Monday, January 30, 2017

twrp - How to uninstall a system app using adb uninstall command (NOT remove via rm or any other way)


Have to mention this to avoid possible confusion, this question is not duplicate. This question is specific to using adb to uninstall a package. There are several similar questions but are all different from this one, as they're focused on removing an application by any means.


Please do not provide answers using "rm" command to delete the package files. Also, answers related to malformed package names, or trailing carriage returns. I think they're pretty much all covered in all the other questions.


I had pm uninstall functionality but after ROM upgrade. Some things won't uninstall anymore. For example the following two system apps (which I removed under previous ROM, significantly improving overall performance):

/system/priv-app/SecurityCenter/SecurityCenter.apk=com.miui.securitycenter
/system/app/Updater/Updater.apk=com.android.updater


Now I get an error trying to pm uninstall them: Failure [DELETE_FAILED_INTERNAL_ERROR]


But other system apps (which won't uninstall through regular android interface) do uninstall via pm uninstall command. Example:
/system/priv-app/Browser/Browser.apk=com.android.browser


So both are system apps, what could be the difference between them?


For reference, I upgraded from MIUI 8.1.6.0 to 8.5.3.0, and re-installed TWRP and SuperSU. This question is not specific to my ROM, as I see other people are in the same situation. But I seem to have an advantage being able to be able to uninstall some system apps. And am willing to contribute, to find a solution for everyone, to uninstall any app.


I tried: mount -o rw,remount /system
but that didn't solve it.


Please help out with any ideas along the way. Thanks!





Update 1 - Confirming steps to avoid intermittent issues
* Wiped all partitions in TWRP
* Installed Latest ROM (MIUI 8.5.3.0)
* Went back to TWRP, wiped only /Data
* Restored /Data from backed up version of the ROM that came with device (MIUI 8.1.6.0)
* Now after I boot into OS, ROM shows as latest (MIUI 8.5.3.0) in settings


Now I am able to pm uninstall every app I've tried. Even the most resilient: Google APP, Updater, Security.


This Frankenstein.. err I mean hybrid ROM works fine so far, and I've already removed many system packages, making the phone (Redmi 3S+) visibly faster. But I would still like to pinpoint what was causing this to make it into Generic Solution. So, if it ain't broke I'm willing break it, so next time it breaks we will know what's causing it and how to fix it.


Update 2 -

* Wiped all partitions and restored all partitions from Original ROM.
* Restored to factory settings (using TWRP)
* and after booting into ROM, went back to TWRP and made another backup
* Using same scenario as in Update 1 above, with only exception of using /Data from here. pm uninstall does not work.


Any thoughts on the differences between the two /Data partitions I should be focusing on?




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...