@@ -68,7 +68,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
6868 // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
6969 // is properly propagated through your change. Not doing so will result in a loss of user
7070 // settings.
71- private static final int DATABASE_VERSION = 92 ;
71+ private static final int DATABASE_VERSION = 93 ;
7272
7373 private Context mContext ;
7474 private int mUserHandle ;
@@ -1449,6 +1449,30 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) {
14491449 upgradeVersion = 92 ;
14501450 }
14511451
1452+ if (upgradeVersion == 92 ) {
1453+ SQLiteStatement stmt = null ;
1454+ try {
1455+ stmt = db .compileStatement ("INSERT OR IGNORE INTO secure(name,value)"
1456+ + " VALUES(?,?);" );
1457+ if (mUserHandle == UserHandle .USER_OWNER ) {
1458+ // consider existing primary users to have made it through user setup
1459+ // if the globally-scoped device-provisioned bit is set
1460+ // (indicating they already made it through setup as primary)
1461+ int deviceProvisioned = getIntValueFromTable (db , TABLE_GLOBAL ,
1462+ Settings .Global .DEVICE_PROVISIONED , 0 );
1463+ loadSetting (stmt , Settings .Secure .USER_SETUP_COMPLETE ,
1464+ deviceProvisioned );
1465+ } else {
1466+ // otherwise use the default
1467+ loadBooleanSetting (stmt , Settings .Secure .USER_SETUP_COMPLETE ,
1468+ R .bool .def_user_setup_complete );
1469+ }
1470+ } finally {
1471+ if (stmt != null ) stmt .close ();
1472+ }
1473+ upgradeVersion = 93 ;
1474+ }
1475+
14521476 // *** Remember to update DATABASE_VERSION above!
14531477
14541478 if (upgradeVersion != currentVersion ) {
@@ -2016,6 +2040,9 @@ private void loadSecureSettings(SQLiteDatabase db) {
20162040 loadBooleanSetting (stmt ,
20172041 Settings .Secure .ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE ,
20182042 R .bool .def_accessibility_display_magnification_auto_update );
2043+
2044+ loadBooleanSetting (stmt , Settings .Secure .USER_SETUP_COMPLETE ,
2045+ R .bool .def_user_setup_complete );
20192046 } finally {
20202047 if (stmt != null ) stmt .close ();
20212048 }
0 commit comments