blob: 262b2a1e43bf8c99be2540cd8b5588145b811e50 [file] [log] [blame]
Sunny Goyale1ee42c2017-07-24 01:02:38 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.launcher3.config;
18
fbarone58aaf12023-09-25 11:34:56 -070019import static com.android.launcher3.BuildConfig.WIDGET_ON_FIRST_SCREEN;
Anushree Ganjameb5cb752024-01-18 11:14:54 -080020import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY;
21import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT;
22import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS;
23import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT;
24import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT;
25import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE;
26import static com.android.launcher3.LauncherPrefs.LONG_PRESS_NAV_HANDLE_TIMEOUT_MS;
Sunny Goyalef6b0c02023-03-20 15:56:07 -070027import static com.android.launcher3.config.FeatureFlags.FlagState.DISABLED;
28import static com.android.launcher3.config.FeatureFlags.FlagState.ENABLED;
29import static com.android.launcher3.config.FeatureFlags.FlagState.TEAMFOOD;
Sunny Goyal749983b2023-02-24 09:27:04 -080030import static com.android.launcher3.uioverrides.flags.FlagsFactory.getDebugFlag;
31import static com.android.launcher3.uioverrides.flags.FlagsFactory.getReleaseFlag;
Tracy Zhouf2d7be12023-11-02 17:33:51 -070032import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;
Sunny Goyal749983b2023-02-24 09:27:04 -080033
Tracy Zhou89f72882024-02-13 23:12:42 -080034import android.content.res.Resources;
Anushree Ganjamcb571da2023-10-24 14:47:09 -070035import android.view.ViewConfiguration;
36
Sunny Goyalb138ec92023-03-02 16:49:59 -080037import androidx.annotation.VisibleForTesting;
38
Sunny Goyal3e3d7592019-09-11 16:51:50 -070039import com.android.launcher3.BuildConfig;
Alex Chaue1955fe2023-09-13 15:33:57 +010040import com.android.launcher3.Flags;
Anushree Ganjameb5cb752024-01-18 11:14:54 -080041import com.android.launcher3.uioverrides.flags.FlagsFactory;
Ryan Lothianfa530cd2018-10-12 14:14:16 -040042
Sunny Goyalb138ec92023-03-02 16:49:59 -080043import java.util.function.Predicate;
44import java.util.function.ToIntFunction;
45
Sunny Goyale1ee42c2017-07-24 01:02:38 -070046/**
47 * Defines a set of flags used to control various launcher behaviors.
Schneider Victor-tulias8d3d6232023-09-26 17:19:15 -040048 * <p>
Ryan Lothian688e9892018-10-03 13:32:01 -040049 * <p>All the flags should be defined here with appropriate default values.
Sunny Goyale1ee42c2017-07-24 01:02:38 -070050 */
Sunny Goyal3e3d7592019-09-11 16:51:50 -070051public final class FeatureFlags {
Sunny Goyale1ee42c2017-07-24 01:02:38 -070052
Sunny Goyalb138ec92023-03-02 16:49:59 -080053 @VisibleForTesting
54 public static Predicate<BooleanFlag> sBooleanReader = f -> f.mCurrentValue;
55 @VisibleForTesting
56 public static ToIntFunction<IntFlag> sIntReader = f -> f.mCurrentValue;
57
Sunny Goyal749983b2023-02-24 09:27:04 -080058 private FeatureFlags() { }
Ryan Lothianfa530cd2018-10-12 14:14:16 -040059
Zak Cohen3eeb41d2020-02-14 14:15:13 -080060 /**
61 * True when the build has come from Android Studio and is being used for local debugging.
Sunny Goyal29fa0f32023-02-22 16:56:15 -080062 * @deprecated Use {@link BuildConfig#IS_STUDIO_BUILD} directly
Zak Cohen3eeb41d2020-02-14 14:15:13 -080063 */
Sunny Goyal29fa0f32023-02-22 16:56:15 -080064 @Deprecated
65 public static final boolean IS_STUDIO_BUILD = BuildConfig.IS_STUDIO_BUILD;
Sunny Goyale1ee42c2017-07-24 01:02:38 -070066
Sunny Goyal3e3d7592019-09-11 16:51:50 -070067 /**
68 * Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature
69 * and should be modified at a project level.
Sunny Goyal29fa0f32023-02-22 16:56:15 -080070 * @deprecated Use {@link BuildConfig#QSB_ON_FIRST_SCREEN} directly
Sunny Goyal3e3d7592019-09-11 16:51:50 -070071 */
Sunny Goyal29fa0f32023-02-22 16:56:15 -080072 @Deprecated
Shikha Malhotra78843322022-02-24 13:30:57 +000073 public static final boolean QSB_ON_FIRST_SCREEN = BuildConfig.QSB_ON_FIRST_SCREEN;
Sunny Goyal3e3d7592019-09-11 16:51:50 -070074
Sunny Goyal3e3d7592019-09-11 16:51:50 -070075 /**
76 * Feature flag to handle define config changes dynamically instead of killing the process.
Schneider Victor-tulias7d8a0df2023-04-05 15:11:44 -070077 * <p>
Sunny Goyal3e3d7592019-09-11 16:51:50 -070078 *
79 * To add a new flag that can be toggled through the flags UI:
Schneider Victor-tulias7d8a0df2023-04-05 15:11:44 -070080 * <p>
Zak Cohenf9e73a02019-12-03 12:00:44 -080081 * Declare a new ToggleableFlag below. Give it a unique key (e.g. "QSB_ON_FIRST_SCREEN"),
Federico Barondafd14d2022-10-05 14:51:37 -070082 * and set a default value for the flag. This will be the default value on Debug builds.
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -070083 * <p>
Sunny Goyal3e3d7592019-09-11 16:51:50 -070084 */
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -070085 // TODO(Block 1): Clean up flags
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -070086 public static final BooleanFlag ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES = getReleaseFlag(
Luca Zuccarinic3c75c22023-08-03 16:16:33 +000087 270394041, "ENABLE_SEARCH_RESULT_BACKGROUND_DRAWABLES", ENABLED,
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -070088 "Enable option to replace decorator-based search result backgrounds with drawables");
89
90 public static final BooleanFlag ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION = getReleaseFlag(
Luca Zuccarinic3c75c22023-08-03 16:16:33 +000091 270394392, "ENABLE_SEARCH_RESULT_LAUNCH_TRANSITION", ENABLED,
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -070092 "Enable option to launch search results using the new view container transitions");
93
94 // TODO(Block 2): Clean up flags
95 public static final BooleanFlag ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH = getDebugFlag(270395073,
96 "ENABLE_MULTI_DISPLAY_PARTIAL_DEPTH", DISABLED,
97 "Allow bottom sheet depth to be smaller than 1 for multi-display devices.");
98
99 // TODO(Block 3): Clean up flags
100 public static final BooleanFlag ENABLE_DISMISS_PREDICTION_UNDO = getDebugFlag(270394476,
101 "ENABLE_DISMISS_PREDICTION_UNDO", DISABLED,
102 "Show an 'Undo' snackbar when users dismiss a predicted hotseat item");
103
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800104 public static final BooleanFlag MOVE_STARTUP_DATA_TO_DEVICE_PROTECTED_STORAGE = getDebugFlag(
105 251502424, "ENABLE_BOOT_AWARE_STARTUP_DATA", DISABLED,
106 "Marks LauncherPref data as (and allows it to) available while the device is"
107 + " locked. Enabling this causes a 1-time movement of certain SharedPreferences"
108 + " data. Improves startup latency.");
109
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700110 public static final BooleanFlag CONTINUOUS_VIEW_TREE_CAPTURE = getDebugFlag(270395171,
111 "CONTINUOUS_VIEW_TREE_CAPTURE", ENABLED, "Capture View tree every frame");
112
113 public static final BooleanFlag ENABLE_WORKSPACE_LOADING_OPTIMIZATION = getDebugFlag(251502424,
114 "ENABLE_WORKSPACE_LOADING_OPTIMIZATION", DISABLED,
115 "load the current workspace screen visible to the user before the rest rather than "
116 + "loading all of them at once.");
117
118 public static final BooleanFlag CHANGE_MODEL_DELEGATE_LOADING_ORDER = getDebugFlag(251502424,
119 "CHANGE_MODEL_DELEGATE_LOADING_ORDER", DISABLED,
120 "changes the timing of the loading and binding of delegate items during "
121 + "data preparation for loading the home screen");
122
123 // TODO(Block 4): Cleanup flags
124 public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR =
Andy Wickham830e4b72023-04-19 07:08:44 -0700125 getReleaseFlag(268388460, "ENABLE_FLOATING_SEARCH_BAR", DISABLED,
Andy Wickham64896f32023-05-30 21:46:24 -0700126 "Allow search bar to persist and animate across states, and attach to"
127 + " the keyboard from the bottom of the screen");
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700128
Andy Wickham830e4b72023-04-19 07:08:44 -0700129 public static final BooleanFlag ENABLE_ALL_APPS_FROM_OVERVIEW =
130 getDebugFlag(275132633, "ENABLE_ALL_APPS_FROM_OVERVIEW", DISABLED,
131 "Allow entering All Apps from Overview (e.g. long swipe up from app)");
132
Andy Wickham9fbc52f2023-09-22 17:44:23 -0700133 public static final BooleanFlag CUSTOM_LPNH_THRESHOLDS =
Anushree Ganjamcb571da2023-10-24 14:47:09 -0700134 getReleaseFlag(301680992, "CUSTOM_LPNH_THRESHOLDS", DISABLED,
Andy Wickham9fbc52f2023-09-22 17:44:23 -0700135 "Add dev options to customize the LPNH trigger slop and milliseconds");
136
Andy Wickham24a50df2023-10-31 16:51:36 -0700137 public static final BooleanFlag ANIMATE_LPNH =
138 getReleaseFlag(308693847, "ANIMATE_LPNH", TEAMFOOD,
139 "Animates navbar when long pressing");
140
Andreas Agvard1ea07462023-11-30 20:47:22 +0100141 public static final BooleanFlag SHRINK_NAV_HANDLE_ON_PRESS =
142 getReleaseFlag(314158312, "SHRINK_NAV_HANDLE_ON_PRESS", DISABLED,
143 "Shrinks navbar when long pressing if ANIMATE_LPNH is enabled");
144
Anushree Ganjamcb571da2023-10-24 14:47:09 -0700145 public static final IntFlag LPNH_SLOP_PERCENTAGE =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800146 FlagsFactory.getIntFlag(301680992, "LPNH_SLOP_PERCENTAGE", 100,
147 "Controls touch slop percentage for lpnh",
148 LONG_PRESS_NAV_HANDLE_SLOP_PERCENTAGE);
Anushree Ganjamcb571da2023-10-24 14:47:09 -0700149
150 public static final IntFlag LPNH_TIMEOUT_MS =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800151 FlagsFactory.getIntFlag(301680992, "LPNH_TIMEOUT_MS",
152 ViewConfiguration.getLongPressTimeout(),
153 "Controls lpnh timeout in milliseconds", LONG_PRESS_NAV_HANDLE_TIMEOUT_MS);
Anushree Ganjamcb571da2023-10-24 14:47:09 -0700154
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700155 public static final BooleanFlag ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS = getReleaseFlag(
156 270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED,
157 "Enable option to show keyboard when going to all-apps");
158
159 // TODO(Block 5): Clean up flags
160 public static final BooleanFlag ENABLE_TWOLINE_DEVICESEARCH = getDebugFlag(201388851,
Brandon Dayauon00bd00f2024-03-07 10:14:44 -0800161 "ENABLE_TWOLINE_DEVICESEARCH", DISABLED,
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700162 "Enable two line label for icons with labels on device search.");
163
164 public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(270395143,
165 "ENABLE_ICON_IN_TEXT_HEADER", DISABLED, "Show icon in textheader");
166
167 public static final BooleanFlag ENABLE_PREMIUM_HAPTICS_ALL_APPS = getDebugFlag(270396358,
168 "ENABLE_PREMIUM_HAPTICS_ALL_APPS", DISABLED,
169 "Enables haptics opening/closing All apps");
170
171 // TODO(Block 6): Clean up flags
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700172 public static final BooleanFlag ENABLE_ALL_APPS_SEARCH_IN_TASKBAR = getDebugFlag(270393900,
Brian Isganitis26e1ff52023-10-03 14:12:19 -0400173 "ENABLE_ALL_APPS_SEARCH_IN_TASKBAR", ENABLED,
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700174 "Enables Search box in Taskbar All Apps.");
175
176 public static final BooleanFlag SECONDARY_DRAG_N_DROP_TO_PIN = getDebugFlag(270395140,
177 "SECONDARY_DRAG_N_DROP_TO_PIN", DISABLED,
178 "Enable dragging and dropping to pin apps within secondary display");
179
180 // TODO(Block 7): Clean up flags
181 public static final BooleanFlag ENABLE_FORCED_MONO_ICON = getDebugFlag(270396209,
182 "ENABLE_FORCED_MONO_ICON", DISABLED,
183 "Enable the ability to generate monochromatic icons, if it is not provided by the app");
184
185 // TODO(Block 8): Clean up flags
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700186
187 // TODO(Block 9): Clean up flags
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700188 public static final BooleanFlag MULTI_SELECT_EDIT_MODE = getDebugFlag(270709220,
189 "MULTI_SELECT_EDIT_MODE", DISABLED, "Enable new multi-select edit mode "
190 + "for home screen");
191
fbaronc2907252023-09-05 15:53:43 -0700192 public static final BooleanFlag SMARTSPACE_AS_A_WIDGET = getDebugFlag(299181941,
193 "SMARTSPACE_AS_A_WIDGET", DISABLED, "Enable SmartSpace as a widget");
194
fbarone58aaf12023-09-25 11:34:56 -0700195 public static boolean shouldShowFirstPageWidget() {
196 return SMARTSPACE_AS_A_WIDGET.get() && WIDGET_ON_FIRST_SCREEN;
197 }
198
fbaronf96f7fe2023-07-10 09:39:17 -0700199 public static final BooleanFlag ENABLE_SMARTSPACE_REMOVAL = getDebugFlag(290799975,
200 "ENABLE_SMARTSPACE_REMOVAL", DISABLED, "Enable SmartSpace removal for "
201 + "home screen");
202
Sebastian Franco7ba94892023-06-29 14:33:23 -0700203 // TODO(Block 11): Clean up flags
Sebastián Franco1f4d56c2023-08-08 03:29:10 +0000204 public static final BooleanFlag FOLDABLE_SINGLE_PAGE = getDebugFlag(270395274,
Sebastian Francof3766132023-09-07 14:50:07 -0700205 "FOLDABLE_SINGLE_PAGE", DISABLED, "Use a single page for the workspace");
Sebastián Franco1f4d56c2023-08-08 03:29:10 +0000206
Sebastian Franco7ba94892023-06-29 14:33:23 -0700207 public static final BooleanFlag ENABLE_PARAMETRIZE_REORDER = getDebugFlag(289420844,
208 "ENABLE_PARAMETRIZE_REORDER", DISABLED,
209 "Enables generating the reorder using a set of parameters");
210
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700211 // TODO(Block 12): Clean up flags
212 public static final BooleanFlag ENABLE_MULTI_INSTANCE = getDebugFlag(270396680,
213 "ENABLE_MULTI_INSTANCE", DISABLED,
214 "Enables creation and filtering of multiple task instances in overview");
215
216 // TODO(Block 13): Clean up flags
217 public static final BooleanFlag ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING = getReleaseFlag(
218 270391397, "ENABLE_DEVICE_SEARCH_PERFORMANCE_LOGGING", DISABLED,
219 "Allows on device search in all apps logging");
220
221 // TODO(Block 14): Cleanup flags
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700222 public static final BooleanFlag NOTIFY_CRASHES = getDebugFlag(270393108, "NOTIFY_CRASHES",
Tony Wickham670f17f2023-06-05 22:15:18 +0000223 TEAMFOOD, "Sends a notification whenever launcher encounters an uncaught exception.");
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700224
Tracy Zhouf2d7be12023-11-02 17:33:51 -0700225 public static final boolean ENABLE_TASKBAR_NAVBAR_UNIFICATION =
Tracy Zhou89f72882024-02-13 23:12:42 -0800226 enableTaskbarNavbarUnification() && !isPhone();
227
228 private static boolean isPhone() {
229 final boolean isPhone;
230 int foldedDeviceStatesId = Resources.getSystem().getIdentifier(
231 "config_foldedDeviceStates", "array", "android");
232 if (foldedDeviceStatesId != 0) {
233 isPhone = Resources.getSystem().getIntArray(foldedDeviceStatesId).length == 0;
234 } else {
235 isPhone = true;
236 }
237 return isPhone;
238 }
Tracy Zhouf2d7be12023-11-02 17:33:51 -0700239
Tracy Zhou00f9e522023-10-24 18:39:36 -0700240 // Aconfig migration complete for ENABLE_TASKBAR_NO_RECREATION.
Tracy Zhou01cc8562023-08-29 22:39:04 -0700241 public static final BooleanFlag ENABLE_TASKBAR_NO_RECREATION = getDebugFlag(299193589,
242 "ENABLE_TASKBAR_NO_RECREATION", DISABLED,
243 "Enables taskbar with no recreation from lifecycle changes of TaskbarActivityContext.");
Tracy Zhou00f9e522023-10-24 18:39:36 -0700244 public static boolean enableTaskbarNoRecreate() {
Tracy Zhouf2d7be12023-11-02 17:33:51 -0700245 return ENABLE_TASKBAR_NO_RECREATION.get() || Flags.enableTaskbarNoRecreate()
246 // Task bar pinning and task bar nav bar unification are both dependent on
247 // ENABLE_TASKBAR_NO_RECREATION. We want to turn ENABLE_TASKBAR_NO_RECREATION on
248 // when either of the dependent features is turned on.
Jagrut Desai057144e2024-01-03 15:04:00 -0800249 || enableTaskbarPinning() || ENABLE_TASKBAR_NAVBAR_UNIFICATION;
Tracy Zhou00f9e522023-10-24 18:39:36 -0700250 }
Tracy Zhou01cc8562023-08-29 22:39:04 -0700251
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700252 // TODO(Block 16): Clean up flags
Sunny Goyale1ee42c2017-07-24 01:02:38 -0700253 // When enabled the promise icon is visible in all apps while installation an app.
Sunny Goyal749983b2023-02-24 09:27:04 -0800254 public static final BooleanFlag PROMISE_APPS_IN_ALL_APPS = getDebugFlag(270390012,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700255 "PROMISE_APPS_IN_ALL_APPS", DISABLED, "Add promise icon in all-apps");
Sunny Goyale1ee42c2017-07-24 01:02:38 -0700256
Sunny Goyal749983b2023-02-24 09:27:04 -0800257 public static final BooleanFlag KEYGUARD_ANIMATION = getDebugFlag(270390904,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700258 "KEYGUARD_ANIMATION", DISABLED,
259 "Enable animation for keyguard going away on wallpaper");
Jon Mirandac2980782020-03-17 14:24:42 -0700260
Sunny Goyal749983b2023-02-24 09:27:04 -0800261 public static final BooleanFlag ENABLE_DEVICE_SEARCH = getReleaseFlag(270390907,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700262 "ENABLE_DEVICE_SEARCH", ENABLED, "Allows on device search in all apps");
Samuel Fufa9ae44d62020-07-17 11:18:25 -0700263
Sunny Goyal749983b2023-02-24 09:27:04 -0800264 public static final BooleanFlag ENABLE_HIDE_HEADER = getReleaseFlag(270390930,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700265 "ENABLE_HIDE_HEADER", ENABLED, "Hide header on keyboard before typing in all apps");
Brandon Dayauon452ee1e2022-06-13 13:39:44 -0700266
Anushree Ganjamd1a28fe2023-08-23 21:40:57 -0700267 // Aconfig migration complete for ENABLE_EXPANDING_PAUSE_WORK_BUTTON.
Sunny Goyal749983b2023-02-24 09:27:04 -0800268 public static final BooleanFlag ENABLE_EXPANDING_PAUSE_WORK_BUTTON = getDebugFlag(270390779,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700269 "ENABLE_EXPANDING_PAUSE_WORK_BUTTON", DISABLED,
Brandon Dayauonc9672b92022-11-21 16:30:28 -0800270 "Expand and collapse pause work button while scrolling");
271
Sunny Goyal749983b2023-02-24 09:27:04 -0800272 public static final BooleanFlag COLLECT_SEARCH_HISTORY = getReleaseFlag(270391455,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700273 "COLLECT_SEARCH_HISTORY", DISABLED, "Allow launcher to collect search history for log");
sfufa@google.com2f0c1e62021-11-18 12:48:16 -0800274
Anushree Ganjam2a14b972023-08-30 13:31:10 -0700275 // Aconfig migration complete for ENABLE_TWOLINE_ALLAPPS.
Sunny Goyal749983b2023-02-24 09:27:04 -0800276 public static final BooleanFlag ENABLE_TWOLINE_ALLAPPS = getDebugFlag(270390937,
Brandon Dayauon00bd00f2024-03-07 10:14:44 -0800277 "ENABLE_TWOLINE_ALLAPPS", DISABLED, "Enables two line label inside all apps.");
Hyunyoung Songafe8fad2021-11-09 16:11:58 -0800278
Sunny Goyal749983b2023-02-24 09:27:04 -0800279 public static final BooleanFlag IME_STICKY_SNACKBAR_EDU = getDebugFlag(270391693,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700280 "IME_STICKY_SNACKBAR_EDU", ENABLED, "Show sticky IME edu in AllApps");
Samuel Fufad04a92d2021-06-16 09:46:25 -0500281
Sunny Goyal749983b2023-02-24 09:27:04 -0800282 public static final BooleanFlag FOLDER_NAME_MAJORITY_RANKING = getDebugFlag(270391638,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700283 "FOLDER_NAME_MAJORITY_RANKING", ENABLED,
Jayaprakash Sundararajf4898452020-06-08 01:19:15 -0700284 "Suggests folder names based on majority based ranking.");
285
Sunny Goyal749983b2023-02-24 09:27:04 -0800286 public static final BooleanFlag INJECT_FALLBACK_APP_CORPUS_RESULTS = getReleaseFlag(270391706,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700287 "INJECT_FALLBACK_APP_CORPUS_RESULTS", DISABLED,
Sunny Goyal749983b2023-02-24 09:27:04 -0800288 "Inject fallback app corpus result when AiAi fails to return it.");
Holly Sunc6208072022-11-18 14:51:28 -0800289
Andreas Agvardeea784a2023-05-16 01:23:52 +0200290 public static final BooleanFlag ENABLE_LONG_PRESS_NAV_HANDLE =
Anushree Ganjambfa35862024-03-07 12:39:18 -0800291 getReleaseFlag(299682306, "ENABLE_LONG_PRESS_NAV_HANDLE", ENABLED,
Andreas Agvardeea784a2023-05-16 01:23:52 +0200292 "Enables long pressing on the bottom bar nav handle to trigger events.");
293
Andreas Agvardd1674982023-10-16 15:49:56 +0200294 public static final BooleanFlag ENABLE_SEARCH_HAPTIC_HINT =
Andy Wickhamc0c420a2023-11-29 16:51:08 -0800295 getReleaseFlag(314005131, "ENABLE_SEARCH_HAPTIC_HINT", ENABLED,
296 "Enables haptic hint while long pressing on the bottom bar nav handle.");
297
298 public static final BooleanFlag ENABLE_SEARCH_HAPTIC_COMMIT =
Andreas Agvardfd7f1922023-12-01 09:28:03 +0100299 getReleaseFlag(314005577, "ENABLE_SEARCH_HAPTIC_COMMIT", ENABLED,
Andy Wickhamc0c420a2023-11-29 16:51:08 -0800300 "Enables haptic hint at end of long pressing on the bottom bar nav handle.");
Andreas Agvardd1674982023-10-16 15:49:56 +0200301
Andreas Agvardb36bcff2023-11-10 15:16:55 +0100302 public static final IntFlag LPNH_HAPTIC_HINT_START_SCALE_PERCENT =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800303 FlagsFactory.getIntFlag(309972570,
304 "LPNH_HAPTIC_HINT_START_SCALE_PERCENT", 0,
305 "Haptic hint start scale.",
306 LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_START_SCALE_PERCENT);
Andreas Agvardb36bcff2023-11-10 15:16:55 +0100307
308 public static final IntFlag LPNH_HAPTIC_HINT_END_SCALE_PERCENT =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800309 FlagsFactory.getIntFlag(309972570,
310 "LPNH_HAPTIC_HINT_END_SCALE_PERCENT", 100,
311 "Haptic hint end scale.", LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_END_SCALE_PERCENT);
Andreas Agvardb36bcff2023-11-10 15:16:55 +0100312
313 public static final IntFlag LPNH_HAPTIC_HINT_SCALE_EXPONENT =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800314 FlagsFactory.getIntFlag(309972570,
315 "LPNH_HAPTIC_HINT_SCALE_EXPONENT", 1,
316 "Haptic hint scale exponent.",
317 LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_SCALE_EXPONENT);
Andreas Agvardb36bcff2023-11-10 15:16:55 +0100318
319 public static final IntFlag LPNH_HAPTIC_HINT_ITERATIONS =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800320 FlagsFactory.getIntFlag(309972570, "LPNH_HAPTIC_HINT_ITERATIONS",
321 50,
322 "Haptic hint number of iterations.",
323 LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_ITERATIONS);
Andreas Agvardb36bcff2023-11-10 15:16:55 +0100324
Andreas Agvard0fc7d522023-11-16 17:51:00 +0100325 public static final BooleanFlag ENABLE_LPNH_DEEP_PRESS =
326 getReleaseFlag(310952290, "ENABLE_LPNH_DEEP_PRESS", ENABLED,
327 "Long press of nav handle is instantly triggered if deep press is detected.");
328
Andreas Agvardfc74c092023-11-16 15:06:46 +0100329 public static final IntFlag LPNH_HAPTIC_HINT_DELAY =
Anushree Ganjameb5cb752024-01-18 11:14:54 -0800330 FlagsFactory.getIntFlag(309972570, "LPNH_HAPTIC_HINT_DELAY", 0,
331 "Delay before haptic hint starts.", LONG_PRESS_NAV_HANDLE_HAPTIC_HINT_DELAY);
Andreas Agvardfc74c092023-11-16 15:06:46 +0100332
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700333 // TODO(Block 17): Clean up flags
Jagrut Desai90dd0982023-11-09 09:57:38 -0800334 // Aconfig migration complete for ENABLE_TASKBAR_PINNING.
Jagrut Desai5bcad412023-12-20 11:09:50 -0800335 private static final BooleanFlag ENABLE_TASKBAR_PINNING = getDebugFlag(296231746,
Jagrut Desai0dbc0d02023-10-30 12:24:50 -0700336 "ENABLE_TASKBAR_PINNING", TEAMFOOD,
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700337 "Enables taskbar pinning to allow user to switch between transient and persistent "
338 + "taskbar flavors");
Andy Wickhamd386d7d2019-10-17 11:59:53 -0700339
Jagrut Desai90dd0982023-11-09 09:57:38 -0800340 public static boolean enableTaskbarPinning() {
341 return ENABLE_TASKBAR_PINNING.get() || Flags.enableTaskbarPinning();
342 }
343
Jeremy Sim7dc3bdc2023-10-12 13:04:54 -0700344 // Aconfig migration complete for ENABLE_APP_PAIRS.
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700345 public static final BooleanFlag ENABLE_APP_PAIRS = getDebugFlag(274189428,
346 "ENABLE_APP_PAIRS", DISABLED,
347 "Enables the ability to create and save app pairs on the Home screen for easy"
348 + " split screen launching.");
Jeremy Sim7dc3bdc2023-10-12 13:04:54 -0700349 public static boolean enableAppPairs() {
350 return ENABLE_APP_PAIRS.get() || com.android.wm.shell.Flags.enableAppPairs();
351 }
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700352
353 // TODO(Block 19): Clean up flags
354 public static final BooleanFlag SCROLL_TOP_TO_RESET = getReleaseFlag(270395177,
355 "SCROLL_TOP_TO_RESET", ENABLED,
356 "Bring up IME and focus on input when scroll to top if 'Always show keyboard'"
357 + " is enabled or in prefix state");
358
359 public static final BooleanFlag ENABLE_SEARCH_UNINSTALLED_APPS = getReleaseFlag(270395269,
Holly Suncd5d9a72023-06-13 15:31:30 -0700360 "ENABLE_SEARCH_UNINSTALLED_APPS", ENABLED, "Search uninstalled app results.");
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700361
362 // TODO(Block 20): Clean up flags
363 public static final BooleanFlag ENABLE_SCRIM_FOR_APP_LAUNCH = getDebugFlag(270393276,
364 "ENABLE_SCRIM_FOR_APP_LAUNCH", DISABLED, "Enables scrim during app launch animation.");
365
366 public static final BooleanFlag ENABLE_BACK_SWIPE_HOME_ANIMATION = getDebugFlag(270393426,
367 "ENABLE_BACK_SWIPE_HOME_ANIMATION", ENABLED,
368 "Enables home animation to icon when user swipes back.");
369
Jon Mirandaf762e172023-08-02 11:59:44 -0700370 public static final BooleanFlag ENABLE_DYNAMIC_TASKBAR_THRESHOLDS = getDebugFlag(294252473,
Jon Miranda06054132023-08-17 07:47:12 -0700371 "ENABLE_DYNAMIC_TASKBAR_THRESHOLDS", ENABLED,
Jon Mirandaf762e172023-08-02 11:59:44 -0700372 "Enables taskbar thresholds that scale based on screen size.");
373
Jon Miranda60ae29e2023-10-27 09:37:22 -0700374 // Aconfig migration complete for ENABLE_HOME_TRANSITION_LISTENER.
Jon Miranda00c3d782023-10-17 18:11:01 -0700375 public static final BooleanFlag ENABLE_HOME_TRANSITION_LISTENER = getDebugFlag(306053414,
Jon Miranda60ae29e2023-10-27 09:37:22 -0700376 "ENABLE_HOME_TRANSITION_LISTENER", TEAMFOOD,
Jon Miranda00c3d782023-10-17 18:11:01 -0700377 "Enables launcher to listen to all transitions that include home activity.");
378
Jon Miranda60ae29e2023-10-27 09:37:22 -0700379 public static boolean enableHomeTransitionListener() {
380 return ENABLE_HOME_TRANSITION_LISTENER.get() || Flags.enableHomeTransitionListener();
381 }
382
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700383 // TODO(Block 21): Clean up flags
384 public static final BooleanFlag ENABLE_APP_ICON_FOR_INLINE_SHORTCUTS = getDebugFlag(270395087,
385 "ENABLE_APP_ICON_IN_INLINE_SHORTCUTS", DISABLED, "Show app icon for inline shortcut");
386
387 // TODO(Block 22): Clean up flags
Sihua Maa5ccdbb2023-05-15 14:20:28 -0700388 public static final BooleanFlag ENABLE_WIDGET_TRANSITION_FOR_RESIZING = getDebugFlag(268553314,
389 "ENABLE_WIDGET_TRANSITION_FOR_RESIZING", DISABLED,
390 "Enable widget transition animation when resizing the widgets");
391
Nick Chameyev705c6652023-04-14 17:05:12 +0100392 public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209,
Nick Chameyev6d756972023-05-26 11:50:13 +0100393 "PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED,
Nick Chameyev705c6652023-04-14 17:05:12 +0100394 "Enables starting the unfold animation preemptively when unfolding, without"
395 + "waiting for SystemUI and then merging the SystemUI progress whenever we "
396 + "start receiving the events");
397
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700398 // TODO(Block 24): Clean up flags
399 public static final BooleanFlag ENABLE_NEW_MIGRATION_LOGIC = getDebugFlag(270393455,
400 "ENABLE_NEW_MIGRATION_LOGIC", ENABLED,
401 "Enable the new grid migration logic, keeping pages when src < dest");
402
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700403 // TODO(Block 25): Clean up flags
404 public static final BooleanFlag ENABLE_NEW_GESTURE_NAV_TUTORIAL = getDebugFlag(270396257,
405 "ENABLE_NEW_GESTURE_NAV_TUTORIAL", ENABLED,
406 "Enable the redesigned gesture navigation tutorial");
407
408 // TODO(Block 26): Clean up flags
409 public static final BooleanFlag ENABLE_WIDGET_HOST_IN_BACKGROUND = getDebugFlag(270394384,
410 "ENABLE_WIDGET_HOST_IN_BACKGROUND", ENABLED,
411 "Enable background widget updates listening for widget holder");
412
413 // TODO(Block 27): Clean up flags
Sunny Goyal749983b2023-02-24 09:27:04 -0800414 public static final BooleanFlag ENABLE_OVERLAY_CONNECTION_OPTIM = getDebugFlag(270392629,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700415 "ENABLE_OVERLAY_CONNECTION_OPTIM", DISABLED,
Sunny Goyal64453ae2022-10-21 14:06:49 -0700416 "Enable optimizing overlay service connection");
417
Grace170911d2022-07-22 01:13:46 +0000418 /**
419 * Enables region sampling for text color: Needs system health assessment before turning on
420 */
Sunny Goyal749983b2023-02-24 09:27:04 -0800421 public static final BooleanFlag ENABLE_REGION_SAMPLING = getDebugFlag(270391669,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700422 "ENABLE_REGION_SAMPLING", DISABLED,
Grace170911d2022-07-22 01:13:46 +0000423 "Enable region sampling to determine color of text on screen.");
424
vadimt5a07aad2020-02-12 14:40:05 -0800425 public static final BooleanFlag ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS =
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700426 getDebugFlag(270393096, "ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS",
427 DISABLED, "Always use hardware optimization for folder animations.");
vadimt5a07aad2020-02-12 14:40:05 -0800428
Sunny Goyal749983b2023-02-24 09:27:04 -0800429 public static final BooleanFlag SEPARATE_RECENTS_ACTIVITY = getDebugFlag(270392980,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700430 "SEPARATE_RECENTS_ACTIVITY", DISABLED,
Sunny Goyala314d5a2020-05-20 20:34:04 -0700431 "Uses a separate recents activity instead of using the integrated recents+Launcher UI");
432
Sunny Goyal749983b2023-02-24 09:27:04 -0800433 public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = getReleaseFlag(270393258,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700434 "ENABLE_ENFORCED_ROUNDED_CORNERS", ENABLED,
435 "Enforce rounded corners on all App Widgets");
Pierre Barbier de Reuille298526e2021-03-18 08:49:47 +0000436
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700437 public static final BooleanFlag USE_LOCAL_ICON_OVERRIDES = getDebugFlag(270394973,
438 "USE_LOCAL_ICON_OVERRIDES", ENABLED,
439 "Use inbuilt monochrome icons if app doesn't provide one");
Schneider Victor-tulias766f2fc2022-05-11 10:27:30 -0700440
Tracy Zhou859edd02023-11-08 22:44:44 -0800441 // Aconfig migration complete for ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.
Tracy Zhou7e0f5d82022-10-09 23:39:24 -0700442 public static final BooleanFlag ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE = getDebugFlag(
Vinit Nayake606ad42023-08-16 17:28:10 +0000443 270393453, "ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE", DISABLED,
Tracy Zhou7e0f5d82022-10-09 23:39:24 -0700444 "Enable initiating split screen from workspace to workspace.");
Vinit Nayaka1be4c12023-10-24 16:57:39 -0700445 public static boolean enableSplitContextually() {
446 return ENABLE_SPLIT_FROM_WORKSPACE_TO_WORKSPACE.get() ||
447 com.android.wm.shell.Flags.enableSplitContextual();
448 }
Tracy Zhou7e0f5d82022-10-09 23:39:24 -0700449
Sunny Goyal749983b2023-02-24 09:27:04 -0800450 public static final BooleanFlag ENABLE_TRACKPAD_GESTURE = getDebugFlag(271010401,
Tracy Zhoue7150712023-05-15 18:43:29 +0000451 "ENABLE_TRACKPAD_GESTURE", ENABLED, "Enables trackpad gesture.");
Tracy Zhoudaad3fe2022-10-20 00:37:33 -0700452
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700453 // TODO(Block 29): Clean up flags
454 public static final BooleanFlag ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT = getDebugFlag(270393897,
455 "ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT", DISABLED,
456 "Enables displaying the all apps button in the hotseat.");
Nicolo' Mazzucato8d9edd22023-02-06 18:38:50 +0000457
Sunny Goyal749983b2023-02-24 09:27:04 -0800458 public static final BooleanFlag ENABLE_KEYBOARD_QUICK_SWITCH = getDebugFlag(270396844,
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700459 "ENABLE_KEYBOARD_QUICK_SWITCH", ENABLED, "Enables keyboard quick switching");
Schneider Victor-tuliasf9087292023-01-24 15:05:08 -0800460
Schneider Victor-tuliaseb8dce02023-05-03 10:10:21 -0700461 public static final BooleanFlag ENABLE_KEYBOARD_TASKBAR_TOGGLE = getDebugFlag(281726846,
462 "ENABLE_KEYBOARD_TASKBAR_TOGGLE", ENABLED,
463 "Enables keyboard taskbar stash toggling");
464
Schneider Victor-tuliasecaba5a2023-04-18 14:09:07 -0700465 // TODO(Block 30): Clean up flags
466 public static final BooleanFlag USE_SEARCH_REQUEST_TIMEOUT_OVERRIDES = getDebugFlag(270395010,
467 "USE_SEARCH_REQUEST_TIMEOUT_OVERRIDES", DISABLED,
468 "Use local overrides for search request timeout");
Ankita Vyas45ef9b62023-01-20 09:19:29 +0000469
Sebastian Franco7ba94892023-06-29 14:33:23 -0700470 // TODO(Block 31): Clean up flags
Vinit Nayak2a014d42023-04-24 20:55:50 -0700471
Sebastian Franco7ba94892023-06-29 14:33:23 -0700472 // TODO(Block 32): Clean up flags
Thales Limaca31b612023-09-14 14:25:26 +0100473 // Aconfig migration complete for ENABLE_RESPONSIVE_WORKSPACE.
474 @VisibleForTesting
Thales Limaec5abba2023-04-05 16:33:50 +0100475 public static final BooleanFlag ENABLE_RESPONSIVE_WORKSPACE = getDebugFlag(241386436,
Thales Lima8f58b0a2023-09-25 16:27:21 -0700476 "ENABLE_RESPONSIVE_WORKSPACE", TEAMFOOD,
Thales Limaec5abba2023-04-05 16:33:50 +0100477 "Enables new workspace grid calculations method.");
Thales Limaca31b612023-09-14 14:25:26 +0100478 public static boolean enableResponsiveWorkspace() {
479 return ENABLE_RESPONSIVE_WORKSPACE.get() || Flags.enableResponsiveWorkspace();
480 }
Thales Limaec5abba2023-04-05 16:33:50 +0100481
Fengjiang Li1519c162023-06-15 12:28:42 -0700482 // TODO(Block 33): Clean up flags
Fengjiang Li1519c162023-06-15 12:28:42 -0700483 public static final BooleanFlag ENABLE_ALL_APPS_RV_PREINFLATION = getDebugFlag(288161355,
Fengjiang Li1a0c2782023-12-14 18:19:35 +0000484 "ENABLE_ALL_APPS_RV_PREINFLATION", ENABLED,
Fengjiang Li1519c162023-06-15 12:28:42 -0700485 "Enables preinflating all apps icons to avoid scrolling jank.");
Fengjiang Li98c91a62023-08-04 17:16:11 +0000486 public static final BooleanFlag ALL_APPS_GONE_VISIBILITY = getDebugFlag(291651514,
Fengjiang Li1a0c2782023-12-14 18:19:35 +0000487 "ALL_APPS_GONE_VISIBILITY", ENABLED,
Fengjiang Li98c91a62023-08-04 17:16:11 +0000488 "Set all apps container view's hidden visibility to GONE instead of INVISIBLE.");
489
Schneider Victor-tulias8d3d6232023-09-26 17:19:15 -0400490 // TODO(Block 34): Empty block
491 // Please only add flags to your assigned block. If you do not have a block:
492 // 1. Assign yourself this block
493 // 2. Add your flag to this block
494 // 3. Add a new empty block below this one
495 // 4. Move this comment to that new empty block
496 // This is all to prevent merge conflicts in the future and help keep track of who owns which
497 // flags.
498 // List of assigned blocks can be found: http://go/gnl-flags-block-directory
Sebastian Franco7ba94892023-06-29 14:33:23 -0700499
Sunny Goyal94fa76f2020-01-21 11:59:19 -0800500 public static class BooleanFlag {
Ryan Lothianfa530cd2018-10-12 14:14:16 -0400501
Sunny Goyal749983b2023-02-24 09:27:04 -0800502 private final boolean mCurrentValue;
Hyunyoung Songe17a6992019-09-09 23:32:17 -0700503
Sunny Goyal749983b2023-02-24 09:27:04 -0800504 public BooleanFlag(boolean currentValue) {
505 mCurrentValue = currentValue;
Ryan Lothianfa530cd2018-10-12 14:14:16 -0400506 }
507
Ryan Lothianfa530cd2018-10-12 14:14:16 -0400508 public boolean get() {
Sunny Goyalb138ec92023-03-02 16:49:59 -0800509 return sBooleanReader.test(this);
Sunny Goyal94fa76f2020-01-21 11:59:19 -0800510 }
Sunny Goyal94fa76f2020-01-21 11:59:19 -0800511 }
Sunny Goyal2003c1c2023-02-28 12:00:27 -0800512
513 /**
514 * Class representing an integer flag
515 */
516 public static class IntFlag {
517
518 private final int mCurrentValue;
519
520 public IntFlag(int currentValue) {
521 mCurrentValue = currentValue;
522 }
523
524 public int get() {
Sunny Goyalb138ec92023-03-02 16:49:59 -0800525 return sIntReader.applyAsInt(this);
Sunny Goyal2003c1c2023-02-28 12:00:27 -0800526 }
527 }
Sunny Goyalef6b0c02023-03-20 15:56:07 -0700528
529 /**
530 * Enabled state for a flag
531 */
532 public enum FlagState {
533 ENABLED,
534 DISABLED,
535 TEAMFOOD // Enabled in team food
536 }
Sunny Goyale1ee42c2017-07-24 01:02:38 -0700537}