Loading services/core/java/com/android/server/wm/ActivityRecord.java +27 −16 Original line number Diff line number Diff line Loading @@ -438,10 +438,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final String packageName; // the intent component, or target of an alias. final ComponentName mActivityComponent; // Has a wallpaper window as a background. // TODO: Rename to mHasWallpaper and also see if it possible to combine this with the // mOccludesParent field. final boolean hasWallpaper; // Input application handle used by the input dispatcher. private InputApplicationHandle mInputApplicationHandle; Loading Loading @@ -1104,19 +1100,25 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } boolean isLetterboxed = isLetterboxed(mainWin); pw.println(prefix + "isLetterboxed=" + isLetterboxed); if (!isLetterboxed) { boolean areBoundsLetterboxed = mainWin.isLetterboxedAppWindow(); pw.println(prefix + "areBoundsLetterboxed=" + areBoundsLetterboxed); if (!areBoundsLetterboxed) { return; } pw.println(prefix + " letterboxReason=" + getLetterboxReasonString(mainWin)); pw.println(prefix + " letterboxAspectRatio=" + computeAspectRatio(getBounds())); boolean isLetterboxUiShown = isLetterboxed(mainWin); pw.println(prefix + "isLetterboxUiShown=" + isLetterboxUiShown); if (!isLetterboxUiShown) { return; } pw.println(prefix + " letterboxBackgroundColor=" + Integer.toHexString( getLetterboxBackgroundColor().toArgb())); pw.println(prefix + " letterboxBackgroundType=" + letterboxBackgroundTypeToString(mWmService.getLetterboxBackgroundType())); pw.println(prefix + " letterboxAspectRatio=" + computeAspectRatio(getBounds())); } /** Loading Loading @@ -1463,9 +1465,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A "Unexpected letterbox background type: " + letterboxBackgroundType); } /** @return {@code true} when main window is letterboxed and activity isn't transparent. */ private boolean isLetterboxed(WindowState mainWindow) { return mainWindow.isLetterboxedAppWindow() && fillsParent(); /** * @return {@code true} when the main window is letterboxed, this activity isn't transparent * and doesn't show a wallpaper. */ @VisibleForTesting boolean isLetterboxed(WindowState mainWindow) { return mainWindow.isLetterboxedAppWindow() && fillsParent() // Check for FLAG_SHOW_WALLPAPER explicitly instead of using // WindowContainer#showWallpaper because the later will return true when this // activity is using blurred wallpaper for letterbox backgroud. && (mainWindow.mAttrs.flags & FLAG_SHOW_WALLPAPER) == 0; } private void updateRoundedCorners(WindowState mainWindow) { Loading Loading @@ -1655,11 +1665,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A realTheme, com.android.internal.R.styleable.Window, mUserId); if (ent != null) { mOccludesParent = !ActivityInfo.isTranslucentOrFloating(ent.array); hasWallpaper = ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false); mOccludesParent = !ActivityInfo.isTranslucentOrFloating(ent.array) // This style is propagated to the main window attributes with // FLAG_SHOW_WALLPAPER from PhoneWindow#generateLayout. || ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false); noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false); } else { hasWallpaper = false; noDisplay = false; } Loading Loading @@ -2468,7 +2479,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (!includingFinishing && finishing) { return false; } return mOccludesParent; return mOccludesParent || showWallpaper(); } boolean setOccludesParent(boolean occludesParent) { Loading services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -3595,7 +3595,7 @@ class Task extends WindowContainer<WindowContainer> { return false; } if (r.occludesParent() || r.hasWallpaper) { if (r.occludesParent()) { // Root task isn't translucent if it has at least one fullscreen activity // that is visible. return true; Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.view.Surface.ROTATION_180; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; Loading Loading @@ -324,6 +326,22 @@ public class SizeCompatTests extends WindowTestsBase { assertActivityMaxBoundsSandboxed(); } @Test public void testIsLetterboxed_activityShowsWallpaper_returnsFalse() { setUpDisplaySizeWithApp(1000, 2500); mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */); prepareUnresizable(mActivity, SCREEN_ORIENTATION_LANDSCAPE); final WindowState window = createWindow(null, TYPE_BASE_APPLICATION, mActivity, "window"); assertEquals(window, mActivity.findMainWindow()); assertTrue(mActivity.isLetterboxed(mActivity.findMainWindow())); window.mAttrs.flags |= FLAG_SHOW_WALLPAPER; assertFalse(mActivity.isLetterboxed(mActivity.findMainWindow())); } @Test public void testAspectRatioMatchParentBoundsAndImeAttachable() { setUpApp(new TestDisplayContent.Builder(mAtm, 1000, 2000) Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +27 −16 Original line number Diff line number Diff line Loading @@ -438,10 +438,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final String packageName; // the intent component, or target of an alias. final ComponentName mActivityComponent; // Has a wallpaper window as a background. // TODO: Rename to mHasWallpaper and also see if it possible to combine this with the // mOccludesParent field. final boolean hasWallpaper; // Input application handle used by the input dispatcher. private InputApplicationHandle mInputApplicationHandle; Loading Loading @@ -1104,19 +1100,25 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } boolean isLetterboxed = isLetterboxed(mainWin); pw.println(prefix + "isLetterboxed=" + isLetterboxed); if (!isLetterboxed) { boolean areBoundsLetterboxed = mainWin.isLetterboxedAppWindow(); pw.println(prefix + "areBoundsLetterboxed=" + areBoundsLetterboxed); if (!areBoundsLetterboxed) { return; } pw.println(prefix + " letterboxReason=" + getLetterboxReasonString(mainWin)); pw.println(prefix + " letterboxAspectRatio=" + computeAspectRatio(getBounds())); boolean isLetterboxUiShown = isLetterboxed(mainWin); pw.println(prefix + "isLetterboxUiShown=" + isLetterboxUiShown); if (!isLetterboxUiShown) { return; } pw.println(prefix + " letterboxBackgroundColor=" + Integer.toHexString( getLetterboxBackgroundColor().toArgb())); pw.println(prefix + " letterboxBackgroundType=" + letterboxBackgroundTypeToString(mWmService.getLetterboxBackgroundType())); pw.println(prefix + " letterboxAspectRatio=" + computeAspectRatio(getBounds())); } /** Loading Loading @@ -1463,9 +1465,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A "Unexpected letterbox background type: " + letterboxBackgroundType); } /** @return {@code true} when main window is letterboxed and activity isn't transparent. */ private boolean isLetterboxed(WindowState mainWindow) { return mainWindow.isLetterboxedAppWindow() && fillsParent(); /** * @return {@code true} when the main window is letterboxed, this activity isn't transparent * and doesn't show a wallpaper. */ @VisibleForTesting boolean isLetterboxed(WindowState mainWindow) { return mainWindow.isLetterboxedAppWindow() && fillsParent() // Check for FLAG_SHOW_WALLPAPER explicitly instead of using // WindowContainer#showWallpaper because the later will return true when this // activity is using blurred wallpaper for letterbox backgroud. && (mainWindow.mAttrs.flags & FLAG_SHOW_WALLPAPER) == 0; } private void updateRoundedCorners(WindowState mainWindow) { Loading Loading @@ -1655,11 +1665,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A realTheme, com.android.internal.R.styleable.Window, mUserId); if (ent != null) { mOccludesParent = !ActivityInfo.isTranslucentOrFloating(ent.array); hasWallpaper = ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false); mOccludesParent = !ActivityInfo.isTranslucentOrFloating(ent.array) // This style is propagated to the main window attributes with // FLAG_SHOW_WALLPAPER from PhoneWindow#generateLayout. || ent.array.getBoolean(R.styleable.Window_windowShowWallpaper, false); noDisplay = ent.array.getBoolean(R.styleable.Window_windowNoDisplay, false); } else { hasWallpaper = false; noDisplay = false; } Loading Loading @@ -2468,7 +2479,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (!includingFinishing && finishing) { return false; } return mOccludesParent; return mOccludesParent || showWallpaper(); } boolean setOccludesParent(boolean occludesParent) { Loading
services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -3595,7 +3595,7 @@ class Task extends WindowContainer<WindowContainer> { return false; } if (r.occludesParent() || r.hasWallpaper) { if (r.occludesParent()) { // Root task isn't translucent if it has at least one fullscreen activity // that is visible. return true; Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.view.Surface.ROTATION_180; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; Loading Loading @@ -324,6 +326,22 @@ public class SizeCompatTests extends WindowTestsBase { assertActivityMaxBoundsSandboxed(); } @Test public void testIsLetterboxed_activityShowsWallpaper_returnsFalse() { setUpDisplaySizeWithApp(1000, 2500); mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */); prepareUnresizable(mActivity, SCREEN_ORIENTATION_LANDSCAPE); final WindowState window = createWindow(null, TYPE_BASE_APPLICATION, mActivity, "window"); assertEquals(window, mActivity.findMainWindow()); assertTrue(mActivity.isLetterboxed(mActivity.findMainWindow())); window.mAttrs.flags |= FLAG_SHOW_WALLPAPER; assertFalse(mActivity.isLetterboxed(mActivity.findMainWindow())); } @Test public void testAspectRatioMatchParentBoundsAndImeAttachable() { setUpApp(new TestDisplayContent.Builder(mAtm, 1000, 2000) Loading