From 3dc1850640a2af2fb342740853be1f84e76672c7 Mon Sep 17 00:00:00 2001 From: Qiang Chen Date: Wed, 3 Dec 2014 10:38:47 +0800 Subject: 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 --- telecomm/java/android/telecom/Connection.java | 11 +++++++++++ telecomm/java/android/telecom/ConnectionService.java | 5 +++++ telecomm/java/android/telecom/ConnectionServiceAdapter.java | 12 ++++++++++++ .../android/telecom/ConnectionServiceAdapterServant.java | 4 ++++ telecomm/java/android/telecom/RemoteConnectionService.java | 4 ++++ .../android/internal/telecom/IConnectionServiceAdapter.aidl | 2 ++ 6 files changed, 38 insertions(+) (limited to 'telecomm') diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 27c92bf..c02eee2 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -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) {} } /** @@ -1621,6 +1622,16 @@ public abstract class Connection extends Conferenceable { } /** + *@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. */ public final List getConferenceables() { diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 019839f..306b7e4 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -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} */ diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 8495f95..f59427d 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -230,6 +230,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. * diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index 7162772..feaa89e 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -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) { diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index c87b037..eead32a 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -335,6 +335,10 @@ final class RemoteConnectionService { findConnectionForAction(callId, "setPhoneAccountHandle") .setPhoneAccountHandle(pHandle); } + + @Override + public void resetCdmaConnectionTime(String callId) { + } }; private final ConnectionServiceAdapterServant mServant = diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index 32c48b1..aaefbaf 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -89,4 +89,6 @@ oneway interface IConnectionServiceAdapter { void setExtras(String callId, in Bundle extras); void setPhoneAccountHandle(String callId, in PhoneAccountHandle pHandle); + + void resetCdmaConnectionTime(String callId); } -- cgit v1.1