1 /* 2 * Copyright (C) 2011 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.server.wm; 18 19 import android.annotation.IntDef; 20 21 import com.android.server.wm.StartingSurfaceController.StartingSurface; 22 23 /** 24 * Represents the model about how a starting window should be constructed. 25 */ 26 public abstract class StartingData { 27 28 /** Nothing need to do after transaction */ 29 static final int AFTER_TRANSACTION_IDLE = 0; 30 /** Remove the starting window directly after transaction done. */ 31 static final int AFTER_TRANSACTION_REMOVE_DIRECTLY = 1; 32 /** Do copy splash screen to client after transaction done. */ 33 static final int AFTER_TRANSACTION_COPY_TO_CLIENT = 2; 34 /** 35 * Remove the starting window after transition finish. 36 * Used when activity doesn't request show when locked, so the app window should never show to 37 * the user if device is locked. 38 **/ 39 static final int AFTER_TRANSITION_FINISH = 3; 40 41 @IntDef(prefix = { "AFTER_TRANSACTION" }, value = { 42 AFTER_TRANSACTION_IDLE, 43 AFTER_TRANSACTION_REMOVE_DIRECTLY, 44 AFTER_TRANSACTION_COPY_TO_CLIENT, 45 AFTER_TRANSITION_FINISH, 46 }) 47 @interface AfterTransaction {} 48 49 protected final WindowManagerService mService; 50 protected final int mTypeParams; 51 52 /** 53 * Tell whether the launching activity should use 54 * {@link android.view.WindowManager.LayoutParams#SOFT_INPUT_IS_FORWARD_NAVIGATION}. 55 */ 56 boolean mIsTransitionForward; 57 58 /** 59 * Non-null if the starting window should cover the bounds of associated task. It is assigned 60 * when the parent activity of starting window may be put in a partial area of the task. 61 */ 62 Task mAssociatedTask; 63 64 65 /** Whether the starting window is resized from transfer across activities. */ 66 boolean mResizedFromTransfer; 67 68 /** Whether the starting window is drawn. */ 69 boolean mIsDisplayed; 70 71 /** 72 * For Shell transition. 73 * This starting window should be removed after applying the start transaction of transition, 74 * which ensures the app window has shown. 75 */ 76 @AfterTransaction int mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE; 77 78 /** Whether to prepare the removal animation. */ 79 boolean mPrepareRemoveAnimation; 80 81 /** Non-zero if this starting window is added in a collecting transition. */ 82 int mTransitionId; 83 StartingData(WindowManagerService service, int typeParams)84 protected StartingData(WindowManagerService service, int typeParams) { 85 mService = service; 86 mTypeParams = typeParams; 87 } 88 89 /** 90 * Creates the actual starting window surface. 91 * 92 * @param activity the app to add the starting window to 93 * @return a class implementing {@link StartingSurface} for easy removal with 94 * {@link StartingSurface#remove} 95 */ createStartingSurface(ActivityRecord activity)96 abstract StartingSurface createStartingSurface(ActivityRecord activity); 97 98 /** 99 * @return Whether to apply reveal animation when exiting the starting window. 100 */ needRevealAnimation()101 abstract boolean needRevealAnimation(); 102 103 /** @see android.window.TaskSnapshot#hasImeSurface() */ hasImeSurface()104 boolean hasImeSurface() { 105 return false; 106 } 107 108 @Override toString()109 public String toString() { 110 return getClass().getSimpleName() + "{" 111 + Integer.toHexString(System.identityHashCode(this)) 112 + " removeAfterTransaction= " + mRemoveAfterTransaction 113 + "}"; 114 } 115 } 116