From 2e3f116cecba6649979aa916436d90dbace32671 Mon Sep 17 00:00:00 2001 From: sceller Date: Tue, 11 Dec 2018 11:11:22 -0800 Subject: Add RPCs to get/set voice call stream volume (#102) --- .../android/mobly/snippet/bundled/AudioSnippet.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/com/google/android') diff --git a/src/main/java/com/google/android/mobly/snippet/bundled/AudioSnippet.java b/src/main/java/com/google/android/mobly/snippet/bundled/AudioSnippet.java index cf5331f..9871c4b 100644 --- a/src/main/java/com/google/android/mobly/snippet/bundled/AudioSnippet.java +++ b/src/main/java/com/google/android/mobly/snippet/bundled/AudioSnippet.java @@ -81,6 +81,26 @@ public class AudioSnippet implements Snippet { public void setRingVolume(Integer value) { mAudioManager.setStreamVolume(AudioManager.STREAM_RING, value, 0 /* flags, 0 = no flags */); } + + @Rpc(description = "Gets the voice call volume.") + public int getVoiceCallVolume() { + return mAudioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL); + } + + @Rpc(description = "Gets the maximum voice call volume value.") + public int getVoiceCallMaxVolume() { + return mAudioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL); + } + + @Rpc( + description = + "Sets the voice call stream volume. The minimum value is 0. Use getVoiceCallMaxVolume" + + "to determine the maximum." + ) + public void setVoiceCallVolume(Integer value) { + mAudioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, + value, 0 /* flags, 0 = no flags */); + } @Rpc(description = "Silences all audio streams.") public void muteAll() throws Exception { -- cgit v1.2.3