Merge "Reorder migration of settings from db to xml" into nyc-dev
am: 4b1d8b07e5
* commit '4b1d8b07e5189cf07e64463c0af28b4b5491fb27':
Reorder migration of settings from db to xml
This commit is contained in:
@ -1671,16 +1671,16 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
|
|
||||||
private void migrateLegacySettingsForUserLocked(DatabaseHelper dbHelper,
|
private void migrateLegacySettingsForUserLocked(DatabaseHelper dbHelper,
|
||||||
SQLiteDatabase database, int userId) {
|
SQLiteDatabase database, int userId) {
|
||||||
// Move over the global settings if owner.
|
// Move over the system settings.
|
||||||
if (userId == UserHandle.USER_SYSTEM) {
|
final int systemKey = makeKey(SETTINGS_TYPE_SYSTEM, userId);
|
||||||
final int globalKey = makeKey(SETTINGS_TYPE_GLOBAL, userId);
|
ensureSettingsStateLocked(systemKey);
|
||||||
ensureSettingsStateLocked(globalKey);
|
SettingsState systemSettings = mSettingsStates.get(systemKey);
|
||||||
SettingsState globalSettings = mSettingsStates.get(globalKey);
|
migrateLegacySettingsLocked(systemSettings, database, TABLE_SYSTEM);
|
||||||
migrateLegacySettingsLocked(globalSettings, database, TABLE_GLOBAL);
|
systemSettings.persistSyncLocked();
|
||||||
globalSettings.persistSyncLocked();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move over the secure settings.
|
// Move over the secure settings.
|
||||||
|
// Do this after System settings, since this is the first thing we check when deciding
|
||||||
|
// to skip over migration from db to xml for a secondary user.
|
||||||
final int secureKey = makeKey(SETTINGS_TYPE_SECURE, userId);
|
final int secureKey = makeKey(SETTINGS_TYPE_SECURE, userId);
|
||||||
ensureSettingsStateLocked(secureKey);
|
ensureSettingsStateLocked(secureKey);
|
||||||
SettingsState secureSettings = mSettingsStates.get(secureKey);
|
SettingsState secureSettings = mSettingsStates.get(secureKey);
|
||||||
@ -1688,12 +1688,16 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
ensureSecureSettingAndroidIdSetLocked(secureSettings);
|
ensureSecureSettingAndroidIdSetLocked(secureSettings);
|
||||||
secureSettings.persistSyncLocked();
|
secureSettings.persistSyncLocked();
|
||||||
|
|
||||||
// Move over the system settings.
|
// Move over the global settings if owner.
|
||||||
final int systemKey = makeKey(SETTINGS_TYPE_SYSTEM, userId);
|
// Do this last, since this is the first thing we check when deciding
|
||||||
ensureSettingsStateLocked(systemKey);
|
// to skip over migration from db to xml for owner user.
|
||||||
SettingsState systemSettings = mSettingsStates.get(systemKey);
|
if (userId == UserHandle.USER_SYSTEM) {
|
||||||
migrateLegacySettingsLocked(systemSettings, database, TABLE_SYSTEM);
|
final int globalKey = makeKey(SETTINGS_TYPE_GLOBAL, userId);
|
||||||
systemSettings.persistSyncLocked();
|
ensureSettingsStateLocked(globalKey);
|
||||||
|
SettingsState globalSettings = mSettingsStates.get(globalKey);
|
||||||
|
migrateLegacySettingsLocked(globalSettings, database, TABLE_GLOBAL);
|
||||||
|
globalSettings.persistSyncLocked();
|
||||||
|
}
|
||||||
|
|
||||||
// Drop the database as now all is moved and persisted.
|
// Drop the database as now all is moved and persisted.
|
||||||
if (DROP_DATABASE_ON_MIGRATION) {
|
if (DROP_DATABASE_ON_MIGRATION) {
|
||||||
|
Reference in New Issue
Block a user