Loading core/java/android/view/WindowManagerPolicy.java +6 −8 Original line number Diff line number Diff line Loading @@ -605,21 +605,21 @@ public interface WindowManagerPolicy { public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation); /** * Return whether the given window should forcibly hide everything * behind it. Typically returns true for the keyguard. * Return whether the given window is forcibly hiding all windows except windows with * FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard. */ public boolean doesForceHide(WindowManager.LayoutParams attrs); public boolean isForceHiding(WindowManager.LayoutParams attrs); /** * Return whether the given window can become one that passes doesForceHide() test. * Return whether the given window can become one that passes isForceHiding() test. * Typically returns true for the StatusBar. */ public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); /** * Determine if a window that is behind one that is force hiding * (as determined by {@link #doesForceHide}) should actually be hidden. * (as determined by {@link #isForceHiding}) should actually be hidden. * For example, typically returns false for the status bar. Be careful * to return false for any window that you may hide yourself, since this * will conflict with what you set. Loading Loading @@ -830,13 +830,11 @@ public interface WindowManagerPolicy { * setting the window's frame, either here or in finishLayout(). * * @param win The window being positioned. * @param attrs The LayoutParams of the window. * @param attached For sub-windows, the window it is attached to; this * window will already have had layoutWindow() called on it * so you can use its Rect. Otherwise null. */ public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached); public void layoutWindowLw(WindowState win, WindowState attached); /** Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +45 −9 Original line number Diff line number Diff line Loading @@ -435,6 +435,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { * be done once per window. */ private WindowState mWinDismissingKeyguard; /** The window that is currently showing "over" the keyguard. If there is an app window * belonging to another app on top of this the keyguard shows. If there is a fullscreen * app window under this, still dismiss the keyguard but don't show the app underneath. Show * the wallpaper. */ private WindowState mWinShowWhenLocked; boolean mShowingLockscreen; boolean mShowingDream; boolean mDreamingLockscreen; Loading Loading @@ -1669,8 +1675,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } @Override public boolean doesForceHide(WindowManager.LayoutParams attrs) { return (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0; public boolean isForceHiding(WindowManager.LayoutParams attrs) { return (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || (isKeyguardHostWindow(attrs) && isKeyguardSecureIncludingHidden()); } @Override Loading Loading @@ -3119,10 +3126,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached) { public void layoutWindowLw(WindowState win, WindowState attached) { // we've already done the status bar if ((win == mStatusBar && !doesForceHide(attrs)) || win == mNavigationBar) { final WindowManager.LayoutParams attrs = win.getAttrs(); if ((win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) == 0) || win == mNavigationBar) { return; } final boolean isDefaultDisplay = win.isDefaultDisplay(); Loading Loading @@ -3603,12 +3611,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDismissKeyguard = DISMISS_KEYGUARD_NONE; mShowingLockscreen = false; mShowingDream = false; mWinShowWhenLocked = null; } /** {@inheritDoc} */ @Override public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs) { public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs) { if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw=" + win.isVisibleOrBehindKeyguardLw()); final int fl = PolicyControl.getWindowFlags(win, attrs); Loading Loading @@ -3646,9 +3654,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { final boolean showWhenLocked = (fl & FLAG_SHOW_WHEN_LOCKED) != 0; final boolean dismissKeyguard = (fl & FLAG_DISMISS_KEYGUARD) != 0; final boolean secureKeyguard = isKeyguardSecure(); if (appWindow) { if (showWhenLocked || (dismissKeyguard && !isKeyguardSecure())) { if (showWhenLocked || (dismissKeyguard && !secureKeyguard)) { // Remove any previous windows with the same appToken. mAppsToBeHidden.remove(win.getAppToken()); if (mAppsToBeHidden.isEmpty() && showWhenLocked && isKeyguardSecureIncludingHidden()) { mWinShowWhenLocked = win; mHideLockScreen = true; mForceStatusBarFromKeyguard = false; } } else { mAppsToBeHidden.add(win.getAppToken()); } Loading @@ -3670,13 +3686,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDismissKeyguard = mWinDismissingKeyguard == win ? DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START; mWinDismissingKeyguard = win; mForceStatusBarFromKeyguard = mShowingLockscreen && isKeyguardSecure(); mForceStatusBarFromKeyguard = mShowingLockscreen && secureKeyguard; } } if ((fl & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) { mAllowLockscreenWhenOn = true; } } if (mWinShowWhenLocked != null && mWinShowWhenLocked.getAppToken() != win.getAppToken()) { win.hideLw(false); } } } } Loading @@ -3684,6 +3705,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public int finishPostLayoutPolicyLw() { if (mWinShowWhenLocked != null && mWinShowWhenLocked != mTopFullscreenOpaqueWindowState) { // A dialog is dismissing the keyguard. Put the wallpaper behind it and hide the // fullscreen window. // TODO: Make sure FLAG_SHOW_WALLPAPER is restored when dialog is dismissed. Or not. mWinShowWhenLocked.getAttrs().flags |= FLAG_SHOW_WALLPAPER; mTopFullscreenOpaqueWindowState.hideLw(false); mTopFullscreenOpaqueWindowState = mWinShowWhenLocked; } int changes = 0; boolean topIsFullscreen = false; Loading Loading @@ -4639,6 +4670,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return mKeyguardDelegate.isSecure(); } // Returns true if keyguard is currently locked whether or not it is currently hidden. private boolean isKeyguardSecureIncludingHidden() { return mKeyguardDelegate.isSecure() && mKeyguardDelegate.isShowing(); } /** {@inheritDoc} */ public boolean inKeyguardRestrictedKeyInputMode() { if (mKeyguardDelegate == null) return false; Loading services/core/java/com/android/server/wm/WindowAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED; Loading Loading @@ -227,7 +228,7 @@ public class WindowAnimator { continue; } final WindowStateAnimator winAnimator = win.mWinAnimator; if (mPolicy.doesForceHide(win.mAttrs)) { if ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) { if (!winAnimator.mAnimating) { // Create a new animation to delay until keyguard is gone on its own. winAnimator.mAnimation = new AlphaAnimation(1.0f, 1.0f); Loading Loading @@ -268,7 +269,7 @@ public class WindowAnimator { } } if (mPolicy.doesForceHide(win.mAttrs)) { if (mPolicy.isForceHiding(win.mAttrs)) { if (!wasAnimating && nowAnimating) { if (WindowManagerService.DEBUG_ANIM || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, Loading services/core/java/com/android/server/wm/WindowManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -8442,7 +8442,7 @@ public class WindowManagerService extends IWindowManager.Stub } win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, null); mPolicy.layoutWindowLw(win, null); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading Loading @@ -8494,7 +8494,7 @@ public class WindowManagerService extends IWindowManager.Stub } win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow); mPolicy.layoutWindowLw(win, win.mAttachedWindow); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading Loading
core/java/android/view/WindowManagerPolicy.java +6 −8 Original line number Diff line number Diff line Loading @@ -605,21 +605,21 @@ public interface WindowManagerPolicy { public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation); /** * Return whether the given window should forcibly hide everything * behind it. Typically returns true for the keyguard. * Return whether the given window is forcibly hiding all windows except windows with * FLAG_SHOW_WHEN_LOCKED set. Typically returns true for the keyguard. */ public boolean doesForceHide(WindowManager.LayoutParams attrs); public boolean isForceHiding(WindowManager.LayoutParams attrs); /** * Return whether the given window can become one that passes doesForceHide() test. * Return whether the given window can become one that passes isForceHiding() test. * Typically returns true for the StatusBar. */ public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs); /** * Determine if a window that is behind one that is force hiding * (as determined by {@link #doesForceHide}) should actually be hidden. * (as determined by {@link #isForceHiding}) should actually be hidden. * For example, typically returns false for the status bar. Be careful * to return false for any window that you may hide yourself, since this * will conflict with what you set. Loading Loading @@ -830,13 +830,11 @@ public interface WindowManagerPolicy { * setting the window's frame, either here or in finishLayout(). * * @param win The window being positioned. * @param attrs The LayoutParams of the window. * @param attached For sub-windows, the window it is attached to; this * window will already have had layoutWindow() called on it * so you can use its Rect. Otherwise null. */ public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached); public void layoutWindowLw(WindowState win, WindowState attached); /** Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +45 −9 Original line number Diff line number Diff line Loading @@ -435,6 +435,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { * be done once per window. */ private WindowState mWinDismissingKeyguard; /** The window that is currently showing "over" the keyguard. If there is an app window * belonging to another app on top of this the keyguard shows. If there is a fullscreen * app window under this, still dismiss the keyguard but don't show the app underneath. Show * the wallpaper. */ private WindowState mWinShowWhenLocked; boolean mShowingLockscreen; boolean mShowingDream; boolean mDreamingLockscreen; Loading Loading @@ -1669,8 +1675,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } @Override public boolean doesForceHide(WindowManager.LayoutParams attrs) { return (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0; public boolean isForceHiding(WindowManager.LayoutParams attrs) { return (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || (isKeyguardHostWindow(attrs) && isKeyguardSecureIncludingHidden()); } @Override Loading Loading @@ -3119,10 +3126,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached) { public void layoutWindowLw(WindowState win, WindowState attached) { // we've already done the status bar if ((win == mStatusBar && !doesForceHide(attrs)) || win == mNavigationBar) { final WindowManager.LayoutParams attrs = win.getAttrs(); if ((win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) == 0) || win == mNavigationBar) { return; } final boolean isDefaultDisplay = win.isDefaultDisplay(); Loading Loading @@ -3603,12 +3611,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDismissKeyguard = DISMISS_KEYGUARD_NONE; mShowingLockscreen = false; mShowingDream = false; mWinShowWhenLocked = null; } /** {@inheritDoc} */ @Override public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs) { public void applyPostLayoutPolicyLw(WindowState win, WindowManager.LayoutParams attrs) { if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw=" + win.isVisibleOrBehindKeyguardLw()); final int fl = PolicyControl.getWindowFlags(win, attrs); Loading Loading @@ -3646,9 +3654,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { final boolean showWhenLocked = (fl & FLAG_SHOW_WHEN_LOCKED) != 0; final boolean dismissKeyguard = (fl & FLAG_DISMISS_KEYGUARD) != 0; final boolean secureKeyguard = isKeyguardSecure(); if (appWindow) { if (showWhenLocked || (dismissKeyguard && !isKeyguardSecure())) { if (showWhenLocked || (dismissKeyguard && !secureKeyguard)) { // Remove any previous windows with the same appToken. mAppsToBeHidden.remove(win.getAppToken()); if (mAppsToBeHidden.isEmpty() && showWhenLocked && isKeyguardSecureIncludingHidden()) { mWinShowWhenLocked = win; mHideLockScreen = true; mForceStatusBarFromKeyguard = false; } } else { mAppsToBeHidden.add(win.getAppToken()); } Loading @@ -3670,13 +3686,18 @@ public class PhoneWindowManager implements WindowManagerPolicy { mDismissKeyguard = mWinDismissingKeyguard == win ? DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START; mWinDismissingKeyguard = win; mForceStatusBarFromKeyguard = mShowingLockscreen && isKeyguardSecure(); mForceStatusBarFromKeyguard = mShowingLockscreen && secureKeyguard; } } if ((fl & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) { mAllowLockscreenWhenOn = true; } } if (mWinShowWhenLocked != null && mWinShowWhenLocked.getAppToken() != win.getAppToken()) { win.hideLw(false); } } } } Loading @@ -3684,6 +3705,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ @Override public int finishPostLayoutPolicyLw() { if (mWinShowWhenLocked != null && mWinShowWhenLocked != mTopFullscreenOpaqueWindowState) { // A dialog is dismissing the keyguard. Put the wallpaper behind it and hide the // fullscreen window. // TODO: Make sure FLAG_SHOW_WALLPAPER is restored when dialog is dismissed. Or not. mWinShowWhenLocked.getAttrs().flags |= FLAG_SHOW_WALLPAPER; mTopFullscreenOpaqueWindowState.hideLw(false); mTopFullscreenOpaqueWindowState = mWinShowWhenLocked; } int changes = 0; boolean topIsFullscreen = false; Loading Loading @@ -4639,6 +4670,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return mKeyguardDelegate.isSecure(); } // Returns true if keyguard is currently locked whether or not it is currently hidden. private boolean isKeyguardSecureIncludingHidden() { return mKeyguardDelegate.isSecure() && mKeyguardDelegate.isShowing(); } /** {@inheritDoc} */ public boolean inKeyguardRestrictedKeyInputMode() { if (mKeyguardDelegate == null) return false; Loading
services/core/java/com/android/server/wm/WindowAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED; Loading Loading @@ -227,7 +228,7 @@ public class WindowAnimator { continue; } final WindowStateAnimator winAnimator = win.mWinAnimator; if (mPolicy.doesForceHide(win.mAttrs)) { if ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) { if (!winAnimator.mAnimating) { // Create a new animation to delay until keyguard is gone on its own. winAnimator.mAnimation = new AlphaAnimation(1.0f, 1.0f); Loading Loading @@ -268,7 +269,7 @@ public class WindowAnimator { } } if (mPolicy.doesForceHide(win.mAttrs)) { if (mPolicy.isForceHiding(win.mAttrs)) { if (!wasAnimating && nowAnimating) { if (WindowManagerService.DEBUG_ANIM || WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, Loading
services/core/java/com/android/server/wm/WindowManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -8442,7 +8442,7 @@ public class WindowManagerService extends IWindowManager.Stub } win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, null); mPolicy.layoutWindowLw(win, null); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading Loading @@ -8494,7 +8494,7 @@ public class WindowManagerService extends IWindowManager.Stub } win.mLayoutNeeded = false; win.prelayout(); mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow); mPolicy.layoutWindowLw(win, win.mAttachedWindow); win.mLayoutSeq = seq; if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" Loading