Changing Android system options via adb shell

While setting up an unattended testing environment which uses Android emulators, I’ve run into difficulties with the default system settings.

An Android Virtual Device – like any freshly-installed Android device – is created with default settings which are not very friendly for a testing environment, namely:

  • the lock screen is active, and shows up when the device boots
  • there’s the “make yourself at home” cling screen which overlays the launcher
  • default timezone is not right for my location
  • screen off timeout is too short


All of these cause difficulties for unattended instantiation of new AVDs.

The "make yourself at home" screen. Known internally as "cling" screen.

The “make yourself at home” screen. Known internally as cling screen.

Fortunately most of the system settings can be changed in the settings provider database (/data/data/ This works for the Android emulator (tested with Android API 19-22), but should also work for rooted Nexus devices.

The database has 3 main useful tables, where most of the interesting settings are stored: system; global; and secure.

All of these tables have 3 columns: _id; name; and value. Entries look like:

sqlite> select * from global;

So, for example disabling “daydream” is done with:

adb -s emulator-5554 shell sqlite3 /data/data/ "update secure set value = '0' where name = 'screensaver_enabled'"

Other queries for different settings:

## sleep timer 30 minutes
update system set value = '1800000' where name = 'screen_off_timeout'
## daydream off
update secure set value = '0' where name = 'screensaver_enabled'
## disable auto time zone
update global set value = '0' where name = 'auto_time_zone'
## change time format to 24h
 insert into system (name,value) values ('time_12_24','24')

For some reason the timezone is not changeable in the database, to set a TZ one must do:

adb -s emulator-5554 shell "setprop persist.sys.timezone Europe/London"

Dismissing the “make yourself at home” welcome screen is a bit trickier, but can be done with:

adb -s emulator-5554 shell 'cat <<EOFLOL >/data/data/
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <null name="" />
 <boolean name="cling.workspace.dismissed" value="true" />
 <boolean name="cling.allapps.dismissed" value="true" />
 <boolean name="cling.folder.dismissed" value="true" />
 <int name="" value="-1" />
 <string name="android.incremental.version">999428</string>

Disabling the lockscreen, setting it to “None” was harder to figure out, but is achieved by deleting the lock settings database files:

adb -s emulator-5554 shell rm -f /data/system/locksettings.db*

In the end a restart of the device is required, and it will boot with the modified settings.