summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2020-09-18 16:51:41 -0700
committerWinson Chung <winsonc@google.com>2020-09-21 18:23:41 +0000
commit8cbe2db5dd4a3889a2a6a739f34d011b80fbaca8 (patch)
tree63f82f14bc2f45bcd7cbc7d41d7260de9424f17a
parent0bf48315b627db802cb8f986b18b24c0baea31e4 (diff)
End current key button animations when the button is hidden
- If the ripple animation doesn't finish before the view is hidden and not scheduled to draw, the render node animation will not finish, leaving the ripple visible until it is next touched. Instead, we should just end existing animations whenever the buttons are made invisible Bug: 168422286 Test: Extend ripple duration beyond the dismiss nav bar window duration and verify bug happens without change and is fixed with the change Change-Id: If3a38bcd47cc7665ee42c66f688cf306c7fab44c Merged-In: If3a38bcd47cc7665ee42c66f688cf306c7fab44c (cherry picked from commit df7e471a6feeceb854e4f74448715688f99ce956)
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java10
2 files changed, 28 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
index 23d03a4b225a..e1ff9a236b02 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
@@ -172,6 +172,24 @@ public class KeyButtonDrawable extends Drawable {
}
@Override
+ public boolean setVisible(boolean visible, boolean restart) {
+ boolean changed = super.setVisible(visible, restart);
+ if (changed) {
+ // End any existing animations when the visibility changes
+ jumpToCurrentState();
+ }
+ return changed;
+ }
+
+ @Override
+ public void jumpToCurrentState() {
+ super.jumpToCurrentState();
+ if (mAnimatedDrawable != null) {
+ mAnimatedDrawable.jumpToCurrentState();
+ }
+ }
+
+ @Override
public void setAlpha(int alpha) {
mState.mAlpha = alpha;
mIconPaint.setAlpha(alpha);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java
index 2d8784dc41bd..9e1485dba8bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonRipple.java
@@ -225,6 +225,16 @@ public class KeyButtonRipple extends Drawable {
}
@Override
+ public boolean setVisible(boolean visible, boolean restart) {
+ boolean changed = super.setVisible(visible, restart);
+ if (changed) {
+ // End any existing animations when the visibility changes
+ jumpToCurrentState();
+ }
+ return changed;
+ }
+
+ @Override
public void jumpToCurrentState() {
endAnimations("jumpToCurrentState", false /* cancel */);
}