diff options
4 files changed, 32 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index 61cca00f76ac..0c08735fbc0c 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -257,6 +257,12 @@ public class ActivityOptions extends ComponentOptions { private static final String KEY_LAUNCH_TASK_ID = "android.activity.launchTaskId"; /** + * See {@link #setDisableStartingWindow}. + * @hide + */ + private static final String KEY_DISABLE_STARTING_WINDOW = "android.activity.disableStarting"; + + /** * See {@link #setPendingIntentLaunchFlags(int)} * @hide */ @@ -467,6 +473,7 @@ public class ActivityOptions extends ComponentOptions { private PictureInPictureParams mLaunchIntoPipParams; private boolean mDismissKeyguard; private boolean mIgnorePendingIntentCreatorForegroundState; + private boolean mDisableStartingWindow; /** * Create an ActivityOptions specifying a custom animation to run when @@ -1272,6 +1279,7 @@ public class ActivityOptions extends ComponentOptions { mDismissKeyguard = opts.getBoolean(KEY_DISMISS_KEYGUARD); mIgnorePendingIntentCreatorForegroundState = opts.getBoolean( KEY_IGNORE_PENDING_INTENT_CREATOR_FOREGROUND_STATE); + mDisableStartingWindow = opts.getBoolean(KEY_DISABLE_STARTING_WINDOW); } /** @@ -1671,6 +1679,22 @@ public class ActivityOptions extends ComponentOptions { } /** + * Sets whether recents disable showing starting window when activity launch. + * @hide + */ + @RequiresPermission(START_TASKS_FROM_RECENTS) + public void setDisableStartingWindow(boolean disable) { + mDisableStartingWindow = disable; + } + + /** + * @hide + */ + public boolean getDisableStartingWindow() { + return mDisableStartingWindow; + } + + /** * Specifies intent flags to be applied for any activity started from a PendingIntent. * * @hide @@ -2178,6 +2202,9 @@ public class ActivityOptions extends ComponentOptions { b.putBoolean(KEY_IGNORE_PENDING_INTENT_CREATOR_FOREGROUND_STATE, mIgnorePendingIntentCreatorForegroundState); } + if (mDisableStartingWindow) { + b.putBoolean(KEY_DISABLE_STARTING_WINDOW, mDisableStartingWindow); + } return b; } diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index a870b8afe2f9..e3916cbc30bd 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -1481,7 +1481,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { handleNonResizableTaskIfNeeded(task, WINDOWING_MODE_UNDEFINED, mRootWindowContainer.getDefaultTaskDisplayArea(), currentRootTask, forceNonResizeable); - if (r != null) { + if (r != null && (options == null || !options.getDisableStartingWindow())) { // Use a starting window to reduce the transition latency for reshowing the task. // Note that with shell transition, this should be executed before requesting // transition to avoid delaying the starting window. diff --git a/services/core/java/com/android/server/wm/SafeActivityOptions.java b/services/core/java/com/android/server/wm/SafeActivityOptions.java index 8bacacd1451c..e69a732b3fde 100644 --- a/services/core/java/com/android/server/wm/SafeActivityOptions.java +++ b/services/core/java/com/android/server/wm/SafeActivityOptions.java @@ -263,7 +263,7 @@ public class SafeActivityOptions { ActivityOptions options, int callingPid, int callingUid) { // If a launch task id is specified, then ensure that the caller is the recents // component or has the START_TASKS_FROM_RECENTS permission - if (options.getLaunchTaskId() != INVALID_TASK_ID + if ((options.getLaunchTaskId() != INVALID_TASK_ID || options.getDisableStartingWindow()) && !supervisor.mRecentTasks.isCallerRecents(callingUid)) { final int startInTaskPerm = ActivityTaskManagerService.checkPermission( START_TASKS_FROM_RECENTS, callingPid, callingUid); diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index aede32c453f2..e77c6f5d799b 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5049,6 +5049,9 @@ class Task extends TaskFragment { == ActivityOptions.ANIM_SCENE_TRANSITION) { doShow = false; } + if (options != null && options.getDisableStartingWindow()) { + doShow = false; + } if (r.mLaunchTaskBehind) { // Don't do a starting window for mLaunchTaskBehind. More importantly make sure we // tell WindowManager that r is visible even though it is at the back of the root |