Perform haptic feedback on nav button key press

Fixes: 203614307
Test: manual
Change-Id: Icaea3f5e436522f23202c20fcc7f7c5dbe309372
This commit is contained in:
Tracy Zhou
2022-06-23 14:29:34 -07:00
parent 5069964ea2
commit 0a0fcb809c
3 changed files with 40 additions and 31 deletions

View File

@@ -33,6 +33,8 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.HapticFeedbackConstants;
import android.view.View;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
@@ -113,7 +115,9 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
mHandler = handler;
}
public void onButtonClick(@TaskbarButton int buttonType) {
public void onButtonClick(@TaskbarButton int buttonType, View view) {
// Provide the same haptic feedback that the system offers for virtual keys.
view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
switch (buttonType) {
case BUTTON_BACK:
logEvent(LAUNCHER_TASKBAR_BACK_BUTTON_TAP);
@@ -144,7 +148,9 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
}
}
public boolean onButtonLongClick(@TaskbarButton int buttonType) {
public boolean onButtonLongClick(@TaskbarButton int buttonType, View view) {
// Provide the same haptic feedback that the system offers for virtual keys.
view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
switch (buttonType) {
case BUTTON_HOME:
logEvent(LAUNCHER_TASKBAR_HOME_BUTTON_LONGPRESS);