summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/proto/android/server/windowmanagerservice.proto36
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java115
-rw-r--r--services/core/java/com/android/server/policy/WindowManagerPolicy.java28
-rw-r--r--services/core/java/com/android/server/wm/AccessibilityController.java5
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java11
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java12
-rw-r--r--services/core/java/com/android/server/wm/InputMonitor.java2
-rw-r--r--services/core/java/com/android/server/wm/Task.java19
-rw-r--r--services/core/java/com/android/server/wm/WallpaperController.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowFrames.java176
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java8
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java454
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java18
-rw-r--r--services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java42
-rw-r--r--services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java120
-rw-r--r--services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java103
-rw-r--r--services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java6
17 files changed, 655 insertions, 504 deletions
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index 2de53b97312a..710fe3d6e3e9 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -288,10 +288,11 @@ message WindowStateProto {
optional int32 stack_id = 4;
optional .android.view.WindowLayoutParamsProto attributes = 5;
optional .android.graphics.RectProto given_content_insets = 6;
- optional .android.graphics.RectProto frame = 7;
- optional .android.graphics.RectProto containing_frame = 8;
- optional .android.graphics.RectProto parent_frame = 9;
- optional .android.graphics.RectProto content_frame = 10;
+ reserved 7 to 10;
+// optional .android.graphics.RectProto frame = 7;
+// optional .android.graphics.RectProto containing_frame = 8;
+// optional .android.graphics.RectProto parent_frame = 9;
+// optional .android.graphics.RectProto content_frame = 10;
optional .android.graphics.RectProto content_insets = 11;
optional .android.graphics.RectProto surface_insets = 12;
optional WindowStateAnimatorProto animator = 13;
@@ -304,11 +305,12 @@ message WindowStateProto {
optional int32 system_ui_visibility = 21;
optional bool has_surface = 22;
optional bool is_ready_for_display = 23;
- optional .android.graphics.RectProto display_frame = 24;
- optional .android.graphics.RectProto overscan_frame = 25;
- optional .android.graphics.RectProto visible_frame = 26;
- optional .android.graphics.RectProto decor_frame = 27;
- optional .android.graphics.RectProto outset_frame = 28;
+ reserved 24 to 28;
+// optional .android.graphics.RectProto display_frame = 24;
+// optional .android.graphics.RectProto overscan_frame = 25;
+// optional .android.graphics.RectProto visible_frame = 26;
+// optional .android.graphics.RectProto decor_frame = 27;
+// optional .android.graphics.RectProto outset_frame = 28;
optional .android.graphics.RectProto overscan_insets = 29;
optional .android.graphics.RectProto visible_insets = 30;
optional .android.graphics.RectProto stable_insets = 31;
@@ -321,6 +323,7 @@ message WindowStateProto {
optional bool is_visible = 38;
optional bool pending_forced_seamless_rotation = 39;
optional int64 finished_forced_seamless_rotation_frame = 40;
+ optional WindowFramesProto window_frames = 41;
}
message IdentifierProto {
@@ -382,3 +385,18 @@ message ConfigurationContainerProto {
optional .android.content.ConfigurationProto full_configuration = 2;
optional .android.content.ConfigurationProto merged_override_configuration = 3;
}
+
+/* represents WindowFrames */
+message WindowFramesProto {
+ option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ optional .android.graphics.RectProto containing_frame = 1;
+ optional .android.graphics.RectProto content_frame = 2;
+ optional .android.graphics.RectProto decor_frame = 3;
+ optional .android.graphics.RectProto display_frame = 4;
+ optional .android.graphics.RectProto frame = 5;
+ optional .android.graphics.RectProto outset_frame = 6;
+ optional .android.graphics.RectProto overscan_frame = 7;
+ optional .android.graphics.RectProto parent_frame = 8;
+ optional .android.graphics.RectProto visible_frame = 9;
+}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 883e9392854c..cb652242f629 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -288,6 +288,7 @@ import com.android.server.wm.ActivityTaskManagerInternal;
import com.android.server.wm.ActivityTaskManagerInternal.SleepToken;
import com.android.server.wm.AppTransition;
import com.android.server.wm.DisplayFrames;
+import com.android.server.wm.WindowFrames;
import com.android.server.wm.WindowManagerInternal;
import com.android.server.wm.WindowManagerInternal.AppTransitionListener;
import com.android.server.wm.utils.InsetUtils;
@@ -665,15 +666,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
InputConsumer mInputConsumer = null;
- static final Rect mTmpParentFrame = new Rect();
- static final Rect mTmpDisplayFrame = new Rect();
- static final Rect mTmpOverscanFrame = new Rect();
- static final Rect mTmpContentFrame = new Rect();
- static final Rect mTmpVisibleFrame = new Rect();
- static final Rect mTmpDecorFrame = new Rect();
- static final Rect mTmpStableFrame = new Rect();
- static final Rect mTmpNavigationFrame = new Rect();
- static final Rect mTmpOutsetFrame = new Rect();
+ private final WindowFrames mWindowFrames = new WindowFrames();
private static final Rect mTmpDisplayCutoutSafeExceptMaybeBarsRect = new Rect();
private static final Rect mTmpRect = new Rect();
@@ -4643,18 +4636,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mDockLayer = 0x10000000;
mStatusBarLayer = -1;
- // start with the current dock rect, which will be (0,0,displayWidth,displayHeight)
- final Rect pf = mTmpParentFrame;
- final Rect df = mTmpDisplayFrame;
- final Rect of = mTmpOverscanFrame;
- final Rect vf = mTmpVisibleFrame;
- final Rect dcf = mTmpDecorFrame;
- vf.set(displayFrames.mDock);
- of.set(displayFrames.mDock);
- df.set(displayFrames.mDock);
- pf.set(displayFrames.mDock);
- dcf.setEmpty(); // Decor frame N/A for system bars.
-
if (displayFrames.mDisplayId == DEFAULT_DISPLAY) {
// For purposes of putting out fake window up to steal focus, we will
// drive nav being hidden only by whether it is requested.
@@ -4695,16 +4676,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// be hidden (because of the screen aspect ratio), then take that into account.
navVisible |= !canHideNavigationBar();
- boolean updateSysUiVisibility = layoutNavigationBar(displayFrames, uiMode, dcf,
- navVisible, navTranslucent, navAllowedHidden, statusBarExpandedNotKeyguard);
+ boolean updateSysUiVisibility = layoutNavigationBar(displayFrames, uiMode, navVisible,
+ navTranslucent, navAllowedHidden, statusBarExpandedNotKeyguard);
if (DEBUG_LAYOUT) Slog.i(TAG, "mDock rect:" + displayFrames.mDock);
- updateSysUiVisibility |= layoutStatusBar(
- displayFrames, pf, df, of, vf, dcf, sysui, isKeyguardShowing);
+ updateSysUiVisibility |= layoutStatusBar(displayFrames, sysui, isKeyguardShowing);
if (updateSysUiVisibility) {
updateSystemUiVisibilityLw();
}
}
- layoutScreenDecorWindows(displayFrames, pf, df, dcf);
+ layoutScreenDecorWindows(displayFrames);
if (displayFrames.mDisplayCutoutSafe.top > displayFrames.mUnrestricted.top) {
// Make sure that the zone we're avoiding for the cutout is at least as tall as the
@@ -4715,11 +4695,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
- private void layoutScreenDecorWindows(DisplayFrames displayFrames, Rect pf, Rect df, Rect dcf) {
+ private void layoutScreenDecorWindows(DisplayFrames displayFrames) {
if (mScreenDecorWindows.isEmpty()) {
return;
}
+ mTmpRect.setEmpty();
+ mWindowFrames.setFrames(displayFrames.mDock /* parentFrame */,
+ displayFrames.mDock /* displayFrame */, displayFrames.mDock /* overscanFrame */,
+ displayFrames.mDock /* contentFrame */, displayFrames.mDock /* visibleFrame */,
+ mTmpRect /* decorFrame */, displayFrames.mDock /* stableFrame */,
+ displayFrames.mDock /* outsetFrame */);
+
final int displayId = displayFrames.mDisplayId;
final Rect dockFrame = displayFrames.mDock;
final int displayHeight = displayFrames.mDisplayHeight;
@@ -4732,9 +4719,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
continue;
}
- w.computeFrameLw(pf /* parentFrame */, df /* displayFrame */, df /* overlayFrame */,
- df /* contentFrame */, df /* visibleFrame */, dcf /* decorFrame */,
- df /* stableFrame */, df /* outsetFrame */, displayFrames.mDisplayCutout,
+ w.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout,
false /* parentFrameWasClippedByDisplayCutout */);
final Rect frame = w.getFrameLw();
@@ -4780,25 +4765,25 @@ public class PhoneWindowManager implements WindowManagerPolicy {
displayFrames.mRestrictedOverscan.set(dockFrame);
}
- private boolean layoutStatusBar(DisplayFrames displayFrames, Rect pf, Rect df, Rect of, Rect vf,
- Rect dcf, int sysui, boolean isKeyguardShowing) {
+ private boolean layoutStatusBar(DisplayFrames displayFrames, int sysui,
+ boolean isKeyguardShowing) {
// decide where the status bar goes ahead of time
if (mStatusBar == null) {
return false;
}
// apply any navigation bar insets
- of.set(displayFrames.mUnrestricted);
- df.set(displayFrames.mUnrestricted);
- pf.set(displayFrames.mUnrestricted);
- vf.set(displayFrames.mStable);
+ mTmpRect.setEmpty();
+ mWindowFrames.setFrames(displayFrames.mUnrestricted /* parentFrame */,
+ displayFrames.mUnrestricted /* displayFrame */,
+ displayFrames.mStable /* overscanFrame */, displayFrames.mStable /* contentFrame */,
+ displayFrames.mStable /* visibleFrame */, mTmpRect /* decorFrame */,
+ displayFrames.mStable /* stableFrame */, displayFrames.mStable /* outsetFrame */);
mStatusBarLayer = mStatusBar.getSurfaceLayer();
// Let the status bar determine its size.
- mStatusBar.computeFrameLw(pf /* parentFrame */, df /* displayFrame */,
- vf /* overlayFrame */, vf /* contentFrame */, vf /* visibleFrame */,
- dcf /* decorFrame */, vf /* stableFrame */, vf /* outsetFrame */,
- displayFrames.mDisplayCutout, false /* parentFrameWasClippedByDisplayCutout */);
+ mStatusBar.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout,
+ false /* parentFrameWasClippedByDisplayCutout */);
// For layout, the status bar is always at the top with our fixed height.
displayFrames.mStable.top = displayFrames.mUnrestricted.top
@@ -4845,12 +4830,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return mStatusBarController.checkHiddenLw();
}
- private boolean layoutNavigationBar(DisplayFrames displayFrames, int uiMode, Rect dcf,
- boolean navVisible, boolean navTranslucent, boolean navAllowedHidden,
+ private boolean layoutNavigationBar(DisplayFrames displayFrames, int uiMode, boolean navVisible,
+ boolean navTranslucent, boolean navAllowedHidden,
boolean statusBarExpandedNotKeyguard) {
if (mNavigationBar == null) {
return false;
}
+
+ final Rect navigationFrame = mWindowFrames.mParentFrame;
boolean transientNavBarShowing = mNavigationBarController.isTransientShowing();
// Force the navigation bar to its appropriate place and size. We need to do this directly,
// instead of relying on it to bubble up from the nav bar, because this needs to change
@@ -4869,7 +4856,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// It's a system nav bar or a portrait screen; nav bar goes on bottom.
final int top = cutoutSafeUnrestricted.bottom
- getNavigationBarHeight(rotation, uiMode);
- mTmpNavigationFrame.set(0, top, displayWidth, displayFrames.mUnrestricted.bottom);
+ navigationFrame.set(0, top, displayWidth, displayFrames.mUnrestricted.bottom);
displayFrames.mStable.bottom = displayFrames.mStableFullscreen.bottom = top;
if (transientNavBarShowing) {
mNavigationBarController.setBarShowingLw(true);
@@ -4892,7 +4879,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Landscape screen; nav bar goes to the right.
final int left = cutoutSafeUnrestricted.right
- getNavigationBarWidth(rotation, uiMode);
- mTmpNavigationFrame.set(left, 0, displayFrames.mUnrestricted.right, displayHeight);
+ navigationFrame.set(left, 0, displayFrames.mUnrestricted.right, displayHeight);
displayFrames.mStable.right = displayFrames.mStableFullscreen.right = left;
if (transientNavBarShowing) {
mNavigationBarController.setBarShowingLw(true);
@@ -4915,7 +4902,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Seascape screen; nav bar goes to the left.
final int right = cutoutSafeUnrestricted.left
+ getNavigationBarWidth(rotation, uiMode);
- mTmpNavigationFrame.set(displayFrames.mUnrestricted.left, 0, right, displayHeight);
+ navigationFrame.set(displayFrames.mUnrestricted.left, 0, right, displayHeight);
displayFrames.mStable.left = displayFrames.mStableFullscreen.left = right;
if (transientNavBarShowing) {
mNavigationBarController.setBarShowingLw(true);
@@ -4943,13 +4930,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
displayFrames.mContent.set(dockFrame);
mStatusBarLayer = mNavigationBar.getSurfaceLayer();
// And compute the final frame.
- mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
- mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe, mTmpNavigationFrame, dcf,
- mTmpNavigationFrame, displayFrames.mDisplayCutoutSafe,
- displayFrames.mDisplayCutout, false /* parentFrameWasClippedByDisplayCutout */);
+ mTmpRect.setEmpty();
+ mWindowFrames.setFrames(navigationFrame /* parentFrame */,
+ navigationFrame /* displayFrame */, navigationFrame /* overscanFrame */,
+ displayFrames.mDisplayCutoutSafe /* contentFrame */,
+ navigationFrame /* visibleFrame */, mTmpRect /* decorFrame */,
+ navigationFrame /* stableFrame */,
+ displayFrames.mDisplayCutoutSafe /* outsetFrame */);
+
+ mNavigationBar.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout,
+ false /* parentFrameWasClippedByDisplayCutout */);
mNavigationBarController.setContentFrame(mNavigationBar.getContentFrameLw());
- if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame);
+ if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + navigationFrame);
return mNavigationBarController.checkHiddenLw();
}
@@ -5077,15 +5070,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final int requestedSysUiFl = PolicyControl.getSystemUiVisibility(null, attrs);
final int sysUiFl = requestedSysUiFl | getImpliedSysUiFlagsForLayout(attrs);
- final Rect pf = mTmpParentFrame;
- final Rect df = mTmpDisplayFrame;
- final Rect of = mTmpOverscanFrame;
- final Rect cf = mTmpContentFrame;
- final Rect vf = mTmpVisibleFrame;
- final Rect dcf = mTmpDecorFrame;
- final Rect sf = mTmpStableFrame;
- Rect osf = null;
+ final Rect pf = mWindowFrames.mParentFrame;
+ final Rect df = mWindowFrames.mDisplayFrame;
+ final Rect of = mWindowFrames.mOverscanFrame;
+ final Rect cf = mWindowFrames.mContentFrame;
+ final Rect vf = mWindowFrames.mVisibleFrame;
+ final Rect dcf = mWindowFrames.mDecorFrame;
+ final Rect sf = mWindowFrames.mStableFrame;
dcf.setEmpty();
+ mWindowFrames.mOutsetFrame.setEmpty();
final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar
&& mNavigationBar != null && mNavigationBar.isVisibleLw());
@@ -5484,7 +5477,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// apply the outsets to floating dialogs, because they wouldn't make sense there.
final boolean useOutsets = shouldUseOutsets(attrs, fl);
if (isDefaultDisplay && useOutsets) {
- osf = mTmpOutsetFrame;
+ final Rect osf = mWindowFrames.mOutsetFrame;
osf.set(cf.left, cf.top, cf.right, cf.bottom);
int outset = ScreenShapeHelper.getWindowOutsetBottomPx(mContext.getResources());
if (outset > 0) {
@@ -5512,9 +5505,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
+ " cf=" + cf.toShortString() + " vf=" + vf.toShortString()
+ " dcf=" + dcf.toShortString()
+ " sf=" + sf.toShortString()
- + " osf=" + (osf == null ? "null" : osf.toShortString()));
+ + " osf=" + mWindowFrames.mOutsetFrame.toShortString());
- win.computeFrameLw(pf, df, of, cf, vf, dcf, sf, osf, displayFrames.mDisplayCutout,
+ win.computeFrameLw(mWindowFrames, displayFrames.mDisplayCutout,
parentFrameWasClippedByDisplayCutout);
// Dock windows carve out the bottom of the screen, so normal windows
// can't appear underneath them.
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index 7ea620039026..d63433db7310 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -93,6 +93,7 @@ import android.view.animation.Animation;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.internal.policy.IShortcutService;
import com.android.server.wm.DisplayFrames;
+import com.android.server.wm.WindowFrames;
import com.android.server.wm.utils.WmDisplayCutout;
import java.io.PrintWriter;
@@ -197,34 +198,13 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
* getFrame() if so desired. Must be called with the window manager
* lock held.
*
- * @param parentFrame The frame of the parent container this window
- * is in, used for computing its basic position.
- * @param displayFrame The frame of the overall display in which this
- * window can appear, used for constraining the overall dimensions
- * of the window.
- * @param overlayFrame The frame within the display that is inside
- * of the overlay region.
- * @param contentFrame The frame within the display in which we would
- * like active content to appear. This will cause windows behind to
- * be resized to match the given content frame.
- * @param visibleFrame The frame within the display that the window
- * is actually visible, used for computing its visible insets to be
- * given to windows behind.
- * This can be used as a hint for scrolling (avoiding resizing)
- * the window to make certain that parts of its content
- * are visible.
- * @param decorFrame The decor frame specified by policy specific to this window,
- * to use for proper cropping during animation.
- * @param stableFrame The frame around which stable system decoration is positioned.
- * @param outsetFrame The frame that includes areas that aren't part of the surface but we
- * want to treat them as such.
+ * @param windowFrames Container for all the window frames that affect how the window is
+ * laid out.
* @param displayCutout the display cutout
* @param parentFrameWasClippedByDisplayCutout true if the parent frame would have been
* different if there was no display cutout.
*/
- public void computeFrameLw(Rect parentFrame, Rect displayFrame,
- Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame,
- Rect stableFrame, @Nullable Rect outsetFrame, WmDisplayCutout displayCutout,
+ public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout,
boolean parentFrameWasClippedByDisplayCutout);
/**
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index a6ec3cff1b2c..f0898c0228b2 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -549,7 +549,8 @@ final class AccessibilityController {
touchableRegion.getBounds(touchableFrame);
RectF windowFrame = mTempRectF;
windowFrame.set(touchableFrame);
- windowFrame.offset(-windowState.mFrame.left, -windowState.mFrame.top);
+ windowFrame.offset(-windowState.getFrameLw().left,
+ -windowState.getFrameLw().top);
matrix.mapRect(windowFrame);
Region windowBounds = mTempRegion2;
windowBounds.set((int) windowFrame.left, (int) windowFrame.top,
@@ -1222,7 +1223,7 @@ final class AccessibilityController {
// Move to origin as all transforms are captured by the matrix.
RectF windowFrame = mTempRectF;
windowFrame.set(touchableFrame);
- windowFrame.offset(-windowState.mFrame.left, -windowState.mFrame.top);
+ windowFrame.offset(-windowState.getFrameLw().left, -windowState.getFrameLw().top);
// Map the frame to get what appears on the screen.
Matrix matrix = mTempMatrix;
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index fa6079c51906..d9ddf9f9b3a4 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1523,7 +1523,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
if (mLetterbox == null) {
mLetterbox = new Letterbox(() -> makeChildSurface(null));
}
- mLetterbox.layout(getParent().getBounds(), w.mFrame);
+ mLetterbox.layout(getParent().getBounds(), w.getFrameLw());
} else if (mLetterbox != null) {
mLetterbox.hide();
}
@@ -1808,7 +1808,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// won't exactly match the final freeform window frame (e.g. when overlapping with
// the status bar). In that case we need to use the final frame.
if (freeform) {
- frame.set(win.mFrame);
+ frame.set(win.getFrameLw());
} else if (win.isLetterboxedAppWindow()) {
frame.set(getTask().getBounds());
} else if (win.isDockedResizing()) {
@@ -1816,7 +1816,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// animation target (which will be different than the task bounds)
frame.set(getTask().getParent().getBounds());
} else {
- frame.set(win.mContainingFrame);
+ frame.set(win.getContainingFrame());
}
surfaceInsets = win.getAttrs().surfaceInsets;
// XXX(b/72757033): These are insets relative to the window frame, but we're really
@@ -2022,7 +2022,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
if (win == null) {
return;
}
- final Rect frame = win.mFrame;
+ final Rect frame = win.getFrameLw();
final int thumbnailDrawableRes = getTask().mUserId == mService.mCurrentUserId
? R.drawable.ic_account_circle
: R.drawable.ic_corp_badge;
@@ -2034,7 +2034,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
}
mThumbnail = new AppWindowThumbnail(getPendingTransaction(), this, thumbnail);
final Animation animation =
- mService.mAppTransition.createCrossProfileAppsThumbnailAnimationLocked(win.mFrame);
+ mService.mAppTransition.createCrossProfileAppsThumbnailAnimationLocked(
+ win.getFrameLw());
mThumbnail.startAnimation(getPendingTransaction(), animation, new Point(frame.left,
frame.top));
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index efe4d6f48da1..8a1c4a4e88e9 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -579,9 +579,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
w.mAppToken.layoutLetterbox(w);
}
- if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + w.mFrame
- + " mContainingFrame=" + w.mContainingFrame
- + " mDisplayFrame=" + w.mDisplayFrame);
+ if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + w.getFrameLw()
+ + " mContainingFrame=" + w.getContainingFrame()
+ + " mDisplayFrame=" + w.getDisplayFrameLw());
}
}
};
@@ -607,9 +607,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
w.prelayout();
mService.mPolicy.layoutWindowLw(w, w.getParentWindow(), mDisplayFrames);
w.mLayoutSeq = mLayoutSeq;
- if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + w.mFrame
- + " mContainingFrame=" + w.mContainingFrame
- + " mDisplayFrame=" + w.mDisplayFrame);
+ if (DEBUG_LAYOUT) Slog.v(TAG, " LAYOUT: mFrame=" + w.getFrameLw()
+ + " mContainingFrame=" + w.getContainingFrame()
+ + " mDisplayFrame=" + w.getDisplayFrameLw());
}
} else if (w.mAttrs.type == TYPE_DREAM) {
// Don't layout windows behind a dream, so that if it does stuff like hide the
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index a626663c2e67..8ab46518ed4d 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -326,7 +326,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
inputWindowHandle.ownerUid = child.mSession.mUid;
inputWindowHandle.inputFeatures = child.mAttrs.inputFeatures;
- final Rect frame = child.mFrame;
+ final Rect frame = child.getFrameLw();
inputWindowHandle.frameLeft = frame.left;
inputWindowHandle.frameTop = frame.top;
inputWindowHandle.frameRight = frame.right;
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 2da77a15b956..71f34c98ee1f 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -409,7 +409,7 @@ class Task extends WindowContainer<AppWindowToken> {
* @param out Rect containing the max visible bounds.
* @return true if the task has some visible app windows; false otherwise.
*/
- boolean getMaxVisibleBounds(Rect out) {
+ private boolean getMaxVisibleBounds(Rect out) {
boolean foundTop = false;
for (int i = mChildren.size() - 1; i >= 0; i--) {
final AppWindowToken token = mChildren.get(i);
@@ -422,22 +422,11 @@ class Task extends WindowContainer<AppWindowToken> {
continue;
}
if (!foundTop) {
- out.set(win.mVisibleFrame);
foundTop = true;
- continue;
- }
- if (win.mVisibleFrame.left < out.left) {
- out.left = win.mVisibleFrame.left;
- }
- if (win.mVisibleFrame.top < out.top) {
- out.top = win.mVisibleFrame.top;
- }
- if (win.mVisibleFrame.right > out.right) {
- out.right = win.mVisibleFrame.right;
- }
- if (win.mVisibleFrame.bottom > out.bottom) {
- out.bottom = win.mVisibleFrame.bottom;
+ out.setEmpty();
}
+
+ win.getMaxVisibleBounds(out);
}
return foundTop;
}
diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java
index c63da77d4a47..3d349ce34d6b 100644
--- a/services/core/java/com/android/server/wm/WallpaperController.java
+++ b/services/core/java/com/android/server/wm/WallpaperController.java
@@ -295,7 +295,7 @@ class WallpaperController {
float defaultWallpaperX = wallpaperWin.isRtl() ? 1f : 0f;
float wpx = mLastWallpaperX >= 0 ? mLastWallpaperX : defaultWallpaperX;
float wpxs = mLastWallpaperXStep >= 0 ? mLastWallpaperXStep : -1.0f;
- int availw = wallpaperWin.mFrame.right - wallpaperWin.mFrame.left - dw;
+ int availw = wallpaperWin.getFrameLw().right - wallpaperWin.getFrameLw().left - dw;
int offset = availw > 0 ? -(int)(availw * wpx + .5f) : 0;
if (mLastWallpaperDisplayOffsetX != Integer.MIN_VALUE) {
offset += mLastWallpaperDisplayOffsetX;
@@ -310,7 +310,7 @@ class WallpaperController {
float wpy = mLastWallpaperY >= 0 ? mLastWallpaperY : 0.5f;
float wpys = mLastWallpaperYStep >= 0 ? mLastWallpaperYStep : -1.0f;
- int availh = wallpaperWin.mFrame.bottom - wallpaperWin.mFrame.top - dh;
+ int availh = wallpaperWin.getFrameLw().bottom - wallpaperWin.getFrameLw().top - dh;
offset = availh > 0 ? -(int)(availh * wpy + .5f) : 0;
if (mLastWallpaperDisplayOffsetY != Integer.MIN_VALUE) {
offset += mLastWallpaperDisplayOffsetY;
diff --git a/services/core/java/com/android/server/wm/WindowFrames.java b/services/core/java/com/android/server/wm/WindowFrames.java
new file mode 100644
index 000000000000..25317bb69768
--- /dev/null
+++ b/services/core/java/com/android/server/wm/WindowFrames.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.server.wm;
+
+import static com.android.server.wm.WindowFramesProto.CONTAINING_FRAME;
+import static com.android.server.wm.WindowFramesProto.CONTENT_FRAME;
+import static com.android.server.wm.WindowFramesProto.DECOR_FRAME;
+import static com.android.server.wm.WindowFramesProto.DISPLAY_FRAME;
+import static com.android.server.wm.WindowFramesProto.FRAME;
+import static com.android.server.wm.WindowFramesProto.OUTSET_FRAME;
+import static com.android.server.wm.WindowFramesProto.OVERSCAN_FRAME;
+import static com.android.server.wm.WindowFramesProto.PARENT_FRAME;
+import static com.android.server.wm.WindowFramesProto.VISIBLE_FRAME;
+
+import android.annotation.NonNull;
+import android.graphics.Rect;
+import android.util.proto.ProtoOutputStream;
+
+import java.io.PrintWriter;
+
+/**
+ * Container class for all the window frames that affect how windows are laid out.
+ *
+ * TODO(b/111611553): Investigate which frames are still needed and which are duplicates
+ */
+public class WindowFrames {
+
+ /**
+ * In most cases, this is the area of the entire screen.
+ *
+ * TODO(b/111611553): The name is unclear and most likely should be swapped with
+ * {@link #mDisplayFrame}
+ * TODO(b/111611553): In some cases, it also includes top insets, like for IME. Determine
+ * whether this is still necessary to do.
+ */
+ public final Rect mParentFrame = new Rect();
+
+ /**
+ * The entire screen area of the {@link TaskStack} this window is in. Usually equal to the
+ * screen area of the device.
+ *
+ * TODO(b/111611553): The name is unclear and most likely should be swapped with
+ * {@link #mParentFrame}
+ */
+ public final Rect mDisplayFrame = new Rect();
+
+ /**
+ * The region of the display frame that the display type supports displaying content on. This
+ * is mostly a special case for TV where some displays don’t have the entire display usable.
+ * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_OVERSCAN} flag can be used to
+ * allow window display contents to extend into the overscan region.
+ */
+ public final Rect mOverscanFrame = new Rect();
+
+ /**
+ * Legacy stuff. Generally equal to the content frame expect when the IME for older apps
+ * displays hint text.
+ */
+ public final Rect mVisibleFrame = new Rect();
+
+ /**
+ * The area not occupied by the status and navigation bars. So, if both status and navigation
+ * bars are visible, the decor frame is equal to the stable frame.
+ */
+ public final Rect mDecorFrame = new Rect();
+
+ /**
+ * Equal to the decor frame if the IME (e.g. keyboard) is not present. Equal to the decor frame
+ * minus the area occupied by the IME if the IME is present.
+ */
+ public final Rect mContentFrame = new Rect();
+
+ /**
+ * The display frame minus the stable insets. This value is always constant regardless of if
+ * the status bar or navigation bar is visible.
+ */
+ public final Rect mStableFrame = new Rect();
+
+ /**
+ * Frame that includes dead area outside of the surface but where we want to pretend that it's
+ * possible to draw.
+ */
+ final public Rect mOutsetFrame = new Rect();
+
+ /**
+ * Similar to {@link #mDisplayFrame}
+ *
+ * TODO: Why is this different than mDisplayFrame
+ */
+ final Rect mContainingFrame = new Rect();
+
+ /**
+ * "Real" frame that the application sees, in display coordinate space.
+ */
+ final Rect mFrame = new Rect();
+
+ /**
+ * The last real frame that was reported to the client.
+ */
+ final Rect mLastFrame = new Rect();
+
+ public WindowFrames() {
+ }
+
+ public WindowFrames(Rect parentFrame, Rect displayFrame, Rect overscanFrame, Rect contentFrame,
+ Rect visibleFrame, Rect decorFrame, Rect stableFrame, Rect outsetFrame) {
+ setFrames(parentFrame, displayFrame, overscanFrame, contentFrame, visibleFrame, decorFrame,
+ stableFrame, outsetFrame);
+ }
+
+ public void setFrames(Rect parentFrame, Rect displayFrame, Rect overscanFrame,
+ Rect contentFrame, Rect visibleFrame, Rect decorFrame, Rect stableFrame,
+ Rect outsetFrame) {
+ mParentFrame.set(parentFrame);
+ mDisplayFrame.set(displayFrame);
+ mOverscanFrame.set(overscanFrame);
+ mContentFrame.set(contentFrame);
+ mVisibleFrame.set(visibleFrame);
+ mDecorFrame.set(decorFrame);
+ mStableFrame.set(stableFrame);
+ mOutsetFrame.set(outsetFrame);
+ }
+
+ public void writeToProto(@NonNull ProtoOutputStream proto, long fieldId) {
+ final long token = proto.start(fieldId);
+ mParentFrame.writeToProto(proto, PARENT_FRAME);
+ mContentFrame.writeToProto(proto, CONTENT_FRAME);
+ mDisplayFrame.writeToProto(proto, DISPLAY_FRAME);
+ mOverscanFrame.writeToProto(proto, OVERSCAN_FRAME);
+ mVisibleFrame.writeToProto(proto, VISIBLE_FRAME);
+ mDecorFrame.writeToProto(proto, DECOR_FRAME);
+ mOutsetFrame.writeToProto(proto, OUTSET_FRAME);
+ mContainingFrame.writeToProto(proto, CONTAINING_FRAME);
+ mFrame.writeToProto(proto, FRAME);
+ proto.end(token);
+ }
+
+ public void dump(PrintWriter pw, String prefix) {
+ pw.print(prefix); pw.print("Frames: containing=");
+ mContainingFrame.printShortString(pw);
+ pw.print(" parent="); mParentFrame.printShortString(pw);
+ pw.println();
+ pw.print(prefix); pw.print(" display=");
+ mDisplayFrame.printShortString(pw);
+ pw.print(" overscan="); mOverscanFrame.printShortString(pw);
+ pw.println();
+ pw.print(prefix); pw.print(" content=");
+ mContentFrame.printShortString(pw);
+ pw.print(" visible="); mVisibleFrame.printShortString(pw);
+ pw.println();
+ pw.print(prefix); pw.print(" decor=");
+ mDecorFrame.printShortString(pw);
+ pw.println();
+ pw.print(prefix); pw.print(" outset=");
+ mOutsetFrame.printShortString(pw);
+ pw.println();
+ pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
+ pw.print(" last="); mLastFrame.printShortString(pw);
+ pw.println();
+ }
+
+}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index f315999356a8..16ab45655d7f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1595,7 +1595,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
// We use the visible frame, because we want the animation to morph the window from what
// was visible to the user to the final destination of the new window.
- Rect frame = replacedWindow.mVisibleFrame;
+ Rect frame = replacedWindow.getVisibleFrameLw();
// We treat this as if this activity was opening, so we can trigger the app transition
// animation and piggy-back on existing transition animation infrastructure.
mOpeningApps.add(atoken);
@@ -1831,7 +1831,7 @@ public class WindowManagerService extends IWindowManager.Stub
outDisplayFrame.setEmpty();
return;
}
- outDisplayFrame.set(win.mDisplayFrame);
+ outDisplayFrame.set(win.getDisplayFrameLw());
}
}
@@ -2168,7 +2168,7 @@ public class WindowManagerService extends IWindowManager.Stub
outStableInsets.set(win.mStableInsets);
outCutout.set(win.mDisplayCutout.getDisplayCutout());
outOutsets.set(win.mOutsets);
- outBackdropFrame.set(win.getBackdropFrame(win.mFrame));
+ outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw()));
if (localLOGV) Slog.v(
TAG_WM, "Relayout given client " + client.asBinder()
+ ", requestedWidth=" + requestedWidth
@@ -7252,7 +7252,7 @@ public class WindowManagerService extends IWindowManager.Stub
synchronized (mWindowMap) {
WindowState windowState = mWindowMap.get(token);
if (windowState != null) {
- outBounds.set(windowState.mFrame);
+ outBounds.set(windowState.getFrameLw());
} else {
outBounds.setEmpty();
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index fb0c3bcb1e8f..2d44b1368fa9 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -119,15 +119,10 @@ import static com.android.server.wm.WindowStateProto.ANIMATING_EXIT;
import static com.android.server.wm.WindowStateProto.ANIMATOR;
import static com.android.server.wm.WindowStateProto.ATTRIBUTES;
import static com.android.server.wm.WindowStateProto.CHILD_WINDOWS;
-import static com.android.server.wm.WindowStateProto.CONTAINING_FRAME;
-import static com.android.server.wm.WindowStateProto.CONTENT_FRAME;
import static com.android.server.wm.WindowStateProto.CONTENT_INSETS;
import static com.android.server.wm.WindowStateProto.CUTOUT;
-import static com.android.server.wm.WindowStateProto.DECOR_FRAME;
import static com.android.server.wm.WindowStateProto.DESTROYING;
-import static com.android.server.wm.WindowStateProto.DISPLAY_FRAME;
import static com.android.server.wm.WindowStateProto.DISPLAY_ID;
-import static com.android.server.wm.WindowStateProto.FRAME;
import static com.android.server.wm.WindowStateProto.GIVEN_CONTENT_INSETS;
import static com.android.server.wm.WindowStateProto.HAS_SURFACE;
import static com.android.server.wm.WindowStateProto.IDENTIFIER;
@@ -135,10 +130,7 @@ import static com.android.server.wm.WindowStateProto.IS_ON_SCREEN;
import static com.android.server.wm.WindowStateProto.IS_READY_FOR_DISPLAY;
import static com.android.server.wm.WindowStateProto.IS_VISIBLE;
import static com.android.server.wm.WindowStateProto.OUTSETS;
-import static com.android.server.wm.WindowStateProto.OUTSET_FRAME;
-import static com.android.server.wm.WindowStateProto.OVERSCAN_FRAME;
import static com.android.server.wm.WindowStateProto.OVERSCAN_INSETS;
-import static com.android.server.wm.WindowStateProto.PARENT_FRAME;
import static com.android.server.wm.WindowStateProto.REMOVED;
import static com.android.server.wm.WindowStateProto.REMOVE_ON_EXIT;
import static com.android.server.wm.WindowStateProto.REQUESTED_HEIGHT;
@@ -149,9 +141,9 @@ import static com.android.server.wm.WindowStateProto.SURFACE_INSETS;
import static com.android.server.wm.WindowStateProto.SURFACE_POSITION;
import static com.android.server.wm.WindowStateProto.SYSTEM_UI_VISIBILITY;
import static com.android.server.wm.WindowStateProto.VIEW_VISIBILITY;
-import static com.android.server.wm.WindowStateProto.VISIBLE_FRAME;
import static com.android.server.wm.WindowStateProto.VISIBLE_INSETS;
import static com.android.server.wm.WindowStateProto.WINDOW_CONTAINER;
+import static com.android.server.wm.WindowStateProto.WINDOW_FRAMES;
import static com.android.server.wm.utils.CoordinateTransforms.transformRect;
import static com.android.server.wm.utils.CoordinateTransforms.transformToRotation;
@@ -401,50 +393,15 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
float mLastHScale=1, mLastVScale=1;
final Matrix mTmpMatrix = new Matrix();
- // "Real" frame that the application sees, in display coordinate space.
- final Rect mFrame = new Rect();
- final Rect mLastFrame = new Rect();
private boolean mFrameSizeChanged = false;
// Frame that is scaled to the application's coordinate space when in
// screen size compatibility mode.
final Rect mCompatFrame = new Rect();
- final Rect mContainingFrame = new Rect();
-
- final Rect mParentFrame = new Rect();
-
/** Whether the parent frame would have been different if there was no display cutout. */
private boolean mParentFrameWasClippedByDisplayCutout;
- // The entire screen area of the {@link TaskStack} this window is in. Usually equal to the
- // screen area of the device.
- final Rect mDisplayFrame = new Rect();
-
- // The region of the display frame that the display type supports displaying content on. This
- // is mostly a special case for TV where some displays don’t have the entire display usable.
- // {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_OVERSCAN} flag can be used to allow
- // window display contents to extend into the overscan region.
- private final Rect mOverscanFrame = new Rect();
-
- // The display frame minus the stable insets. This value is always constant regardless of if
- // the status bar or navigation bar is visible.
- private final Rect mStableFrame = new Rect();
-
- // The area not occupied by the status and navigation bars. So, if both status and navigation
- // bars are visible, the decor frame is equal to the stable frame.
- final Rect mDecorFrame = new Rect();
-
- // Equal to the decor frame if the IME (e.g. keyboard) is not present. Equal to the decor frame
- // minus the area occupied by the IME if the IME is present.
- private final Rect mContentFrame = new Rect();
-
- // Legacy stuff. Generally equal to the content frame expect when the IME for older apps
- // displays hint text.
- final Rect mVisibleFrame = new Rect();
-
- // Frame that includes dead area outside of the surface but where we want to pretend that it's
- // possible to draw.
- private final Rect mOutsetFrame = new Rect();
+ private final WindowFrames mWindowFrames = new WindowFrames();
/**
* Usually empty. Set to the task's tempInsetFrame. See
@@ -850,9 +807,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
@Override
- public void computeFrameLw(Rect parentFrame, Rect displayFrame, Rect overscanFrame,
- Rect contentFrame, Rect visibleFrame, Rect decorFrame, Rect stableFrame,
- Rect outsetFrame, WmDisplayCutout displayCutout,
+ public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout,
boolean parentFrameWasClippedByDisplayCutout) {
if (mWillReplaceWindow && (mAnimatingExit || !mReplacingRemoveRequested)) {
// This window is being replaced and either already got information that it's being
@@ -892,36 +847,39 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
final int layoutYDiff;
if (inFullscreenContainer || layoutInParentFrame()) {
// We use the parent frame as the containing frame for fullscreen and child windows
- mContainingFrame.set(parentFrame);
- mDisplayFrame.set(displayFrame);
- layoutDisplayFrame = displayFrame;
- layoutContainingFrame = parentFrame;
+ mWindowFrames.mContainingFrame.set(windowFrames.mParentFrame);
+ mWindowFrames.mDisplayFrame.set(windowFrames.mDisplayFrame);
+ layoutDisplayFrame = windowFrames.mDisplayFrame;
+ layoutContainingFrame = windowFrames.mParentFrame;
layoutXDiff = 0;
layoutYDiff = 0;
} else {
- getBounds(mContainingFrame);
+ getBounds(mWindowFrames.mContainingFrame);
if (mAppToken != null && !mAppToken.mFrozenBounds.isEmpty()) {
// If the bounds are frozen, we still want to translate the window freely and only
// freeze the size.
Rect frozen = mAppToken.mFrozenBounds.peek();
- mContainingFrame.right = mContainingFrame.left + frozen.width();
- mContainingFrame.bottom = mContainingFrame.top + frozen.height();
+ mWindowFrames.mContainingFrame.right =
+ mWindowFrames.mContainingFrame.left + frozen.width();
+ mWindowFrames.mContainingFrame.bottom =
+ mWindowFrames.mContainingFrame.top + frozen.height();
}
final WindowState imeWin = mService.mInputMethodWindow;
// IME is up and obscuring this window. Adjust the window position so it is visible.
if (imeWin != null && imeWin.isVisibleNow() && isInputMethodTarget()) {
- if (inFreeformWindowingMode()
- && mContainingFrame.bottom > contentFrame.bottom) {
+ if (inFreeformWindowingMode() && mWindowFrames.mContainingFrame.bottom
+ > windowFrames.mContentFrame.bottom) {
// In freeform we want to move the top up directly.
// TODO: Investigate why this is contentFrame not parentFrame.
- mContainingFrame.top -= mContainingFrame.bottom - contentFrame.bottom;
- } else if (!inPinnedWindowingMode()
- && mContainingFrame.bottom > parentFrame.bottom) {
+ mWindowFrames.mContainingFrame.top -= mWindowFrames.mContainingFrame.bottom
+ - windowFrames.mContentFrame.bottom;
+ } else if (!inPinnedWindowingMode() && mWindowFrames.mContainingFrame.bottom
+ > windowFrames.mParentFrame.bottom) {
// But in docked we want to behave like fullscreen and behave as if the task
// were given smaller bounds for the purposes of layout. Skip adjustments for
// the pinned stack, they are handled separately in the PinnedStackController.
- mContainingFrame.bottom = parentFrame.bottom;
+ mWindowFrames.mContainingFrame.bottom = windowFrames.mParentFrame.bottom;
}
}
@@ -929,8 +887,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// In floating modes (e.g. freeform, pinned) we have only to set the rectangle
// if it wasn't set already. No need to intersect it with the (visible)
// "content frame" since it is allowed to be outside the visible desktop.
- if (mContainingFrame.isEmpty()) {
- mContainingFrame.set(contentFrame);
+ if (mWindowFrames.mContainingFrame.isEmpty()) {
+ mWindowFrames.mContainingFrame.set(windowFrames.mContentFrame);
}
}
@@ -940,31 +898,39 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// PIP edge case: When going from pinned to fullscreen, we apply a
// tempInsetFrame for the full task - but we're still at the start of the animation.
// To prevent a jump if there's a letterbox, restrict to the parent frame.
- mInsetFrame.intersectUnchecked(parentFrame);
- mContainingFrame.intersectUnchecked(parentFrame);
+ mInsetFrame.intersectUnchecked(windowFrames.mParentFrame);
+ mWindowFrames.mContainingFrame.intersectUnchecked(windowFrames.mParentFrame);
}
- mDisplayFrame.set(mContainingFrame);
- layoutXDiff = !mInsetFrame.isEmpty() ? mInsetFrame.left - mContainingFrame.left : 0;
- layoutYDiff = !mInsetFrame.isEmpty() ? mInsetFrame.top - mContainingFrame.top : 0;
- layoutContainingFrame = !mInsetFrame.isEmpty() ? mInsetFrame : mContainingFrame;
+ mWindowFrames.mDisplayFrame.set(mWindowFrames.mContainingFrame);
+ layoutXDiff =
+ !mInsetFrame.isEmpty() ? mInsetFrame.left - mWindowFrames.mContainingFrame.left
+ : 0;
+ layoutYDiff =
+ !mInsetFrame.isEmpty() ? mInsetFrame.top - mWindowFrames.mContainingFrame.top
+ : 0;
+ layoutContainingFrame =
+ !mInsetFrame.isEmpty() ? mInsetFrame : mWindowFrames.mContainingFrame;
mTmpRect.set(0, 0, dc.getDisplayInfo().logicalWidth, dc.getDisplayInfo().logicalHeight);
- subtractInsets(mDisplayFrame, layoutContainingFrame, displayFrame, mTmpRect);
+ subtractInsets(mWindowFrames.mDisplayFrame, layoutContainingFrame,
+ windowFrames.mDisplayFrame, mTmpRect);
if (!layoutInParentFrame()) {
- subtractInsets(mContainingFrame, layoutContainingFrame, parentFrame, mTmpRect);
- subtractInsets(mInsetFrame, layoutContainingFrame, parentFrame, mTmpRect);
+ subtractInsets(mWindowFrames.mContainingFrame, layoutContainingFrame,
+ windowFrames.mParentFrame, mTmpRect);
+ subtractInsets(mInsetFrame, layoutContainingFrame, windowFrames.mParentFrame,
+ mTmpRect);
}
- layoutDisplayFrame = displayFrame;
+ layoutDisplayFrame = windowFrames.mDisplayFrame;
layoutDisplayFrame.intersect(layoutContainingFrame);
}
- final int pw = mContainingFrame.width();
- final int ph = mContainingFrame.height();
+ final int pw = mWindowFrames.mContainingFrame.width();
+ final int ph = mWindowFrames.mContainingFrame.height();
- if (!mParentFrame.equals(parentFrame)) {
+ if (!mWindowFrames.mParentFrame.equals(windowFrames.mParentFrame)) {
//Slog.i(TAG_WM, "Window " + this + " content frame from " + mParentFrame
// + " to " + parentFrame);
- mParentFrame.set(parentFrame);
+ mWindowFrames.mParentFrame.set(windowFrames.mParentFrame);
mContentChanged = true;
}
if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
@@ -973,100 +939,110 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mContentChanged = true;
}
- mOverscanFrame.set(overscanFrame);
- mContentFrame.set(contentFrame);
- mVisibleFrame.set(visibleFrame);
- mDecorFrame.set(decorFrame);
- mStableFrame.set(stableFrame);
- final boolean hasOutsets = outsetFrame != null;
+ mWindowFrames.mOverscanFrame.set(windowFrames.mOverscanFrame);
+ mWindowFrames.mContentFrame.set(windowFrames.mContentFrame);
+ mWindowFrames.mVisibleFrame.set(windowFrames.mVisibleFrame);
+ mWindowFrames.mDecorFrame.set(windowFrames.mDecorFrame);
+ mWindowFrames.mStableFrame.set(windowFrames.mStableFrame);
+ final boolean hasOutsets = !windowFrames.mOutsetFrame.isEmpty();
if (hasOutsets) {
- mOutsetFrame.set(outsetFrame);
+ mWindowFrames.mOutsetFrame.set(windowFrames.mOutsetFrame);
}
- final int fw = mFrame.width();
- final int fh = mFrame.height();
+ final int fw = mWindowFrames.mFrame.width();
+ final int fh = mWindowFrames.mFrame.height();
applyGravityAndUpdateFrame(layoutContainingFrame, layoutDisplayFrame);
// Calculate the outsets before the content frame gets shrinked to the window frame.
if (hasOutsets) {
- mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left, 0),
- Math.max(mContentFrame.top - mOutsetFrame.top, 0),
- Math.max(mOutsetFrame.right - mContentFrame.right, 0),
- Math.max(mOutsetFrame.bottom - mContentFrame.bottom, 0));
+ mOutsets.set(
+ Math.max(mWindowFrames.mContentFrame.left - mWindowFrames.mOutsetFrame.left, 0),
+ Math.max(mWindowFrames.mContentFrame.top - mWindowFrames.mOutsetFrame.top, 0),
+ Math.max(mWindowFrames.mOutsetFrame.right - mWindowFrames.mContentFrame.right,
+ 0),
+ Math.max(mWindowFrames.mOutsetFrame.bottom - mWindowFrames.mContentFrame.bottom,
+ 0));
} else {
mOutsets.set(0, 0, 0, 0);
}
// Make sure the content and visible frames are inside of the
// final window frame.
- if (windowsAreFloating && !mFrame.isEmpty()) {
+ if (windowsAreFloating && !mWindowFrames.mFrame.isEmpty()) {
// For pinned workspace the frame isn't limited in any particular
// way since SystemUI controls the bounds. For freeform however
// we want to keep things inside the content frame.
- final Rect limitFrame = task.inPinnedWindowingMode() ? mFrame : mContentFrame;
+ final Rect limitFrame = task.inPinnedWindowingMode() ? mWindowFrames.mFrame
+ : mWindowFrames.mContentFrame;
// Keep the frame out of the blocked system area, limit it in size to the content area
// and make sure that there is always a minimum visible so that the user can drag it
// into a usable area..
- final int height = Math.min(mFrame.height(), limitFrame.height());
- final int width = Math.min(limitFrame.width(), mFrame.width());
+ final int height = Math.min(mWindowFrames.mFrame.height(), limitFrame.height());
+ final int width = Math.min(limitFrame.width(), mWindowFrames.mFrame.width());
final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
final int minVisibleHeight = Math.min(height, WindowManagerService.dipToPixel(
MINIMUM_VISIBLE_HEIGHT_IN_DP, displayMetrics));
final int minVisibleWidth = Math.min(width, WindowManagerService.dipToPixel(
MINIMUM_VISIBLE_WIDTH_IN_DP, displayMetrics));
final int top = Math.max(limitFrame.top,
- Math.min(mFrame.top, limitFrame.bottom - minVisibleHeight));
+ Math.min( mWindowFrames.mFrame.top, limitFrame.bottom - minVisibleHeight));
final int left = Math.max(limitFrame.left + minVisibleWidth - width,
- Math.min(mFrame.left, limitFrame.right - minVisibleWidth));
- mFrame.set(left, top, left + width, top + height);
- mContentFrame.set(mFrame);
- mVisibleFrame.set(mContentFrame);
- mStableFrame.set(mContentFrame);
+ Math.min( mWindowFrames.mFrame.left, limitFrame.right - minVisibleWidth));
+ mWindowFrames.mFrame.set(left, top, left + width, top + height);
+ mWindowFrames.mContentFrame.set( mWindowFrames.mFrame);
+ mWindowFrames.mVisibleFrame.set(mWindowFrames.mContentFrame);
+ mWindowFrames.mStableFrame.set(mWindowFrames.mContentFrame);
} else if (mAttrs.type == TYPE_DOCK_DIVIDER) {
- dc.getDockedDividerController().positionDockedStackedDivider(mFrame);
- mContentFrame.set(mFrame);
- if (!mFrame.equals(mLastFrame)) {
+ dc.getDockedDividerController().positionDockedStackedDivider(mWindowFrames.mFrame);
+ mWindowFrames.mContentFrame.set(mWindowFrames.mFrame);
+ if (!mWindowFrames.mFrame.equals(mWindowFrames.mLastFrame)) {
mMovedByResize = true;
}
} else {
- mContentFrame.set(Math.max(mContentFrame.left, mFrame.left),
- Math.max(mContentFrame.top, mFrame.top),
- Math.min(mContentFrame.right, mFrame.right),
- Math.min(mContentFrame.bottom, mFrame.bottom));
+ mWindowFrames.mContentFrame.set(
+ Math.max(mWindowFrames.mContentFrame.left, mWindowFrames.mFrame.left),
+ Math.max(mWindowFrames.mContentFrame.top, mWindowFrames.mFrame.top),
+ Math.min(mWindowFrames.mContentFrame.right, mWindowFrames.mFrame.right),
+ Math.min(mWindowFrames.mContentFrame.bottom, mWindowFrames.mFrame.bottom));
- mVisibleFrame.set(Math.max(mVisibleFrame.left, mFrame.left),
- Math.max(mVisibleFrame.top, mFrame.top),
- Math.min(mVisibleFrame.right, mFrame.right),
- Math.min(mVisibleFrame.bottom, mFrame.bottom));
+ mWindowFrames.mVisibleFrame.set(
+ Math.max(mWindowFrames.mVisibleFrame.left, mWindowFrames.mFrame.left),
+ Math.max(mWindowFrames.mVisibleFrame.top, mWindowFrames.mFrame.top),
+ Math.min(mWindowFrames.mVisibleFrame.right, mWindowFrames.mFrame.right),
+ Math.min(mWindowFrames.mVisibleFrame.bottom, mWindowFrames.mFrame.bottom));
- mStableFrame.set(Math.max(mStableFrame.left, mFrame.left),
- Math.max(mStableFrame.top, mFrame.top),
- Math.min(mStableFrame.right, mFrame.right),
- Math.min(mStableFrame.bottom, mFrame.bottom));
+ mWindowFrames.mStableFrame.set(
+ Math.max(mWindowFrames.mStableFrame.left, mWindowFrames.mFrame.left),
+ Math.max(mWindowFrames.mStableFrame.top, mWindowFrames.mFrame.top),
+ Math.min(mWindowFrames.mStableFrame.right, mWindowFrames.mFrame.right),
+ Math.min(mWindowFrames.mStableFrame.bottom, mWindowFrames.mFrame.bottom));
}
if (inFullscreenContainer && !windowsAreFloating) {
// Windows that are not fullscreen can be positioned outside of the display frame,
// but that is not a reason to provide them with overscan insets.
- mOverscanInsets.set(Math.max(mOverscanFrame.left - layoutContainingFrame.left, 0),
- Math.max(mOverscanFrame.top - layoutContainingFrame.top, 0),
- Math.max(layoutContainingFrame.right - mOverscanFrame.right, 0),
- Math.max(layoutContainingFrame.bottom - mOverscanFrame.bottom, 0));
+ mOverscanInsets.set(
+ Math.max(mWindowFrames.mOverscanFrame.left - layoutContainingFrame.left, 0),
+ Math.max(mWindowFrames.mOverscanFrame.top - layoutContainingFrame.top, 0),
+ Math.max(layoutContainingFrame.right - mWindowFrames.mOverscanFrame.right, 0),
+ Math.max(layoutContainingFrame.bottom - mWindowFrames.mOverscanFrame.bottom,
+ 0));
}
if (mAttrs.type == TYPE_DOCK_DIVIDER) {
// For the docked divider, we calculate the stable insets like a full-screen window
// so it can use it to calculate the snap positions.
- final WmDisplayCutout c = displayCutout.calculateRelativeTo(mDisplayFrame);
- mTmpRect.set(mDisplayFrame);
+ final WmDisplayCutout c = displayCutout.calculateRelativeTo(
+ mWindowFrames.mDisplayFrame);
+ mTmpRect.set(mWindowFrames.mDisplayFrame);
mTmpRect.inset(c.getDisplayCutout().getSafeInsets());
- mTmpRect.intersectUnchecked(mStableFrame);
+ mTmpRect.intersectUnchecked(mWindowFrames.mStableFrame);
- mStableInsets.set(Math.max(mTmpRect.left - mDisplayFrame.left, 0),
- Math.max(mTmpRect.top - mDisplayFrame.top, 0),
- Math.max(mDisplayFrame.right - mTmpRect.right, 0),
- Math.max(mDisplayFrame.bottom - mTmpRect.bottom, 0));
+ mStableInsets.set(Math.max(mTmpRect.left - mWindowFrames.mDisplayFrame.left, 0),
+ Math.max(mTmpRect.top - mWindowFrames.mDisplayFrame.top, 0),
+ Math.max(mWindowFrames.mDisplayFrame.right - mTmpRect.right, 0),
+ Math.max(mWindowFrames.mDisplayFrame.bottom - mTmpRect.bottom, 0));
// The divider doesn't care about insets in any case, so set it to empty so we don't
// trigger a relayout when moving it.
@@ -1078,41 +1054,44 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// Override right and/or bottom insets in case if the frame doesn't fit the screen in
// non-fullscreen mode.
boolean overrideRightInset = !windowsAreFloating && !inFullscreenContainer
- && mFrame.right > mTmpRect.right;
+ && mWindowFrames.mFrame.right > mTmpRect.right;
boolean overrideBottomInset = !windowsAreFloating && !inFullscreenContainer
- && mFrame.bottom > mTmpRect.bottom;
- mContentInsets.set(mContentFrame.left - mFrame.left,
- mContentFrame.top - mFrame.top,
- overrideRightInset ? mTmpRect.right - mContentFrame.right
- : mFrame.right - mContentFrame.right,
- overrideBottomInset ? mTmpRect.bottom - mContentFrame.bottom
- : mFrame.bottom - mContentFrame.bottom);
-
- mVisibleInsets.set(mVisibleFrame.left - mFrame.left,
- mVisibleFrame.top - mFrame.top,
- overrideRightInset ? mTmpRect.right - mVisibleFrame.right
- : mFrame.right - mVisibleFrame.right,
- overrideBottomInset ? mTmpRect.bottom - mVisibleFrame.bottom
- : mFrame.bottom - mVisibleFrame.bottom);
-
- mStableInsets.set(Math.max(mStableFrame.left - mFrame.left, 0),
- Math.max(mStableFrame.top - mFrame.top, 0),
- overrideRightInset ? Math.max(mTmpRect.right - mStableFrame.right, 0)
- : Math.max(mFrame.right - mStableFrame.right, 0),
- overrideBottomInset ? Math.max(mTmpRect.bottom - mStableFrame.bottom, 0)
- : Math.max(mFrame.bottom - mStableFrame.bottom, 0));
- }
-
- mDisplayCutout = displayCutout.calculateRelativeTo(mFrame);
+ && mWindowFrames.mFrame.bottom > mTmpRect.bottom;
+ mContentInsets.set(mWindowFrames.mContentFrame.left - mWindowFrames.mFrame.left,
+ mWindowFrames.mContentFrame.top - mWindowFrames.mFrame.top,
+ overrideRightInset ? mTmpRect.right - mWindowFrames.mContentFrame.right
+ : mWindowFrames.mFrame.right - mWindowFrames.mContentFrame.right,
+ overrideBottomInset ? mTmpRect.bottom - mWindowFrames.mContentFrame.bottom
+ : mWindowFrames.mFrame.bottom - mWindowFrames.mContentFrame.bottom);
+
+ mVisibleInsets.set(mWindowFrames.mVisibleFrame.left - mWindowFrames.mFrame.left,
+ mWindowFrames.mVisibleFrame.top - mWindowFrames.mFrame.top,
+ overrideRightInset ? mTmpRect.right - mWindowFrames.mVisibleFrame.right
+ : mWindowFrames.mFrame.right - mWindowFrames.mVisibleFrame.right,
+ overrideBottomInset ? mTmpRect.bottom - mWindowFrames.mVisibleFrame.bottom
+ : mWindowFrames.mFrame.bottom - mWindowFrames.mVisibleFrame.bottom);
+
+ mStableInsets.set(
+ Math.max(mWindowFrames.mStableFrame.left - mWindowFrames.mFrame.left, 0),
+ Math.max(mWindowFrames.mStableFrame.top - mWindowFrames.mFrame.top, 0),
+ overrideRightInset ? Math.max(mTmpRect.right - mWindowFrames.mStableFrame.right,
+ 0) : Math.max(
+ mWindowFrames.mFrame.right - mWindowFrames.mStableFrame.right, 0),
+ overrideBottomInset ? Math.max(
+ mTmpRect.bottom - mWindowFrames.mStableFrame.bottom, 0) : Math.max(
+ mWindowFrames.mFrame.bottom - mWindowFrames.mStableFrame.bottom, 0));
+ }
+
+ mDisplayCutout = displayCutout.calculateRelativeTo(mWindowFrames.mFrame);
// Offset the actual frame by the amount layout frame is off.
- mFrame.offset(-layoutXDiff, -layoutYDiff);
+ mWindowFrames.mFrame.offset(-layoutXDiff, -layoutYDiff);
mCompatFrame.offset(-layoutXDiff, -layoutYDiff);
- mContentFrame.offset(-layoutXDiff, -layoutYDiff);
- mVisibleFrame.offset(-layoutXDiff, -layoutYDiff);
- mStableFrame.offset(-layoutXDiff, -layoutYDiff);
+ mWindowFrames.mContentFrame.offset(-layoutXDiff, -layoutYDiff);
+ mWindowFrames.mVisibleFrame.offset(-layoutXDiff, -layoutYDiff);
+ mWindowFrames.mStableFrame.offset(-layoutXDiff, -layoutYDiff);
- mCompatFrame.set(mFrame);
+ mCompatFrame.set(mWindowFrames.mFrame);
if (mEnforceSizeCompat) {
// If there is a size compatibility scale being applied to the
// window, we need to apply this to its insets so that they are
@@ -1128,12 +1107,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mCompatFrame.scale(mInvGlobalScale);
}
- if (mIsWallpaper && (fw != mFrame.width() || fh != mFrame.height())) {
+ if (mIsWallpaper && (fw != mWindowFrames.mFrame.width()
+ || fh != mWindowFrames.mFrame.height())) {
final DisplayContent displayContent = getDisplayContent();
if (displayContent != null) {
final DisplayInfo displayInfo = displayContent.getDisplayInfo();
- getDisplayContent().mWallpaperController.updateWallpaperOffset(
- this, displayInfo.logicalWidth, displayInfo.logicalHeight, false);
+ getDisplayContent().mWallpaperController.updateWallpaperOffset(this,
+ displayInfo.logicalWidth, displayInfo.logicalHeight, false);
}
}
@@ -1141,7 +1121,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
"Resolving (mRequestedWidth="
+ mRequestedWidth + ", mRequestedheight="
+ mRequestedHeight + ") to" + " (pw=" + pw + ", ph=" + ph
- + "): frame=" + mFrame.toShortString()
+ + "): frame=" + mWindowFrames.mFrame.toShortString()
+ " ci=" + mContentInsets.toShortString()
+ " vi=" + mVisibleInsets.toShortString()
+ " si=" + mStableInsets.toShortString()
@@ -1162,31 +1142,43 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
@Override
public Rect getFrameLw() {
- return mFrame;
+ return mWindowFrames.mFrame;
}
@Override
public Rect getDisplayFrameLw() {
- return mDisplayFrame;
+ return mWindowFrames.mDisplayFrame;
}
@Override
public Rect getOverscanFrameLw() {
- return mOverscanFrame;
+ return mWindowFrames.mOverscanFrame;
}
@Override
public Rect getContentFrameLw() {
- return mContentFrame;
+ return mWindowFrames.mContentFrame;
}
@Override
public Rect getVisibleFrameLw() {
- return mVisibleFrame;
+ return mWindowFrames.mVisibleFrame;
}
Rect getStableFrameLw() {
- return mStableFrame;
+ return mWindowFrames.mStableFrame;
+ }
+
+ Rect getDecorFrame() {
+ return mWindowFrames.mDecorFrame;
+ }
+
+ Rect getParentFrame() {
+ return mWindowFrames.mParentFrame;
+ }
+
+ Rect getContainingFrame() {
+ return mWindowFrames.mContainingFrame;
}
@Override
@@ -1245,8 +1237,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mVisibleInsetsChanged |= !mLastVisibleInsets.equals(mVisibleInsets);
mStableInsetsChanged |= !mLastStableInsets.equals(mStableInsets);
mOutsetsChanged |= !mLastOutsets.equals(mOutsets);
- mFrameSizeChanged |= (mLastFrame.width() != mFrame.width()) ||
- (mLastFrame.height() != mFrame.height());
+ mFrameSizeChanged |= (mWindowFrames.mLastFrame.width() != mWindowFrames.mFrame.width()) ||
+ (mWindowFrames.mLastFrame.height() != mWindowFrames.mFrame.height());
mDisplayCutoutChanged |= !mLastDisplayCutout.equals(mDisplayCutout);
return mOverscanInsetsChanged || mContentInsetsChanged || mVisibleInsetsChanged
|| mOutsetsChanged || mFrameSizeChanged || mDisplayCutoutChanged;
@@ -1282,12 +1274,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
&& !isDragResizingChangeReported();
if (localLOGV) Slog.v(TAG_WM, "Resizing " + this + ": configChanged=" + configChanged
- + " dragResizingChanged=" + dragResizingChanged + " last=" + mLastFrame
- + " frame=" + mFrame);
+ + " dragResizingChanged=" + dragResizingChanged
+ + " last=" + mWindowFrames.mLastFrame + " frame=" + mWindowFrames.mFrame);
// We update mLastFrame always rather than in the conditional with the last inset
// variables, because mFrameSizeChanged only tracks the width and height changing.
- mLastFrame.set(mFrame);
+ mWindowFrames.mLastFrame.set(mWindowFrames.mFrame);
if (mContentInsetsChanged
|| mVisibleInsetsChanged
@@ -1442,13 +1434,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
}
- bounds.set(mVisibleFrame);
+ bounds.set(mWindowFrames.mVisibleFrame);
if (intersectWithStackBounds) {
bounds.intersect(mTmpRect);
}
if (bounds.isEmpty()) {
- bounds.set(mFrame);
+ bounds.set(mWindowFrames.mFrame);
if (intersectWithStackBounds) {
bounds.intersect(mTmpRect);
}
@@ -1805,8 +1797,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// Frame has moved, containing content frame has also moved, and we're not currently
// animating... let's do something.
- final int left = mFrame.left;
- final int top = mFrame.top;
+ final int left = mWindowFrames.mFrame.left;
+ final int top = mWindowFrames.mFrame.top;
final Task task = getTask();
final boolean adjustedForMinimizedDockOrIme = task != null
&& (task.mStack.isAdjustedForMinimizedDockedStack()
@@ -1840,7 +1832,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
private boolean hasMoved() {
return mHasSurface && (mContentChanged || mMovedByResize)
&& !mAnimatingExit
- && (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)
+ && (mWindowFrames.mFrame.top != mWindowFrames.mLastFrame.top
+ || mWindowFrames.mFrame.left != mWindowFrames.mLastFrame.left)
&& (!mIsChildWindow || !getParentWindow().hasMoved());
}
@@ -1854,8 +1847,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
boolean fillsDisplay() {
final DisplayInfo displayInfo = getDisplayInfo();
- return mFrame.left <= 0 && mFrame.top <= 0
- && mFrame.right >= displayInfo.appWidth && mFrame.bottom >= displayInfo.appHeight;
+ return mWindowFrames.mFrame.left <= 0 && mWindowFrames.mFrame.top <= 0
+ && mWindowFrames.mFrame.right >= displayInfo.appWidth
+ && mWindowFrames.mFrame.bottom >= displayInfo.appHeight;
}
/** Returns true if last applied config was not yet requested by client. */
@@ -2889,10 +2883,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// All window frames that are fullscreen extend above status bar, but some don't extend
// below navigation bar. Thus, check for display frame for top/left and stable frame for
// bottom right.
- if (win.mFrame.left <= win.mDisplayFrame.left
- && win.mFrame.top <= win.mDisplayFrame.top
- && win.mFrame.right >= win.mStableFrame.right
- && win.mFrame.bottom >= win.mStableFrame.bottom) {
+ if (win.getFrameLw().left <= win.getDisplayFrameLw().left
+ && win.getFrameLw().top <= win.getDisplayFrameLw().top
+ && win.getFrameLw().right >= win.getStableFrameLw().right
+ && win.getFrameLw().bottom >= win.getStableFrameLw().bottom) {
// Is a fullscreen window, like the clock alarm. Show to everyone.
return false;
}
@@ -2909,7 +2903,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
void getTouchableRegion(Region outRegion) {
- final Rect frame = mFrame;
+ final Rect frame = mWindowFrames.mFrame;
switch (mTouchableInsets) {
default:
case TOUCHABLE_INSETS_FRAME:
@@ -2994,7 +2988,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == DRAW_PENDING)
Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");
- final Rect frame = mFrame;
+ final Rect frame = mWindowFrames.mFrame;
final Rect overscanInsets = mLastOverscanInsets;
final Rect contentInsets = mLastContentInsets;
final Rect visibleInsets = mLastVisibleInsets;
@@ -3159,7 +3153,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
*/
private boolean frameCoversEntireAppTokenBounds() {
mTmpRect.set(mAppToken.getBounds());
- mTmpRect.intersectUnchecked(mFrame);
+ mTmpRect.intersectUnchecked(mWindowFrames.mFrame);
return mAppToken.getBounds().equals(mTmpRect);
}
@@ -3261,10 +3255,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
proto.write(STACK_ID, getStackId());
mAttrs.writeToProto(proto, ATTRIBUTES);
mGivenContentInsets.writeToProto(proto, GIVEN_CONTENT_INSETS);
- mFrame.writeToProto(proto, FRAME);
- mContainingFrame.writeToProto(proto, CONTAINING_FRAME);
- mParentFrame.writeToProto(proto, PARENT_FRAME);
- mContentFrame.writeToProto(proto, CONTENT_FRAME);
+ mWindowFrames.writeToProto(proto, WINDOW_FRAMES);
mContentInsets.writeToProto(proto, CONTENT_INSETS);
mAttrs.surfaceInsets.writeToProto(proto, SURFACE_INSETS);
mSurfacePosition.writeToProto(proto, SURFACE_POSITION);
@@ -3279,11 +3270,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
proto.write(SYSTEM_UI_VISIBILITY, mSystemUiVisibility);
proto.write(HAS_SURFACE, mHasSurface);
proto.write(IS_READY_FOR_DISPLAY, isReadyForDisplay());
- mDisplayFrame.writeToProto(proto, DISPLAY_FRAME);
- mOverscanFrame.writeToProto(proto, OVERSCAN_FRAME);
- mVisibleFrame.writeToProto(proto, VISIBLE_FRAME);
- mDecorFrame.writeToProto(proto, DECOR_FRAME);
- mOutsetFrame.writeToProto(proto, OUTSET_FRAME);
mOverscanInsets.writeToProto(proto, OVERSCAN_INSETS);
mVisibleInsets.writeToProto(proto, VISIBLE_INSETS);
mStableInsets.writeToProto(proto, STABLE_INSETS);
@@ -3405,30 +3391,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
pw.print(prefix); pw.print("mHasSurface="); pw.print(mHasSurface);
pw.print(" isReadyForDisplay()="); pw.print(isReadyForDisplay());
pw.print(" mWindowRemovalAllowed="); pw.println(mWindowRemovalAllowed);
- if (dumpAll) {
- pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
- pw.print(" last="); mLastFrame.printShortString(pw);
- pw.println();
- }
if (mEnforceSizeCompat) {
pw.print(prefix); pw.print("mCompatFrame="); mCompatFrame.printShortString(pw);
pw.println();
}
if (dumpAll) {
- pw.print(prefix); pw.print("Frames: containing=");
- mContainingFrame.printShortString(pw);
- pw.print(" parent="); mParentFrame.printShortString(pw);
- pw.println();
- pw.print(prefix); pw.print(" display="); mDisplayFrame.printShortString(pw);
- pw.print(" overscan="); mOverscanFrame.printShortString(pw);
- pw.println();
- pw.print(prefix); pw.print(" content="); mContentFrame.printShortString(pw);
- pw.print(" visible="); mVisibleFrame.printShortString(pw);
- pw.println();
- pw.print(prefix); pw.print(" decor="); mDecorFrame.printShortString(pw);
- pw.println();
- pw.print(prefix); pw.print(" outset="); mOutsetFrame.printShortString(pw);
- pw.println();
+ mWindowFrames.dump(pw, prefix);
pw.print(prefix); pw.print("Cur insets: overscan=");
mOverscanInsets.printShortString(pw);
pw.print(" content="); mContentInsets.printShortString(pw);
@@ -3609,16 +3577,16 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// Set mFrame
Gravity.apply(mAttrs.gravity, w, h, containingFrame,
(int) (x + mAttrs.horizontalMargin * pw),
- (int) (y + mAttrs.verticalMargin * ph), mFrame);
+ (int) (y + mAttrs.verticalMargin * ph), mWindowFrames.mFrame);
// Now make sure the window fits in the overall display frame.
if (fitToDisplay) {
- Gravity.applyDisplay(mAttrs.gravity, displayFrame, mFrame);
+ Gravity.applyDisplay(mAttrs.gravity, displayFrame, mWindowFrames.mFrame);
}
// We need to make sure we update the CompatFrame as it is used for
// cropping decisions, etc, on systems where we lack a decor layer.
- mCompatFrame.set(mFrame);
+ mCompatFrame.set(mWindowFrames.mFrame);
if (mEnforceSizeCompat) {
// See comparable block in computeFrameLw.
mCompatFrame.scale(mInvGlobalScale);
@@ -3731,7 +3699,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
float translateToWindowX(float x) {
- float winX = x - mFrame.left;
+ float winX = x - mWindowFrames.mFrame.left;
if (mEnforceSizeCompat) {
winX *= mGlobalScale;
}
@@ -3739,7 +3707,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
float translateToWindowY(float y) {
- float winY = y - mFrame.top;
+ float winY = y - mWindowFrames.mFrame.top;
if (mEnforceSizeCompat) {
winY *= mGlobalScale;
}
@@ -4303,7 +4271,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// The decor frame is used to specify the region not covered by the system
// decorations (nav bar, status bar). In case this is empty, for example with
// FLAG_TRANSLUCENT_NAVIGATION, we don't need to do any cropping.
- if (mDecorFrame.isEmpty()) {
+ if (mWindowFrames.mDecorFrame.isEmpty()) {
return true;
}
@@ -4348,12 +4316,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* by system decorations.
*/
private void calculateSystemDecorRect(Rect systemDecorRect) {
- final Rect decorRect = mDecorFrame;
- final int width = mFrame.width();
- final int height = mFrame.height();
+ final Rect decorRect = mWindowFrames.mDecorFrame;
+ final int width = mWindowFrames.mFrame.width();
+ final int height = mWindowFrames.mFrame.height();
- final int left = mFrame.left;
- final int top = mFrame.top;
+ final int left = mWindowFrames.mFrame.left;
+ final int top = mWindowFrames.mFrame.top;
// Initialize the decor rect to the entire frame.
if (isDockedResizing()) {
@@ -4504,7 +4472,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
void startAnimation(Animation anim) {
final DisplayInfo displayInfo = getDisplayContent().getDisplayInfo();
- anim.initialize(mFrame.width(), mFrame.height(),
+ anim.initialize(mWindowFrames.mFrame.width(), mWindowFrames.mFrame.height(),
displayInfo.appWidth, displayInfo.appHeight);
anim.restrictDuration(MAX_ANIMATION_DURATION);
anim.scaleCurrentDuration(mService.getWindowAnimationScaleLocked());
@@ -4519,7 +4487,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (DEBUG_ANIM) Slog.v(TAG, "Setting move animation on " + this);
final Point oldPosition = new Point();
final Point newPosition = new Point();
- transformFrameToSurfacePosition(mLastFrame.left, mLastFrame.top, oldPosition);
+ transformFrameToSurfacePosition(mWindowFrames.mLastFrame.left, mWindowFrames.mLastFrame.top,
+ oldPosition);
transformFrameToSurfacePosition(left, top, newPosition);
final AnimationAdapter adapter = new LocalAnimationAdapter(
new MoveAnimationSpec(oldPosition.x, oldPosition.y, newPosition.x, newPosition.y),
@@ -4554,8 +4523,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
final WindowContainer parent = getParent();
if (isChildWindow()) {
final WindowState parentWindow = getParentWindow();
- x += parentWindow.mFrame.left - parentWindow.mAttrs.surfaceInsets.left;
- y += parentWindow.mFrame.top - parentWindow.mAttrs.surfaceInsets.top;
+ x += parentWindow.mWindowFrames.mFrame.left - parentWindow.mAttrs.surfaceInsets.left;
+ y += parentWindow.mWindowFrames.mFrame.top - parentWindow.mAttrs.surfaceInsets.top;
} else if (parent != null) {
final Rect parentBounds = parent.getBounds();
x += parentBounds.left;
@@ -4708,7 +4677,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return;
}
- transformFrameToSurfacePosition(mFrame.left, mFrame.top, mSurfacePosition);
+ transformFrameToSurfacePosition(mWindowFrames.mFrame.left, mWindowFrames.mFrame.top,
+ mSurfacePosition);
if (!mSurfaceAnimator.hasLeash() && !mLastSurfacePosition.equals(mSurfacePosition)) {
t.setPosition(mSurfaceControl, mSurfacePosition.x, mSurfacePosition.y);
@@ -4734,8 +4704,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// Since the parent was outset by its surface insets, we need to undo the outsetting
// with insetting by the same amount.
final WindowState parent = getParentWindow();
- outPoint.offset(-parent.mFrame.left + parent.mAttrs.surfaceInsets.left,
- -parent.mFrame.top + parent.mAttrs.surfaceInsets.top);
+ outPoint.offset(-parent.mWindowFrames.mFrame.left + parent.mAttrs.surfaceInsets.left,
+ -parent.mWindowFrames.mFrame.top + parent.mAttrs.surfaceInsets.top);
} else if (parentWindowContainer != null) {
final Rect parentBounds = parentWindowContainer.getBounds();
outPoint.offset(-parentBounds.left, -parentBounds.top);
@@ -4876,7 +4846,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// we recompute the coordinates of mFrame in the new orientation, so the surface can be
// properly placed.
transformToRotation(oldRotation, newRotation, getDisplayInfo(), transform);
- transformRect(transform, mFrame, null /* tmpRectF */);
+ transformRect(transform, mWindowFrames.mFrame, null /* tmpRectF */);
updateSurfacePosition(t);
mWinAnimator.seamlesslyRotate(t, oldRotation, newRotation);
@@ -4886,6 +4856,26 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
super.seamlesslyRotate(t, oldRotation, newRotation);
}
+ public void getMaxVisibleBounds(Rect out) {
+ if (out.isEmpty()) {
+ out.set(mWindowFrames.mVisibleFrame);
+ return;
+ }
+
+ if (mWindowFrames.mVisibleFrame.left < out.left) {
+ out.left = mWindowFrames.mVisibleFrame.left;
+ }
+ if (mWindowFrames.mVisibleFrame.top < out.top) {
+ out.top = mWindowFrames.mVisibleFrame.top;
+ }
+ if (mWindowFrames.mVisibleFrame.right > out.right) {
+ out.right = mWindowFrames.mVisibleFrame.right;
+ }
+ if (mWindowFrames.mVisibleFrame.bottom > out.bottom) {
+ out.bottom = mWindowFrames.mVisibleFrame.bottom;
+ }
+ }
+
private final class MoveAnimationSpec implements AnimationSpec {
private final long mDuration;
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 14e0e13414a9..5ba1da80abfe 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -540,13 +540,13 @@ class WindowStateAnimator {
}
if (WindowManagerService.localLOGV) Slog.v(TAG, "Got surface: " + mSurfaceController
- + ", set left=" + w.mFrame.left + " top=" + w.mFrame.top
+ + ", set left=" + w.getFrameLw().left + " top=" + w.getFrameLw().top
+ ", animLayer=" + mAnimLayer);
if (SHOW_LIGHT_TRANSACTIONS) {
Slog.i(TAG, ">>> OPEN TRANSACTION createSurfaceLocked");
WindowManagerService.logSurface(w, "CREATE pos=("
- + w.mFrame.left + "," + w.mFrame.top + ") ("
+ + w.getFrameLw().left + "," + w.getFrameLw().top + ") ("
+ width + "x" + height + "), layer=" + mAnimLayer + " HIDE", false);
}
@@ -691,7 +691,7 @@ class WindowStateAnimator {
if (screenAnimation) {
// cache often used attributes locally
- final Rect frame = mWin.mFrame;
+ final Rect frame = mWin.getFrameLw();
final float tmpFloats[] = mService.mTmpFloats;
final Matrix tmpMatrix = mWin.mTmpMatrix;
@@ -811,7 +811,7 @@ class WindowStateAnimator {
w.calculatePolicyCrop(mSystemDecorRect);
if (DEBUG_WINDOW_CROP) Slog.d(TAG, "Applying decor to crop win=" + w + " mDecorFrame="
- + w.mDecorFrame + " mSystemDecorRect=" + mSystemDecorRect);
+ + w.getDecorFrame() + " mSystemDecorRect=" + mSystemDecorRect);
final Task task = w.getTask();
final boolean fullscreen = w.fillsDisplay() || (task != null && task.isFullscreen());
@@ -931,9 +931,9 @@ class WindowStateAnimator {
// Make sure that what we're animating to and from is actually the right size in case
// the window cannot take up the full screen.
- mTmpStackBounds.intersectUnchecked(w.mParentFrame);
- mTmpSourceBounds.intersectUnchecked(w.mParentFrame);
- mTmpAnimatingBounds.intersectUnchecked(w.mParentFrame);
+ mTmpStackBounds.intersectUnchecked(w.getParentFrame());
+ mTmpSourceBounds.intersectUnchecked(w.getParentFrame());
+ mTmpAnimatingBounds.intersectUnchecked(w.getParentFrame());
if (!mTmpSourceBounds.isEmpty()) {
// Get the final target stack bounds, if we are not animating, this is just the
@@ -1504,8 +1504,8 @@ class WindowStateAnimator {
// We rotated the screen, but have not received a new buffer with the correct size yet. In
// the mean time, we rotate the buffer we have to the new orientation.
final Matrix transform = mService.mTmpTransform;
- transformToRotation(oldRotation, newRotation, w.mFrame.width(), w.mFrame.height(),
- transform);
+ transformToRotation(oldRotation, newRotation, w.getFrameLw().width(),
+ w.getFrameLw().height(), transform);
transform.getValues(mService.mTmpFloats);
float DsDx = mService.mTmpFloats[Matrix.MSCALE_X];
diff --git a/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java
index 044186f39bfc..eb6ed1924235 100644
--- a/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java
+++ b/services/tests/servicestests/src/com/android/server/policy/FakeWindowState.java
@@ -25,19 +25,12 @@ import android.view.DisplayCutout;
import android.view.IApplicationToken;
import android.view.WindowManager;
+import com.android.server.wm.WindowFrames;
import com.android.server.wm.utils.WmDisplayCutout;
public class FakeWindowState implements WindowManagerPolicy.WindowState {
- public final Rect parentFrame = new Rect();
- public final Rect displayFrame = new Rect();
- public final Rect overscanFrame = new Rect();
- public final Rect contentFrame = new Rect();
- public final Rect visibleFrame = new Rect();
- public final Rect decorFrame = new Rect();
- public final Rect stableFrame = new Rect();
- public Rect outsetFrame = new Rect();
-
+ public WindowFrames windowFrames;
public WmDisplayCutout displayCutout;
public WindowManager.LayoutParams attrs;
@@ -61,44 +54,43 @@ public class FakeWindowState implements WindowManagerPolicy.WindowState {
}
@Override
- public void computeFrameLw(Rect parentFrame, Rect displayFrame, Rect overlayFrame,
- Rect contentFrame, Rect visibleFrame, Rect decorFrame, Rect stableFrame,
- @Nullable Rect outsetFrame, WmDisplayCutout displayCutout,
+ public void computeFrameLw(WindowFrames windowFrames, WmDisplayCutout displayCutout,
boolean parentFrameWasClippedByDisplayCutout) {
- this.parentFrame.set(parentFrame);
- this.displayFrame.set(displayFrame);
- this.overscanFrame.set(overlayFrame);
- this.contentFrame.set(contentFrame);
- this.visibleFrame.set(visibleFrame);
- this.decorFrame.set(decorFrame);
- this.stableFrame.set(stableFrame);
- this.outsetFrame = outsetFrame == null ? null : new Rect(outsetFrame);
+ this.windowFrames = windowFrames;
this.displayCutout = displayCutout;
}
@Override
public Rect getFrameLw() {
- return parentFrame;
+ return windowFrames.mParentFrame;
}
@Override
public Rect getDisplayFrameLw() {
- return displayFrame;
+ return windowFrames.mDisplayFrame;
}
@Override
public Rect getOverscanFrameLw() {
- return overscanFrame;
+ return windowFrames.mOverscanFrame;
}
@Override
public Rect getContentFrameLw() {
- return contentFrame;
+ return windowFrames.mContentFrame;
}
@Override
public Rect getVisibleFrameLw() {
- return visibleFrame;
+ return windowFrames.mVisibleFrame;
+ }
+
+ public Rect getStableFrame() {
+ return windowFrames.mStableFrame;
+ }
+
+ public Rect getDecorFrame() {
+ return windowFrames.mDecorFrame;
}
@Override
diff --git a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
index cb94ec7caaca..cb9fab3fa87c 100644
--- a/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
+++ b/services/tests/servicestests/src/com/android/server/policy/PhoneWindowManagerLayoutTest.java
@@ -75,11 +75,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetBy(mAppWindow.displayFrame, 0, 0, 0, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetBy(mAppWindow.getDisplayFrameLw(), 0, 0, 0, 0);
}
@Test
@@ -90,11 +90,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.displayFrame, 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), 0, NAV_BAR_HEIGHT);
}
@Test
@@ -106,11 +106,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.displayFrame, 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), 0, NAV_BAR_HEIGHT);
}
@Test
@@ -131,11 +131,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.displayFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), 0, 0);
}
@Test
@@ -148,11 +148,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, STATUS_BAR_HEIGHT, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.displayFrame, STATUS_BAR_HEIGHT, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), STATUS_BAR_HEIGHT, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), STATUS_BAR_HEIGHT, 0);
}
@Test
@@ -165,11 +165,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetBy(mAppWindow.displayFrame, 0, 0, 0, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetBy(mAppWindow.getDisplayFrameLw(), 0, 0, 0, 0);
}
@Test
@@ -182,11 +182,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, STATUS_BAR_HEIGHT, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.displayFrame, STATUS_BAR_HEIGHT, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), STATUS_BAR_HEIGHT, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), STATUS_BAR_HEIGHT, 0);
}
@Test
@@ -200,11 +200,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.stableFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.decorFrame, 0, 0);
- assertInsetByTopBottom(mAppWindow.displayFrame, 0, 0);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getStableFrame(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDecorFrame(), 0, 0);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), 0, 0);
}
@@ -217,12 +217,12 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetBy(mAppWindow.parentFrame, DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
- assertInsetBy(mAppWindow.stableFrame, 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.contentFrame,
+ assertInsetBy(mAppWindow.getFrameLw(), DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
+ assertInsetBy(mAppWindow.getStableFrame(), 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
+ assertInsetBy(mAppWindow.getContentFrameLw(),
DISPLAY_CUTOUT_HEIGHT, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
- assertInsetBy(mAppWindow.displayFrame, DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
+ assertInsetBy(mAppWindow.getDecorFrame(), 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.getDisplayFrameLw(), DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
}
@Test
@@ -234,12 +234,12 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetBy(mAppWindow.parentFrame, 0, 0, DISPLAY_CUTOUT_HEIGHT, 0);
- assertInsetBy(mAppWindow.stableFrame, NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, 0, 0);
- assertInsetBy(mAppWindow.contentFrame,
+ assertInsetBy(mAppWindow.getFrameLw(), 0, 0, DISPLAY_CUTOUT_HEIGHT, 0);
+ assertInsetBy(mAppWindow.getStableFrame(), NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, 0, 0);
+ assertInsetBy(mAppWindow.getContentFrameLw(),
NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT, DISPLAY_CUTOUT_HEIGHT, 0);
- assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
- assertInsetBy(mAppWindow.displayFrame, 0, 0, DISPLAY_CUTOUT_HEIGHT, 0);
+ assertInsetBy(mAppWindow.getDecorFrame(), 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.getDisplayFrameLw(), 0, 0, DISPLAY_CUTOUT_HEIGHT, 0);
}
@Test
@@ -253,11 +253,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetBy(mAppWindow.parentFrame, DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
- assertInsetBy(mAppWindow.stableFrame, 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.contentFrame,
+ assertInsetBy(mAppWindow.getFrameLw(), DISPLAY_CUTOUT_HEIGHT, 0, 0, 0);
+ assertInsetBy(mAppWindow.getStableFrame(), 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
+ assertInsetBy(mAppWindow.getContentFrameLw(),
DISPLAY_CUTOUT_HEIGHT, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.getDecorFrame(), 0, 0, 0, 0);
}
@Test
@@ -273,8 +273,8 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetByTopBottom(mAppWindow.parentFrame, 0, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mAppWindow.displayFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getFrameLw(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mAppWindow.getDisplayFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
}
@Test
@@ -289,11 +289,11 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
mPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mPolicy.layoutWindowLw(mAppWindow, null, mFrames);
- assertInsetBy(mAppWindow.parentFrame, 0, 0, 0, 0);
- assertInsetBy(mAppWindow.stableFrame, 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.contentFrame,
+ assertInsetBy(mAppWindow.getFrameLw(), 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.getStableFrame(), 0, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
+ assertInsetBy(mAppWindow.getContentFrameLw(),
DISPLAY_CUTOUT_HEIGHT, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT, 0);
- assertInsetBy(mAppWindow.decorFrame, 0, 0, 0, 0);
+ assertInsetBy(mAppWindow.getDecorFrame(), 0, 0, 0, 0);
}
@Test
diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java
index 5a563320f9cb..6b410b68c45d 100644
--- a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java
@@ -51,6 +51,7 @@ public class WindowFrameTests extends WindowTestsBase {
private WindowToken mWindowToken;
private final IWindow mIWindow = new TestIWindow();
+ private final Rect mEmptyRect = new Rect();
class WindowStateWithTask extends WindowState {
final Task mTask;
@@ -160,8 +161,9 @@ public class WindowFrameTests extends WindowTestsBase {
// When mFrame extends past cf, the content insets are
// the difference between mFrame and ContentFrame. Visible
// and stable frames work the same way.
- w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame,0, 0, 1000, 1000);
+ final WindowFrames windowFrames = new WindowFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(),0, 0, 1000, 1000);
assertRect(w.mContentInsets, 0, topContentInset, 0, bottomContentInset);
assertRect(w.mVisibleInsets, 0, topVisibleInset, 0, bottomVisibleInset);
assertRect(w.mStableInsets, leftStableInset, 0, rightStableInset, 0);
@@ -169,19 +171,19 @@ public class WindowFrameTests extends WindowTestsBase {
assertTrue(cf.equals(w.getContentFrameLw()));
assertTrue(vf.equals(w.getVisibleFrameLw()));
assertTrue(sf.equals(w.getStableFrameLw()));
- // On the other hand mFrame doesn't extend past cf we won't get any insets
+ // On the other hand getFrame() doesn't extend past cf we won't get any insets
w.mAttrs.x = 100;
w.mAttrs.y = 100;
w.mAttrs.width = 100; w.mAttrs.height = 100; //have to clear MATCH_PARENT
w.mRequestedWidth = 100;
w.mRequestedHeight = 100;
- w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 100, 100, 200, 200);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 100, 100, 200, 200);
assertRect(w.mContentInsets, 0, 0, 0, 0);
// In this case the frames are shrunk to the window frame.
- assertTrue(w.mFrame.equals(w.getContentFrameLw()));
- assertTrue(w.mFrame.equals(w.getVisibleFrameLw()));
- assertTrue(w.mFrame.equals(w.getStableFrameLw()));
+ assertTrue(w.getFrameLw().equals(w.getContentFrameLw()));
+ assertTrue(w.getFrameLw().equals(w.getVisibleFrameLw()));
+ assertTrue(w.getFrameLw().equals(w.getStableFrameLw()));
}
@Test
@@ -196,25 +198,26 @@ public class WindowFrameTests extends WindowTestsBase {
// Here the window has FILL_PARENT, FILL_PARENT
// so we expect it to fill the entire available frame.
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 0, 0, 1000, 1000);
+ final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 0, 0, 1000, 1000);
// It can select various widths and heights within the bounds.
// Strangely the window attribute width is ignored for normal windows
// and we use mRequestedWidth/mRequestedHeight
w.mAttrs.width = 300;
w.mAttrs.height = 300;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
// Explicit width and height without requested width/height
// gets us nothing.
- assertRect(w.mFrame, 0, 0, 0, 0);
+ assertRect(w.getFrameLw(), 0, 0, 0, 0);
w.mRequestedWidth = 300;
w.mRequestedHeight = 300;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
// With requestedWidth/Height we can freely choose our size within the
// parent bounds.
- assertRect(w.mFrame, 0, 0, 300, 300);
+ assertRect(w.getFrameLw(), 0, 0, 300, 300);
// With FLAG_SCALED though, requestedWidth/height is used to control
// the unscaled surface size, and mAttrs.width/height becomes the
@@ -224,23 +227,23 @@ public class WindowFrameTests extends WindowTestsBase {
w.mRequestedWidth = -1;
w.mAttrs.width = 100;
w.mAttrs.height = 100;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 0, 0, 100, 100);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 0, 0, 100, 100);
w.mAttrs.flags = 0;
// But sizes too large will be clipped to the containing frame
w.mRequestedWidth = 1200;
w.mRequestedHeight = 1200;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 0, 0, 1000, 1000);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 0, 0, 1000, 1000);
// Before they are clipped though windows will be shifted
w.mAttrs.x = 300;
w.mAttrs.y = 300;
w.mRequestedWidth = 1000;
w.mRequestedHeight = 1000;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 0, 0, 1000, 1000);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 0, 0, 1000, 1000);
// If there is room to move around in the parent frame the window will be shifted according
// to gravity.
@@ -249,17 +252,17 @@ public class WindowFrameTests extends WindowTestsBase {
w.mRequestedWidth = 300;
w.mRequestedHeight = 300;
w.mAttrs.gravity = Gravity.RIGHT | Gravity.TOP;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 700, 0, 1000, 300);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 700, 0, 1000, 300);
w.mAttrs.gravity = Gravity.RIGHT | Gravity.BOTTOM;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 700, 700, 1000, 1000);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 700, 700, 1000, 1000);
// Window specified x and y are interpreted as offsets in the opposite
// direction of gravity
w.mAttrs.x = 100;
w.mAttrs.y = 100;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, 600, 600, 900, 900);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), 600, 600, 900, 900);
}
@Test
@@ -279,10 +282,11 @@ public class WindowFrameTests extends WindowTestsBase {
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight);
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, null, WmDisplayCutout.NO_CUTOUT, false);
+ final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
// For non fullscreen tasks the containing frame is based off the
// task bounds not the parent frame.
- assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom);
+ assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
assertRect(w.getContentFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
assertRect(w.mContentInsets, 0, 0, 0, 0);
@@ -291,8 +295,10 @@ public class WindowFrameTests extends WindowTestsBase {
final int cfRight = logicalWidth / 2;
final int cfBottom = logicalHeight / 2;
final Rect cf = new Rect(0, 0, cfRight, cfBottom);
- w.computeFrameLw(pf, pf, pf, cf, cf, pf, cf, null, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom);
+
+ windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
int contentInsetRight = taskRight - cfRight;
int contentInsetBottom = taskBottom - cfBottom;
assertRect(w.mContentInsets, 0, 0, contentInsetRight, contentInsetBottom);
@@ -308,8 +314,10 @@ public class WindowFrameTests extends WindowTestsBase {
final int insetRight = insetLeft + (taskRight - taskLeft);
final int insetBottom = insetTop + (taskBottom - taskTop);
task.mInsetBounds.set(insetLeft, insetTop, insetRight, insetBottom);
- w.computeFrameLw(pf, pf, pf, cf, cf, pf, cf, null, WmDisplayCutout.NO_CUTOUT, false);
- assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom);
+
+ windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
contentInsetRight = insetRight - cfRight;
contentInsetBottom = insetBottom - cfBottom;
assertRect(w.mContentInsets, 0, 0, contentInsetRight, contentInsetBottom);
@@ -340,13 +348,14 @@ public class WindowFrameTests extends WindowTestsBase {
final Rect policyCrop = new Rect();
- w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null, WmDisplayCutout.NO_CUTOUT, false);
+ final WindowFrames windowFrames = new WindowFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
w.calculatePolicyCrop(policyCrop);
assertRect(policyCrop, 0, cf.top, logicalWidth, cf.bottom);
- dcf.setEmpty();
+ windowFrames.mDecorFrame.setEmpty();
// Likewise with no decor frame we would get no crop
- w.computeFrameLw(pf, df, of, cf, vf, dcf, sf, null, WmDisplayCutout.NO_CUTOUT, false);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
w.calculatePolicyCrop(policyCrop);
assertRect(policyCrop, 0, 0, logicalWidth, logicalHeight);
@@ -354,12 +363,14 @@ public class WindowFrameTests extends WindowTestsBase {
// Normally it would be cropped to it's frame but in the case of docked resizing
// we need to account for the fact the windows surface will be made
// fullscreen and thus also make the crop fullscreen.
+
+ windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, pf);
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
w.mAttrs.width = logicalWidth / 2;
w.mAttrs.height = logicalHeight / 2;
w.mRequestedWidth = logicalWidth / 2;
w.mRequestedHeight = logicalHeight / 2;
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, WmDisplayCutout.NO_CUTOUT, false);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
w.calculatePolicyCrop(policyCrop);
// Normally the crop is shrunk from the decor frame
@@ -394,12 +405,11 @@ public class WindowFrameTests extends WindowTestsBase {
w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP;
final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight);
- w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */,
- pf /* contentFrame */, pf /* visibleFrame */, pf /* decorFrame */,
- pf /* stableFrame */, null /* outsetFrame */, WmDisplayCutout.NO_CUTOUT, false);
+ final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
// For non fullscreen tasks the containing frame is based off the
// task bounds not the parent frame.
- assertRect(w.mFrame, taskLeft, taskTop, taskRight, taskBottom);
+ assertRect(w.getFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
assertRect(w.getContentFrameLw(), taskLeft, taskTop, taskRight, taskBottom);
assertRect(w.mContentInsets, 0, 0, 0, 0);
@@ -413,10 +423,9 @@ public class WindowFrameTests extends WindowTestsBase {
pf.set(0, 0, logicalWidth, logicalHeight);
task.mFullscreenForTest = true;
- w.computeFrameLw(pf /* parentFrame */, pf /* displayFrame */, pf /* overscanFrame */,
- cf /* contentFrame */, cf /* visibleFrame */, pf /* decorFrame */,
- cf /* stableFrame */, null /* outsetFrame */, WmDisplayCutout.NO_CUTOUT, false);
- assertEquals(cf, w.mFrame);
+ windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect);
+ w.computeFrameLw(windowFrames, WmDisplayCutout.NO_CUTOUT, false);
+ assertEquals(cf, w.getFrameLw());
assertEquals(cf, w.getContentFrameLw());
assertRect(w.mContentInsets, 0, 0, 0, 0);
}
@@ -433,7 +442,8 @@ public class WindowFrameTests extends WindowTestsBase {
final WmDisplayCutout cutout = WmDisplayCutout.computeSafeInsets(
fromBoundingRect(500, 0, 550, 50), pf.width(), pf.height());
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, cutout, false);
+ final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf);
+ w.computeFrameLw(windowFrames, cutout, false);
assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetTop(), 50);
assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetBottom(), 0);
@@ -455,7 +465,8 @@ public class WindowFrameTests extends WindowTestsBase {
final WmDisplayCutout cutout = WmDisplayCutout.computeSafeInsets(
fromBoundingRect(500, 0, 550, 50), pf.width(), pf.height());
- w.computeFrameLw(pf, pf, pf, pf, pf, pf, pf, pf, cutout, false);
+ final WindowFrames windowFrames = new WindowFrames(pf, pf, pf, pf, pf, pf, pf, pf);
+ w.computeFrameLw(windowFrames, cutout, false);
assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetTop(), 50);
assertEquals(w.mDisplayCutout.getDisplayCutout().getSafeInsetBottom(), 0);
diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
index 9f113ad3137e..0ddba6ac401c 100644
--- a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java
@@ -364,15 +364,15 @@ public class WindowStateTests extends WindowTestsBase {
app.mSurfaceControl = mock(SurfaceControl.class);
app.mWinAnimator.mSurfaceController = mock(WindowSurfaceController.class);
try {
- app.mFrame.set(10, 20, 60, 80);
+ app.getFrameLw().set(10, 20, 60, 80);
app.seamlesslyRotate(t, ROTATION_0, ROTATION_90);
assertTrue(app.mSeamlesslyRotated);
assertEquals(new Rect(20, mDisplayInfo.logicalWidth - 60,
- 80, mDisplayInfo.logicalWidth - 10), app.mFrame);
+ 80, mDisplayInfo.logicalWidth - 10), app.getFrameLw());
- verify(t).setPosition(app.mSurfaceControl, app.mFrame.left, app.mFrame.top);
+ verify(t).setPosition(app.mSurfaceControl, app.getFrameLw().left, app.getFrameLw().top);
verify(app.mWinAnimator.mSurfaceController).setPosition(t, 0, 50, false);
verify(app.mWinAnimator.mSurfaceController).setMatrix(t, 0, -1, 1, 0, false);
} finally {