From dcb24ca47138219f41b730af8cdcd2db8f553562 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Mon, 23 Jul 2018 15:07:11 +0200 Subject: [PATCH] WM: Guard against released surfaces in forced rotator Change-Id: Ibce67ccede8f114b82779a74853e43b3abe44c55 Fixes: 111670701 Test: Rotate phone with cutout enabled, verify cutout overlay is still properly synchornized and SystemUI does not crash. --- .../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) {