Skip to content

Commit e13ae64

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Use parent window to evaluate show-to-all-users." into jb-mr1-dev
2 parents e4728b1 + 341220f commit e13ae64

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

services/java/com/android/server/wm/WindowState.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,18 +1038,26 @@ public void setShowToOwnerOnlyLocked(boolean showToOwnerOnly) {
10381038
}
10391039

10401040
boolean isHiddenFromUserLocked() {
1041-
// Save some cycles by not calling getDisplayInfo unless it is an application
1042-
// window intended for all users.
1043-
if (mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
1044-
&& mAppToken != null && mAppToken.showWhenLocked) {
1045-
final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo();
1046-
if (isFullscreen(displayInfo.appWidth, displayInfo.appHeight)) {
1041+
// Attached windows are evaluated based on the window that they are attached to.
1042+
WindowState win = this;
1043+
while (win.mAttachedWindow != null) {
1044+
win = win.mAttachedWindow;
1045+
}
1046+
if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
1047+
&& win.mAppToken != null && win.mAppToken.showWhenLocked) {
1048+
// Save some cycles by not calling getDisplayInfo unless it is an application
1049+
// window intended for all users.
1050+
final DisplayInfo displayInfo = win.mDisplayContent.getDisplayInfo();
1051+
if (win.mFrame.left <= 0 && win.mFrame.top <= 0
1052+
&& win.mFrame.right >= displayInfo.appWidth
1053+
&& win.mFrame.bottom >= displayInfo.appHeight) {
10471054
// Is a fullscreen window, like the clock alarm. Show to everyone.
10481055
return false;
10491056
}
10501057
}
10511058

1052-
return mShowToOwnerOnly && UserHandle.getUserId(mOwnerUid) != mService.mCurrentUserId;
1059+
return win.mShowToOwnerOnly
1060+
&& UserHandle.getUserId(win.mOwnerUid) != mService.mCurrentUserId;
10531061
}
10541062

10551063
private static void applyInsets(Region outRegion, Rect frame, Rect inset) {

0 commit comments

Comments
 (0)