summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Candice Lo <chihtinglo@google.com> 2023-12-21 16:11:20 +0800
committer Candice Lo <chihtinglo@google.com> 2023-12-21 16:47:21 +0800
commit6e7d84b77a85bb0e81779c42785acbf98c82491b (patch)
treecae909964ead7084fcde38030621fe00430498d2
parent6e72846153658a1f2554cd459841c406547ff370 (diff)
fix(window magnification): Do null check before animation
We would like to make sure the view is not null before applying animation to it. Bug: 317172128 Flag: NA Test: atest WindowMagnificationControllerTest Change-Id: I84050c2108c4852b6c2832222c28f492e6d8fbdb
-rw-r--r--packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
index 0bd4859eefd5..dde9f48424ea 100644
--- a/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
+++ b/packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java
@@ -1303,7 +1303,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
} else if (id == R.id.close_button) {
setEditMagnifierSizeMode(false);
} else {
- animateBounceEffect();
+ animateBounceEffectIfNeeded();
}
}
@@ -1465,7 +1465,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
mBounceEffectDuration = duration;
}
- private void animateBounceEffect() {
+ private void animateBounceEffectIfNeeded() {
+ if (mMirrorView == null) {
+ // run the animation only if the mirror view is not null
+ return;
+ }
+
final ObjectAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(mMirrorView,
PropertyValuesHolder.ofFloat(View.SCALE_X, 1, mBounceEffectAnimationScale, 1),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, mBounceEffectAnimationScale, 1));