diff options
author | John Spurlock <jspurlock@google.com> | 2012-10-05 11:15:28 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2012-10-05 11:45:18 -0400 |
commit | 7f1c248e80c747663396c6112bd637b0ee558dcb (patch) | |
tree | 827ad6ad3b2531f766ef0178695807e1a2cf96c1 /packages | |
parent | 20de160ca32a8f2936a80ffd70551a22e2371d25 (diff) | |
download | frameworks_base-7f1c248e80c747663396c6112bd637b0ee558dcb.zip frameworks_base-7f1c248e80c747663396c6112bd637b0ee558dcb.tar.gz frameworks_base-7f1c248e80c747663396c6112bd637b0ee558dcb.tar.bz2 |
Fix upgrade case for Settings.Secure.USER_SETUP_COMPLETE.
Existing primary users were never being marked as complete,
causing things that relied on this (e.g. showing the quick settings panel)
to break.
Bug:7282088
Change-Id: I9c8622f3cd0fb99a44477946d3db22fa2cbbc6fc
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/res/values/defaults.xml | 3 | ||||
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml index ab8e961..9e137ce 100644 --- a/packages/SettingsProvider/res/values/defaults.xml +++ b/packages/SettingsProvider/res/values/defaults.xml @@ -174,4 +174,7 @@ <bool name="def_screensaver_activate_on_sleep">false</bool> <!-- ComponentName of the default screen saver (Settings.Secure.SCREENSAVER_COMPONENT) --> <string name="def_screensaver_component">com.google.android.deskclock/com.android.deskclock.Screensaver</string> + + <!-- Default for Settings.Secure.USER_SETUP_COMPLETE --> + <bool name="def_user_setup_complete">false</bool> </resources> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index a9869d9..0b61abe 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -68,7 +68,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 92; + private static final int DATABASE_VERSION = 93; private Context mContext; private int mUserHandle; @@ -1449,6 +1449,30 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 92; } + if (upgradeVersion == 92) { + SQLiteStatement stmt = null; + try { + stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + + " VALUES(?,?);"); + if (mUserHandle == UserHandle.USER_OWNER) { + // consider existing primary users to have made it through user setup + // if the globally-scoped device-provisioned bit is set + // (indicating they already made it through setup as primary) + int deviceProvisioned = getIntValueFromTable(db, TABLE_GLOBAL, + Settings.Global.DEVICE_PROVISIONED, 0); + loadSetting(stmt, Settings.Secure.USER_SETUP_COMPLETE, + deviceProvisioned); + } else { + // otherwise use the default + loadBooleanSetting(stmt, Settings.Secure.USER_SETUP_COMPLETE, + R.bool.def_user_setup_complete); + } + } finally { + if (stmt != null) stmt.close(); + } + upgradeVersion = 93; + } + // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -2016,6 +2040,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, R.bool.def_accessibility_display_magnification_auto_update); + + loadBooleanSetting(stmt, Settings.Secure.USER_SETUP_COMPLETE, + R.bool.def_user_setup_complete); } finally { if (stmt != null) stmt.close(); } |