mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-21 10:29:20 +00:00
More complete stub sources
This commit is contained in:
@@ -37,7 +37,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
|
||||
public Activity instantiateActivity(ClassLoader cl, String className, Intent intent)
|
||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
if (delegate != null)
|
||||
return delegate.instantiateActivity(loader, className, intent);
|
||||
return delegate.instantiateActivity(loader, Mapping.get(className), intent);
|
||||
return create(className, DownloadActivity::new);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
|
||||
public BroadcastReceiver instantiateReceiver(ClassLoader cl, String className, Intent intent)
|
||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
if (delegate != null)
|
||||
return delegate.instantiateReceiver(loader, className, intent);
|
||||
return delegate.instantiateReceiver(loader, Mapping.get(className), intent);
|
||||
return create(className, DummyReceiver::new);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
|
||||
public Service instantiateService(ClassLoader cl, String className, Intent intent)
|
||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
if (delegate != null)
|
||||
return delegate.instantiateService(loader, className, intent);
|
||||
return delegate.instantiateService(loader, Mapping.get(className), intent);
|
||||
return create(className, DummyService::new);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DelegateComponentFactory extends AppComponentFactory {
|
||||
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
if (loader == null) loader = cl;
|
||||
if (delegate != null)
|
||||
return delegate.instantiateProvider(loader, className);
|
||||
return delegate.instantiateProvider(loader, Mapping.get(className));
|
||||
return create(className, DummyProvider::new);
|
||||
}
|
||||
|
||||
@@ -76,4 +76,5 @@ public class DelegateComponentFactory extends AppComponentFactory {
|
||||
return factory.create();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,10 +11,8 @@ import com.topjohnwu.magisk.utils.DynamicClassLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InjectAPK {
|
||||
|
||||
@@ -70,8 +68,7 @@ public class InjectAPK {
|
||||
private static DynAPK.Data dynData() {
|
||||
DynAPK.Data data = new DynAPK.Data();
|
||||
data.version = BuildConfig.STUB_VERSION;
|
||||
// Public source code does not do component name obfuscation
|
||||
data.classToComponent = new HashMap<>();
|
||||
data.classToComponent = Mapping.inverseMap;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
31
stub/src/main/java/com/topjohnwu/magisk/Mapping.java
Normal file
31
stub/src/main/java/com/topjohnwu/magisk/Mapping.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Mapping {
|
||||
|
||||
private static Map<String, String> map = new HashMap<>();
|
||||
public static Map<String, String> inverseMap;
|
||||
|
||||
static {
|
||||
map.put("a.Qzw", "a.e");
|
||||
map.put("a.u7", "a.c");
|
||||
map.put("a.ii", "a.p");
|
||||
map.put("a.r", "a.h");
|
||||
map.put("xt.R", "a.b");
|
||||
map.put("lt5.a", "a.m");
|
||||
map.put("d.s", "a.j");
|
||||
map.put("w.d", "androidx.work.impl.background.systemjob.SystemJobService");
|
||||
|
||||
inverseMap = new HashMap<>(map.size());
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
inverseMap.put(e.getValue(), e.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public static String get(String name) {
|
||||
String n = map.get(name);
|
||||
return n != null ? n : name;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user