Merge "Migrate BUGREPORT_IN_POWER_MENU from Secure to Global settings"
This commit is contained in:
committed by
Android (Google) Code Review
commit
919129832d
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user