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

Commit 6478e8a0 authored by kaiyiz's avatar kaiyiz Committed by Qiang Chen
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.

CRs-Fixed: 754497

Change-Id: Ib90283a3b5bbc7e8fa1d1e7ef09342ac19302f9c
parent 9083f2c3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -983,6 +983,16 @@ public final class CallsManager extends Call.ListenerBase {
        }
    }

    void resetCdmaConnectionTime(Call call) {
        call.setConnectTimeMillis(System.currentTimeMillis());
        if (mCalls.contains(call)) {
            for (CallsManagerListener listener : mListeners) {
                listener.onCallStateChanged(call, CallState.ACTIVE, CallState.ACTIVE);
            }
            updateForegroundCall();
        }
    }

    /**
     * Cleans up any calls currently associated with the specified connection service when the
     * service binder disconnects unexpectedly.
+14 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
    private static final int MSG_SET_CALL_SUBSTATE = 24;
    private static final int MSG_ADD_EXISTING_CONNECTION = 25;
    private static final int MSG_SET_CALL_PROPERTIES = 26;
    private static final int MSG_RESET_CDMA_CONNECT_TIME = 27;

    private final Handler mHandler = new Handler() {
        @Override
@@ -409,6 +410,12 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                        args.recycle();
                    }
                }
                case MSG_RESET_CDMA_CONNECT_TIME:
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
                        mCallsManager.resetCdmaConnectionTime(call);
                    }
                    break;
            }
        }
    };
@@ -664,6 +671,13 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
            args.arg2 = connection;
            mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
       }

       public void resetCdmaConnectionTime(String callId) {
            logIncoming("resetCdmaConnectionTime");
            if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) {
                mHandler.obtainMessage(MSG_RESET_CDMA_CONNECT_TIME, callId).sendToTarget();
            }
        }
    }

    private final Adapter mAdapter = new Adapter();