diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java index e3362870cdf07..cb7afc77a65bd 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java @@ -15,18 +15,10 @@ */ package com.android.wm.shell.startingsurface; -import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN; -import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SPLASH_SCREEN; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_CREATED; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_NEW_TASK; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_SAME_PACKAGE; -import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; @@ -68,27 +60,24 @@ import java.util.function.BiConsumer; */ public class StartingWindowController implements RemoteCallable { private static final String TAG = StartingWindowController.class.getSimpleName(); + // TODO b/183150443 Keep this flag open for a while, several things might need to adjust. - static final boolean DEBUG_SPLASH_SCREEN = true; - static final boolean DEBUG_TASK_SNAPSHOT = false; + public static final boolean DEBUG_SPLASH_SCREEN = true; + public static final boolean DEBUG_TASK_SNAPSHOT = false; private final StartingSurfaceDrawer mStartingSurfaceDrawer; - private final StartingTypeChecker mStartingTypeChecker = new StartingTypeChecker(); + private final StartingWindowTypeAlgorithm mStartingWindowTypeAlgorithm; private BiConsumer mTaskLaunchingCallback; private final StartingSurfaceImpl mImpl = new StartingSurfaceImpl(); private final Context mContext; private final ShellExecutor mSplashScreenExecutor; - // For Car Launcher - public StartingWindowController(Context context, ShellExecutor splashScreenExecutor) { - this(context, splashScreenExecutor, new TransactionPool()); - } - public StartingWindowController(Context context, ShellExecutor splashScreenExecutor, - TransactionPool pool) { + StartingWindowTypeAlgorithm startingWindowTypeAlgorithm, TransactionPool pool) { mContext = context; mStartingSurfaceDrawer = new StartingSurfaceDrawer(context, splashScreenExecutor, pool); + mStartingWindowTypeAlgorithm = startingWindowTypeAlgorithm; mSplashScreenExecutor = splashScreenExecutor; } @@ -109,90 +98,6 @@ public class StartingWindowController implements RemoteCallable { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "addStartingWindow"); - final int suggestionType = mStartingTypeChecker.estimateStartingWindowType( + + final int suggestionType = mStartingWindowTypeAlgorithm.getSuggestedWindowType( windowInfo); final RunningTaskInfo runningTaskInfo = windowInfo.taskInfo; if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) { @@ -228,8 +134,10 @@ public class StartingWindowController implements RemoteCallable