From 98baccf8e095652f82d04b8f3e277905e67db33f Mon Sep 17 00:00:00 2001 From: yueg Date: Mon, 14 Aug 2017 10:28:15 -0700 Subject: 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 --- java/com/android/incallui/ReturnToCallController.java | 15 ++++++++++++--- java/com/android/incallui/call/CallList.java | 16 ++++++++++++++++ java/com/android/incallui/call/DialerCall.java | 4 ++++ 3 files changed, 32 insertions(+), 3 deletions(-) (limited to 'java') 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 @@ -535,6 +535,22 @@ public class CallList implements DialerCallDelegate { return retval; } + /** + * 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 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(); -- cgit v1.2.3