2
2
3
3
import android .app .Application ;
4
4
import android .content .Context ;
5
+ import android .content .pm .ApplicationInfo ;
5
6
import android .os .Binder ;
6
7
import android .os .UserHandle ;
7
8
@@ -52,17 +53,14 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
52
53
@ Override
53
54
protected void afterHookedMethod (MethodHookParam param ) {
54
55
final Context context = (Context ) param .args [0 ];
55
- final int userId = UserHandle .getUserHandleForUid (context .getApplicationInfo ().uid ).hashCode ();
56
- final int packageUid = Binder .getCallingUid ();
57
- final int packagePid = Binder .getCallingPid ();
58
- final boolean availability = Utils .getParamAvailability (param , packagePid );
56
+ final boolean availability = Utils .getParamAvailability (param , Binder .getCallingPid ());
59
57
60
- // hook myself
61
58
if (packageName .equals (BuildConfig .APPLICATION_ID )) {
59
+ // hook myself
62
60
XposedHelpers .findAndHookMethod (Utils .class .getName (), lpparam .classLoader , "isEnhancementEnabled" , XC_MethodReplacement .returnConstant (true ));
63
61
}
64
62
65
- if ((boolean ) callStaticMethod (UserHandle .class , "isCore" , packageUid ) || !availability ) {
63
+ if ((boolean ) callStaticMethod (UserHandle .class , "isCore" , Binder . getCallingUid () ) || !availability ) {
66
64
// is Android code package
67
65
return ;
68
66
}
@@ -90,8 +88,6 @@ protected void afterHookedMethod(MethodHookParam param) {
90
88
findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get" , String .class , String .class , new XC_MethodHook () {
91
89
@ Override
92
90
protected void afterHookedMethod (MethodHookParam param ) {
93
- final int packagePid = Binder .getCallingPid ();
94
- final boolean availability = Utils .getParamAvailability (param , packagePid );
95
91
final String key = param .args [0 ].toString ();
96
92
97
93
if (PROPS .containsKey (key )) {
@@ -104,8 +100,6 @@ protected void afterHookedMethod(MethodHookParam param) {
104
100
findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get_int" , String .class , int .class , new XC_MethodHook () {
105
101
@ Override
106
102
protected void afterHookedMethod (MethodHookParam param ) {
107
- final int packagePid = Binder .getCallingPid ();
108
- final boolean availability = Utils .getParamAvailability (param , packagePid );
109
103
final String key = param .args [0 ].toString ();
110
104
111
105
if (PROPS .containsKey (key )) {
@@ -118,8 +112,6 @@ protected void afterHookedMethod(MethodHookParam param) {
118
112
findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get_long" , String .class , long .class , new XC_MethodHook () {
119
113
@ Override
120
114
protected void afterHookedMethod (MethodHookParam param ) {
121
- final int packagePid = Binder .getCallingPid ();
122
- final boolean availability = Utils .getParamAvailability (param , packagePid );
123
115
final String key = param .args [0 ].toString ();
124
116
125
117
if (PROPS .containsKey (key )) {
0 commit comments