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

Commit f0da1f51 authored by Jason Simmons's avatar Jason Simmons Committed by Android (Google) Code Review
Browse files

Merge "Only send master volume or mute updates if the settings have changed" into ics-aah

parents e361df99 a477bab9
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -733,9 +733,11 @@ public class AudioService extends IAudioService.Stub {

    /** @see AudioManager#setMasterMute(boolean, IBinder) */
    public void setMasterMute(boolean state, IBinder cb) {
        if (state != AudioSystem.getMasterMute()) {
            AudioSystem.setMasterMute(state);
            sendMasterMuteUpdate(state, AudioManager.FLAG_SHOW_UI);
        }
    }

    /** get master mute state. */
    public boolean isMasterMute() {
@@ -762,10 +764,14 @@ public class AudioService extends IAudioService.Stub {
        if (!AudioSystem.getMasterMute()) {
            int oldVolume = getMasterVolume();
            AudioSystem.setMasterVolume(volume);

            int newVolume = getMasterVolume();
            if (newVolume != oldVolume) {
                // Post a persist master volume msg
                sendMsg(mAudioHandler, MSG_PERSIST_MASTER_VOLUME, 0, SENDMSG_REPLACE,
                        Math.round(volume * (float)1000.0), 0, null, PERSIST_DELAY);
            sendMasterVolumeUpdate(flags, oldVolume, getMasterVolume());
                sendMasterVolumeUpdate(flags, oldVolume, newVolume);
            }
        }
    }