do not vibrate if do not disturb is enabled, fixes #1125

This commit is contained in:
Helium314 2024-09-28 22:28:37 +02:00
parent 27d257ce1d
commit d754e7ca7f
2 changed files with 12 additions and 4 deletions

View file

@ -1853,7 +1853,13 @@ public class LatinIME extends InputMethodService implements
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
if (AudioManager.RINGER_MODE_CHANGED_ACTION.equals(action)) {
AudioAndHapticFeedbackManager.getInstance().onRingerModeChanged();
boolean dnd;
try {
dnd = android.provider.Settings.Global.getInt(context.getContentResolver(), "zen_mode") != 0;
} catch (android.provider.Settings.SettingNotFoundException e) {
dnd = false;
}
AudioAndHapticFeedbackManager.getInstance().onRingerModeChanged(dnd);
}
}
};