Add test for system crash when adjusting volume

This CL adds CTS test methods for fixing system crash which happens
when any of below methods is called with illegal direction argument:
 - MediaController.adjustVolume()
 - AudioManager.adjustVolume()
 - AudioManager.adjustSuggestedStreamVolume()

Bug: 65755677
Test: Passed the tests.
Change-Id: Ibd2a94f8b1e6da5d4d37b7e10649e86a7a391ef3
(cherry picked from commit bffea00165fd2fb1c9a8f4516010af291aad7ceb)
diff --git a/tests/tests/media/src/android/media/cts/AudioManagerTest.java b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
index 4c6eb27..ef14b9c 100644
--- a/tests/tests/media/src/android/media/cts/AudioManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
@@ -902,6 +902,19 @@
         }
     }
 
+    public void testAdjustVolumeWithIllegalDirection() throws Exception {
+        // Call the method with illegal direction. System should not reboot.
+        mAudioManager.adjustVolume(37, 0);
+    }
+
+    public void testAdjustSuggestedStreamVolumeWithIllegalArguments() throws Exception {
+        // Call the method with illegal direction. System should not reboot.
+        mAudioManager.adjustSuggestedStreamVolume(37, AudioManager.STREAM_MUSIC, 0);
+
+        // Call the method with illegal stream. System should not reboot.
+        mAudioManager.adjustSuggestedStreamVolume(AudioManager.ADJUST_RAISE, 66747, 0);
+    }
+
     private void setInterruptionFilter(int filter) throws Exception {
         mNm.setInterruptionFilter(filter);
         for (int i = 0; i < 5; i++) {
diff --git a/tests/tests/media/src/android/media/cts/MediaControllerTest.java b/tests/tests/media/src/android/media/cts/MediaControllerTest.java
index 17588ee..ec370ef 100644
--- a/tests/tests/media/src/android/media/cts/MediaControllerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaControllerTest.java
@@ -84,6 +84,11 @@
         }
     }
 
+    public void testAdjustVolumeWithIllegalDirection() {
+        // Call the method with illegal direction. System should not reboot.
+        mController.adjustVolume(37, 0);
+    }
+
     public void testVolumeControl() throws Exception {
         VolumeProvider vp = new VolumeProvider(VolumeProvider.VOLUME_CONTROL_ABSOLUTE, 11, 5) {
             @Override