Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f677d66 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

Add new audio mode 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.

Change-Id: Id744cd26520ea1d1a4795eabe6a1f0c58789af76
parent 75663cee
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ public:
        MODE_NORMAL = 0,
        MODE_RINGTONE,
        MODE_IN_CALL,
        MODE_IN_COMMUNICATION,
        NUM_MODES  // not a valid entry, denotes end-of-list
    };

+3 −3
Original line number Diff line number Diff line
@@ -602,9 +602,9 @@ enum audio_device_e {

// Audio mode
enum audio_mode_e {
    AUDIO_MODE_NORMAL,      // phone idle
    AUDIO_MODE_RINGTONE,    // phone ringing
    AUDIO_MODE_IN_CALL      // phone call connected
    AUDIO_MODE_NORMAL,      // device idle
    AUDIO_MODE_RINGTONE,    // device ringing
    AUDIO_MODE_IN_CALL      // audio call connected (VoIP or telephony)
};

// Values for "accessMode" field of buffer_config_t:
+8 −3
Original line number Diff line number Diff line
@@ -984,7 +984,7 @@ public class AudioManager {
     * application when it places a phone call, as it will cause signals from the radio layer
     * to feed the platform mixer.
     *
     * @param mode  the requested audio mode (NORMAL, RINGTONE, or IN_CALL).
     * @param mode  the requested audio mode (NORMAL, RINGTONE, IN_CALL or IN_COMMUNICATION).
     *              Informs the HAL about the current audio state so that
     *              it can route the audio appropriately.
     */
@@ -1000,7 +1000,7 @@ public class AudioManager {
    /**
     * Returns the current audio mode.
     *
     * @return      the current audio mode (NORMAL, RINGTONE, or IN_CALL).
     * @return      the current audio mode (NORMAL, RINGTONE, IN_CALL or IN_COMMUNICATION).
     *              Returns the current current audio state from the HAL.
     */
    public int getMode() {
@@ -1034,9 +1034,14 @@ public class AudioManager {
     */
    public static final int MODE_RINGTONE           = AudioSystem.MODE_RINGTONE;
    /**
     * In call audio mode. A call is established.
     * In call audio mode. A telephony call is established.
     */
    public static final int MODE_IN_CALL            = AudioSystem.MODE_IN_CALL;
    /**
     * @hide
     * In communication audio mode. An audio/video chat or VoIP call is established.
     */
    public static final int MODE_IN_COMMUNICATION   = AudioSystem.MODE_IN_COMMUNICATION;

    /* Routing bits for setRouting/getRouting API */
    /**
+2 −1
Original line number Diff line number Diff line
@@ -718,7 +718,7 @@ public class AudioService extends IAudioService.Stub {
            return;
        }

        if (mode < AudioSystem.MODE_CURRENT || mode > AudioSystem.MODE_IN_CALL) {
        if (mode < AudioSystem.MODE_CURRENT || mode >= AudioSystem.NUM_MODES) {
            return;
        }

@@ -2305,6 +2305,7 @@ public class AudioService extends IAudioService.Stub {
                //      add modify the phone app to take advantage of the new API
                synchronized(mRingingLock) {
                    if (mIsRinging || (getMode() == AudioSystem.MODE_IN_CALL) ||
                            (getMode() == AudioSystem.MODE_IN_COMMUNICATION) ||
                            (getMode() == AudioSystem.MODE_RINGTONE) ) {
                        return;
                    }
+2 −1
Original line number Diff line number Diff line
@@ -106,7 +106,8 @@ public class AudioSystem
    public static final int MODE_NORMAL             = 0;
    public static final int MODE_RINGTONE           = 1;
    public static final int MODE_IN_CALL            = 2;
    public static final int NUM_MODES               = 3;
    public static final int MODE_IN_COMMUNICATION   = 3;
    public static final int NUM_MODES               = 4;


    /* Routing bits for setRouting/getRouting API */
Loading