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

Commit d289ca47 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Get rid of multiple haptic feedbacks when long pressing on nav buttons

When returning false in a onLongClickListener, the touch event gets dispatched to onClickListener at release.

Fixes: 351457303
Test: long press and short press both result in one haptic feedback
Flag: EXEMPT bugfix
Change-Id: Id173a2d1fcf2f61c3289c653809207425b468a82
parent f49f87de
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -166,8 +166,12 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
        if (buttonType == BUTTON_SPACE) {
            return false;
        }
        // Provide the same haptic feedback that the system offers for virtual keys.
        view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);

        // Provide the same haptic feedback that the system offers for long press.
        // The haptic feedback from long pressing on the home button is handled by circle to search.
        if (buttonType != BUTTON_HOME) {
            view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
        switch (buttonType) {
            case BUTTON_HOME:
                logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_LONGPRESS);
@@ -179,10 +183,12 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
                return true;
            case BUTTON_BACK:
                logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_LONGPRESS);
                return backRecentsLongpress(buttonType);
                backRecentsLongpress(buttonType);
                return true;
            case BUTTON_RECENTS:
                logEvent(LAUNCHER_TASKBAR_OVERVIEW_BUTTON_LONGPRESS);
                return backRecentsLongpress(buttonType);
                backRecentsLongpress(buttonType);
                return true;
            case BUTTON_IME_SWITCH:
            default:
                return false;