File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
app/src/main/java/com/mj/android_note/module/plugins Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments