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

Commit c7fcba4b authored by Joe Onorato's avatar Joe Onorato
Browse files

Make the volume keys adjust the media volume by default if the device is not "voice capable."

Change-Id: Ide396f8940a075c0b00b7c983c1769c1cc0f17bf
parent 933464dd
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class AudioService extends IAudioService.Stub {

    private Context mContext;
    private ContentResolver mContentResolver;

    private boolean mVoiceCapable;

    /** The UI */
    private VolumePanel mVolumePanel;
@@ -283,6 +283,8 @@ public class AudioService extends IAudioService.Stub {
    public AudioService(Context context) {
        mContext = context;
        mContentResolver = context.getContentResolver();
        mVoiceCapable = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_voice_capable);

       // Intialized volume
        MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = SystemProperties.getInt(
@@ -1323,8 +1325,15 @@ public class AudioService extends IAudioService.Stub {
            // Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC...");
            return AudioSystem.STREAM_MUSIC;
        } else if (suggestedStreamType == AudioManager.USE_DEFAULT_STREAM_TYPE) {
            // Log.v(TAG, "getActiveStreamType: Forcing STREAM_RING...");
            if (mVoiceCapable) {
                // Log.v(TAG, "getActiveStreamType: Forcing STREAM_RING..."
                //        + " b/c USE_DEFAULT_STREAM_TYPE...");
                return AudioSystem.STREAM_RING;
            } else {
                // Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC "
                //        + " b/c USE_DEFAULT_STREAM_TYPE...");
                return AudioSystem.STREAM_MUSIC;
            }
        } else {
            // Log.v(TAG, "getActiveStreamType: Returning suggested type " + suggestedStreamType);
            return suggestedStreamType;