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

Commit bd83b298 authored by Pat Manning's avatar Pat Manning Committed by Android (Google) Code Review
Browse files

Merge "Set taskbar to fullscreen for tooltip only once it is shown." into udc-qpr-dev

parents 0baeedbc a3d564ce
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.view.ContextThemeWrapper;
import android.view.MotionEvent;
import android.view.View;

import androidx.annotation.VisibleForTesting;

import com.android.app.animation.Interpolators;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BubbleTextView;
@@ -49,7 +51,7 @@ import com.android.launcher3.views.ArrowTipView;
 */
public class TaskbarHoverToolTipController implements View.OnHoverListener {

    private static final int HOVER_TOOL_TIP_REVEAL_START_DELAY = 400;
    @VisibleForTesting protected static final int HOVER_TOOL_TIP_REVEAL_START_DELAY = 400;
    private static final int HOVER_TOOL_TIP_REVEAL_DURATION = 300;
    private static final int HOVER_TOOL_TIP_EXIT_DURATION = 150;

@@ -145,7 +147,6 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
    }

    private void startRevealHoverToolTip() {
        mActivity.setTaskbarWindowFullscreen(true);
        mHoverToolTipHandler.postDelayed(mRevealHoverToolTipRunnable,
                HOVER_TOOL_TIP_REVEAL_START_DELAY);
    }
@@ -157,6 +158,7 @@ public class TaskbarHoverToolTipController implements View.OnHoverListener {
        if (mHoverView instanceof FolderIcon && !((FolderIcon) mHoverView).getIconVisible()) {
            return;
        }
        mActivity.setTaskbarWindowFullscreen(true);
        Rect iconViewBounds = Utilities.getViewBounds(mHoverView);
        mHoverToolTipView.showAtLocation(mToolTipText, iconViewBounds.centerX(),
                mTaskbarView.getTop(), /* shouldAutoClose= */ false);
+10 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;

import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS;
import static com.android.launcher3.taskbar.TaskbarHoverToolTipController.HOVER_TOOL_TIP_REVEAL_START_DELAY;

import static com.google.common.truth.Truth.assertThat;

@@ -26,6 +27,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -56,7 +58,7 @@ import org.mockito.stubbing.Answer;
 */
@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@TestableLooper.RunWithLooper(setAsMainLooper = true)
public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {

    private TaskbarHoverToolTipController mTaskbarHoverToolTipController;
@@ -126,8 +128,10 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {

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

        // Verify fullscreen is not set until the delayed runnable to reveal the tooltip has run
        verify(taskbarActivityContext, never()).setTaskbarWindowFullscreen(true);
        waitForIdleSync();
        assertThat(hoverHandled).isTrue();
        verify(taskbarActivityContext).setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
                true);
@@ -155,8 +159,10 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {

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

        // Verify fullscreen is not set until the delayed runnable to reveal the tooltip has run
        verify(taskbarActivityContext, never()).setTaskbarWindowFullscreen(true);
        waitForIdleSync();
        assertThat(hoverHandled).isTrue();
        verify(taskbarActivityContext).setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_HOVERING_ICONS,
                true);
@@ -216,6 +222,7 @@ public class TaskbarHoverToolTipControllerTest extends TaskbarBaseTestCase {
    }

    private void waitForIdleSync() {
        mTestableLooper.moveTimeForward(HOVER_TOOL_TIP_REVEAL_START_DELAY + 1);
        mTestableLooper.processAllMessages();
    }
}