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

Commit 30a5ebce authored by Jordan Patterson's avatar Jordan Patterson
Browse files

Reduce Call Answer Delay

This patch sets a boolean acceptingIncomingCall to true on
acceptCall.  In setAudioMode, we set the mode as IN_CALL if the call is
ringing and acceptingIncomingCall is true.  This initializes the
microphone sooner, and should reduce the microphone delay.

Not sure if this is the best way to do this, but this reduces call
delay to under a second for me.  I thought I might as well upload it so
others could have a look at it.

Change-Id: Ied21acb81c8447fc9949cecf861c0be4ca67ebb0
parent 7657b943
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public final class CallManager {
    // default phone as the first phone registered, which is PhoneBase obj
    private Phone mDefaultPhone;

    private boolean acceptingRingingCall;
    // state registrants
    protected final RegistrantList mPreciseCallStateRegistrants
    = new RegistrantList();
@@ -170,6 +171,7 @@ public final class CallManager {
        mBackgroundCalls = new ArrayList<Call>();
        mForegroundCalls = new ArrayList<Call>();
        mDefaultPhone = null;
        acceptingRingingCall = false;
    }

    /**
@@ -376,7 +378,12 @@ public final class CallManager {
        int mode = AudioManager.MODE_NORMAL;
        switch (getState()) {
            case RINGING:
                if (acceptingRingingCall) {
                  mode = AudioManager.MODE_IN_CALL;
                  acceptingRingingCall = false;
                } else {
                  mode = AudioManager.MODE_RINGTONE;
                }
                break;
            case OFFHOOK:
                Phone fgPhone = getFgPhone();
@@ -510,6 +517,7 @@ public final class CallManager {
        }

        ringingPhone.acceptCall();
        acceptingRingingCall = true;

        if (VDBG) {
            Log.d(LOG_TAG, "End acceptCall(" +ringingCall + ")");