Fix the "Alarm volume" icon is displayed incorrectly
Symptom: 1. Set Alarm volume to 0 on Sound & notification screen, then tap Back key and reopen the screen. 2. Set Alarm volume up to 1 or larger, then alarm icon changes to unmute. 3. Set Alarm volume down to 0, then the icon doesn't change to mute. There expected the icon should change to mute one. Detail and sample: SeekBarVolumizer manages a variable mLastAudibleStreamVolume. This variable decides whether it executes mute procedure or not. When this variable is 0, it will not execute mute procedure. Because the condition to execute mute proceduce is below. - lastAudibleVolume * (mute ? -1 : 1) < 0 What original code will not update this variable from constructor is one of problems. So once the icon changes to unmute one, the icon will never change to mute one. Solution: Changed the condition as it doesn't depend on value of lastAudibleVolume. Bug: 30265487 Change-Id: I42165f39d1f344169674c09a045b6fb2bb25db4d
This commit is contained in:
committed by
Shunta Sato
parent
98cf9d1a60
commit
8eb355dff9
@@ -333,8 +333,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
if (msg.what == UPDATE_SLIDER) {
|
||||
if (mSeekBar != null) {
|
||||
mLastProgress = msg.arg1;
|
||||
mLastAudibleStreamVolume = Math.abs(msg.arg2);
|
||||
final boolean muted = msg.arg2 < 0;
|
||||
mLastAudibleStreamVolume = msg.arg2;
|
||||
final boolean muted = ((Boolean)msg.obj).booleanValue();
|
||||
if (muted != mMuted) {
|
||||
mMuted = muted;
|
||||
if (mCallback != null) {
|
||||
@@ -347,8 +347,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
}
|
||||
|
||||
public void postUpdateSlider(int volume, int lastAudibleVolume, boolean mute) {
|
||||
final int arg2 = lastAudibleVolume * (mute ? -1 : 1);
|
||||
obtainMessage(UPDATE_SLIDER, volume, arg2).sendToTarget();
|
||||
obtainMessage(UPDATE_SLIDER, volume, lastAudibleVolume, new Boolean(mute)).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user