Disable ring, notification and touch vibration in silent mode

Disable haptic settings for ring, notification and touch feedback when
the phone ringer mode is set to silent.

Preserve the setting values and display message explaining why those
settings are disabled.

Bug: 203188852
Test: *Vibration[Intensity|Toggle]PreferenceControllerTest
Change-Id: I6c24079ece9d637f2feb487f756937888a92caa7
This commit is contained in:
Lais Andrade
2022-01-14 16:58:48 +00:00
parent 56a62d74ec
commit 76b2cd60e5
15 changed files with 393 additions and 26 deletions

View File

@@ -35,6 +35,12 @@ public class RingVibrationPreferenceConfig extends VibrationPreferenceConfig {
mAudioManager = context.getSystemService(AudioManager.class);
}
@Override
public boolean isRestrictedByRingerModeSilent() {
// Incoming calls never vibrate when the phone is in silent mode.
return true;
}
@Override
public int readIntensity() {
final int vibrateWhenRinging = Settings.System.getInt(mContentResolver,