diff options
author | Craig Mautner <cmautner@google.com> | 2014-03-27 20:38:29 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-27 20:38:29 +0000 |
commit | acb9ed8049c37018b4b7d9c534d07fb4cf3cd0bd (patch) | |
tree | c8ed70309d993a3724e65da1b5f936cb4435565f | |
parent | 513cee9aebb4e1dc075421d01a3a7530c0eb2d42 (diff) | |
parent | a79501cd3843149f0759bd53d310cf97d4ee1c8d (diff) | |
download | frameworks_base-acb9ed8049c37018b4b7d9c534d07fb4cf3cd0bd.zip frameworks_base-acb9ed8049c37018b4b7d9c534d07fb4cf3cd0bd.tar.gz frameworks_base-acb9ed8049c37018b4b7d9c534d07fb4cf3cd0bd.tar.bz2 |
am a79501cd: am af89d7e2: am bffd4d43: Merge "Check return values for null." into klp-modular-dev
* commit 'a79501cd3843149f0759bd53d310cf97d4ee1c8d':
Check return values for null.
-rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 14 | ||||
-rw-r--r-- | services/core/java/com/android/server/wm/WindowStateAnimator.java | 12 |
2 files changed, 22 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 0558b5a..dcf5880 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -920,6 +920,10 @@ public class WindowManagerService extends IWindowManager.Stub final IWindow client = win.mClient; final WindowToken token = win.mToken; final DisplayContent displayContent = win.getDisplayContent(); + if (displayContent == null) { + // It doesn't matter this display is going away. + return 0; + } final WindowList windows = win.getWindowList(); final int N = windows.size(); @@ -1097,6 +1101,9 @@ public class WindowManagerService extends IWindowManager.Stub private void addAttachedWindowToListLocked(final WindowState win, boolean addToToken) { final WindowToken token = win.mToken; final DisplayContent displayContent = win.getDisplayContent(); + if (displayContent == null) { + return; + } final WindowState attached = win.mAttachedWindow; WindowList tokenWindowList = getTokenWindowsOnDisplay(token, displayContent); @@ -2254,6 +2261,11 @@ public class WindowManagerService extends IWindowManager.Stub return WindowManagerGlobal.ADD_APP_EXITING; } + if (win.getDisplayContent() == null) { + Slog.w(TAG, "Adding window to Display that has been removed."); + return WindowManagerGlobal.ADD_INVALID_DISPLAY; + } + mPolicy.adjustWindowParamsLw(win.mAttrs); win.setShowToOwnerOnlyLocked(mPolicy.checkShowToOwnerOnly(attrs)); @@ -2743,7 +2755,7 @@ public class WindowManagerService extends IWindowManager.Stub return; } - final DisplayInfo displayInfo = window.getDisplayContent().getDisplayInfo(); + final DisplayInfo displayInfo = displayContent.getDisplayInfo(); final RectF dispRect = new RectF(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); matrix.mapRect(dispRect); diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 6b3c368..3c9d53e 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -176,9 +176,15 @@ class WindowStateAnimator { mAnimator = service.mAnimator; mPolicy = service.mPolicy; mContext = service.mContext; - final DisplayInfo displayInfo = win.getDisplayContent().getDisplayInfo(); - mAnimDw = displayInfo.appWidth; - mAnimDh = displayInfo.appHeight; + final DisplayContent displayContent = win.getDisplayContent(); + if (displayContent != null) { + final DisplayInfo displayInfo = displayContent.getDisplayInfo(); + mAnimDw = displayInfo.appWidth; + mAnimDh = displayInfo.appHeight; + } else { + Slog.w(TAG, "WindowStateAnimator ctor: Display has been removed"); + // This is checked on return and dealt with. + } mWin = win; mAttachedWinAnimator = win.mAttachedWindow == null |