diff options
author | Christopher Tate <ctate@google.com> | 2014-05-19 16:33:27 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2014-05-19 18:08:30 -0700 |
commit | aa036a2db08e19397285062c98aaab7acbf80717 (patch) | |
tree | decfcb3e83671091fcfe7202a8bea4a986b984cc /packages/SettingsProvider/src | |
parent | e595504f09f3cae65cda27261353eb3cfa72fd6e (diff) | |
download | frameworks_base-aa036a2db08e19397285062c98aaab7acbf80717.zip frameworks_base-aa036a2db08e19397285062c98aaab7acbf80717.tar.gz frameworks_base-aa036a2db08e19397285062c98aaab7acbf80717.tar.bz2 |
Move the non-market install setting from Global to per-user Secure
Bug 13760585
Change-Id: I45b0fa87e72dc5c18d687261fb95cbea5d06163a
Diffstat (limited to 'packages/SettingsProvider/src')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 909c32e..286921e 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -70,7 +70,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 = 102; + private static final int DATABASE_VERSION = 103; private Context mContext; private int mUserHandle; @@ -1632,6 +1632,34 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 102; } + if (upgradeVersion == 102) { + db.beginTransaction(); + SQLiteStatement stmt = null; + try { + // The INSTALL_NON_MARKET_APPS setting is becoming per-user rather + // than device-global. + if (mUserHandle == UserHandle.USER_OWNER) { + // In the owner user, the global table exists so we can migrate the + // entry from there to the secure table, preserving its value. + String[] globalToSecure = { + Settings.Secure.INSTALL_NON_MARKET_APPS + }; + moveSettingsToNewTable(db, TABLE_GLOBAL, TABLE_SECURE, globalToSecure, true); + } else { + // Secondary users' dbs don't have the global table, so institute the + // default. + stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + + " VALUES(?,?);"); + loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, + R.bool.def_install_non_market_apps); + } + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + if (stmt != null) stmt.close(); + } + upgradeVersion = 103; + } // *** Remember to update DATABASE_VERSION above! if (upgradeVersion != currentVersion) { @@ -2191,6 +2219,9 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadStringSetting(stmt, Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, R.string.def_immersive_mode_confirmations); + loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, + R.bool.def_install_non_market_apps); + } finally { if (stmt != null) stmt.close(); } @@ -2289,9 +2320,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { loadBooleanSetting(stmt, Settings.Global.NETSTATS_ENABLED, R.bool.def_netstats_enabled); - loadBooleanSetting(stmt, Settings.Global.INSTALL_NON_MARKET_APPS, - R.bool.def_install_non_market_apps); - loadBooleanSetting(stmt, Settings.Global.USB_MASS_STORAGE_ENABLED, R.bool.def_usb_mass_storage_enabled); |