請參考下面的代碼,通過RootTools方法的幫助將用戶應用程序apk移動到生根設備的系統應用程序apk中。
PackageInfo paramPackageInfo = null;
try {
paramPackageInfo = this.getPackageManager().getPackageInfo(
this.getPackageName(), 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
ApplicationInfo localApplicationInfo = paramPackageInfo.applicationInfo;
String str1 = "/system/app/" + localApplicationInfo.packageName
+ ".apk";
String str2 = "busybox mv " + localApplicationInfo.sourceDir + " "
+ str1;
RootTools.remount("/system", "rw");
RootTools.remount("/mnt", "rw");
CommandCapture command = new CommandCapture(0, str2,
"busybox chmod 644 " + str1);
try {
RootTools.getShell(true).add(command).waitForFinish();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
} catch (RootDeniedException e) {
e.printStackTrace();
}
RootTools.remount("/system", "ro");
RootTools.remount("/mnt", "ro");
必要Busybox的和超級用戶的應用程序,而在應用程序中使用上面的代碼。
你打算開發一個有根系統的系統嗎 –
@ArunCThomas是它的根源設備 –
然後通過supersu應用發佈你正在做的命令? – DThought