Skip to content

Commit 51c2367

Browse files
ogunwaleThe Android Automerger
authored andcommitted
[DO NOT MERGE] Fixed NPE when trying to animate a window without display
In some cases it is possible for the AppToken.allAppWindows list to get out of sync with the list of windows known to WMS if the client doesn't call Session.remove(Window). This can lead to an NPE when the animation threads runs and the display for the window has been removed. Bug: 19972099 Change-Id: Ifdf9ff2364b96757bba0539394c4a682f64577c9
1 parent f2e5ef3 commit 51c2367

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

services/core/java/com/android/server/wm/WindowAnimator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,16 @@ int getPendingLayoutChanges(final int displayId) {
824824
if (displayId < 0) {
825825
return 0;
826826
}
827-
return mService.getDisplayContentLocked(displayId).pendingLayoutChanges;
827+
DisplayContent displayContent = mService.getDisplayContentLocked(displayId);
828+
return (displayContent != null) ? displayContent.pendingLayoutChanges : 0;
828829
}
829830

830831
void setPendingLayoutChanges(final int displayId, final int changes) {
831832
if (displayId >= 0) {
832-
mService.getDisplayContentLocked(displayId).pendingLayoutChanges |= changes;
833+
DisplayContent displayContent = mService.getDisplayContentLocked(displayId);
834+
if (displayContent != null) {
835+
displayContent.pendingLayoutChanges |= changes;
836+
}
833837
}
834838
}
835839

0 commit comments

Comments
 (0)