I'm writing a Uninstall App. I want to remove System App, of course my phone is Rooted. I use code from How to uninstall Android App with root permissions?.
private void delApp() {
String deleteCMD = "pm " + applicationInfo.packageName;
Process process;
try
{
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /system; \n");
os.writeBytes(deleteCMD+"; \n");
os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /system; \n");
os.flush();
}
catch (IOException e)
{
e.printStackTrace();
}
}
but my phone Toast a message "... has been Granted super User Permissons" and not remove app I choosed. I try with both User App and System App but not different. What am I missing ? How to remove System App with Root permissons and How to remove App without this Dialog (fast remove and automaticaly).
EDIT I solved my problem using this code, hope it help someone.
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o rw,remount /system\n");
os.writeBytes("rm -r "+ "[SourceDir]" + "\n");
os.writeBytes("mount -o ro,remount /system\n");
os.flush();
os.close();
process.waitFor();
note: [SourceDir] is your system app directory