diff options
author | Aravind Akella <aakella@google.com> | 2015-06-30 18:02:45 -0700 |
---|---|---|
committer | Aravind Akella <aakella@google.com> | 2015-06-30 18:02:45 -0700 |
commit | b02e6050bd8f250d52d59e7fe2096dd420cec730 (patch) | |
tree | 90b23096ead59081a551a3a71a3585b60696ebfc /core/java | |
parent | 3a0d77f42aa8bbc3e3f81bb80a55324fc686e2a7 (diff) | |
download | frameworks_base-b02e6050bd8f250d52d59e7fe2096dd420cec730.zip frameworks_base-b02e6050bd8f250d52d59e7fe2096dd420cec730.tar.gz frameworks_base-b02e6050bd8f250d52d59e7fe2096dd420cec730.tar.bz2 |
Fix for last sensor missing from sensor list returned by the HAL.
Bug: 22072216
Change-Id: I39a422fb80adcd348ff9c10bf3d3f19ab569a0af
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/hardware/SystemSensorManager.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/java/android/hardware/SystemSensorManager.java b/core/java/android/hardware/SystemSensorManager.java index d7960af..f218528 100644 --- a/core/java/android/hardware/SystemSensorManager.java +++ b/core/java/android/hardware/SystemSensorManager.java @@ -85,15 +85,14 @@ public class SystemSensorManager extends SensorManager { // initialize the sensor list int i = 0; - while(true) { + do { Sensor sensor = new Sensor(); i = nativeGetNextSensor(mNativeInstance, sensor, i); - if (i <= 0) { - break; + if (i >= 0) { + mFullSensorsList.add(sensor); + mHandleToSensor.append(sensor.getHandle(), sensor); } - mFullSensorsList.add(sensor); - mHandleToSensor.append(sensor.getHandle(), sensor); - } + } while (i > 0); } |