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

Commit 79fe82a8 authored by Mengjun Leng's avatar Mengjun Leng
Browse files

Telecom: Reset the duration after the CDMA call is accepted

In android original design, the duration of CDMA MO call is started from
the dial command sent, so it is not the real duration of the active time.

In this patch, CallsManager receive a new message to
reset the connection time for this call.

Change-Id: I37621d5c56ef95a8c9886b799528602f8d36cdb8
parent a5b57f02
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1402,6 +1402,10 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        return mConnectTimeMillis;
    }

    public void setConnectTimeMillis(long connectTimeMillis) {
        mConnectTimeMillis = connectTimeMillis;
    }

    int getConnectionCapabilities() {
        return mConnectionCapabilities;
    }
+10 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ public class CallsManager extends Call.ListenerBase
        void onHoldToneRequested(Call call);
        void onExternalCallChanged(Call call, boolean isExternalCall);
        void onDisconnectedTonePlaying(boolean isTonePlaying);
        void onConnectionTimeChanged(Call call);
    }

    /** Interface used to define the action which is executed delay under some condition. */
@@ -3940,4 +3941,13 @@ public class CallsManager extends Call.ListenerBase
            }
        }
    }

    public void resetConnectionTime(Call call) {
        call.setConnectTimeMillis(System.currentTimeMillis());
        if (mCalls.contains(call)) {
            for (CallsManagerListener listener : mListeners) {
                listener.onConnectionTimeChanged(call);
            }
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -92,4 +92,8 @@ public class CallsManagerListenerBase implements CallsManager.CallsManagerListen
    @Override
    public void onDisconnectedTonePlaying(boolean isTonePlaying) {
    }

    @Override
    public void onConnectionTimeChanged(Call call) {
    }
}
+20 −0
Original line number Diff line number Diff line
@@ -144,6 +144,26 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
            }
        }

        @Override
        public void resetConnectionTime(String callId, Session.Info sessionInfo) {
            Log.startSession(sessionInfo, "CSW.rCCT");
            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
                    logIncoming("resetConnectionTime %s", callId);
                    Call call = mCallIdMapper.getCall(callId);
                    if (call != null) {
                        mCallsManager.resetConnectionTime(call);
                    } else {
                        // Log.w(this, "resetConnectionTime, unknown call id: %s", msg.obj);
                    }
                }
            } finally {
                Binder.restoreCallingIdentity(token);
                Log.endSession();
            }
        }

        @Override
        public void setVideoProvider(String callId, IVideoProvider videoProvider,
                Session.Info sessionInfo) {
+6 −0
Original line number Diff line number Diff line
@@ -960,6 +960,12 @@ public class InCallController extends CallsManagerListenerBase {
        updateCall(call);
    }

    @Override
    public void onConnectionTimeChanged(Call call) {
        Log.d(this, "onConnectionTimeChanged %s", call);
        updateCall(call);
    }

    void bringToForeground(boolean showDialpad) {
        if (!mInCallServices.isEmpty()) {
            for (IInCallService inCallService : mInCallServices.values()) {