13
13
14
14
import java .lang .reflect .AccessibleObject ;
15
15
import java .lang .reflect .Method ;
16
+ import java .util .Arrays ;
16
17
import java .util .Objects ;
18
+ import java .util .stream .Collectors ;
19
+ import java .util .stream .Stream ;
17
20
18
21
import de .robv .android .xposed .IXposedHookLoadPackage ;
19
22
import de .robv .android .xposed .XC_MethodHook ;
22
25
23
26
public class Module implements IXposedHookLoadPackage {
24
27
private static final String TAG = "XposedUniversalAuth" ;
28
+ private static final String STATUS_BAR_CLASS = "com.android.systemui.statusbar.phone.StatusBar" ;
29
+ private static final String SYSTEM_UI_CLASS = "com.android.systemui.SystemUI" ;
25
30
26
31
/**
27
32
* This method is called when an app is loaded. It's called very early, even before
@@ -37,7 +42,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
37
42
if (Objects .equals (lpparam .packageName , "com.android.systemui" )) {
38
43
// Hook com.android.systemui.statusbar.phone.StatusBar.start
39
44
XposedHelpers .findAndHookMethod (
40
- "com.android.systemui.statusbar.phone.StatusBar" ,
45
+ STATUS_BAR_CLASS ,
41
46
lpparam .classLoader ,
42
47
"start" ,
43
48
new XC_MethodHook () {
@@ -55,7 +60,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
55
60
@ Override
56
61
protected void afterHookedMethod (MethodHookParam param ) throws Throwable {
57
62
// XposedBridge.log("FaceUnlock hook pre-install!");
58
- hookStatusBar (param );
63
+ hookStatusBar (lpparam . classLoader , param );
59
64
// XposedBridge.log("FaceUnlock hook installed!");
60
65
}
61
66
}
@@ -68,10 +73,19 @@ private <T extends AccessibleObject> T asAccessible(T a) {
68
73
return a ;
69
74
}
70
75
71
- private void hookStatusBar (XC_MethodHook .MethodHookParam param ) throws Throwable {
76
+ private String dumpArray (Object [] obj ) {
77
+ return dumpStream (Arrays .stream (obj ));
78
+ }
79
+
80
+ private String dumpStream (Stream <Object > stream ) {
81
+ return stream .map (Object ::toString ).collect (Collectors .joining (",\n " ));
82
+ }
83
+
84
+ private void hookStatusBar (ClassLoader classLoader , XC_MethodHook .MethodHookParam param ) throws Throwable {
72
85
Object statusBar = param .thisObject ;
73
- Class <?> statusBarClass = statusBar .getClass ();
74
- Context context = (Context ) asAccessible (statusBarClass .getField ("mContext" )).get (statusBar );
86
+ Class <?> systemUiClass = classLoader .loadClass (SYSTEM_UI_CLASS );
87
+ Class <?> statusBarClass = classLoader .loadClass (STATUS_BAR_CLASS );
88
+ Context context = (Context ) asAccessible (systemUiClass .getDeclaredField ("mContext" )).get (statusBar );
75
89
76
90
UnlockMethod method = hookStatusBarBiometricUnlock (statusBar , statusBarClass );
77
91
0 commit comments