mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-21 21:20:00 +00:00
Minor changes
This commit is contained in:
@@ -55,11 +55,11 @@ public class DelegateApplication extends Application {
|
||||
ClassLoader cl = new DynamicClassLoader(MANAGER_APK, factory.loader);
|
||||
try {
|
||||
// Create the delegate AppComponentFactory
|
||||
Object df = cl.loadClass("a.a").newInstance();
|
||||
AppComponentFactory df = (AppComponentFactory) cl.loadClass("a.a").newInstance();
|
||||
|
||||
// Create the delegate Application
|
||||
delegate = (Application) cl.loadClass("a.e").getConstructor(Object.class)
|
||||
.newInstance(DynAPK.pack(Mapping.data));
|
||||
.newInstance(DynAPK.pack(Mapping.data()));
|
||||
|
||||
// Call attachBaseContext without ContextImpl to show it is being wrapped
|
||||
Method m = ContextWrapper.class.getDeclaredMethod("attachBaseContext", Context.class);
|
||||
@@ -67,7 +67,7 @@ public class DelegateApplication extends Application {
|
||||
m.invoke(delegate, this);
|
||||
|
||||
// If everything went well, set our loader and delegate
|
||||
factory.delegate = (AppComponentFactory) df;
|
||||
factory.delegate = df;
|
||||
factory.loader = cl;
|
||||
} catch (Exception e) {
|
||||
Log.e(getClass().getSimpleName(), "", e);
|
||||
|
@@ -8,22 +8,8 @@ import static com.topjohnwu.magisk.DynAPK.Data;
|
||||
public class Mapping {
|
||||
private static Map<String, String> map = new HashMap<>();
|
||||
|
||||
// This mapping will be sent into the guest app
|
||||
public static Data data = new Data();
|
||||
|
||||
static {
|
||||
map.put(a.z.class.getName(), "a.c");
|
||||
map.put("a.x", "a.f");
|
||||
map.put("a.o", "a.b");
|
||||
map.put("a.g", "a.m");
|
||||
map.put(a.w.class.getName(), "a.h");
|
||||
map.put("a.v", "a.j");
|
||||
map.put("a.j", "androidx.work.impl.background.systemjob.SystemJobService");
|
||||
|
||||
data.componentMap = new HashMap<>(map.size());
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
data.componentMap.put(e.getValue(), e.getKey());
|
||||
}
|
||||
map.put("a.x", "androidx.work.impl.background.systemjob.SystemJobService");
|
||||
}
|
||||
|
||||
public static String get(String name) {
|
||||
@@ -31,4 +17,14 @@ public class Mapping {
|
||||
return n != null ? n : name;
|
||||
}
|
||||
|
||||
public static Data data() {
|
||||
Map<String, String> componentMap = new HashMap<>(map.size());
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
componentMap.put(e.getValue(), e.getKey());
|
||||
}
|
||||
Data data = new Data();
|
||||
data.componentMap = componentMap;
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user