Minor changes

This commit is contained in:
topjohnwu 2019-10-30 04:15:53 -04:00
parent fdf04f77f2
commit dc9f69bab0
9 changed files with 30 additions and 34 deletions

View File

@ -20,6 +20,6 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keepclassmembers class * implements javax.net.ssl.SSLSocketFactory {
-keepclassmembers class * extends javax.net.ssl.SSLSocketFactory {
** delegate;
}

View File

@ -50,7 +50,7 @@ public class DynAPK {
public static Object pack(Data data) {
Object[] arr = new Object[2];
arr[STUB_VERSION_ENTRY] = STUB_VERSION;
arr[STUB_VERSION_ENTRY] = data.version;
arr[COMPONENT_MAP] = data.componentMap;
return arr;
}
@ -64,7 +64,7 @@ public class DynAPK {
}
public static class Data {
public int version;
public int version = STUB_VERSION;
public Map<String, String> componentMap;
}
}

View File

@ -16,8 +16,8 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name="a.y"
android:appComponentFactory="a.x"
android:name="a.e"
android:appComponentFactory="a.a"
android:allowBackup="true"
android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute,GoogleAppIndexingWarning" >
@ -25,7 +25,7 @@
<!-- Download Activity -->
<activity
android:name="a.z"
android:name="a.c"
android:configChanges="orientation|screenSize"
android:theme="@style/SplashTheme">
<intent-filter>
@ -37,24 +37,24 @@
<!-- Magisk Manager Components -->
<activity
android:name="a.o"
android:name="a.b"
android:configChanges="orientation|screenSize"
android:exported="true" />
<activity
android:name="a.x"
android:name="a.f"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="nosensor" />
<activity
android:name="a.g"
android:name="a.m"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:directBootAware="true"
android:excludeFromRecents="true"
android:exported="false" />
<receiver
android:name="a.w"
android:name="a.h"
android:directBootAware="true">
<intent-filter>
<action android:name="android.intent.action.REBOOT" />
@ -70,7 +70,7 @@
</receiver>
<service
android:name="a.v"
android:name="a.j"
android:exported="false" />
<meta-data
@ -80,7 +80,7 @@
<!-- WorkManager SystemJobService -->
<service
android:name="a.j"
android:name="a.x"
android:directBootAware="false"
android:enabled="true"
android:exported="true"

View File

@ -2,5 +2,5 @@ package a;
import com.topjohnwu.magisk.DelegateComponentFactory;
public class x extends DelegateComponentFactory {
public class a extends DelegateComponentFactory {
}

View File

@ -2,5 +2,5 @@ package a;
import com.topjohnwu.magisk.DownloadActivity;
public class z extends DownloadActivity {
public class c extends DownloadActivity {
}

View File

@ -2,5 +2,5 @@ package a;
import com.topjohnwu.magisk.DelegateApplication;
public class y extends DelegateApplication {
public class e extends DelegateApplication {
}

View File

@ -2,5 +2,5 @@ package a;
import com.topjohnwu.magisk.dummy.DummyReceiver;
public class w extends DummyReceiver {
public class h extends DummyReceiver {
}

View File

@ -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);

View File

@ -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;
}
}