summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chong Zhang <chz@google.com> 2016-05-21 09:23:55 -0700
committer Chong Zhang <chz@google.com> 2016-05-23 11:46:04 -0700
commite292eb3d4d0a2809b760eb849dc77c0f47e9494c (patch)
tree60e6d703933ce7f17128bbcdbd1df85c5dae7eb8
parent0a9ccf26192bc5a6fd74afb7afd4834b08230299 (diff)
Don't include removed window when counting interesting windows
Also do not give input focus to window that's already marked for removal. The input channel is already disposed and input manager will treat these as null focus. bug: 28797800 Change-Id: I3cb2d514a7286847f1ad6af3f629d04c303d3cbd
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java8
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java6
2 files changed, 10 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 82cd0fa0c25d..aaed8ca9181d 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2359,7 +2359,13 @@ public class WindowManagerService extends IWindowManager.Stub
// immediately after the enter animation is done. If the app is not yet drawn then
// it will show up as a flicker.
win.mRemoveOnExit = true;
- win.mWindowRemovalAllowed = true;
+ // Request a focus update as this window's input channel is already gone. Otherwise
+ // we could have no focused window in input manager.
+ final boolean focusChanged = updateFocusedWindowLocked(
+ UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/);
+ if (focusChanged) {
+ mInputMonitor.updateInputWindowsLw(false /*force*/);
+ }
Binder.restoreCallingIdentity(origId);
return;
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index e5e74a663eb0..c15afb339646 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1265,8 +1265,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
* @return true if the window should be considered while evaluating allDrawn flags.
*/
boolean mightAffectAllDrawn(boolean visibleOnly) {
- final boolean isViewVisible = (mViewVisibility == View.VISIBLE)
- && (mAppToken == null || !mAppToken.clientHidden);
+ final boolean isViewVisible = (mAppToken == null || !mAppToken.clientHidden)
+ && (mViewVisibility == View.VISIBLE) && !mWindowRemovalAllowed;
return (isOnScreenIgnoringKeyguard() && (!visibleOnly || isViewVisible)
|| mWinAnimator.mAttrType == TYPE_BASE_APPLICATION)
&& !mAnimatingExit && !mDestroying;
@@ -1822,7 +1822,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
/** @return true if this window desires key events. */
boolean canReceiveKeys() {
return isVisibleOrAdding()
- && (mViewVisibility == View.VISIBLE)
+ && (mViewVisibility == View.VISIBLE) && !mRemoveOnExit
&& ((mAttrs.flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0)
&& (mAppToken == null || mAppToken.windowsAreFocusable())
&& !isAdjustedForMinimizedDock();