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.systemui.media
18 
19 import android.os.IBinder
20 import android.os.Parcel
21 import android.os.Parcelable
22 
23 /**
24  * Class that represents an area that should be captured.
25  * Currently it has only a launch cookie that represents a task but
26  * we potentially could add more identifiers e.g. for a pair of tasks.
27  */
28 data class MediaProjectionCaptureTarget(
29     val launchCookie: IBinder?
30 ): Parcelable {
31 
32     constructor(parcel: Parcel) : this(parcel.readStrongBinder())
33 
34     override fun writeToParcel(dest: Parcel, flags: Int) {
35         dest.writeStrongBinder(launchCookie)
36     }
37 
38     override fun describeContents(): Int = 0
39 
40     companion object CREATOR : Parcelable.Creator<MediaProjectionCaptureTarget> {
41         override fun createFromParcel(parcel: Parcel): MediaProjectionCaptureTarget {
42             return MediaProjectionCaptureTarget(parcel)
43         }
44 
45         override fun newArray(size: Int): Array<MediaProjectionCaptureTarget?> {
46             return arrayOfNulls(size)
47         }
48     }
49 }
50