summaryrefslogtreecommitdiff
path: root/core/java/android/window/ClientWindowFrames.java
diff options
context:
space:
mode:
authorTiger Huang <tigerhuang@google.com>2022-03-14 22:30:45 +0800
committerTiger Huang <tigerhuang@google.com>2022-03-14 22:30:45 +0800
commit45790587c729db89fc366d85ba45bc7081ea7d9c (patch)
tree5d11f53c11e2415cd01a14bf3211fbad2a8d51fe /core/java/android/window/ClientWindowFrames.java
parent54102c21f22fce1729133719d4b83d9ae14bcdcf (diff)
Use ClientWindowFrames to collect frames computed by WindowLayout
This is a step to move the window layout to the client side. ClientWindowFrames is used to carry window frames dispatched from the server to the client for now. Later, the window frames will be computed at the client side, and the frames will be sent to the server side via ClientWindowFrames. Bug: 161810301 Test: presubmit (no behavior change but only code refactors) Change-Id: I83d8cfff2432e09759ef5b3d5f3b21731fc71bff
Diffstat (limited to 'core/java/android/window/ClientWindowFrames.java')
-rw-r--r--core/java/android/window/ClientWindowFrames.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/core/java/android/window/ClientWindowFrames.java b/core/java/android/window/ClientWindowFrames.java
index acf9882e6658..5b915cc22ec5 100644
--- a/core/java/android/window/ClientWindowFrames.java
+++ b/core/java/android/window/ClientWindowFrames.java
@@ -27,47 +27,55 @@ import android.os.Parcelable;
*/
public class ClientWindowFrames implements Parcelable {
/** The actual window bounds. */
- public final @NonNull Rect frame;
+ public final @NonNull Rect frame = new Rect();
/**
* The container frame that is usually the same as display size. It may exclude the area of
* insets if the window layout parameter has specified fit-insets-sides.
*/
- public final @NonNull Rect displayFrame;
+ public final @NonNull Rect displayFrame = new Rect();
+
+ /**
+ * The frame to be referenced while applying gravity and MATCH_PARENT.
+ */
+ public final @NonNull Rect parentFrame = new Rect();
/** The background area while the window is resizing. */
- public final @NonNull Rect backdropFrame;
+ public final @NonNull Rect backdropFrame = new Rect();
+
+ public boolean isParentFrameClippedByDisplayCutout;
public ClientWindowFrames() {
- frame = new Rect();
- displayFrame = new Rect();
- backdropFrame = new Rect();
}
public ClientWindowFrames(ClientWindowFrames other) {
- frame = new Rect(other.frame);
- displayFrame = new Rect(other.displayFrame);
- backdropFrame = new Rect(other.backdropFrame);
+ frame.set(other.frame);
+ displayFrame.set(other.displayFrame);
+ parentFrame.set(other.parentFrame);
+ backdropFrame.set(other.backdropFrame);
+ isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout;
}
private ClientWindowFrames(Parcel in) {
- frame = Rect.CREATOR.createFromParcel(in);
- displayFrame = Rect.CREATOR.createFromParcel(in);
- backdropFrame = Rect.CREATOR.createFromParcel(in);
+ readFromParcel(in);
}
/** Needed for AIDL out parameters. */
public void readFromParcel(Parcel in) {
frame.readFromParcel(in);
displayFrame.readFromParcel(in);
+ parentFrame.readFromParcel(in);
backdropFrame.readFromParcel(in);
+ isParentFrameClippedByDisplayCutout = in.readBoolean();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
frame.writeToParcel(dest, flags);
displayFrame.writeToParcel(dest, flags);
+ parentFrame.writeToParcel(dest, flags);
backdropFrame.writeToParcel(dest, flags);
+ dest.writeBoolean(isParentFrameClippedByDisplayCutout);
}
@Override
@@ -75,7 +83,9 @@ public class ClientWindowFrames implements Parcelable {
final StringBuilder sb = new StringBuilder(32);
return "ClientWindowFrames{frame=" + frame.toShortString(sb)
+ " display=" + displayFrame.toShortString(sb)
- + " backdrop=" + backdropFrame.toShortString(sb) + "}";
+ + " parentFrame=" + parentFrame.toShortString(sb)
+ + " backdrop=" + backdropFrame.toShortString(sb)
+ + " parentClippedByDisplayCutout=" + isParentFrameClippedByDisplayCutout + "}";
}
@Override