• 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 android.annotation.NonNull;
20 import android.annotation.TestApi;
21 import android.app.ActivityManager.RunningTaskInfo;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 import android.view.SurfaceControl;
25 
26 /**
27  * Data object for the task info provided when a task is presented to an organizer.
28  * @hide
29  */
30 @TestApi
31 public final class TaskAppearedInfo implements Parcelable {
32 
33     @NonNull
34     private final RunningTaskInfo mTaskInfo;
35 
36     @NonNull
37     private final SurfaceControl mLeash;
38 
39     @NonNull
40     public static final Creator<TaskAppearedInfo> CREATOR = new Creator<TaskAppearedInfo>() {
41         @Override
42         public TaskAppearedInfo createFromParcel(Parcel source) {
43             final RunningTaskInfo taskInfo = source.readTypedObject(RunningTaskInfo.CREATOR);
44             final SurfaceControl leash = source.readTypedObject(SurfaceControl.CREATOR);
45             return new TaskAppearedInfo(taskInfo, leash);
46         }
47 
48         @Override
49         public TaskAppearedInfo[] newArray(int size) {
50             return new TaskAppearedInfo[size];
51         }
52 
53     };
54 
TaskAppearedInfo(@onNull RunningTaskInfo taskInfo, @NonNull SurfaceControl leash)55     public TaskAppearedInfo(@NonNull RunningTaskInfo taskInfo, @NonNull SurfaceControl leash) {
56         mTaskInfo = taskInfo;
57         mLeash = leash;
58     }
59 
60     @Override
writeToParcel(@onNull Parcel dest, int flags)61     public void writeToParcel(@NonNull Parcel dest, int flags) {
62         dest.writeTypedObject(mTaskInfo, flags);
63         dest.writeTypedObject(mLeash, flags);
64     }
65 
66     @Override
describeContents()67     public int describeContents() {
68         return 0;
69     }
70 
71     /**
72      * @return the task info.
73      */
74     @NonNull
getTaskInfo()75     public RunningTaskInfo getTaskInfo() {
76         return mTaskInfo;
77     }
78 
79     /**
80      * @return the leash for the task.
81      */
82     @NonNull
getLeash()83     public SurfaceControl getLeash() {
84         return mLeash;
85     }
86 }
87