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

Commit cdd6cfb3 authored by Michael Wright's avatar Michael Wright
Browse files

Block haptic text handle at the policy layer.

This means that we globally enforce the haptic text handle events, even
if they're coming from something other than TextView. Prior to this,
things like WebView would cause haptic feedback on text handle movement
if the tick effect was implemented even if the feedback was disabled by
the configuration.

We've left the code in Editor that blocks text handle haptic feedback
just to avoid paying the cost of an IPC call whenever the handle moves
on devices where it's disabled.

Bug: 111461797
Test: Manual
Change-Id: If4536ae7582a0ec1a309b90e353ff6c2b14a1995
parent 3b87c389
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -474,6 +474,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mShortPressOnSleepBehavior;
    int mShortPressOnWindowBehavior;
    boolean mHasSoftInput = false;
    boolean mHapticTextHandleEnabled;
    boolean mUseTvRouting;
    int mVeryLongPressTimeout;
    boolean mAllowStartActivityForLongPressOnPowerDuringSetup;
@@ -1806,6 +1807,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mAllowStartActivityForLongPressOnPowerDuringSetup = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_allowStartActivityForLongPressOnPowerInSetup);

        mHapticTextHandleEnabled = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_enableHapticTextHandle);

        mUseTvRouting = AudioSystem.getPlatformType(mContext) == AudioSystem.PLATFORM_TELEVISION;

        mHandleVolumeKeysInWM = mContext.getResources().getBoolean(
@@ -5098,8 +5102,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            case HapticFeedbackConstants.CLOCK_TICK:
            case HapticFeedbackConstants.CONTEXT_CLICK:
                return VibrationEffect.get(VibrationEffect.EFFECT_TICK);
            case HapticFeedbackConstants.KEYBOARD_RELEASE:
            case HapticFeedbackConstants.TEXT_HANDLE_MOVE:
                if (!mHapticTextHandleEnabled) {
                    return null;
                }
            case HapticFeedbackConstants.KEYBOARD_RELEASE:
            case HapticFeedbackConstants.VIRTUAL_KEY_RELEASE:
            case HapticFeedbackConstants.ENTRY_BUMP:
            case HapticFeedbackConstants.DRAG_CROSSING:
@@ -5264,10 +5271,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                pw.println(mAllowStartActivityForLongPressOnPowerDuringSetup);
        pw.print(prefix);
                pw.print("mHasSoftInput="); pw.print(mHasSoftInput);
                pw.print(" mDismissImeOnBackKeyPressed="); pw.println(mDismissImeOnBackKeyPressed);
                pw.print(" mHapticTextHandleEnabled="); pw.println(mHapticTextHandleEnabled);
        pw.print(prefix);
                pw.print("mDismissImeOnBackKeyPressed="); pw.print(mDismissImeOnBackKeyPressed);
                pw.print(" mIncallPowerBehavior=");
                pw.print(incallPowerBehaviorToString(mIncallPowerBehavior));
                pw.println(incallPowerBehaviorToString(mIncallPowerBehavior));
        pw.print(prefix);
                pw.print("mIncallBackBehavior=");
                pw.print(incallBackBehaviorToString(mIncallBackBehavior));
                pw.print(" mEndcallBehavior=");