wm density Crash Rescue

device: Mi MIX 2S system: MIUI 10

Try and fail

My device crashed after trying to modify window density.

su
wm density 120

Screen went dark, adb shell reports error.

.\adb shell wm density reset

Tried force reboot, not working, and adb shell no longer worked due to permission. Device auto reboot into recovery.

Tried everything from Google and nothing works.

Tried adb command when restarting but encountered error.

.\adb shell wm density reset
Security exception: Must hold permission android.permission.WRITE_SECURE_SETTINGS

Solution

This reminds me of a way to circumvent device password lock, which I accidentally bumped into 2 weeks ago when modifying status bar icon.

Simply rename/remove

/system/priv-app/MiuiSystemUI/MiuiSystemUI.apk

Then reboot, you'll find yourself home screen immediately!!! Do anything you like to fix the resolution.