Fix a possible race condition in SensorManager initialization.
Bug: 24526176 Change-Id: Ib8bae6eee16a5b787d3c2da6ef03af311cfdfadc
This commit is contained in:
@@ -78,14 +78,14 @@ public class SystemSensorManager extends SensorManager {
|
||||
sSensorModuleInitialized = true;
|
||||
nativeClassInit();
|
||||
}
|
||||
}
|
||||
|
||||
// initialize the sensor list
|
||||
for (int index = 0;;++index) {
|
||||
Sensor sensor = new Sensor();
|
||||
if (!nativeGetSensorAtIndex(mNativeInstance, sensor, index)) break;
|
||||
mFullSensorsList.add(sensor);
|
||||
mHandleToSensor.append(sensor.getHandle(), sensor);
|
||||
// initialize the sensor list
|
||||
for (int index = 0;;++index) {
|
||||
Sensor sensor = new Sensor();
|
||||
if (!nativeGetSensorAtIndex(mNativeInstance, sensor, index)) break;
|
||||
mFullSensorsList.add(sensor);
|
||||
mHandleToSensor.append(sensor.getHandle(), sensor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user