From 2ba92c71b5684dce700cf848bf157153c156df1d Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 15 Nov 2010 12:11:32 -0800 Subject: do not merge bug 3370834 Cherrypick from master Cherripick from master CL 79833, 79417, 78864, 80332, 87500 Add new audio mode and recording source for audio communications other than telelphony. The audio mode MODE_IN_CALL signals the system the device a phone call is currently underway. There was no way for audio video chat or VoIP applications to signal a call is underway, but not using the telephony resources. This change introduces a new mode to address this. Changes in other parts of the system (java and native) are required to take this new mode into account. The generic AudioPolicyManager is updated to not use its phone state variable directly, but to use two new convenience methods, isInCall() and isStateInCall(int) instead. Add a recording source used to designate a recording stream for voice communications such as VoIP. Update the platform-independent audio policy manager to pass the nature of the audio recording source to the audio policy client interface through the AudioPolicyClientInterface::setParameters() method. SIP calls should set the audio mode to MODE_IN_COMMUNICATION, Audio mode MODE_IN_CALL is reserved for telephony. SIP: Enable built-in echo canceler if available. 1. Always initialize AudioRecord with VOICE_COMMUNICATION. 2. If echo canceler is available, disable our echo suppressor. Note that this CL is intentionally not correcting the getAudioSourceMax() return value in MediaRecorder.java as the new source is hidden here. Change-Id: Ie68cd03c50553101aa2ad838fe9459b2cf151bc8 --- .../java/com/android/internal/telephony/CallManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'telephony/java') diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java index 0335ca2..b89058f 100644 --- a/telephony/java/com/android/internal/telephony/CallManager.java +++ b/telephony/java/com/android/internal/telephony/CallManager.java @@ -380,12 +380,17 @@ public final class CallManager { break; case OFFHOOK: Phone fgPhone = getFgPhone(); - // Enable IN_CALL mode while foreground call is in DIALING, - // ALERTING, ACTIVE and DISCONNECTING state and not from sipPhone + // While foreground call is in DIALING, + // ALERTING, ACTIVE and DISCONNECTING state if (getActiveFgCallState() != Call.State.IDLE - && getActiveFgCallState() != Call.State.DISCONNECTED - && !(fgPhone instanceof SipPhone)) { - mode = AudioManager.MODE_IN_CALL; + && getActiveFgCallState() != Call.State.DISCONNECTED) { + if (fgPhone instanceof SipPhone) { + // enable IN_COMMUNICATION audio mode for sipPhone + mode = AudioManager.MODE_IN_COMMUNICATION; + } else { + // enable IN_CALL audio mode for telephony + mode = AudioManager.MODE_IN_CALL; + } } break; } -- cgit v1.1