From 48609d015f06e262796b7ce8a088243199940a8a Mon Sep 17 00:00:00 2001 From: yueg Date: Tue, 19 Dec 2017 19:43:53 -0800 Subject: Bubble v2 changes. - Only show bubble for outgoing, active and background call. (Before: show bubble when is in call) - Show "Call ended" and hide bubble only when there is no outgoing, active or background call. (Before: show "Call ended" for all real call disconnection like one call in conference) - Don't show "Call ended" but only hide bubble when Duo upgrade is accepted/declined. We show bubble for Duo upgrade since the call is still connected. The solution doesn't work for fallback upgrade on pre-ODR device (so "Call ended" still shows). Bug: 67605985 Test: NewReturnToCallControllerTest PiperOrigin-RevId: 179636643 Change-Id: I5d1f6e812c94108228757af89e33d4c496beb735 --- .../incallui/NewReturnToCallController.java | 43 ++++++++++------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'java/com/android/incallui') diff --git a/java/com/android/incallui/NewReturnToCallController.java b/java/com/android/incallui/NewReturnToCallController.java index ad49d6828..ca60a52c1 100644 --- a/java/com/android/incallui/NewReturnToCallController.java +++ b/java/com/android/incallui/NewReturnToCallController.java @@ -101,7 +101,7 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au if (showing) { hide(); } else { - if (TelecomUtil.isInManagedCall(context)) { + if (getCall() != null) { show(); } } @@ -157,22 +157,15 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au @Override public void onDisconnect(DialerCall call) { - 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.isInManagedCall(context) - || CallList.getInstance().getActiveOrBackgroundCall() != null)) { - bubble.showText(context.getText(R.string.incall_call_ended)); - } - // For conference call, we should hideAndReset for the last disconnected child call while the - // parent call is still there. - if (!CallList.getInstance().hasNonParentActiveOrBackgroundCall()) { + LogUtil.enterBlock("ReturnToCallController.onDisconnect"); + if (bubble != null && bubble.isVisible() && (getCall() == null)) { + // Show "Call ended" and hide bubble when there is no outgoing, active or background call + LogUtil.i("ReturnToCallController.onDisconnect", "show call ended and hide bubble"); + // Don't show text if it's Duo upgrade + // It doesn't work for Duo fallback upgrade since we're not considered in call + if (!TelecomUtil.isInCall(context) || CallList.getInstance().getIncomingCall() != null) { + bubble.showText(context.getText(R.string.incall_call_ended)); + } hideAndReset(); } else { startContactInfoSearch(); @@ -197,19 +190,21 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au } private void startContactInfoSearch() { - DialerCall dialerCall = CallList.getInstance().getIncomingCall(); - if (dialerCall == null) { - dialerCall = CallList.getInstance().getOutgoingCall(); - } - if (dialerCall == null) { - dialerCall = CallList.getInstance().getActiveOrBackgroundCall(); - } + DialerCall dialerCall = getCall(); if (dialerCall != null) { contactInfoCache.findInfo( dialerCall, false /* isIncoming */, new ReturnToCallContactInfoCacheCallback(this)); } } + private DialerCall getCall() { + DialerCall dialerCall = CallList.getInstance().getOutgoingCall(); + if (dialerCall == null) { + dialerCall = CallList.getInstance().getActiveOrBackgroundCall(); + } + return dialerCall; + } + private void onPhotoAvatarReceived(@NonNull Drawable photo) { if (bubble != null) { bubble.updatePhotoAvatar(photo); -- cgit v1.2.3