Merge "[SB Refactor] Don't show RAT icon if the resource ID is invalid." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e05e51d380
@@ -170,7 +170,10 @@ constructor(
|
||||
if (networkTypeIconGroup.dataContentDescription != 0)
|
||||
ContentDescription.Resource(networkTypeIconGroup.dataContentDescription)
|
||||
else null
|
||||
val icon = Icon.Resource(networkTypeIconGroup.dataType, desc)
|
||||
val icon =
|
||||
if (networkTypeIconGroup.dataType != 0)
|
||||
Icon.Resource(networkTypeIconGroup.dataType, desc)
|
||||
else null
|
||||
return@combine when {
|
||||
!shouldShow -> null
|
||||
else -> icon
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.test.filters.SmallTest
|
||||
import com.android.settingslib.AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH
|
||||
import com.android.settingslib.AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH_NONE
|
||||
import com.android.settingslib.mobile.TelephonyIcons.THREE_G
|
||||
import com.android.settingslib.mobile.TelephonyIcons.UNKNOWN
|
||||
import com.android.systemui.SysuiTestCase
|
||||
import com.android.systemui.common.shared.model.ContentDescription
|
||||
import com.android.systemui.common.shared.model.Icon
|
||||
@@ -343,7 +344,7 @@ class MobileIconViewModelTest : SysuiTestCase() {
|
||||
fun networkType_alwaysShow_shownEvenWhenDisabled() =
|
||||
testScope.runTest {
|
||||
interactor.setIconGroup(THREE_G)
|
||||
interactor.setIsDataEnabled(true)
|
||||
interactor.setIsDataEnabled(false)
|
||||
interactor.alwaysShowDataRatIcon.value = true
|
||||
|
||||
var latest: Icon? = null
|
||||
@@ -399,6 +400,21 @@ class MobileIconViewModelTest : SysuiTestCase() {
|
||||
job.cancel()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun networkType_alwaysShow_notShownWhenInvalidDataTypeIcon() =
|
||||
testScope.runTest {
|
||||
// The UNKNOWN icon group doesn't have a valid data type icon ID
|
||||
interactor.setIconGroup(UNKNOWN)
|
||||
interactor.alwaysShowDataRatIcon.value = true
|
||||
|
||||
var latest: Icon? = null
|
||||
val job = underTest.networkTypeIcon.onEach { latest = it }.launchIn(this)
|
||||
|
||||
assertThat(latest).isNull()
|
||||
|
||||
job.cancel()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `network type - alwaysShow - shown when not default`() =
|
||||
testScope.runTest {
|
||||
|
||||
Reference in New Issue
Block a user