22
33import android .app .Application ;
44import android .content .Context ;
5+ import android .content .pm .ApplicationInfo ;
56import android .os .Binder ;
67import android .os .UserHandle ;
78
@@ -52,17 +53,14 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
5253 @ Override
5354 protected void afterHookedMethod (MethodHookParam param ) {
5455 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 ());
5957
60- // hook myself
6158 if (packageName .equals (BuildConfig .APPLICATION_ID )) {
59+ // hook myself
6260 XposedHelpers .findAndHookMethod (Utils .class .getName (), lpparam .classLoader , "isEnhancementEnabled" , XC_MethodReplacement .returnConstant (true ));
6361 }
6462
65- if ((boolean ) callStaticMethod (UserHandle .class , "isCore" , packageUid ) || !availability ) {
63+ if ((boolean ) callStaticMethod (UserHandle .class , "isCore" , Binder . getCallingUid () ) || !availability ) {
6664 // is Android code package
6765 return ;
6866 }
@@ -90,8 +88,6 @@ protected void afterHookedMethod(MethodHookParam param) {
9088 findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get" , String .class , String .class , new XC_MethodHook () {
9189 @ Override
9290 protected void afterHookedMethod (MethodHookParam param ) {
93- final int packagePid = Binder .getCallingPid ();
94- final boolean availability = Utils .getParamAvailability (param , packagePid );
9591 final String key = param .args [0 ].toString ();
9692
9793 if (PROPS .containsKey (key )) {
@@ -104,8 +100,6 @@ protected void afterHookedMethod(MethodHookParam param) {
104100 findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get_int" , String .class , int .class , new XC_MethodHook () {
105101 @ Override
106102 protected void afterHookedMethod (MethodHookParam param ) {
107- final int packagePid = Binder .getCallingPid ();
108- final boolean availability = Utils .getParamAvailability (param , packagePid );
109103 final String key = param .args [0 ].toString ();
110104
111105 if (PROPS .containsKey (key )) {
@@ -118,8 +112,6 @@ protected void afterHookedMethod(MethodHookParam param) {
118112 findAndHookMethod (XposedHelpers .findClass ("android.os.SystemProperties" , lpparam .classLoader ), "native_get_long" , String .class , long .class , new XC_MethodHook () {
119113 @ Override
120114 protected void afterHookedMethod (MethodHookParam param ) {
121- final int packagePid = Binder .getCallingPid ();
122- final boolean availability = Utils .getParamAvailability (param , packagePid );
123115 final String key = param .args [0 ].toString ();
124116
125117 if (PROPS .containsKey (key )) {
0 commit comments