Skip to content

Commit 58f762c

Browse files
author
维术
committed
[New]: Initial commit with exposed support.
1 parent 5efeaa9 commit 58f762c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

VirtualApp/lib/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ android {
3535

3636
dependencies {
3737
compile fileTree(include: ['*.jar'], dir: 'libs')
38+
compile 'me.weishu.exposed:exposed-core:0.2.2'
3839
}

VirtualApp/lib/src/main/java/com/lody/virtual/client/VClientImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.util.List;
5858
import java.util.Map;
5959

60+
import me.weishu.exposed.ExposedBridge;
6061
import mirror.android.app.ActivityThread;
6162
import mirror.android.app.ActivityThreadNMR1;
6263
import mirror.android.app.ContextImpl;
@@ -293,7 +294,19 @@ private void bindApplicationNoCheck(String packageName, String processName, Cond
293294
if (!conflict) {
294295
InvocationStubManager.getInstance().checkEnv(AppInstrumentation.class);
295296
}
297+
298+
ClassLoader originClassLoader = context.getClassLoader();
299+
ExposedBridge.initOnce(context, data.appInfo, originClassLoader);
300+
List<InstalledAppInfo> modules = VirtualCore.get().getInstalledApps(0);
301+
for (InstalledAppInfo module : modules) {
302+
ExposedBridge.loadModule(module.apkPath, module.getOdexFile().getParent(), module.libPath,
303+
data.appInfo, originClassLoader);
304+
}
305+
296306
mInitialApplication = LoadedApk.makeApplication.call(data.info, false, null);
307+
308+
ExposedBridge.patchAppClassLoader(context);
309+
297310
mirror.android.app.ActivityThread.mInitialApplication.set(mainThread, mInitialApplication);
298311
ContextFixer.fixContext(mInitialApplication);
299312
if (Build.VERSION.SDK_INT >= 24 && "com.tencent.mm:recovery".equals(processName)) {

0 commit comments

Comments
 (0)