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

Commit fcf250b4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove android.os.haptic_feedback_input_source_customization_enabled" into main

parents b9ce738b 548f49f1
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -34,17 +34,6 @@ flag {
    }
}

flag {
    namespace: "haptics"
    name: "haptic_feedback_input_source_customization_enabled"
    description: "Enabled the extended haptic feedback customization by input source."
    bug: "331819348"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_FEATURE
    }
}

flag {
    namespace: "haptics"
    name: "haptics_scale_v2_enabled"
+7 −20
Original line number Diff line number Diff line
@@ -103,12 +103,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider {

        if (Math.abs(mTotalScrollPixels) >= mTickIntervalPixels) {
            mTotalScrollPixels %= mTickIntervalPixels;
            if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) {
            mView.performHapticFeedbackForInputDevice(
                    HapticFeedbackConstants.SCROLL_TICK, inputDeviceId, source, /* flags= */ 0);
            } else {
                mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_TICK);
            }
        }
    }

@@ -122,13 +118,8 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider {
        if (!mCanPlayLimitFeedback) {
            return;
        }
        if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) {
        mView.performHapticFeedbackForInputDevice(
                HapticFeedbackConstants.SCROLL_LIMIT, inputDeviceId, source, /* flags= */ 0);
        } else {
            mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_LIMIT);
        }

        mCanPlayLimitFeedback = false;
    }

@@ -138,13 +129,9 @@ public class HapticScrollFeedbackProvider implements ScrollFeedbackProvider {
        if (!mHapticScrollFeedbackEnabled) {
            return;
        }
        if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) {
        mView.performHapticFeedbackForInputDevice(
                HapticFeedbackConstants.SCROLL_ITEM_FOCUS, inputDeviceId, source,
                /* flags= */ 0);
        } else {
            mView.performHapticFeedback(HapticFeedbackConstants.SCROLL_ITEM_FOCUS);
        }
        mCanPlayLimitFeedback = true;
    }

+45 −58

File changed.

Preview size limit exceeded, changes collapsed.

+6 −11
Original line number Diff line number Diff line
@@ -136,17 +136,12 @@ final class HapticFeedbackCustomization {
        mHapticCustomizations = hapticCustomizations;

        // Load customizations specified by input sources.
        if (android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled()) {
        mHapticCustomizationsForSourceRotary =
                loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo,
                        R.xml.haptic_feedback_customization_source_rotary_encoder);
        mHapticCustomizationsForSourceTouchScreen =
                loadCustomizedFeedbackVibrationFromRes(res, vibratorInfo,
                        R.xml.haptic_feedback_customization_source_touchscreen);
        } else {
            mHapticCustomizationsForSourceRotary = new SparseArray<>();
            mHapticCustomizationsForSourceTouchScreen = new SparseArray<>();
        }

        // Load customizations specified for usages.
        if (android.os.vibrator.Flags.hapticFeedbackWithCustomUsage()) {
+10 −16
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.server.vibrator;

import static android.os.vibrator.Flags.hapticFeedbackInputSourceCustomizationEnabled;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.Resources;
@@ -169,17 +167,14 @@ public final class HapticFeedbackVibrationProvider {
    }

    /**
     * Similar to {@link #getVibrationAttributes(int, int, int)} but also handles
     * input source customization.
     * Similar to {@link #getVibrationAttributes} but also handles input source customization.
     *
     * @param inputSource the {@link InputDevice.Source} that customizes the
     *                    {@link VibrationAttributes}.
     * @param inputSource one of {@code InputDevice.SOURCE_*} to customize the attributes.
     */
    public VibrationAttributes getVibrationAttributesForInputDevice(int effectId,
            int inputSource,
            @HapticFeedbackConstants.Flags int flags,
            @HapticFeedbackConstants.PrivateFlags int privFlags) {
        if (hapticFeedbackInputSourceCustomizationEnabled()) {
        switch (effectId) {
            case HapticFeedbackConstants.SCROLL_TICK,
                    HapticFeedbackConstants.SCROLL_ITEM_FOCUS,
@@ -190,7 +185,6 @@ public final class HapticFeedbackVibrationProvider {
                return getVibrationAttributesWithFlags(attrs, effectId, flags);
            }
        }
        }
        return getVibrationAttributes(
                effectId, VibrationAttributes.USAGE_UNKNOWN, flags, privFlags);
    }
Loading