我正在尝试从我的Java代码中安装一个系统应用程序,但迄今为止我还没有成功。
以下是我已经完成的内容:
- My device is rooted.
- My "installer" app is installed as a system app. (copied it manually to /system/app)
- I have signed the installer apk with platform key, and I have
android:sharedUserId="android.uid.system"
in the Manifest. I have been trying (and trying, and then some more) for
Runtime.getRuntime.exec("su")
. I intend to mount the system partition asrw
, do acat
for the apk, and then make system partitionro
. Following is the list of commands:mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system<br> cat /sdcard/application.apk > /system/app/application.apk<br> mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system<br><br>The application.apk here is the app being installed from the installer app. This app is also signed with platform key, and has the sharedUserId configured.
- I have requested for the
INSTALL_PACKAGES
permission in the manifest.
我尝试了多种exec("")格式的变化,包括在每个命令中使用'su -c'。我遇到了Broken Pipe异常和Security异常。有时候我没有得到异常,但是文件没有被复制。
请告诉我我错过了什么。有人成功实现了吗?
谢谢!