|
|
@@ -67,7 +67,7 @@ object Global {
|
|
|
}
|
|
|
|
|
|
@JvmStatic
|
|
|
- fun save(telephonyConfig: TelephonyConfig) {
|
|
|
+ fun save(telephonyConfig: TelephonyConfig, suspend: Boolean? = true) {
|
|
|
val context = Utils.getContext()
|
|
|
Global.telephonyConfig.mcc = telephonyConfig.mcc
|
|
|
Global.telephonyConfig.mnc = telephonyConfig.mnc
|
|
|
@@ -78,6 +78,9 @@ object Global {
|
|
|
Global.telephonyConfig.imsi = telephonyConfig.imsi
|
|
|
|
|
|
try {
|
|
|
+ if (suspend == true) {
|
|
|
+ suspend(gms = true, sms = true)
|
|
|
+ }
|
|
|
val file = File(ContextCompat.getDataDir(context), "config.json")
|
|
|
val gson = Gson()
|
|
|
val json = gson.toJson(telephonyConfig)
|
|
|
@@ -93,8 +96,12 @@ object Global {
|
|
|
Utils.runAsRoot(
|
|
|
"cp " + file.path + " /data/data/com.android.phone/rcsConfig.json",
|
|
|
"echo 'copied to phone'",
|
|
|
- "chmod 777 /data/data/com.android.phone/rcsConfig.json"
|
|
|
+ "chmod 777 /data/data/com.android.phone/rcsConfig.json",
|
|
|
+ "sleep 1"
|
|
|
)
|
|
|
+ if (suspend == true) {
|
|
|
+ unsuspend(gms = true, sms = true)
|
|
|
+ }
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
}
|
|
|
@@ -103,7 +110,26 @@ object Global {
|
|
|
@JvmStatic
|
|
|
fun clear(gsf: Boolean, gms: Boolean, sms: Boolean) {
|
|
|
try {
|
|
|
+ suspend(gsf, gms, sms)
|
|
|
val cmds: MutableList<String> = ArrayList()
|
|
|
+ // suspend
|
|
|
+ if (gsf) {
|
|
|
+ cmds.add("pm suspend com.google.android.gsf")
|
|
|
+ cmds.add("am force-stop com.google.android.gsf")
|
|
|
+ cmds.add("echo 'gsf suspended'")
|
|
|
+ }
|
|
|
+ if (gms) {
|
|
|
+ cmds.add("pm suspend com.google.android.gms")
|
|
|
+ cmds.add("am force-stop com.google.android.gms")
|
|
|
+ cmds.add("echo 'gms suspended'")
|
|
|
+ }
|
|
|
+ if (sms) {
|
|
|
+ cmds.add("pm suspend com.google.android.apps.messaging")
|
|
|
+ cmds.add("am force-stop com.google.android.apps.messaging")
|
|
|
+ cmds.add("echo 'sms suspended'")
|
|
|
+ }
|
|
|
+ cmds.add("sleep 1")
|
|
|
+ // clear
|
|
|
if (gsf) {
|
|
|
cmds.add("pm clear com.google.android.gsf")
|
|
|
cmds.add("echo 'cleared gsf'")
|
|
|
@@ -116,29 +142,93 @@ object Global {
|
|
|
cmds.add("pm clear com.google.android.apps.messaging")
|
|
|
cmds.add("echo 'cleared sms'")
|
|
|
}
|
|
|
+ cmds.add("sleep 1")
|
|
|
+ // unsuspend
|
|
|
+ if (gsf) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.gsf")
|
|
|
+ cmds.add("echo 'gsf unsuspend'")
|
|
|
+ }
|
|
|
+ if (gms) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.gms")
|
|
|
+ cmds.add("echo 'gms unsuspend'")
|
|
|
+ }
|
|
|
+ if (sms) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.apps.messaging")
|
|
|
+ cmds.add("echo 'sms unsuspend'")
|
|
|
+ }
|
|
|
+ cmds.add("sleep 1")
|
|
|
Utils.runAsRoot(*cmds.toTypedArray<String>())
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// @JvmStatic
|
|
|
+// fun stop(gsf: Boolean? = false, gms: Boolean? = false, sms: Boolean? = false) {
|
|
|
+// try {
|
|
|
+// val cmds: MutableList<String> = ArrayList()
|
|
|
+// if (gsf == true) {
|
|
|
+// cmds.add("am force-stop com.google.android.gsf")
|
|
|
+// cmds.add("echo 'stopped gsf'")
|
|
|
+// }
|
|
|
+// if (gms == true) {
|
|
|
+// cmds.add("am force-stop com.google.android.gms")
|
|
|
+// cmds.add("echo 'stopped gms'")
|
|
|
+// Thread.sleep(1000)
|
|
|
+// }
|
|
|
+// if (sms == true) {
|
|
|
+// cmds.add("am force-stop com.google.android.apps.messaging")
|
|
|
+// cmds.add("echo 'stopped sms'")
|
|
|
+// }
|
|
|
+// Utils.runAsRoot(*cmds.toTypedArray<String>())
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
@JvmStatic
|
|
|
- fun stop(gsf: Boolean? = false, gms: Boolean? = false, sms: Boolean? = false) {
|
|
|
+ fun suspend(gsf: Boolean? = false, gms: Boolean? = false, sms: Boolean? = false) {
|
|
|
try {
|
|
|
val cmds: MutableList<String> = ArrayList()
|
|
|
if (gsf == true) {
|
|
|
+ cmds.add("pm suspend com.google.android.gsf")
|
|
|
cmds.add("am force-stop com.google.android.gsf")
|
|
|
- cmds.add("echo 'stopped gsf'")
|
|
|
+ cmds.add("echo 'gsf suspended'")
|
|
|
}
|
|
|
if (gms == true) {
|
|
|
+ cmds.add("pm suspend com.google.android.gms")
|
|
|
cmds.add("am force-stop com.google.android.gms")
|
|
|
- cmds.add("echo 'stopped gms'")
|
|
|
- Thread.sleep(1000)
|
|
|
+ cmds.add("echo 'gms suspended'")
|
|
|
}
|
|
|
if (sms == true) {
|
|
|
+ cmds.add("pm suspend com.google.android.apps.messaging")
|
|
|
cmds.add("am force-stop com.google.android.apps.messaging")
|
|
|
- cmds.add("echo 'stopped sms'")
|
|
|
+ cmds.add("echo 'sms suspended'")
|
|
|
}
|
|
|
+ cmds.add("sleep 1")
|
|
|
+ Utils.runAsRoot(*cmds.toTypedArray<String>())
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @JvmStatic
|
|
|
+ fun unsuspend(gsf: Boolean? = false, gms: Boolean? = false, sms: Boolean? = false) {
|
|
|
+ try {
|
|
|
+ val cmds: MutableList<String> = ArrayList()
|
|
|
+ if (gsf == true) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.gsf")
|
|
|
+ cmds.add("echo 'gsf unsuspend'")
|
|
|
+ }
|
|
|
+ if (gms == true) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.gms")
|
|
|
+ cmds.add("echo 'gms unsuspend'")
|
|
|
+ }
|
|
|
+ if (sms == true) {
|
|
|
+ cmds.add("pm unsuspend com.google.android.apps.messaging")
|
|
|
+ cmds.add("echo 'sms unsuspend'")
|
|
|
+ }
|
|
|
+ cmds.add("sleep 1")
|
|
|
Utils.runAsRoot(*cmds.toTypedArray<String>())
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
@@ -166,6 +256,8 @@ object Global {
|
|
|
arch = "arm"
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(arch)) {
|
|
|
+ suspend(sms = true)
|
|
|
+
|
|
|
val binPath = File(dataDir, "bin/sqlite3.$arch").path
|
|
|
Log.i("Modifier", "sqlite3 binPath: $binPath")
|
|
|
Utils.runAsRoot(
|
|
|
@@ -174,12 +266,13 @@ object Global {
|
|
|
"$binPath /data/data/com.google.android.apps.messaging/databases/bugle_db \"DELETE FROM messages;\"",
|
|
|
"echo ok"
|
|
|
)
|
|
|
- stop(false, false, true)
|
|
|
+ unsuspend(sms = true)
|
|
|
Utils.runAsRoot("am start com.google.android.apps.messaging")
|
|
|
Utils.runAsRoot("input keyevent KEYCODE_BACK")
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
}
|