[RESTRICT AUTOMERGE] Do not resume activity if behind a translucent task am: 51d287d831

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

Change-Id: I9b3c12eaf5f1e8597c1577610deb2c73e966c8ba
This commit is contained in:
Jeff Chang
2022-03-07 04:49:35 +00:00
committed by Automerger Merge Worker
3 changed files with 14 additions and 2 deletions

View File

@@ -93,7 +93,7 @@ class EnsureActivitiesVisibleHelper {
// activities are actually behind other fullscreen activities, but still required
// to be visible (such as performing Recents animation).
final boolean resumeTopActivity = mTop != null && !mTop.mLaunchTaskBehind
&& mTask.isTopActivityFocusable()
&& mTask.canBeResumed(starting)
&& (starting == null || !starting.isDescendantOf(mTask));
mTask.forAllActivities(a -> {

View File

@@ -1948,7 +1948,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
try {
if (mTaskSupervisor.realStartActivityLocked(r, app,
top == r && r.isFocusable() /*andResume*/, true /*checkConfig*/)) {
top == r && r.getTask().canBeResumed(r) /*andResume*/,
true /*checkConfig*/)) {
mTmpBoolean = true;
}
} catch (RemoteException e) {

View File

@@ -4240,6 +4240,17 @@ class Task extends WindowContainer<WindowContainer> {
return getVisibility(starting) != TASK_VISIBILITY_INVISIBLE;
}
/**
* Returns {@code true} is the activity in this Task can be resumed.
*
* @param starting The currently starting activity or {@code null} if there is none.
*/
boolean canBeResumed(@Nullable ActivityRecord starting) {
// No need to resume activity in Task that is not visible.
return isTopActivityFocusable()
&& getVisibility(starting) == TASK_VISIBILITY_VISIBLE;
}
/**
* Returns true if the task should be visible.
*