Skip to content

Commit

Permalink
Update for U compatibility and bump version to 4.3 (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp authored Oct 13, 2023
1 parent 02cbc1e commit 1b7898a
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 29 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ val releaseKeyAlias: String? by rootProject
val releaseKeyPassword: String? by rootProject

android {
compileSdk = 33
buildToolsVersion = "33.0.0"
compileSdk = 34
buildToolsVersion = "34.0.0"
defaultConfig {
applicationId = "com.coderstory.toolkit"
minSdk = 29
targetSdk = 33
versionCode = 1997
versionName = "4.2"
targetSdk = 34
versionCode = 2000
versionName = "4.3"
}

signingConfigs {
Expand Down Expand Up @@ -85,7 +85,7 @@ val optimizeReleaseRes = task("optimizeReleaseRes").doLast {
optimized.renameTo(zip.toFile())
}
}
tasks.whenTaskAdded {
tasks.configureEach {
when (name) {
"optimizeReleaseResources" -> {
finalizedBy(optimizeReleaseRes)
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/toolkit/coderstory/CorePatchForSv2.java

This file was deleted.

8 changes: 5 additions & 3 deletions app/src/main/java/toolkit/coderstory/CorePatchForT.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class CorePatchForT extends CorePatchForSv2 {
public class CorePatchForT extends CorePatchForS {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws IllegalAccessException, InvocationTargetException, InstantiationException {
super.handleLoadPackage(loadPackageParam);
Expand All @@ -29,8 +29,10 @@ protected void beforeHookedMethod(MethodHookParam param) {
// Don't handle PERMISSION (grant SIGNATURE permissions to pkgs with this cert)
// Or applications will have all privileged permissions
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/pm/PackageParser.java;l=5947?q=CertCapabilities
if (((Integer) param.args[1] != 4) && prefs.getBoolean("digestCreak", true)) {
param.setResult(true);
if (prefs.getBoolean("digestCreak", true)) {
if ((Integer) param.args[1] != 4) {
param.setResult(true);
}
}
}
});
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/java/toolkit/coderstory/CorePatchForU.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package toolkit.coderstory;

import java.lang.reflect.InvocationTargetException;

import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class CorePatchForU extends CorePatchForT {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws IllegalAccessException, InvocationTargetException, InstantiationException {
super.handleLoadPackage(loadPackageParam);

// ee11a9c (Rename AndroidPackageApi to AndroidPackage)
findAndHookMethod("com.android.server.pm.PackageManagerServiceUtils", loadPackageParam.classLoader,
"checkDowngrade",
"com.android.server.pm.pkg.AndroidPackage",
"android.content.pm.PackageInfoLite",
new ReturnConstant(prefs, "downgrade", null));
}
}
10 changes: 6 additions & 4 deletions app/src/main/java/toolkit/coderstory/MainHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
if (("android".equals(lpparam.packageName)) && (lpparam.processName.equals("android"))) {
Log.d(TAG, "Current sdk version " + Build.VERSION.SDK_INT);
switch (Build.VERSION.SDK_INT) {
case Build.VERSION_CODES.UPSIDE_DOWN_CAKE: // 34
new CorePatchForU().handleLoadPackage(lpparam);
break;
case Build.VERSION_CODES.TIRAMISU: // 33
new CorePatchForT().handleLoadPackage(lpparam);
break;
case Build.VERSION_CODES.S_V2: // 32
new CorePatchForSv2().handleLoadPackage(lpparam);
break;
case Build.VERSION_CODES.S: // 31
new CorePatchForS().handleLoadPackage(lpparam);
break;
Expand All @@ -43,12 +44,13 @@ public void initZygote(StartupParam startupParam) throws Throwable {
if (startupParam.startsSystemServer) {
Log.d(TAG, "Current sdk version " + Build.VERSION.SDK_INT);
switch (Build.VERSION.SDK_INT) {
case Build.VERSION_CODES.UPSIDE_DOWN_CAKE: // 34
new CorePatchForU().initZygote(startupParam);
break;
case Build.VERSION_CODES.TIRAMISU: // 33
new CorePatchForT().initZygote(startupParam);
break;
case Build.VERSION_CODES.S_V2: // 32
new CorePatchForSv2().initZygote(startupParam);
break;
case Build.VERSION_CODES.S: // 31
new CorePatchForS().initZygote(startupParam);
break;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">Core Patch</string>
<string name="module_description">Patch pour Android 10–13</string>
<string name="corepatch">Cette version est pour 10–13 uniquement.\nMerci d\’utiliser la dernière version de LSPosed.</string>
<string name="module_description">Patch pour Android 10–14</string>
<string name="corepatch">Cette version est pour 10–14 uniquement.\nMerci d\’utiliser la dernière version de LSPosed.</string>
<string name="downgr">Permettre la rétrogradation</string>
<string name="downgr_summary">Permettre la rétrogradation d\’applications.</string>
<string name="authcreak">Désactiver la vérification digest</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">Core Patch</string>
<string name="module_description">Android 10–13 core patch</string>
<string name="corepatch">이 버전은 Android 10–13 전용입니다.\nLSPosed의 최신 버전을 사용하십시오.</string>
<string name="module_description">Android 10–14 core patch</string>
<string name="corepatch">이 버전은 Android 10–14 전용입니다.\nLSPosed의 최신 버전을 사용하십시오.</string>
<string name="downgr">다운그레이드 허용</string>
<string name="downgr_summary">애플리케이션 다운그레이드를 허용합니다.</string>
<string name="authcreak">다이제스트 확인 비활성화</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<string name="app_name">Core Patch</string>
<string name="authcreak">Отключить проверку дайджеста</string>
<string name="authcreak_summary">Позволяет устанавливать приложения после изменения файла в apk (игнорировать недопустимую ошибку дайджеста).</string>
<string name="corepatch">«Эта версия предназначена только для Android 10–13.
<string name="corepatch">«Эта версия предназначена только для Android 10–14.
Пожалуйста, используйте последнюю версию LSPposed. "</string>
<string name="digestCreak">Отключить сравнение подписей</string>
<string name="digestCreak_summary">Разрешить переустановку приложения с другими подписями.</string>
Expand All @@ -16,7 +16,7 @@
<string name="enhancedMode">Расширенный режим</string>
<string name="enhancedMode_summary">Пройдите некоторую проверку в приложении</string>
<string name="ignore">Игнорировать</string>
<string name="module_description">Android 10–13 core patch</string>
<string name="module_description">Android 10–14 core patch</string>
<string name="not_supported">Похоже, вы используете устаревшую версию LSPposed или LSPposed не активирован, пожалуйста, обновите LSPposed или повторите попытку после активации.</string>
<string name="settings">Настройки</string>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">核心破解</string>
<string name="module_description">Android 10–13 核心破解</string>
<string name="corepatch">此版本只支持 Android 10–13\n请安装最新版本的 LSPosed 框架,否则功能可能无法正确启用。</string>
<string name="module_description">Android 10–14 核心破解</string>
<string name="corepatch">此版本只支持 Android 10–14\n请安装最新版本的 LSPosed 框架,否则功能可能无法正确启用。</string>
<string name="downgr">允许降级安装应用</string>
<string name="downgr_summary">允许应用在安装新版本的情况下直接覆盖安装旧版本</string>
<string name="authcreak">禁用软件包管理器签名验证</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">Core Patch</string>
<string name="module_description">Android 10–13 core patch</string>
<string name="corepatch">This version is for Android 10–13 only.\nPlease use the latest version of the LSPosed.</string>
<string name="module_description">Android 10–14 core patch</string>
<string name="corepatch">This version is for Android 10–14 only.\nPlease use the latest version of the LSPosed.</string>
<string name="downgr">Allow downgrade</string>
<string name="downgr_summary">Allow downgrade applications.</string>
<string name="authcreak">Disable digest verify</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.android.tools.build:gradle:8.1.2")
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ android.enableAppCompileTimeRClass=true
android.enableR8.fullMode=true
android.experimental.enableNewResourceShrinker=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 1b7898a

Please sign in to comment.