From 4c85530de0c72fdddce8d709e7ab761703cc01c5 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Tue, 10 Jan 2023 17:42:23 -0500 Subject: [PATCH] [Sb refactor] [demo] Use better default for demo mode DemoModeConnectionsRepository was using (isConnected = false, isValidated = false) for its default mobile connectivity model, and doesn't yet support updating those values via the command line. This CL just changes the default to be (true, true) so that the icons properly show up. Test: manual demo mode Bug: 238425913 Change-Id: I1c9ade7ed0bd3c278ed38a3b306627a2879fb83e --- .../repository/demo/DemoMobileConnectionsRepository.kt | 3 ++- .../demo/DemoMobileConnectionsRepositoryTest.kt | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt index 1fcc727e8ad83..108834521ebf0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepository.kt @@ -156,7 +156,8 @@ constructor( override val defaultDataSubId = MutableStateFlow(INVALID_SUBSCRIPTION_ID) // TODO(b/261029387): not yet supported - override val defaultMobileNetworkConnectivity = MutableStateFlow(MobileConnectivityModel()) + override val defaultMobileNetworkConnectivity = + MutableStateFlow(MobileConnectivityModel(isConnected = true, isValidated = true)) override fun getRepoForSubId(subId: Int): DemoMobileConnectionRepository { val current = connectionRepoCache[subId]?.repo diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt index 9d16b7fe52460..f12d113cfaa8f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/demo/DemoMobileConnectionsRepositoryTest.kt @@ -89,6 +89,14 @@ class DemoMobileConnectionsRepositoryTest : SysuiTestCase() { underTest.startProcessingCommands() } + @Test + fun `connectivity - defaults to connected and validated`() = + testScope.runTest { + val connectivity = underTest.defaultMobileNetworkConnectivity.value + assertThat(connectivity.isConnected).isTrue() + assertThat(connectivity.isValidated).isTrue() + } + @Test fun `network event - create new subscription`() = testScope.runTest {