Separate notification/ring volume sliders in UI
Separate the logic between notification slider and ring slider in
setting through new logic in SeekBarVolumizer when ring is not aliased
with notification in config.xml.
Start the notif/ring separation code but hide it in the new SysUI volume dialog.
Bug: b/38477228
Test: manual
(1) With ring/notif alias set to false, in the Sound Settings, drag ring volume to zero. Verify notification volume snaps to zero as well. Then drag the notification volume out of zero. Verify that notification volume is stable at the new value and does not wrongly snap back to zero.
(2) With the alias set to false, drag media volume to zero, midpoint, and max. Verify the slider control is stable, and that the audio level corresponds relative to the level on UI.
(3) Repeat test 2 with the alias set to true.
Change-Id: Ifff4c06a952ba13dc6d6830fea5fe47651fa5b2e
This commit is contained in:
@@ -159,6 +159,7 @@ interface INotificationManager
|
||||
void clearRequestedListenerHints(in INotificationListener token);
|
||||
void requestHintsFromListener(in INotificationListener token, int hints);
|
||||
int getHintsFromListener(in INotificationListener token);
|
||||
int getHintsFromListenerNoToken();
|
||||
void requestInterruptionFilterFromListener(in INotificationListener token, int interruptionFilter);
|
||||
int getInterruptionFilterFromListener(in INotificationListener token);
|
||||
void setOnNotificationPostedTrimFromListener(in INotificationListener token, int trim);
|
||||
|
||||
@@ -115,6 +115,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
private final int mMaxStreamVolume;
|
||||
private boolean mAffectedByRingerMode;
|
||||
private boolean mNotificationOrRing;
|
||||
private final boolean mNotifAliasRing;
|
||||
private final Receiver mReceiver = new Receiver();
|
||||
|
||||
private Handler mHandler;
|
||||
@@ -179,6 +180,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
if (mNotificationOrRing) {
|
||||
mRingerMode = mAudioManager.getRingerModeInternal();
|
||||
}
|
||||
mNotifAliasRing = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_alias_ring_notif_stream_types);
|
||||
mZenMode = mNotificationManager.getZenMode();
|
||||
|
||||
if (hasAudioProductStrategies()) {
|
||||
@@ -280,7 +283,15 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
if (zenMuted) {
|
||||
mSeekBar.setProgress(mLastAudibleStreamVolume, true);
|
||||
} else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
|
||||
mSeekBar.setProgress(0, true);
|
||||
/**
|
||||
* the first variable above is preserved and the conditions below are made explicit
|
||||
* so that when user attempts to slide the notification seekbar out of vibrate the
|
||||
* seekbar doesn't wrongly snap back to 0 when the streams aren't aliased
|
||||
*/
|
||||
if (mNotifAliasRing || mStreamType == AudioManager.STREAM_RING
|
||||
|| (mStreamType == AudioManager.STREAM_NOTIFICATION && mMuted)) {
|
||||
mSeekBar.setProgress(0, true);
|
||||
}
|
||||
} else if (mMuted) {
|
||||
mSeekBar.setProgress(0, true);
|
||||
} else {
|
||||
@@ -354,6 +365,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
// set the time of stop volume
|
||||
if ((mStreamType == AudioManager.STREAM_VOICE_CALL
|
||||
|| mStreamType == AudioManager.STREAM_RING
|
||||
|| (!mNotifAliasRing && mStreamType == AudioManager.STREAM_NOTIFICATION)
|
||||
|| mStreamType == AudioManager.STREAM_ALARM)) {
|
||||
sStopVolumeTime = java.lang.System.currentTimeMillis();
|
||||
}
|
||||
@@ -631,8 +643,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
||||
}
|
||||
|
||||
private void updateVolumeSlider(int streamType, int streamValue) {
|
||||
final boolean streamMatch = mNotificationOrRing ? isNotificationOrRing(streamType)
|
||||
: (streamType == mStreamType);
|
||||
final boolean streamMatch = mNotifAliasRing && mNotificationOrRing
|
||||
? isNotificationOrRing(streamType) : streamType == mStreamType;
|
||||
if (mSeekBar != null && streamMatch && streamValue != -1) {
|
||||
final boolean muted = mAudioManager.isStreamMute(mStreamType)
|
||||
|| streamValue == 0;
|
||||
|
||||
@@ -4867,6 +4867,13 @@ public class NotificationManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHintsFromListenerNoToken() {
|
||||
synchronized (mNotificationLock) {
|
||||
return mListenerHints;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestInterruptionFilterFromListener(INotificationListener token,
|
||||
int interruptionFilter) throws RemoteException {
|
||||
|
||||
Reference in New Issue
Block a user