Introduce ASensor_getHandle API to Sensors NDK
Adds the ASensor_getHandle API to the Sensors NDK which returns a
sensors internal sensor handle.
Bug: 122366555
Test: Builds, verified function returns correct handle
Change-Id: I1358528d2e7ee2918d5f5c2195d51adaa2cc3661
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index 8e58210..c3b2e25 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -342,3 +342,8 @@
RETURN_IF_SENSOR_IS_NULL(ASENSOR_DIRECT_RATE_STOP);
return static_cast<Sensor const *>(sensor)->getHighestDirectReportRateLevel();
}
+
+int ASensor_getHandle(ASensor const* sensor) {
+ RETURN_IF_SENSOR_IS_NULL(ASENSOR_INVALID);
+ return static_cast<Sensor const*>(sensor)->getHandle();
+}