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

Commit 663ba31c authored by Brian's avatar Brian Committed by Steve Kondik
Browse files

Maintain separate media volumes for when the headset is and is not plugged in.

When a headset is plugged in, the last media volume set for a headset is restored.
When the headset is unplugged, the last media volume set for the speaker is restored.
This enables, for example, keeping media volume at 0 normally to avoid unexpected
sounds from the speaker, but having it automatically turned on when you plug in a headset,
since you would presumably be plugging the headset in to listen to something.  Or, if you
crank the volume on the speaker, you won't suffer hearing damage if you forget to turn it
down again next time you plug in a headset.

Whitespace fixed.

Added headset icons to volume panel.  Now shows a headset icon
when changing volume with a wired headset plugged in.

Added fitsnugly's icons

Change-Id: I5965cb165433368dd858b3ba06d487c89403f7fa
parent f382b43e
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -335,10 +335,16 @@ public class VolumePanel extends Handler
        mLargeStreamIcon.setVisibility(View.GONE);
        mSmallStreamIcon.setVisibility(View.VISIBLE);

        if (mAudioManager.isWiredHeadsetOn()) {
            mSmallStreamIcon.setImageResource(index == 0
                    ? com.android.internal.R.drawable.ic_volume_headset_off_small
                            : com.android.internal.R.drawable.ic_volume_headset_small);
        } else {
            mSmallStreamIcon.setImageResource(index == 0
                    ? com.android.internal.R.drawable.ic_volume_off_small
                            : com.android.internal.R.drawable.ic_volume_small);
        }
    }

    /**
     * Makes the large image view visible with the given icon.
@@ -365,11 +371,11 @@ public class VolumePanel extends Handler
        if (LOGD) Log.d(TAG, "setRingerIcon(), ringerMode: " + ringerMode);

        if (ringerMode == AudioManager.RINGER_MODE_SILENT) {
            icon = com.android.internal.R.drawable.ic_volume_off;
            icon =  mAudioManager.isWiredHeadsetOn()?com.android.internal.R.drawable.ic_volume_headset_off:com.android.internal.R.drawable.ic_volume_off;
        } else if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
            icon = com.android.internal.R.drawable.ic_vibrate;
        } else {
            icon = com.android.internal.R.drawable.ic_volume;
            icon = mAudioManager.isWiredHeadsetOn()?com.android.internal.R.drawable.ic_volume_headset:com.android.internal.R.drawable.ic_volume;
        }
        mLargeStreamIcon.setImageResource(icon);
    }
+6.79 KiB
Loading image diff...
+6.35 KiB
Loading image diff...
+4.37 KiB
Loading image diff...
+4.67 KiB
Loading image diff...
Loading