Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 582bd496 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

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

parents 3cdd7060 41f50d35
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import java.util.ArrayList;
/** Helper class to ensure activities are in the right visible state for a container. */
class EnsureActivitiesVisibleHelper {
    private final TaskFragment mTaskFragment;
    private ActivityRecord mTop;
    private ActivityRecord mTopRunningActivity;
    private ActivityRecord mStarting;
    private boolean mAboveTop;
    private boolean mContainerShouldBeVisible;
@@ -54,10 +54,10 @@ class EnsureActivitiesVisibleHelper {
    void reset(ActivityRecord starting, int configChanges, boolean preserveWindows,
            boolean notifyClients) {
        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
        // are now visible.
        mAboveTop = mTop != null;
        mAboveTop = mTopRunningActivity != null;
        mContainerShouldBeVisible = mTaskFragment.shouldBeVisible(mStarting);
        mBehindFullyOccludedContainer = !mContainerShouldBeVisible;
        mConfigChanges = configChanges;
@@ -85,18 +85,19 @@ class EnsureActivitiesVisibleHelper {
        reset(starting, configChanges, preserveWindows, notifyClients);

        if (DEBUG_VISIBILITY) {
            Slog.v(TAG_VISIBILITY, "ensureActivitiesVisible behind " + mTop
            Slog.v(TAG_VISIBILITY, "ensureActivitiesVisible behind " + mTopRunningActivity
                    + " 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.
            mTaskFragment.asTask().checkTranslucentActivityWaiting(mTop);
            mTaskFragment.asTask().checkTranslucentActivityWaiting(mTopRunningActivity);
        }

        // We should not resume activities that being launched behind because these
        // 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
        final boolean resumeTopActivity = mTopRunningActivity != null
                && !mTopRunningActivity.mLaunchTaskBehind
                && mTaskFragment.canBeResumed(starting)
                && (starting == null || !starting.isDescendantOf(mTaskFragment));

@@ -113,7 +114,7 @@ class EnsureActivitiesVisibleHelper {
                mBehindFullyOccludedContainer |=
                        (childTaskFragment.getBounds().equals(mTaskFragment.getBounds())
                                && !childTaskFragment.isTranslucent(starting));
                if (mAboveTop && mTop.getTaskFragment() == childTaskFragment) {
                if (mAboveTop && mTopRunningActivity.getTaskFragment() == childTaskFragment) {
                    mAboveTop = false;
                }

@@ -147,8 +148,11 @@ class EnsureActivitiesVisibleHelper {

    private void setActivityVisibilityState(ActivityRecord r, ActivityRecord starting,
            final boolean resumeTopActivity) {
        final boolean isTop = r == mTop;
        final boolean isTop = r == mTopRunningActivity;
        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;
        }
        mAboveTop = false;