예제 #1
0
 /**
  * modify SERIAL
  *
  * @param lpparam
  */
 public static void handleSERIAL(XC_LoadPackage.LoadPackageParam lpparam) {
   try {
     Log.d(TAG + "-" + "handleSERIAL", new Exception().getStackTrace()[0].getMethodName());
     String SERIAL_VAL = "";
     try {
       FileLoaderBaseVersion imeiLoader =
           new FileLoaderBaseVersion(AppsParameters.PARAM_FILE_PATH);
       SERIAL_VAL = imeiLoader.loadKeyValue("SERIAL");
     } catch (Exception e) {
       SERIAL_VAL = getRandomSERIAL();
     } finally {
       XposedHelpers.setStaticObjectField(Build.class, "SERIAL", SERIAL_VAL);
     }
   } catch (Exception e) {
     Log.e(TAG, lpparam.packageName + " has error:" + e.toString());
   }
 }
예제 #2
0
  public void getSettingsFromDB(String process_name) {
    if (!process_name.equals("android")) {
      return;
    }
    ArrayList<ProcessSetting> ps =
        (ArrayList<ProcessSetting>)
            XposedHelpers.getStaticObjectField(ProcessSettingDBHelper.class, "psettings");
    if (ps == null) {
      XposedHelpers.setStaticObjectField(
          ProcessSettingDBHelper.class, "psettings", new ArrayList<ProcessSetting>());
    } else {
      return;
    }
    /* Read DB */

    try {
      Runtime.getRuntime()
          .exec(
              new String[] {
                "su", "-c", "chown root.root /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db"
              });
    } catch (IOException e) {
      XposedBridge.log(
          "chown root.root /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db failed.");
    }
    try {
      Runtime.getRuntime()
          .exec(
              new String[] {
                "su", "-c", "chmod 777 /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db"
              });
    } catch (IOException e) {
      XposedBridge.log("chmod 777 /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db failed.");
    }
    try {
      Runtime.getRuntime()
          .exec(
              new String[] {
                "su",
                "-c",
                "chown root.root /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db-journal"
              });
    } catch (IOException e) {
      XposedBridge.log(
          "chown root.root /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db-journal failed.");
    }
    try {
      Runtime.getRuntime()
          .exec(
              new String[] {
                "su", "-c", "chmod 777 /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db-journal"
              });
    } catch (IOException e) {
      XposedBridge.log(
          "chmod 777 /data/data/sg.edu.nus.soc.cs5231/databases/cs5231.db-journal failed.");
    }
    ProcessSettingDBHelper db = new ProcessSettingDBHelper(null);
    XposedHelpers.setStaticObjectField(
        ProcessSettingDBHelper.class, "psettings", db.getAllProcessSetting());
    ;
    XposedBridge.log(
        "JASON: DB LOADED WITH "
            + ((ArrayList<ProcessSetting>)
                    XposedHelpers.getStaticObjectField(ProcessSettingDBHelper.class, "psettings"))
                .size()
            + " PROCESS SETTINGS.");
    /* End Read DB */
  }