| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.window; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.graphics.Rect; |
| 22 |
import android.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public class ClientWindowFrames implements Parcelable { |
| 30 |
|
| 31 |
public final @NonNull Rect frame = new Rect(); |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public final @NonNull Rect displayFrame = new Rect(); |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public final @NonNull Rect parentFrame = new Rect(); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public @Nullable Rect attachedFrame; |
| 49 |
|
| 50 |
public boolean isParentFrameClippedByDisplayCutout; |
| 51 |
|
| 52 |
public float compatScale = 1f; |
| 53 |
|
| 54 |
public ClientWindowFrames() { |
| 55 |
} |
| 56 |
|
| 57 |
public ClientWindowFrames(ClientWindowFrames other) { |
| 58 |
frame.set(other.frame); |
| 59 |
displayFrame.set(other.displayFrame); |
| 60 |
parentFrame.set(other.parentFrame); |
| 61 |
if (other.attachedFrame != null) { |
| 62 |
attachedFrame = new Rect(other.attachedFrame); |
| 63 |
} |
| 64 |
isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout; |
| 65 |
compatScale = other.compatScale; |
| 66 |
} |
| 67 |
|
| 68 |
private ClientWindowFrames(Parcel in) { |
| 69 |
readFromParcel(in); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
public void readFromParcel(Parcel in) { |
| 74 |
frame.readFromParcel(in); |
| 75 |
displayFrame.readFromParcel(in); |
| 76 |
parentFrame.readFromParcel(in); |
| 77 |
attachedFrame = in.readTypedObject(Rect.CREATOR); |
| 78 |
isParentFrameClippedByDisplayCutout = in.readBoolean(); |
| 79 |
compatScale = in.readFloat(); |
| 80 |
} |
| 81 |
|
| 82 |
@Override |
| 83 |
public void writeToParcel(Parcel dest, int flags) { |
| 84 |
frame.writeToParcel(dest, flags); |
| 85 |
displayFrame.writeToParcel(dest, flags); |
| 86 |
parentFrame.writeToParcel(dest, flags); |
| 87 |
dest.writeTypedObject(attachedFrame, flags); |
| 88 |
dest.writeBoolean(isParentFrameClippedByDisplayCutout); |
| 89 |
dest.writeFloat(compatScale); |
| 90 |
} |
| 91 |
|
| 92 |
@Override |
| 93 |
public String toString() { |
| 94 |
final StringBuilder sb = new StringBuilder(32); |
| 95 |
return "ClientWindowFrames{frame=" + frame.toShortString(sb) |
| 96 |
+ " display=" + displayFrame.toShortString(sb) |
| 97 |
+ " parentFrame=" + parentFrame.toShortString(sb) |
| 98 |
+ (attachedFrame != null ? " attachedFrame=" + attachedFrame.toShortString() : "") |
| 99 |
+ (isParentFrameClippedByDisplayCutout ? " parentClippedByDisplayCutout" : "") |
| 100 |
+ (compatScale != 1f ? " sizeCompatScale=" + compatScale : "") + "}"; |
| 101 |
} |
| 102 |
|
| 103 |
@Override |
| 104 |
public int describeContents() { |
| 105 |
return 0; |
| 106 |
} |
| 107 |
|
| 108 |
public static final Creator<ClientWindowFrames> CREATOR = new Creator<ClientWindowFrames>() { |
| 109 |
public ClientWindowFrames createFromParcel(Parcel in) { |
| 110 |
return new ClientWindowFrames(in); |
| 111 |
} |
| 112 |
|
| 113 |
public ClientWindowFrames[] newArray(int size) { |
| 114 |
return new ClientWindowFrames[size]; |
| 115 |
} |
| 116 |
}; |
| 117 |
} |