summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author shawnlin <shawnlin@google.com> 2021-06-03 15:24:10 +0800
committer shawnlin <shawnlin@google.com> 2021-06-03 15:24:10 +0800
commitb672d860500120761bacb4fdde7aaa1d2fc93136 (patch)
treeaf10f4f4ea1ada00e4144fa5b6a269e396ca5ac4
parent21eeb8c97676cc31fd93e8f932ff4a0c9e17977e (diff)
Reset the flag of attaching nav to app to prevent flickering
The restoreNavigationBarFromApp() could now be called twice in live tile mode. Reset the mNavigationBarAttachedToApp once the nav bar is detached to prevent the nav fade-in animation playing twice. Bug: 189900722 Test: atest RecentsAnimationControllerTest Change-Id: Ifa02a7355d6503399de636646d73b9a4b6766a51
-rw-r--r--services/core/java/com/android/server/wm/RecentsAnimationController.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java8
2 files changed, 10 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java
index 2feb8a743930..e7ad18ff0b6b 100644
--- a/services/core/java/com/android/server/wm/RecentsAnimationController.java
+++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java
@@ -658,6 +658,8 @@ public class RecentsAnimationController implements DeathRecipient {
if (!mNavigationBarAttachedToApp) {
return;
}
+ mNavigationBarAttachedToApp = false;
+
if (mStatusBar != null) {
mStatusBar.setNavigationBarLumaSamplingEnabled(mDisplayId, true);
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
index 41506f6ad921..39a59c9e5064 100644
--- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java
@@ -519,12 +519,14 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
eq(mDefaultDisplay.mDisplayId), eq(false));
verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
+ assertTrue(mController.isNavigationBarAttachedToApp());
mController.cleanupAnimation(REORDER_MOVE_TO_TOP);
verify(mController).restoreNavigationBarFromApp(eq(true));
verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
eq(mDefaultDisplay.mDisplayId), eq(true));
verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
+ assertFalse(mController.isNavigationBarAttachedToApp());
}
@Test
@@ -541,6 +543,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
eq(mDefaultDisplay.mDisplayId), eq(false));
verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
+ assertTrue(mController.isNavigationBarAttachedToApp());
final WindowContainer parent = navToken.getParent();
@@ -550,6 +553,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
eq(mDefaultDisplay.mDisplayId), eq(true));
verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
verify(transaction).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl());
+ assertFalse(mController.isNavigationBarAttachedToApp());
}
@Test
@@ -566,6 +570,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
eq(mDefaultDisplay.mDisplayId), eq(false));
verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl());
verify(transaction).setLayer(navToken.getSurfaceControl(), Integer.MAX_VALUE);
+ assertTrue(mController.isNavigationBarAttachedToApp());
final WindowContainer parent = navToken.getParent();
@@ -575,6 +580,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled(
eq(mDefaultDisplay.mDisplayId), eq(true));
verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
+ assertFalse(mController.isNavigationBarAttachedToApp());
}
@Test
@@ -607,6 +613,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
eq(mDefaultDisplay.mDisplayId), eq(false));
verify(navWindow).setSurfaceTranslationY(-secondary.getBounds().top);
verify(transaction).reparent(navToken.getSurfaceControl(), secondary.getSurfaceControl());
+ assertTrue(mController.isNavigationBarAttachedToApp());
reset(navWindow);
mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
@@ -616,6 +623,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
verify(navWindow).setSurfaceTranslationY(0);
verify(transaction).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl());
verify(mController).restoreNavigationBarFromApp(eq(false));
+ assertFalse(mController.isNavigationBarAttachedToApp());
}
@Test