@@ -1202,21 +1202,24 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
12021202
12031203 if (upgradeVersion == 82 ) {
12041204 // Move to per-user settings dbs
1205- db .beginTransaction ();
1206- SQLiteStatement stmt = null ;
1207- try {
1208- // Migrate now-global settings. Note that this happens before
1209- // new users can be created.
1210- createGlobalTable (db );
1211- String [] settingsToMove = hashsetToStringArray (SettingsProvider .sSystemGlobalKeys );
1212- moveSettingsToNewTable (db , TABLE_SYSTEM , TABLE_GLOBAL , settingsToMove , false );
1213- settingsToMove = hashsetToStringArray (SettingsProvider .sSecureGlobalKeys );
1214- moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , false );
1205+ if (mUserHandle == UserHandle .USER_OWNER ) {
12151206
1216- db .setTransactionSuccessful ();
1217- } finally {
1218- db .endTransaction ();
1219- if (stmt != null ) stmt .close ();
1207+ db .beginTransaction ();
1208+ SQLiteStatement stmt = null ;
1209+ try {
1210+ // Migrate now-global settings. Note that this happens before
1211+ // new users can be created.
1212+ createGlobalTable (db );
1213+ String [] settingsToMove = hashsetToStringArray (SettingsProvider .sSystemGlobalKeys );
1214+ moveSettingsToNewTable (db , TABLE_SYSTEM , TABLE_GLOBAL , settingsToMove , false );
1215+ settingsToMove = hashsetToStringArray (SettingsProvider .sSecureGlobalKeys );
1216+ moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , false );
1217+
1218+ db .setTransactionSuccessful ();
1219+ } finally {
1220+ db .endTransaction ();
1221+ if (stmt != null ) stmt .close ();
1222+ }
12201223 }
12211224 upgradeVersion = 83 ;
12221225 }
@@ -1251,73 +1254,81 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
12511254 }
12521255
12531256 if (upgradeVersion == 84 ) {
1254- db .beginTransaction ();
1255- SQLiteStatement stmt = null ;
1256- try {
1257- // Patch up the slightly-wrong key migration from 82 -> 83 for those
1258- // devices that missed it, ignoring if the move is redundant
1259- String [] settingsToMove = {
1260- Settings .Secure .ADB_ENABLED ,
1261- Settings .Secure .BLUETOOTH_ON ,
1262- Settings .Secure .DATA_ROAMING ,
1263- Settings .Secure .DEVICE_PROVISIONED ,
1264- Settings .Secure .INSTALL_NON_MARKET_APPS ,
1265- Settings .Secure .USB_MASS_STORAGE_ENABLED
1266- };
1267- moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
1268- db .setTransactionSuccessful ();
1269- } finally {
1270- db .endTransaction ();
1271- if (stmt != null ) stmt .close ();
1257+ if (mUserHandle == UserHandle .USER_OWNER ) {
1258+ db .beginTransaction ();
1259+ SQLiteStatement stmt = null ;
1260+ try {
1261+ // Patch up the slightly-wrong key migration from 82 -> 83 for those
1262+ // devices that missed it, ignoring if the move is redundant
1263+ String [] settingsToMove = {
1264+ Settings .Secure .ADB_ENABLED ,
1265+ Settings .Secure .BLUETOOTH_ON ,
1266+ Settings .Secure .DATA_ROAMING ,
1267+ Settings .Secure .DEVICE_PROVISIONED ,
1268+ Settings .Secure .INSTALL_NON_MARKET_APPS ,
1269+ Settings .Secure .USB_MASS_STORAGE_ENABLED
1270+ };
1271+ moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
1272+ db .setTransactionSuccessful ();
1273+ } finally {
1274+ db .endTransaction ();
1275+ if (stmt != null ) stmt .close ();
1276+ }
12721277 }
12731278 upgradeVersion = 85 ;
12741279 }
12751280
12761281 if (upgradeVersion == 85 ) {
1277- db .beginTransaction ();
1278- try {
1279- // Fix up the migration, ignoring already-migrated elements, to snap up to
1280- // date with new changes to the set of global versus system/secure settings
1281- String [] settingsToMove = { Settings .System .STAY_ON_WHILE_PLUGGED_IN };
1282- moveSettingsToNewTable (db , TABLE_SYSTEM , TABLE_GLOBAL , settingsToMove , true );
1282+ if (mUserHandle == UserHandle .USER_OWNER ) {
1283+ db .beginTransaction ();
1284+ try {
1285+ // Fix up the migration, ignoring already-migrated elements, to snap up to
1286+ // date with new changes to the set of global versus system/secure settings
1287+ String [] settingsToMove = { Settings .System .STAY_ON_WHILE_PLUGGED_IN };
1288+ moveSettingsToNewTable (db , TABLE_SYSTEM , TABLE_GLOBAL , settingsToMove , true );
12831289
1284- db .setTransactionSuccessful ();
1285- } finally {
1286- db .endTransaction ();
1290+ db .setTransactionSuccessful ();
1291+ } finally {
1292+ db .endTransaction ();
1293+ }
12871294 }
12881295 upgradeVersion = 86 ;
12891296 }
12901297
12911298 if (upgradeVersion == 86 ) {
1292- db .beginTransaction ();
1293- try {
1294- String [] settingsToMove = {
1295- Settings .Secure .PACKAGE_VERIFIER_ENABLE ,
1296- Settings .Secure .PACKAGE_VERIFIER_TIMEOUT ,
1297- Settings .Secure .PACKAGE_VERIFIER_DEFAULT_RESPONSE
1298- };
1299- moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
1299+ if (mUserHandle == UserHandle .USER_OWNER ) {
1300+ db .beginTransaction ();
1301+ try {
1302+ String [] settingsToMove = {
1303+ Settings .Secure .PACKAGE_VERIFIER_ENABLE ,
1304+ Settings .Secure .PACKAGE_VERIFIER_TIMEOUT ,
1305+ Settings .Secure .PACKAGE_VERIFIER_DEFAULT_RESPONSE
1306+ };
1307+ moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
13001308
1301- db .setTransactionSuccessful ();
1302- } finally {
1303- db .endTransaction ();
1309+ db .setTransactionSuccessful ();
1310+ } finally {
1311+ db .endTransaction ();
1312+ }
13041313 }
13051314 upgradeVersion = 87 ;
13061315 }
13071316
13081317 if (upgradeVersion == 87 ) {
1309- db .beginTransaction ();
1310- try {
1311- String [] settingsToMove = {
1312- Settings .Secure .DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS ,
1313- Settings .Secure .DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS ,
1314- Settings .Secure .GPRS_REGISTER_CHECK_PERIOD_MS
1315- };
1316- moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
1318+ if (mUserHandle == UserHandle .USER_OWNER ) {
1319+ db .beginTransaction ();
1320+ try {
1321+ String [] settingsToMove = {
1322+ Settings .Secure .DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS ,
1323+ Settings .Secure .DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS ,
1324+ Settings .Secure .GPRS_REGISTER_CHECK_PERIOD_MS
1325+ };
1326+ moveSettingsToNewTable (db , TABLE_SECURE , TABLE_GLOBAL , settingsToMove , true );
13171327
1318- db .setTransactionSuccessful ();
1319- } finally {
1320- db .endTransaction ();
1328+ db .setTransactionSuccessful ();
1329+ } finally {
1330+ db .endTransaction ();
1331+ }
13211332 }
13221333 upgradeVersion = 88 ;
13231334 }
0 commit comments