OSDN Git Service

Vibrate when ringer changes to vibrate
authorBeverly <beverlyt@google.com>
Tue, 22 May 2018 17:02:15 +0000 (13:02 -0400)
committerBeverly <beverlyt@google.com>
Tue, 22 May 2018 19:19:51 +0000 (15:19 -0400)
Test: manual
Change-Id: Icf7bf0d1dfa632d674b9e6aaff0c98099a4b2eb3
Fixes: 78665512

packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java

index d76b7f0..03474a8 100644 (file)
@@ -727,6 +727,12 @@ public class VolumeDialogImpl implements VolumeDialog {
     }
 
     protected void onStateChangedH(State state) {
+        if (mState != null && state != null
+                && mState.ringerModeInternal != state.ringerModeInternal
+                && state.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE) {
+            mController.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_HEAVY_CLICK));
+        }
+
         mState = state;
         mDynamic.clear();
         // add any new dynamic rows