[SB Refactor] Define flags that allow us to run the backend without
updating the UI. Bug: 238425913 Test: set the _BACKEND flags on and verify that we get the logs but that the icon comes from the old system Test: set the _BACKEND flags off and verify that we don't get any logs from the new system Test: set the USE_NEW_ICONS flags on and verify that the icon comes from the new system Test: statusbar.pipeline tests Change-Id: I7125da88dbb9da52fc8b22bb9ff34af0c13e290d
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<List<Int>> =
|
||||
interactor.filteredSubscriptions.mapLatest { infos ->
|
||||
@@ -66,8 +68,14 @@ constructor(
|
||||
private val mobileSubIdsState: StateFlow<List<Int>> =
|
||||
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())
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<WifiActivityModel?> =
|
||||
|
||||
Reference in New Issue
Block a user