Merge changes Ib9dde023,I917506fc,I8576cc36 into udc-dev am: ab3637736a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22997371

Change-Id: I268ae455782c4d1835e4ae331ecbdbbc07595fdd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Caitlin Shkuratov
2023-05-08 19:24:17 +00:00
committed by Automerger Merge Worker
4 changed files with 304 additions and 302 deletions

View File

@@ -160,7 +160,7 @@ abstract class StatusBarPipelineModule {
@SysUISingleton @SysUISingleton
@SharedConnectivityInputLog @SharedConnectivityInputLog
fun provideSharedConnectivityTableLogBuffer(factory: LogBufferFactory): LogBuffer { fun provideSharedConnectivityTableLogBuffer(factory: LogBufferFactory): LogBuffer {
return factory.create("SharedConnectivityInputLog", 30) return factory.create("SharedConnectivityInputLog", 60)
} }
@Provides @Provides

View File

@@ -38,6 +38,7 @@ import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.log.table.logDiffsForTable import com.android.systemui.log.table.logDiffsForTable
import com.android.systemui.statusbar.pipeline.airplane.data.repository.AirplaneModeRepository
import com.android.systemui.statusbar.pipeline.dagger.MobileSummaryLog import com.android.systemui.statusbar.pipeline.dagger.MobileSummaryLog
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel
@@ -88,6 +89,7 @@ constructor(
private val context: Context, private val context: Context,
@Background private val bgDispatcher: CoroutineDispatcher, @Background private val bgDispatcher: CoroutineDispatcher,
@Application private val scope: CoroutineScope, @Application private val scope: CoroutineScope,
airplaneModeRepository: AirplaneModeRepository,
// Some "wifi networks" should be rendered as a mobile connection, which is why the wifi // Some "wifi networks" should be rendered as a mobile connection, which is why the wifi
// repository is an input to the mobile repository. // repository is an input to the mobile repository.
// See [CarrierMergedConnectionRepository] for details. // See [CarrierMergedConnectionRepository] for details.
@@ -106,10 +108,20 @@ constructor(
context.getString(R.string.status_bar_network_name_separator) context.getString(R.string.status_bar_network_name_separator)
private val carrierMergedSubId: StateFlow<Int?> = private val carrierMergedSubId: StateFlow<Int?> =
wifiRepository.wifiNetwork combine(
.mapLatest { wifiRepository.wifiNetwork,
if (it is WifiNetworkModel.CarrierMerged) { connectivityRepository.defaultConnections,
it.subscriptionId airplaneModeRepository.isAirplaneMode,
) { wifiNetwork, defaultConnections, isAirplaneMode ->
// The carrier merged connection should only be used if it's also the default
// connection or mobile connections aren't available because of airplane mode.
val defaultConnectionIsNonMobile =
defaultConnections.carrierMerged.isDefault ||
defaultConnections.wifi.isDefault ||
isAirplaneMode
if (wifiNetwork is WifiNetworkModel.CarrierMerged && defaultConnectionIsNonMobile) {
wifiNetwork.subscriptionId
} else { } else {
null null
} }
@@ -269,12 +281,8 @@ constructor(
.stateIn(scope, SharingStarted.WhileSubscribed(), false) .stateIn(scope, SharingStarted.WhileSubscribed(), false)
override val hasCarrierMergedConnection: StateFlow<Boolean> = override val hasCarrierMergedConnection: StateFlow<Boolean> =
combine( carrierMergedSubId
connectivityRepository.defaultConnections, .map { it != null }
carrierMergedSubId,
) { defaultConnections, carrierMergedSubId ->
defaultConnections.carrierMerged.isDefault || carrierMergedSubId != null
}
.distinctUntilChanged() .distinctUntilChanged()
.logDiffsForTable( .logDiffsForTable(
tableLogger, tableLogger,

View File

@@ -26,6 +26,7 @@ import com.android.systemui.demomode.DemoModeController
import com.android.systemui.dump.DumpManager import com.android.systemui.dump.DumpManager
import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.TableLogBuffer
import com.android.systemui.log.table.TableLogBufferFactory import com.android.systemui.log.table.TableLogBufferFactory
import com.android.systemui.statusbar.pipeline.airplane.data.repository.FakeAirplaneModeRepository
import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger
import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel import com.android.systemui.statusbar.pipeline.mobile.data.model.SubscriptionModel
import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.DemoMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.demo.DemoMobileConnectionsRepository
@@ -131,6 +132,7 @@ class MobileRepositorySwitcherTest : SysuiTestCase() {
context, context,
IMMEDIATE, IMMEDIATE,
scope, scope,
FakeAirplaneModeRepository(),
wifiRepository, wifiRepository,
mock(), mock(),
) )