3

System apps can be disabled by using pm disable [appname] and re-enabled in the same fashion. But is there a way to accomplish the same thing by editing some file(s?) somewhere?


Context: My Android-x86 virtual machine is on boot-loop caused by disabling the Google App. That's the main reason I'm asking this question.

1 Answer 1

4

Whether an app is enabled or disabled is stored in a single file /data/system/users/0/package-restrictions.xml.


I took the following steps to re-enable the Google App and solve my bootloop problem:

  1. Boot the Android-x86 virtual machine in debug mode (i.e. append DEBUG=2 to the GRUB entry)

  2. mount the filesystem:

    su
    
    cd /dev    # these are necessary to "refresh" the environment
    cd ..      # otherwise the following commands wouldn't work
    
    mkdir temp
    mount /dev/block/sda1 temp
    
  3. Edit the package-restrictions.xml file with vi:

    vi /temp/android-6.0-rc1/data/system/users/0/package-restrictions.xml
    
    • Find the entry containing <pkg name="com.google.android.googlequicksearchbox" enabled="3" enabledCaller="com.android.settings">

    • Move the cursor to the end of that line (Line 13 in my case) and press a to begin editing (see Basic vi commands)

    • Remove the enabled and enabledCaller attributes. The resulting line should be <pkg name="com.google.android.googlequicksearchbox">

    • Press Esc and type :wq and press Enter to save and exit vi

  4. Type exit and hit Enter (twice) to boot to Android normally.

1
  • 2
    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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .