am 8d1de349: Merge "Do not create incoming/disconnected calls on update." into klp-dev
* commit '8d1de3499e10b571b64ba76a1e05086a93131400':
Do not create incoming/disconnected calls on update.
diff --git a/src/com/android/phone/CallHandlerServiceProxy.java b/src/com/android/phone/CallHandlerServiceProxy.java
index 4820b33..82c56a5 100644
--- a/src/com/android/phone/CallHandlerServiceProxy.java
+++ b/src/com/android/phone/CallHandlerServiceProxy.java
@@ -44,7 +44,7 @@
implements CallModeler.Listener, AudioModeListener {
private static final String TAG = CallHandlerServiceProxy.class.getSimpleName();
- private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 0) && (SystemProperties.getInt(
+ private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt(
"ro.debuggable", 0) == 1);
public static final int RETRY_DELAY_MILLIS = 2000;
@@ -229,10 +229,6 @@
Log.i(TAG, "Updating with new audio mode: " + AudioMode.toString(newMode) +
" with mute " + muted);
- if (DBG) {
- Log.d(TAG, "onSupportAudioModeChange");
- }
-
mCallHandlerServiceGuarded.onAudioModeChange(newMode, muted);
} catch (Exception e) {
Log.e(TAG, "Remote exception handling onAudioModeChange", e);
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index fc51c6b..8848f73 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -278,8 +278,10 @@
final List<Call> updatedCalls = Lists.newArrayList();
doUpdate(false, updatedCalls);
- for (int i = 0; i < mListeners.size(); ++i) {
- mListeners.get(i).onUpdate(updatedCalls);
+ if (updatedCalls.size() > 0) {
+ for (int i = 0; i < mListeners.size(); ++i) {
+ mListeners.get(i).onUpdate(updatedCalls);
+ }
}
}
@@ -299,14 +301,23 @@
for (com.android.internal.telephony.Call telephonyCall : telephonyCalls) {
for (Connection connection : telephonyCall.getConnections()) {
- // new connections return a Call with INVALID state, which does not translate to
+ // 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() &&
+ !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, true);
+ final Call call = getCallFromMap(mCallMap, connection, create);
+
+ if (call == null) {
+ continue;
+ }
boolean changed = updateCallFromConnection(call, connection, false);
- Log.i(TAG, "doUpdate: " + call);
if (fullUpdate || changed) {
out.add(call);
}