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 android.view;
18 
19 import static android.view.Display.INVALID_DISPLAY;
20 
21 import android.annotation.IntDef;
22 import android.annotation.NonNull;
23 import android.annotation.Nullable;
24 import android.os.IBinder;
25 import android.os.Parcel;
26 import android.os.Parcelable;
27 
28 import com.android.internal.util.DataClass;
29 
30 import java.lang.annotation.Retention;
31 import java.lang.annotation.RetentionPolicy;
32 
33 /**
34  * Description of a content recording session.
35  *
36  * @hide
37  */
38 @DataClass(
39         genConstructor = false,
40         genToString = true,
41         genSetters = true,
42         genEqualsHashCode = true
43 )
44 public final class ContentRecordingSession implements Parcelable {
45 
46     /**
47      * An entire DisplayContent is being recorded. Recording may also be paused.
48      */
49     public static final int RECORD_CONTENT_DISPLAY = 0;
50     /**
51      * A single Task is being recorded. Recording may also be paused.
52      */
53     public static final int RECORD_CONTENT_TASK = 1;
54 
55     /** Full screen sharing (app is not selected). */
56     public static final int TARGET_UID_FULL_SCREEN = -1;
57 
58     /** Can't report (e.g. side loaded app). */
59     public static final int TARGET_UID_UNKNOWN = -2;
60 
61     /** Task id is not set either because full screen capture or launching a new app */
62     public static final int TASK_ID_UNKNOWN = -1;
63 
64     /**
65      * Id of Task that is launched to be captured for a single app capture session. The value may be
66      * {@link #TASK_ID_UNKNOWN} if the session is not for a single app capture.
67      */
68     private int mTaskId = TASK_ID_UNKNOWN;
69 
70     /**
71      * Unique logical identifier of the {@link android.hardware.display.VirtualDisplay} that has
72      * recorded content rendered to its surface.
73      */
74     private int mVirtualDisplayId = INVALID_DISPLAY;
75 
76     /**
77      * The content to record.
78      */
79     @RecordContent
80     private int mContentToRecord = RECORD_CONTENT_DISPLAY;
81 
82     /**
83      * Unique logical identifier of the {@link android.view.Display} to record.
84      *
85      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_DISPLAY}, then is
86      * a valid display id.
87      */
88     private int mDisplayToRecord = INVALID_DISPLAY;
89 
90     /**
91      * The token of the layer of the hierarchy to record.
92      *
93      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_TASK}, then
94      * represents the {@link android.window.WindowContainerToken} of the Task to record.
95      */
96     @Nullable
97     private IBinder mTokenToRecord = null;
98 
99     /**
100      * When {@code true}, no mirroring should take place until the user has re-granted access to
101      * the consent token. When {@code false}, recording can begin immediately.
102      *
103      * <p>Only set on the server side to sanitize any input from the client process.
104      */
105     private boolean mWaitingForConsent = false;
106 
107     /** UID of the package that is captured if selected. */
108     private int mTargetUid = TARGET_UID_UNKNOWN;
109 
110     /**
111      * Default instance, with recording the display.
112      */
ContentRecordingSession()113     private ContentRecordingSession() {
114     }
115 
116     /** Returns an instance initialized for recording the indicated display. */
createDisplaySession(int displayToMirror)117     public static ContentRecordingSession createDisplaySession(int displayToMirror) {
118         return new ContentRecordingSession()
119                 .setDisplayToRecord(displayToMirror)
120                 .setContentToRecord(RECORD_CONTENT_DISPLAY)
121                 .setTargetUid(TARGET_UID_FULL_SCREEN);
122     }
123 
124     /** Returns an instance initialized for task recording. */
createTaskSession( @onNull IBinder taskWindowContainerToken)125     public static ContentRecordingSession createTaskSession(
126             @NonNull IBinder taskWindowContainerToken) {
127         return createTaskSession(taskWindowContainerToken, TASK_ID_UNKNOWN);
128     }
129 
130     /** Returns an instance initialized for task recording. */
createTaskSession( @onNull IBinder taskWindowContainerToken, int taskId)131     public static ContentRecordingSession createTaskSession(
132             @NonNull IBinder taskWindowContainerToken, int taskId) {
133         return new ContentRecordingSession()
134                 .setContentToRecord(RECORD_CONTENT_TASK)
135                 .setTokenToRecord(taskWindowContainerToken)
136                 .setTaskId(taskId);
137     }
138 
139     /**
140      * Returns {@code true} if this is a valid session.
141      *
142      * <p>A valid session has a non-null token for task recording, or a valid id for the display to
143      * record.
144      */
isValid(ContentRecordingSession session)145     public static boolean isValid(ContentRecordingSession session) {
146         if (session == null) {
147             return false;
148         }
149         final boolean isValidTaskSession = session.getContentToRecord() == RECORD_CONTENT_TASK
150                 && session.getTokenToRecord() != null;
151         final boolean isValidDisplaySession = session.getContentToRecord() == RECORD_CONTENT_DISPLAY
152                 && session.getDisplayToRecord() > INVALID_DISPLAY;
153         return session.getVirtualDisplayId() > INVALID_DISPLAY
154                 && (isValidTaskSession || isValidDisplaySession);
155     }
156 
157     /**
158      * Returns {@code true} when both sessions are on the same
159      * {@link android.hardware.display.VirtualDisplay}.
160      */
isProjectionOnSameDisplay(ContentRecordingSession session, ContentRecordingSession incomingSession)161     public static boolean isProjectionOnSameDisplay(ContentRecordingSession session,
162             ContentRecordingSession incomingSession) {
163         return session != null && incomingSession != null
164                 && session.getVirtualDisplayId() == incomingSession.getVirtualDisplayId();
165     }
166 
167 
168 
169 
170     // Code below generated by codegen v1.0.23.
171     //
172     // DO NOT MODIFY!
173     // CHECKSTYLE:OFF Generated code
174     //
175     // To regenerate run:
176     // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/ContentRecordingSession.java
177     //
178     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
179     //   Settings > Editor > Code Style > Formatter Control
180     //@formatter:off
181 
182 
183     @IntDef(prefix = "RECORD_CONTENT_", value = {
184         RECORD_CONTENT_DISPLAY,
185         RECORD_CONTENT_TASK
186     })
187     @Retention(RetentionPolicy.SOURCE)
188     @DataClass.Generated.Member
189     public @interface RecordContent {}
190 
191     @DataClass.Generated.Member
recordContentToString(@ecordContent int value)192     public static String recordContentToString(@RecordContent int value) {
193         switch (value) {
194             case RECORD_CONTENT_DISPLAY:
195                     return "RECORD_CONTENT_DISPLAY";
196             case RECORD_CONTENT_TASK:
197                     return "RECORD_CONTENT_TASK";
198             default: return Integer.toHexString(value);
199         }
200     }
201 
202     @IntDef(prefix = "TARGET_UID_", value = {
203         TARGET_UID_FULL_SCREEN,
204         TARGET_UID_UNKNOWN
205     })
206     @Retention(RetentionPolicy.SOURCE)
207     @DataClass.Generated.Member
208     public @interface TargetUid {}
209 
210     @DataClass.Generated.Member
targetUidToString(@argetUid int value)211     public static String targetUidToString(@TargetUid int value) {
212         switch (value) {
213             case TARGET_UID_FULL_SCREEN:
214                     return "TARGET_UID_FULL_SCREEN";
215             case TARGET_UID_UNKNOWN:
216                     return "TARGET_UID_UNKNOWN";
217             default: return Integer.toHexString(value);
218         }
219     }
220 
221     @DataClass.Generated.Member
ContentRecordingSession( int taskId, int virtualDisplayId, @RecordContent int contentToRecord, int displayToRecord, @Nullable IBinder tokenToRecord, boolean waitingForConsent, int targetUid)222     /* package-private */ ContentRecordingSession(
223             int taskId,
224             int virtualDisplayId,
225             @RecordContent int contentToRecord,
226             int displayToRecord,
227             @Nullable IBinder tokenToRecord,
228             boolean waitingForConsent,
229             int targetUid) {
230         this.mTaskId = taskId;
231         this.mVirtualDisplayId = virtualDisplayId;
232         this.mContentToRecord = contentToRecord;
233 
234         if (!(mContentToRecord == RECORD_CONTENT_DISPLAY)
235                 && !(mContentToRecord == RECORD_CONTENT_TASK)) {
236             throw new java.lang.IllegalArgumentException(
237                     "contentToRecord was " + mContentToRecord + " but must be one of: "
238                             + "RECORD_CONTENT_DISPLAY(" + RECORD_CONTENT_DISPLAY + "), "
239                             + "RECORD_CONTENT_TASK(" + RECORD_CONTENT_TASK + ")");
240         }
241 
242         this.mDisplayToRecord = displayToRecord;
243         this.mTokenToRecord = tokenToRecord;
244         this.mWaitingForConsent = waitingForConsent;
245         this.mTargetUid = targetUid;
246 
247         // onConstructed(); // You can define this method to get a callback
248     }
249 
250     /**
251      * Id of Task that is launched to be captured for a single app capture session. The value may be
252      * {@link #TASK_ID_UNKNOWN} if the session is not for a single app capture.
253      */
254     @DataClass.Generated.Member
getTaskId()255     public int getTaskId() {
256         return mTaskId;
257     }
258 
259     /**
260      * Unique logical identifier of the {@link android.hardware.display.VirtualDisplay} that has
261      * recorded content rendered to its surface.
262      */
263     @DataClass.Generated.Member
getVirtualDisplayId()264     public int getVirtualDisplayId() {
265         return mVirtualDisplayId;
266     }
267 
268     /**
269      * The content to record.
270      */
271     @DataClass.Generated.Member
getContentToRecord()272     public @RecordContent int getContentToRecord() {
273         return mContentToRecord;
274     }
275 
276     /**
277      * Unique logical identifier of the {@link android.view.Display} to record.
278      *
279      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_DISPLAY}, then is
280      * a valid display id.
281      */
282     @DataClass.Generated.Member
getDisplayToRecord()283     public int getDisplayToRecord() {
284         return mDisplayToRecord;
285     }
286 
287     /**
288      * The token of the layer of the hierarchy to record.
289      *
290      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_TASK}, then
291      * represents the {@link android.window.WindowContainerToken} of the Task to record.
292      */
293     @DataClass.Generated.Member
getTokenToRecord()294     public @Nullable IBinder getTokenToRecord() {
295         return mTokenToRecord;
296     }
297 
298     /**
299      * When {@code true}, no mirroring should take place until the user has re-granted access to
300      * the consent token. When {@code false}, recording can begin immediately.
301      *
302      * <p>Only set on the server side to sanitize any input from the client process.
303      */
304     @DataClass.Generated.Member
isWaitingForConsent()305     public boolean isWaitingForConsent() {
306         return mWaitingForConsent;
307     }
308 
309     /**
310      * UID of the package that is captured if selected.
311      */
312     @DataClass.Generated.Member
getTargetUid()313     public int getTargetUid() {
314         return mTargetUid;
315     }
316 
317     /**
318      * Id of Task that is launched to be captured for a single app capture session. The value may be
319      * {@link #TASK_ID_UNKNOWN} if the session is not for a single app capture.
320      */
321     @DataClass.Generated.Member
setTaskId( int value)322     public @NonNull ContentRecordingSession setTaskId( int value) {
323         mTaskId = value;
324         return this;
325     }
326 
327     /**
328      * Unique logical identifier of the {@link android.hardware.display.VirtualDisplay} that has
329      * recorded content rendered to its surface.
330      */
331     @DataClass.Generated.Member
setVirtualDisplayId( int value)332     public @NonNull ContentRecordingSession setVirtualDisplayId( int value) {
333         mVirtualDisplayId = value;
334         return this;
335     }
336 
337     /**
338      * The content to record.
339      */
340     @DataClass.Generated.Member
setContentToRecord(@ecordContent int value)341     public @NonNull ContentRecordingSession setContentToRecord(@RecordContent int value) {
342         mContentToRecord = value;
343 
344         if (!(mContentToRecord == RECORD_CONTENT_DISPLAY)
345                 && !(mContentToRecord == RECORD_CONTENT_TASK)) {
346             throw new java.lang.IllegalArgumentException(
347                     "contentToRecord was " + mContentToRecord + " but must be one of: "
348                             + "RECORD_CONTENT_DISPLAY(" + RECORD_CONTENT_DISPLAY + "), "
349                             + "RECORD_CONTENT_TASK(" + RECORD_CONTENT_TASK + ")");
350         }
351 
352         return this;
353     }
354 
355     /**
356      * Unique logical identifier of the {@link android.view.Display} to record.
357      *
358      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_DISPLAY}, then is
359      * a valid display id.
360      */
361     @DataClass.Generated.Member
setDisplayToRecord( int value)362     public @NonNull ContentRecordingSession setDisplayToRecord( int value) {
363         mDisplayToRecord = value;
364         return this;
365     }
366 
367     /**
368      * The token of the layer of the hierarchy to record.
369      *
370      * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_TASK}, then
371      * represents the {@link android.window.WindowContainerToken} of the Task to record.
372      */
373     @DataClass.Generated.Member
setTokenToRecord(@onNull IBinder value)374     public @NonNull ContentRecordingSession setTokenToRecord(@NonNull IBinder value) {
375         mTokenToRecord = value;
376         return this;
377     }
378 
379     /**
380      * When {@code true}, no mirroring should take place until the user has re-granted access to
381      * the consent token. When {@code false}, recording can begin immediately.
382      *
383      * <p>Only set on the server side to sanitize any input from the client process.
384      */
385     @DataClass.Generated.Member
setWaitingForConsent( boolean value)386     public @NonNull ContentRecordingSession setWaitingForConsent( boolean value) {
387         mWaitingForConsent = value;
388         return this;
389     }
390 
391     /**
392      * UID of the package that is captured if selected.
393      */
394     @DataClass.Generated.Member
setTargetUid( int value)395     public @NonNull ContentRecordingSession setTargetUid( int value) {
396         mTargetUid = value;
397         return this;
398     }
399 
400     @Override
401     @DataClass.Generated.Member
toString()402     public String toString() {
403         // You can override field toString logic by defining methods like:
404         // String fieldNameToString() { ... }
405 
406         return "ContentRecordingSession { " +
407                 "taskId = " + mTaskId + ", " +
408                 "virtualDisplayId = " + mVirtualDisplayId + ", " +
409                 "contentToRecord = " + recordContentToString(mContentToRecord) + ", " +
410                 "displayToRecord = " + mDisplayToRecord + ", " +
411                 "tokenToRecord = " + mTokenToRecord + ", " +
412                 "waitingForConsent = " + mWaitingForConsent + ", " +
413                 "targetUid = " + mTargetUid +
414         " }";
415     }
416 
417     @Override
418     @DataClass.Generated.Member
equals(@ullable Object o)419     public boolean equals(@Nullable Object o) {
420         // You can override field equality logic by defining either of the methods like:
421         // boolean fieldNameEquals(ContentRecordingSession other) { ... }
422         // boolean fieldNameEquals(FieldType otherValue) { ... }
423 
424         if (this == o) return true;
425         if (o == null || getClass() != o.getClass()) return false;
426         @SuppressWarnings("unchecked")
427         ContentRecordingSession that = (ContentRecordingSession) o;
428         //noinspection PointlessBooleanExpression
429         return true
430                 && mTaskId == that.mTaskId
431                 && mVirtualDisplayId == that.mVirtualDisplayId
432                 && mContentToRecord == that.mContentToRecord
433                 && mDisplayToRecord == that.mDisplayToRecord
434                 && java.util.Objects.equals(mTokenToRecord, that.mTokenToRecord)
435                 && mWaitingForConsent == that.mWaitingForConsent
436                 && mTargetUid == that.mTargetUid;
437     }
438 
439     @Override
440     @DataClass.Generated.Member
hashCode()441     public int hashCode() {
442         // You can override field hashCode logic by defining methods like:
443         // int fieldNameHashCode() { ... }
444 
445         int _hash = 1;
446         _hash = 31 * _hash + mTaskId;
447         _hash = 31 * _hash + mVirtualDisplayId;
448         _hash = 31 * _hash + mContentToRecord;
449         _hash = 31 * _hash + mDisplayToRecord;
450         _hash = 31 * _hash + java.util.Objects.hashCode(mTokenToRecord);
451         _hash = 31 * _hash + Boolean.hashCode(mWaitingForConsent);
452         _hash = 31 * _hash + mTargetUid;
453         return _hash;
454     }
455 
456     @Override
457     @DataClass.Generated.Member
writeToParcel(@onNull Parcel dest, int flags)458     public void writeToParcel(@NonNull Parcel dest, int flags) {
459         // You can override field parcelling by defining methods like:
460         // void parcelFieldName(Parcel dest, int flags) { ... }
461 
462         byte flg = 0;
463         if (mWaitingForConsent) flg |= 0x20;
464         if (mTokenToRecord != null) flg |= 0x10;
465         dest.writeByte(flg);
466         dest.writeInt(mTaskId);
467         dest.writeInt(mVirtualDisplayId);
468         dest.writeInt(mContentToRecord);
469         dest.writeInt(mDisplayToRecord);
470         if (mTokenToRecord != null) dest.writeStrongBinder(mTokenToRecord);
471         dest.writeInt(mTargetUid);
472     }
473 
474     @Override
475     @DataClass.Generated.Member
describeContents()476     public int describeContents() { return 0; }
477 
478     /** @hide */
479     @SuppressWarnings({"unchecked", "RedundantCast"})
480     @DataClass.Generated.Member
ContentRecordingSession(@onNull Parcel in)481     /* package-private */ ContentRecordingSession(@NonNull Parcel in) {
482         // You can override field unparcelling by defining methods like:
483         // static FieldType unparcelFieldName(Parcel in) { ... }
484 
485         byte flg = in.readByte();
486         boolean waitingForConsent = (flg & 0x20) != 0;
487         int taskId = in.readInt();
488         int virtualDisplayId = in.readInt();
489         int contentToRecord = in.readInt();
490         int displayToRecord = in.readInt();
491         IBinder tokenToRecord = (flg & 0x10) == 0 ? null : (IBinder) in.readStrongBinder();
492         int targetUid = in.readInt();
493 
494         this.mTaskId = taskId;
495         this.mVirtualDisplayId = virtualDisplayId;
496         this.mContentToRecord = contentToRecord;
497 
498         if (!(mContentToRecord == RECORD_CONTENT_DISPLAY)
499                 && !(mContentToRecord == RECORD_CONTENT_TASK)) {
500             throw new java.lang.IllegalArgumentException(
501                     "contentToRecord was " + mContentToRecord + " but must be one of: "
502                             + "RECORD_CONTENT_DISPLAY(" + RECORD_CONTENT_DISPLAY + "), "
503                             + "RECORD_CONTENT_TASK(" + RECORD_CONTENT_TASK + ")");
504         }
505 
506         this.mDisplayToRecord = displayToRecord;
507         this.mTokenToRecord = tokenToRecord;
508         this.mWaitingForConsent = waitingForConsent;
509         this.mTargetUid = targetUid;
510 
511         // onConstructed(); // You can define this method to get a callback
512     }
513 
514     @DataClass.Generated.Member
515     public static final @NonNull Parcelable.Creator<ContentRecordingSession> CREATOR
516             = new Parcelable.Creator<ContentRecordingSession>() {
517         @Override
518         public ContentRecordingSession[] newArray(int size) {
519             return new ContentRecordingSession[size];
520         }
521 
522         @Override
523         public ContentRecordingSession createFromParcel(@NonNull Parcel in) {
524             return new ContentRecordingSession(in);
525         }
526     };
527 
528     /**
529      * A builder for {@link ContentRecordingSession}
530      */
531     @SuppressWarnings("WeakerAccess")
532     @DataClass.Generated.Member
533     public static final class Builder {
534 
535         private int mTaskId;
536         private int mVirtualDisplayId;
537         private @RecordContent int mContentToRecord;
538         private int mDisplayToRecord;
539         private @Nullable IBinder mTokenToRecord;
540         private boolean mWaitingForConsent;
541         private int mTargetUid;
542 
543         private long mBuilderFieldsSet = 0L;
544 
Builder()545         public Builder() {
546         }
547 
548         /**
549          * Id of Task that is launched to be captured for a single app capture session. The value may be
550          * {@link #TASK_ID_UNKNOWN} if the session is not for a single app capture.
551          */
552         @DataClass.Generated.Member
setTaskId(int value)553         public @NonNull Builder setTaskId(int value) {
554             checkNotUsed();
555             mBuilderFieldsSet |= 0x1;
556             mTaskId = value;
557             return this;
558         }
559 
560         /**
561          * Unique logical identifier of the {@link android.hardware.display.VirtualDisplay} that has
562          * recorded content rendered to its surface.
563          */
564         @DataClass.Generated.Member
setVirtualDisplayId(int value)565         public @NonNull Builder setVirtualDisplayId(int value) {
566             checkNotUsed();
567             mBuilderFieldsSet |= 0x2;
568             mVirtualDisplayId = value;
569             return this;
570         }
571 
572         /**
573          * The content to record.
574          */
575         @DataClass.Generated.Member
setContentToRecord(@ecordContent int value)576         public @NonNull Builder setContentToRecord(@RecordContent int value) {
577             checkNotUsed();
578             mBuilderFieldsSet |= 0x4;
579             mContentToRecord = value;
580             return this;
581         }
582 
583         /**
584          * Unique logical identifier of the {@link android.view.Display} to record.
585          *
586          * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_DISPLAY}, then is
587          * a valid display id.
588          */
589         @DataClass.Generated.Member
setDisplayToRecord(int value)590         public @NonNull Builder setDisplayToRecord(int value) {
591             checkNotUsed();
592             mBuilderFieldsSet |= 0x8;
593             mDisplayToRecord = value;
594             return this;
595         }
596 
597         /**
598          * The token of the layer of the hierarchy to record.
599          *
600          * <p>If {@link #getContentToRecord()} is {@link RecordContent#RECORD_CONTENT_TASK}, then
601          * represents the {@link android.window.WindowContainerToken} of the Task to record.
602          */
603         @DataClass.Generated.Member
setTokenToRecord(@onNull IBinder value)604         public @NonNull Builder setTokenToRecord(@NonNull IBinder value) {
605             checkNotUsed();
606             mBuilderFieldsSet |= 0x10;
607             mTokenToRecord = value;
608             return this;
609         }
610 
611         /**
612          * When {@code true}, no mirroring should take place until the user has re-granted access to
613          * the consent token. When {@code false}, recording can begin immediately.
614          *
615          * <p>Only set on the server side to sanitize any input from the client process.
616          */
617         @DataClass.Generated.Member
setWaitingForConsent(boolean value)618         public @NonNull Builder setWaitingForConsent(boolean value) {
619             checkNotUsed();
620             mBuilderFieldsSet |= 0x20;
621             mWaitingForConsent = value;
622             return this;
623         }
624 
625         /**
626          * UID of the package that is captured if selected.
627          */
628         @DataClass.Generated.Member
setTargetUid(int value)629         public @NonNull Builder setTargetUid(int value) {
630             checkNotUsed();
631             mBuilderFieldsSet |= 0x40;
632             mTargetUid = value;
633             return this;
634         }
635 
636         /** Builds the instance. This builder should not be touched after calling this! */
build()637         public @NonNull ContentRecordingSession build() {
638             checkNotUsed();
639             mBuilderFieldsSet |= 0x80; // Mark builder used
640 
641             if ((mBuilderFieldsSet & 0x1) == 0) {
642                 mTaskId = TASK_ID_UNKNOWN;
643             }
644             if ((mBuilderFieldsSet & 0x2) == 0) {
645                 mVirtualDisplayId = INVALID_DISPLAY;
646             }
647             if ((mBuilderFieldsSet & 0x4) == 0) {
648                 mContentToRecord = RECORD_CONTENT_DISPLAY;
649             }
650             if ((mBuilderFieldsSet & 0x8) == 0) {
651                 mDisplayToRecord = INVALID_DISPLAY;
652             }
653             if ((mBuilderFieldsSet & 0x10) == 0) {
654                 mTokenToRecord = null;
655             }
656             if ((mBuilderFieldsSet & 0x20) == 0) {
657                 mWaitingForConsent = false;
658             }
659             if ((mBuilderFieldsSet & 0x40) == 0) {
660                 mTargetUid = TARGET_UID_UNKNOWN;
661             }
662             ContentRecordingSession o = new ContentRecordingSession(
663                     mTaskId,
664                     mVirtualDisplayId,
665                     mContentToRecord,
666                     mDisplayToRecord,
667                     mTokenToRecord,
668                     mWaitingForConsent,
669                     mTargetUid);
670             return o;
671         }
672 
checkNotUsed()673         private void checkNotUsed() {
674             if ((mBuilderFieldsSet & 0x80) != 0) {
675                 throw new IllegalStateException(
676                         "This Builder should not be reused. Use a new Builder instance instead");
677             }
678         }
679     }
680 
681     @DataClass.Generated(
682             time = 1716481148184L,
683             codegenVersion = "1.0.23",
684             sourceFile = "frameworks/base/core/java/android/view/ContentRecordingSession.java",
685             inputSignatures = "public static final  int RECORD_CONTENT_DISPLAY\npublic static final  int RECORD_CONTENT_TASK\npublic static final  int TARGET_UID_FULL_SCREEN\npublic static final  int TARGET_UID_UNKNOWN\npublic static final  int TASK_ID_UNKNOWN\nprivate  int mTaskId\nprivate  int mVirtualDisplayId\nprivate @android.view.ContentRecordingSession.RecordContent int mContentToRecord\nprivate  int mDisplayToRecord\nprivate @android.annotation.Nullable android.os.IBinder mTokenToRecord\nprivate  boolean mWaitingForConsent\nprivate  int mTargetUid\npublic static  android.view.ContentRecordingSession createDisplaySession(int)\npublic static  android.view.ContentRecordingSession createTaskSession(android.os.IBinder)\npublic static  android.view.ContentRecordingSession createTaskSession(android.os.IBinder,int)\npublic static  boolean isValid(android.view.ContentRecordingSession)\npublic static  boolean isProjectionOnSameDisplay(android.view.ContentRecordingSession,android.view.ContentRecordingSession)\nclass ContentRecordingSession extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genConstructor=false, genToString=true, genSetters=true, genEqualsHashCode=true)")
686     @Deprecated
__metadata()687     private void __metadata() {}
688 
689 
690     //@formatter:on
691     // End of generated code
692 
693 }
694