Cha*_*nya 7 android root su android-install-apk
我正在尝试从我的java代码安装系统应用程序,到目前为止,我还没有取得任何成功.
以下是我到目前为止所做的事情:
android:sharedUserId="android.uid.system"在Manifest中.我一直在努力(尝试,然后再尝试一些)Runtime.getRuntime.exec("su").我打算挂载系统分区rw,cat为apk 做一个,然后进行系统分区ro.以下是命令列表:
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.
Run Code Online (Sandbox Code Playgroud)INSTALL_PACKAGES清单中的许可.我尝试了许多exec("")格式的变体,包括使用'su -c'每个命令.我得到了Broken Pipe异常和安全异常.有时,我没有得到异常,但文件未被复制.
请让我知道我在这里缺少什么.有人有这个工作吗?
谢谢!
我继续挖掘,结果如下:
Run Code Online (Sandbox Code Playgroud)/* Until we have something better, only root and the shell can use su.*/ myuid = getuid(); if (myuid != AID_ROOT && myuid != AID_SHELL) { fprintf(stderr,"su: uid %d not allowed to su\n", myuid); return 1; }
ChainsDD(超级用户)和cyanogen mod通过实现自己的su.c来解决这个问题:https://github.com/CyanogenMod/android_system_su/blob/master/su.c
有什么特别之处/system/app?事实似乎是,该分区在非 root 设备上是只读的,从而防止修改/卸载放在那里的应用程序。https://android.stackexchange.com/questions/17871/what-are-the-differences- Between-a-system-app-and-user-app
使用平台密钥和 签名的应用程序sharedUserId = system对于我的目的而言“足够好”,我不需要专门将其复制到 /system/app。
我现在接受这个答案。
| 归档时间: |
|
| 查看次数: |
7226 次 |
| 最近记录: |