1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
|
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.window;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.TaskInfo;
import android.content.pm.ActivityInfo;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.InsetsState;
import android.view.InsetsVisibilities;
import android.view.WindowManager;
/**
* Information you can retrieve about a starting window of a particular task that is currently
* start in the system.
* @hide
*/
public final class StartingWindowInfo implements Parcelable {
/**
* Prefer nothing or not care the type of starting window.
* @hide
*/
public static final int STARTING_WINDOW_TYPE_NONE = 0;
/**
* Prefer splash screen starting window.
* @hide
*/
public static final int STARTING_WINDOW_TYPE_SPLASH_SCREEN = 1;
/**
* Prefer snapshot starting window.
* @hide
*/
public static final int STARTING_WINDOW_TYPE_SNAPSHOT = 2;
/**
* Prefer solid color splash screen starting window.
* @hide
*/
public static final int STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN = 3;
/** @hide **/
public static final int STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN = 4;
/**
* @hide
*/
@IntDef(flag = true, prefix = "STARTING_WINDOW_TYPE_", value = {
STARTING_WINDOW_TYPE_NONE,
STARTING_WINDOW_TYPE_SPLASH_SCREEN,
STARTING_WINDOW_TYPE_SNAPSHOT,
STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN,
STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
})
public @interface StartingWindowType {}
/**
* The {@link TaskInfo} from this task.
* @hide
*/
@NonNull
public ActivityManager.RunningTaskInfo taskInfo;
/**
* The {@link ActivityInfo} of the target activity which to create the starting window.
* It can be null if the info is the same as the top in task info.
* @hide
*/
@Nullable
public ActivityInfo targetActivityInfo;
/**
* InsetsState of TopFullscreenOpaqueWindow
* @hide
*/
@Nullable
public InsetsState topOpaqueWindowInsetsState;
/**
* LayoutParams of TopFullscreenOpaqueWindow
* @hide
*/
@Nullable
public WindowManager.LayoutParams topOpaqueWindowLayoutParams;
/**
* LayoutParams of MainWindow
* @hide
*/
@Nullable
public WindowManager.LayoutParams mainWindowLayoutParams;
/**
* @hide
*/
@IntDef(flag = true, prefix = "TYPE_PARAMETER_", value = {
TYPE_PARAMETER_NEW_TASK,
TYPE_PARAMETER_TASK_SWITCH,
TYPE_PARAMETER_PROCESS_RUNNING,
TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT,
TYPE_PARAMETER_ACTIVITY_CREATED,
TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN,
TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN,
TYPE_PARAMETER_LEGACY_SPLASH_SCREEN
})
public @interface StartingTypeParams {}
/**
* The parameters of the starting window...
* @hide
*/
public static final int TYPE_PARAMETER_NEW_TASK = 0x00000001;
/** @hide */
public static final int TYPE_PARAMETER_TASK_SWITCH = 0x00000002;
/** @hide */
public static final int TYPE_PARAMETER_PROCESS_RUNNING = 0x00000004;
/** @hide */
public static final int TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT = 0x00000008;
/** @hide */
public static final int TYPE_PARAMETER_ACTIVITY_CREATED = 0x00000010;
/** @hide */
public static final int TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN = 0x00000020;
/**
* The parameter which indicates if the activity has finished drawing.
* @hide
*/
public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040;
/**
* Application will receive the
* {@link
* android.window.SplashScreen.OnExitAnimationListener#onSplashScreenExit(SplashScreenView)}
* callback, even when the splash screen only shows a solid color.
*
* @hide
*/
public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080;
/**
* Application is allowed to use the legacy splash screen
* @hide
*/
public static final int TYPE_PARAMETER_LEGACY_SPLASH_SCREEN = 0x80000000;
/**
* The parameters which effect the starting window type.
* @see android.window.StartingWindowInfo.StartingTypeParams
* @hide
*/
public int startingWindowTypeParameter;
/**
* Specifies a theme for the splash screen.
* @hide
*/
public int splashScreenThemeResId;
/**
* Is keyguard occluded on default display.
* @hide
*/
public boolean isKeyguardOccluded = false;
/**
* TaskSnapshot.
* @hide
*/
public TaskSnapshot taskSnapshot;
/**
* The requested insets visibility of the top main window.
* @hide
*/
public final InsetsVisibilities requestedVisibilities = new InsetsVisibilities();
public StartingWindowInfo() {
}
private StartingWindowInfo(@NonNull Parcel source) {
readFromParcel(source);
}
/**
* Return whether the application allow to handle the solid color style splash screen.
*/
public boolean allowHandleSolidColorSplashScreen() {
return (startingWindowTypeParameter & TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN) != 0;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeTypedObject(taskInfo, flags);
dest.writeTypedObject(targetActivityInfo, flags);
dest.writeInt(startingWindowTypeParameter);
dest.writeTypedObject(topOpaqueWindowInsetsState, flags);
dest.writeTypedObject(topOpaqueWindowLayoutParams, flags);
dest.writeTypedObject(mainWindowLayoutParams, flags);
dest.writeInt(splashScreenThemeResId);
dest.writeBoolean(isKeyguardOccluded);
dest.writeTypedObject(taskSnapshot, flags);
requestedVisibilities.writeToParcel(dest, flags);
}
void readFromParcel(@NonNull Parcel source) {
taskInfo = source.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
targetActivityInfo = source.readTypedObject(ActivityInfo.CREATOR);
startingWindowTypeParameter = source.readInt();
topOpaqueWindowInsetsState = source.readTypedObject(InsetsState.CREATOR);
topOpaqueWindowLayoutParams = source.readTypedObject(
WindowManager.LayoutParams.CREATOR);
mainWindowLayoutParams = source.readTypedObject(WindowManager.LayoutParams.CREATOR);
splashScreenThemeResId = source.readInt();
isKeyguardOccluded = source.readBoolean();
taskSnapshot = source.readTypedObject(TaskSnapshot.CREATOR);
requestedVisibilities.readFromParcel(source);
}
@Override
public String toString() {
return "StartingWindowInfo{taskId=" + taskInfo.taskId
+ " targetActivityInfo=" + targetActivityInfo
+ " displayId=" + taskInfo.displayId
+ " topActivityType=" + taskInfo.topActivityType
+ " preferredStartingWindowType="
+ Integer.toHexString(startingWindowTypeParameter)
+ " insetsState=" + topOpaqueWindowInsetsState
+ " topWindowLayoutParams=" + topOpaqueWindowLayoutParams
+ " mainWindowLayoutParams=" + mainWindowLayoutParams
+ " splashScreenThemeResId " + Integer.toHexString(splashScreenThemeResId);
}
public static final @android.annotation.NonNull Creator<StartingWindowInfo> CREATOR =
new Creator<StartingWindowInfo>() {
public StartingWindowInfo createFromParcel(@NonNull Parcel source) {
return new StartingWindowInfo(source);
}
public StartingWindowInfo[] newArray(int size) {
return new StartingWindowInfo[size];
}
};
}
|