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

Commit f75bc90c authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Don't remove bubbles after mode switching

We currently remove TaskViews as part of mode switching cleanup, but that
eventually removes existing bubbles which means bubbles are lost after
mode switching.

As a short term solution, this CL avoids removing the bubble if the task
is removed as a result of mode switching. A longer term solution is to
refactor the task views outside of the expanded views so they don't need
to be removed as part of mode switching. See b/316358859.

Fixes: 316358859
Test: Manual
      - Add bubbles
      - Switch modes
      - Observe that bubbles are not removed
Change-Id: I382725e318bc441eb9e8b277e615ca21fdbdc871
parent 7a85cfb8
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -1481,6 +1481,36 @@ public class BubbleController implements ConfigurationChangeListener,
        }
    }

    // TODO(b/316358859): remove this method after task views are shared across modes
    /**
     * Removes the bubble with the given key after task removal, unless the task was removed as
     * a result of mode switching, in which case, the bubble isn't removed because it will be
     * re-inflated for the new mode.
     */
    @MainThread
    public void removeFloatingBubbleAfterTaskRemoval(String key, int reason) {
        // if we're floating remove the bubble. otherwise, we're here because the task was removed
        // after switching modes. See b/316358859
        if (!isShowingAsBubbleBar()) {
            removeBubble(key, reason);
        }
    }

    // TODO(b/316358859): remove this method after task views are shared across modes
    /**
     * Removes the bubble with the given key after task removal, unless the task was removed as
     * a result of mode switching, in which case, the bubble isn't removed because it will be
     * re-inflated for the new mode.
     */
    @MainThread
    public void removeBarBubbleAfterTaskRemoval(String key, int reason) {
        // if we're showing as bubble bar remove the bubble. otherwise, we're here because the task
        // was removed after switching modes. See b/316358859
        if (isShowingAsBubbleBar()) {
            removeBubble(key, reason);
        }
    }

    /**
     * Removes all the bubbles.
     * <p>
+2 −1
Original line number Diff line number Diff line
@@ -313,7 +313,8 @@ public class BubbleExpandedView extends LinearLayout {
                        + " bubble=" + getBubbleKey());
            }
            if (mBubble != null) {
                mController.removeBubble(mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
                mController.removeFloatingBubbleAfterTaskRemoval(
                        mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
            }
            if (mTaskView != null) {
                // Release the surface
+2 −1
Original line number Diff line number Diff line
@@ -188,7 +188,8 @@ public class BubbleTaskViewHelper {
                        + " bubble=" + getBubbleKey());
            }
            if (mBubble != null) {
                mController.removeBubble(mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
                mController.removeBarBubbleAfterTaskRemoval(
                        mBubble.getKey(), Bubbles.DISMISS_TASK_FINISHED);
            }
        }