以编程方式将文件复制到根分区

时间:2014-05-11 13:23:48

标签: android process root

我正在开发一个以编程方式修改build.prop的root应用程序。 我将build.prop从/system/build.prop复制到/sdcard/ 但修改后我无法复制回根分区

这是我将build.prop从/system/build.prop复制到/sdcard/

的代码
protected void SUCommand()
{
    String sSUCommand = "cp /system/build.prop /sdcard/";
    final String[] sCommand = {"su","-c",sSUCommand};

    Thread thSUProcess = new Thread()
    {
        public void run()
        {
            try
            {
                Process p = Runtime.getRuntime().exec(sCommand);

            }
            catch(Exception e){}
        }

    };


    thSUProcess.start();

}

我将String sSUCommand = "cp /system/build.prop /sdcard/";更改为String sSUCommand = "cp /sdcard/build.prop /system/";以将其复制到系统分区 但没有奏效

我已经根植了我的手机并成功运行了很多根应用程序 请告诉我正确的方法

1 个答案:

答案 0 :(得分:1)

您可能希望将系统分区挂载为rw而不是rd以便执行此操作

https://android.stackexchange.com/questions/25250/how-to-mount-system-in-rw-mode-if-no-custom-recovery