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

Commit 56420982 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent taskbar icon tooltip from showing on hotseat transition." into main

parents 651448cb fc1d2daa
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1649,6 +1649,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        return mControllers.uiController.canToggleHomeAllApps();
    }

    boolean isIconAlignedWithHotseat() {
        return mControllers.uiController.isIconAlignedWithHotseat();
    }

    @VisibleForTesting
    public TaskbarControllers getControllers() {
        return mControllers;
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
        if (mHoverView == null || mToolTipText == null) {
            return;
        }
        // Do not show tooltip if taskbar icons are transitioning to hotseat.
        if (mActivity.isIconAlignedWithHotseat()) {
            return;
        }
        if (mHoverView instanceof FolderIcon && !((FolderIcon) mHoverView).getIconVisible()) {
            return;
        }
+16 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
        when(taskbarActivityContext.getDragLayer()).thenReturn(mTaskbarDragLayer);
        when(taskbarActivityContext.getMainLooper()).thenReturn(context.getMainLooper());
        when(taskbarActivityContext.getDisplay()).thenReturn(mDisplay);
        when(taskbarActivityContext.isIconAlignedWithHotseat()).thenReturn(false);

        when(mTaskbarDragLayer.getChildCount()).thenReturn(1);
        mSpyFolderView = spy(new Folder(new ActivityContextWrapper(context), null));
@@ -243,6 +244,21 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
                false);
    }

    @Test
    public void onHover_hoverEnterIconAlignedWithHotseat_noReveal() {
        when(mMotionEvent.getAction()).thenReturn(MotionEvent.ACTION_HOVER_ENTER);
        when(mMotionEvent.getActionMasked()).thenReturn(MotionEvent.ACTION_HOVER_ENTER);
        when(taskbarActivityContext.isIconAlignedWithHotseat()).thenReturn(true);

        boolean hoverHandled =
                mTaskbarHoverToolTipController.onHover(mHoverBubbleTextView, mMotionEvent);
        waitForIdleSync();

        assertThat(hoverHandled).isTrue();
        verify(taskbarActivityContext).setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
                true);
    }

    private void waitForIdleSync() {
        mTestableLooper.processAllMessages();
    }