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

Commit 25707743 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, a new message is registered to listen the event of the call
accepted, and then reset the duration when the event happens.

Change-Id: Icc447012030ae243f200ec2c83b7d5210af9b31c
parent c14a4be7
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -842,6 +842,7 @@ public abstract class Connection extends Conferenceable {
        public void onRemoteRttRequest(Connection c) {}
        /** @hide */
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
        public void onConnectionTimeReset(Connection c) {}
    }

    /**
@@ -2363,6 +2364,16 @@ public abstract class Connection extends Conferenceable {
        fireOnConferenceableConnectionsChanged();
    }

    /**
     * @hide
     * Resets the cdma connection time.
     */
    public final void resetConnectionTime() {
        for (Listener l : mListeners) {
            l.onConnectionTimeReset(this);
        }
    }

    /**
     * Returns the connections or conferences with which this connection can be conferenced.
     */
+7 −0
Original line number Diff line number Diff line
@@ -1474,6 +1474,13 @@ public abstract class ConnectionService extends Service {
                mAdapter.onPhoneAccountChanged(id, pHandle);
            }
        }

        public void onConnectionTimeReset(Connection c) {
            String id = mIdByConnection.get(c);
            if (id != null) {
                mAdapter.resetConnectionTime(id);
            }
        }
    };

    /** {@inheritDoc} */
+12 −0
Original line number Diff line number Diff line
@@ -254,6 +254,18 @@ final class ConnectionServiceAdapter implements DeathRecipient {
        }
    }

    /**
        * Resets the cdma connection time.
        */
    void resetConnectionTime(String callId) {
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.resetConnectionTime(callId, Log.getExternalSession());
            } catch (RemoteException e) {
            }
        }
    }

    /**
     * Indicates that the call no longer exists. Can be used with either a call or a conference
     * call.
+5 −0
Original line number Diff line number Diff line
@@ -610,6 +610,11 @@ final class ConnectionServiceAdapterServant {
        public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
            mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
        }

        @Override
        public void resetConnectionTime(String callId, Session.Info sessionInfo) {
            // Do nothing
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
+5 −0
Original line number Diff line number Diff line
@@ -466,6 +466,11 @@ final class RemoteConnectionService {
                Log.w(this, "onRemoteRttRequest called on a remote conference");
            }
        }

        @Override
        public void resetConnectionTime(String callId, Session.Info sessionInfo) {
            // Do nothing
        }
    };

    private final ConnectionServiceAdapterServant mServant =
Loading