summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Pietal <mpietal@google.com> 2023-03-30 17:10:52 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-03-30 17:10:52 +0000
commit157ea6d3a44fe0462d4dcb5f07cb02fbb7d62395 (patch)
tree38438b4f2d704f1d7580551e12c3544c2e5955f1
parent83097c1fc1d04279c107e89c70f70a389efd9375 (diff)
parentd926222af28605526436ac3df4fc369da5b14c2c (diff)
Merge "Reset isFoldHandled" into tm-qpr-dev am: d926222af2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22314562 Change-Id: I85479dcadeb92ef13c7b4699177a4ee51f7052dc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt24
2 files changed, 29 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
index 101bd4483cb3..641cc45e01d8 100644
--- a/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/unfold/FoldAodAnimationController.kt
@@ -152,6 +152,7 @@ constructor(
} else if (isFolded && !isFoldHandled && alwaysOnEnabled && isDozing) {
// Screen turning on for the first time after folding and we are already dozing
// We should play the folding to AOD animation
+ isFoldHandled = true
setAnimationState(playing = true)
centralSurfaces.notificationPanelViewController.prepareFoldToAodAnimation()
@@ -186,7 +187,10 @@ constructor(
cancelAnimation?.run()
// Post starting the animation to the next frame to avoid junk due to inset changes
- cancelAnimation = mainExecutor.executeDelayed(startAnimationRunnable, /* delayMillis= */ 0)
+ cancelAnimation = mainExecutor.executeDelayed(
+ startAnimationRunnable,
+ /* delayMillis= */ 0
+ )
shouldPlayAnimation = false
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
index a87e61aae207..7f64867d3868 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/unfold/FoldAodAnimationControllerTest.kt
@@ -50,6 +50,8 @@ import org.junit.runner.RunWith
import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.Mock
+import org.mockito.Mockito.never
+import org.mockito.Mockito.reset
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.Mockito.`when` as whenever
@@ -174,6 +176,28 @@ class FoldAodAnimationControllerTest : SysuiTestCase() {
}
@Test
+ fun onFolded_onScreenTurningOnInvokedTwice_doesNotLogLatency() =
+ runBlocking(IMMEDIATE) {
+ val job = underTest.listenForDozing(this)
+ keyguardRepository.setDozing(true)
+ setAodEnabled(enabled = true)
+
+ yield()
+
+ fold()
+ simulateScreenTurningOn()
+ reset(latencyTracker)
+
+ // This can happen > 1 time if the prox sensor is covered
+ simulateScreenTurningOn()
+
+ verify(latencyTracker, never()).onActionStart(any())
+ verify(latencyTracker, never()).onActionEnd(any())
+
+ job.cancel()
+ }
+
+ @Test
fun onFolded_animationCancelled_doesNotLogLatency() =
runBlocking(IMMEDIATE) {
val job = underTest.listenForDozing(this)