Merge "Migrate BUGREPORT_IN_POWER_MENU from Secure to Global settings"
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4dbc4b4..441214c 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2610,6 +2610,7 @@
MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
+ MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
@@ -3081,8 +3082,10 @@
/**
* When the user has enable the option to have a "bug report" command
* in the power menu.
+ * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
* @hide
*/
+ @Deprecated
public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
/**
@@ -4037,7 +4040,7 @@
* @hide
*/
public static final String[] SETTINGS_TO_BACKUP = {
- BUGREPORT_IN_POWER_MENU,
+ BUGREPORT_IN_POWER_MENU, // moved to global
ALLOW_MOCK_LOCATION,
PARENTAL_CONTROL_ENABLED,
PARENTAL_CONTROL_REDIRECT_URL,
@@ -4316,6 +4319,13 @@
public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
/**
+ * When the user has enable the option to have a "bug report" command
+ * in the power menu.
+ * @hide
+ */
+ public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
+
+ /**
* Whether ADB is enabled.
*/
public static final String ADB_ENABLED = "adb_enabled";
@@ -5359,6 +5369,7 @@
* @hide
*/
public static final String[] SETTINGS_TO_BACKUP = {
+ BUGREPORT_IN_POWER_MENU,
STAY_ON_WHILE_PLUGGED_IN,
MODE_RINGER,
AUTO_TIME,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index cccce9d..fc0ff55 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -71,7 +71,7 @@
// 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 = 95;
+ private static final int DATABASE_VERSION = 96;
private Context mContext;
private int mUserHandle;
@@ -1488,7 +1488,6 @@
// Redo this step, since somehow it didn't work the first time for some users
if (mUserHandle == UserHandle.USER_OWNER) {
db.beginTransaction();
- SQLiteStatement stmt = null;
try {
// Migrate now-global settings
String[] settingsToMove = hashsetToStringArray(SettingsProvider.sSystemGlobalKeys);
@@ -1499,7 +1498,6 @@
db.setTransactionSuccessful();
} finally {
db.endTransaction();
- if (stmt != null) stmt.close();
}
}
upgradeVersion = 94;
@@ -1524,6 +1522,20 @@
upgradeVersion = 95;
}
+ if (upgradeVersion == 95) {
+ if (mUserHandle == UserHandle.USER_OWNER) {
+ db.beginTransaction();
+ try {
+ String[] settingsToMove = { Settings.Global.BUGREPORT_IN_POWER_MENU };
+ moveSettingsToNewTable(db, TABLE_SECURE, TABLE_GLOBAL, settingsToMove, true);
+ db.setTransactionSuccessful();
+ } finally {
+ db.endTransaction();
+ }
+ }
+ upgradeVersion = 96;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion != currentVersion) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
index 00991c1..1037137 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java
@@ -139,7 +139,7 @@
public void startObserving() {
final ContentResolver cr = mContext.getContentResolver();
cr.registerContentObserver(
- Settings.Secure.getUriFor(Settings.Secure.BUGREPORT_IN_POWER_MENU), false, this);
+ Settings.Global.getUriFor(Settings.Global.BUGREPORT_IN_POWER_MENU), false, this);
}
}
@@ -544,7 +544,7 @@
final ContentResolver cr = mContext.getContentResolver();
boolean enabled = false;
try {
- enabled = (Settings.Secure.getInt(cr, Settings.Secure.BUGREPORT_IN_POWER_MENU) != 0);
+ enabled = (Settings.Global.getInt(cr, Settings.Global.BUGREPORT_IN_POWER_MENU) != 0);
} catch (SettingNotFoundException e) {
}
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java
index 3dc77d4..761eb2d 100755
--- a/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -260,8 +260,8 @@
mItems.add(mAirplaneModeOn);
// next: bug report, if enabled
- if (Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0) {
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.BUGREPORT_IN_POWER_MENU, 0) != 0) {
mItems.add(
new SinglePressAction(com.android.internal.R.drawable.stat_sys_adb,
R.string.global_action_bug_report) {