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

Commit 51f9467e authored by Justin Weir's avatar Justin Weir
Browse files

Fix for some devices

changing to RTL is not sufficient to trigger a different contentArea
if the privacy chip and corner rounding are the same, which means the
flow will not emit a second value. To fix this, we'll also rotate the
display to guarantee a different content area.

Fixes: 437437516
Test: ran test on a device where it would fail
Flag: EXEMPT test-only change
Change-Id: I96a1330de00882092422b4f1c93d90ac17c26144
parent 371470ef
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.systemui.statusbar.layout.ui.viewmodel

import android.content.res.Configuration
import android.platform.test.annotations.EnableFlags
import android.view.Display
import android.view.Surface
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
@@ -30,10 +32,12 @@ import com.android.systemui.statusbar.layout.statusBarContentInsetsProvider
import com.android.systemui.statusbar.policy.configurationController
import com.android.systemui.statusbar.policy.fake
import com.android.systemui.testKosmos
import com.android.systemui.util.mockito.mock
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.whenever

@RunWith(AndroidJUnit4::class)
@SmallTest
@@ -57,6 +61,13 @@ class StatusBarContentInsetsViewModelTest : SysuiTestCase() {
            val values by collectValues(underTest.contentArea)

            // WHEN the content area changes

            // changing to RTL is not sufficient to trigger a different contentArea if the privacy
            // chip and corner rounding are the same, so we'll also rotate the display
            val mockDisplay = mock<Display>()
            context.display = mockDisplay
            whenever(mockDisplay.getRotation()).thenReturn(Surface.ROTATION_90)

            configurationController.fake.notifyLayoutDirectionChanged(isRtl = true)
            configurationController.fake.notifyDensityOrFontScaleChanged()