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

Commit 7ef69d43 authored by Roman Birg's avatar Roman Birg Committed by Michael Stucki
Browse files

Notification sound-to-vibration conversion toggle

Allows to change the new feature of AOSP 4.2, where all notification are
changed to vibrations on vibrate mode. Instead, allow the old behaviour
to silence sound notifications and to only play vibrations if desired.

Alle credits go to romanbb from AOKP, I just ported it.
Original AOKP-Commit:
https://github.com/AOKP/frameworks_base/commit/c1b2bb9b5d0c33e790973841bb2acaa5ea5d51fe

Change-Id: Id27dd2975d3383f6d7395a0ee995d7832e87ca66
parent 679d1a9a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3410,6 +3410,14 @@ public final class Settings {
        @Deprecated
        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;

        /**
         * toggle to "fix" the following: (found in NotificationManagerService)
         *  new in 4.2: if there was supposed to be a sound and we're in vibrate mode,
         *  we always vibrate, even if no vibration was specified
         */
        public static final String NOTIFICATION_CONVERT_SOUND_TO_VIBRATION = "convert_sound_to_vibration";

    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -1246,7 +1246,8 @@ public class NotificationManagerService extends INotificationManager.Stub
                final boolean convertSoundToVibration =
                           !hasCustomVibrate
                        && (useDefaultSound || notification.sound != null)
                        && (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE);
                        && (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE)
                        && (Settings.System.getInt(mContext.getContentResolver(), Settings.System.NOTIFICATION_CONVERT_SOUND_TO_VIBRATION, 1) != 0);

                // The DEFAULT_VIBRATE flag trumps any custom vibration.
                final boolean useDefaultVibrate =