Loading services/core/java/com/android/server/wm/AppWindowToken.java +10 −0 Original line number Diff line number Diff line Loading @@ -1728,6 +1728,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree frame.set(win.mContainingFrame); } surfaceInsets = win.getAttrs().surfaceInsets; // XXX(b/72757033): These are insets relative to the window frame, but we're really // interested in the insets relative to the frame we chose in the if-blocks above. insets.set(win.mContentInsets); stableInsets.set(win.mStableInsets); } Loading Loading @@ -2120,4 +2122,12 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } return stringName + ((mIsExiting) ? " mIsExiting=" : ""); } Rect getLetterboxInsets() { if (mLetterbox != null) { return mLetterbox.getInsets(); } else { return new Rect(); } } } services/core/java/com/android/server/wm/Letterbox.java +19 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,17 @@ public class Letterbox { mRight.setRect(t, inner.right, outer.top, outer.right, inner.bottom); } /** * Gets the insets between the outer and inner rects. */ public Rect getInsets() { return new Rect( mLeft.getWidth(), mTop.getHeight(), mRight.getWidth(), mBottom.getHeight()); } /** * Hides the letterbox. * Loading Loading @@ -141,5 +152,13 @@ public class Letterbox { mSurface = null; } } public int getWidth() { return Math.max(0, mLastRight - mLastLeft); } public int getHeight() { return Math.max(0, mLastBottom - mLastTop); } } } services/core/java/com/android/server/wm/TaskSnapshotController.java +17 −9 Original line number Diff line number Diff line Loading @@ -281,17 +281,25 @@ class TaskSnapshotController { } private Rect getInsetsFromTaskBounds(WindowState state, Task task) { final Rect r = new Rect(); r.set(state.getContentFrameLw()); r.intersectUnchecked(state.getStableFrameLw()); // XXX(b/72757033): These are insets relative to the window frame, but we're really // interested in the insets relative to the task bounds. Rect insets = minRect(state.mContentInsets, state.mStableInsets); insets = maxRect(insets, state.mAppToken.getLetterboxInsets()); return insets; } final Rect taskBounds = task.getBounds(); private Rect minRect(Rect rect1, Rect rect2) { return new Rect(Math.min(rect1.left, rect2.left), Math.min(rect1.top, rect2.top), Math.min(rect1.right, rect2.right), Math.min(rect1.bottom, rect2.bottom)); } r.set(Math.max(0, r.left - taskBounds.left), Math.max(0, r.top - taskBounds.top), Math.max(0, taskBounds.right - r.right), Math.max(0, taskBounds.bottom - r.bottom)); return r; private Rect maxRect(Rect rect1, Rect rect2) { return new Rect(Math.max(rect1.left, rect2.left), Math.max(rect1.top, rect2.top), Math.max(rect1.right, rect2.right), Math.max(rect1.bottom, rect2.bottom)); } /** Loading Loading
services/core/java/com/android/server/wm/AppWindowToken.java +10 −0 Original line number Diff line number Diff line Loading @@ -1728,6 +1728,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree frame.set(win.mContainingFrame); } surfaceInsets = win.getAttrs().surfaceInsets; // XXX(b/72757033): These are insets relative to the window frame, but we're really // interested in the insets relative to the frame we chose in the if-blocks above. insets.set(win.mContentInsets); stableInsets.set(win.mStableInsets); } Loading Loading @@ -2120,4 +2122,12 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } return stringName + ((mIsExiting) ? " mIsExiting=" : ""); } Rect getLetterboxInsets() { if (mLetterbox != null) { return mLetterbox.getInsets(); } else { return new Rect(); } } }
services/core/java/com/android/server/wm/Letterbox.java +19 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,17 @@ public class Letterbox { mRight.setRect(t, inner.right, outer.top, outer.right, inner.bottom); } /** * Gets the insets between the outer and inner rects. */ public Rect getInsets() { return new Rect( mLeft.getWidth(), mTop.getHeight(), mRight.getWidth(), mBottom.getHeight()); } /** * Hides the letterbox. * Loading Loading @@ -141,5 +152,13 @@ public class Letterbox { mSurface = null; } } public int getWidth() { return Math.max(0, mLastRight - mLastLeft); } public int getHeight() { return Math.max(0, mLastBottom - mLastTop); } } }
services/core/java/com/android/server/wm/TaskSnapshotController.java +17 −9 Original line number Diff line number Diff line Loading @@ -281,17 +281,25 @@ class TaskSnapshotController { } private Rect getInsetsFromTaskBounds(WindowState state, Task task) { final Rect r = new Rect(); r.set(state.getContentFrameLw()); r.intersectUnchecked(state.getStableFrameLw()); // XXX(b/72757033): These are insets relative to the window frame, but we're really // interested in the insets relative to the task bounds. Rect insets = minRect(state.mContentInsets, state.mStableInsets); insets = maxRect(insets, state.mAppToken.getLetterboxInsets()); return insets; } final Rect taskBounds = task.getBounds(); private Rect minRect(Rect rect1, Rect rect2) { return new Rect(Math.min(rect1.left, rect2.left), Math.min(rect1.top, rect2.top), Math.min(rect1.right, rect2.right), Math.min(rect1.bottom, rect2.bottom)); } r.set(Math.max(0, r.left - taskBounds.left), Math.max(0, r.top - taskBounds.top), Math.max(0, taskBounds.right - r.right), Math.max(0, taskBounds.bottom - r.bottom)); return r; private Rect maxRect(Rect rect1, Rect rect2) { return new Rect(Math.max(rect1.left, rect2.left), Math.max(rect1.top, rect2.top), Math.max(rect1.right, rect2.right), Math.max(rect1.bottom, rect2.bottom)); } /** Loading