Loading services/core/java/com/android/server/wm/AppWindowToken.java +2 −1 Original line number Diff line number Diff line Loading @@ -1714,7 +1714,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (mLetterbox == null) { mLetterbox = new Letterbox(() -> makeChildSurface(null)); } mLetterbox.layout(getParent().getBounds(), w.getFrameLw()); getPosition(mTmpPoint); mLetterbox.layout(getParent().getBounds(), w.getFrameLw(), mTmpPoint); } else if (mLetterbox != null) { mLetterbox.hide(); } Loading services/core/java/com/android/server/wm/ConfigurationContainer.java +9 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import static com.android.server.wm.ConfigurationContainerProto.OVERRIDE_CONFIGU import android.annotation.CallSuper; import android.app.WindowConfiguration; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.Rect; import android.util.proto.ProtoOutputStream; Loading Loading @@ -242,6 +243,14 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> { outBounds.set(getBounds()); } /** * Sets {@code out} to the top-left corner of the bounds as returned by {@link #getBounds()}. */ public void getPosition(Point out) { Rect bounds = getBounds(); out.set(bounds.left, bounds.top); } /** * Returns the bounds requested on this container. These may not be the actual bounds the * container ends up with due to policy constraints. The {@link Rect} handed back is Loading services/core/java/com/android/server/wm/Letterbox.java +12 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.view.SurfaceControl.HIDDEN; import android.graphics.Point; import android.graphics.Rect; import android.view.SurfaceControl; Loading @@ -30,6 +31,7 @@ import java.util.function.Supplier; public class Letterbox { private static final Rect EMPTY_RECT = new Rect(); private static final Point ZERO_POINT = new Point(0, 0); private final Supplier<SurfaceControl.Builder> mFactory; private final Rect mOuter = new Rect(); Loading @@ -53,14 +55,19 @@ public class Letterbox { * frames will be covered by black color surfaces. * * The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface. * * @param outer the outer frame of the letterbox (this frame will be black, except the area * that intersects with the {code inner} frame). * @param inner the inner frame of the letterbox (this frame will be clear) * that intersects with the {code inner} frame), in global coordinates * @param inner the inner frame of the letterbox (this frame will be clear), in global * coordinates * @param surfaceOrigin the origin of the surface factory in global coordinates */ public void layout(Rect outer, Rect inner) { public void layout(Rect outer, Rect inner, Point surfaceOrigin) { mOuter.set(outer); mInner.set(inner); mOuter.offset(-surfaceOrigin.x, -surfaceOrigin.y); mInner.offset(-surfaceOrigin.x, -surfaceOrigin.y); outer = mOuter; inner = mInner; mTop.layout(outer.left, outer.top, inner.right, inner.top); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom); Loading Loading @@ -94,7 +101,7 @@ public class Letterbox { * The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface. */ public void hide() { layout(EMPTY_RECT, EMPTY_RECT); layout(EMPTY_RECT, EMPTY_RECT, ZERO_POINT); } /** Loading Loading
services/core/java/com/android/server/wm/AppWindowToken.java +2 −1 Original line number Diff line number Diff line Loading @@ -1714,7 +1714,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree if (mLetterbox == null) { mLetterbox = new Letterbox(() -> makeChildSurface(null)); } mLetterbox.layout(getParent().getBounds(), w.getFrameLw()); getPosition(mTmpPoint); mLetterbox.layout(getParent().getBounds(), w.getFrameLw(), mTmpPoint); } else if (mLetterbox != null) { mLetterbox.hide(); } Loading
services/core/java/com/android/server/wm/ConfigurationContainer.java +9 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import static com.android.server.wm.ConfigurationContainerProto.OVERRIDE_CONFIGU import android.annotation.CallSuper; import android.app.WindowConfiguration; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.Rect; import android.util.proto.ProtoOutputStream; Loading Loading @@ -242,6 +243,14 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> { outBounds.set(getBounds()); } /** * Sets {@code out} to the top-left corner of the bounds as returned by {@link #getBounds()}. */ public void getPosition(Point out) { Rect bounds = getBounds(); out.set(bounds.left, bounds.top); } /** * Returns the bounds requested on this container. These may not be the actual bounds the * container ends up with due to policy constraints. The {@link Rect} handed back is Loading
services/core/java/com/android/server/wm/Letterbox.java +12 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.view.SurfaceControl.HIDDEN; import android.graphics.Point; import android.graphics.Rect; import android.view.SurfaceControl; Loading @@ -30,6 +31,7 @@ import java.util.function.Supplier; public class Letterbox { private static final Rect EMPTY_RECT = new Rect(); private static final Point ZERO_POINT = new Point(0, 0); private final Supplier<SurfaceControl.Builder> mFactory; private final Rect mOuter = new Rect(); Loading @@ -53,14 +55,19 @@ public class Letterbox { * frames will be covered by black color surfaces. * * The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface. * * @param outer the outer frame of the letterbox (this frame will be black, except the area * that intersects with the {code inner} frame). * @param inner the inner frame of the letterbox (this frame will be clear) * that intersects with the {code inner} frame), in global coordinates * @param inner the inner frame of the letterbox (this frame will be clear), in global * coordinates * @param surfaceOrigin the origin of the surface factory in global coordinates */ public void layout(Rect outer, Rect inner) { public void layout(Rect outer, Rect inner, Point surfaceOrigin) { mOuter.set(outer); mInner.set(inner); mOuter.offset(-surfaceOrigin.x, -surfaceOrigin.y); mInner.offset(-surfaceOrigin.x, -surfaceOrigin.y); outer = mOuter; inner = mInner; mTop.layout(outer.left, outer.top, inner.right, inner.top); mLeft.layout(outer.left, inner.top, inner.left, outer.bottom); Loading Loading @@ -94,7 +101,7 @@ public class Letterbox { * The caller must use {@link #applySurfaceChanges} to apply the new layout to the surface. */ public void hide() { layout(EMPTY_RECT, EMPTY_RECT); layout(EMPTY_RECT, EMPTY_RECT, ZERO_POINT); } /** Loading