Skip to content

Commit 14f0f71

Browse files
author
mj
committed
增加pluginMaager
1 parent 2ae0001 commit 14f0f71

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.mj.android_note.module.plugins;
2+
3+
import android.content.Context;
4+
5+
import dalvik.system.DexClassLoader;
6+
7+
/**
8+
* Author : MJ
9+
* Date : 2020-03-04--15:47
10+
11+
* Description : 插件加载器
12+
*/
13+
public class PluginManager {
14+
15+
16+
public static void loadApk(Context context, String apkPath) {
17+
// 加载插件class到宿主
18+
loadClassToMainApk(context, apkPath);
19+
// 加载插件的Resource到宿主
20+
loadResourceToMainApk(context, apkPath);
21+
// hook宿主中的Intent
22+
hook();
23+
}
24+
25+
private static void hook() {
26+
27+
}
28+
29+
private static void loadResourceToMainApk(Context context, String apkPath) {
30+
DexClassLoader dexClassLoader = new DexClassLoader(
31+
apkPath,
32+
context.getCacheDir().getAbsolutePath(),
33+
null,
34+
context.getClassLoader());
35+
}
36+
37+
private static void loadClassToMainApk(Context context, String apkPath) {
38+
39+
}
40+
41+
}

0 commit comments

Comments
 (0)