Skip to content

Commit 8e16927

Browse files
committed
VirutalApp: add Hook class UML
1 parent e19d1dc commit 8e16927

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

VAHook.puml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
@startuml
2+
3+
interface IBinder
4+
5+
abstract class Hook {
6+
getName()
7+
beforeHook
8+
onHook
9+
afterHook
10+
isEnable
11+
}
12+
13+
interface IHookObject {
14+
void addHook(Hook hook);
15+
removeHook(hookName);
16+
getHook(name);
17+
getProxyObject();
18+
}
19+
20+
class HookObject {
21+
Map<String, Hook> mHookMaps;
22+
mBaseObject;
23+
mProxyObject;
24+
}
25+
26+
class PatchObject {
27+
hookObject
28+
}
29+
30+
class ActivityManagerPatch {
31+
}
32+
33+
interface Injectable {
34+
inject()
35+
isEnvBad()
36+
}
37+
38+
class IInterface {
39+
IBinder asBinder();
40+
}
41+
42+
class IActivityManager {
43+
startActivity()
44+
broadcastIntent()
45+
}
46+
47+
IHookObject <|-- HookObject
48+
HookObject <|-- PatchObject
49+
Injectable <|-- PatchObject
50+
51+
Hook <|-- StartActivity
52+
Hook <|-- BroadcastIntent
53+
54+
IHookObject *-- IInterface
55+
HookObject *-- Hook
56+
ActivityManagerPatch *-- StartActivity
57+
ActivityManagerPatch *-- BroadcastIntent
58+
59+
IBinder <|-- HookBinder
60+
IHookObject <|-- HookBinder
61+
62+
IInterface <|-- IActivityManager
63+
64+
PatchObject <|-- ActivityManagerPatch
65+
66+
class PatchManager {
67+
Map<Class, Injectable> mPatchMaps;
68+
init()
69+
injectAll()
70+
addAllPatches()
71+
addPatch()
72+
addAllPatches()
73+
}
74+
75+
PatchManager *-- ActivityManagerPatch
76+
77+
note top of Hook
78+
该类是对方法的hook,每个Hook对象都对应于一个方法,
79+
如IActivityManager.startActivity
80+
endnote
81+
82+
note top of HookObject
83+
该类对应于一个被hook的类,所有内部都代理了IInterface的某个具体子类,
84+
该类中有一张表,存储了每个被hook的方法的Hook对象.
85+
86+
该类中对接口类使用
87+
Proxy.newProxyInstance
88+
InvocationHandler
89+
endnote
90+
91+
@enduml

0 commit comments

Comments
 (0)