Port log to protologs for shell starting window.

Bug: 185288910
Test: adb shell dumpsys activity service SystemUIService WMShell\
enable-text WM_SHELL_STARTING_WINDOW

Change-Id: I549ed9564d662507df31fac2a69cd9ac0cb018a6
This commit is contained in:
wilsonshih
2021-11-10 20:11:26 +08:00
parent 6773eb3208
commit 41bb305eeb
8 changed files with 99 additions and 131 deletions

View File

@@ -32,6 +32,8 @@ public enum ShellProtoLogGroup implements IProtoLogGroup {
Consts.TAG_WM_SHELL),
WM_SHELL_DRAG_AND_DROP(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
Consts.TAG_WM_SHELL),
WM_SHELL_STARTING_WINDOW(Consts.ENABLE_DEBUG, Consts.ENABLE_LOG_TO_PROTO_DEBUG, false,
Consts.TAG_WM_STARTING_WINDOW),
TEST_GROUP(true, true, false, "WindowManagerShellProtoLogTest");
private final boolean mEnabled;
@@ -91,6 +93,7 @@ public enum ShellProtoLogGroup implements IProtoLogGroup {
private static class Consts {
private static final String TAG_WM_SHELL = "WindowManagerShell";
private static final String TAG_WM_STARTING_WINDOW = "ShellStartingWindow";
private static final boolean ENABLE_DEBUG = true;
private static final boolean ENABLE_LOG_TO_PROTO_DEBUG = true;

View File

@@ -56,7 +56,7 @@ import com.android.wm.shell.common.TransactionPool;
public class SplashScreenExitAnimation implements Animator.AnimatorListener {
private static final boolean DEBUG_EXIT_ANIMATION = false;
private static final boolean DEBUG_EXIT_ANIMATION_BLEND = false;
private static final String TAG = StartingSurfaceDrawer.TAG;
private static final String TAG = StartingWindowController.TAG;
private static final Interpolator ICON_INTERPOLATOR = new PathInterpolator(0.15f, 0f, 1f, 1f);
private static final Interpolator MASK_RADIUS_INTERPOLATOR =

View File

@@ -61,9 +61,11 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.palette.Palette;
import com.android.internal.graphics.palette.Quantizer;
import com.android.internal.graphics.palette.VariationalKMeansQuantizer;
import com.android.internal.protolog.common.ProtoLog;
import com.android.launcher3.icons.BaseIconFactory;
import com.android.launcher3.icons.IconProvider;
import com.android.wm.shell.common.TransactionPool;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import java.util.List;
import java.util.function.Consumer;
@@ -78,8 +80,7 @@ import java.util.function.UnaryOperator;
* @hide
*/
public class SplashscreenContentDrawer {
private static final String TAG = StartingSurfaceDrawer.TAG;
private static final boolean DEBUG = StartingSurfaceDrawer.DEBUG_SPLASH_SCREEN;
private static final String TAG = StartingWindowController.TAG;
// The acceptable area ratio of foreground_icon_area/background_icon_area, if there is an
// icon which it's non-transparent foreground area is similar to it's background area, then
@@ -295,12 +296,10 @@ public class SplashscreenContentDrawer {
R.styleable.Window_windowSplashScreenIconBackgroundColor, def),
Color.TRANSPARENT);
typedArray.recycle();
if (DEBUG) {
Slog.d(TAG, "window attributes color: "
+ Integer.toHexString(attrs.mWindowBgColor)
+ " icon " + attrs.mSplashScreenIcon + " duration " + attrs.mAnimationDuration
+ " brandImage " + attrs.mBrandingImage);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"getWindowAttrs: window attributes color: %s, replace icon: %b, avd duration: %d",
Integer.toHexString(attrs.mWindowBgColor), attrs.mSplashScreenIcon != null,
attrs.mAnimationDuration);
}
/** Creates the wrapper with system theme to avoid unexpected styles from app. */
@@ -385,9 +384,8 @@ public class SplashscreenContentDrawer {
iconDrawable = mContext.getPackageManager().getDefaultActivityIcon();
}
if (!processAdaptiveIcon(iconDrawable)) {
if (DEBUG) {
Slog.d(TAG, "The icon is not an AdaptiveIconDrawable");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"The icon is not an AdaptiveIconDrawable");
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "legacy_icon_factory");
final ShapeIconFactory factory = new ShapeIconFactory(
SplashscreenContentDrawer.this.mContext,
@@ -435,14 +433,14 @@ public class SplashscreenContentDrawer {
() -> new DrawableColorTester(iconForeground,
DrawableColorTester.TRANSLUCENT_FILTER /* filterType */),
() -> new DrawableColorTester(adaptiveIconDrawable.getBackground()));
if (DEBUG) {
Slog.d(TAG, "FgMainColor=" + Integer.toHexString(iconColor.mFgColor)
+ " BgMainColor=" + Integer.toHexString(iconColor.mBgColor)
+ " IsBgComplex=" + iconColor.mIsBgComplex
+ " FromCache=" + (iconColor.mReuseCount > 0)
+ " ThemeColor=" + Integer.toHexString(mThemeColor));
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"processAdaptiveIcon: FgMainColor=%s, BgMainColor=%s, "
+ "IsBgComplex=%b, FromCache=%b, ThemeColor=%s",
Integer.toHexString(iconColor.mFgColor),
Integer.toHexString(iconColor.mBgColor),
iconColor.mIsBgComplex,
iconColor.mReuseCount > 0,
Integer.toHexString(mThemeColor));
// Only draw the foreground of AdaptiveIcon to the splash screen if below condition
// meet:
@@ -456,9 +454,8 @@ public class SplashscreenContentDrawer {
&& (isRgbSimilarInHsv(mThemeColor, iconColor.mBgColor)
|| (iconColor.mIsBgGrayscale
&& !isRgbSimilarInHsv(mThemeColor, iconColor.mFgColor)))) {
if (DEBUG) {
Slog.d(TAG, "makeSplashScreenContentView: choose fg icon");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"processAdaptiveIcon: choose fg icon");
// Reference AdaptiveIcon description, outer is 108 and inner is 72, so we
// scale by 192/160 if we only draw adaptiveIcon's foreground.
final float noBgScale =
@@ -469,9 +466,8 @@ public class SplashscreenContentDrawer {
mFinalIconSize = (int) (0.5f + mIconSize * noBgScale);
createIconDrawable(iconForeground, false);
} else {
if (DEBUG) {
Slog.d(TAG, "makeSplashScreenContentView: draw whole icon");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"processAdaptiveIcon: draw whole icon");
createIconDrawable(iconDrawable, false);
}
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
@@ -504,9 +500,6 @@ public class SplashscreenContentDrawer {
mBrandingImageHeight);
}
final SplashScreenView splashScreenView = builder.build();
if (DEBUG) {
Slog.d(TAG, "fillViewWithIcon surfaceWindowView " + splashScreenView);
}
if (mSuggestType != STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN) {
splashScreenView.addOnAttachStateChangeListener(
new View.OnAttachStateChangeListener() {
@@ -536,10 +529,9 @@ public class SplashscreenContentDrawer {
final float lumB = Color.luminance(b);
final float contrastRatio = lumA > lumB
? (lumA + 0.05f) / (lumB + 0.05f) : (lumB + 0.05f) / (lumA + 0.05f);
if (DEBUG) {
Slog.d(TAG, "isRgbSimilarInHsv a: " + Integer.toHexString(a)
+ " b " + Integer.toHexString(b) + " contrast ratio: " + contrastRatio);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"isRgbSimilarInHsv a:%s, b:%s, contrast ratio:%f",
Integer.toHexString(a), Integer.toHexString(b), contrastRatio);
if (contrastRatio < 2) {
return true;
}
@@ -560,14 +552,11 @@ public class SplashscreenContentDrawer {
final double square = squareH + squareS + squareV;
final double mean = square / 3;
final double root = Math.sqrt(mean);
if (DEBUG) {
Slog.d(TAG, "hsvDiff " + minAngle
+ " ah " + aHsv[0] + " bh " + bHsv[0]
+ " as " + aHsv[1] + " bs " + bHsv[1]
+ " av " + aHsv[2] + " bv " + bHsv[2]
+ " sqH " + squareH + " sqS " + squareS + " sqV " + squareV
+ " root " + root);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"isRgbSimilarInHsv hsvDiff: %d, ah: %f, bh: %f, as: %f, bs: %f, av: %f, bv: %f, "
+ "sqH: %f, sqS: %f, sqV: %f, rsm: %f",
minAngle, aHsv[0], bHsv[0], aHsv[1], bHsv[1], aHsv[2], bHsv[2],
squareH, squareS, squareV, root);
return root < 0.1;
}
@@ -598,9 +587,8 @@ public class SplashscreenContentDrawer {
if (drawable instanceof LayerDrawable) {
LayerDrawable layerDrawable = (LayerDrawable) drawable;
if (layerDrawable.getNumberOfLayers() > 0) {
if (DEBUG) {
Slog.d(TAG, "replace drawable with bottom layer drawable");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"DrawableColorTester: replace drawable with bottom layer drawable");
drawable = layerDrawable.getDrawable(0);
}
}
@@ -805,9 +793,8 @@ public class SplashscreenContentDrawer {
}
}
if (realSize == 0) {
if (DEBUG) {
Slog.d(TAG, "quantize: this is pure transparent image");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"DrawableTester quantize: pure transparent image");
mInnerQuantizer.quantize(pixels, maxColors);
return;
}

View File

@@ -52,7 +52,7 @@ import com.android.internal.R;
*/
public class SplashscreenIconDrawableFactory {
private static final String TAG = "SplashscreenIconDrawableFactory";
private static final String TAG = StartingWindowController.TAG;
/**
* @return An array containing the foreground drawable at index 0 and if needed a background

View File

@@ -61,10 +61,12 @@ import android.window.TaskSnapshot;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.ProtoLog;
import com.android.launcher3.icons.IconProvider;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.TransactionPool;
import com.android.wm.shell.common.annotations.ShellSplashscreenThread;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import java.util.function.Supplier;
@@ -106,9 +108,7 @@ import java.util.function.Supplier;
*/
@ShellSplashscreenThread
public class StartingSurfaceDrawer {
static final String TAG = StartingSurfaceDrawer.class.getSimpleName();
static final boolean DEBUG_SPLASH_SCREEN = StartingWindowController.DEBUG_SPLASH_SCREEN;
static final boolean DEBUG_TASK_SNAPSHOT = StartingWindowController.DEBUG_TASK_SNAPSHOT;
private static final String TAG = StartingWindowController.TAG;
private final Context mContext;
private final DisplayManager mDisplayManager;
@@ -178,11 +178,9 @@ public class StartingSurfaceDrawer {
// replace with the default theme if the application didn't set
final int theme = getSplashScreenTheme(windowInfo.splashScreenThemeResId, activityInfo);
if (DEBUG_SPLASH_SCREEN) {
Slog.d(TAG, "addSplashScreen " + activityInfo.packageName
+ " theme=" + Integer.toHexString(theme) + " task=" + taskInfo.taskId
+ " suggestType=" + suggestType);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"addSplashScreen for package: %s with theme: %s for task: %d, suggestType: %d",
activityInfo.packageName, Integer.toHexString(theme), taskId, suggestType);
final Display display = getDisplay(displayId);
if (display == null) {
// Can't show splash screen on requested display, so skip showing at all.
@@ -207,10 +205,9 @@ public class StartingSurfaceDrawer {
final Configuration taskConfig = taskInfo.getConfiguration();
if (taskConfig.diffPublicOnly(context.getResources().getConfiguration()) != 0) {
if (DEBUG_SPLASH_SCREEN) {
Slog.d(TAG, "addSplashScreen: creating context based"
+ " on task Configuration " + taskConfig + " for splash screen");
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"addSplashScreen: creating context based on task Configuration %s",
taskConfig);
final Context overrideContext = context.createConfigurationContext(taskConfig);
overrideContext.setTheme(theme);
final TypedArray typedArray = overrideContext.obtainStyledAttributes(
@@ -221,10 +218,9 @@ public class StartingSurfaceDrawer {
// We want to use the windowBackground for the override context if it is
// available, otherwise we use the default one to make sure a themed starting
// window is displayed for the app.
if (DEBUG_SPLASH_SCREEN) {
Slog.d(TAG, "addSplashScreen: apply overrideConfig"
+ taskConfig + " to starting window resId=" + resId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"addSplashScreen: apply overrideConfig %s",
taskConfig);
context = overrideContext;
}
} catch (Resources.NotFoundException e) {
@@ -460,10 +456,9 @@ public class StartingSurfaceDrawer {
* Called when the content of a task is ready to show, starting window can be removed.
*/
public void removeStartingWindow(StartingWindowRemovalInfo removalInfo) {
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
Slog.d(TAG, "Task start finish, remove starting surface for task "
+ removalInfo.taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Task start finish, remove starting surface for task: %d",
removalInfo.taskId);
removeWindowSynced(removalInfo);
}
@@ -485,10 +480,9 @@ public class StartingSurfaceDrawer {
} else {
parcelable = null;
}
if (DEBUG_SPLASH_SCREEN) {
Slog.v(TAG, "Copying splash screen window view for task: " + taskId
+ " parcelable: " + parcelable);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Copying splash screen window view for task: %d with parcelable %b",
taskId, parcelable != null);
ActivityTaskManager.getInstance().onSplashScreenViewCopyFinished(taskId, parcelable);
}
@@ -514,11 +508,9 @@ public class StartingSurfaceDrawer {
return;
}
mAnimatedSplashScreenSurfaceHosts.remove(taskId);
if (DEBUG_SPLASH_SCREEN) {
String reason = fromServer ? "Server cleaned up" : "App removed";
Slog.v(TAG, reason + "the splash screen. Releasing SurfaceControlViewHost for task:"
+ taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"%s the splash screen. Releasing SurfaceControlViewHost for task: %d",
fromServer ? "Server cleaned up" : "App removed", taskId);
SplashScreenView.releaseIconHost(viewHost);
}
@@ -576,9 +568,8 @@ public class StartingSurfaceDrawer {
final StartingWindowRecord record = mStartingWindowRecords.get(taskId);
if (record != null) {
if (record.mDecorView != null) {
if (DEBUG_SPLASH_SCREEN) {
Slog.v(TAG, "Removing splash screen window for task: " + taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Removing splash screen window for task: %d", taskId);
if (record.mContentView != null) {
if (record.mSuggestType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN) {
removeWindowInner(record.mDecorView, false);
@@ -601,9 +592,8 @@ public class StartingSurfaceDrawer {
mStartingWindowRecords.remove(taskId);
}
if (record.mTaskSnapshotWindow != null) {
if (DEBUG_TASK_SNAPSHOT) {
Slog.v(TAG, "Removing task snapshot window for " + taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Removing task snapshot window for %d", taskId);
record.mTaskSnapshotWindow.scheduleRemove(
() -> mStartingWindowRecords.remove(taskId), removalInfo.deferRemoveForIme);
}

View File

@@ -29,9 +29,7 @@ import android.app.TaskInfo;
import android.content.Context;
import android.graphics.Color;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.Trace;
import android.util.Slog;
import android.util.SparseIntArray;
import android.window.StartingWindowInfo;
import android.window.StartingWindowInfo.StartingWindowType;
@@ -66,10 +64,7 @@ import com.android.wm.shell.common.TransactionPool;
* @hide
*/
public class StartingWindowController implements RemoteCallable<StartingWindowController> {
private static final String TAG = StartingWindowController.class.getSimpleName();
public static final boolean DEBUG_SPLASH_SCREEN = false;
public static final boolean DEBUG_TASK_SNAPSHOT = false;
public static final String TAG = "ShellStartingWindow";
private static final long TASK_BG_COLOR_RETAIN_TIME_MS = 5000;

View File

@@ -85,8 +85,10 @@ import android.window.TaskSnapshot;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.DecorView;
import com.android.internal.protolog.common.ProtoLog;
import com.android.internal.view.BaseIWindow;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
/**
* This class represents a starting window that shows a snapshot.
@@ -113,8 +115,7 @@ public class TaskSnapshotWindow {
| FLAG_SCALED
| FLAG_SECURE;
private static final String TAG = StartingSurfaceDrawer.TAG;
private static final boolean DEBUG = StartingSurfaceDrawer.DEBUG_TASK_SNAPSHOT;
private static final String TAG = StartingWindowController.TAG;
private static final String TITLE_FORMAT = "SnapshotStartingWindow for taskId=%s";
private static final long DELAY_REMOVAL_TIME_GENERAL = 100;
@@ -158,9 +159,8 @@ public class TaskSnapshotWindow {
@NonNull Runnable clearWindowHandler) {
final ActivityManager.RunningTaskInfo runningTaskInfo = info.taskInfo;
final int taskId = runningTaskInfo.taskId;
if (DEBUG) {
Slog.d(TAG, "create taskSnapshot surface for task: " + taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"create taskSnapshot surface for task: %d", taskId);
final WindowManager.LayoutParams attrs = info.topOpaqueWindowLayoutParams;
final WindowManager.LayoutParams mainWindowParams = info.mainWindowLayoutParams;
@@ -327,17 +327,15 @@ public class TaskSnapshotWindow {
? MAX_DELAY_REMOVAL_TIME_IME_VISIBLE
: DELAY_REMOVAL_TIME_GENERAL;
mSplashScreenExecutor.executeDelayed(mScheduledRunnable, delayRemovalTime);
if (DEBUG) {
Slog.d(TAG, "Defer removing snapshot surface in " + delayRemovalTime);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Defer removing snapshot surface in %d", delayRemovalTime);
}
void removeImmediately() {
mSplashScreenExecutor.removeCallbacks(mScheduledRunnable);
try {
if (DEBUG) {
Slog.d(TAG, "Removing taskSnapshot surface, mHasDrawn: " + mHasDrawn);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Removing taskSnapshot surface, mHasDrawn=%b", mHasDrawn);
mSession.remove(mWindow);
} catch (RemoteException e) {
// nothing
@@ -363,9 +361,8 @@ public class TaskSnapshotWindow {
}
private void drawSnapshot() {
if (DEBUG) {
Slog.d(TAG, "Drawing snapshot surface sizeMismatch= " + mSizeMismatch);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"Drawing snapshot surface sizeMismatch=%b", mSizeMismatch);
if (mSizeMismatch) {
// The dimensions of the buffer and the window don't match, so attaching the buffer
// will fail. Better create a child window with the exact dimensions and fill the parent

View File

@@ -31,13 +31,11 @@ import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN;
import static com.android.wm.shell.startingsurface.StartingWindowController.DEBUG_SPLASH_SCREEN;
import static com.android.wm.shell.startingsurface.StartingWindowController.DEBUG_TASK_SNAPSHOT;
import android.util.Slog;
import android.window.StartingWindowInfo;
import android.window.TaskSnapshot;
import com.android.internal.protolog.common.ProtoLog;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm;
/**
@@ -45,8 +43,6 @@ import com.android.wm.shell.startingsurface.StartingWindowTypeAlgorithm;
* At the moment also used on Android Auto and Wear OS.
*/
public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgorithm {
private static final String TAG = PhoneStartingWindowTypeAlgorithm.class.getSimpleName();
@Override
public int getSuggestedWindowType(StartingWindowInfo windowInfo) {
final int parameter = windowInfo.startingWindowTypeParameter;
@@ -62,17 +58,19 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
final boolean activityDrawn = (parameter & TYPE_PARAMETER_ACTIVITY_DRAWN) != 0;
final boolean topIsHome = windowInfo.taskInfo.topActivityType == ACTIVITY_TYPE_HOME;
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
Slog.d(TAG, "preferredStartingWindowType newTask:" + newTask
+ " taskSwitch:" + taskSwitch
+ " processRunning:" + processRunning
+ " allowTaskSnapshot:" + allowTaskSnapshot
+ " activityCreated:" + activityCreated
+ " useEmptySplashScreen:" + useEmptySplashScreen
+ " legacySplashScreen:" + legacySplashScreen
+ " activityDrawn:" + activityDrawn
+ " topIsHome:" + topIsHome);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"preferredStartingWindowType "
+ "newTask=%b, "
+ "taskSwitch=%b, "
+ "processRunning=%b, "
+ "allowTaskSnapshot=%b, "
+ "activityCreated=%b, "
+ "useEmptySplashScreen=%b, "
+ "legacySplashScreen=%b, "
+ "activityDrawn=%b, "
+ "topIsHome=%b",
newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated,
useEmptySplashScreen, legacySplashScreen, activityDrawn, topIsHome);
if (!topIsHome) {
if (!processRunning
@@ -104,26 +102,24 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
private boolean isSnapshotCompatible(StartingWindowInfo windowInfo) {
final TaskSnapshot snapshot = windowInfo.taskSnapshot;
if (snapshot == null) {
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
Slog.d(TAG, "isSnapshotCompatible no snapshot " + windowInfo.taskInfo.taskId);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"isSnapshotCompatible no snapshot, taskId=%d",
windowInfo.taskInfo.taskId);
return false;
}
if (!snapshot.getTopActivityComponent().equals(windowInfo.taskInfo.topActivity)) {
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
Slog.d(TAG, "isSnapshotCompatible obsoleted snapshot "
+ windowInfo.taskInfo.topActivity);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"isSnapshotCompatible obsoleted snapshot for %s",
windowInfo.taskInfo.topActivity);
return false;
}
final int taskRotation = windowInfo.taskInfo.configuration
.windowConfiguration.getRotation();
final int snapshotRotation = snapshot.getRotation();
if (DEBUG_SPLASH_SCREEN || DEBUG_TASK_SNAPSHOT) {
Slog.d(TAG, "isSnapshotCompatible rotation " + taskRotation
+ " snapshot " + snapshotRotation);
}
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_STARTING_WINDOW,
"isSnapshotCompatible taskRotation=%d, snapshotRotation=%d",
taskRotation, snapshotRotation);
return taskRotation == snapshotRotation;
}
}