Merge "Separate notification/ring volume sliders in UI" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1387d8d4ac
@@ -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