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

Commit 4406de67 authored by Wilson Wu's avatar Wilson Wu Committed by Android (Google) Code Review
Browse files

Merge "Add fixed amplitude check for keyboard vibration" into main

parents bdfae3a3 fd45101e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -110,7 +110,9 @@ public class KeyboardVibrationTogglePreferenceController extends TogglePreferenc
    @Override
    public int getAvailabilityStatus() {
        if (Flags.keyboardCategoryEnabled()
                && mContext.getResources().getBoolean(R.bool.config_keyboard_vibration_supported)) {
                && mContext.getResources().getBoolean(R.bool.config_keyboard_vibration_supported)
                && mContext.getResources().getFloat(
                com.android.internal.R.dimen.config_keyboardHapticFeedbackFixedAmplitude) > 0) {
            return AVAILABLE;
        }
        return UNSUPPORTED_ON_DEVICE;
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
    public void getAvailabilityStatus_featureSupported_available() {
        mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED);
        when(mResources.getBoolean(R.bool.config_keyboard_vibration_supported)).thenReturn(true);
        when(mResources.getFloat(
                com.android.internal.R.dimen.config_keyboardHapticFeedbackFixedAmplitude))
                .thenReturn(0.8f);

        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
    }