summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-11-03 23:08:23 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-11-03 23:08:26 +0000
commitc2a2b94393c54f0b303eca0efc5f3c8281f7ee65 (patch)
tree58c09470d9c0dac5095381ad810ee3a20a2fee28
parentecbf80b62de2556cdee027a31858e3134194a8b7 (diff)
parentb0d273427b3edf074a2c927b4f7e5d53fca2168a (diff)
Merge "Get rid of Keyguard visibility modifiers on WindowState"
-rw-r--r--core/java/android/view/WindowManagerPolicy.java7
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java26
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java55
3 files changed, 14 insertions, 74 deletions
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index a8d70c4b0a86..8a9bb33895f4 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -339,13 +339,6 @@ public interface WindowManagerPolicy {
boolean isVisibleLw();
/**
- * Like {@link #isVisibleLw}, but also counts a window that is currently
- * "hidden" behind the keyguard as visible. This allows us to apply
- * things like window flags that impact the keyguard.
- */
- boolean isVisibleOrBehindKeyguardLw();
-
- /**
* Is this window currently visible to the user on-screen? It is
* displayed either if it is visible or it is currently running an
* animation before no longer being visible. Must be called with the
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 2ca0db43294e..3df05476951d 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5089,12 +5089,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Dock windows carve out the bottom of the screen, so normal windows
// can't appear underneath them.
- if (attrs.type == TYPE_INPUT_METHOD && win.isVisibleOrBehindKeyguardLw()
- && win.isDisplayedLw() && !win.getGivenInsetsPendingLw()) {
+ if (attrs.type == TYPE_INPUT_METHOD && win.isVisibleLw()
+ && !win.getGivenInsetsPendingLw()) {
setLastInputMethodWindowLw(null, null);
offsetInputMethodWindowLw(win);
}
- if (attrs.type == TYPE_VOICE_INTERACTION && win.isVisibleOrBehindKeyguardLw()
+ if (attrs.type == TYPE_VOICE_INTERACTION && win.isVisibleLw()
&& !win.getGivenInsetsPendingLw()) {
offsetVoiceInputWindowLw(win);
}
@@ -5168,12 +5168,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs,
WindowState attached, WindowState imeTarget) {
- if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw="
- + win.isVisibleOrBehindKeyguardLw());
+ final boolean visible = win.isVisibleLw();
+ if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisible=" + visible);
applyKeyguardPolicyLw(win, imeTarget);
final int fl = PolicyControl.getWindowFlags(win, attrs);
- if (mTopFullscreenOpaqueWindowState == null
- && win.isVisibleLw() && attrs.type == TYPE_INPUT_METHOD) {
+ if (mTopFullscreenOpaqueWindowState == null && visible && attrs.type == TYPE_INPUT_METHOD) {
mForcingShowNavBar = true;
mForcingShowNavBarLayer = win.getSurfaceLayer();
}
@@ -5189,8 +5188,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean appWindow = attrs.type >= FIRST_APPLICATION_WINDOW
&& attrs.type < FIRST_SYSTEM_WINDOW;
final int stackId = win.getStackId();
- if (mTopFullscreenOpaqueWindowState == null &&
- win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()) {
+ if (mTopFullscreenOpaqueWindowState == null && visible) {
if ((fl & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
mForceStatusBar = true;
}
@@ -5221,10 +5219,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
- final boolean reallyVisible = win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw();
-
// Voice interaction overrides both top fullscreen and top docked.
- if (reallyVisible && win.getAttrs().type == TYPE_VOICE_INTERACTION) {
+ if (visible && win.getAttrs().type == TYPE_VOICE_INTERACTION) {
if (mTopFullscreenOpaqueWindowState == null) {
mTopFullscreenOpaqueWindowState = win;
if (mTopFullscreenOpaqueOrDimmingWindowState == null) {
@@ -5240,7 +5236,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
// Keep track of the window if it's dimming but not necessarily fullscreen.
- if (mTopFullscreenOpaqueOrDimmingWindowState == null && reallyVisible
+ if (mTopFullscreenOpaqueOrDimmingWindowState == null && visible
&& win.isDimming() && StackId.normallyFullscreenWindows(stackId)) {
mTopFullscreenOpaqueOrDimmingWindowState = win;
}
@@ -5248,7 +5244,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// We need to keep track of the top "fullscreen" opaque window for the docked stack
// separately, because both the "real fullscreen" opaque window and the one for the docked
// stack can control View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.
- if (mTopDockedOpaqueWindowState == null && reallyVisible && appWindow && attached == null
+ if (mTopDockedOpaqueWindowState == null && visible && appWindow && attached == null
&& isFullscreen(attrs) && stackId == DOCKED_STACK_ID) {
mTopDockedOpaqueWindowState = win;
if (mTopDockedOpaqueOrDimmingWindowState == null) {
@@ -5258,7 +5254,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Also keep track of any windows that are dimming but not necessarily fullscreen in the
// docked stack.
- if (mTopDockedOpaqueOrDimmingWindowState == null && reallyVisible && win.isDimming()
+ if (mTopDockedOpaqueOrDimmingWindowState == null && visible && win.isDimming()
&& stackId == DOCKED_STACK_ID) {
mTopDockedOpaqueOrDimmingWindowState = win;
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 534a3d2885ce..972c35911b39 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1353,25 +1353,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
/**
- * Like {@link #isVisibleLw}, but also counts a window that is currently "hidden" behind the
- * keyguard as visible. This allows us to apply things like window flags that impact the
- * keyguard. XXX I am starting to think we need to have ANOTHER visibility flag for this
- * "hidden behind keyguard" state rather than overloading mPolicyVisibility. Ungh.
- */
- @Override
- public boolean isVisibleOrBehindKeyguardLw() {
- if (mToken.waitingToShow && mService.mAppTransition.isTransitionSet()) {
- return false;
- }
- final AppWindowToken atoken = mAppToken;
- final boolean animating = atoken != null && atoken.mAppAnimator.animation != null;
- return mHasSurface && !mDestroying && !mAnimatingExit
- && (atoken == null ? mPolicyVisibility : !atoken.hiddenRequested)
- && ((!isParentWindowHidden() && mViewVisibility == View.VISIBLE && !mToken.hidden)
- || mWinAnimator.mAnimation != null || animating);
- }
-
- /**
* Is this window visible, ignoring its app token? It is not visible if there is no surface,
* or we are in the process of running an exit animation that will remove the surface.
*/
@@ -1418,14 +1399,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* being visible.
*/
boolean isOnScreen() {
- return mPolicyVisibility && isOnScreenIgnoringKeyguard();
- }
-
- /**
- * Like isOnScreen(), but ignores any force hiding of the window due
- * to the keyguard.
- */
- private boolean isOnScreenIgnoringKeyguard() {
if (!mHasSurface || mDestroying) {
return false;
}
@@ -1449,7 +1422,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
boolean mightAffectAllDrawn(boolean visibleOnly) {
final boolean isViewVisible = (mAppToken == null || !mAppToken.clientHidden)
&& (mViewVisibility == View.VISIBLE) && !mWindowRemovalAllowed;
- return (isOnScreenIgnoringKeyguard() && (!visibleOnly || isViewVisible)
+ return (isOnScreen() && (!visibleOnly || isViewVisible)
|| mWinAnimator.mAttrType == TYPE_BASE_APPLICATION
|| mWinAnimator.mAttrType == TYPE_DRAWN_APPLICATION)
&& !mAnimatingExit && !mDestroying;
@@ -1479,28 +1452,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
/**
- * Like isReadyForDisplay(), but ignores any force hiding of the window due
- * to the keyguard.
- */
- boolean isReadyForDisplayIgnoringKeyguard() {
- if (mToken.waitingToShow && mService.mAppTransition.isTransitionSet()) {
- return false;
- }
- final AppWindowToken atoken = mAppToken;
- if (atoken == null && !mPolicyVisibility) {
- // If this is not an app window, and the policy has asked to force
- // hide, then we really do want to hide.
- return false;
- }
- return mHasSurface && !mDestroying
- && ((!isParentWindowHidden() && mViewVisibility == View.VISIBLE && !mToken.hidden)
- || mWinAnimator.mAnimation != null
- || ((atoken != null) && (atoken.mAppAnimator.animation != null)
- && !mWinAnimator.isDummyAnimation())
- || isAnimatingWithSavedSurface());
- }
-
- /**
* Like isOnScreen, but returns false if the surface hasn't yet
* been drawn.
*/
@@ -3771,7 +3722,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
logPerformShow("performShow on ");
- if (mWinAnimator.mDrawState != READY_TO_SHOW || !isReadyForDisplayIgnoringKeyguard()) {
+ if (mWinAnimator.mDrawState != READY_TO_SHOW || !isReadyForDisplay()) {
return false;
}
@@ -3821,7 +3772,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|| (DEBUG_STARTING_WINDOW && mAttrs.type == TYPE_APPLICATION_STARTING)) {
Slog.v(TAG, prefix + this
+ ": mDrawState=" + mWinAnimator.drawStateToString()
- + " readyForDisplay=" + isReadyForDisplayIgnoringKeyguard()
+ + " readyForDisplay=" + isReadyForDisplay()
+ " starting=" + (mAttrs.type == TYPE_APPLICATION_STARTING)
+ " during animation: policyVis=" + mPolicyVisibility
+ " parentHidden=" + isParentWindowHidden()