Skip to content

Commit

Permalink
Fix null accelerometer sensor
Browse files Browse the repository at this point in the history
It appears handleToSensor for Sensor.TYPE_ACCELEROMETER doesn't always return a sensor. Revert back to the old way of doing it, it should work
  • Loading branch information
Frazew committed Jul 25, 2016
1 parent 2b0d784 commit e992592
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public class SystemSensorManagerHook {
public static List<Object> fillSensorLists(ArrayList<Sensor> fullSensorList, SparseArray<Sensor> handleToSensor, XC_LoadPackage.LoadPackageParam lpparam) throws IllegalAccessException, InstantiationException, InvocationTargetException {
Iterator<Sensor> iterator = fullSensorList.iterator();

int minDelayAccelerometer = handleToSensor.get(Sensor.TYPE_ACCELEROMETER).getMinDelay();

int minDelayAccelerometer = 0;
while (iterator.hasNext()) {
Sensor sensor = iterator.next();
if (XposedMod.sensorsToEmulate.indexOfKey(sensor.getType()) >= 0) {
XposedMod.sensorsToEmulate.get(sensor.getType()).alreadyThere = true;
}
if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) minDelayAccelerometer = sensor.getMinDelay();
}

XposedHelpers.findConstructorBestMatch(Sensor.class).setAccessible(true);
Expand Down

0 comments on commit e992592

Please sign in to comment.