operate the database directly in the ADB shell using the sqlite3 command
In general, mobile phones in the development phase will be the Sqlite3 module into the mirror. For example, in Android 5.1, the path is/system/xbin/sqlite3. (But for ordinary mobile phones, it may not be possible to bring this module, so this article only for the mobile phone development phase debugging)
First check whether the Sqlite3 file exists in the phone, and if it exists, you can use the Sqlite3 command directly under the ADB shell:
example : Changing the settings entry in the system settings database: Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED
(This setting is a new addition to the Android 5.1 system to determine whether the access network to determine the validity of the network connection)
~ Search in the framework source code to know the definition in Base/core/java/android/provider/settings.java captive_portal_detection_ ENABLED = "captive_portal_detection_enabled";
~ Enter the settings provider directory:
Cd/data/data/com.android.providers.settings/databases
Database operation started:
- Sqlite3 settings.db command to enter the SQLite operator interface, use the. Tables command to view the tables in this database:
- Select to view the data in the global table:
SELECT * from Global;
- As you can see, no field names are displayed, and if we don't know their field names, we can use the. Header on to turn on the display field name:
- After the field name is displayed, the query target record is made:
Sqlite> SELECT * from global where name= ' captive_portal_detection_enabled ';
- The value is now 1 and is changed with the update command:
sqlite> Update global set value= ' 0 ' where name= ' captive_portal_detection_enabled ';
- You can see that the changes have been made. The value of the Value field has been changed to 0. Success!
For the framework debug, perhaps this modification can help you in the development of the debugging phase, without modifying the software code to do some tests associated with the system settings (for items that cannot be set in the Settings app).
Of course, the sqlite3 command can be used for all provider applications and for the DB to be added and censored.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Operate the database directly in the ADB shell using the sqlite3 command