Skip to content

Commit

Permalink
Remove enhanced mode
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp committed Nov 24, 2024
1 parent 3599a10 commit 3d3136c
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 98 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ val optimizeReleaseRes = task("optimizeReleaseRes").doLast {
)
val zip = Paths.get(
project.layout.buildDirectory.get().asFile.path, "intermediates",
"optimized_processed_res", "release", "resources-release-optimize.ap_"
"optimized_processed_res", "release", "optimizeReleaseResources", "resources-release-optimize.ap_"
)
val optimized = File("${zip}.opt")
val cmd = exec {
Expand Down
17 changes: 1 addition & 16 deletions app/src/main/java/toolkit/coderstory/CorePatchForQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
import java.util.Arrays;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class CorePatchForQ extends XposedHelper implements IXposedHookLoadPackage, IXposedHookZygoteInit {
public class CorePatchForQ extends XposedHelper implements IXposedHookLoadPackage {
final XSharedPreferences prefs = new XSharedPreferences(BuildConfig.APPLICATION_ID, "conf");

@Override
Expand Down Expand Up @@ -152,17 +150,4 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
new ReturnConstant(prefs, "disableVerificationAgent", false)
);
}

@Override
public void initZygote(StartupParam startupParam) {
hookAllMethods("android.content.pm.PackageParser", null, "getApkSigningVersion", XC_MethodReplacement.returnConstant(1));
hookAllConstructors("android.util.jar.StrictJarVerifier", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (prefs.getBoolean("enhancedMode", false)) {
param.args[3] = Boolean.FALSE;
}
}
});
}
}
20 changes: 2 additions & 18 deletions app/src/main/java/toolkit/coderstory/CorePatchForR.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
import java.util.zip.ZipEntry;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XSharedPreferences;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

@TargetApi(Build.VERSION_CODES.R)
public class CorePatchForR extends XposedHelper implements IXposedHookLoadPackage, IXposedHookZygoteInit {
public class CorePatchForR extends XposedHelper implements IXposedHookLoadPackage {
private final static Method deoptimizeMethod;

static {
Expand Down Expand Up @@ -68,7 +66,6 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam)
XposedBridge.log("D/" + MainHook.TAG + " authcreak=" + prefs.getBoolean("authcreak", false));
XposedBridge.log("D/" + MainHook.TAG + " digestCreak=" + prefs.getBoolean("digestCreak", true));
XposedBridge.log("D/" + MainHook.TAG + " UsePreSig=" + prefs.getBoolean("UsePreSig", false));
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));
Expand Down Expand Up @@ -143,6 +140,7 @@ public void afterHookedMethod(MethodHookParam param) throws Throwable {
final Object block = constructor.newInstance(param.args[0]);
Object[] infos = (Object[]) XposedHelpers.callMethod(block, "getSignerInfos");
Object info = infos[0];
@SuppressWarnings("unchecked")
List<X509Certificate> verifiedSignerCertChain = (List<X509Certificate>) XposedHelpers.callMethod(info, "getCertificateChain", block);
param.setResult(verifiedSignerCertChain.toArray(
new X509Certificate[0]));
Expand Down Expand Up @@ -422,20 +420,6 @@ Class<?> getSigningDetails(ClassLoader classLoader) {
return XposedHelpers.findClass("android.content.pm.PackageParser.SigningDetails", classLoader);
}

@Override
public void initZygote(StartupParam startupParam) {

hookAllMethods("android.content.pm.PackageParser", null, "getApkSigningVersion", XC_MethodReplacement.returnConstant(1));
hookAllConstructors("android.util.jar.StrictJarVerifier", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (prefs.getBoolean("enhancedMode", false)) {
param.args[3] = Boolean.FALSE;
}
}
});
}

Object mPMS = null;

void initializeDebugHook(XC_LoadPackage.LoadPackageParam lpparam) throws IllegalAccessException, InvocationTargetException {
Expand Down
36 changes: 1 addition & 35 deletions app/src/main/java/toolkit/coderstory/MainHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import com.coderstory.toolkit.BuildConfig;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

public class MainHook implements IXposedHookLoadPackage, IXposedHookZygoteInit {
public class MainHook implements IXposedHookLoadPackage {
public static final String TAG = "CorePatch";

@Override
Expand Down Expand Up @@ -44,37 +43,4 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
}
}
}

@Override
public void initZygote(StartupParam startupParam) {
if (startupParam.startsSystemServer) {
if (BuildConfig.DEBUG)
XposedBridge.log("D/" + TAG + " initZygote: Current sdk version " + Build.VERSION.SDK_INT);
switch (Build.VERSION.SDK_INT) {
case Build.VERSION_CODES.VANILLA_ICE_CREAM: // 35
new CorePatchForV().initZygote(startupParam);
break;
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
case Build.VERSION_CODES.S: // 31
new CorePatchForS().initZygote(startupParam);
break;
case Build.VERSION_CODES.R: // 30
new CorePatchForR().initZygote(startupParam);
break;
case Build.VERSION_CODES.Q: // 29
case Build.VERSION_CODES.P: // 28
new CorePatchForQ().initZygote(startupParam);
break;
default:
XposedBridge.log("W/" + TAG + " Unsupported Version of Android " + Build.VERSION.SDK_INT);
break;
}
}
}
}
2 changes: 0 additions & 2 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<string name="settings">Réglages</string>
<string name="ignore">Ignorer</string>
<string name="not_supported">Vous utilisez apparemment une ancienne version de LSPosed ou LSPosed n\’est pas activé, Merci de mettre LSPosed à jour ou de retenter après activation.</string>
<string name="enhancedMode">Mode Amélioré</string>
<string name="enhancedMode_summary">Outrepasser certaines validations dans l\’application</string>
<string name="miui_usepresig_warn">UsePreSig ne fonctionne pas sur MiUI car son sous-système est beaucoup trop différent.\nNous n\’avons pas le temps de nous pencher sur ce cas.</string>
<string name="usepresig_warn">!! N\’importe quel apk peut remplacer celui déjà installé !!\nPrenez garde lors ce que vous installez des apk inconnus</string>
</resources>
4 changes: 1 addition & 3 deletions app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
<string name="ignore">Abaikan</string>
<string name="config_error">Inisialisasi konfigurasi gagal</string>
<string name="not_supported">Sepertinya Anda menggunakan versi LSPosed yang jadul atau LSPosed tidak diaktifkan, harap perbarui LSPosed atau coba lagi setelah diaktifkan.</string>
<string name="enhancedMode">Mode Peningkatan</string>
<string name="enhancedMode_summary">Loloskan beberapa validasi dalam aplikasi</string>
<string name="bypassBlock">Terobos blokiran</string>
<string name="bypassBlock">Terobos blokiran</string>
<string name="bypassBlock_summary">Terobos daftar blokir dalam beberapa perangkat seperti Nothing Phone</string>
<string name="miui_usepresig_warn">Gunakan signatures terpasang tidak bekerja di MiUI karena framework banyak dimodifikasi.\nKami tidak punya waktu untuk menyelidikinya.</string>
<string name="usepresig_warn">!! Segala apk dapat menggantikan aplikasi yang terpasang !!\nBerhati-hati ketika memasang apk antah-berantah</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<string name="ignore">Ignora</string>
<string name="config_error">Inizializzazione della configurazione non riuscita</string>
<string name="not_supported">Sembra che tu stia utilizzando una versione obsoleta di LSPosed oppure LSPosed non è attivato. Aggiorna LSPosed o riprova dopo l\'attivazione.</string>
<string name="enhancedMode">Modalità Potenziata</string>
<string name="enhancedMode_summary">Supera alcune convalide nell\'applicazione</string>
<string name="bypassBlock">Bypassa blocchi</string>
<string name="bypassBlock_summary">Bypassa la lista di blocco di alcuni dispositivi come Nothing Phone</string>
<string name="miui_usepresig_warn">UsePreSig non funzionerà su MiUI perché il suo framework è troppo diverso. Non abbiamo tempo per seguire il caso.</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<string name="ignore">無視</string>
<string name="config_error">構成の初期化に失敗しました</string>
<string name="not_supported">古いバージョンの LSPosed を使用しているか、LSPosed が有効化されていないようです。LSPosed を更新、有効化をした後に再試行をしてください。</string>
<string name="enhancedMode">拡張モード</string>
<string name="enhancedMode_summary">一部のアプリの検証をパスします。</string>
<string name="bypassBlock">ブロックをバイパスする</string>
<string name="bypassBlock_summary">Nothing Phone などの一部のデバイスのブロックリストをバイパスします。</string>
<string name="miui_usepresig_warn">インストールされている署名の使用は、フレームワークが大幅に変更されるため MIUI では動作しません。\nこの問題を解析をする時間がありません。</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@
<string name="settings">설정</string>
<string name="ignore">무시</string>
<string name="not_supported">LSPosed의 오래된 버전을 사용 중이거나 LSPosed가 활성화되지 않은 것 같습니다. LSPosed를 업데이트하거나 활성화한 후 다시 시도하십시오.</string>
<string name="enhancedMode">강화 모드</string>
<string name="enhancedMode_summary">애플리케이션에서 일부 유효성 검사를 통과합니다.</string>
</resources>
2 changes: 0 additions & 2 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<string name="ignore">Ignorar</string>
<string name="config_error">Falha na inicialização da configuração</string>
<string name="not_supported">Parece que você está usando uma versão desatualizada do LSPosed ou o LSPosed não está ativado. Atualize o LSPosed ou tente novamente após a ativação.</string>
<string name="enhancedMode">Modo aprimorado</string>
<string name="enhancedMode_summary">Realize alguma validação no app</string>
<string name="bypassBlock">Ignorar bloqueio</string>
<string name="bypassBlock_summary">Ignore a lista de bloqueio em alguns dispositivos como Nothing Phone</string>
<string name="miui_usepresig_warn">Usar assinaturas instaladas não funcionará na MIUI porque sua estrutura muda muito.\nNão temos tempo para acompanhar o caso.</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<string name="digestCreak_summary">Разрешить переустановку приложения с другими подписями.</string>
<string name="downgr">Разрешить понижать версию.</string>
<string name="downgr_summary">Разрешить переустановку приложений на прошлые версии.</string>
<string name="enhancedMode">Расширенный режим</string>
<string name="enhancedMode_summary">Пройдите некоторую проверку в приложении</string>
<string name="ignore">Игнорировать</string>
<string name="module_description">Android 9-15 core patch</string>
<string name="not_supported">Похоже, вы используете устаревшую версию LSPposed или LSPposed не активирован, пожалуйста, обновите LSPposed или повторите попытку после активации.</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
<string name="settings">设置</string>
<string name="ignore">忽略</string>
<string name="not_supported">模块未激活或正使用旧版 LSPosed,请激活模块或更新 LSPosed 后再试。</string>
<string name="enhancedMode">增强模式</string>
<string name="enhancedMode_summary">可以解决一些 APP 内部的完整性校验,一般不需要开启</string>
<string name="miui_usepresig_warn">由于 MIUI 大幅度魔改了安卓框架,UsePreSig 无法正常工作\n我们没有时间溯源</string>
<string name="usepresig_warn">!!所有安装包可以覆盖已安装的 APP!!\n安装未知的安装包时请务必小心</string>
<string name="bypassBlock">绕过黑名单</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<string name="settings">設定</string>
<string name="ignore">忽略</string>
<string name="not_supported">未啟用模組或正在使用舊版的 LSPosed,請啟用模組或是更新 LSPosed 模組後再試一次。</string>
<string name="enhancedMode">增強模式</string>
<string name="enhancedMode_summary">可以解決一些應用程式內部的完整性校驗,一般不需要開啟</string>
<string name="miui_usepresig_warn">由於 MIUI 大幅度修改了 Android 框架,UsePreSig 無法正常運作\n我們沒有時間分析</string>
<string name="usepresig_warn">!!所有安裝檔可以覆蓋已安裝的應用程式!!\n安裝未知的安裝檔時請務必小心</string>
<string name="bypassBlock">繞過黑名單</string>
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<string name="ignore">Ignore</string>
<string name="config_error">Configuration initialization failed</string>
<string name="not_supported">It seems that you are using an out dated version of LSPosed or LSPosed is not activated, please update LSPosed or try again after activated.</string>
<string name="enhancedMode">Enhanced Mode</string>
<string name="enhancedMode_summary">Pass some validation in the application</string>
<string name="bypassBlock">Bypass block</string>
<string name="bypassBlock_summary">Bypass blocklist in some devices like Nothing Phone</string>
<string name="miui_usepresig_warn">UsePreSig won\'t work on MiUI because its framework changes too much.\nWe don\'t have time to track the case.</string>
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/xml/prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
android:summary="@string/UsePreSig_summary"
android:defaultValue="false" />

<SwitchPreference
android:key="enhancedMode"
android:title="@string/enhancedMode"
android:summary="@string/enhancedMode_summary"
android:defaultValue="false" />
<SwitchPreference
android:key="bypassBlock"
android:title="@string/bypassBlock"
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:8.5.2")
classpath("com.android.tools.build:gradle:8.7.2")
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

1 comment on commit 3d3136c

@devnoname120
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviraxp Could you elaborate on why this was removed? Thanks

Please sign in to comment.