I wrote something to uninstall (delete) an App and have now the problem that the apk seems to be deleted but the app is not really deleted from phone..
The supposedly deleted app still exists in the launchers app drawer. And I can open the app, but it force closes the app.
I tested the procedure with an own App (existing at /data/app, not /system/app). With systemapps I didn't test.
Here the code:
private void delApp() {
String deleteCMD = "rm " + packageInfo.applicationInfo.sourceDir;
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();
}
}