Is it safe to edit settings.db in Android

不问归期 提交于 2019-12-11 08:42:56

问题


I am working on pre-configuring an Android device and now I have finally found where all the system settings are stored on Android. Now to the question: Is is safe to replace the sqlite database settings.db in:

root@android:/data/data/com.android.providers.settings/databases # ls -la
-rw-rw---- system   system      77824 2017-03-23 11:25 settings.db
-rw------- system   system      33344 2017-03-23 11:25 settings.db-journal

What about settings.db-journal, can I delete that if I assume that noone is doing much "setting" of any settings? Does the database contain anything unique to just this device, i.e. a serial number or such that absolutely shouldn't be replaced? I am thinking of copying over the same database to a large number of devices...so I just want to know if there are any problems with that.

Do I have to do some f-sync before reboot or such as well?


回答1:


You must not replace a database file while it is open.

The -journal file is part of the database. Deleting it will lead to data corruption (unless it happens to be empty).



来源:https://stackoverflow.com/questions/42978385/is-it-safe-to-edit-settings-db-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!