Prevents NPE after stack got removed from display

Application crashed and the top activity was immediately
finished after paused timeout. If there was no activities
left in stack, it would be removed from display and updated
the display id to invalid. Therefore, the system crashed
in accessing a null ActivityDisplay object.

Bug: 120667451
Test: existing test pass

Change-Id: Ica978faf4233d8e6a709fa92f87d850f6ab8e061
This commit is contained in:
Louis Chang
2018-12-11 10:49:48 +08:00
parent c9c6a91e46
commit 24f7a03daf

View File

@@ -1797,7 +1797,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
// focus). Also if there is an active pinned stack - we always want to notify it about
// task stack changes, because its positioning may depend on it.
if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause
|| getDisplay().hasPinnedStack()) {
|| (getDisplay() != null && getDisplay().hasPinnedStack())) {
mService.getTaskChangeNotificationController().notifyTaskStackChanged();
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false;
}