From 4a17e47530fb4dfeee7433bd52f166bf8095a3c3 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Tue, 20 Nov 2018 08:01:57 -0800 Subject: [PATCH] WM: Guard against released surfaces in forced rotator Fixes: 119470176 Test: Rotate phone with cutout enabled, verify cutout overlay is still properly synchornized and SystemUI does not crash. (cherry picked from commit dcb24ca47138219f41b730af8cdcd2db8f553562) Merged-In: Ibce67ccede8f114b82779a74853e43b3abe44c55 Change-Id: Ibce67ccede8f114b82779a74853e43b3abe44c55 --- .../android/server/wm/ForcedSeamlessRotator.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java b/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java index f25ec5cd935e4..bebc5656c2843 100644 --- a/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java +++ b/services/core/java/com/android/server/wm/ForcedSeamlessRotator.java @@ -75,12 +75,14 @@ public class ForcedSeamlessRotator { public void finish(WindowToken token, WindowState win) { mTransform.reset(); token.getPendingTransaction().setMatrix(token.mSurfaceControl, mTransform, mFloat9); - token.getPendingTransaction().deferTransactionUntil(token.mSurfaceControl, - win.mWinAnimator.mSurfaceController.mSurfaceControl.getHandle(), - win.getFrameNumber()); - win.getPendingTransaction().deferTransactionUntil(win.mSurfaceControl, - win.mWinAnimator.mSurfaceController.mSurfaceControl.getHandle(), - win.getFrameNumber()); + if (win.mWinAnimator.mSurfaceController != null) { + token.getPendingTransaction().deferTransactionUntil(token.mSurfaceControl, + win.mWinAnimator.mSurfaceController.mSurfaceControl.getHandle(), + win.getFrameNumber()); + win.getPendingTransaction().deferTransactionUntil(win.mSurfaceControl, + win.mWinAnimator.mSurfaceController.mSurfaceControl.getHandle(), + win.getFrameNumber()); + } } public void dump(PrintWriter pw) {