From 38764de1cb5d62a2f474c6bf40b4f122e9f61a6f Mon Sep 17 00:00:00 2001 From: JingMatrix Date: Mon, 19 Aug 2024 00:17:39 +0200 Subject: [PATCH] Support Andorid 15 beta 4.2 In Android 15, class ParsedPackage is in the package `com.android.internal.pm.parsing.pkg`. See https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/pm/parsing/pkg/ParsedPackage.java; The module is tested with [JingMatrix/LSPosed](https://github.com/JingMatrix/LSPosed) on Android 15 beta 4.2 --- README.md | 2 +- app/build.gradle.kts | 6 +++--- .../toolkit/coderstory/CorePatchForT.java | 7 ++++++- .../toolkit/coderstory/CorePatchForV.java | 19 +++++++++++++++++++ .../java/toolkit/coderstory/MainHook.java | 3 +++ app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-in/strings.xml | 4 ++-- app/src/main/res/values-it/strings.xml | 4 ++-- app/src/main/res/values-ja/strings.xml | 4 ++-- app/src/main/res/values-ko/strings.xml | 4 ++-- app/src/main/res/values-pt-rBR/strings.xml | 4 ++-- app/src/main/res/values-ru/strings.xml | 4 ++-- app/src/main/res/values-zh-rCN/strings.xml | 4 ++-- app/src/main/res/values-zh-rTW/strings.xml | 4 ++-- app/src/main/res/values/strings.xml | 4 ++-- 15 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 app/src/main/java/toolkit/coderstory/CorePatchForV.java diff --git a/README.md b/README.md index d6bae23..de8ad77 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Disable signature verification For Android branch master -> support android 4.4-7.x Android8.x -> maybe you need find the commit what change version name to 2.1,then compile by you self branch Q -> support android 9.0-10.0 -branch main -> support android 10-14 +branch main -> support android 10-15 ``` ## Features diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b096362..805caef 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -10,12 +10,12 @@ val releaseKeyAlias: String? by rootProject val releaseKeyPassword: String? by rootProject android { - compileSdk = 34 - buildToolsVersion = "34.0.0" + compileSdk = 35 + buildToolsVersion = "35.0.0" defaultConfig { applicationId = "com.coderstory.toolkit" minSdk = 28 - targetSdk = 34 + targetSdk = 35 versionCode = 2019 versionName = "4.5" } diff --git a/app/src/main/java/toolkit/coderstory/CorePatchForT.java b/app/src/main/java/toolkit/coderstory/CorePatchForT.java index 8380e1e..6de15ec 100644 --- a/app/src/main/java/toolkit/coderstory/CorePatchForT.java +++ b/app/src/main/java/toolkit/coderstory/CorePatchForT.java @@ -39,9 +39,10 @@ protected void beforeHookedMethod(MethodHookParam param) { } }); + Class ParsedPackage = getParsedPackage(loadPackageParam.classLoader); findAndHookMethod("com.android.server.pm.InstallPackageHelper", loadPackageParam.classLoader, "doesSignatureMatchForPermissions", String.class, - "com.android.server.pm.parsing.pkg.ParsedPackage", int.class, new XC_MethodHook() { + ParsedPackage, int.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) { if (prefs.getBoolean("digestCreak", true) && prefs.getBoolean("UsePreSig", false)) { @@ -90,6 +91,10 @@ protected void afterHookedMethod(MethodHookParam param) { } } + Class getParsedPackage(ClassLoader classLoader) { + return XposedHelpers.findClassIfExists("com.android.server.pm.parsing.pkg.ParsedPackage", classLoader); + } + Class getSigningDetails(ClassLoader classLoader) { return XposedHelpers.findClassIfExists("android.content.pm.SigningDetails", classLoader); } diff --git a/app/src/main/java/toolkit/coderstory/CorePatchForV.java b/app/src/main/java/toolkit/coderstory/CorePatchForV.java new file mode 100644 index 0000000..dbd6f02 --- /dev/null +++ b/app/src/main/java/toolkit/coderstory/CorePatchForV.java @@ -0,0 +1,19 @@ +package toolkit.coderstory; + +import java.lang.reflect.InvocationTargetException; + +import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XposedHelpers; +import de.robv.android.xposed.callbacks.XC_LoadPackage; + +public class CorePatchForV extends CorePatchForU { + @Override + public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws IllegalAccessException, InvocationTargetException, InstantiationException { + super.handleLoadPackage(loadPackageParam); + } + + @Override + Class getParsedPackage(ClassLoader classLoader) { + return XposedHelpers.findClassIfExists("com.android.internal.pm.parsing.pkg.ParsedPackage", classLoader); + } +} diff --git a/app/src/main/java/toolkit/coderstory/MainHook.java b/app/src/main/java/toolkit/coderstory/MainHook.java index a78fbb8..fa5fba7 100644 --- a/app/src/main/java/toolkit/coderstory/MainHook.java +++ b/app/src/main/java/toolkit/coderstory/MainHook.java @@ -18,6 +18,9 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th if (BuildConfig.DEBUG) XposedBridge.log("D/" + TAG + " handleLoadPackage"); switch (Build.VERSION.SDK_INT) { + case Build.VERSION_CODES.VANILLA_ICE_CREAM: // 35 + new CorePatchForV().handleLoadPackage(lpparam); + break; case Build.VERSION_CODES.UPSIDE_DOWN_CAKE: // 34 new CorePatchForU().handleLoadPackage(lpparam); break; diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ea88926..e93267c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,6 +1,6 @@ Core Patch - Patch pour Android 9–14 + Patch pour Android 9-15 Cette version est pour 10–14 uniquement.\nMerci d\’utiliser la dernière version de LSPosed. Permettre la rétrogradation Permettre la rétrogradation d\’applications. diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 0199a83..11fe494 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -1,7 +1,7 @@ Core Patch - Android 9–14 core patch - Versi ini adalah untuk Android 9-14 saja.\nHarap gunakan versi LSPosed terbaru. + Android 9-15 core patch + Versi ini adalah untuk Android 9-15 saja.\nHarap gunakan versi LSPosed terbaru. Izinkan turun versi Izinkan turun versi aplikasi. Matikan verifikasi digest diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1d1ed5f..794817e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,7 +1,7 @@ Core Patch - Android 9–14 core patch - Questa versione è solo per Android 9–14.\nPer favore utilizza la versione più recente di LSPosed. + Android 9-15 core patch + Questa versione è solo per Android 9-15.\nPer favore utilizza la versione più recente di LSPosed. Consenti ​​Downgrade Consenti il ​​downgrade delle applicazioni. Disabilita verifica digest diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8efdfb9..e384c82 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1,8 +1,8 @@  Core Patch - Android 9–14 コアパッチ - このバージョンは、 Android 9–14 のみで動作します。\n最新版の LSPosed を使用してください。 + Android 9-15 コアパッチ + このバージョンは、 Android 9-15 のみで動作します。\n最新版の LSPosed を使用してください。 ダウングレードを許可する アプリのダウングレードを許可します。 ダイジェストの検証を無効化する diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 6a0607b..fd0dd30 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1,7 +1,7 @@ Core Patch - Android 9–14 core patch - 이 버전은 Android 9–14 전용입니다.\nLSPosed의 최신 버전을 사용하십시오. + Android 9-15 core patch + 이 버전은 Android 9-15 전용입니다.\nLSPosed의 최신 버전을 사용하십시오. 다운그레이드 허용 애플리케이션 다운그레이드를 허용합니다. 다이제스트 확인 비활성화 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index efd3fd6..3793f90 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1,7 +1,7 @@ Core Patch - Android 9–14 core patch - Esta versão é apenas para Android 9–14.\nPor favor, use a versão mais recente do LSPosed. + Android 9-15 core patch + Esta versão é apenas para Android 9-15.\nPor favor, use a versão mais recente do LSPosed. Permitir downgrade Permite downgrade de apps Desativar verificação de integridade diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9e9ade3..34599c3 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -7,7 +7,7 @@ Core Patch Отключить проверку дайджеста Позволяет устанавливать приложения после изменения файла в apk (игнорировать недопустимую ошибку дайджеста). - «Эта версия предназначена только для Android 9–14. + «Эта версия предназначена только для Android 9-15. Пожалуйста, используйте последнюю версию LSPposed. " Отключить сравнение подписей Разрешить переустановку приложения с другими подписями. @@ -16,7 +16,7 @@ Расширенный режим Пройдите некоторую проверку в приложении Игнорировать - Android 9–14 core patch + Android 9-15 core patch Похоже, вы используете устаревшую версию LSPposed или LSPposed не активирован, пожалуйста, обновите LSPposed или повторите попытку после активации. Настройки diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index af57c35..5cf6ab1 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,7 +1,7 @@ 核心破解 - Android 9–14 核心破解 - 此版本只支持 Android 9–14\n请安装最新版本的 LSPosed 框架,否则功能可能无法正确启用。 + Android 9-15 核心破解 + 此版本只支持 Android 9-15\n请安装最新版本的 LSPosed 框架,否则功能可能无法正确启用。 允许降级安装应用 允许应用在安装新版本的情况下直接覆盖安装旧版本 禁用软件包管理器签名验证 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0d6667e..355603b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1,8 +1,8 @@ 核心修補 - Android 9–14 核心修補 - 此版本只支援 Android 9–14\n請安裝最新版本的 LSPosed 框架,否則功能可能無法正確啟用。 + Android 9-15 核心修補 + 此版本只支援 Android 9-15\n請安裝最新版本的 LSPosed 框架,否則功能可能無法正確啟用。 允許降版安裝應用程式 允許應用程式在安裝新版本的情況下直接覆蓋安裝舊版本 停用套裝安裝程式簽名驗證 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 505c87d..d47aa98 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,7 @@ Core Patch - Android 9–14 core patch - This version is for Android 9–14 only.\nPlease use the latest version of the LSPosed. + Android 9-15 core patch + This version is for Android 9-15 only.\nPlease use the latest version of the LSPosed. Allow downgrade Allow downgrade applications. Disable digest verify