Merge "Check for block location change when configuration changes" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4f4d7d3a08
@@ -639,7 +639,9 @@ constructor(
|
|||||||
) =
|
) =
|
||||||
traceSection("MediaHierarchyManager#updateDesiredLocation") {
|
traceSection("MediaHierarchyManager#updateDesiredLocation") {
|
||||||
val desiredLocation = calculateLocation()
|
val desiredLocation = calculateLocation()
|
||||||
if (desiredLocation != this.desiredLocation || forceStateUpdate) {
|
if (
|
||||||
|
desiredLocation != this.desiredLocation || forceStateUpdate && !blockLocationChanges
|
||||||
|
) {
|
||||||
if (this.desiredLocation >= 0 && desiredLocation != this.desiredLocation) {
|
if (this.desiredLocation >= 0 && desiredLocation != this.desiredLocation) {
|
||||||
// Only update previous location when it actually changes
|
// Only update previous location when it actually changes
|
||||||
previousLocation = this.desiredLocation
|
previousLocation = this.desiredLocation
|
||||||
|
|||||||
@@ -179,6 +179,57 @@ class MediaHierarchyManagerTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testBlockedWhenConfigurationChangesAndScreenOff() {
|
||||||
|
// Let's set it onto QS:
|
||||||
|
mediaHierarchyManager.qsExpansion = 1.0f
|
||||||
|
verify(mediaCarouselController)
|
||||||
|
.onDesiredLocationChanged(
|
||||||
|
ArgumentMatchers.anyInt(),
|
||||||
|
any(MediaHostState::class.java),
|
||||||
|
anyBoolean(),
|
||||||
|
anyLong(),
|
||||||
|
anyLong()
|
||||||
|
)
|
||||||
|
val observer = wakefullnessObserver.value
|
||||||
|
assertNotNull("lifecycle observer wasn't registered", observer)
|
||||||
|
observer.onStartedGoingToSleep()
|
||||||
|
clearInvocations(mediaCarouselController)
|
||||||
|
configurationController.notifyConfigurationChanged()
|
||||||
|
verify(mediaCarouselController, times(0))
|
||||||
|
.onDesiredLocationChanged(
|
||||||
|
ArgumentMatchers.anyInt(),
|
||||||
|
any(MediaHostState::class.java),
|
||||||
|
anyBoolean(),
|
||||||
|
anyLong(),
|
||||||
|
anyLong()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testAllowedWhenConfigurationChanges() {
|
||||||
|
// Let's set it onto QS:
|
||||||
|
mediaHierarchyManager.qsExpansion = 1.0f
|
||||||
|
verify(mediaCarouselController)
|
||||||
|
.onDesiredLocationChanged(
|
||||||
|
ArgumentMatchers.anyInt(),
|
||||||
|
any(MediaHostState::class.java),
|
||||||
|
anyBoolean(),
|
||||||
|
anyLong(),
|
||||||
|
anyLong()
|
||||||
|
)
|
||||||
|
clearInvocations(mediaCarouselController)
|
||||||
|
configurationController.notifyConfigurationChanged()
|
||||||
|
verify(mediaCarouselController)
|
||||||
|
.onDesiredLocationChanged(
|
||||||
|
ArgumentMatchers.anyInt(),
|
||||||
|
any(MediaHostState::class.java),
|
||||||
|
anyBoolean(),
|
||||||
|
anyLong(),
|
||||||
|
anyLong()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAllowedWhenNotTurningOff() {
|
fun testAllowedWhenNotTurningOff() {
|
||||||
// Let's set it onto QS:
|
// Let's set it onto QS:
|
||||||
|
|||||||
Reference in New Issue
Block a user