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.content.res.Configuration; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 25 /** 26 * Stores information about a particular {@link com.android.server.wm.DisplayArea}. This object will 27 * be sent to registered {@link DisplayAreaOrganizer} to provide information when the DisplayArea 28 * is added, removed, or changed. 29 * 30 * @hide 31 */ 32 @TestApi 33 public final class DisplayAreaInfo implements Parcelable { 34 35 @NonNull 36 public final WindowContainerToken token; 37 38 @NonNull 39 public final Configuration configuration = new Configuration(); 40 41 /** 42 * The id of the display this display area is associated with. 43 */ 44 public final int displayId; 45 46 public final int featureId; 47 DisplayAreaInfo(@onNull WindowContainerToken token, int displayId, int featureId)48 public DisplayAreaInfo(@NonNull WindowContainerToken token, int displayId, int featureId) { 49 this.token = token; 50 this.displayId = displayId; 51 this.featureId = featureId; 52 } 53 DisplayAreaInfo(Parcel in)54 private DisplayAreaInfo(Parcel in) { 55 token = WindowContainerToken.CREATOR.createFromParcel(in); 56 configuration.readFromParcel(in); 57 displayId = in.readInt(); 58 featureId = in.readInt(); 59 } 60 61 @Override writeToParcel(@onNull Parcel dest, int flags)62 public void writeToParcel(@NonNull Parcel dest, int flags) { 63 token.writeToParcel(dest, flags); 64 configuration.writeToParcel(dest, flags); 65 dest.writeInt(displayId); 66 dest.writeInt(featureId); 67 } 68 69 @NonNull 70 public static final Creator<DisplayAreaInfo> CREATOR = new Creator<DisplayAreaInfo>() { 71 @Override 72 public DisplayAreaInfo createFromParcel(Parcel in) { 73 return new DisplayAreaInfo(in); 74 } 75 76 @Override 77 public DisplayAreaInfo[] newArray(int size) { 78 return new DisplayAreaInfo[size]; 79 } 80 }; 81 82 @Override toString()83 public String toString() { 84 return "DisplayAreaInfo{token=" + token 85 + " config=" + configuration + "}"; 86 } 87 88 @Override describeContents()89 public int describeContents() { 90 return 0; 91 } 92 } 93