Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable package verification agent such as play protection #109

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/java/toolkit/coderstory/CorePatchForQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
});
}
hookAllMethods(
XposedHelpers.findClass("com.android.server.pm.PackageManagerService", loadPackageParam.classLoader),
"isVerificationEnabled",
new ReturnConstant(prefs, "disableVerificationAgent", false)
);
}

@Override
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/toolkit/coderstory/CorePatchForR.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
XposedBridge.log("D/" + MainHook.TAG + " enhancedMode=" + prefs.getBoolean("enhancedMode", false));
XposedBridge.log("D/" + MainHook.TAG + " bypassBlock=" + prefs.getBoolean("bypassBlock", true));
XposedBridge.log("D/" + MainHook.TAG + " sharedUser=" + prefs.getBoolean("sharedUser", false));
XposedBridge.log("D/" + MainHook.TAG + " disableVerificationAgent=" + prefs.getBoolean("disableVerificationAgent", true));
}

var pmService = XposedHelpers.findClassIfExists("com.android.server.pm.PackageManagerService",
Expand Down Expand Up @@ -392,6 +393,8 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
);

hookAllMethods(getIsVerificationEnabledClass(loadPackageParam.classLoader), "isVerificationEnabled", new ReturnConstant(prefs, "disableVerificationAgent", false));

if (BuildConfig.DEBUG) initializeDebugHook(loadPackageParam);
}

Expand All @@ -410,6 +413,10 @@ static Object callOriginMethod(Object obj, String methodName, Object... args) {
}
}

Class<?> getIsVerificationEnabledClass(ClassLoader classLoader) {
return XposedHelpers.findClass("com.android.server.pm.PackageManagerService", classLoader);
}

Class<?> getSigningDetails(ClassLoader classLoader) {
return XposedHelpers.findClass("android.content.pm.PackageParser.SigningDetails", classLoader);
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/toolkit/coderstory/CorePatchForT.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,9 @@ protected Object SharedUserSetting_packages(Object sharedUser) {
protected Object SigningDetails_mergeLineageWith(Object self, Object other) {
return XposedHelpers.callMethod(self, "mergeLineageWith", other, 2 /*MERGE_RESTRICTED_CAPABILITY*/);
}

@Override
Class<?> getIsVerificationEnabledClass(ClassLoader classLoader) {
return XposedHelpers.findClass("com.android.server.pm.VerificationParams", classLoader);
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/toolkit/coderstory/CorePatchForU.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ protected void afterHookedMethod(MethodHookParam param) {
new ReturnConstant(prefs, "bypassBlock", false));
}
}

@Override
Class<?> getIsVerificationEnabledClass(ClassLoader classLoader) {
return XposedHelpers.findClass("com.android.server.pm.VerifyingSession", classLoader);
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
<string name="config_error">配置初始化失败</string>
<string name="shared_user_title">绕过共享用户签名验证</string>
<string name="shared_user_summary">允许安装与其共享用户签名不同的 app(<b>需要同时打开“禁用APK签名验证”</b>)</string>
<string name="disable_verification_agent_title">禁用安装包验证代理</string>
<string name="disable_verification_agent_summary">如 Play 商店的保护机制</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
<string name="usepresig_warn">!! Any apk can override the installed one !!\nBe carefully when installing unknown apk</string>
<string name="shared_user_title">Bypass shared user verify</string>
<string name="shared_user_summary">Allow install app with signature differ from its shared user (<b>\'Disable compare signatures\' must be enabled too</b>)</string>
<string name="disable_verification_agent_title">Disable Package Verification Agent</string>
<string name="disable_verification_agent_summary">e.g. Google Play Protection</string>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml/prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
android:title="@string/shared_user_title"
android:summary="@string/shared_user_summary"
android:defaultValue="false" />

<SwitchPreference
android:key="disableVerificationAgent"
android:title="@string/disable_verification_agent_title"
android:summary="@string/disable_verification_agent_summary"
android:defaultValue="true" />
</PreferenceCategory>

</PreferenceScreen>
Loading