Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39d9541a authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Internet tile data interactor to include icon id

When on Active Wifi, the icon id was not sent from data interactor to
mapper. Doing so helps the viewmodel adapter cache icons down the line.
Without this CL, the adapter thought of each active wifi icon as the
same icon.

Bug: 356254554
Flag: com.android.systemui.qs_new_tiles
Test: atest InternetTileDataInteractorTest
Change-Id: Id92c2c00e34ea22f46165d4931a3f83db687ade3
parent 254b854c
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -204,7 +204,7 @@ class InternetTileDataInteractorTest : SysuiTestCase() {


            val actualIcon = latest?.icon
            val actualIcon = latest?.icon
            assertThat(actualIcon).isEqualTo(expectedIcon)
            assertThat(actualIcon).isEqualTo(expectedIcon)
            assertThat(latest?.iconId).isNull()
            assertThat(latest?.iconId).isEqualTo(WifiIcons.WIFI_NO_INTERNET_ICONS[4])
            assertThat(latest?.contentDescription.loadContentDescription(context))
            assertThat(latest?.contentDescription.loadContentDescription(context))
                .isEqualTo("$internet,test ssid")
                .isEqualTo("$internet,test ssid")
            val expectedSd = wifiIcon.contentDescription
            val expectedSd = wifiIcon.contentDescription
@@ -443,15 +443,15 @@ class InternetTileDataInteractorTest : SysuiTestCase() {
     * on the mentioned context. Since that context does not have a looper assigned to it, the
     * on the mentioned context. Since that context does not have a looper assigned to it, the
     * handler instantiation will throw a RuntimeException.
     * handler instantiation will throw a RuntimeException.
     *
     *
     * TODO(b/338068066): Robolectric behavior differs in that it does not throw the exception
     * TODO(b/338068066): Robolectric behavior differs in that it does not throw the exception So
     * So either we should make Robolectric behvase similar to the device test, or change this
     *   either we should make Robolectric behave similar to the device test, or change this test to
     * test to look for a different signal than the exception, when run by Robolectric. For now
     *   look for a different signal than the exception, when run by Robolectric. For now we just
     * we just assume the test is not Robolectric.
     *   assume the test is not Robolectric.
     */
     */
    @Test(expected = java.lang.RuntimeException::class)
    @Test(expected = java.lang.RuntimeException::class)
    fun mobileDefault_usesNetworkNameAndIcon_throwsRunTimeException() =
    fun mobileDefault_usesNetworkNameAndIcon_throwsRunTimeException() =
        testScope.runTest {
        testScope.runTest {
            assumeFalse(isRobolectricTest());
            assumeFalse(isRobolectricTest())


            collectLastValue(underTest.tileData(testUser, flowOf(DataUpdateTrigger.InitialRequest)))
            collectLastValue(underTest.tileData(testUser, flowOf(DataUpdateTrigger.InitialRequest)))


+1 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,7 @@ constructor(
                flowOf(
                flowOf(
                    InternetTileModel.Active(
                    InternetTileModel.Active(
                        secondaryTitle = secondary,
                        secondaryTitle = secondary,
                        iconId = wifiIcon.icon.res,
                        icon = Icon.Loaded(context.getDrawable(wifiIcon.icon.res)!!, null),
                        icon = Icon.Loaded(context.getDrawable(wifiIcon.icon.res)!!, null),
                        stateDescription = wifiIcon.contentDescription,
                        stateDescription = wifiIcon.contentDescription,
                        contentDescription = ContentDescription.Loaded("$internetLabel,$secondary"),
                        contentDescription = ContentDescription.Loaded("$internetLabel,$secondary"),