使用Runtime.getRuntime()将文件复制到/ system文件夹中exec
问题描述:
我必须复制/system/media/audio/ringtones
中的.mp3
文件,然后将其设置为默认铃声。
我尝试将它与复制:使用Runtime.getRuntime()将文件复制到/ system文件夹中exec
Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("mount -o rw, remount -t yaffs2 /dev/block/mtdblock4 /system");
Runtime.getRuntime().exec("cp /storage/sdcard0/MyFile.mp3 /system/media/audio/ringtones/MyFile.mp3");
Runtime.getRuntime().exec("mount -o ro, remount -t yaffs2 /dev/block/mtdblock4 /system");
,但没有发生,即使我手动根探险(我运行在星系S2上的CyanogenMod 10.2) ...为什么要改变/system
目录的权限?
如果我尝试在其他目录中复制(即/ storage/sdcard0/folder /)所有工作正常。一些提示将不胜感激。之后,我如何设置文件系统中某个位置的.mp3
文件作为默认铃声?
答
我有更换bootanimation.zip类似的问题,这是我如何解决它。希望它有助于某人。
Runtime.getRuntime().exec("mount -o remount,rw system /system");
Runtime.getRuntime().exec("cp /storage/emulated/0/bootanimation/bootanimation.zip /system/media/bootanimation.zip");
Runtime.getRuntime().exec("chmod 644 /system/media/bootanimation.zip");
Runtime.getRuntime().exec("mount -o remount,ro system /system");
您是否拥有手机的root权限? –
是的,我运行cyanogenmod,它的根源:D – Fujitina