Add advanced Build classes field logging

Co-authored-by: Nicholas Bissell <thefreeman193@hotmail.com>
This commit is contained in:
osm0sis
2024-01-13 13:38:18 -04:00
parent 21a309dd12
commit 24db525cf3

View File

@@ -23,6 +23,7 @@ public final class EntryPoint {
public static void init() {
spoofProvider();
spoofDevice();
if (verboseLogs > 99) logFields();
}
public static void readJson(String data) {
@@ -141,6 +142,27 @@ public final class EntryPoint {
LOG(String.format("[%s]: %s -> %s", name, oldValue, value));
}
private static String logParseField(Field field) {
Object value = null;
String type = field.getType().getName();
String name = field.getName();
try {
value = field.get(null);
} catch (IllegalAccessException|NullPointerException e) {
return String.format("Couldn't access '%s' field value: " + e, name);
}
return String.format("<%s> %s: %s", type, name, String.valueOf(value));
}
private static void logFields() {
for (Field field : Build.class.getDeclaredFields()) {
LOG("Build " + logParseField(field));
}
for (Field field : Build.VERSION.class.getDeclaredFields()) {
LOG("Build.VERSION " + logParseField(field));
}
}
static void LOG(String msg) {
Log.d("PIF/Java", msg);
}