Loading services/core/java/com/android/server/policy/WindowManagerPolicy.java +0 −8 Original line number Diff line number Diff line Loading @@ -396,14 +396,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { return false; } /** * Returns true if the window has a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ default boolean isLetterboxedOverlappingWith(Rect rect) { return false; } /** @return the current windowing mode of this window. */ int getWindowingMode(); Loading services/core/java/com/android/server/wm/ActivityRecord.java +7 −0 Original line number Diff line number Diff line Loading @@ -1394,6 +1394,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect); } /** * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. Loading services/core/java/com/android/server/wm/BarController.java +14 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static com.android.server.wm.BarControllerProto.STATE; import static com.android.server.wm.BarControllerProto.TRANSIENT_STATE; import android.annotation.NonNull; import android.app.StatusBarManager; import android.graphics.Rect; import android.os.Handler; Loading Loading @@ -169,13 +170,23 @@ public class BarController { return vis; } private Rect getContentFrame(@NonNull WindowState win) { final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); return rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; } boolean isLightAppearanceAllowed(WindowState win) { if (win == null) { return true; } return !win.isLetterboxedOverlappingWith(getContentFrame(win)); } boolean isTransparentAllowed(WindowState win) { if (win == null) { return true; } final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); final Rect contentFrame = rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; return !win.isLetterboxedOverlappingWith(contentFrame); return win.letterboxNotIntersectsOrFullyContains(getContentFrame(win)); } boolean setBarShowingLw(final boolean show) { Loading services/core/java/com/android/server/wm/DisplayPolicy.java +20 −13 Original line number Diff line number Diff line Loading @@ -3437,7 +3437,8 @@ public class DisplayPolicy { WindowState opaqueOrDimming) { final boolean onKeyguard = isKeyguardShowing() && !isKeyguardOccluded(); final WindowState statusColorWin = onKeyguard ? mNotificationShade : opaqueOrDimming; if (statusColorWin != null && (statusColorWin == opaque || onKeyguard)) { if (statusColorWin != null) { if (statusColorWin == opaque || onKeyguard) { // If the top fullscreen-or-dimming window is also the top fullscreen, respect // its light flag. appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; Loading @@ -3445,10 +3446,14 @@ public class DisplayPolicy { PolicyControl.getSystemUiVisibility(statusColorWin, null)); appearance |= (statusColorWin.mAttrs.insetsFlags.appearance | legacyAppearance) & APPEARANCE_LIGHT_STATUS_BARS; } else if (statusColorWin != null && statusColorWin.isDimming()) { } else if (statusColorWin.isDimming()) { // Otherwise if it's dimming, clear the light flag. appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; } if (!mStatusBarController.isLightAppearanceAllowed(statusColorWin)) { appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; } } return appearance; } Loading Loading @@ -3512,8 +3517,7 @@ public class DisplayPolicy { return vis; } @VisibleForTesting static int updateLightNavigationBarAppearanceLw(int appearance, WindowState opaque, private int updateLightNavigationBarAppearanceLw(int appearance, WindowState opaque, WindowState opaqueOrDimming, WindowState imeWindow, WindowState navColorWin) { if (navColorWin != null) { Loading @@ -3526,6 +3530,9 @@ public class DisplayPolicy { // Clear the light flag for dimming window. appearance &= ~APPEARANCE_LIGHT_NAVIGATION_BARS; } if (!mNavigationBarController.isLightAppearanceAllowed(navColorWin)) { appearance &= ~APPEARANCE_LIGHT_NAVIGATION_BARS; } } return appearance; } Loading services/core/java/com/android/server/wm/Letterbox.java +29 −4 Original line number Diff line number Diff line Loading @@ -77,10 +77,10 @@ public class Letterbox { mOuter.set(outer); mInner.set(inner); mTop.layout(outer.left, outer.top, inner.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(inner.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, inner.bottom, surfaceOrigin); mTop.layout(outer.left, outer.top, outer.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, outer.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(outer.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, outer.bottom, surfaceOrigin); } Loading @@ -100,6 +100,31 @@ public class Letterbox { return mInner; } /** * Returns {@code true} if the letterbox does not overlap with the bar, or the letterbox can * fully cover the window frame. * * @param rect The area of the window frame. */ boolean notIntersectsOrFullyContains(Rect rect) { int emptyCount = 0; int noOverlappingCount = 0; for (LetterboxSurface surface : mSurfaces) { final Rect surfaceRect = surface.mLayoutFrameGlobal; if (surfaceRect.isEmpty()) { // empty letterbox emptyCount++; } else if (!Rect.intersects(surfaceRect, rect)) { // no overlapping noOverlappingCount++; } else if (surfaceRect.contains(rect)) { // overlapping and covered return true; } } return (emptyCount + noOverlappingCount) == mSurfaces.length; } /** * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ Loading Loading
services/core/java/com/android/server/policy/WindowManagerPolicy.java +0 −8 Original line number Diff line number Diff line Loading @@ -396,14 +396,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { return false; } /** * Returns true if the window has a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ default boolean isLetterboxedOverlappingWith(Rect rect) { return false; } /** @return the current windowing mode of this window. */ int getWindowingMode(); Loading
services/core/java/com/android/server/wm/ActivityRecord.java +7 −0 Original line number Diff line number Diff line Loading @@ -1394,6 +1394,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } /** * @see Letterbox#notIntersectsOrFullyContains(Rect) */ boolean letterboxNotIntersectsOrFullyContains(Rect rect) { return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect); } /** * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. Loading
services/core/java/com/android/server/wm/BarController.java +14 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.wm; import static com.android.server.wm.BarControllerProto.STATE; import static com.android.server.wm.BarControllerProto.TRANSIENT_STATE; import android.annotation.NonNull; import android.app.StatusBarManager; import android.graphics.Rect; import android.os.Handler; Loading Loading @@ -169,13 +170,23 @@ public class BarController { return vis; } private Rect getContentFrame(@NonNull WindowState win) { final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); return rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; } boolean isLightAppearanceAllowed(WindowState win) { if (win == null) { return true; } return !win.isLetterboxedOverlappingWith(getContentFrame(win)); } boolean isTransparentAllowed(WindowState win) { if (win == null) { return true; } final Rect rotatedContentFrame = win.mToken.getFixedRotationBarContentFrame(mWindowType); final Rect contentFrame = rotatedContentFrame != null ? rotatedContentFrame : mContentFrame; return !win.isLetterboxedOverlappingWith(contentFrame); return win.letterboxNotIntersectsOrFullyContains(getContentFrame(win)); } boolean setBarShowingLw(final boolean show) { Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +20 −13 Original line number Diff line number Diff line Loading @@ -3437,7 +3437,8 @@ public class DisplayPolicy { WindowState opaqueOrDimming) { final boolean onKeyguard = isKeyguardShowing() && !isKeyguardOccluded(); final WindowState statusColorWin = onKeyguard ? mNotificationShade : opaqueOrDimming; if (statusColorWin != null && (statusColorWin == opaque || onKeyguard)) { if (statusColorWin != null) { if (statusColorWin == opaque || onKeyguard) { // If the top fullscreen-or-dimming window is also the top fullscreen, respect // its light flag. appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; Loading @@ -3445,10 +3446,14 @@ public class DisplayPolicy { PolicyControl.getSystemUiVisibility(statusColorWin, null)); appearance |= (statusColorWin.mAttrs.insetsFlags.appearance | legacyAppearance) & APPEARANCE_LIGHT_STATUS_BARS; } else if (statusColorWin != null && statusColorWin.isDimming()) { } else if (statusColorWin.isDimming()) { // Otherwise if it's dimming, clear the light flag. appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; } if (!mStatusBarController.isLightAppearanceAllowed(statusColorWin)) { appearance &= ~APPEARANCE_LIGHT_STATUS_BARS; } } return appearance; } Loading Loading @@ -3512,8 +3517,7 @@ public class DisplayPolicy { return vis; } @VisibleForTesting static int updateLightNavigationBarAppearanceLw(int appearance, WindowState opaque, private int updateLightNavigationBarAppearanceLw(int appearance, WindowState opaque, WindowState opaqueOrDimming, WindowState imeWindow, WindowState navColorWin) { if (navColorWin != null) { Loading @@ -3526,6 +3530,9 @@ public class DisplayPolicy { // Clear the light flag for dimming window. appearance &= ~APPEARANCE_LIGHT_NAVIGATION_BARS; } if (!mNavigationBarController.isLightAppearanceAllowed(navColorWin)) { appearance &= ~APPEARANCE_LIGHT_NAVIGATION_BARS; } } return appearance; } Loading
services/core/java/com/android/server/wm/Letterbox.java +29 −4 Original line number Diff line number Diff line Loading @@ -77,10 +77,10 @@ public class Letterbox { mOuter.set(outer); mInner.set(inner); mTop.layout(outer.left, outer.top, inner.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(inner.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, inner.bottom, surfaceOrigin); mTop.layout(outer.left, outer.top, outer.right, inner.top, surfaceOrigin); mLeft.layout(outer.left, outer.top, inner.left, outer.bottom, surfaceOrigin); mBottom.layout(outer.left, inner.bottom, outer.right, outer.bottom, surfaceOrigin); mRight.layout(inner.right, outer.top, outer.right, outer.bottom, surfaceOrigin); } Loading @@ -100,6 +100,31 @@ public class Letterbox { return mInner; } /** * Returns {@code true} if the letterbox does not overlap with the bar, or the letterbox can * fully cover the window frame. * * @param rect The area of the window frame. */ boolean notIntersectsOrFullyContains(Rect rect) { int emptyCount = 0; int noOverlappingCount = 0; for (LetterboxSurface surface : mSurfaces) { final Rect surfaceRect = surface.mLayoutFrameGlobal; if (surfaceRect.isEmpty()) { // empty letterbox emptyCount++; } else if (!Rect.intersects(surfaceRect, rect)) { // no overlapping noOverlappingCount++; } else if (surfaceRect.contains(rect)) { // overlapping and covered return true; } } return (emptyCount + noOverlappingCount) == mSurfaces.length; } /** * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ Loading