From 0be2cfec46cebe44b638c2a95f613de53bb4526a Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Wed, 25 May 2016 14:27:39 -0700 Subject: [PATCH] Fix exception when trying to update config of detached stack There is an NullPointerException which can be reproduced with following steps on angler: 1. In split-screen open activities from the same app. Make sure to launch them from launcher. 2. Rotate device to landscape. 3. Force-stop the app using adb command. After killing the app it will try to open launcher, which is fixed in portrait mode on that device. This will update the configuration for all the stacks, including already detached. Bug: 28786255 Change-Id: Ia326c09cff9f1a3fb43cca5b48db29718553346a --- services/core/java/com/android/server/wm/TaskStack.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index f51fd8aaf7eb5..aa499438ef7d0 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -380,6 +380,11 @@ public class TaskStack implements DimLayer.DimLayerUser, } private boolean updateBoundsAfterConfigChange() { + if (mDisplayContent == null) { + // If the stack is already detached we're not updating anything, + // as it's going away soon anyway. + return false; + } final int newRotation = getDisplayInfo().rotation; final int newDensity = getDisplayInfo().logicalDensityDpi;