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

Commit 97b320df authored by gsarrica's avatar gsarrica Committed by Steve Kondik
Browse files

Allow unlinking of notification sound and ringtone volume. Thanks to http://forum.aokp.co/

 for this.

Change-Id: I55db003cc1691fbca5d3e8ea79e088d0622d38ee
parent 2b6dae3e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2193,6 +2193,13 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_QUICK_UNLOCK_CONTROL = "lockscreen_quick_unlock_control";

        /**
         * Boolean value whether to link ringtone and notification volumes
         * 
         * @hide
         */
        public static final String VOLUME_LINK_NOTIFICATION = "volume_link_notification";

        /**
         * Whether to unlock the menu key.  The value is boolean (1 or 0).
         * @hide
+18 −0
Original line number Diff line number Diff line
@@ -459,6 +459,15 @@ public class AudioService extends IAudioService.Stub {
        } else {
            mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC);
        }

        boolean linkNotificationWithVolume = Settings.System.getInt(mContentResolver,
                Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1;
        if (linkNotificationWithVolume) {
            STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_RING;
        } else {
            STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_NOTIFICATION;
        }

        Settings.System.putInt(cr,
                Settings.System.MODE_RINGER_STREAMS_AFFECTED, mRingerModeAffectedStreams);

@@ -2315,6 +2324,8 @@ public class AudioService extends IAudioService.Stub {
            super(new Handler());
            mContentResolver.registerContentObserver(Settings.System.getUriFor(
                Settings.System.MODE_RINGER_STREAMS_AFFECTED), false, this);
            mContentResolver.registerContentObserver(Settings.System.getUriFor(
                Settings.System.VOLUME_LINK_NOTIFICATION), false, this);
        }

        @Override
@@ -2338,6 +2349,13 @@ public class AudioService extends IAudioService.Stub {
                    mRingerModeAffectedStreams = ringerModeAffectedStreams;
                    setRingerModeInt(getRingerMode(), false);
                }
                boolean linkNotificationWithVolume = Settings.System.getInt(mContentResolver,
                        Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1;
                if (linkNotificationWithVolume) {
                    STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_RING;
                } else {
                    STREAM_VOLUME_ALIAS[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_NOTIFICATION;
                }
            }
        }
    }