| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public final class StartingWindowInfo implements Parcelable { |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
public static final int STARTING_WINDOW_TYPE_NONE = 0; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public static final int STARTING_WINDOW_TYPE_SPLASH_SCREEN = 1; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public static final int STARTING_WINDOW_TYPE_SNAPSHOT = 2; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public static final int STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN = 3; |
| 57 |
|
| 58 |
|
| 59 |
public static final int STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN = 4; |
| 60 |
|
| 61 |
|
| 62 |
|
| 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 |
|
| 75 |
|
| 76 |
|
| 77 |
@NonNull |
| 78 |
public ActivityManager.RunningTaskInfo taskInfo; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
@Nullable |
| 86 |
public ActivityInfo targetActivityInfo; |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
@Nullable |
| 93 |
public InsetsState topOpaqueWindowInsetsState; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
@Nullable |
| 100 |
public WindowManager.LayoutParams topOpaqueWindowLayoutParams; |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
@Nullable |
| 107 |
public WindowManager.LayoutParams mainWindowLayoutParams; |
| 108 |
|
| 109 |
|
| 110 |
|
| 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 |
|
| 126 |
|
| 127 |
|
| 128 |
public static final int TYPE_PARAMETER_NEW_TASK = 0x00000001; |
| 129 |
|
| 130 |
public static final int TYPE_PARAMETER_TASK_SWITCH = 0x00000002; |
| 131 |
|
| 132 |
public static final int TYPE_PARAMETER_PROCESS_RUNNING = 0x00000004; |
| 133 |
|
| 134 |
public static final int TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT = 0x00000008; |
| 135 |
|
| 136 |
public static final int TYPE_PARAMETER_ACTIVITY_CREATED = 0x00000010; |
| 137 |
|
| 138 |
public static final int TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN = 0x00000020; |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040; |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
public static final int TYPE_PARAMETER_LEGACY_SPLASH_SCREEN = 0x80000000; |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
public int startingWindowTypeParameter; |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
public int splashScreenThemeResId; |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
public boolean isKeyguardOccluded = false; |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
public TaskSnapshot taskSnapshot; |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 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 |
|
| 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 |
} |