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

Commit 0e1e0f61 authored by Matthew Ng's avatar Matthew Ng
Browse files

Remove haptics on navbar and only have button haptics on touch up

Removed haptics whenever you touch the nav bar. Added haptics for
KeyButtonView on touch up.

Test: tap the nav buttons
Fixes: 74978190
Change-Id: Iab11c0d13b5e1cb44b1e4c316a9181ef711b3144
parent ae26aa74
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
import android.os.VibrationEffect;
import android.support.annotation.ColorInt;
import android.util.AttributeSet;
import android.util.Log;
@@ -69,7 +68,6 @@ import com.android.systemui.recents.RecentsOnboarding;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.NavigationBarCompat;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.policy.DeadZone;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
import com.android.systemui.statusbar.policy.TintedKeyButtonDrawable;
@@ -150,7 +148,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
    private Divider mDivider;
    private RecentsOnboarding mRecentsOnboarding;
    private NotificationPanelView mPanelView;
    private final VibratorHelper mVibratorHelper;

    private int mRotateBtnStyle = R.style.RotateButtonCCWStart90;

@@ -246,7 +243,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mVibratorHelper = Dependency.get(VibratorHelper.class);

        mConfiguration = new Configuration();
        mConfiguration.updateFrom(context.getResources().getConfiguration());
@@ -314,9 +310,6 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                } else if (mRecentsButtonBounds.contains(x, y)) {
                    mDownHitTarget = HIT_TARGET_OVERVIEW;
                }

                // Vibrate tick whenever down occurs on navigation bar
                mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
                break;
        }
        return mGestureHelper.onInterceptTouchEvent(event);
+2 −7
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.metrics.LogMaker;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.VibrationEffect;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.HapticFeedbackConstants;
@@ -50,7 +49,6 @@ import com.android.systemui.OverviewProxyService;
import com.android.systemui.R;
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.VibratorHelper;

import static android.view.KeyEvent.KEYCODE_HOME;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
@@ -75,7 +73,6 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
    private OnClickListener mOnClickListener;
    private final KeyButtonRipple mRipple;
    private final OverviewProxyService mOverviewProxyService;
    private final VibratorHelper mVibratorHelper;
    private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);

    private final Runnable mCheckLongPress = new Runnable() {
@@ -121,7 +118,6 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

        mRipple = new KeyButtonRipple(context, this);
        mVibratorHelper = Dependency.get(VibratorHelper.class);
        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        setBackground(mRipple);
    }
@@ -262,9 +258,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
                final boolean doHapticFeedback = (SystemClock.uptimeMillis() - mDownTime) > 150;
                if (isProxyConnected) {
                    if (doIt) {
                        if (doHapticFeedback) {
                            mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
                        }
                        // Apply haptic feedback on touch up since there is none on touch down
                        performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                        playSoundEffect(SoundEffectConstants.CLICK);
                    }
                } else if (doHapticFeedback && !mLongClicked) {