summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly <beverlyt@google.com> 2020-10-01 08:56:05 -0400
committer Beverly <beverlyt@google.com> 2020-10-01 08:56:05 -0400
commit9e88d6e7ffa48f79003d391710a73fae78f2426a (patch)
tree5ef9357bbb4b2b6b0663c7994de8f17f3df814b9
parent8862617d5f80b50185d1a8092a70309a8fc52ee4 (diff)
Test no vibration if first ringer state = vibrate
Test to ensure when the device first boots up, that when the ringer state on the volume dialog is set to VIBRATE, the device won't vibrate. The device will only vibrate if the ringer is manually set to VIBRATE later after initalization. Test: atest VolumeDialogImplTest Fixes: 169679638 Change-Id: Ia384b299b9fef962992d32355dfe2e2909635239
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
index f3cdbf7409c1..c0856892dc44 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java
@@ -21,6 +21,7 @@ import static com.android.systemui.volume.VolumeDialogControllerImpl.STREAMS;
import static junit.framework.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import android.app.KeyguardManager;
@@ -167,6 +168,45 @@ public class VolumeDialogImplTest extends SysuiTestCase {
AccessibilityManager.FLAG_CONTENT_CONTROLS);
}
+ @Test
+ public void testVibrateOnRingerChangedToVibrate() {
+ final State initialSilentState = new State();
+ initialSilentState.ringerModeInternal = AudioManager.RINGER_MODE_SILENT;
+
+ final State vibrateState = new State();
+ vibrateState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE;
+
+ // change ringer to silent
+ mDialog.onStateChangedH(initialSilentState);
+
+ // expected: shouldn't call vibrate yet
+ verify(mController, never()).vibrate(any());
+
+ // changed ringer to vibrate
+ mDialog.onStateChangedH(vibrateState);
+
+ // expected: vibrate device
+ verify(mController).vibrate(any());
+ }
+
+ @Test
+ public void testNoVibrateOnRingerInitialization() {
+ final State initialUnsetState = new State();
+ initialUnsetState.ringerModeInternal = -1;
+
+ // ringer not initialized yet:
+ mDialog.onStateChangedH(initialUnsetState);
+
+ final State vibrateState = new State();
+ vibrateState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE;
+
+ // changed ringer to vibrate
+ mDialog.onStateChangedH(vibrateState);
+
+ // shouldn't call vibrate
+ verify(mController, never()).vibrate(any());
+ }
+
/*
@Test
public void testContentDescriptions() {