Debian Codegraph @

core/java/android/service/rotationresolver/RotationResolutionRequest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2021 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 android.service.rotationresolver;
18
19 import android.annotation.DurationMillisLong;
20 import android.annotation.NonNull;
21 import android.annotation.SystemApi;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 import android.view.Surface;
25
26 import com.android.internal.util.DataClass;
27
28 /**
29 * This class represents a request to an {@link RotationResolverService}. The request contains
30 * information from the system that can help RotationResolverService to determine the appropriate
31 * screen rotation.
32 *
33 * @see RotationResolverService#resolveRotation(IRotationResolverCallback,
34 * RotationResolutionRequest, ICancellationSignal)
35 *
36 * @hide
37 */
38 @SystemApi
39 @DataClass (
40 genParcelable = true,
41 genToString = true
42 )
43 public final class RotationResolutionRequest implements Parcelable {
44 /** The Name of the package of the current fore-ground activity. */
45 @NonNull private final String mForegroundPackageName;
46
47 /** The current rotation of the screen. */
48 @Surface.Rotation private final int mCurrentRotation;
49
50 /** The proposed screen rotation in the system. */
51 @Surface.Rotation private final int mProposedRotation;
52
53 /** Whether should use the camera sensor to resolve screen rotation. */
54 private final boolean mShouldUseCamera;
55
56 /** The timeout of the request. */
57 @DurationMillisLong private final long mTimeoutMillis;
58
59
60
61
62 // Code below generated by codegen v1.0.23.
63 //
64 // DO NOT MODIFY!
65 // CHECKSTYLE:OFF Generated code
66 //
67 // To regenerate run:
68 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/rotationresolver/RotationResolutionRequest.java
69 //
70 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
71 // Settings > Editor > Code Style > Formatter Control
72 //@formatter:off
73
74
75 /**
76 * Creates a new RotationResolutionRequest.
77 *
78 * @param foregroundPackageName
79 * The Name of the package of the current fore-ground activity.
80 * @param currentRotation
81 * The current rotation of the screen.
82 * @param proposedRotation
83 * The proposed screen rotation in the system.
84 * @param shouldUseCamera
85 * Whether should use the camera sensor to resolve screen rotation.
86 * @param timeoutMillis
87 * The timeout of the request.
88 */
89 @DataClass.Generated.Member
90 public RotationResolutionRequest(
91 @NonNull String foregroundPackageName,
92 @Surface.Rotation int currentRotation,
93 @Surface.Rotation int proposedRotation,
94 boolean shouldUseCamera,
95 @DurationMillisLong long timeoutMillis) {
96 this.mForegroundPackageName = foregroundPackageName;
97 com.android.internal.util.AnnotationValidations.validate(
98 NonNull.class, null, mForegroundPackageName);
99 this.mCurrentRotation = currentRotation;
100 com.android.internal.util.AnnotationValidations.validate(
101 Surface.Rotation.class, null, mCurrentRotation);
102 this.mProposedRotation = proposedRotation;
103 com.android.internal.util.AnnotationValidations.validate(
104 Surface.Rotation.class, null, mProposedRotation);
105 this.mShouldUseCamera = shouldUseCamera;
106 this.mTimeoutMillis = timeoutMillis;
107 com.android.internal.util.AnnotationValidations.validate(
108 DurationMillisLong.class, null, mTimeoutMillis);
109
110 // onConstructed(); // You can define this method to get a callback
111 }
112
113 /**
114 * The Name of the package of the current fore-ground activity.
115 */
116 @DataClass.Generated.Member
117 public @NonNull String getForegroundPackageName() {
118 return mForegroundPackageName;
119 }
120
121 /**
122 * The current rotation of the screen.
123 */
124 @DataClass.Generated.Member
125 public @Surface.Rotation int getCurrentRotation() {
126 return mCurrentRotation;
127 }
128
129 /**
130 * The proposed screen rotation in the system.
131 */
132 @DataClass.Generated.Member
133 public @Surface.Rotation int getProposedRotation() {
134 return mProposedRotation;
135 }
136
137 /**
138 * Whether should use the camera sensor to resolve screen rotation.
139 */
140 @DataClass.Generated.Member
141 public boolean shouldUseCamera() {
142 return mShouldUseCamera;
143 }
144
145 /**
146 * The timeout of the request.
147 */
148 @DataClass.Generated.Member
149 public @DurationMillisLong long getTimeoutMillis() {
150 return mTimeoutMillis;
151 }
152
153 @Override
154 @DataClass.Generated.Member
155 public String toString() {
156 // You can override field toString logic by defining methods like:
157 // String fieldNameToString() { ... }
158
159 return "RotationResolutionRequest { " +
160 "foregroundPackageName = " + mForegroundPackageName + ", " +
161 "currentRotation = " + mCurrentRotation + ", " +
162 "proposedRotation = " + mProposedRotation + ", " +
163 "shouldUseCamera = " + mShouldUseCamera + ", " +
164 "timeoutMillis = " + mTimeoutMillis +
165 " }";
166 }
167
168 @Override
169 @DataClass.Generated.Member
170 public void writeToParcel(@NonNull Parcel dest, int flags) {
171 // You can override field parcelling by defining methods like:
172 // void parcelFieldName(Parcel dest, int flags) { ... }
173
174 byte flg = 0;
175 if (mShouldUseCamera) flg |= 0x8;
176 dest.writeByte(flg);
177 dest.writeString(mForegroundPackageName);
178 dest.writeInt(mCurrentRotation);
179 dest.writeInt(mProposedRotation);
180 dest.writeLong(mTimeoutMillis);
181 }
182
183 @Override
184 @DataClass.Generated.Member
185 public int describeContents() { return 0; }
186
187 /** @hide */
188 @SuppressWarnings({"unchecked", "RedundantCast"})
189 @DataClass.Generated.Member
190 /* package-private */ RotationResolutionRequest(@NonNull Parcel in) {
191 // You can override field unparcelling by defining methods like:
192 // static FieldType unparcelFieldName(Parcel in) { ... }
193
194 byte flg = in.readByte();
195 boolean shouldUseCamera = (flg & 0x8) != 0;
196 String foregroundPackageName = in.readString();
197 int currentRotation = in.readInt();
198 int proposedRotation = in.readInt();
199 long timeoutMillis = in.readLong();
200
201 this.mForegroundPackageName = foregroundPackageName;
202 com.android.internal.util.AnnotationValidations.validate(
203 NonNull.class, null, mForegroundPackageName);
204 this.mCurrentRotation = currentRotation;
205 com.android.internal.util.AnnotationValidations.validate(
206 Surface.Rotation.class, null, mCurrentRotation);
207 this.mProposedRotation = proposedRotation;
208 com.android.internal.util.AnnotationValidations.validate(
209 Surface.Rotation.class, null, mProposedRotation);
210 this.mShouldUseCamera = shouldUseCamera;
211 this.mTimeoutMillis = timeoutMillis;
212 com.android.internal.util.AnnotationValidations.validate(
213 DurationMillisLong.class, null, mTimeoutMillis);
214
215 // onConstructed(); // You can define this method to get a callback
216 }
217
218 @DataClass.Generated.Member
219 public static final @NonNull Parcelable.Creator<RotationResolutionRequest> CREATOR
220 = new Parcelable.Creator<RotationResolutionRequest>() {
221 @Override
222 public RotationResolutionRequest[] newArray(int size) {
223 return new RotationResolutionRequest[size];
224 }
225
226 @Override
227 public RotationResolutionRequest createFromParcel(@NonNull Parcel in) {
228 return new RotationResolutionRequest(in);
229 }
230 };
231
232 @DataClass.Generated(
233 time = 1618447759819L,
234 codegenVersion = "1.0.23",
235 sourceFile = "frameworks/base/core/java/android/service/rotationresolver/RotationResolutionRequest.java",
236 inputSignatures = "private final @android.annotation.NonNull java.lang.String mForegroundPackageName\nprivate final @android.view.Surface.Rotation int mCurrentRotation\nprivate final @android.view.Surface.Rotation int mProposedRotation\nprivate final boolean mShouldUseCamera\nprivate final @android.annotation.DurationMillisLong long mTimeoutMillis\nclass RotationResolutionRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genToString=true)")
237 @Deprecated
238 private void __metadata() {}
239
240
241 //@formatter:on
242 // End of generated code
243
244 }