Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,10 @@ object Flags { // TODO(b/301610137): Tracking bug @JvmField val NEW_NETWORK_SLICE_UI = releasedFlag("new_network_slice_ui") // TODO(b/311222557): Tracking bug val ROAMING_INDICATOR_VIA_DISPLAY_INFO = releasedFlag("roaming_indicator_via_display_info") // TODO(b/308138154): Tracking bug val FILTER_PROVISIONING_NETWORK_SUBSCRIPTIONS = releasedFlag("filter_provisioning_network_subscriptions") Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/MobileInputLogger.kt +2 −1 Original line number Diff line number Diff line Loading @@ -109,8 +109,9 @@ constructor( { int1 = subId str1 = displayInfo.toString() bool1 = displayInfo.isRoaming }, { "onDisplayInfoChanged: subId=$int1 displayInfo=$str1" }, { "onDisplayInfoChanged: subId=$int1 displayInfo=$str1 isRoaming=$bool1" }, ) } Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt +14 −3 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState.Disconnected Loading Loading @@ -105,6 +107,7 @@ class MobileConnectionRepositoryImpl( private val bgDispatcher: CoroutineDispatcher, logger: MobileInputLogger, override val tableLogBuffer: TableLogBuffer, flags: FeatureFlagsClassic, scope: CoroutineScope, ) : MobileConnectionRepository { init { Loading Loading @@ -201,9 +204,15 @@ class MobileConnectionRepositoryImpl( .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val isRoaming = if (flags.isEnabled(ROAMING_INDICATOR_VIA_DISPLAY_INFO)) { callbackEvents .mapNotNull { it.onDisplayInfoChanged } .map { it.telephonyDisplayInfo.isRoaming } } else { callbackEvents .mapNotNull { it.onServiceStateChanged } .map { it.serviceState.roaming } } .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val operatorAlphaShort = Loading Loading @@ -432,6 +441,7 @@ class MobileConnectionRepositoryImpl( private val logger: MobileInputLogger, private val carrierConfigRepository: CarrierConfigRepository, private val mobileMappingsProxy: MobileMappingsProxy, private val flags: FeatureFlagsClassic, @Background private val bgDispatcher: CoroutineDispatcher, @Application private val scope: CoroutineScope, ) { Loading @@ -456,6 +466,7 @@ class MobileConnectionRepositoryImpl( bgDispatcher, logger, mobileLogger, flags, scope, ) } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.telephony.TelephonyManager import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.FakeFeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.TableLogBufferFactory import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel Loading Loading @@ -68,6 +70,9 @@ import org.mockito.Mockito.verify class FullMobileConnectionRepositoryTest : SysuiTestCase() { private lateinit var underTest: FullMobileConnectionRepository private val flags = FakeFeatureFlagsClassic().also { it.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) } private val systemClock = FakeSystemClock() private val testDispatcher = UnconfinedTestDispatcher() private val testScope = TestScope(testDispatcher) Loading Loading @@ -690,6 +695,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { testDispatcher, logger = mock(), tableLogBuffer, flags, testScope.backgroundScope, ) whenever( Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt +81 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ import android.telephony.SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX import android.telephony.SubscriptionManager.PROFILE_CLASS_UNSET import android.telephony.TelephonyCallback import android.telephony.TelephonyCallback.DataActivityListener import android.telephony.TelephonyCallback.DisplayInfoListener import android.telephony.TelephonyCallback.ServiceStateListener import android.telephony.TelephonyDisplayInfo import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE import android.telephony.TelephonyManager Loading Loading @@ -65,6 +67,8 @@ import androidx.test.filters.SmallTest import com.android.settingslib.mobile.MobileMappings import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.FakeFeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState Loading Loading @@ -111,6 +115,9 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { private lateinit var underTest: MobileConnectionRepositoryImpl private lateinit var connectionsRepo: FakeMobileConnectionsRepository private val flags = FakeFeatureFlagsClassic().also { it.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) } @Mock private lateinit var connectivityManager: ConnectivityManager @Mock private lateinit var telephonyManager: TelephonyManager @Mock private lateinit var logger: MobileInputLogger Loading Loading @@ -158,6 +165,7 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) } Loading Loading @@ -610,8 +618,80 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { } @Test fun roaming_gsm_queriesServiceState() = fun roaming_gsm_queriesDisplayInfo_viaDisplayInfo() = testScope.runTest { // GIVEN flag is true flags.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) // Re-create the repository, because the flag is read at init underTest = MobileConnectionRepositoryImpl( SUB_1_ID, context, subscriptionModel, DEFAULT_NAME_MODEL, SEP, connectivityManager, telephonyManager, systemUiCarrierConfig, fakeBroadcastDispatcher, mobileMappings, testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) var latest: Boolean? = null val job = underTest.isRoaming.onEach { latest = it }.launchIn(this) val cb = getTelephonyCallbackForType<DisplayInfoListener>() // CDMA roaming is off, GSM roaming is off whenever(telephonyManager.cdmaEnhancedRoamingIndicatorDisplayNumber).thenReturn(ERI_OFF) cb.onDisplayInfoChanged( TelephonyDisplayInfo(NETWORK_TYPE_LTE, NETWORK_TYPE_UNKNOWN, false) ) assertThat(latest).isFalse() // CDMA roaming is off, GSM roaming is on cb.onDisplayInfoChanged( TelephonyDisplayInfo(NETWORK_TYPE_LTE, NETWORK_TYPE_UNKNOWN, true) ) assertThat(latest).isTrue() job.cancel() } @Test fun roaming_gsm_queriesDisplayInfo_viaServiceState() = testScope.runTest { // GIVEN flag is false flags.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, false) // Re-create the repository, because the flag is read at init underTest = MobileConnectionRepositoryImpl( SUB_1_ID, context, subscriptionModel, DEFAULT_NAME_MODEL, SEP, connectivityManager, telephonyManager, systemUiCarrierConfig, fakeBroadcastDispatcher, mobileMappings, testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) var latest: Boolean? = null val job = underTest.isRoaming.onEach { latest = it }.launchIn(this) Loading Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,10 @@ object Flags { // TODO(b/301610137): Tracking bug @JvmField val NEW_NETWORK_SLICE_UI = releasedFlag("new_network_slice_ui") // TODO(b/311222557): Tracking bug val ROAMING_INDICATOR_VIA_DISPLAY_INFO = releasedFlag("roaming_indicator_via_display_info") // TODO(b/308138154): Tracking bug val FILTER_PROVISIONING_NETWORK_SUBSCRIPTIONS = releasedFlag("filter_provisioning_network_subscriptions") Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/MobileInputLogger.kt +2 −1 Original line number Diff line number Diff line Loading @@ -109,8 +109,9 @@ constructor( { int1 = subId str1 = displayInfo.toString() bool1 = displayInfo.isRoaming }, { "onDisplayInfoChanged: subId=$int1 displayInfo=$str1" }, { "onDisplayInfoChanged: subId=$int1 displayInfo=$str1 isRoaming=$bool1" }, ) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryImpl.kt +14 −3 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.flags.FeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState.Disconnected Loading Loading @@ -105,6 +107,7 @@ class MobileConnectionRepositoryImpl( private val bgDispatcher: CoroutineDispatcher, logger: MobileInputLogger, override val tableLogBuffer: TableLogBuffer, flags: FeatureFlagsClassic, scope: CoroutineScope, ) : MobileConnectionRepository { init { Loading Loading @@ -201,9 +204,15 @@ class MobileConnectionRepositoryImpl( .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val isRoaming = if (flags.isEnabled(ROAMING_INDICATOR_VIA_DISPLAY_INFO)) { callbackEvents .mapNotNull { it.onDisplayInfoChanged } .map { it.telephonyDisplayInfo.isRoaming } } else { callbackEvents .mapNotNull { it.onServiceStateChanged } .map { it.serviceState.roaming } } .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val operatorAlphaShort = Loading Loading @@ -432,6 +441,7 @@ class MobileConnectionRepositoryImpl( private val logger: MobileInputLogger, private val carrierConfigRepository: CarrierConfigRepository, private val mobileMappingsProxy: MobileMappingsProxy, private val flags: FeatureFlagsClassic, @Background private val bgDispatcher: CoroutineDispatcher, @Application private val scope: CoroutineScope, ) { Loading @@ -456,6 +466,7 @@ class MobileConnectionRepositoryImpl( bgDispatcher, logger, mobileLogger, flags, scope, ) } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/FullMobileConnectionRepositoryTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.telephony.TelephonyManager import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.FakeFeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.log.table.TableLogBufferFactory import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel Loading Loading @@ -68,6 +70,9 @@ import org.mockito.Mockito.verify class FullMobileConnectionRepositoryTest : SysuiTestCase() { private lateinit var underTest: FullMobileConnectionRepository private val flags = FakeFeatureFlagsClassic().also { it.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) } private val systemClock = FakeSystemClock() private val testDispatcher = UnconfinedTestDispatcher() private val testScope = TestScope(testDispatcher) Loading Loading @@ -690,6 +695,7 @@ class FullMobileConnectionRepositoryTest : SysuiTestCase() { testDispatcher, logger = mock(), tableLogBuffer, flags, testScope.backgroundScope, ) whenever( Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/pipeline/mobile/data/repository/prod/MobileConnectionRepositoryTest.kt +81 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,9 @@ import android.telephony.SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX import android.telephony.SubscriptionManager.PROFILE_CLASS_UNSET import android.telephony.TelephonyCallback import android.telephony.TelephonyCallback.DataActivityListener import android.telephony.TelephonyCallback.DisplayInfoListener import android.telephony.TelephonyCallback.ServiceStateListener import android.telephony.TelephonyDisplayInfo import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA import android.telephony.TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE import android.telephony.TelephonyManager Loading Loading @@ -65,6 +67,8 @@ import androidx.test.filters.SmallTest import com.android.settingslib.mobile.MobileMappings import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.FakeFeatureFlagsClassic import com.android.systemui.flags.Flags.ROAMING_INDICATOR_VIA_DISPLAY_INFO import com.android.systemui.log.table.TableLogBuffer import com.android.systemui.statusbar.pipeline.mobile.data.MobileInputLogger import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState Loading Loading @@ -111,6 +115,9 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { private lateinit var underTest: MobileConnectionRepositoryImpl private lateinit var connectionsRepo: FakeMobileConnectionsRepository private val flags = FakeFeatureFlagsClassic().also { it.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) } @Mock private lateinit var connectivityManager: ConnectivityManager @Mock private lateinit var telephonyManager: TelephonyManager @Mock private lateinit var logger: MobileInputLogger Loading Loading @@ -158,6 +165,7 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) } Loading Loading @@ -610,8 +618,80 @@ class MobileConnectionRepositoryTest : SysuiTestCase() { } @Test fun roaming_gsm_queriesServiceState() = fun roaming_gsm_queriesDisplayInfo_viaDisplayInfo() = testScope.runTest { // GIVEN flag is true flags.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, true) // Re-create the repository, because the flag is read at init underTest = MobileConnectionRepositoryImpl( SUB_1_ID, context, subscriptionModel, DEFAULT_NAME_MODEL, SEP, connectivityManager, telephonyManager, systemUiCarrierConfig, fakeBroadcastDispatcher, mobileMappings, testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) var latest: Boolean? = null val job = underTest.isRoaming.onEach { latest = it }.launchIn(this) val cb = getTelephonyCallbackForType<DisplayInfoListener>() // CDMA roaming is off, GSM roaming is off whenever(telephonyManager.cdmaEnhancedRoamingIndicatorDisplayNumber).thenReturn(ERI_OFF) cb.onDisplayInfoChanged( TelephonyDisplayInfo(NETWORK_TYPE_LTE, NETWORK_TYPE_UNKNOWN, false) ) assertThat(latest).isFalse() // CDMA roaming is off, GSM roaming is on cb.onDisplayInfoChanged( TelephonyDisplayInfo(NETWORK_TYPE_LTE, NETWORK_TYPE_UNKNOWN, true) ) assertThat(latest).isTrue() job.cancel() } @Test fun roaming_gsm_queriesDisplayInfo_viaServiceState() = testScope.runTest { // GIVEN flag is false flags.set(ROAMING_INDICATOR_VIA_DISPLAY_INFO, false) // Re-create the repository, because the flag is read at init underTest = MobileConnectionRepositoryImpl( SUB_1_ID, context, subscriptionModel, DEFAULT_NAME_MODEL, SEP, connectivityManager, telephonyManager, systemUiCarrierConfig, fakeBroadcastDispatcher, mobileMappings, testDispatcher, logger, tableLogger, flags, testScope.backgroundScope, ) var latest: Boolean? = null val job = underTest.isRoaming.onEach { latest = it }.launchIn(this) Loading