Skip to content

Instantly share code, notes, and snippets.



Last active Oct 17, 2020
What would you like to do?
unset a setting if it breaks your android OS

This guide tells you how to reset a system setting in case your OS breaks once you change it. In my case, as soon as I enabled the "force RTL layout" setting, I got "System UI stopped working" over and over again, even in safe mode.


  • This guide is written for Android 5.1, it should work for older versions (with remarks, cf. below), it might work for newer versions.
  • You'll need a custom recovery, I recomment TWRP.
  • You'll need adb available, google around to know how to install it on your OS. If you're on windows, ensure you have the drivers for your smartphone!
  • USB debugging should be enabled in the developer menu
  • If you already have root access over ADB on your phone, you can skip the entire "reboot into recovery and mount /system and /data" part. You will probably still need the reboot at the end though.

What to do

Connect your smartphone to your computer.

# reboot in recovery
# you may see a pop-up asking whether you want to allow your computer to remotely debug your phone, click "allow"
adb reboot recovery

Once you've booted into recovery, mount /system and /data (how to do this depends on your recovery). Start a shell on your phone by executing

# first, make sure we're root
adb root

# start a shell
adb shell

Next, execute these commands in the ADB shell:

# we need this to get sqlite to work
cd /system/lib

# open the database
# NOTE for older devices: if any of the following commands fail,
# try the files below, until you find one that works:
# - /data/data/
# - /dbdata/databases/
# NOTE if sqlite3 can't be found: this guide won't work for you, you can use
# the guide here instead:
/system/xbin/sqlite3 /data/data/

We're now in the database, tread carefully!

-- take a look at all settings
SELECT * FROM global;

-- you'll see a bunch of output, find the setting that you just changed
-- (if it's the last setting you changed, it should be the last line)
-- the line constist of <number>|<name>|<value>
-- remember the name, and replace <name> in the command below with the name of your setting

-- change the setting
-- values:
-- - checkbox that should be off: 0
-- - checkbox that should be on: 1
-- - other: ???
-- replace <value> with the correct value in the command below.
UPDATE global SET value = '<value>' WHERE name = '<name>';
-- For example: the command I had to enter was:
-- UPDATE global SET value = '0' WHERE name = 'debug.force_rtl';

Close the database and the adb shell by hitting ctrl + D twice. Once you're back in the shell of your computer, run

adb reboot

and you're done.


This comment has been minimized.

Copy link

@j3dd j3dd commented Sep 10, 2015

Saved me from restoring a nandroid backup


This comment has been minimized.

Copy link

@yanko yanko commented May 14, 2016

I have enabled "force RTL layout" on my note 5 android 6.0.1, and I am getting the System UI issue. I tried "adb devices"
but it does not see my device connected.
is there a way to possibly use TWRP to copy the setting.db file and on a pc use sqlite3 to update the "debug.force_rtl" record and then
replace the settings.db back on the device?

thank you.


This comment has been minimized.

Copy link

@oboenikui oboenikui commented Jun 27, 2016

I found another solution using "content" command. Root access isn't required.
Boot into normal system, and execute

adb shell content delete --uri content://settings/global --where "name='debug.force_rtl'"
adb reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment