You've already forked PlayIntegrityFork
mirror of
https://github.com/osm0sis/PlayIntegrityFork.git
synced 2025-09-06 06:37:06 +00:00
Add missing support for Boolean and Long fields (#4)
e.g. IS_TREBLE_ENABLED, IS_DEBUGGABLE and TIME Reference: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/Build.java
This commit is contained in:
@@ -91,6 +91,7 @@ public final class EntryPoint {
|
|||||||
|
|
||||||
Field field = null;
|
Field field = null;
|
||||||
String oldValue = null;
|
String oldValue = null;
|
||||||
|
Object newValue = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (classContainsField(Build.class, name)) {
|
if (classContainsField(Build.class, name)) {
|
||||||
@@ -116,12 +117,21 @@ public final class EntryPoint {
|
|||||||
LOG(String.format("[%s]: already '%s', skipping...", name, value));
|
LOG(String.format("[%s]: already '%s', skipping...", name, value));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Class<?> fieldType = field.getType();
|
||||||
|
if (fieldType == String.class) {
|
||||||
|
newValue = value;
|
||||||
|
} else if (fieldType == int.class) {
|
||||||
|
newValue = Integer.parseInt(value);
|
||||||
|
} else if (fieldType == long.class) {
|
||||||
|
newValue = Long.parseLong(value);
|
||||||
|
} else if (fieldType == boolean.class) {
|
||||||
|
newValue = Boolean.parseBoolean(value);
|
||||||
|
} else {
|
||||||
|
LOG(String.format("Couldn't convert '%s' to '%s' type", value, fieldType));
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (field.getType().equals(Integer.TYPE)) {
|
field.set(null, newValue);
|
||||||
field.set(null, Integer.parseInt(value));
|
|
||||||
} else {
|
|
||||||
field.set(null, value);
|
|
||||||
}
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
LOG(String.format("Couldn't modify '%s' field value: " + e, name));
|
LOG(String.format("Couldn't modify '%s' field value: " + e, name));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user