From a52cc16b43dec10dd966d2385bf44ace846c8d54 Mon Sep 17 00:00:00 2001 From: Nicholas Bissell Date: Wed, 5 Feb 2025 18:36:28 +0000 Subject: [PATCH] No class loading if Java features disabled - No longer loads custom classes if not needed for respective packages - Renames isGmsUnstable to isDroidGuardOrVending - Removes spoofVendingSdk from migrate/autopif scripts (don't document yet) - Adds missing setAccessible() call for early return in EntryPointVending.init() - Adds missing set of spoofSignature -> 0 for vending --- app/src/main/cpp/main.cpp | 13 ++++++++----- .../playintegrityfix/EntryPointVending.java | 1 + module/autopif2.sh | 2 +- module/migrate.sh | 3 +-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index 03acc92..fe230b7 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -13,6 +13,7 @@ #define JSON_FILE_PATH "/data/adb/modules/playintegrityfix/pif.json" #define CUSTOM_JSON_FILE_PATH "/data/adb/modules/playintegrityfix/custom.pif.json" #define VENDING_PACKAGE "com.android.vending" +#define DROIDGUARD_PACKAGE "com.google.android.gms.unstable" static int verboseLogs = 0; static int spoofBuild = 1; @@ -85,7 +86,7 @@ public: } void preAppSpecialize(zygisk::AppSpecializeArgs *args) override { - bool isGms = false, isGmsUnstable = false; + bool isGms = false, isDroidGuardOrVending = false; auto rawProcess = env->GetStringUTFChars(args->nice_name, nullptr); auto rawDir = env->GetStringUTFChars(args->app_data_dir, nullptr); @@ -101,7 +102,7 @@ public: std::string_view dir(rawDir); isGms = dir.ends_with("/com.google.android.gms") || dir.ends_with("/com.android.vending"); - isGmsUnstable = pkgName == "com.google.android.gms.unstable" || pkgName == VENDING_PACKAGE; + isDroidGuardOrVending = pkgName == DROIDGUARD_PACKAGE || pkgName == VENDING_PACKAGE; env->ReleaseStringUTFChars(args->nice_name, rawProcess); env->ReleaseStringUTFChars(args->app_data_dir, rawDir); @@ -114,7 +115,7 @@ public: // We are in GMS now, force unmount api->setOption(zygisk::FORCE_DENYLIST_UNMOUNT); - if (!isGmsUnstable) { + if (!isDroidGuardOrVending) { api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY); return; } @@ -164,11 +165,13 @@ public: readJson(); - if (pkgName == VENDING_PACKAGE) spoofProps = spoofBuild = spoofProvider = 0; + if (pkgName == VENDING_PACKAGE) spoofProps = spoofBuild = spoofProvider = spoofSignature = 0; else spoofVendingSdk = 0; if (spoofProps > 0) doHook(); - inject(); + if (spoofBuild + spoofProvider + spoofSignature + spoofVendingSdk > 0 || + pkgName == DROIDGUARD_PACKAGE && verboseLogs > 99) + inject(); dexVector.clear(); json.clear(); diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPointVending.java b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPointVending.java index 57b9cd3..2bf556a 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPointVending.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPointVending.java @@ -23,6 +23,7 @@ public final class EntryPointVending { oldValue = field.getInt(null); if (oldValue == targetSdk) { if (verboseLogs > 2) LOG(String.format("[SDK_INT]: %d (unchanged)", oldValue)); + field.setAccessible(false); return; } field.set(null, targetSdk); diff --git a/module/autopif2.sh b/module/autopif2.sh index d3b327f..615f11a 100644 --- a/module/autopif2.sh +++ b/module/autopif2.sh @@ -158,7 +158,7 @@ if [ -f "$MIGRATE" ]; then if [ -n "$ARGS" ]; then grep_json() { [ -f "$2" ] && grep -m1 "$1" $2 | cut -d\" -f4; } verboseLogs=$(grep_json "VERBOSE_LOGS" $OLDJSON); - ADVSETTINGS="spoofBuild spoofProps spoofProvider spoofSignature spoofVendingSdk verboseLogs"; + ADVSETTINGS="spoofBuild spoofProps spoofProvider spoofSignature verboseLogs"; for SETTING in $ADVSETTINGS; do eval [ -z \"\$$SETTING\" ] \&\& $SETTING=$(grep_json "$SETTING" $OLDJSON); eval TMPVAL=\$$SETTING; diff --git a/module/migrate.sh b/module/migrate.sh index 0877711..df9b194 100644 --- a/module/migrate.sh +++ b/module/migrate.sh @@ -114,13 +114,12 @@ if [ -z "$DEVICE_INITIAL_SDK_INT" -o "$DEVICE_INITIAL_SDK_INT" = "null" ]; then DEVICE_INITIAL_SDK_INT=25; fi; -ADVSETTINGS="spoofBuild spoofProps spoofProvider spoofSignature spoofVendingSdk verboseLogs"; +ADVSETTINGS="spoofBuild spoofProps spoofProvider spoofSignature verboseLogs"; spoofBuild=1; spoofProps=1; spoofProvider=1; spoofSignature=0; -spoofVendingSdk=0; verboseLogs=0; if [ -f "$OUT" ]; then