From 93dd25cfe7e4f6538291eb90fc8a583f2f5c8b0b Mon Sep 17 00:00:00 2001 From: Aran Ink Date: Thu, 9 May 2019 14:42:14 -0400 Subject: [PATCH] Add secure setting for Global Actions Panel debug mode. Changes grid-based power menu logic to use new debug setting. Bug: 123397865 Bug: 127644235 Test: Automated tests pass. Manual testing turning off/on debug setting. Change-Id: Ic95188bd10a433f5c58f0f37a098a872e65d8150 --- core/java/android/provider/Settings.java | 7 +++++++ .../src/android/provider/SettingsBackupTest.java | 1 + .../systemui/globalactions/GlobalActionsDialog.java | 11 +++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index de888d3f9a7fb..9c394bdabb0af 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6513,6 +6513,13 @@ public final class Settings { public static final String GLOBAL_ACTIONS_PANEL_AVAILABLE = "global_actions_panel_available"; + /** + * Enables debug mode for the Global Actions Panel. + * @hide + */ + public static final String GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED = + "global_actions_panel_debug_enabled"; + /** * Whether the hush gesture has ever been used * @hide diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index 9fa04ef2dda2e..fda37c8783ff1 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -637,6 +637,7 @@ public class SettingsBackupTest { Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, Settings.Secure.ENABLED_PRINT_SERVICES, Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE, + Settings.Secure.GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED, Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR, Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java index 1ffed4c35e14c..c0423d7062b99 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java @@ -1768,13 +1768,20 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener, } } + /** + * Determines whether or not debug mode has been activated for the Global Actions Panel. + */ + private static boolean isPanelDebugModeEnabled(Context context) { + return Settings.Secure.getInt(context.getContentResolver(), + Settings.Secure.GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED, 0) == 1; + } + /** * Determines whether or not the Global Actions menu should be forced to * use the newer grid-style layout. */ private static boolean isForceGridEnabled(Context context) { - return FeatureFlagUtils.isEnabled(context, - FeatureFlagUtils.FORCE_GLOBAL_ACTIONS_GRID_ENABLED); + return isPanelDebugModeEnabled(context); } /**