Skip to content

Instantly share code, notes, and snippets.

@varhub
Last active July 6, 2018 12:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varhub/e10960fb290d5b6fa2bf to your computer and use it in GitHub Desktop.
Save varhub/e10960fb290d5b6fa2bf to your computer and use it in GitHub Desktop.
Privacy Guard - Recover from bootloop

Privacy Guard - Recover from bootloop

Copyright (C) 2016 Victor Arribas (CC-BY-NC-SA-4.0)


Abstract

Recover from bootloop after break CyanogenMod's Privacy Guard without data lost.

Story

I changed privacy options for some system apps, and yes, google services was one of them. This may result in a bootloop, and there is nothing to do except enter at recovery.

I only found 1, but factory reset was not a option for me. So I began inpect files through adb until found /data/system/appops.xml As spoke at 2 and 3 revert file or even simpler, delete it, is enough. Issue overcomed!

Solution

  1. Enter into recovery
  2. With embedded file manager (aromafm) or adb delete /data/system/appops.xml
  3. Reboot and redo all safe changes at Privacy Guard

Resources and middle steps

list (adb)

Fetch all phone files. Requires /system and /data to be mounted

find / -type f > /tmp/files.log

filter

cat files.log \
| egrep -v '/proc/|/sys/|/bin/|/sbin/|/xbin/|/cacerts/|/framework/|/lib/' \
| egrep -v '\.apk|\.so|\.jar' \
| egrep -v '/system/fonts/|/etc/nano/|/etc/terminfo/|/share/vim/|/media/audio/' \
| egrep -v '/dropbox/|/xprivacy/|mozilla.firefox/|telegram.messenger/|com.google.android.youtube/' \
| egrep -v '/media/0/DCIM/|/media/1/DCIM/' \
| egrep -v '/media/0/Telegram/|/media/0/WhatsApp' \
> files.filtered

puller

files='
/data/data/com.android.settings/shared_prefs/privacy_guard_manager.xml
'
out=android.settings

files='
/data/system/appops.xml
/data/system/device_policies.xml
/data/system/package-usage.list
'
out=system

[ -n "$out" ] && mkdir -p $out
for file in $files
do
[ -z "$file" ] && continue
adb pull $file $out
done

Bibliography

@kapaggar
Copy link

kapaggar commented Jan 4, 2017

You saved atleast 2 hours of my life.

messed up with some Privacy Guard settings.
Bootloop
SD Card was encrypted
OOoo Sheeit
adb shell rm /data/system/appops.xml
defibrillated my android

@Erwane
Copy link

Erwane commented Nov 22, 2017

Thanks a lot.

My stucked s4 mini is completely working.

@Latechneuse
Copy link

Latechneuse commented May 29, 2018

After changing "Google Play Services" permissions I entered into a boot loop.
As I didn't want to re-configure all the app permissions, I downloaded aoppops.xml through adb (adb pull /data/system/appops.xml) and edited it by removing the section
<pkg n="com.google.android.gms"> … </pkg>
This just removes all settings for Google Play Services.
After that I uploaded the edited file (adb push appops.xml /data/system/appops.xml) and everything works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment