Wi-Fi Aware

The Wi-Fi Aware feature in the Android 8.1 (O MR1) release enables supporting devices to connect to one another directly over Wi-Fi without internet or cellular network access. This feature, built upon the Wi-Fi Alliance Wi-Fi Aware specification (version 2.0), allows easy sharing of high-throughput data among trusted devices and apps that are otherwise off network.

Examples and source

To use this feature, device manufacturers should implement the Wi-Fi Hardware Interface Design Language (HIDL) provided in the Android Open Source Project (AOSP). In the Android 8.0 (O) release, HIDL replaces the previous Hardware Abstraction Layer (HAL) structure used in order to streamline implementations by specifying types and method calls collected into interfaces and packages.

Follow the Wi-Fi HIDL to employ the Wi-Fi aware feature: hardware/interfaces/wifi/1.0. The Wi-Fi Aware HAL surface is very large; the hardware/interfaces/wifi/1.0/README-NAN.md file describes the subset which is currently in use.

You may reference the legacy Wi-Fi HAL to see how it correlates with the new HIDL interface: hardware/libhardware_legacy/+/master/include/hardware_legacy/wifi_nan.h.

Implementation

Device manufacturers need to provide both framework and HAL/firmware support:

  • Framework:
    • AOSP code
    • Enable Aware: requires both a feature flag and an HIDL build flag
  • Wi-Fi Aware (NAN) HAL support (which implies firmware support)

To implement this feature, device manufacturers implement the Wi-Fi HIDL and also enable two feature flags:

In BoardConfig.mk, add this flag to tell the Wi-Fi HIDL to include the Wi-Fi Aware feature: WIFI_HIDL_FEATURE_AWARE := true

And in device.mk, modify the PRODUCT_COPY_FILES environment variable to include support for the Wi-Fi Aware feature: PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.wifi.aware.xml:system/etc/permissions/android.hardware.wifi.aware.xml

Otherwise, everything required for this feature is included in AOSP.

Validation

Android Compatibility Test Suite (CTS) tests exist for this feature. CTS detects when the feature is enabled and automatically includes the associated tests.

This feature can also be tested using the Vendor Test Suite (VTS) and acts/sl4a, a test suite that conducts extensive integration testing.

The acts/sl4a test suite, described in tools/test/connectivity/acts/tests/google/wifi/aware/README.md, provides functional, performance, and stress tests.