From 96901c4541bb38bfef2cfccac3a5039d0f4d109f Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 17 Nov 2023 15:14:49 -0800 Subject: [PATCH] Include a developer option sliding flag to toggle the different amount of apps to show Bug: 299294792 Test: Verified SearchTransitionController didn't regress by turning off BACKGROUND_DRAWABLES flag. Flag: ACONFIG com.android.launcher3.Flags.enable_private_space DEVELOPMENT Change-Id: I78ee3a9dbc2d60f1b7acaa5834a8c656217a07d8 --- .../uioverrides/flags/DeveloperOptionsUI.java | 11 +++++++++++ src/com/android/launcher3/LauncherPrefs.kt | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java index 301fbe491b..c1a85fa71d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java +++ b/quickstep/src/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java @@ -28,6 +28,7 @@ import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_H import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE; import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS; +import static com.android.launcher3.LauncherPrefs.PRIVATE_SPACE_APPS; import static com.android.launcher3.settings.SettingsActivity.EXTRA_FRAGMENT_HIGHLIGHT_KEY; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.PLUGIN_CHANGED; import static com.android.launcher3.uioverrides.plugins.PluginManagerWrapper.pluginEnabledKey; @@ -67,6 +68,7 @@ import androidx.preference.SeekBarPreference; import androidx.preference.SwitchPreference; import com.android.launcher3.ConstantItem; +import com.android.launcher3.Flags; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; @@ -115,6 +117,9 @@ public class DeveloperOptionsUI { addAllAppsFromOverviewCatergory(); } addCustomLpnhCategory(); + if (Flags.enablePrivateSpace()) { + addCustomPrivateAppsCategory(); + } } private void filterPreferences(String query, PreferenceGroup pg) { @@ -365,6 +370,12 @@ public class DeveloperOptionsUI { } } + private void addCustomPrivateAppsCategory() { + PreferenceCategory category = newCategory("Apps in Private Space Config"); + category.addPreference(createSeekBarPreference( + "Number of Apps to put in private region", 0, 100, 1, PRIVATE_SPACE_APPS)); + } + /** * Create a preference with text and a seek bar. Should be added to a PreferenceCategory. * diff --git a/src/com/android/launcher3/LauncherPrefs.kt b/src/com/android/launcher3/LauncherPrefs.kt index a05b0f5a98..78056e625b 100644 --- a/src/com/android/launcher3/LauncherPrefs.kt +++ b/src/com/android/launcher3/LauncherPrefs.kt @@ -364,6 +364,13 @@ class LauncherPrefs(private val encryptedContext: Context) { EncryptionType.MOVE_TO_DEVICE_PROTECTED ) @JvmField + val PRIVATE_SPACE_APPS = + nonRestorableItem( + "pref_private_space_apps", + 0, + EncryptionType.MOVE_TO_DEVICE_PROTECTED + ) + @JvmField val THEMED_ICONS = backedUpItem(Themes.KEY_THEMED_ICONS, false, EncryptionType.MOVE_TO_DEVICE_PROTECTED) @JvmField val PROMISE_ICON_IDS = backedUpItem(InstallSessionHelper.PROMISE_ICON_IDS, "")