Debian Codegraph @

core/java/com/android/internal/statusbar/LetterboxDetails.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.internal.statusbar;
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 import android.view.InsetsFlags;
25 import android.view.ViewDebug;
26 import android.view.WindowInsetsController.Appearance;
27
28 import com.android.internal.util.DataClass;
29
30 /**
31 * Details about the letterbox state of an app.
32 */
33 @DataClass(
34 genParcelable = true,
35 genAidl = true,
36 genToString = true,
37 genGetters = false,
38 genEqualsHashCode = true
39 )
40 public class LetterboxDetails implements Parcelable {
41
42 @NonNull
43 private final Rect mLetterboxInnerBounds;
44 @NonNull
45 private final Rect mLetterboxFullBounds;
46 private final int mAppAppearance;
47
48 /**
49 * Returns the bounds of the inner letterbox (app content).
50 *
51 * <p>When an app is letterboxed, it is not using the full bounds of its window. Here we return
52 * the bounds that are being used for the app content.
53 *
54 * <pre>
55 * +-------+---------+-------+
56 * | | | |
57 * | | | |
58 * | Outer | Inner | Outer |
59 * | | | |
60 * | | | |
61 * +-------+-------- +-------+
62 * <pre>
63 */
64 @NonNull
65 public Rect getLetterboxInnerBounds() {
66 return mLetterboxInnerBounds;
67 }
68
69 /**
70 * Returns the full bounds of the letterbox.
71 *
72 * <p>These are the entire bounds of the window where the app is placed. We cannot assume that
73 * the full bounds are the bounds of the screen, as the app can be in split-screen, or can have
74 * some margin due to display cutouts.
75 *
76 * <pre>
77 * ---- Full bounds width ----
78 * +-------+---------+-------+ |
79 * | | | | |
80 * | | | | |
81 * | Outer | Inner | Outer | + Full bounds height
82 * | | | | |
83 * | | | | |
84 * +-------+-------- +-------+ |
85 * </pre>
86 */
87 @NonNull
88 public Rect getLetterboxFullBounds() {
89 return mLetterboxFullBounds;
90 }
91
92 /**
93 * Returns the {@link Appearance} of the inner letterbox (app content).
94 */
95 @Appearance
96 public int getAppAppearance() {
97 return mAppAppearance;
98 }
99
100 /** Returns a string representation of the {@link #getAppAppearance()} property. */
101 public String appAppearanceToString() {
102 return ViewDebug.flagsToString(InsetsFlags.class, "appearance", mAppAppearance);
103 }
104
105
106
107 // Code below generated by codegen v1.0.23.
108 //
109 // DO NOT MODIFY!
110 // CHECKSTYLE:OFF Generated code
111 //
112 // To regenerate run:
113 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/com/android/internal/statusbar/LetterboxDetails.java
114 //
115 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
116 // Settings > Editor > Code Style > Formatter Control
117 //@formatter:off
118
119
120 @DataClass.Generated.Member
121 public LetterboxDetails(
122 @NonNull Rect letterboxInnerBounds,
123 @NonNull Rect letterboxFullBounds,
124 int appAppearance) {
125 this.mLetterboxInnerBounds = letterboxInnerBounds;
126 com.android.internal.util.AnnotationValidations.validate(
127 NonNull.class, null, mLetterboxInnerBounds);
128 this.mLetterboxFullBounds = letterboxFullBounds;
129 com.android.internal.util.AnnotationValidations.validate(
130 NonNull.class, null, mLetterboxFullBounds);
131 this.mAppAppearance = appAppearance;
132
133 // onConstructed(); // You can define this method to get a callback
134 }
135
136 @Override
137 @DataClass.Generated.Member
138 public String toString() {
139 // You can override field toString logic by defining methods like:
140 // String fieldNameToString() { ... }
141
142 return "LetterboxDetails { " +
143 "letterboxInnerBounds = " + mLetterboxInnerBounds + ", " +
144 "letterboxFullBounds = " + mLetterboxFullBounds + ", " +
145 "appAppearance = " + appAppearanceToString() +
146 " }";
147 }
148
149 @Override
150 @DataClass.Generated.Member
151 public boolean equals(@Nullable Object o) {
152 // You can override field equality logic by defining either of the methods like:
153 // boolean fieldNameEquals(LetterboxDetails other) { ... }
154 // boolean fieldNameEquals(FieldType otherValue) { ... }
155
156 if (this == o) return true;
157 if (o == null || getClass() != o.getClass()) return false;
158 @SuppressWarnings("unchecked")
159 LetterboxDetails that = (LetterboxDetails) o;
160 //noinspection PointlessBooleanExpression
161 return true
162 && java.util.Objects.equals(mLetterboxInnerBounds, that.mLetterboxInnerBounds)
163 && java.util.Objects.equals(mLetterboxFullBounds, that.mLetterboxFullBounds)
164 && mAppAppearance == that.mAppAppearance;
165 }
166
167 @Override
168 @DataClass.Generated.Member
169 public int hashCode() {
170 // You can override field hashCode logic by defining methods like:
171 // int fieldNameHashCode() { ... }
172
173 int _hash = 1;
174 _hash = 31 * _hash + java.util.Objects.hashCode(mLetterboxInnerBounds);
175 _hash = 31 * _hash + java.util.Objects.hashCode(mLetterboxFullBounds);
176 _hash = 31 * _hash + mAppAppearance;
177 return _hash;
178 }
179
180 @Override
181 @DataClass.Generated.Member
182 public void writeToParcel(@NonNull Parcel dest, int flags) {
183 // You can override field parcelling by defining methods like:
184 // void parcelFieldName(Parcel dest, int flags) { ... }
185
186 dest.writeTypedObject(mLetterboxInnerBounds, flags);
187 dest.writeTypedObject(mLetterboxFullBounds, flags);
188 dest.writeInt(mAppAppearance);
189 }
190
191 @Override
192 @DataClass.Generated.Member
193 public int describeContents() { return 0; }
194
195 /** @hide */
196 @SuppressWarnings({"unchecked", "RedundantCast"})
197 @DataClass.Generated.Member
198 protected LetterboxDetails(@NonNull Parcel in) {
199 // You can override field unparcelling by defining methods like:
200 // static FieldType unparcelFieldName(Parcel in) { ... }
201
202 Rect letterboxInnerBounds = (Rect) in.readTypedObject(Rect.CREATOR);
203 Rect letterboxFullBounds = (Rect) in.readTypedObject(Rect.CREATOR);
204 int appAppearance = in.readInt();
205
206 this.mLetterboxInnerBounds = letterboxInnerBounds;
207 com.android.internal.util.AnnotationValidations.validate(
208 NonNull.class, null, mLetterboxInnerBounds);
209 this.mLetterboxFullBounds = letterboxFullBounds;
210 com.android.internal.util.AnnotationValidations.validate(
211 NonNull.class, null, mLetterboxFullBounds);
212 this.mAppAppearance = appAppearance;
213
214 // onConstructed(); // You can define this method to get a callback
215 }
216
217 @DataClass.Generated.Member
218 public static final @NonNull Parcelable.Creator<LetterboxDetails> CREATOR
219 = new Parcelable.Creator<LetterboxDetails>() {
220 @Override
221 public LetterboxDetails[] newArray(int size) {
222 return new LetterboxDetails[size];
223 }
224
225 @Override
226 public LetterboxDetails createFromParcel(@NonNull Parcel in) {
227 return new LetterboxDetails(in);
228 }
229 };
230
231 @DataClass.Generated(
232 time = 1656941109526L,
233 codegenVersion = "1.0.23",
234 sourceFile = "frameworks/base/core/java/com/android/internal/statusbar/LetterboxDetails.java",
235 inputSignatures = "private final @android.annotation.NonNull android.graphics.Rect mLetterboxInnerBounds\nprivate final @android.annotation.NonNull android.graphics.Rect mLetterboxFullBounds\nprivate final int mAppAppearance\npublic @android.annotation.NonNull android.graphics.Rect getLetterboxInnerBounds()\npublic @android.annotation.NonNull android.graphics.Rect getLetterboxFullBounds()\npublic @android.view.WindowInsetsController.Appearance int getAppAppearance()\npublic java.lang.String appAppearanceToString()\nclass LetterboxDetails extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=true, genToString=true, genGetters=false, genEqualsHashCode=true)")
236 @Deprecated
237 private void __metadata() {}
238
239
240 //@formatter:on
241 // End of generated code
242
243 }