Reputation: 75
I recently installed this RTT-Manager-App on my Smartphone, mainly to find out if my device and the available Access Points support the IEEE 802.11mc standard.
However as soon as I start the app, it crashes. This is caused by a NullPointerException on the WifiRttManager instance. I then set up a tiny App which only contains this code in it's MainActivity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WifiRttManager rttManager = (WifiRttManager) getBaseContext().getSystemService(Context.WIFI_RTT_RANGING_SERVICE);
rttManager.isAvailable();
}
This results in the same error:
Unable to start activity ComponentInfo{...MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.wifi.rtt.WifiRttManager.isAvailable()' on a null object reference
WifiRttManager requires both Android P as well as a CPU that supports 802.11mc (such as Qualcomm Snapdragon 820 CPU, as stated by the author of the before mentioned RTT-Manager-App).
I first tried running the app on a OnePlus X (Android P and Qualcomm Snapdragon 801) where it crashed, so I thought that the CPU did not support 802.11mc.
However I then also tried running it on a OnePlus 6T (Android P and Qualcomm Snapdragon 845) where it crashed just the same.
What else could be the reason for getSystemService(Context.WIFI_RTT_RANGING_SERVICE) always returning null?
Upvotes: 1
Views: 1216
Reputation: 51
It seems like your phone needs to be enabled to support wirirtt. According to the google document, https://source.android.com/devices/tech/connect/wifi-rtt
To implement Wi-Fi RTT, you must provide both framework and HAL/firmware support:
Framework:
AOSP code Enable Wi-Fi RTT: requires a feature flag Wi-Fi RTT (IEEE 802.11mc) HAL support (which implies firmware support)
To implement this feature, implement the Wi-Fi HIDL and enable the feature flag:
In device.mk located in device//, modify the PRODUCT_COPY_FILES environment variable to include support for the Wi-Fi RTT feature:
PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.wifi.rtt.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.rtt.xml
Otherwise, everything required for this feature is included in AOSP.
Upvotes: 1