Make the dialpad silent in "vibrate only" mode (bug 1984905).
This is a followup to https://android-git.corp.google.com/g/5438 (see bug
1839556) which made the dialpad silent if the phone was in "silent mode".
But "vibrate only" mode has a separate AudioManager constant:
RINGER_MODE_VIBRATE. I need to check for that too.
diff --git a/src/com/android/contacts/TwelveKeyDialer.java b/src/com/android/contacts/TwelveKeyDialer.java
index 152ff30..33f261e 100644
--- a/src/com/android/contacts/TwelveKeyDialer.java
+++ b/src/com/android/contacts/TwelveKeyDialer.java
@@ -708,7 +708,9 @@
// onResume(), since it's possible to toggle silent mode without
// leaving the current activity (via the ENDCALL-longpress menu.)
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) {
+ int ringerMode = audioManager.getRingerMode();
+ if ((ringerMode == AudioManager.RINGER_MODE_SILENT)
+ || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
return;
}