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

Commit c0dec4f2 authored by Ats Jenk's avatar Ats Jenk
Browse files

Hide IME first when clicking on area outside bubble

When IME is open and user taps on the area above the IME and outside the
bubble, dismiss the IME, but leave the bubble open.
When tapping on the area again, collapse the bubble.
Updated order of events when tapping outside the bubble or using back
gesture is:
1. close EDU if visible
2. close caption menu if visible
3. hide IME if visible
4. collapse bubble

Bug: 345483473
Flag: com.android.wm.shell.enable_bubble_bar
Test: open caption menu and IME, tap outside of bubble, caption menu
  closes, tap again, IME hides, tap again, bubble collapses
Change-Id: I82a0ed18929fa452f5d16e37492190d69b8f12a8
parent d24a0c2c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -456,5 +456,7 @@ class BubbleStackViewTest {
        override fun isStackExpanded(): Boolean = false

        override fun isShowingAsBubbleBar(): Boolean = false

        override fun hideCurrentInputMethod() {}
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -592,11 +592,12 @@ public class BubbleController implements ConfigurationChangeListener,
     * Hides the current input method, wherever it may be focused, via InputMethodManagerInternal.
     */
    void hideCurrentInputMethod() {
        mBubblePositioner.setImeVisible(false /* visible */, 0 /* height */);
        int displayId = mWindowManager.getDefaultDisplay().getDisplayId();
        try {
            mBarService.hideCurrentInputMethodForBubbles(displayId);
        } catch (RemoteException e) {
            e.printStackTrace();
            Log.e(TAG, "Failed to hide IME", e);
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ interface BubbleExpandedViewManager {
    fun setAppBubbleTaskId(key: String, taskId: Int)
    fun isStackExpanded(): Boolean
    fun isShowingAsBubbleBar(): Boolean
    fun hideCurrentInputMethod()

    companion object {
        /**
@@ -73,6 +74,10 @@ interface BubbleExpandedViewManager {
                override fun isStackExpanded(): Boolean = controller.isStackExpanded

                override fun isShowingAsBubbleBar(): Boolean = controller.isShowingAsBubbleBar

                override fun hideCurrentInputMethod() {
                    controller.hideCurrentInputMethod()
                }
            }
        }
    }
+0 −1
Original line number Diff line number Diff line
@@ -2324,7 +2324,6 @@ public class BubbleStackView extends FrameLayout
     * not.
     */
    void hideCurrentInputMethod() {
        mPositioner.setImeVisible(false, 0);
        mManager.hideCurrentInputMethod();
    }

+20 −6
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
    private static final int INVALID_TASK_ID = -1;

    private BubbleExpandedViewManager mManager;
    private BubblePositioner mPositioner;
    private boolean mIsOverflow;
    private BubbleTaskViewHelper mBubbleTaskViewHelper;
    private BubbleBarMenuViewController mMenuViewController;
@@ -160,6 +161,7 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
            boolean isOverflow,
            @Nullable BubbleTaskView bubbleTaskView) {
        mManager = expandedViewManager;
        mPositioner = positioner;
        mIsOverflow = isOverflow;

        if (mIsOverflow) {
@@ -290,15 +292,27 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
    }

    /**
     * Hides the current modal menu view or collapses the bubble stack.
     * Called from {@link BubbleBarLayerView}
     * Hides the current modal menu if it is visible
     * @return {@code true} if menu was visible and is hidden
     */
    public void hideMenuOrCollapse() {
    public boolean hideMenuIfVisible() {
        if (mMenuViewController.isMenuVisible()) {
            mMenuViewController.hideMenu(/* animated = */ true);
        } else {
            mManager.collapseStack();
            mMenuViewController.hideMenu(true /* animated */);
            return true;
        }
        return false;
    }

    /**
     * Hides the IME if it is visible
     * @return {@code true} if IME was visible
     */
    public boolean hideImeIfVisible() {
        if (mPositioner.isImeVisible()) {
            mManager.hideCurrentInputMethod();
            return true;
        }
        return false;
    }

    /** Updates the bubble shown in the expanded view. */
Loading