Skip to content

Commit 868b58e

Browse files
committed
Fixed the minimum SDK checks
(Prepare for version 1.31, hotfix)
1 parent 2384831 commit 868b58e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "fr.frazew.virtualgyroscope"
99
minSdkVersion 16
1010
targetSdkVersion 23
11-
versionCode 130
12-
versionName "1.3"
11+
versionCode 131
12+
versionName "1.31"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/fr/frazew/virtualgyroscope/XposedMod.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public class XposedMod implements IXposedHookLoadPackage {
3333
}};
3434

3535
public static final SparseArray<SensorModel> sensorsToEmulate = new SparseArray<SensorModel>() {{
36-
append(Sensor.TYPE_ROTATION_VECTOR, new SensorModel(Sensor.TYPE_ROTATION_VECTOR, "VirtualSensor RotationVector", sensorTypetoHandle.get(Sensor.TYPE_ROTATION_VECTOR), 0.01F, -1, -1, (Build.VERSION.SDK_INT >= 19) ? Sensor.STRING_TYPE_ROTATION_VECTOR : "", "none"));
37-
append(Sensor.TYPE_GYROSCOPE, new SensorModel(Sensor.TYPE_GYROSCOPE, "VirtualSensor Gyroscope", sensorTypetoHandle.get(Sensor.TYPE_GYROSCOPE), 0.01F, -1, (float) Math.PI, (Build.VERSION.SDK_INT >= 19) ? Sensor.STRING_TYPE_GYROSCOPE : "", "android.hardware.sensor.gyroscope"));
38-
if (Build.VERSION.SDK_INT >= 19) append(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR, new SensorModel(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR, "VirtualSensor GeomagneticRotationVector", sensorTypetoHandle.get(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR), 0.01F, -1, -1, (Build.VERSION.SDK_INT >= 19) ? Sensor.STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR : "", "none"));
39-
append(Sensor.TYPE_GRAVITY, new SensorModel(Sensor.TYPE_GRAVITY, "VirtualSensor Gravity", sensorTypetoHandle.get(Sensor.TYPE_GRAVITY), 0.01F, -1, -1, (Build.VERSION.SDK_INT >= 19) ? Sensor.STRING_TYPE_GRAVITY : "", "none"));
40-
append(Sensor.TYPE_LINEAR_ACCELERATION, new SensorModel(Sensor.TYPE_LINEAR_ACCELERATION, "VirtualSensor LinearAcceleration", sensorTypetoHandle.get(Sensor.TYPE_LINEAR_ACCELERATION), 0.01F, -1, -1, (Build.VERSION.SDK_INT >= 19) ? Sensor.STRING_TYPE_LINEAR_ACCELERATION : "", "none")); // Had to use another handle as it broke the magnetic sensor's readings (?!)
36+
append(Sensor.TYPE_ROTATION_VECTOR, new SensorModel(Sensor.TYPE_ROTATION_VECTOR, "VirtualSensor RotationVector", sensorTypetoHandle.get(Sensor.TYPE_ROTATION_VECTOR), 0.01F, -1, -1, (Build.VERSION.SDK_INT > 19) ? Sensor.STRING_TYPE_ROTATION_VECTOR : "", "none"));
37+
append(Sensor.TYPE_GYROSCOPE, new SensorModel(Sensor.TYPE_GYROSCOPE, "VirtualSensor Gyroscope", sensorTypetoHandle.get(Sensor.TYPE_GYROSCOPE), 0.01F, -1, (float) Math.PI, (Build.VERSION.SDK_INT > 19) ? Sensor.STRING_TYPE_GYROSCOPE : "", "android.hardware.sensor.gyroscope"));
38+
if (Build.VERSION.SDK_INT >= 19) append(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR, new SensorModel(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR, "VirtualSensor GeomagneticRotationVector", sensorTypetoHandle.get(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR), 0.01F, -1, -1, (Build.VERSION.SDK_INT > 19) ? Sensor.STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR : "", "none"));
39+
append(Sensor.TYPE_GRAVITY, new SensorModel(Sensor.TYPE_GRAVITY, "VirtualSensor Gravity", sensorTypetoHandle.get(Sensor.TYPE_GRAVITY), 0.01F, -1, -1, (Build.VERSION.SDK_INT > 19) ? Sensor.STRING_TYPE_GRAVITY : "", "none"));
40+
append(Sensor.TYPE_LINEAR_ACCELERATION, new SensorModel(Sensor.TYPE_LINEAR_ACCELERATION, "VirtualSensor LinearAcceleration", sensorTypetoHandle.get(Sensor.TYPE_LINEAR_ACCELERATION), 0.01F, -1, -1, (Build.VERSION.SDK_INT > 19) ? Sensor.STRING_TYPE_LINEAR_ACCELERATION : "", "none")); // Had to use another handle as it broke the magnetic sensor's readings (?!)
4141
}};
4242

4343
@Override

app/src/main/java/fr/frazew/virtualgyroscope/hooks/SystemSensorManagerHook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static List<Object> fillSensorLists(ArrayList<Sensor> fullSensorList, Spa
4040
XposedHelpers.findField(Sensor.class, "mResolution").setAccessible(true);
4141
XposedHelpers.findField(Sensor.class, "mMinDelay").setAccessible(true);
4242
XposedHelpers.findField(Sensor.class, "mMaxRange").setAccessible(true);
43-
XposedHelpers.findField(Sensor.class, "mStringType").setAccessible(true);
43+
if (Build.VERSION.SDK_INT > 19) XposedHelpers.findField(Sensor.class, "mStringType").setAccessible(true);
4444
XposedHelpers.findField(Sensor.class, "mRequiredPermission").setAccessible(true);
4545

4646
for (int i = 0; i < XposedMod.sensorsToEmulate.size(); i++) {
@@ -53,7 +53,7 @@ public static List<Object> fillSensorLists(ArrayList<Sensor> fullSensorList, Spa
5353
XposedHelpers.setObjectField(s, "mVersion", BuildConfig.VERSION_CODE);
5454
XposedHelpers.setObjectField(s, "mHandle", model.handle);
5555
XposedHelpers.setObjectField(s, "mMinDelay", model.minDelay == -1 ? minDelayAccelerometer : model.minDelay);
56-
if (Build.VERSION.SDK_INT >= 19)
56+
if (Build.VERSION.SDK_INT > 19)
5757
XposedHelpers.setObjectField(s, "mStringType", model.stringType);
5858
XposedHelpers.setObjectField(s, "mResolution", model.resolution == -1 ? 0.01F : model.resolution); // This 0.01F is a placeholder, it doesn't seem to change anything but I keep it
5959
if (model.maxRange != -1)

0 commit comments

Comments
 (0)