Loading core/java/android/provider/Settings.java +36 −0 Original line number Diff line number Diff line Loading @@ -2917,6 +2917,36 @@ public final class Settings { */ public static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; /** * Whether the power menu reboot menu is enabled * @hide */ public static final String POWER_MENU_REBOOT_ENABLED = "power_menu_reboot_enabled"; /** * Whether power menu screenshot is enabled * @hide */ public static final String POWER_MENU_SCREENSHOT_ENABLED = "power_menu_screenshot_enabled"; /** * Whether power menu profiles switcher is enabled * @hide */ public static final String POWER_MENU_PROFILES_ENABLED = "power_menu_profiles_enabled"; /** * Whether power menu airplane toggle is enabled * @hide */ public static final String POWER_MENU_AIRPLANE_ENABLED = "power_menu_airplane_enabled"; /** * Whether power menu silent mode is enabled * @hide */ public static final String POWER_MENU_SILENT_ENABLED = "power_menu_silent_enabled"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading Loading @@ -2994,6 +3024,12 @@ public final class Settings { QUIET_HOURS_MUTE, QUIET_HOURS_STILL, QUIET_HOURS_DIM, SYSTEM_PROFILES_ENABLED, POWER_MENU_SCREENSHOT_ENABLED, POWER_MENU_REBOOT_ENABLED, POWER_MENU_PROFILES_ENABLED, POWER_MENU_AIRPLANE_ENABLED, POWER_MENU_SILENT_ENABLED, }; // Settings moved to Settings.Secure Loading policy/src/com/android/internal/policy/impl/GlobalActions.java +55 −40 Original line number Diff line number Diff line Loading @@ -120,11 +120,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private boolean mIsWaitingForEcmExit = false; private boolean mHasTelephony; private boolean mHasVibrator; private Profile mChosenProfile; private static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; /** * @param context everything needs a context :( */ Loading Loading @@ -283,6 +280,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }); // next: reboot // only shown if enabled, enabled by default if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_REBOOT_ENABLED, 1) == 1) { mItems.add( new SinglePressAction(R.drawable.ic_lock_reboot, R.string.global_action_reboot) { public void onPress() { Loading @@ -302,9 +302,14 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return true; } }); } // next: profile - only shown if enabled, which is true by default if (Settings.System.getInt(mContext.getContentResolver(), SYSTEM_PROFILES_ENABLED, 1) == 1) { // next: profile // only shown if both system profiles and the menu item is enabled, enabled by default if ((Settings.System.getInt(mContext.getContentResolver(), Settings.System.SYSTEM_PROFILES_ENABLED, 1) == 1) && (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_PROFILES_ENABLED, 1) == 1)) { mItems.add( new ProfileChooseAction() { public void onPress() { Loading @@ -326,6 +331,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac } // next: screenshot // only shown if enabled, disabled by default if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_SCREENSHOT_ENABLED, 0) == 1) { mItems.add( new SinglePressAction(R.drawable.ic_lock_screenshot, R.string.global_action_screenshot) { public void onPress() { Loading @@ -340,9 +348,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return true; } }); } // next: airplane mode if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_AIRPLANE_ENABLED, 1) == 1) { mItems.add(mAirplaneModeOn); } // next: bug report, if enabled if (Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading @@ -393,16 +405,18 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }); } // last: silent mode if (SHOW_SILENT_TOGGLE) { mItems.add(mSilentModeAction); } // one more thing: optionally add a list of users to switch to // next: optionally add a list of users to switch to if (SystemProperties.getBoolean("fw.power_user_switcher", false)) { addUsersToMenu(mItems); } // last: silent mode if ((Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_SILENT_ENABLED, 1) == 1) && (SHOW_SILENT_TOGGLE)) { mItems.add(mSilentModeAction); } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(getUiContext()); Loading @@ -423,6 +437,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); dialog.setOnDismissListener(this); Loading Loading
core/java/android/provider/Settings.java +36 −0 Original line number Diff line number Diff line Loading @@ -2917,6 +2917,36 @@ public final class Settings { */ public static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; /** * Whether the power menu reboot menu is enabled * @hide */ public static final String POWER_MENU_REBOOT_ENABLED = "power_menu_reboot_enabled"; /** * Whether power menu screenshot is enabled * @hide */ public static final String POWER_MENU_SCREENSHOT_ENABLED = "power_menu_screenshot_enabled"; /** * Whether power menu profiles switcher is enabled * @hide */ public static final String POWER_MENU_PROFILES_ENABLED = "power_menu_profiles_enabled"; /** * Whether power menu airplane toggle is enabled * @hide */ public static final String POWER_MENU_AIRPLANE_ENABLED = "power_menu_airplane_enabled"; /** * Whether power menu silent mode is enabled * @hide */ public static final String POWER_MENU_SILENT_ENABLED = "power_menu_silent_enabled"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading Loading @@ -2994,6 +3024,12 @@ public final class Settings { QUIET_HOURS_MUTE, QUIET_HOURS_STILL, QUIET_HOURS_DIM, SYSTEM_PROFILES_ENABLED, POWER_MENU_SCREENSHOT_ENABLED, POWER_MENU_REBOOT_ENABLED, POWER_MENU_PROFILES_ENABLED, POWER_MENU_AIRPLANE_ENABLED, POWER_MENU_SILENT_ENABLED, }; // Settings moved to Settings.Secure Loading
policy/src/com/android/internal/policy/impl/GlobalActions.java +55 −40 Original line number Diff line number Diff line Loading @@ -120,11 +120,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private boolean mIsWaitingForEcmExit = false; private boolean mHasTelephony; private boolean mHasVibrator; private Profile mChosenProfile; private static final String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled"; /** * @param context everything needs a context :( */ Loading Loading @@ -283,6 +280,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }); // next: reboot // only shown if enabled, enabled by default if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_REBOOT_ENABLED, 1) == 1) { mItems.add( new SinglePressAction(R.drawable.ic_lock_reboot, R.string.global_action_reboot) { public void onPress() { Loading @@ -302,9 +302,14 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return true; } }); } // next: profile - only shown if enabled, which is true by default if (Settings.System.getInt(mContext.getContentResolver(), SYSTEM_PROFILES_ENABLED, 1) == 1) { // next: profile // only shown if both system profiles and the menu item is enabled, enabled by default if ((Settings.System.getInt(mContext.getContentResolver(), Settings.System.SYSTEM_PROFILES_ENABLED, 1) == 1) && (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_PROFILES_ENABLED, 1) == 1)) { mItems.add( new ProfileChooseAction() { public void onPress() { Loading @@ -326,6 +331,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac } // next: screenshot // only shown if enabled, disabled by default if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_SCREENSHOT_ENABLED, 0) == 1) { mItems.add( new SinglePressAction(R.drawable.ic_lock_screenshot, R.string.global_action_screenshot) { public void onPress() { Loading @@ -340,9 +348,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return true; } }); } // next: airplane mode if (Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_AIRPLANE_ENABLED, 1) == 1) { mItems.add(mAirplaneModeOn); } // next: bug report, if enabled if (Settings.Secure.getInt(mContext.getContentResolver(), Loading Loading @@ -393,16 +405,18 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }); } // last: silent mode if (SHOW_SILENT_TOGGLE) { mItems.add(mSilentModeAction); } // one more thing: optionally add a list of users to switch to // next: optionally add a list of users to switch to if (SystemProperties.getBoolean("fw.power_user_switcher", false)) { addUsersToMenu(mItems); } // last: silent mode if ((Settings.System.getInt(mContext.getContentResolver(), Settings.System.POWER_MENU_SILENT_ENABLED, 1) == 1) && (SHOW_SILENT_TOGGLE)) { mItems.add(mSilentModeAction); } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(getUiContext()); Loading @@ -423,6 +437,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); dialog.setOnDismissListener(this); Loading