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

Commit 34ff4929 authored by Jose Lima's avatar Jose Lima Committed by Jose Ricardo Lima
Browse files

Fixes for a few bugs related to visible-behind activities

   - Allow activities currently not visible to switch back to not
     visible-behind state.
   - Do not allow an activity that is not set as the visible-behind
     activity to cancel the visible-behind state.
   - Immediately mark a finishing activity as no longer visible behind.

Bug: 17070266
Change-Id: I2c5016793e5264013b8a54b84098e6ffae34ae6c
parent 478114cb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -575,6 +575,10 @@ final class ActivityRecord {

    void makeFinishing() {
        if (!finishing) {
            if (this == task.stack.getVisibleBehindActivity()) {
                // A finishing activity should not remain as visible in the background
                mStackSupervisor.requestVisibleBehindLocked(this, false);
            }
            finishing = true;
            if (stopped) {
                clearOptionsLocked();
+10 −3
Original line number Diff line number Diff line
@@ -2659,13 +2659,20 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }

        // A non-top activity is reporting a visibility change.
        if (top.fullscreen || top.state != ActivityState.RESUMED || top.app == null ||
                top.app.thread == null) {
        if ((visible && (top.fullscreen || top.state != ActivityState.RESUMED)) ||
                top.app == null || top.app.thread == null) {
            // Can't carry out this request.
            if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning top.fullscreen="
                    + top.fullscreen + " top.state=" + top.state + " top.app=" + top.app +
                    " top.app.thread=" + top.app.thread);
            return false;
        } else if (!visible && stack.getVisibleBehindActivity() != r) {
            // Only the activity set as currently visible behind should actively reset its
            // visible behind state.
            if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning visible="
                    + visible + " stack.getVisibleBehindActivity()=" +
                    stack.getVisibleBehindActivity() + " r=" + r);
            return false;
        }

        stack.setVisibleBehindActivity(visible ? r : null);