xiongzhu il y a 1 an
Parent
commit
b8a71364a0

+ 1 - 1
app/build.gradle

@@ -24,7 +24,7 @@ android {
         applicationId "com.example.modifier"
         minSdk 29
         targetSdk 34
-        versionCode 144
+        versionCode 145
         versionName "1.0.1"
         archivesBaseName = "modifier-${versionCode}"
 

+ 5 - 0
app/src/main/java/com/example/modifier/service/ModifierService.kt

@@ -356,6 +356,11 @@ class ModifierService : AccessibilityService() {
             appStateRepo.appState.value.storing
         popup.menu.findItem(R.id.check_availability).isEnabled =
             !appStateRepo.appState.value.checkingConnection
+        if (BuildConfig.DEBUG) {
+            popup.menu.findItem(R.id.inspect).isVisible = true
+            popup.menu.findItem(R.id.toggle_on).isVisible = true
+            popup.menu.findItem(R.id.toggle_off).isVisible = true
+        }
 
         popup.setOnMenuItemClickListener { item ->
             CoroutineScope(Dispatchers.IO).launch {

+ 1 - 1
app/src/main/java/com/example/modifier/service/ScreenController.kt

@@ -21,7 +21,7 @@ class ScreenController(val context: AccessibilityService, private val inspector:
                 res.rcsSwitch = null
                 inspector.traverseNode(res)
                 if (res.rcsSwitch == null) {
-                    shellRun(CMD_BACK, "sleep 0.5", CMD_RCS_SETTINGS_ACTIVITY, "sleep 0.5")
+                    shellRun(CMD_BACK, "sleep 0.5", CMD_RCS_SETTINGS_ACTIVITY, "sleep 1")
                 } else {
                     if (res.rcsSwitch!!.isChecked == state) {
                         return@repeatBlock true

+ 15 - 2
app/src/main/java/com/example/modifier/utils/System.kt

@@ -306,7 +306,20 @@ fun getIPAddress(): List<String> {
 }
 
 suspend fun checkPif() {
+    if (!(Build.MODEL.startsWith("SM-F707") || Build.MODEL.startsWith("SM-F711"))) {
+        return
+    }
     try {
+        val out = shellRun("cat /data/adb/modules/playintegrityfix/module.prop").first
+        var pifFile = ""
+        if (out.contains("name=Play Integrity Fix")) {
+            pifFile = "pif.json"
+        } else if (out.contains("name=Play Integrity Fork")) {
+            pifFile = "custom.pif.json"
+        } else {
+            Log.e(systemTag, "PIF module not found")
+        }
+
         val config = ktorClient.get(SysConfigApi.Id(SysConfigApi(), "pif"))
             .body<SysConfigResponse>()
         if (config.value.isEmpty()) {
@@ -323,7 +336,7 @@ suspend fun checkPif() {
             return
         }
 
-        val currentFingerprint = shellRun("cat /data/adb/modules/playintegrityfix/pif.json").let {
+        val currentFingerprint = shellRun("cat /data/adb/modules/playintegrityfix/$pifFile").let {
             val json = JSONObject(it.first.split("\n")
                 .joinToString("\n") { line ->
                     line.replace(Regex("^\\s*//.*"), "")
@@ -337,7 +350,7 @@ suspend fun checkPif() {
                 tmpFile = File.createTempFile("pif", ".json")
                 FileUtils.writeStringToFile(tmpFile, newPif.toString(), "UTF-8")
                 shellRun(
-                    "cp ${tmpFile.path} /data/adb/modules/playintegrityfix/pif.json",
+                    "cp ${tmpFile.path} /data/adb/modules/playintegrityfix/$pifFile",
                     PACKAGE_GMS.kill(),
                 )
                 tmpFile.delete()