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. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
-keepclassmembers class * implements javax.net.ssl.SSLSocketFactory { -keepclassmembers class * extends javax.net.ssl.SSLSocketFactory {
** delegate; ** delegate;
} }

View File

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

View File

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

View File

@ -2,5 +2,5 @@ package a;
import com.topjohnwu.magisk.DelegateComponentFactory; 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; 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; 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; 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); ClassLoader cl = new DynamicClassLoader(MANAGER_APK, factory.loader);
try { try {
// Create the delegate AppComponentFactory // Create the delegate AppComponentFactory
Object df = cl.loadClass("a.a").newInstance(); AppComponentFactory df = (AppComponentFactory) cl.loadClass("a.a").newInstance();
// Create the delegate Application // Create the delegate Application
delegate = (Application) cl.loadClass("a.e").getConstructor(Object.class) 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 // Call attachBaseContext without ContextImpl to show it is being wrapped
Method m = ContextWrapper.class.getDeclaredMethod("attachBaseContext", Context.class); Method m = ContextWrapper.class.getDeclaredMethod("attachBaseContext", Context.class);
@ -67,7 +67,7 @@ public class DelegateApplication extends Application {
m.invoke(delegate, this); m.invoke(delegate, this);
// If everything went well, set our loader and delegate // If everything went well, set our loader and delegate
factory.delegate = (AppComponentFactory) df; factory.delegate = df;
factory.loader = cl; factory.loader = cl;
} catch (Exception e) { } catch (Exception e) {
Log.e(getClass().getSimpleName(), "", e); Log.e(getClass().getSimpleName(), "", e);

View File

@ -8,22 +8,8 @@ import static com.topjohnwu.magisk.DynAPK.Data;
public class Mapping { public class Mapping {
private static Map<String, String> map = new HashMap<>(); private static Map<String, String> map = new HashMap<>();
// This mapping will be sent into the guest app
public static Data data = new Data();
static { static {
map.put(a.z.class.getName(), "a.c"); map.put("a.x", "androidx.work.impl.background.systemjob.SystemJobService");
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());
}
} }
public static String get(String name) { public static String get(String name) {
@ -31,4 +17,14 @@ public class Mapping {
return n != null ? n : name; 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;
}
} }