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