Revert "When ringer changes to vibrate, phone vibrates"

Fixes: 79773317
Bug: 78665512

This reverts commit d253f98c0e.

Reason for revert: b/79773317

Change-Id: I6f3eebd64b94436748986422906006686351cc4b
This commit is contained in:
Beverly Tai
2018-05-15 23:49:05 +00:00
parent d253f98c0e
commit efd8e08dd3
2 changed files with 24 additions and 23 deletions

View File

@@ -17,8 +17,6 @@
package com.android.systemui.volume;
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.NotificationManager;
import android.content.BroadcastReceiver;
@@ -583,30 +581,13 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
mState.ringerModeInternal = rm;
Events.writeEvent(mContext, Events.EVENT_INTERNAL_RINGER_MODE_CHANGED, rm);
provideFeedback(mState.ringerModeInternal);
if (mState.ringerModeInternal == RINGER_MODE_NORMAL) {
playTouchFeedback();
}
return true;
}
private void provideFeedback(int newRingerMode) {
VibrationEffect effect = null;
switch (newRingerMode) {
case RINGER_MODE_NORMAL:
scheduleTouchFeedback();
playTouchFeedback();
break;
case RINGER_MODE_SILENT:
effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
break;
case RINGER_MODE_VIBRATE:
default:
effect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
}
if (effect != null) {
vibrate(effect);
}
}
private void onSetRingerModeW(int mode, boolean external) {
if (external) {
mAudio.setRingerMode(mode);

View File

@@ -446,12 +446,32 @@ public class VolumeDialogImpl implements VolumeDialog {
}
Events.writeEvent(mContext, Events.EVENT_RINGER_TOGGLE, newRingerMode);
updateRingerH();
provideTouchFeedbackH(newRingerMode);
mController.setRingerMode(newRingerMode, false);
maybeShowToastH(newRingerMode);
});
updateRingerH();
}
private void provideTouchFeedbackH(int newRingerMode) {
VibrationEffect effect = null;
switch (newRingerMode) {
case RINGER_MODE_NORMAL:
mController.scheduleTouchFeedback();
break;
case RINGER_MODE_SILENT:
effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
break;
case RINGER_MODE_VIBRATE:
default:
effect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
}
if (effect != null) {
mController.vibrate(effect);
}
}
private void maybeShowToastH(int newRingerMode) {
int seenToastCount = Prefs.getInt(mContext, Prefs.Key.SEEN_RINGER_GUIDANCE_COUNT, 0);