Skip to content

Instantly share code, notes, and snippets.

@solohsu
Last active February 19, 2019 18:06
Show Gist options
  • Save solohsu/ecc07141759958fc096ba0781fac0a5f to your computer and use it in GitHub Desktop.
Save solohsu/ecc07141759958fc096ba0781fac0a5f to your computer and use it in GitHub Desktop.
OnePlus Android Pie bootloop
public static boolean inCompatConfigList(int type, String verifyStr) {
try {
return getPackageManager().inCompatConfigList(type, verifyStr);
} catch (Exception e) {
return false;
} catch (LinkageError e2) {
return false;
}
}
protected Class<?> findClass(String name) throws ClassNotFoundException {
List<Throwable> suppressedExceptions = new ArrayList();
Class c = this.pathList.findClass(name, suppressedExceptions);
if (c != null) {
return c;
}
if (h2Status == 0) {
h2Status = "CN".equals(SystemProperties_get("persist.sys.oem.region", "null")) ? 1 : 2;
}
if (h2Status == 1 && !inCompatConfigList(15, currentPackageName())) {
boolean apache = false;
for (String path : this.pathList.getDexPaths()) {
if (ORG_APACHE_HTTP_LEGACY_PATH.equals(path)) {
apache = true;
break;
}
}
if (!apache) {
c = findApacheClass(name);
if (c != null) {
return c;
}
}
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Didn't find class \"");
stringBuilder.append(name);
stringBuilder.append("\" on path: ");
stringBuilder.append(this.pathList);
ClassNotFoundException cnfe = new ClassNotFoundException(stringBuilder.toString());
for (Throwable t : suppressedExceptions) {
cnfe.addSuppressed(t);
}
throw cnfe;
}
private static boolean inCompatConfigList(int type, String verifyStr) {
PrintStream printStream;
StringBuilder stringBuilder;
boolean value = false;
try {
Class tClass = Class.forName("android.app.ActivityThread");
Method get = tClass.getMethod("inCompatConfigList", new Class[]{Integer.TYPE, String.class});
if (get != null) {
value = ((Boolean) get.invoke(tClass, new Object[]{Integer.valueOf(type), verifyStr})).booleanValue();
}
} catch (Error e) {
printStream = System.out;
stringBuilder = new StringBuilder();
stringBuilder.append("inCompatConfigList: ");
stringBuilder.append(e);
printStream.println(stringBuilder.toString());
} catch (Exception e2) {
printStream = System.out;
stringBuilder = new StringBuilder();
stringBuilder.append("inCompatConfigList: ");
stringBuilder.append(e2);
printStream.println(stringBuilder.toString());
}
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment