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

Commit f5693845 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove duplicated invocation of makeActiveIfNeeded

Since the lifecycle item includes the visibility operation,
there becomes 2 makeActiveIfNeeded which is unnecessary.

Also
 - Remove mClientVisibilityDeferred because when the callers
   want to update the deferred records, mNotifyClients will
   be true.
 - Remove mStarting because all methods of the helper has it
   as a parameter.

Bug: 297502610
Flag: EXEMPT reduce duplicated invocation
Test: CtsWindowManagerDeviceActivity
Change-Id: Iff6260426ae7073b5e3ccccb109b83827cef153a
parent 5d23bdf5
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -531,7 +531,6 @@ final class ActivityRecord extends WindowToken {
    // window.
    private boolean mVisibleSetFromTransferredStartingWindow;
    boolean nowVisible;     // is this activity's window visible?
    boolean mClientVisibilityDeferred;// was the visibility change message to client deferred?
    boolean idle;           // has the activity gone idle?
    boolean hasBeenLaunched;// has this activity ever been launched?
    boolean immersive;      // immersive mode (don't interrupt if possible)
@@ -5943,10 +5942,7 @@ final class ActivityRecord extends WindowToken {
            setVisibility(true);
            app.postPendingUiCleanMsg(true);
            if (reportToClient) {
                mClientVisibilityDeferred = false;
                makeActiveIfNeeded(starting);
            } else {
                mClientVisibilityDeferred = true;
            }
            // The activity may be waiting for stop, but that is no longer appropriate for it.
            mTaskSupervisor.mStoppingActivities.remove(this);
+6 −13
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import java.util.ArrayList;
class EnsureActivitiesVisibleHelper {
    private final TaskFragment mTaskFragment;
    private ActivityRecord mTopRunningActivity;
    private ActivityRecord mStarting;
    private boolean mAboveTop;
    private boolean mContainerShouldBeVisible;
    private boolean mBehindFullyOccludedContainer;
@@ -47,12 +46,11 @@ class EnsureActivitiesVisibleHelper {
     *                      be sent to the clients.
     */
    void reset(ActivityRecord starting, boolean notifyClients) {
        mStarting = starting;
        mTopRunningActivity = mTaskFragment.topRunningActivity();
        // If the top activity is not fullscreen, then we need to make sure any activities under it
        // are now visible.
        mAboveTop = mTopRunningActivity != null;
        mContainerShouldBeVisible = mTaskFragment.shouldBeVisible(mStarting);
        mContainerShouldBeVisible = mTaskFragment.shouldBeVisible(starting);
        mBehindFullyOccludedContainer = !mContainerShouldBeVisible;
        mNotifyClients = notifyClients;
    }
@@ -178,7 +176,7 @@ class EnsureActivitiesVisibleHelper {
            }
            // First: if this is not the current activity being started, make
            // sure it matches the current configuration.
            if (r != mStarting && mNotifyClients) {
            if (r != starting && mNotifyClients) {
                if (!isTop) {
                    r.mDisplayContent.applyFixedRotationForNonTopVisibleActivityIfNeeded(r);
                }
@@ -186,24 +184,19 @@ class EnsureActivitiesVisibleHelper {
            }

            if (!r.attachedToProcess()) {
                makeVisibleAndRestartIfNeeded(mStarting, resumeTopActivity && isTop, r);
                makeVisibleAndRestartIfNeeded(starting, resumeTopActivity && isTop, r);
            } else if (r.isVisibleRequested()) {
                // If this activity is already visible, then there is nothing to do here.
                if (DEBUG_VISIBILITY) {
                    Slog.v(TAG_VISIBILITY, "Skipping: already visible at " + r);
                }

                if (r.mClientVisibilityDeferred && mNotifyClients) {
                    r.makeActiveIfNeeded(r.mClientVisibilityDeferred ? null : starting);
                    r.mClientVisibilityDeferred = false;
                }

                r.handleAlreadyVisible();
                if (mNotifyClients) {
                    r.makeActiveIfNeeded(mStarting);
                    r.makeActiveIfNeeded(starting);
                }
                r.handleAlreadyVisible();
            } else {
                r.makeVisibleIfNeeded(mStarting, mNotifyClients);
                r.makeVisibleIfNeeded(starting, mNotifyClients);
            }
        } else {
            if (DEBUG_VISIBILITY) {