Add fixed amplitude check for keyboard vibration

Make sure the keybaord vibration settings only show
up when fixed amplitude provided to avoid any unsync
behavior with platform.

Bug: 326027376
Test: atest KeyboardVibrationTogglePreferenceControllerTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fd45101eee85da95a3de8d4ce2bfd01824e282c3)
Merged-In: I3b4e06660e3eaa6ce537b72831073f092cba37e2
Change-Id: I3b4e06660e3eaa6ce537b72831073f092cba37e2
This commit is contained in:
Wilson Wu
2024-03-06 11:02:52 +00:00
committed by Android Build Coastguard Worker
parent 7147196c42
commit 08308b2ee8
2 changed files with 7 additions and 2 deletions

View File

@@ -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);
}