Is it safe to edit settings.db in Android

2019-07-26 05:03发布

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条回答
乱世女痞
2楼-- · 2019-07-26 05:26

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).

查看更多
登录 后发表回答