summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author qing <qingzhong@google.com> 2021-10-26 19:05:51 +0000
committer Qing Zhong <qingzhong@google.com> 2023-08-02 19:11:34 +0000
commit278fdb13a33c42fccc29c82878820246ff9eb872 (patch)
treeafbfd7ffff8e07c7a0834fb49ea7d359fb5ec544
parenteae843b7e6f3530a89f212034bb7cdffa85c3a80 (diff)
Make call back order right for DISCONNECTED call
If call is initially a DISCONNECTED call, the callback will be fire in wrong sequence where onCallRemoved is fired before onCallAdded. Bug: 203563157 Test: manual test Change-Id: I4b13dc13b34a1547f0c68ced01b3c1177dfa9eb3 (cherry picked from commit 5495c83fb5dbf833082ce4c9c21c415580420a7f) (cherry picked from commit fb9aec0c1175618759f5d7328fc42ec3c152cbe2)
-rw-r--r--telecomm/java/android/telecom/Call.java4
-rw-r--r--telecomm/java/android/telecom/Phone.java3
2 files changed, 6 insertions, 1 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 78b86d398718..5bdcdf4d63ef 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -2661,7 +2661,9 @@ public final class Call {
// remove ourselves from the Phone. Note that we do this after completing all state updates
// so a client can cleanly transition all their UI to the state appropriate for a
// DISCONNECTED Call while still relying on the existence of that Call in the Phone's list.
- if (mState == STATE_DISCONNECTED) {
+ // Check if the original state is already disconnected, otherwise onCallRemoved will be
+ // triggered before onCallAdded.
+ if (mState == STATE_DISCONNECTED && stateChanged) {
fireCallDestroyed();
}
}
diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java
index 95a8e16ace3d..61e829e75930 100644
--- a/telecomm/java/android/telecom/Phone.java
+++ b/telecomm/java/android/telecom/Phone.java
@@ -174,6 +174,9 @@ public final class Phone {
checkCallTree(parcelableCall);
call.internalUpdate(parcelableCall, mCallByTelecomCallId);
fireCallAdded(call);
+ if (call.getState() == Call.STATE_DISCONNECTED) {
+ internalRemoveCall(call);
+ }
} else {
Log.w(this, "Call %s added, but it was already present", call.internalGetCallId());
checkCallTree(parcelableCall);