问题描述
在这里我是一个星系S6的用户,我发现开关近期的应用按钮(一个在home键的左边)而在玩游戏一样虚荣,因为我misclicked它经常很烦人。之后做一些研究,我发现,这是可能的注释掉在系统的/ usr / keylayout generic.kl的关键254,然后我出来与创建它注释掉键254新generic.kl的想法,那么与我的应用程序按钮,点击它会在文件移动与评论钥匙系统的/ usr / keylayout,以取代旧的方式,反之亦然,我会恢复按钮那里将原来generic.kl当我恢复婉近期应用程序切换到重新开始工作。所以在这里我的问题是,这将是code移动文件到系统并更换了吗?我有一些基本的Android编程知识,我的手机是扎根。
Im a galaxy s6 user here, I found out that the switch recent app button (the one on the left of the home button) quite annoying while playing game like vainglory because I misclicked it quite often. After doing some research I found out that it is possible to comment out the key 254 of generic.kl under system/usr/keylayout, then i come out with an idea of creating a new generic.kl which commented out the key 254, then with a click of button on my app it will move the file with the commented key to system/usr/keylayout to replace the old way, vice versa, I will make a restore button there to restore it will the original generic.kl when I wan the recent app switch to start working again. So my question here is what would be the code to move a file to system and replace it? I do have some basic android programming knowledge and my phone is rooted.
先谢谢了。
推荐答案
使用下面的code复制到系统中。需要root访问权限。
Use the code below to copy to system. Requires root access.
void copyToSystem() {
try {
Process proc = Runtime.getRuntime().exec(
new String[]{
"su", "-c",
"mount -o rw,remount /system ;"
+ " cp -f /storage/sdcard0/MyFolder/MyKeyLayout.kl /system/usr/keylayout/ ;"
+ " mount -o ro,remount /system"});
proc.waitFor();
} catch (Exception ex) {
ex.printStackTrace();
}
}
您需要导入 java.lang.Process中
,而不是 android.os.Process
注意: CP -f
确保文件被替换,如果现有
Note: cp -f
ensures that the file is replaced if already existing.
这篇关于安卓code键移动文件到系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!