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

Commit f82bd7d9 authored by Evan Charlton's avatar Evan Charlton Committed by Steve Kondik
Browse files

Disable notification vibrations when on a call

When the user is currently on a phone call (off-hook or ringing),
notifications will (optionally) not vibrate.

Change-Id: I63c3f66459cb5d7f70e084d433da03db3dcbbc88
parent 56f6bfc8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1583,6 +1583,13 @@ public final class Settings {
         */
        public static final String VOLUME_CONTROL_SILENT = "volume_contol_silent";

        /**
         * Whether notifications should vibrate during phone calls or not.
         *
         * @hide
         */
        public static final String VIBRATE_IN_CALL = "vibrate-in-call";

        /**
         * The mapping of stream type (integer) to its setting.
         */
+8 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ public class NotificationManagerService extends INotificationManager.Stub
    private boolean mInCall = false;
    private boolean mNotificationPulseEnabled;

    private boolean mVibrateInCall = true;

    private boolean mNotificationBlinkEnabled;
    private boolean mNotificationAlwaysOnEnabled;
    private boolean mNotificationChargingEnabled;
@@ -547,6 +549,9 @@ public class NotificationManagerService extends INotificationManager.Stub
                        Settings.System.QUIET_HOURS_STILL, 0) != 0;
            mQuietHoursDim = Settings.System.getInt(resolver,
                        Settings.System.QUIET_HOURS_DIM, 0) != 0;

            mVibrateInCall = Settings.System.getInt(resolver,
                        Settings.System.VIBRATE_IN_CALL, 1) != 0;
        }
    }

@@ -1015,7 +1020,10 @@ public class NotificationManagerService extends INotificationManager.Stub
                // vibrate
                final boolean useDefaultVibrate =
                    (notification.defaults & Notification.DEFAULT_VIBRATE) != 0;

                final boolean vibrateDuringCall = (!mInCall || mVibrateInCall);
                if (!(inQuietHours && mQuietHoursStill)
                        && vibrateDuringCall
                        && (useDefaultVibrate || notification.vibrate != null)
                        && audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {
                    mVibrateNotification = r;