3

There seems to be confusion regarding the behavior of pm uninstall from the ADB shell, see also here and here.

Question: What configuration files does pm uninstall write to, is it /data/system/packages.xml, /data/system/users/0/package-restrictions.xml or both? Are there any additional files?

Note: This questions specifically concerns the behavior of pm uninstall, not pm disable. Furthermore, it concerns the behavior on unrooted devices.

Motivation: Uninstalling the wrong apps doing pm uninstall can result in a soft-brick/boot loop. Therefore, reversing the effects of pm uninstall can be the easiest way out of such problem, especially if other methods risk wiping data that needs to be rescued.

srhslvmn
  • 289
  • 1
  • 11
  • 2
    I think the question title should better be "What EXACTLY does pm uninstall do when uninstalling a system app". Because on regular apps it doesn't matter if your device is rooted or not, the app would simply be uninstalled. Also on system apps I don't think pm would be able to uninstall (delete) it even with root permissions. – Robert Jun 22 '22 at 15:58
  • 1
    ...this bit of information should actually be part of an answer. Also, the solution should be specific to Android 9.0 or at least include it. – srhslvmn Jun 22 '22 at 16:00
  • I don't think that somebody exactly has the answer to this question. But you can try it out yourself. get yourself a rooted emulator, uninstall a system app as you did on your Samsung phone and then compare the xml files before and after uninstalling the system app. A possible emulator for that purpose would be Genymotion as it provides images for different Android versions. – Robert Jun 22 '22 at 16:14
  • curious about what is the difference between pm block vs hide vs disable vs disable-user vs uninstall for system apps – alecxs Jun 24 '22 at 11:56
  • As I understand, Android is open source and written entirely in C. I don't have sufficient command of C, but would it be possible to find definite answers in regard to function behavior by searching the source code (https://cs.android.com/android/platform/superproject)? – srhslvmn Jun 24 '22 at 15:43
  • 1
    yes, homework for someone with too many free time hehe.. actually it's java/kotlin ;) – alecxs Jun 24 '22 at 17:01

0 Answers0