Merge "Allow to disable showing starting window when start from recents" into tm-qpr-dev am: 67b139b04e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18800470

Change-Id: I2eab7b41505fbab36ea26b7d1bdb8abe446f74a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Pat Manning
2022-10-12 11:53:11 +00:00
committed by Automerger Merge Worker
4 changed files with 32 additions and 2 deletions

View File

@@ -265,6 +265,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
@@ -477,6 +483,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
@@ -1284,6 +1291,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);
}
/**
@@ -1699,6 +1707,22 @@ public class ActivityOptions extends ComponentOptions {
return mLaunchTaskId;
}
/**
* 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.
*
@@ -2210,6 +2234,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;
}

View File

@@ -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.

View File

@@ -265,7 +265,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);

View File

@@ -5075,6 +5075,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