?
?
1、只为所有者创建global表。
// Only create the global table for the singleton 'owner' user
//只为所有者创建global table。
if (mUserHandle == UserHandle.USER_OWNER) {
createGlobalTable(db);
}
2、//如果我们正在
加密设备,只能运行核心应用程序。 onlyCore为true
?
?
if (!onlyCore) {
loadBookmarks(db);
}
?
3、在Settings.db的upgradeVersion为26时,创建了Secure表。在upgradeVersion为27、52、55时,将部分配置项转移到secure中。
upgradeVersion = 70时,更新bookmarks
?
?
4、在Settings.db的upgradeVersion = 82时,创建了Global表。 // Move to per-user settings dbs
在Settings.java中创建moveToSystem或者moveToSecure,通过SettingsProvider,传到DatabaseHelper中。
upgradeVersion = 84、87,89、90、93时,从secure中移植到Global中。
upgradeVersion = 85、88、90、91、93时,从System中移植到Global中。
5、
100%
6、在SettingsProvider中定义变量,注意前缀和后缀都很重要,切记。
根据搜索中的前缀,将符合前缀规格的项移植到Secure中。
private void movePrefixedSettingsToNewTable(
SQLiteDatabase db, String sourceTable, String destTable, String[] prefixesToMove) {
SQLiteStatement insertStmt = null;
SQLiteStatement deleteStmt = null;
db.beginTransaction();
try {
insertStmt = db.compileStatement(INSERT INTO + destTable
+ (name,value) SELECT name,value FROM + sourceTable
+ WHERE substr(name,0,?)=?);
deleteStmt = db.compileStatement(
DELETE FROM + sourceTable + WHERE substr(name,0,?)=?);
for (String prefix : prefixesToMove) {
insertStmt.bindLong(1, prefix.length() + 1);
insertStmt.bindString(2, prefix);
insertStmt.execute();
deleteStmt.bindLong(1, prefix.length() + 1);
deleteStmt.bindString(2, prefix);
deleteStmt.execute();
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
if (insertStmt != null) {
insertStmt.close();
}
if (deleteStmt != null) {
deleteStmt.close();
}
}
}
?
?