1 /* 2 * Copyright (C) 2021 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.Nullable; 21 import android.graphics.Rect; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 import android.view.SurfaceControl; 25 26 /** 27 * Information when removing a starting window of a particular task. 28 * @hide 29 */ 30 public final class StartingWindowRemovalInfo implements Parcelable { 31 32 /** 33 * The identifier of a task. 34 * @hide 35 */ 36 public int taskId; 37 38 /** 39 * The animation container layer of the top activity. 40 * @hide 41 */ 42 @Nullable 43 public SurfaceControl windowAnimationLeash; 44 45 /** 46 * The main window frame for the window of the top activity. 47 * @hide 48 */ 49 @Nullable 50 public Rect mainFrame; 51 52 /** 53 * Whether need to play reveal animation. 54 * @hide 55 */ 56 public boolean playRevealAnimation; 57 58 /** 59 * Whether need to defer removing the starting window for IME. 60 * @hide 61 */ 62 public boolean deferRemoveForIme; 63 StartingWindowRemovalInfo()64 public StartingWindowRemovalInfo() { 65 66 } 67 StartingWindowRemovalInfo(@onNull Parcel source)68 private StartingWindowRemovalInfo(@NonNull Parcel source) { 69 readFromParcel(source); 70 } 71 72 @Override describeContents()73 public int describeContents() { 74 return 0; 75 } 76 readFromParcel(@onNull Parcel source)77 void readFromParcel(@NonNull Parcel source) { 78 taskId = source.readInt(); 79 windowAnimationLeash = source.readTypedObject(SurfaceControl.CREATOR); 80 mainFrame = source.readTypedObject(Rect.CREATOR); 81 playRevealAnimation = source.readBoolean(); 82 deferRemoveForIme = source.readBoolean(); 83 } 84 85 @Override writeToParcel(@onNull Parcel dest, int flags)86 public void writeToParcel(@NonNull Parcel dest, int flags) { 87 dest.writeInt(taskId); 88 dest.writeTypedObject(windowAnimationLeash, flags); 89 dest.writeTypedObject(mainFrame, flags); 90 dest.writeBoolean(playRevealAnimation); 91 dest.writeBoolean(deferRemoveForIme); 92 } 93 94 @Override toString()95 public String toString() { 96 return "StartingWindowRemovalInfo{taskId=" + taskId 97 + " frame=" + mainFrame 98 + " playRevealAnimation=" + playRevealAnimation 99 + " deferRemoveForIme=" + deferRemoveForIme + "}"; 100 } 101 102 public static final @android.annotation.NonNull Creator<StartingWindowRemovalInfo> CREATOR = 103 new Creator<StartingWindowRemovalInfo>() { 104 public StartingWindowRemovalInfo createFromParcel(@NonNull Parcel source) { 105 return new StartingWindowRemovalInfo(source); 106 } 107 public StartingWindowRemovalInfo[] newArray(int size) { 108 return new StartingWindowRemovalInfo[size]; 109 } 110 }; 111 } 112