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

Commit f54131ff authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Update visibility when attached

updateVisibility would normally be called during init, but a display or
font size change will have the same visibility before and after, so it
was being skipped. Instead let's just call it explicitly when the view
is attached

Fixes: 159646762
Test: atest KeyguardMediaControllerTest
Test: manual, change font size and observe no gap
Change-Id: Idad51d804c3e08ff673bea61924214a7ff6c0ccd
parent 402d7238
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ class KeyguardMediaController @Inject constructor(
        // Let's now initialize this view, which also creates the host view for us.
        mediaHost.init(MediaHierarchyManager.LOCATION_LOCKSCREEN)
        mediaView.setContentView(mediaHost.hostView)

        // Ensure the visibility is correct
        updateVisibility()
    }

    private fun updateVisibility() {
+4 −3
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito.`when`
import org.mockito.Mockito.atLeastOnce
import org.mockito.Mockito.verify
import org.mockito.junit.MockitoJUnit

@@ -70,7 +71,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
        `when`(mediaHost.visible).thenReturn(false)
        triggerVisibilityListener()

        verify(mediaHeaderView).visibility = eq(GONE)
        verify(mediaHeaderView, atLeastOnce()).visibility = eq(GONE)
    }
    @Test
    fun testAttach_visibleOnKeyguard() {
@@ -80,7 +81,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
                .thenReturn(true)
        triggerVisibilityListener()

        verify(mediaHeaderView).visibility = eq(VISIBLE)
        verify(mediaHeaderView, atLeastOnce()).visibility = eq(VISIBLE)
    }
    @Test
    fun testAttach_hiddenOnKeyguard_whenNotificationsAreHidden() {
@@ -90,7 +91,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
                .thenReturn(false)
        triggerVisibilityListener()

        verify(mediaHeaderView).visibility = eq(GONE)
        verify(mediaHeaderView, atLeastOnce()).visibility = eq(GONE)
    }

    private fun triggerVisibilityListener() {