Android Setting中的相关选项都保存在数据库中,数据库的位置在:
/data/data/com.android.providers.settings/databases/settings.db
Android使用sqlite3作为数据库,我们可以使用adb来管理这个数据库, 具体方法如下:
$ adb shell
#sqilte3 /data/data/com.android.providers.settings/databases/settings.db
//打开了settings.db通过sqlite3
//使用.table可以查看当前所有的表
sqlite> .table
android_metadata bookmarks secure
bluetooth_devices global system
//.dump 表名 可以查看表下所有数据
sqlite> .dump system
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE system (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT UNIQUE ON CONFLICT REPLACE,value TEXT);
INSERT INTO system VALUES(1,'volume_music','8');
INSERT INTO system VALUES(2,'volume_ring','4');
INSERT INTO system VALUES(3,'volume_system','7');
INSERT INTO system VALUES(4,'volume_voice','4');
INSERT INTO system VALUES(5,'volume_alarm','6');
INSERT INTO system VALUES(6,'volume_notification','4');
INSERT INTO system VALUES(7,'volume_bluetooth_sco','7');
INSERT INTO system VALUES(9,'mute_streams_affected','46');
INSERT INTO system VALUES(10,'vibrate_when_ringing','0');
INSERT INTO system VALUES(11,'dim_screen','1');
INSERT INTO system VALUES(12,'screen_off_timeout','60000');
INSERT INTO system VALUES(13,'wifi_use_auto_connect','0');
INSERT INTO system VALUES(14,'ps_to_wifi_reselect','2');
INSERT INTO system VALUES(15,'dtmf_tone_type','0');
INSERT INTO system VALUES(16,'hearing_aid','0');
INSERT INTO system VALUES(17,'tty_mode','0');
INSERT INTO system VALUES(18,'screen_brightness','0');
INSERT INTO system VALUES(19,'screen_brightness_mode','0');
INSERT INTO system VALUES(20,'window_animation_scale','1.0');
INSERT INTO system VALUES(21,'transition_animation_scale','1.0');
INSERT INTO system VALUES(22,'accelerometer_rotation','0');
INSERT INTO system VALUES(23,'haptic_feedback_enabled','1');
INSERT INTO system VALUES(24,'notification_light_pulse','1');
INSERT INTO system VALUES(25,'dtmf_tone','1');
INSERT INTO system VALUES(26,'sound_effects_enabled','1');
INSERT INTO system VALUES(28,'lockscreen_sounds_enabled','1');
INSERT INTO system VALUES(29,'pointer_speed','0');
INSERT INTO system VALUES(30,'cs_default','0');
INSERT INTO system VALUES(31,'ps_default','0');
INSERT INTO system VALUES(32,'sms_default','0');
INSERT INTO system VALUES(33,'online_card0','1');
INSERT INTO system VALUES(34,'online_card1','1');
INSERT INTO system VALUES(35,'sim_autocheck','1');
INSERT INTO system VALUES(36,'fastboot_pre_ringer_mode','2');
INSERT INTO system VALUES(37,'fastboot_off','0');
INSERT INTO system VALUES(38,'fastboot_enter_airplane_mode','0');
INSERT INTO system VALUES(39,'fastboot_pre_usb_mode','mtp,mass_storage,adb');
INSERT INTO system VALUES(40,'mode_ringer_streams_affected','294');
INSERT INTO system VALUES(41,'radio.data.stall.recovery.action','0');
INSERT INTO system VALUES(43,'settings_cfi_visible0','0');
INSERT INTO system VALUES(45,'bd_setting_i','869212020000551');
INSERT INTO system VALUES(46,'com.baidu.deviceid.v2','xj2KS4tIls2FkpetSBXsVG2BQ7QFfFCHjcQCfUUQOW+eKA5frlEJo0Ic93nwF+O7CHGsv9qbTO9U
Cke0u7ui9wRzbQ5TU0ixXsVRogfNn1K4zuJjAcRSh6eOzGPfBMK9');
INSERT INTO system VALUES(47,'com.baidu.deviceid','7FEF45E45806CEDE531677273DA51498');
INSERT INTO system VALUES(68,'sim_record_ready','0');
INSERT INTO system VALUES(69,'exist_card0','0');
CREATE INDEX systemIndex1 ON system (name);
COMMIT;
//当然也可直接通过adb查看
$ adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "select name, value from 'system';"
volume_music|8
volume_ring|4
volume_system|7
volume_voice|4
volume_alarm|6
volume_notification|4
volume_bluetooth_sco|7
mute_streams_affected|46
vibrate_when_ringing|0
dim_screen|1
screen_off_timeout|60000
wifi_use_auto_connect|0
ps_to_wifi_reselect|2
dtmf_tone_type|0
hearing_aid|0
tty_mode|0
screen_brightness|0
screen_brightness_mode|0
window_animation_scale|1.0
transition_animation_scale|1.0
accelerometer_rotation|0
haptic_feedback_enabled|1
notification_light_pulse|1
dtmf_tone|1
sound_effects_enabled|1
lockscreen_sounds_enabled|1
pointer_speed|0
cs_default|0
ps_default|0
sms_default|0
online_card0|1
online_card1|1
sim_autocheck|1
fastboot_pre_ringer_mode|2
fastboot_off|0
fastboot_enter_airplane_mode|0
fastboot_pre_usb_mode|mtp,mass_storage,adb
mode_ringer_streams_affected|294
radio.data.stall.recovery.action|0
settings_cfi_visible0|0
bd_setting_i|869212020000551
com.baidu.deviceid.v2|xj2KS4tIls2FkpetSBXsVG2BQ7QFfFCHjcQCfUUQOW+eKA5frlEJo0Ic93nwF+O7CHGsv9qbTO9U
Cke0u7ui9wRzbQ5TU0ixXsVRogfNn1K4zuJjAcRSh6eOzGPfBMK9
com.baidu.deviceid|7FEF45E45806CEDE531677273DA51498
sim_record_ready|0
exist_card0|0
http://stackoverflow.com/questions/16851774/how-to-use-a-script-to-query-android-sqlite-database