Merge "Ensure the above-top finishing activity is invisible" into tm-qpr-dev am: 41f50d35c2

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

Change-Id: If945842137c2adcadb9e464bf4919dc1ee5a9ae6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Louis Chang
2022-12-17 06:43:32 +00:00
committed by Automerger Merge Worker

View File

@@ -28,7 +28,7 @@ import java.util.ArrayList;
/** Helper class to ensure activities are in the right visible state for a container. */ /** Helper class to ensure activities are in the right visible state for a container. */
class EnsureActivitiesVisibleHelper { class EnsureActivitiesVisibleHelper {
private final TaskFragment mTaskFragment; private final TaskFragment mTaskFragment;
private ActivityRecord mTop; private ActivityRecord mTopRunningActivity;
private ActivityRecord mStarting; private ActivityRecord mStarting;
private boolean mAboveTop; private boolean mAboveTop;
private boolean mContainerShouldBeVisible; private boolean mContainerShouldBeVisible;
@@ -54,10 +54,10 @@ class EnsureActivitiesVisibleHelper {
void reset(ActivityRecord starting, int configChanges, boolean preserveWindows, void reset(ActivityRecord starting, int configChanges, boolean preserveWindows,
boolean notifyClients) { boolean notifyClients) {
mStarting = starting; mStarting = starting;
mTop = mTaskFragment.topRunningActivity(); mTopRunningActivity = mTaskFragment.topRunningActivity();
// If the top activity is not fullscreen, then we need to make sure any activities under it // If the top activity is not fullscreen, then we need to make sure any activities under it
// are now visible. // are now visible.
mAboveTop = mTop != null; mAboveTop = mTopRunningActivity != null;
mContainerShouldBeVisible = mTaskFragment.shouldBeVisible(mStarting); mContainerShouldBeVisible = mTaskFragment.shouldBeVisible(mStarting);
mBehindFullyOccludedContainer = !mContainerShouldBeVisible; mBehindFullyOccludedContainer = !mContainerShouldBeVisible;
mConfigChanges = configChanges; mConfigChanges = configChanges;
@@ -85,18 +85,19 @@ class EnsureActivitiesVisibleHelper {
reset(starting, configChanges, preserveWindows, notifyClients); reset(starting, configChanges, preserveWindows, notifyClients);
if (DEBUG_VISIBILITY) { if (DEBUG_VISIBILITY) {
Slog.v(TAG_VISIBILITY, "ensureActivitiesVisible behind " + mTop Slog.v(TAG_VISIBILITY, "ensureActivitiesVisible behind " + mTopRunningActivity
+ " configChanges=0x" + Integer.toHexString(configChanges)); + " configChanges=0x" + Integer.toHexString(configChanges));
} }
if (mTop != null && mTaskFragment.asTask() != null) { if (mTopRunningActivity != null && mTaskFragment.asTask() != null) {
// TODO(14709632): Check if this needed to be implemented in TaskFragment. // TODO(14709632): Check if this needed to be implemented in TaskFragment.
mTaskFragment.asTask().checkTranslucentActivityWaiting(mTop); mTaskFragment.asTask().checkTranslucentActivityWaiting(mTopRunningActivity);
} }
// We should not resume activities that being launched behind because these // We should not resume activities that being launched behind because these
// activities are actually behind other fullscreen activities, but still required // activities are actually behind other fullscreen activities, but still required
// to be visible (such as performing Recents animation). // to be visible (such as performing Recents animation).
final boolean resumeTopActivity = mTop != null && !mTop.mLaunchTaskBehind final boolean resumeTopActivity = mTopRunningActivity != null
&& !mTopRunningActivity.mLaunchTaskBehind
&& mTaskFragment.canBeResumed(starting) && mTaskFragment.canBeResumed(starting)
&& (starting == null || !starting.isDescendantOf(mTaskFragment)); && (starting == null || !starting.isDescendantOf(mTaskFragment));
@@ -113,7 +114,7 @@ class EnsureActivitiesVisibleHelper {
mBehindFullyOccludedContainer |= mBehindFullyOccludedContainer |=
(childTaskFragment.getBounds().equals(mTaskFragment.getBounds()) (childTaskFragment.getBounds().equals(mTaskFragment.getBounds())
&& !childTaskFragment.isTranslucent(starting)); && !childTaskFragment.isTranslucent(starting));
if (mAboveTop && mTop.getTaskFragment() == childTaskFragment) { if (mAboveTop && mTopRunningActivity.getTaskFragment() == childTaskFragment) {
mAboveTop = false; mAboveTop = false;
} }
@@ -147,8 +148,11 @@ class EnsureActivitiesVisibleHelper {
private void setActivityVisibilityState(ActivityRecord r, ActivityRecord starting, private void setActivityVisibilityState(ActivityRecord r, ActivityRecord starting,
final boolean resumeTopActivity) { final boolean resumeTopActivity) {
final boolean isTop = r == mTop; final boolean isTop = r == mTopRunningActivity;
if (mAboveTop && !isTop) { if (mAboveTop && !isTop) {
// Ensure activities above the top-running activity to be invisible because the
// activity should be finishing or cannot show to current user.
r.makeInvisible();
return; return;
} }
mAboveTop = false; mAboveTop = false;