• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.window;
18 
19 import static android.view.WindowManager.transitTypeToString;
20 
21 import android.annotation.Nullable;
22 import android.app.ActivityManager;
23 import android.app.WindowConfiguration;
24 import android.graphics.Rect;
25 import android.os.Parcelable;
26 import android.view.WindowManager;
27 
28 import com.android.internal.util.DataClass;
29 
30 /**
31  * Used to communicate information about what is changing during a transition to a TransitionPlayer.
32  * @hide
33  */
34 @DataClass(genToString = true, genSetters = true, genAidl = true)
35 public final class TransitionRequestInfo implements Parcelable {
36 
37     /** The type of the transition being requested. */
38     private final @WindowManager.TransitionType int mType;
39 
40     /**
41      * If non-null, If non-null, the task containing the activity whose lifecycle change (start or
42      * finish) has caused this transition to occur.
43      */
44     private @Nullable ActivityManager.RunningTaskInfo mTriggerTask;
45 
46     /** If non-null, a remote-transition associated with the source of this transition. */
47     private @Nullable RemoteTransition mRemoteTransition;
48 
49     /**
50      * If non-null, this request was triggered by this display change. This will not be complete:
51      * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
52      * (if size is changing).
53      */
54     private @Nullable DisplayChange mDisplayChange;
55 
56     /** constructor override */
TransitionRequestInfo( @indowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition)57     public TransitionRequestInfo(
58             @WindowManager.TransitionType int type,
59             @Nullable ActivityManager.RunningTaskInfo triggerTask,
60             @Nullable RemoteTransition remoteTransition) {
61         this(type, triggerTask, remoteTransition, null /* displayChange */);
62     }
63 
64     /** Requested change to a display. */
65     @DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false)
66     public static class DisplayChange implements Parcelable {
67         private final int mDisplayId;
68         @Nullable private Rect mStartAbsBounds = null;
69         @Nullable private Rect mEndAbsBounds = null;
70         private int mStartRotation = WindowConfiguration.ROTATION_UNDEFINED;
71         private int mEndRotation = WindowConfiguration.ROTATION_UNDEFINED;
72         private boolean mPhysicalDisplayChanged = false;
73 
74         /** Create empty display-change. */
DisplayChange(int displayId)75         public DisplayChange(int displayId) {
76             mDisplayId = displayId;
77         }
78 
79         /** Create a display-change representing a rotation. */
DisplayChange(int displayId, int startRotation, int endRotation)80         public DisplayChange(int displayId, int startRotation, int endRotation) {
81             mDisplayId = displayId;
82             mStartRotation = startRotation;
83             mEndRotation = endRotation;
84         }
85 
86 
87 
88         // Code below generated by codegen v1.0.23.
89         //
90         // DO NOT MODIFY!
91         // CHECKSTYLE:OFF Generated code
92         //
93         // To regenerate run:
94         // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/window/TransitionRequestInfo.java
95         //
96         // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
97         //   Settings > Editor > Code Style > Formatter Control
98         //@formatter:off
99 
100 
101         @DataClass.Generated.Member
getDisplayId()102         public int getDisplayId() {
103             return mDisplayId;
104         }
105 
106         @DataClass.Generated.Member
getStartAbsBounds()107         public @Nullable Rect getStartAbsBounds() {
108             return mStartAbsBounds;
109         }
110 
111         @DataClass.Generated.Member
getEndAbsBounds()112         public @Nullable Rect getEndAbsBounds() {
113             return mEndAbsBounds;
114         }
115 
116         @DataClass.Generated.Member
getStartRotation()117         public int getStartRotation() {
118             return mStartRotation;
119         }
120 
121         @DataClass.Generated.Member
getEndRotation()122         public int getEndRotation() {
123             return mEndRotation;
124         }
125 
126         @DataClass.Generated.Member
isPhysicalDisplayChanged()127         public boolean isPhysicalDisplayChanged() {
128             return mPhysicalDisplayChanged;
129         }
130 
131         @DataClass.Generated.Member
setStartAbsBounds(@ndroid.annotation.NonNull Rect value)132         public @android.annotation.NonNull DisplayChange setStartAbsBounds(@android.annotation.NonNull Rect value) {
133             mStartAbsBounds = value;
134             return this;
135         }
136 
137         @DataClass.Generated.Member
setEndAbsBounds(@ndroid.annotation.NonNull Rect value)138         public @android.annotation.NonNull DisplayChange setEndAbsBounds(@android.annotation.NonNull Rect value) {
139             mEndAbsBounds = value;
140             return this;
141         }
142 
143         @DataClass.Generated.Member
setStartRotation( int value)144         public @android.annotation.NonNull DisplayChange setStartRotation( int value) {
145             mStartRotation = value;
146             return this;
147         }
148 
149         @DataClass.Generated.Member
setEndRotation( int value)150         public @android.annotation.NonNull DisplayChange setEndRotation( int value) {
151             mEndRotation = value;
152             return this;
153         }
154 
155         @DataClass.Generated.Member
setPhysicalDisplayChanged( boolean value)156         public @android.annotation.NonNull DisplayChange setPhysicalDisplayChanged( boolean value) {
157             mPhysicalDisplayChanged = value;
158             return this;
159         }
160 
161         @Override
162         @DataClass.Generated.Member
toString()163         public String toString() {
164             // You can override field toString logic by defining methods like:
165             // String fieldNameToString() { ... }
166 
167             return "DisplayChange { " +
168                     "displayId = " + mDisplayId + ", " +
169                     "startAbsBounds = " + mStartAbsBounds + ", " +
170                     "endAbsBounds = " + mEndAbsBounds + ", " +
171                     "startRotation = " + mStartRotation + ", " +
172                     "endRotation = " + mEndRotation + ", " +
173                     "physicalDisplayChanged = " + mPhysicalDisplayChanged +
174             " }";
175         }
176 
177         @Override
178         @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)179         public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
180             // You can override field parcelling by defining methods like:
181             // void parcelFieldName(Parcel dest, int flags) { ... }
182 
183             byte flg = 0;
184             if (mPhysicalDisplayChanged) flg |= 0x20;
185             if (mStartAbsBounds != null) flg |= 0x2;
186             if (mEndAbsBounds != null) flg |= 0x4;
187             dest.writeByte(flg);
188             dest.writeInt(mDisplayId);
189             if (mStartAbsBounds != null) dest.writeTypedObject(mStartAbsBounds, flags);
190             if (mEndAbsBounds != null) dest.writeTypedObject(mEndAbsBounds, flags);
191             dest.writeInt(mStartRotation);
192             dest.writeInt(mEndRotation);
193         }
194 
195         @Override
196         @DataClass.Generated.Member
describeContents()197         public int describeContents() { return 0; }
198 
199         /** @hide */
200         @SuppressWarnings({"unchecked", "RedundantCast"})
201         @DataClass.Generated.Member
DisplayChange(@ndroid.annotation.NonNull android.os.Parcel in)202         protected DisplayChange(@android.annotation.NonNull android.os.Parcel in) {
203             // You can override field unparcelling by defining methods like:
204             // static FieldType unparcelFieldName(Parcel in) { ... }
205 
206             byte flg = in.readByte();
207             boolean physicalDisplayChanged = (flg & 0x20) != 0;
208             int displayId = in.readInt();
209             Rect startAbsBounds = (flg & 0x2) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR);
210             Rect endAbsBounds = (flg & 0x4) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR);
211             int startRotation = in.readInt();
212             int endRotation = in.readInt();
213 
214             this.mDisplayId = displayId;
215             this.mStartAbsBounds = startAbsBounds;
216             this.mEndAbsBounds = endAbsBounds;
217             this.mStartRotation = startRotation;
218             this.mEndRotation = endRotation;
219             this.mPhysicalDisplayChanged = physicalDisplayChanged;
220 
221             // onConstructed(); // You can define this method to get a callback
222         }
223 
224         @DataClass.Generated.Member
225         public static final @android.annotation.NonNull Parcelable.Creator<DisplayChange> CREATOR
226                 = new Parcelable.Creator<DisplayChange>() {
227             @Override
228             public DisplayChange[] newArray(int size) {
229                 return new DisplayChange[size];
230             }
231 
232             @Override
233             public DisplayChange createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
234                 return new DisplayChange(in);
235             }
236         };
237 
238         @DataClass.Generated(
239                 time = 1648141181315L,
240                 codegenVersion = "1.0.23",
241                 sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java",
242                 inputSignatures = "private final  int mDisplayId\nprivate @android.annotation.Nullable android.graphics.Rect mStartAbsBounds\nprivate @android.annotation.Nullable android.graphics.Rect mEndAbsBounds\nprivate  int mStartRotation\nprivate  int mEndRotation\nprivate  boolean mPhysicalDisplayChanged\nclass DisplayChange extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genBuilder=false, genConstructor=false)")
243         @Deprecated
__metadata()244         private void __metadata() {}
245 
246 
247         //@formatter:on
248         // End of generated code
249 
250     }
251 
252 
253 
254 
255     // Code below generated by codegen v1.0.23.
256     //
257     // DO NOT MODIFY!
258     // CHECKSTYLE:OFF Generated code
259     //
260     // To regenerate run:
261     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/window/TransitionRequestInfo.java
262     //
263     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
264     //   Settings > Editor > Code Style > Formatter Control
265     //@formatter:off
266 
267 
268     /**
269      * Creates a new TransitionRequestInfo.
270      *
271      * @param type
272      *   The type of the transition being requested.
273      * @param triggerTask
274      *   If non-null, If non-null, the task containing the activity whose lifecycle change (start or
275      *   finish) has caused this transition to occur.
276      * @param remoteTransition
277      *   If non-null, a remote-transition associated with the source of this transition.
278      * @param displayChange
279      *   If non-null, this request was triggered by this display change. This will not be complete:
280      *   The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
281      *   (if size is changing).
282      */
283     @DataClass.Generated.Member
TransitionRequestInfo( @indowManager.TransitionType int type, @Nullable ActivityManager.RunningTaskInfo triggerTask, @Nullable RemoteTransition remoteTransition, @Nullable DisplayChange displayChange)284     public TransitionRequestInfo(
285             @WindowManager.TransitionType int type,
286             @Nullable ActivityManager.RunningTaskInfo triggerTask,
287             @Nullable RemoteTransition remoteTransition,
288             @Nullable DisplayChange displayChange) {
289         this.mType = type;
290         com.android.internal.util.AnnotationValidations.validate(
291                 WindowManager.TransitionType.class, null, mType);
292         this.mTriggerTask = triggerTask;
293         this.mRemoteTransition = remoteTransition;
294         this.mDisplayChange = displayChange;
295 
296         // onConstructed(); // You can define this method to get a callback
297     }
298 
299     /**
300      * The type of the transition being requested.
301      */
302     @DataClass.Generated.Member
getType()303     public @WindowManager.TransitionType int getType() {
304         return mType;
305     }
306 
307     /**
308      * If non-null, If non-null, the task containing the activity whose lifecycle change (start or
309      * finish) has caused this transition to occur.
310      */
311     @DataClass.Generated.Member
getTriggerTask()312     public @Nullable ActivityManager.RunningTaskInfo getTriggerTask() {
313         return mTriggerTask;
314     }
315 
316     /**
317      * If non-null, a remote-transition associated with the source of this transition.
318      */
319     @DataClass.Generated.Member
getRemoteTransition()320     public @Nullable RemoteTransition getRemoteTransition() {
321         return mRemoteTransition;
322     }
323 
324     /**
325      * If non-null, this request was triggered by this display change. This will not be complete:
326      * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
327      * (if size is changing).
328      */
329     @DataClass.Generated.Member
getDisplayChange()330     public @Nullable DisplayChange getDisplayChange() {
331         return mDisplayChange;
332     }
333 
334     /**
335      * If non-null, If non-null, the task containing the activity whose lifecycle change (start or
336      * finish) has caused this transition to occur.
337      */
338     @DataClass.Generated.Member
setTriggerTask(@ndroid.annotation.NonNull ActivityManager.RunningTaskInfo value)339     public @android.annotation.NonNull TransitionRequestInfo setTriggerTask(@android.annotation.NonNull ActivityManager.RunningTaskInfo value) {
340         mTriggerTask = value;
341         return this;
342     }
343 
344     /**
345      * If non-null, a remote-transition associated with the source of this transition.
346      */
347     @DataClass.Generated.Member
setRemoteTransition(@ndroid.annotation.NonNull RemoteTransition value)348     public @android.annotation.NonNull TransitionRequestInfo setRemoteTransition(@android.annotation.NonNull RemoteTransition value) {
349         mRemoteTransition = value;
350         return this;
351     }
352 
353     /**
354      * If non-null, this request was triggered by this display change. This will not be complete:
355      * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
356      * (if size is changing).
357      */
358     @DataClass.Generated.Member
setDisplayChange(@ndroid.annotation.NonNull DisplayChange value)359     public @android.annotation.NonNull TransitionRequestInfo setDisplayChange(@android.annotation.NonNull DisplayChange value) {
360         mDisplayChange = value;
361         return this;
362     }
363 
364     @Override
365     @DataClass.Generated.Member
toString()366     public String toString() {
367         // You can override field toString logic by defining methods like:
368         // String fieldNameToString() { ... }
369 
370         return "TransitionRequestInfo { " +
371                 "type = " + transitTypeToString(mType) + ", " +
372                 "triggerTask = " + mTriggerTask + ", " +
373                 "remoteTransition = " + mRemoteTransition + ", " +
374                 "displayChange = " + mDisplayChange +
375         " }";
376     }
377 
378     @Override
379     @DataClass.Generated.Member
writeToParcel(@ndroid.annotation.NonNull android.os.Parcel dest, int flags)380     public void writeToParcel(@android.annotation.NonNull android.os.Parcel dest, int flags) {
381         // You can override field parcelling by defining methods like:
382         // void parcelFieldName(Parcel dest, int flags) { ... }
383 
384         byte flg = 0;
385         if (mTriggerTask != null) flg |= 0x2;
386         if (mRemoteTransition != null) flg |= 0x4;
387         if (mDisplayChange != null) flg |= 0x8;
388         dest.writeByte(flg);
389         dest.writeInt(mType);
390         if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags);
391         if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags);
392         if (mDisplayChange != null) dest.writeTypedObject(mDisplayChange, flags);
393     }
394 
395     @Override
396     @DataClass.Generated.Member
describeContents()397     public int describeContents() { return 0; }
398 
399     /** @hide */
400     @SuppressWarnings({"unchecked", "RedundantCast"})
401     @DataClass.Generated.Member
TransitionRequestInfo(@ndroid.annotation.NonNull android.os.Parcel in)402     /* package-private */ TransitionRequestInfo(@android.annotation.NonNull android.os.Parcel in) {
403         // You can override field unparcelling by defining methods like:
404         // static FieldType unparcelFieldName(Parcel in) { ... }
405 
406         byte flg = in.readByte();
407         int type = in.readInt();
408         ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
409         RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR);
410         DisplayChange displayChange = (flg & 0x8) == 0 ? null : (DisplayChange) in.readTypedObject(DisplayChange.CREATOR);
411 
412         this.mType = type;
413         com.android.internal.util.AnnotationValidations.validate(
414                 WindowManager.TransitionType.class, null, mType);
415         this.mTriggerTask = triggerTask;
416         this.mRemoteTransition = remoteTransition;
417         this.mDisplayChange = displayChange;
418 
419         // onConstructed(); // You can define this method to get a callback
420     }
421 
422     @DataClass.Generated.Member
423     public static final @android.annotation.NonNull Parcelable.Creator<TransitionRequestInfo> CREATOR
424             = new Parcelable.Creator<TransitionRequestInfo>() {
425         @Override
426         public TransitionRequestInfo[] newArray(int size) {
427             return new TransitionRequestInfo[size];
428         }
429 
430         @Override
431         public TransitionRequestInfo createFromParcel(@android.annotation.NonNull android.os.Parcel in) {
432             return new TransitionRequestInfo(in);
433         }
434     };
435 
436     @DataClass.Generated(
437             time = 1639445520938L,
438             codegenVersion = "1.0.23",
439             sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java",
440             inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.window.TransitionRequestInfo.DisplayChange mDisplayChange\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)")
441     @Deprecated
__metadata()442     private void __metadata() {}
443 
444 
445     //@formatter:on
446     // End of generated code
447 
448 }
449