Loading core/java/android/view/VolumePanel.java +12 −2 Original line number Diff line number Diff line Loading @@ -352,6 +352,10 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie sc.seekbarView.setProgress(mAudioManager.getLastAudibleStreamVolume(sc.streamType)); final boolean muted = isMuted(sc.streamType); sc.icon.setImageResource(muted ? sc.iconMuteRes : sc.iconRes); if (sc.streamType == AudioManager.STREAM_RING && muted && mAudioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) { sc.icon.setImageResource(R.drawable.ic_audio_ring_notif_vibrate); } sc.seekbarView.setEnabled(!muted); } Loading Loading @@ -695,8 +699,14 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie expand(); } else if (v.getTag() instanceof StreamControl) { StreamControl sc = (StreamControl) v.getTag(); mAudioManager.setRingerMode(mAudioManager.isSilentMode() ? AudioManager.RINGER_MODE_NORMAL : AudioManager.RINGER_MODE_SILENT); boolean vibeInSilent = Settings.System.getInt(mContext.getContentResolver(), System.VIBRATE_IN_SILENT, 1) == 1; int newMode = mAudioManager.isSilentMode() ? AudioManager.RINGER_MODE_NORMAL : (vibeInSilent ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT); mAudioManager.setRingerMode(newMode); // Expand the dialog if it hasn't been expanded yet. if (mShowCombinedVolumes && !isExpanded()) expand(); } Loading core/res/res/drawable-hdpi/ic_audio_ring_notif_vibrate.png 0 → 100644 +1.28 KiB Loading image diff... core/res/res/drawable-mdpi/ic_audio_ring_notif_vibrate.png 0 → 100644 +905 B Loading image diff... core/res/res/drawable-xhdpi/ic_audio_ring_notif_vibrate.png 0 → 100644 +1.8 KiB Loading image diff... media/java/android/media/AudioService.java +22 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package android.media; import static android.media.AudioManager.RINGER_MODE_NORMAL; import static android.media.AudioManager.RINGER_MODE_SILENT; import static android.media.AudioManager.RINGER_MODE_VIBRATE; import android.app.ActivityManagerNative; import android.app.KeyguardManager; import android.app.PendingIntent; Loading Loading @@ -528,8 +532,8 @@ public class AudioService extends IAudioService.Stub { (!mVoiceCapable && streamType != AudioSystem.STREAM_VOICE_CALL && streamType != AudioSystem.STREAM_BLUETOOTH_SCO) || (mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_RING)) { // do not vibrate if already in silent mode if (mRingerMode != AudioManager.RINGER_MODE_NORMAL) { // do not vibrate if already in vibrate mode if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { flags &= ~AudioManager.FLAG_VIBRATE; } // Check if the ringer mode changes with this volume adjustment. If Loading Loading @@ -1621,26 +1625,36 @@ public class AudioService extends IAudioService.Stub { boolean adjustVolumeIndex = true; int newRingerMode = mRingerMode; int uiIndex = (oldIndex + 5) / 10; boolean vibeInSilent = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1; if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { if (mRingerMode == RINGER_MODE_NORMAL) { if ((direction == AudioManager.ADJUST_LOWER) && (uiIndex <= 1)) { // enter silent mode if current index is the last audible one and not repeating a // volume key down if (mPrevVolDirection != AudioManager.ADJUST_LOWER) { if (vibeInSilent || mPrevVolDirection != AudioManager.ADJUST_LOWER) { // "silent mode", but which one? newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1 ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT; newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT; } if (uiIndex == 0 || (mPrevVolDirection == AudioManager.ADJUST_LOWER && mVoiceCapable && streamType == AudioSystem.STREAM_RING)) { adjustVolumeIndex = false; } } } else if (mRingerMode == RINGER_MODE_VIBRATE) { if ((direction == AudioManager.ADJUST_LOWER)) { // Set it to silent, if it wasn't a long-press if (mPrevVolDirection != AudioManager.ADJUST_LOWER) { newRingerMode = RINGER_MODE_SILENT; } } else if (direction == AudioManager.ADJUST_RAISE) { newRingerMode = RINGER_MODE_NORMAL; } adjustVolumeIndex = false; } else { if (direction == AudioManager.ADJUST_RAISE) { // exiting silent mode newRingerMode = AudioManager.RINGER_MODE_NORMAL; // If VIBRATE_IN_SILENT, then go into vibrate mode newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_NORMAL; } adjustVolumeIndex = false; } Loading Loading
core/java/android/view/VolumePanel.java +12 −2 Original line number Diff line number Diff line Loading @@ -352,6 +352,10 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie sc.seekbarView.setProgress(mAudioManager.getLastAudibleStreamVolume(sc.streamType)); final boolean muted = isMuted(sc.streamType); sc.icon.setImageResource(muted ? sc.iconMuteRes : sc.iconRes); if (sc.streamType == AudioManager.STREAM_RING && muted && mAudioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) { sc.icon.setImageResource(R.drawable.ic_audio_ring_notif_vibrate); } sc.seekbarView.setEnabled(!muted); } Loading Loading @@ -695,8 +699,14 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie expand(); } else if (v.getTag() instanceof StreamControl) { StreamControl sc = (StreamControl) v.getTag(); mAudioManager.setRingerMode(mAudioManager.isSilentMode() ? AudioManager.RINGER_MODE_NORMAL : AudioManager.RINGER_MODE_SILENT); boolean vibeInSilent = Settings.System.getInt(mContext.getContentResolver(), System.VIBRATE_IN_SILENT, 1) == 1; int newMode = mAudioManager.isSilentMode() ? AudioManager.RINGER_MODE_NORMAL : (vibeInSilent ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT); mAudioManager.setRingerMode(newMode); // Expand the dialog if it hasn't been expanded yet. if (mShowCombinedVolumes && !isExpanded()) expand(); } Loading
core/res/res/drawable-hdpi/ic_audio_ring_notif_vibrate.png 0 → 100644 +1.28 KiB Loading image diff...
core/res/res/drawable-xhdpi/ic_audio_ring_notif_vibrate.png 0 → 100644 +1.8 KiB Loading image diff...
media/java/android/media/AudioService.java +22 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package android.media; import static android.media.AudioManager.RINGER_MODE_NORMAL; import static android.media.AudioManager.RINGER_MODE_SILENT; import static android.media.AudioManager.RINGER_MODE_VIBRATE; import android.app.ActivityManagerNative; import android.app.KeyguardManager; import android.app.PendingIntent; Loading Loading @@ -528,8 +532,8 @@ public class AudioService extends IAudioService.Stub { (!mVoiceCapable && streamType != AudioSystem.STREAM_VOICE_CALL && streamType != AudioSystem.STREAM_BLUETOOTH_SCO) || (mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_RING)) { // do not vibrate if already in silent mode if (mRingerMode != AudioManager.RINGER_MODE_NORMAL) { // do not vibrate if already in vibrate mode if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) { flags &= ~AudioManager.FLAG_VIBRATE; } // Check if the ringer mode changes with this volume adjustment. If Loading Loading @@ -1621,26 +1625,36 @@ public class AudioService extends IAudioService.Stub { boolean adjustVolumeIndex = true; int newRingerMode = mRingerMode; int uiIndex = (oldIndex + 5) / 10; boolean vibeInSilent = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1; if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { if (mRingerMode == RINGER_MODE_NORMAL) { if ((direction == AudioManager.ADJUST_LOWER) && (uiIndex <= 1)) { // enter silent mode if current index is the last audible one and not repeating a // volume key down if (mPrevVolDirection != AudioManager.ADJUST_LOWER) { if (vibeInSilent || mPrevVolDirection != AudioManager.ADJUST_LOWER) { // "silent mode", but which one? newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1 ? AudioManager.RINGER_MODE_VIBRATE : AudioManager.RINGER_MODE_SILENT; newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT; } if (uiIndex == 0 || (mPrevVolDirection == AudioManager.ADJUST_LOWER && mVoiceCapable && streamType == AudioSystem.STREAM_RING)) { adjustVolumeIndex = false; } } } else if (mRingerMode == RINGER_MODE_VIBRATE) { if ((direction == AudioManager.ADJUST_LOWER)) { // Set it to silent, if it wasn't a long-press if (mPrevVolDirection != AudioManager.ADJUST_LOWER) { newRingerMode = RINGER_MODE_SILENT; } } else if (direction == AudioManager.ADJUST_RAISE) { newRingerMode = RINGER_MODE_NORMAL; } adjustVolumeIndex = false; } else { if (direction == AudioManager.ADJUST_RAISE) { // exiting silent mode newRingerMode = AudioManager.RINGER_MODE_NORMAL; // If VIBRATE_IN_SILENT, then go into vibrate mode newRingerMode = vibeInSilent ? RINGER_MODE_VIBRATE : RINGER_MODE_NORMAL; } adjustVolumeIndex = false; } Loading