Debian Codegraph @

core/java/android/window/StartingWindowInfo.java

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