From 341220fd099b2e74ac605d417f274537dc4bc749 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Tue, 16 Oct 2012 15:20:09 -0700 Subject: [PATCH] Use parent window to evaluate show-to-all-users. When a window is attached to another window use the parent window's attributes to determine whether the child window should be shown to all users. Bug: 7328633 fixed. Change-Id: I9601c149af87f624378e6895063bb3179d4f845e --- .../com/android/server/wm/WindowState.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index feb29b15e337a..c195f4578d8bc 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -1038,18 +1038,26 @@ final class WindowState implements WindowManagerPolicy.WindowState { } boolean isHiddenFromUserLocked() { - // Save some cycles by not calling getDisplayInfo unless it is an application - // window intended for all users. - if (mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW - && mAppToken != null && mAppToken.showWhenLocked) { - final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo(); - if (isFullscreen(displayInfo.appWidth, displayInfo.appHeight)) { + // Attached windows are evaluated based on the window that they are attached to. + WindowState win = this; + while (win.mAttachedWindow != null) { + win = win.mAttachedWindow; + } + if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + && win.mAppToken != null && win.mAppToken.showWhenLocked) { + // Save some cycles by not calling getDisplayInfo unless it is an application + // window intended for all users. + final DisplayInfo displayInfo = win.mDisplayContent.getDisplayInfo(); + if (win.mFrame.left <= 0 && win.mFrame.top <= 0 + && win.mFrame.right >= displayInfo.appWidth + && win.mFrame.bottom >= displayInfo.appHeight) { // Is a fullscreen window, like the clock alarm. Show to everyone. return false; } } - return mShowToOwnerOnly && UserHandle.getUserId(mOwnerUid) != mService.mCurrentUserId; + return win.mShowToOwnerOnly + && UserHandle.getUserId(win.mOwnerUid) != mService.mCurrentUserId; } private static void applyInsets(Region outRegion, Rect frame, Rect inset) {