diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3ed9ea51d..32de4b85e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,10 +11,8 @@ + tools:ignore="UnusedAttribute,GoogleAppIndexingWarning"> .cmp(pkg: String): ComponentName { val name = ClassMap[this].name - return ComponentName(pkg, Info.stub?.componentMap?.get(name) ?: name) + return ComponentName(pkg, Info.stub?.classToComponent?.get(name) ?: name) } inline fun Context.intent() = Intent().setComponent(T::class.java.cmp(packageName)) @@ -131,7 +131,7 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler val name = service.className val component = ComponentName( service.packageName, - Info.stub!!.componentMap[name] ?: name) + Info.stub!!.classToComponent[name] ?: name) // Clone the JobInfo except component val builder = JobInfo.Builder(id, component) diff --git a/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java b/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java index 03b44e9e7..3a397290f 100644 --- a/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java +++ b/shared/src/main/java/com/topjohnwu/magisk/DynAPK.java @@ -15,7 +15,7 @@ public class DynAPK { // Indices of the object array private static final int STUB_VERSION_ENTRY = 0; - private static final int COMPONENT_MAP = 1; + private static final int CLASS_COMPONENT_MAP = 1; private static File dynDir; private static Method addAssetPath; @@ -44,14 +44,14 @@ public class DynAPK { Object[] arr = (Object[]) o; Data data = new Data(); data.version = (int) arr[STUB_VERSION_ENTRY]; - data.componentMap = (Map) arr[COMPONENT_MAP]; + data.classToComponent = (Map) arr[CLASS_COMPONENT_MAP]; return data; } public static Object pack(Data data) { Object[] arr = new Object[2]; arr[STUB_VERSION_ENTRY] = data.version; - arr[COMPONENT_MAP] = data.componentMap; + arr[CLASS_COMPONENT_MAP] = data.classToComponent; return arr; } @@ -65,6 +65,6 @@ public class DynAPK { public static class Data { public int version = STUB_VERSION; - public Map componentMap; + public Map classToComponent; } } diff --git a/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java b/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java index 30d7b89ca..c6b808802 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java +++ b/stub/src/main/java/com/topjohnwu/magisk/DelegateApplication.java @@ -19,12 +19,12 @@ public class DelegateApplication extends Application { static File MANAGER_APK; - private Object factory; + private DelegateComponentFactory factory; private Application delegate; public DelegateApplication() {} - public DelegateApplication(Object o) { + public DelegateApplication(DelegateComponentFactory o) { factory = o; } @@ -46,7 +46,6 @@ public class DelegateApplication extends Application { @SuppressLint("NewApi") private void setUpDynAPK() { - DelegateComponentFactory factory = (DelegateComponentFactory) this.factory; MANAGER_APK = DynAPK.current(this); File update = DynAPK.update(this); if (update.exists()) @@ -55,7 +54,8 @@ public class DelegateApplication extends Application { ClassLoader cl = new DynamicClassLoader(MANAGER_APK, factory.loader); try { // Create the delegate AppComponentFactory - AppComponentFactory df = (AppComponentFactory) cl.loadClass("a.a").newInstance(); + AppComponentFactory df = (AppComponentFactory) + cl.loadClass("androidx.core.app.CoreComponentFactory").newInstance(); // Create the delegate Application delegate = (Application) cl.loadClass("a.e").getConstructor(Object.class) diff --git a/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java b/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java index 9e8a91933..5b781d80e 100644 --- a/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java +++ b/stub/src/main/java/com/topjohnwu/magisk/obfuscate/Mapping.java @@ -29,8 +29,7 @@ public class Mapping { public static Data data() { Data data = new Data(); - data.componentMap = inverseMap; + data.classToComponent = inverseMap; return data; } - }