Support new audio mode for audio communication other than telephony.

Change-Id: I965cbeee67f72e31240e3e8cd2630bf22a03b9ea
This commit is contained in:
Jean-Michel Trivi 2010-11-15 16:02:06 -08:00
parent 7314fe03b6
commit 3e480fa067
2 changed files with 18 additions and 8 deletions

View file

@ -36,8 +36,8 @@ public:
/**
* setMode is called when the audio mode changes. NORMAL mode is for
* standard audio playback, RINGTONE when a ringtone is playing, and IN_CALL
* when a call is in progress.
* standard audio playback, RINGTONE when a ringtone is playing, IN_CALL
* when a telephony call is in progress, IN_COMMUNICATION when a VoIP call is in progress.
*/
virtual status_t setMode(int mode);
@ -50,6 +50,12 @@ public:
virtual status_t dumpState(int fd, const Vector<String16>& args);
protected:
/** returns true if the given mode maps to a telephony or VoIP call is in progress */
virtual bool isModeInCall(int mode)
{ return ((mode == AudioSystem::MODE_IN_CALL)
|| (mode == AudioSystem::MODE_IN_COMMUNICATION)); };
/** returns true if a telephony or VoIP call is in progress */
virtual bool isInCall() { return isModeInCall(mMode); };
int mMode;
};

View file

@ -236,6 +236,10 @@ protected:
void handleIncallSonification(int stream, bool starting, bool stateChange);
// true is current platform implements a back microphone
virtual bool hasBackMicrophone() const { return false; }
// true if device is in a telephony or VoIP call
virtual bool isInCall();
// true if given state represents a device in a telephony or VoIP call
virtual bool isStateInCall(int state);
#ifdef WITH_A2DP
// true is current platform supports suplication of notifications and ringtones over A2DP output