diff options
author | Aravind Akella <aakella@google.com> | 2014-08-05 15:02:11 -0700 |
---|---|---|
committer | Aravind Akella <aakella@google.com> | 2014-08-05 19:34:04 -0700 |
commit | 99fe16508200510e3d8ea2e3c34872be8cce826d (patch) | |
tree | 64f2c001356aa78c883f338230b45e2e0c33a410 /native | |
parent | 66b9e91801ba8867514fbcf0ef8f03a2f4fb8798 (diff) | |
download | frameworks_base-99fe16508200510e3d8ea2e3c34872be8cce826d.zip frameworks_base-99fe16508200510e3d8ea2e3c34872be8cce826d.tar.gz frameworks_base-99fe16508200510e3d8ea2e3c34872be8cce826d.tar.bz2 |
Sensor related changes for NDK.
i) Add ASensor_isWakeUpSensor and ASensorManager_getDefaultSensorEx
methods.
Bug: 16399898
Change-Id: Icc252aad068fa337bef8b22f20584f98cd5a155d
Diffstat (limited to 'native')
-rw-r--r-- | native/android/sensor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp index b09bc2e..73b52aa 100644 --- a/native/android/sensor.cpp +++ b/native/android/sensor.cpp @@ -59,6 +59,19 @@ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type return static_cast<SensorManager*>(manager)->getDefaultSensor(type); } +ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, + int type, bool wakeUp) { + Sensor const* const* sensorList; + size_t size = static_cast<SensorManager*>(manager)->getSensorList(&sensorList); + for (size_t i = 0; i < size; ++i) { + if (ASensor_getType(sensorList[i]) == type && + ASensor_isWakeUpSensor(sensorList[i]) == wakeUp) { + return reinterpret_cast<ASensor const *>(sensorList[i]); + } + } + return NULL; +} + ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data) { @@ -176,3 +189,8 @@ int ASensor_getReportingMode(ASensor const* sensor) { return static_cast<Sensor const*>(sensor)->getReportingMode(); } + +bool ASensor_isWakeUpSensor(ASensor const* sensor) +{ + return static_cast<Sensor const*>(sensor)->isWakeUpSensor(); +}
\ No newline at end of file |