Update TeleService callback and reduce update frequency.
1. Changed name of the initial callback on the binder interface.
2. Made it so that we dont issue updates for Incoming and Disconnected
calls. Incoming calls dont change until their state changes and
disconnected calls dont change at all. What was happening is that the
redundant calls to onUpdate were executing before onDisconnect and
onIncoming effectively changing the state of the call before the
functions that were meant to change them to those states.
Additionally, with disconnected calls, we start tearing down the system
once the last call ends, which would happen twice: one with onUpdate and
once with onDisconnect. This caused additional binder activity after we
already started tearing things down.
bug:10682538
Change-Id: I47161c12429455f5f4fbca9113e6b06438028eb1
diff --git a/common/src/com/android/services/telephony/common/Call.java b/common/src/com/android/services/telephony/common/Call.java
index d88e8fb..b2774ec 100644
--- a/common/src/com/android/services/telephony/common/Call.java
+++ b/common/src/com/android/services/telephony/common/Call.java
@@ -49,7 +49,7 @@
public static final int DIALING = 5; /* An outgoing call during dial phase */
public static final int ONHOLD = 6; /* An active phone call placed on hold */
public static final int DISCONNECTED = 7; /* State after a call disconnects */
- public static final int CONFERENCED = 8; /* Call part of a conference call */
+ public static final int CONFERENCED = 8; /* Call part of a conference call */
public static boolean isConnected(int state) {
switch(state) {
diff --git a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
index 4fbc8b8..0cbd9b9 100644
--- a/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
+++ b/common/src/com/android/services/telephony/common/ICallHandlerService.aidl
@@ -31,10 +31,11 @@
oneway interface ICallHandlerService {
/**
+ * First call made when we are ready to start sending events to the service.
* Hands a command interface to the CallHandlerService through which
* the call monitor can control the phone calls.
*/
- void setCallCommandService(ICallCommandService callCommandService);
+ void startCallService(ICallCommandService callCommandService);
/**
* Called when there is an incoming call.
diff --git a/src/com/android/phone/CallHandlerServiceProxy.java b/src/com/android/phone/CallHandlerServiceProxy.java
index 82c56a5..3c7b517 100644
--- a/src/com/android/phone/CallHandlerServiceProxy.java
+++ b/src/com/android/phone/CallHandlerServiceProxy.java
@@ -402,7 +402,7 @@
*/
private void makeInitialServiceCalls() {
try {
- mCallHandlerServiceGuarded.setCallCommandService(mCallCommandService);
+ mCallHandlerServiceGuarded.startCallService(mCallCommandService);
onSupportedAudioModeChange(mAudioRouter.getSupportedAudioModes());
onAudioModeChange(mAudioRouter.getAudioMode(), mAudioRouter.getMute());
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 8848f73..79e77f6 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -301,18 +301,18 @@
for (com.android.internal.telephony.Call telephonyCall : telephonyCalls) {
for (Connection connection : telephonyCall.getConnections()) {
- // We do not create incoming or disconnected calls on update. Those are created
- // from the associated onNewRingingConnection and onDisconnected which do this
- // process on their own and slightly differently.
- boolean create = connection.getState().isAlive() &&
+ // We only send updates for live calls which are not incoming (ringing).
+ // Disconnected and incoming calls are handled by onDisconnect and
+ // onNewRingingConnection.
+ boolean shouldUpdate = connection.getState().isAlive() &&
!connection.getState().isRinging();
// New connections return a Call with INVALID state, which does not translate to
// a state in the internal.telephony.Call object. This ensures that staleness
// check below fails and we always add the item to the update list if it is new.
- final Call call = getCallFromMap(mCallMap, connection, create);
+ final Call call = getCallFromMap(mCallMap, connection, shouldUpdate /* create */);
- if (call == null) {
+ if (call == null || !shouldUpdate) {
continue;
}