一位朋友玩Broncho A1的锁屏图案,结果手机被锁住了,输入google ID也不行(在我这里可以)。恢复系统吧,他又不想重装所有软件,于是我研究了一下在命令行修改系统设置的方法。他不是搞技术的,所以我让他把 settings.db改个名或者删除掉,不过那样做有点暴力。这里介绍一种稍微麻烦但更友好一点的方法。
1.先要编译一个sqlite3命令行工具(external/sqlite/dist)。
(需要在Android.mk里把LOCAL_MODULE_TAGS := debug一行注释掉)
2.把编译好的sqlite3上传到A1上。
view plaincopy to clipboardprint?
# adb push out/target/product/littleton/system/xbin/sqlite3 /data
# adb push out/target/product/littleton/system/xbin/sqlite3 /data
3.用串口或adb连接到A1的终端上。
view plaincopy to clipboardprint?
adb shell
# cd /data
# chmod 775 sqlite3
adb shell
# cd /data
# chmod 775 sqlite3
4.用sqlite3操作数据系统设置数据库。
view plaincopy to clipboardprint?
# ./sqlite3 /data/data/com.android.providers.settings/databases/settings.db
# ./sqlite3 /data/data/com.android.providers.settings/databases/settings.db
查看数据库中的表:
view plaincopy to clipboardprint?
sqlite> .tables
android_metadata bookmarks secure
bluetooth_devices gservices system
sqlite> .tables
android_metadata bookmarks secure
bluetooth_devices gservices system
查看表system中的内容:
view plaincopy to clipboardprint?
sqlite> select * from system;
1|volume_music|11
3|volume_system|5
5|volume_alarm|6
7|mode_ringer|2
8|vibrate_on|4
9|mode_ringer_streams_affected|38
10|mute_streams_affected|46
11|dim_screen|1
12|stay_on_while_plugged_in|0
13|screen_off_timeout|60000
14|airplane_mode_on|0
15|airplane_mode_radios|cell,bluetooth,wifi
16|auto_time|1
17|screen_brightness|102
18|window_animation_scale|1.0
19|transition_animation_scale|0.0
20|accelerometer_rotation|1
21|dtmf_tone|0
22|date_format|MM-dd-yyyy
23|notify_led_color|255
24|notify_incoming_call|1
25|notify_missed_call|1
26|notify_SMS_MMS|1
27|notify_email|1
28|notify_voice_mail|1
29|notify_remind|1
63|volume_voice|4
64|volume_voice_last_audible|4
73|lock_pattern_tactile_feedback_enabled|0
111|lock_pattern_visible_pattern|1
122|font_scale|1.0
127|next_alarm_formatted|
129|lock_pattern_autolock|1
130|lockscreen.patterneverchosen|1
131|volume_notification|5
132|volume_notification_last_audible|5
133|volume_ring|5
134|volume_ring_last_audible|5
135|lockscreen.lockedoutpermanently|1
sqlite> select * from system;
1|volume_music|11
3|volume_system|5
5|volume_alarm|6
7|mode_ringer|2
8|vibrate_on|4
9|mode_ringer_streams_affected|38
10|mute_streams_affected|46
11|dim_screen|1
12|stay_on_while_plugged_in|0
13|screen_off_timeout|60000
14|airplane_mode_on|0
15|airplane_mode_radios|cell,bluetooth,wifi
16|auto_time|1
17|screen_brightness|102
18|window_animation_scale|1.0
19|transition_animation_scale|0.0
20|accelerometer_rotation|1
21|dtmf_tone|0
22|date_format|MM-dd-yyyy
23|notify_led_color|255
24|notify_incoming_call|1
25|notify_missed_call|1
26|notify_SMS_MMS|1
27|notify_email|1
28|notify_voice_mail|1
29|notify_remind|1
63|volume_voice|4
64|volume_voice_last_audible|4
73|lock_pattern_tactile_feedback_enabled|0
111|lock_pattern_visible_pattern|1
122|font_scale|1.0
127|next_alarm_formatted|
129|lock_pattern_autolock|1
130|lockscreen.patterneverchosen|1
131|volume_notification|5
132|volume_notification_last_audible|5
133|volume_ring|5
134|volume_ring_last_audible|5
135|lockscreen.lockedoutpermanently|1
查看表system的schema:
view plaincopy to clipboardprint?
sqlite> .schema system
CREATE TABLE system (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT UNIQUE ON CONFLICT REPLACE,value TEXT);
CREATE INDEX systemIndex1 ON system (name);
sqlite> .schema system
CREATE TABLE system (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT UNIQUE ON CONFLICT REPLACE,value TEXT);
CREATE INDEX systemIndex1 ON system (name);
修改表中相关内容:
view plaincopy to clipboardprint?
sqlite> update system set value='0' where name='lockscreen.lockedoutpermanently';
sqlite> update system set value='0' where name='lock_pattern_autolock';
sqlite> update system set value='0' where name='lock_pattern_visible_pattern';
sqlite> update system set value='0' where name='lockscreen.lockedoutpermanently';
sqlite> update system set value='0' where name='lock_pattern_autolock';
sqlite> update system set value='0' where name='lock_pattern_visible_pattern';
退出数据库:
sqlite> .quit
5.重启Broncho A1:
/data # reboot