diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index f9b9ca3bb8fed..4be3e5c17dd7b 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -170,10 +170,18 @@ object Flags { @Deprecated("Replaced by mobile and wifi specific flags.") val NEW_STATUS_BAR_PIPELINE_FRONTEND = UnreleasedFlag(605, teamfood = false) + // TODO(b/256614753): Tracking Bug val NEW_STATUS_BAR_MOBILE_ICONS = UnreleasedFlag(606) + // TODO(b/256614210): Tracking Bug val NEW_STATUS_BAR_WIFI_ICON = UnreleasedFlag(607) + // TODO(b/256614751): Tracking Bug + val NEW_STATUS_BAR_MOBILE_ICONS_BACKEND = UnreleasedFlag(608) + + // TODO(b/256613548): Tracking Bug + val NEW_STATUS_BAR_WIFI_ICON_BACKEND = UnreleasedFlag(609) + // 700 - dialer/calls // TODO(b/254512734): Tracking Bug val ONGOING_CALL_STATUS_BAR_CHIP = ReleasedFlag(700) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java index 9095d6f4e369b..0a0ded24ef306 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java @@ -382,15 +382,18 @@ public interface StatusBarIconController { mIconSize = mContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_icon_size); - if (statusBarPipelineFlags.useNewMobileIcons()) { - // This starts the flow for the new pipeline, and will notify us of changes + if (statusBarPipelineFlags.runNewMobileIconsBackend()) { + // This starts the flow for the new pipeline, and will notify us of changes if + // {@link StatusBarPipelineFlags#useNewMobileIcons} is also true. mMobileIconsViewModel = mobileUiAdapter.createMobileIconsViewModel(); MobileIconsBinder.bind(mGroup, mMobileIconsViewModel); } else { mMobileIconsViewModel = null; } - if (statusBarPipelineFlags.useNewWifiIcon()) { + if (statusBarPipelineFlags.runNewWifiIconBackend()) { + // This starts the flow for the new pipeline, and will notify us of changes if + // {@link StatusBarPipelineFlags#useNewWifiIcon} is also true. mWifiViewModel = wifiUiAdapter.bindGroup(mGroup, location); } else { mWifiViewModel = null; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/StatusBarPipelineFlags.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/StatusBarPipelineFlags.kt index 06cd12dd1a0d1..946d7e4a3e75a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/StatusBarPipelineFlags.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/StatusBarPipelineFlags.kt @@ -27,11 +27,26 @@ class StatusBarPipelineFlags @Inject constructor(private val featureFlags: Featu /** True if we should display the mobile icons using the new status bar data pipeline. */ fun useNewMobileIcons(): Boolean = featureFlags.isEnabled(Flags.NEW_STATUS_BAR_MOBILE_ICONS) + /** + * True if we should run the new mobile icons backend to get the logging. + * + * Does *not* affect whether we render the mobile icons using the new backend data. See + * [useNewMobileIcons] for that. + */ + fun runNewMobileIconsBackend(): Boolean = + featureFlags.isEnabled(Flags.NEW_STATUS_BAR_MOBILE_ICONS_BACKEND) || useNewMobileIcons() + /** True if we should display the wifi icon using the new status bar data pipeline. */ fun useNewWifiIcon(): Boolean = featureFlags.isEnabled(Flags.NEW_STATUS_BAR_WIFI_ICON) - // TODO(b/238425913): Add flags to only run the mobile backend or wifi backend so we get the - // logging without getting the UI effects. + /** + * True if we should run the new wifi icon backend to get the logging. + * + * Does *not* affect whether we render the wifi icon using the new backend data. See + * [useNewWifiIcon] for that. + */ + fun runNewWifiIconBackend(): Boolean = + featureFlags.isEnabled(Flags.NEW_STATUS_BAR_WIFI_ICON_BACKEND) || useNewWifiIcon() /** * Returns true if we should apply some coloring to the wifi icon that was rendered with the new diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapter.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapter.kt index 380017cd34182..c7e0ce173ece1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapter.kt @@ -20,6 +20,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.statusbar.phone.StatusBarIconController import com.android.systemui.statusbar.phone.StatusBarIconController.IconManager +import com.android.systemui.statusbar.pipeline.StatusBarPipelineFlags import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractor import com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel.MobileIconsViewModel import javax.inject.Inject @@ -50,6 +51,7 @@ constructor( private val iconController: StatusBarIconController, private val iconsViewModelFactory: MobileIconsViewModel.Factory, @Application scope: CoroutineScope, + private val statusBarPipelineFlags: StatusBarPipelineFlags, ) { private val mobileSubIds: Flow> = interactor.filteredSubscriptions.mapLatest { infos -> @@ -66,8 +68,14 @@ constructor( private val mobileSubIdsState: StateFlow> = mobileSubIds .onEach { - // Notify the icon controller here so that it knows to add icons - iconController.setNewMobileIconSubIds(it) + // Only notify the icon controller if we want to *render* the new icons. + // Note that this flow may still run if + // [statusBarPipelineFlags.runNewMobileIconsBackend] is true because we may want to + // get the logging data without rendering. + if (statusBarPipelineFlags.useNewMobileIcons()) { + // Notify the icon controller here so that it knows to add icons + iconController.setNewMobileIconSubIds(it) + } } .stateIn(scope, SharingStarted.WhileSubscribed(), listOf()) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapter.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapter.kt index bce92b951d23a..b816364ed4cf0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapter.kt @@ -23,6 +23,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.statusbar.phone.StatusBarIconController import com.android.systemui.statusbar.phone.StatusBarLocation +import com.android.systemui.statusbar.pipeline.StatusBarPipelineFlags import com.android.systemui.statusbar.pipeline.wifi.ui.viewmodel.LocationBasedWifiViewModel import com.android.systemui.statusbar.pipeline.wifi.ui.viewmodel.WifiViewModel import javax.inject.Inject @@ -43,6 +44,7 @@ class WifiUiAdapter constructor( private val iconController: StatusBarIconController, private val wifiViewModel: WifiViewModel, + private val statusBarPipelineFlags: StatusBarPipelineFlags, ) { /** * Binds the container for all the status bar icons to a view model, so that we inflate the wifi @@ -67,7 +69,11 @@ constructor( repeatOnLifecycle(Lifecycle.State.STARTED) { launch { locationViewModel.wifiIcon.collect { wifiIcon -> - if (wifiIcon != null) { + // Only notify the icon controller if we want to *render* the new icon. + // Note that this flow may still run if + // [statusBarPipelineFlags.runNewWifiIconBackend] is true because we may + // want to get the logging data without rendering. + if (wifiIcon != null && statusBarPipelineFlags.useNewWifiIcon()) { iconController.setNewWifiIcon() } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt index 89b96b7bc75d2..0782bbb774eb9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModel.kt @@ -145,7 +145,8 @@ constructor( else -> null } } - .stateIn(scope, started = SharingStarted.WhileSubscribed(), initialValue = null) + .logOutputChange(logger, "icon") { icon -> icon?.contentDescription.toString() } + .stateIn(scope, started = SharingStarted.WhileSubscribed(), initialValue = null) /** The wifi activity status. Null if we shouldn't display the activity status. */ private val activity: Flow =