Merge "Update visibility when attached" into rvc-dev am: 1262dc842f am: 20a8e80cca
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12010097 Change-Id: I2cc44b4d18c304883762656d7c2f53aff320dc60
This commit is contained in:
@@ -64,6 +64,9 @@ class KeyguardMediaController @Inject constructor(
|
|||||||
// Let's now initialize this view, which also creates the host view for us.
|
// Let's now initialize this view, which also creates the host view for us.
|
||||||
mediaHost.init(MediaHierarchyManager.LOCATION_LOCKSCREEN)
|
mediaHost.init(MediaHierarchyManager.LOCATION_LOCKSCREEN)
|
||||||
mediaView.setContentView(mediaHost.hostView)
|
mediaView.setContentView(mediaHost.hostView)
|
||||||
|
|
||||||
|
// Ensure the visibility is correct
|
||||||
|
updateVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateVisibility() {
|
private fun updateVisibility() {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import org.mockito.ArgumentCaptor
|
|||||||
import org.mockito.Captor
|
import org.mockito.Captor
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.mockito.Mockito.atLeastOnce
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.junit.MockitoJUnit
|
import org.mockito.junit.MockitoJUnit
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
|
|||||||
`when`(mediaHost.visible).thenReturn(false)
|
`when`(mediaHost.visible).thenReturn(false)
|
||||||
triggerVisibilityListener()
|
triggerVisibilityListener()
|
||||||
|
|
||||||
verify(mediaHeaderView).visibility = eq(GONE)
|
verify(mediaHeaderView, atLeastOnce()).visibility = eq(GONE)
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
fun testAttach_visibleOnKeyguard() {
|
fun testAttach_visibleOnKeyguard() {
|
||||||
@@ -80,7 +81,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
|
|||||||
.thenReturn(true)
|
.thenReturn(true)
|
||||||
triggerVisibilityListener()
|
triggerVisibilityListener()
|
||||||
|
|
||||||
verify(mediaHeaderView).visibility = eq(VISIBLE)
|
verify(mediaHeaderView, atLeastOnce()).visibility = eq(VISIBLE)
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
fun testAttach_hiddenOnKeyguard_whenNotificationsAreHidden() {
|
fun testAttach_hiddenOnKeyguard_whenNotificationsAreHidden() {
|
||||||
@@ -90,7 +91,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
|
|||||||
.thenReturn(false)
|
.thenReturn(false)
|
||||||
triggerVisibilityListener()
|
triggerVisibilityListener()
|
||||||
|
|
||||||
verify(mediaHeaderView).visibility = eq(GONE)
|
verify(mediaHeaderView, atLeastOnce()).visibility = eq(GONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun triggerVisibilityListener() {
|
private fun triggerVisibilityListener() {
|
||||||
|
|||||||
Reference in New Issue
Block a user