summaryrefslogtreecommitdiff
path: root/java/com
diff options
context:
space:
mode:
authoryueg <yueg@google.com>2017-12-19 19:43:53 -0800
committerEric Erfanian <erfanian@google.com>2017-12-22 08:53:22 -0800
commit48609d015f06e262796b7ce8a088243199940a8a (patch)
treed1e3c5ce9057de09132a985bf2d42ea3bb9e6089 /java/com
parent043d6715d7b7f5ccc81c416ef80c1fc04ec1445a (diff)
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
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/dialer/telecom/TelecomUtil.java10
-rw-r--r--java/com/android/incallui/NewReturnToCallController.java43
2 files changed, 28 insertions, 25 deletions
diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java
index 22f3727e6..c64a50231 100644
--- a/java/com/android/dialer/telecom/TelecomUtil.java
+++ b/java/com/android/dialer/telecom/TelecomUtil.java
@@ -178,6 +178,10 @@ public abstract class TelecomUtil {
* are not included.
*/
public static boolean isInManagedCall(Context context) {
+ return instance.isInManagedCall(context);
+ }
+
+ public static boolean isInCall(Context context) {
return instance.isInCall(context);
}
@@ -289,7 +293,7 @@ public abstract class TelecomUtil {
@VisibleForTesting()
public static class TelecomUtilImpl {
- public boolean isInCall(Context context) {
+ public boolean isInManagedCall(Context context) {
if (hasReadPhoneStatePermission(context)) {
// The TelecomManager#isInCall method returns true anytime the user is in a call.
// Starting in O, the APIs include support for self-managed ConnectionServices so that other
@@ -308,6 +312,10 @@ public abstract class TelecomUtil {
return false;
}
+ public boolean isInCall(Context context) {
+ return hasReadPhoneStatePermission(context) && getTelecomManager(context).isInCall();
+ }
+
public boolean hasPermission(Context context, String permission) {
return ContextCompat.checkSelfPermission(context, permission)
== PackageManager.PERMISSION_GRANTED;
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);