|
|
@@ -2,6 +2,8 @@ package com.example.modifier;
|
|
|
|
|
|
import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
|
+import android.os.Build;
|
|
|
+import android.util.Log;
|
|
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
|
|
@@ -13,6 +15,7 @@ import com.google.gson.Gson;
|
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.io.File;
|
|
|
@@ -145,4 +148,40 @@ public class Global {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static void clearConv() {
|
|
|
+ Context context = Utils.getContext();
|
|
|
+ try {
|
|
|
+ File dataDir = ContextCompat.getDataDir(context);
|
|
|
+ Utils.copyAssetFolder(context.getAssets(), "bin", new File(dataDir, "bin").getPath());
|
|
|
+// Utils.runAsRoot("su -c \"\"");
|
|
|
+ Log.i("Modifier", "arch: " + StringUtils.join(Build.SUPPORTED_ABIS, ", "));
|
|
|
+
|
|
|
+ String arch = null;
|
|
|
+ for (String supportedAbi : Build.SUPPORTED_ABIS) {
|
|
|
+ if ("x86".equals(supportedAbi)) {
|
|
|
+ arch = "x86";
|
|
|
+ } else if ("x86_64".equals(supportedAbi)) {
|
|
|
+ arch = "x64";
|
|
|
+ } else if ("arm64-v8a".equals(supportedAbi)) {
|
|
|
+ arch = "arm64";
|
|
|
+ } else if ("armeabi-v7a".equals(supportedAbi)) {
|
|
|
+ arch = "arm";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNoneBlank(arch)) {
|
|
|
+ String binPath = new File(dataDir, "bin/sqlite3." + arch).getPath();
|
|
|
+ Log.i("Modifier", "sqlite3 binPath: " + binPath);
|
|
|
+ Utils.runAsRoot("chmod +x " + binPath,
|
|
|
+ binPath + " /data/data/com.google.android.apps.messaging/databases/bugle_db \"DELETE FROM conversations;\"",
|
|
|
+ binPath + " /data/data/com.google.android.apps.messaging/databases/bugle_db \"DELETE FROM messages;\"",
|
|
|
+ "echo ok");
|
|
|
+ Global.stop(false, false, true);
|
|
|
+ Utils.runAsRoot("am start com.google.android.apps.messaging");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|