Correcting the package name used on splash screen window.
The top activity in TaskActivitiesReport can be filter out if the state of top activity is INITIALIZING, this doesn't make sense for splash screen, because the state of the top activity do can be INITIALIZING. Create a filed targetActivityInfo in StartingWindowInfo to specify the starting activity info. Bug: 193459277 Test: atest SplashscreenTests StartingSurfaceDrawerTests Change-Id: Ifec7aff644013a0426e0622162ab24f6b9fb3d8f
This commit is contained in:
parent
61d71ccaae
commit
7a7722abe0
core/java/android/window
libs/WindowManager/Shell
src/com/android/wm/shell/startingsurface
tests/unittest/src/com/android/wm/shell/startingsurface
services/core/java/com/android/server/wm
@ -22,6 +22,7 @@ import android.annotation.Nullable;
|
||||
import android.annotation.TestApi;
|
||||
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;
|
||||
@ -77,6 +78,14 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
@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
|
||||
@ -174,6 +183,7 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
@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);
|
||||
@ -185,6 +195,7 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
|
||||
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(
|
||||
@ -198,6 +209,7 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartingWindowInfo{taskId=" + taskInfo.taskId
|
||||
+ " targetActivityInfo=" + targetActivityInfo
|
||||
+ " displayId=" + taskInfo.displayId
|
||||
+ " topActivityType=" + taskInfo.topActivityType
|
||||
+ " preferredStartingWindowType="
|
||||
|
@ -168,16 +168,14 @@ public class StartingSurfaceDrawer {
|
||||
void addSplashScreenStartingWindow(StartingWindowInfo windowInfo, IBinder appToken,
|
||||
@StartingWindowType int suggestType) {
|
||||
final RunningTaskInfo taskInfo = windowInfo.taskInfo;
|
||||
final ActivityInfo activityInfo = taskInfo.topActivityInfo;
|
||||
if (activityInfo == null) {
|
||||
final ActivityInfo activityInfo = windowInfo.targetActivityInfo != null
|
||||
? windowInfo.targetActivityInfo
|
||||
: taskInfo.topActivityInfo;
|
||||
if (activityInfo == null || activityInfo.packageName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int displayId = taskInfo.displayId;
|
||||
if (activityInfo.packageName == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int taskId = taskInfo.taskId;
|
||||
Context context = mContext;
|
||||
// replace with the default theme if the application didn't set
|
||||
|
@ -214,6 +214,7 @@ public class StartingSurfaceDrawerTests {
|
||||
final ActivityManager.RunningTaskInfo taskInfo = new ActivityManager.RunningTaskInfo();
|
||||
taskInfo.topActivityInfo = info;
|
||||
taskInfo.taskId = taskId;
|
||||
windowInfo.targetActivityInfo = info;
|
||||
windowInfo.taskInfo = taskInfo;
|
||||
return windowInfo;
|
||||
}
|
||||
|
@ -4167,7 +4167,9 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
StartingWindowInfo getStartingWindowInfo(ActivityRecord activity) {
|
||||
final StartingWindowInfo info = new StartingWindowInfo();
|
||||
info.taskInfo = getTaskInfo();
|
||||
|
||||
info.targetActivityInfo = info.taskInfo.topActivityInfo != null
|
||||
&& activity.info != info.taskInfo.topActivityInfo
|
||||
? activity.info : null;
|
||||
info.isKeyguardOccluded =
|
||||
mAtmService.mKeyguardController.isDisplayOccluded(DEFAULT_DISPLAY);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user