diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 4dbc4b4fa0fdb..441214c873703 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2610,6 +2610,7 @@ public final class Settings { 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 @@ public final class Settings { /** * 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 @@ public final class Settings { * @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, @@ -4315,6 +4318,13 @@ public final class Settings { */ 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. */ @@ -5359,6 +5369,7 @@ public final class Settings { * @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 cccce9d88b520..fc0ff559c5cc9 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 @@ 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 = 95; + private static final int DATABASE_VERSION = 96; private Context mContext; private int mUserHandle; @@ -1488,7 +1488,6 @@ public class DatabaseHelper extends SQLiteOpenHelper { // 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 @@ public class DatabaseHelper extends SQLiteOpenHelper { db.setTransactionSuccessful(); } finally { db.endTransaction(); - if (stmt != null) stmt.close(); } } upgradeVersion = 94; @@ -1524,6 +1522,20 @@ public class DatabaseHelper extends SQLiteOpenHelper { 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 00991c1dd6731..10371374603fa 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 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, 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 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, 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 3dc77d49feab6..761eb2d01f5b8 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 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac 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) {