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

Commit 3dc18506 authored by Qiang Chen's avatar Qiang Chen Committed by Linux Build Service Account
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
CRs-Fixed: 754497
parent ec0eb424
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ public abstract class Connection extends Conferenceable {
        public void onConferenceMergeFailed(Connection c) {}
        public void onExtrasChanged(Connection c, Bundle extras) {}
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
        public void onCdmaConnectionTimeReset(Connection c) {}
    }

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

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

    /**
     * Returns the connections or conferences with which this connection can be conferenced.
     */
+5 −0
Original line number Diff line number Diff line
@@ -632,6 +632,11 @@ public abstract class ConnectionService extends Service {
            Log.i(this, "Adapter onPhoneAccountChanged %s, %s", c, pHandle);
            mAdapter.setPhoneAccountHandle(id, pHandle);
        }

        public void onCdmaConnectionTimeReset(Connection c) {
            String id = mIdByConnection.get(c);
            mAdapter.resetCdmaConnectionTime(id);
        }
    };

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

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

    /**
     * Indicates that the call no longer exists. Can be used with either a call or a conference
     * call.
+4 −0
Original line number Diff line number Diff line
@@ -437,6 +437,10 @@ final class ConnectionServiceAdapterServant {
            args.arg2 = pHandle;
            mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget();
        }

        @Override
        public void resetCdmaConnectionTime(String callId) {
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
+4 −0
Original line number Diff line number Diff line
@@ -335,6 +335,10 @@ final class RemoteConnectionService {
            findConnectionForAction(callId, "setPhoneAccountHandle")
                    .setPhoneAccountHandle(pHandle);
        }

        @Override
        public void resetCdmaConnectionTime(String callId) {
        }
    };

    private final ConnectionServiceAdapterServant mServant =
Loading