diff options
author | yueg <yueg@google.com> | 2017-08-14 10:28:15 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-14 11:00:56 -0700 |
commit | 98baccf8e095652f82d04b8f3e277905e67db33f (patch) | |
tree | ec729d0cc41ce64a298f3b0d8aa9cea36d161504 /java/com | |
parent | 92ce0a5321fa1439b50e0f0e7244ea0f7f205418 (diff) |
Fix bubble for conference call.
Fix bubble conference call bugs once and for all.
ReturnToCallController.onDsconnect() is called twice when ending the last call
in conference call: one for the last call itself, one for the parent call. And
we should do nothing for the parent call. This change avoids extra handling in
Bubble.showText() and Bubble.hideAndReset().
Test: ReturnToCallControllerTest
PiperOrigin-RevId: 165195412
Change-Id: Ib21fac6dd7ad9fe85c3070ce1295f63a91c61a02
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/android/incallui/ReturnToCallController.java | 15 | ||||
-rw-r--r-- | java/com/android/incallui/call/CallList.java | 16 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/java/com/android/incallui/ReturnToCallController.java b/java/com/android/incallui/ReturnToCallController.java index 8e4b9cc65..b0baface4 100644 --- a/java/com/android/incallui/ReturnToCallController.java +++ b/java/com/android/incallui/ReturnToCallController.java @@ -142,13 +142,22 @@ public class ReturnToCallController implements InCallUiListener, Listener, Audio @Override public void onDisconnect(DialerCall call) { - boolean hasAnotherCall = CallList.getInstance().getActiveOrBackgroundCall() != null; + if (call.wasParentCall()) { + // It's disconnected after the last child call is disconnected, and we already did everything + // for the last child. + LogUtil.i( + "ReturnToCallController.onDisconnect", "being called for a parent call and do nothing"); + return; + } if (bubble != null && bubble.isVisible() - && (!TelecomUtil.isInCall(context) || hasAnotherCall)) { + && (!TelecomUtil.isInCall(context) + || CallList.getInstance().getActiveOrBackgroundCall() != null)) { bubble.showText(context.getText(R.string.incall_call_ended)); } - if (!hasAnotherCall) { + // For conference call, we should hideAndReset for the last disconnected child call while the + // parent call is still there. + if (!CallList.getInstance().hasNonParentActiveOrBackgroundCall()) { hideAndReset(); } } diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index d932c2488..d0931dd3d 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -536,6 +536,22 @@ public class CallList implements DialerCallDelegate { } /** + * Return if there is any active or background call which was not a parent call (never had a child + * call) + */ + public boolean hasNonParentActiveOrBackgroundCall() { + for (DialerCall call : mCallById.values()) { + if ((call.getState() == State.ACTIVE + || call.getState() == State.ONHOLD + || call.getState() == State.CONFERENCED) + && !call.wasParentCall()) { + return true; + } + } + return false; + } + + /** * This is called when the service disconnects, either expectedly or unexpectedly. For the * expected case, it's because we have no calls left. For the unexpected case, it is likely a * crash of phone and we need to clean up our calls manually. Without phone, there can be no diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index a954ee914..378f920a8 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -429,6 +429,10 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa } } + public boolean wasParentCall() { + return mLogState.conferencedCalls != 0; + } + private void update() { Trace.beginSection("DialerCall.update"); int oldState = getState(); |