From b889819a32ed5e6a1a19f0ac0c8b603c59cea5a7 Mon Sep 17 00:00:00 2001 From: Candice Date: Tue, 11 Feb 2025 07:28:30 +0000 Subject: Check the fullscreen magnification state onTransactionCommitted NullPointerException could happen when (1) create fullscreen magnification border (2) remove fullscreen magnification (3) transaction for creating border is committed and try to run animation on the border view that has become null. Therefore, we should check the state before performing animation. Bug: 395005528 Test: atest FullscreenMagnificationControllerTest Flag: EXEMPT BUGFIX Change-Id: I7e7eff65db8cae583533a41b71965440d6f348f7 --- .../systemui/accessibility/FullscreenMagnificationController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/accessibility/FullscreenMagnificationController.java b/packages/SystemUI/src/com/android/systemui/accessibility/FullscreenMagnificationController.java index b2f3df60c82b..d7bb667b02a9 100644 --- a/packages/SystemUI/src/com/android/systemui/accessibility/FullscreenMagnificationController.java +++ b/packages/SystemUI/src/com/android/systemui/accessibility/FullscreenMagnificationController.java @@ -352,7 +352,13 @@ public class FullscreenMagnificationController implements ComponentCallbacks { mTransaction .addTransactionCommittedListener( mExecutor, - this::showBorder) + () -> { + if (getState() == ENABLING) { + // Ensure that we are in the ENABLING process to avoid performing + // animation on a null view. + mShowBorderRunnable.run(); + } + }) .setPosition(mBorderSurfaceControl, -mBorderOffset, -mBorderOffset) .setLayer(mBorderSurfaceControl, Integer.MAX_VALUE) .show(mBorderSurfaceControl) -- cgit v1.2.3-59-g8ed1b