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

Commit 57fcf664 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Telephony: Reset the duration after the call is accepted"

parents 23d381ba 6cf2197c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public abstract class CallTracker extends Handler {
    protected static final int EVENT_EXIT_ECM_RESPONSE_CDMA        = 14;
    protected static final int EVENT_CALL_WAITING_INFO_CDMA        = 15;
    protected static final int EVENT_THREE_WAY_DIAL_L2_RESULT_CDMA = 16;
    protected static final int EVENT_CDMA_INFO_REC                 = 17;

    protected void pollCallsWhenSafe() {
        mNeedsPoll = true;
+16 −0
Original line number Diff line number Diff line
@@ -100,10 +100,22 @@ public final class CdmaCallTracker extends CallTracker {
        mCi.registerForOn(this, EVENT_RADIO_AVAILABLE, null);
        mCi.registerForNotAvailable(this, EVENT_RADIO_NOT_AVAILABLE, null);
        mCi.registerForCallWaitingInfo(this, EVENT_CALL_WAITING_INFO_CDMA, null);
        mCi.registerForLineControlInfo(this, EVENT_CDMA_INFO_REC, null);
        mForegroundCall.setGeneric(false);
    }

    private void onControlInfoRec() {
        if (mState == PhoneConstants.State.OFFHOOK) {
            Rlog.d(LOG_TAG, "on accepted, reset connection time");
            CdmaConnection c = (CdmaConnection) mForegroundCall.getLatestConnection();
            if (c.getDurationMillis() > 0 && !c.isConnectionTimerReset() && !c.isIncoming()) {
                c.resetConnectionTimer();
            }
        }
    }

    public void dispose() {
        mCi.unregisterForLineControlInfo(this);
        mCi.unregisterForCallStateChanged(this);
        mCi.unregisterForOn(this);
        mCi.unregisterForNotAvailable(this);
@@ -1030,6 +1042,10 @@ public final class CdmaCallTracker extends CallTracker {
                }
            break;

            case EVENT_CDMA_INFO_REC:
                onControlInfoRec();
            break;

            default:{
               throw new RuntimeException("unexpected event not handled");
            }
+14 −0
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ public class CdmaConnection extends Connection {
    static final int WAKE_LOCK_TIMEOUT_MILLIS = 60*1000;
    static final int PAUSE_DELAY_MILLIS = 2 * 1000;

    private boolean mConnTimerReset = false;

    //***** Inner Classes

    class MyHandler extends Handler {
@@ -957,4 +959,16 @@ public class CdmaConnection extends Connection {
        // UUS information not supported in CDMA
        return null;
    }

    void resetConnectionTimer() {
        mConnectTime = System.currentTimeMillis();
        mConnectTimeReal = SystemClock.elapsedRealtime();
        mDuration = 0;
        mConnTimerReset = true;
        log("CdmaConnection time reseted");
    }

    public boolean isConnectionTimerReset() {
        return mConnTimerReset;
    }
}