1 /*
2  * Copyright (C) 2022 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 package com.android.systemui.flags
17 
18 import android.provider.DeviceConfig
19 import com.android.internal.annotations.Keep
20 import com.android.systemui.flags.FlagsFactory.releasedFlag
21 import com.android.systemui.flags.FlagsFactory.resourceBooleanFlag
22 import com.android.systemui.flags.FlagsFactory.sysPropBooleanFlag
23 import com.android.systemui.flags.FlagsFactory.unreleasedFlag
24 import com.android.systemui.res.R
25 
26 /**
27  * List of [Flag] objects for use in SystemUI.
28  *
29  * Flag Ids are integers. Ids must be unique. This is enforced in a unit test. Ids need not be
30  * sequential. Flags can "claim" a chunk of ids for flags in related features with a comment. This
31  * is purely for organizational purposes.
32  *
33  * On public release builds, flags will always return their default value. There is no way to change
34  * their value on release builds.
35  *
36  * See [FeatureFlagsClassicDebug] for instructions on flipping the flags via adb.
37  */
38 object Flags {
39     // IGNORE ME!
40     // Because flags are static, we need an ever-present flag to reference in some of the internal
41     // code that ensure that other flags are referenced and available.
42     @JvmField val NULL_FLAG = unreleasedFlag("null_flag")
43 
44     // 100 - notification
45     // TODO(b/254512751): Tracking Bug
46     val NOTIFICATION_PIPELINE_DEVELOPER_LOGGING =
47         unreleasedFlag("notification_pipeline_developer_logging")
48 
49     // TODO(b/254512732): Tracking Bug
50     @JvmField val NSSL_DEBUG_LINES = unreleasedFlag("nssl_debug_lines")
51 
52     // TODO(b/254512505): Tracking Bug
53     @JvmField val NSSL_DEBUG_REMOVE_ANIMATION = unreleasedFlag("nssl_debug_remove_animation")
54 
55     // TODO(b/254512624): Tracking Bug
56     @JvmField
57     val NOTIFICATION_DRAG_TO_CONTENTS =
58         resourceBooleanFlag(
59             R.bool.config_notificationToContents,
60             "notification_drag_to_contents"
61         )
62 
63     // TODO(b/280783617): Tracking Bug
64     @Keep
65     @JvmField
66     val BUILDER_EXTRAS_OVERRIDE =
67         sysPropBooleanFlag(
68             "persist.sysui.notification.builder_extras_override",
69             default = true
70         )
71 
72     // 200 - keyguard/lockscreen
73     // ** Flag retired **
74     // public static final BooleanFlag KEYGUARD_LAYOUT =
75     //         new BooleanFlag(true);
76 
77     // TODO(b/254512750): Tracking Bug
78     val NEW_UNLOCK_SWIPE_ANIMATION = releasedFlag("new_unlock_swipe_animation")
79     val CHARGING_RIPPLE = resourceBooleanFlag(R.bool.flag_charging_ripple, "charging_ripple")
80 
81     // TODO(b/254512676): Tracking Bug
82     @JvmField
83     val LOCKSCREEN_CUSTOM_CLOCKS =
84         resourceBooleanFlag(
85             R.bool.config_enableLockScreenCustomClocks,
86             "lockscreen_custom_clocks"
87         )
88 
89     /**
90      * Whether the clock on a wide lock screen should use the new "stepping" animation for moving
91      * the digits when the clock moves.
92      */
93     @JvmField val STEP_CLOCK_ANIMATION = releasedFlag("step_clock_animation")
94 
95     /**
96      * Migration from the legacy isDozing/dozeAmount paths to the new KeyguardTransitionRepository
97      * will occur in stages. This is one stage of many to come.
98      */
99     // TODO(b/255607168): Tracking Bug
100     @JvmField val DOZING_MIGRATION_1 = unreleasedFlag("dozing_migration_1")
101 
102     // TODO(b/305984787):
103     @JvmField
104     val REFACTOR_GETCURRENTUSER = unreleasedFlag("refactor_getcurrentuser", teamfood = true)
105 
106     /** Flag to control the revamp of keyguard biometrics progress animation */
107     // TODO(b/244313043): Tracking bug
108     @JvmField val BIOMETRICS_ANIMATION_REVAMP = unreleasedFlag("biometrics_animation_revamp")
109 
110     // flag for controlling auto pin confirmation and material u shapes in bouncer
111     @JvmField
112     val AUTO_PIN_CONFIRMATION = releasedFlag("auto_pin_confirmation", "auto_pin_confirmation")
113 
114     // TODO(b/262859270): Tracking Bug
115     @JvmField val FALSING_OFF_FOR_UNFOLDED = releasedFlag("falsing_off_for_unfolded")
116 
117     /** Enables code to show contextual loyalty cards in wallet entrypoints */
118     // TODO(b/294110497): Tracking Bug
119     @JvmField
120     val ENABLE_WALLET_CONTEXTUAL_LOYALTY_CARDS =
121         releasedFlag("enable_wallet_contextual_loyalty_cards")
122 
123     // TODO(b/242908637): Tracking Bug
124     @JvmField val WALLPAPER_FULLSCREEN_PREVIEW = releasedFlag("wallpaper_fullscreen_preview")
125 
126     /** Whether the long-press gesture to open wallpaper picker is enabled. */
127     // TODO(b/266242192): Tracking Bug
128     @JvmField
129     val LOCK_SCREEN_LONG_PRESS_ENABLED = releasedFlag("lock_screen_long_press_enabled")
130 
131     /** Inflate and bind views upon emitting a blueprint value . */
132     // TODO(b/297365780): Tracking Bug
133     @JvmField
134     val LAZY_INFLATE_KEYGUARD = releasedFlag("lazy_inflate_keyguard")
135 
136     /** Enables UI updates for AI wallpapers in the wallpaper picker. */
137     // TODO(b/267722622): Tracking Bug
138     @JvmField val WALLPAPER_PICKER_UI_FOR_AIWP = releasedFlag("wallpaper_picker_ui_for_aiwp")
139 
140     /** Whether to allow long-press on the lock screen to directly open wallpaper picker. */
141     // TODO(b/277220285): Tracking bug.
142     @JvmField
143     val LOCK_SCREEN_LONG_PRESS_DIRECT_TO_WPP =
144         unreleasedFlag("lock_screen_long_press_directly_opens_wallpaper_picker")
145 
146     /** Whether page transition animations in the wallpaper picker are enabled */
147     // TODO(b/291710220): Tracking bug.
148     @JvmField
149     val WALLPAPER_PICKER_PAGE_TRANSITIONS = releasedFlag("wallpaper_picker_page_transitions")
150 
151     /** Add "Apply" button to wall paper picker's grid preview page. */
152     // TODO(b/294866904): Tracking bug.
153     @JvmField
154     val WALLPAPER_PICKER_GRID_APPLY_BUTTON =
155             unreleasedFlag("wallpaper_picker_grid_apply_button")
156 
157     /** Flag meant to guard the talkback fix for the KeyguardIndicationTextView */
158     // TODO(b/286563884): Tracking bug
159     @JvmField val KEYGUARD_TALKBACK_FIX = unreleasedFlag("keyguard_talkback_fix")
160 
161     // TODO(b/287268101): Tracking bug.
162     @JvmField val TRANSIT_CLOCK = releasedFlag("lockscreen_custom_transit_clock")
163 
164     /** Enables preview loading animation in the wallpaper picker. */
165     // TODO(b/274443705): Tracking Bug
166     @JvmField
167     val WALLPAPER_PICKER_PREVIEW_ANIMATION = releasedFlag("wallpaper_picker_preview_animation")
168 
169     // 300 - power menu
170     // TODO(b/254512600): Tracking Bug
171     @JvmField val POWER_MENU_LITE = releasedFlag("power_menu_lite")
172 
173     // 400 - smartspace
174 
175     // TODO(b/254513100): Tracking Bug
176     val SMARTSPACE_SHARED_ELEMENT_TRANSITION_ENABLED =
177         releasedFlag("smartspace_shared_element_transition_enabled")
178 
179     // TODO(b/270223352): Tracking Bug
180     @JvmField
181     val HIDE_SMARTSPACE_ON_DREAM_OVERLAY = releasedFlag("hide_smartspace_on_dream_overlay")
182 
183     // TODO(b/271460958): Tracking Bug
184     @JvmField
185     val SHOW_WEATHER_COMPLICATION_ON_DREAM_OVERLAY =
186         releasedFlag("show_weather_complication_on_dream_overlay")
187 
188     // 500 - quick settings
189 
190     val PEOPLE_TILE = resourceBooleanFlag(R.bool.flag_conversations, "people_tile")
191 
192     @JvmField
193     val QS_USER_DETAIL_SHORTCUT =
194         resourceBooleanFlag(
195             R.bool.flag_lockscreen_qs_user_detail_shortcut,
196             "qs_user_detail_shortcut"
197         )
198 
199     // TODO(b/254512383): Tracking Bug
200     @JvmField
201     val FULL_SCREEN_USER_SWITCHER =
202         resourceBooleanFlag(
203             R.bool.config_enableFullscreenUserSwitcher,
204             "full_screen_user_switcher"
205         )
206 
207     // TODO(b/244064524): Tracking Bug
208     @JvmField val QS_SECONDARY_DATA_SUB_INFO = releasedFlag("qs_secondary_data_sub_info")
209 
210     /** Enables new QS Edit Mode visual refresh */
211     // TODO(b/269787742): Tracking Bug
212     @JvmField
213     val ENABLE_NEW_QS_EDIT_MODE = unreleasedFlag("enable_new_qs_edit_mode", teamfood = false)
214 
215     // 600- status bar
216 
217     // TODO(b/291315866): Tracking Bug
218     @JvmField val SIGNAL_CALLBACK_DEPRECATION = releasedFlag("signal_callback_deprecation")
219 
220     // TODO(b/301610137): Tracking bug
221     @JvmField val NEW_NETWORK_SLICE_UI = releasedFlag("new_network_slice_ui")
222 
223     // TODO(b/311222557): Tracking bug
224     val ROAMING_INDICATOR_VIA_DISPLAY_INFO =
225         releasedFlag("roaming_indicator_via_display_info")
226 
227     // TODO(b/308138154): Tracking bug
228     val FILTER_PROVISIONING_NETWORK_SUBSCRIPTIONS =
229         releasedFlag("filter_provisioning_network_subscriptions")
230 
231     // TODO(b/293863612): Tracking Bug
232     @JvmField val INCOMPATIBLE_CHARGING_BATTERY_ICON =
233         releasedFlag("incompatible_charging_battery_icon")
234 
235     // TODO(b/293585143): Tracking Bug
236     val INSTANT_TETHER = releasedFlag("instant_tether")
237 
238     // TODO(b/294588085): Tracking Bug
239     val WIFI_SECONDARY_NETWORKS = releasedFlag("wifi_secondary_networks")
240 
241     // TODO(b/290676905): Tracking Bug
242     val NEW_SHADE_CARRIER_GROUP_MOBILE_ICONS =
243         releasedFlag("new_shade_carrier_group_mobile_icons")
244 
245     // 800 - general visual/theme
246     @JvmField val MONET = resourceBooleanFlag(R.bool.flag_monet, "monet")
247 
248     // 801 - region sampling
249     // TODO(b/254512848): Tracking Bug
250     val REGION_SAMPLING = unreleasedFlag("region_sampling")
251 
252     // 803 - screen contents translation
253     // TODO(b/254513187): Tracking Bug
254     val SCREEN_CONTENTS_TRANSLATION = unreleasedFlag("screen_contents_translation")
255 
256     // 804 - monochromatic themes
257     @JvmField val MONOCHROMATIC_THEME = releasedFlag("monochromatic")
258 
259     // TODO(b/293380347): Tracking Bug
260     @JvmField val COLOR_FIDELITY = unreleasedFlag("color_fidelity")
261 
262     // 900 - media
263     // TODO(b/254512697): Tracking Bug
264     val MEDIA_TAP_TO_TRANSFER = releasedFlag("media_tap_to_transfer")
265 
266     // TODO(b/254512502): Tracking Bug
267     val MEDIA_SESSION_ACTIONS = unreleasedFlag("media_session_actions")
268 
269     // TODO(b/254512654): Tracking Bug
270     @JvmField val DREAM_MEDIA_COMPLICATION = unreleasedFlag("dream_media_complication")
271 
272     // TODO(b/254512673): Tracking Bug
273     @JvmField val DREAM_MEDIA_TAP_TO_OPEN = unreleasedFlag("dream_media_tap_to_open")
274 
275     // TODO(b/266157412): Tracking Bug
276     val MEDIA_RETAIN_SESSIONS = unreleasedFlag("media_retain_sessions")
277 
278     // TODO(b/267007629): Tracking Bug
279     val MEDIA_RESUME_PROGRESS = releasedFlag("media_resume_progress")
280 
281     // TODO(b/267166152) : Tracking Bug
282     val MEDIA_RETAIN_RECOMMENDATIONS = unreleasedFlag("media_retain_recommendations")
283 
284     // TODO(b/270437894): Tracking Bug
285     val MEDIA_REMOTE_RESUME = unreleasedFlag("media_remote_resume")
286 
287     // 1000 - dock
288     val SIMULATE_DOCK_THROUGH_CHARGING = releasedFlag("simulate_dock_through_charging")
289 
290     // TODO(b/273509374): Tracking Bug
291     @JvmField
292     val ALWAYS_SHOW_HOME_CONTROLS_ON_DREAMS =
293         releasedFlag("always_show_home_controls_on_dreams")
294 
295     // 1100 - windowing
296     @Keep
297     @JvmField
298     val WM_ENABLE_SHELL_TRANSITIONS =
299         sysPropBooleanFlag("persist.wm.debug.shell_transit", default = true)
300 
301     // TODO(b/254513207): Tracking Bug
302     @Keep
303     @JvmField
304     val WM_ENABLE_PARTIAL_SCREEN_SHARING =
305         releasedFlag(
306             name = "enable_record_task_content",
307             namespace = DeviceConfig.NAMESPACE_WINDOW_MANAGER,
308         )
309 
310     // TODO(b/256873975): Tracking Bug
311     @JvmField
312     @Keep
313     val WM_BUBBLE_BAR = sysPropBooleanFlag("persist.wm.debug.bubble_bar", default = false)
314 
315     // TODO(b/254513207): Tracking Bug to delete
316     @Keep
317     @JvmField
318     val WM_ENABLE_PARTIAL_SCREEN_SHARING_ENTERPRISE_POLICIES =
319         releasedFlag(
320             name = "enable_screen_record_enterprise_policies",
321             namespace = DeviceConfig.NAMESPACE_WINDOW_MANAGER,
322         )
323 
324     // TODO(b/293252410) : Tracking Bug
325     @JvmField
326     val LOCKSCREEN_ENABLE_LANDSCAPE =
327             unreleasedFlag("lockscreen.enable_landscape")
328 
329     // 1200 - predictive back
330     @Keep
331     @JvmField
332     val WM_ENABLE_PREDICTIVE_BACK_ANIM =
333         sysPropBooleanFlag("persist.wm.debug.predictive_back_anim", default = true)
334 
335     @Keep
336     @JvmField
337     val WM_ALWAYS_ENFORCE_PREDICTIVE_BACK =
338         sysPropBooleanFlag("persist.wm.debug.predictive_back_always_enforce", default = false)
339 
340     // TODO(b/251205791): Tracking Bug
341     @JvmField val SCREENSHOT_APP_CLIPS = releasedFlag("screenshot_app_clips")
342 
343     // 1400 - columbus
344     // TODO(b/254512756): Tracking Bug
345     val QUICK_TAP_IN_PCC = releasedFlag("quick_tap_in_pcc")
346 
347     // TODO(b/261979569): Tracking Bug
348     val QUICK_TAP_FLOW_FRAMEWORK =
349         unreleasedFlag("quick_tap_flow_framework", teamfood = false)
350 
351     // 1500 - chooser aka sharesheet
352 
353     // 1700 - clipboard
354     @JvmField val CLIPBOARD_REMOTE_BEHAVIOR = releasedFlag("clipboard_remote_behavior")
355     // TODO(b/278714186) Tracking Bug
356     @JvmField
357     val CLIPBOARD_IMAGE_TIMEOUT = unreleasedFlag("clipboard_image_timeout", teamfood = true)
358     // TODO(b/279405451): Tracking Bug
359     @JvmField
360     val CLIPBOARD_SHARED_TRANSITIONS =
361             unreleasedFlag("clipboard_shared_transitions", teamfood = true)
362 
363     // 1900
364     @JvmField val NOTE_TASKS = releasedFlag("keycode_flag")
365 
366     // 2200 - biometrics (udfps, sfps, BiometricPrompt, etc.)
367 
368     // 2300 - stylus
369     @JvmField val TRACK_STYLUS_EVER_USED = releasedFlag("track_stylus_ever_used")
370     @JvmField val ENABLE_STYLUS_CHARGING_UI = releasedFlag("enable_stylus_charging_ui")
371     @JvmField
372     val ENABLE_USI_BATTERY_NOTIFICATIONS = releasedFlag("enable_usi_battery_notifications")
373     @JvmField val ENABLE_STYLUS_EDUCATION = releasedFlag("enable_stylus_education")
374 
375     // 2400 - performance tools and debugging info
376     // TODO(b/238923086): Tracking Bug
377     @JvmField
378     val WARN_ON_BLOCKING_BINDER_TRANSACTIONS =
379         unreleasedFlag("warn_on_blocking_binder_transactions")
380 
381     // TODO(b/298380520): Tracking Bug
382     @JvmField
383     val USER_TRACKER_BACKGROUND_CALLBACKS = unreleasedFlag("user_tracker_background_callbacks")
384 
385     // 2700 - unfold transitions
386     // TODO(b/265764985): Tracking Bug
387     @Keep
388     @JvmField
389     val ENABLE_DARK_VIGNETTE_WHEN_FOLDING =
390         unreleasedFlag("enable_dark_vignette_when_folding")
391 
392     // TODO(b/265764985): Tracking Bug
393     @Keep
394     @JvmField
395     val ENABLE_UNFOLD_STATUS_BAR_ANIMATIONS =
396         unreleasedFlag("enable_unfold_status_bar_animations")
397 
398     // TODO(b/316157842): Tracking Bug
399     // Adds extra delay to notifications measure
400     @Keep
401     @JvmField
402     val ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE =
403         unreleasedFlag("enable_notifications_simulate_slow_measure")
404 
405     // TODO(b259590361): Tracking bug
406     val EXPERIMENTAL_FLAG = unreleasedFlag("exp_flag_release")
407 
408     // 2600 - keyboard
409     // TODO(b/259352579): Tracking Bug
410     @JvmField val SHORTCUT_LIST_SEARCH_LAYOUT = releasedFlag("shortcut_list_search_layout")
411 
412     // TODO(b/259428678): Tracking Bug
413     @JvmField val KEYBOARD_BACKLIGHT_INDICATOR = releasedFlag("keyboard_backlight_indicator")
414 
415     // TODO(b/277201412): Tracking Bug
416     @JvmField
417     val SPLIT_SHADE_SUBPIXEL_OPTIMIZATION = unreleasedFlag("split_shade_subpixel_optimization")
418 
419     // TODO(b/278761837): Tracking Bug
420     @JvmField val USE_NEW_ACTIVITY_STARTER = releasedFlag(name = "use_new_activity_starter")
421 
422     // 2900 - Zero Jank fixes. Naming convention is: zj_<bug number>_<cuj name>
423 
424     // TODO:(b/285623104): Tracking bug
425     @JvmField
426     val ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD =
427         releasedFlag("zj_285570694_lockscreen_transition_from_aod")
428 
429     // 3000 - dream
430     // TODO(b/285059790) : Tracking Bug
431     @JvmField
432     val LOCKSCREEN_WALLPAPER_DREAM_ENABLED = unreleasedFlag("enable_lockscreen_wallpaper_dream")
433 
434     // TODO(b/283447257): Tracking bug
435     @JvmField
436     val BIGPICTURE_NOTIFICATION_LAZY_LOADING =
437         unreleasedFlag("bigpicture_notification_lazy_loading")
438 
439     // TODO(b/283740863): Tracking Bug
440     @JvmField
441     val ENABLE_NEW_PRIVACY_DIALOG = releasedFlag("enable_new_privacy_dialog")
442 
443     // TODO(b/302144438): Tracking Bug
444     @JvmField val DECOUPLE_REMOTE_INPUT_DELEGATE_AND_CALLBACK_UPDATE =
445             unreleasedFlag("decouple_remote_input_delegate_and_callback_update")
446 
447     /** TODO(b/296223317): Enables the new keyguard presentation containing a clock. */
448     @JvmField
449     val ENABLE_CLOCK_KEYGUARD_PRESENTATION = releasedFlag("enable_clock_keyguard_presentation")
450 
451     /** Enable the share wifi button in Quick Settings internet dialog. */
452     @JvmField
453     val SHARE_WIFI_QS_BUTTON = releasedFlag("share_wifi_qs_button")
454 
455     /** Enable showing a dialog when clicking on Quick Settings bluetooth tile. */
456     @JvmField
457     val BLUETOOTH_QS_TILE_DIALOG = releasedFlag("bluetooth_qs_tile_dialog")
458 
459     // TODO(b/300995746): Tracking Bug
460     /** A resource flag for whether the communal service is enabled. */
461     @JvmField
462     val COMMUNAL_SERVICE_ENABLED = resourceBooleanFlag(R.bool.config_communalServiceEnabled,
463         "communal_service_enabled")
464 }
465