If I uninstall apps/services on an unrooted Android device via the ADB shell (e.g. by doing pm uninstall), where is this information stored?

Note that I'm not referring to settings within individual apps, but to their installation state.

I've read that uninstalling apps without root privileges will only remove those apps from normal user space through modifications to a configuration file (/data/system/packages.xml), but the app files physically remain on the device to allow reinstallation. If this is true, is packages.xml encrypted (being located in the encrypted /data folder) or can its contents be modified even without root access?

Motivation: Access to /data seems to require root privileges. If you soft-brick an unrooted Android device by accidentally uninstalling critical system apps (and hence modifying packages.xml) resulting in a boot loop, is there any practical way of restoring packages.xml to its stock configuration? Examples may include Samsung Knox or TEEGRIS services.

UPDATE: To clarify, the goal is not to wipe the device as suggested in the comments (this can be done any time from the recovery mode menu), but to find out whether or not the boot loop is caused by a persistent misconfiguration of a file residing in a secured area (persistent meaning that it cannot be reset by flashing e.g. the HOME_CSC firmware file without wiping the entire device and losing all data). Also, the device is not rooted.

NOTE: There is an interesting comment below the answer to Can system apps be enabled/disabled directly from the filesystem? :

"It is also safe to simply remove the package-restrictions.xml file — a new 'clean' file will be recreated on next reboot." – ccpizza Oct 3, 2021 at 16:43

As far as I understand, Android 9.0 switched from Full-Disk Encryption (FDE) to File-Based Encryption (FBE), which means that encryption is done on a file-by-file basis by default.

Is it possible to delete package-restrictions.xml (instead of modifying its content in order to restore individual app settings) from an unrooted device?

  • I shouldn't be here but gosh this is too confusing for me to even answer, sorry. Try to rewipe or format, it is in your device recovery firmware. It's easier if you have Clockworkmods or TWRP Recovery on your phone, but some phones don't make it easy for you to put those recovery firmwares on them. Put the iso rom on an sd card and insert it in your phone because you bricked your phone, that was the major f-u-c-k-up, now you have to wipe your device, some will wipe sd cards to so wipe the phone before you put the sd card in. I wish I knew more like you did with devices. I used ODIN to flash... Jun 21, 2022 at 4:42
  • The file is encrypted and can't be changed other than by a running OS on the phone. But even if it would be not encrypted this would not help you because if the bootloader is locked you can only boot something that is signed by Samsung. So how would you modify the content? I don't think you can use Odin to partially manipulate the user data partition so the only way would be to desolder the flash chip, attach it to a system where you could communicate with the flash chip (I don't think something like this would be cheap). And then re-solder the chip which is again an extremely difficult task.
    – Robert
    Jun 21, 2022 at 7:34
  • Does this answer your question? Cannot log in after disabling Android package from TWRP or with ADB
    – alecxs
    Jun 21, 2022 at 9:00
  • @Ethanmiller Sorry, but your comment is completely incoherent and unintelligible. I think the question is crystal-clear. What do you find confusing? Also, you're throwing together "Clockworkmods", "TWRP Recovery", "ISO ROM", "SD CARD", "wipe your device"...it's a complete mess to be honest. Could you try to formulate a coherent solution or at least explain what you are trying to achieve? Please note: The objective here is not to wipe the device (I can do that any time from the recovery mode)
    – srhslvmn
    Jun 21, 2022 at 14:32
  • @alecxs Please read the question. The device is not rooted, therefore the suggested solution is not applicable (or is it?)
    – srhslvmn
    Jun 21, 2022 at 14:52


You must log in to answer this question.

Browse other questions tagged .