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

Commit f4e4b275 authored by Joe Onorato's avatar Joe Onorato Committed by Android (Google) Code Review
Browse files

Merge "Make the volume keys adjust the media volume by default if the device...

Merge "Make the volume keys adjust the media volume by default if the device is not "voice capable.""
parents 79985590 c7fcba4b
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;