From 9dfd6a437098dbaae0f48a7e3ed5205dc41fefe0 Mon Sep 17 00:00:00 2001 From: erfanian Date: Tue, 17 Apr 2018 15:01:17 -0700 Subject: Update in call button logic. Bug: 73774242 Test: unit PiperOrigin-RevId: 193262041 Change-Id: Idc0de19cc6d58cf79715ec243108c53b9b1df848 --- java/com/android/incallui/CallButtonPresenter.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'java') diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index 7e05badfe..a22a2581f 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -16,7 +16,9 @@ package com.android.incallui; +import android.annotation.TargetApi; import android.content.Context; +import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Trace; import android.support.v4.app.Fragment; @@ -441,7 +443,8 @@ public class CallButtonPresenter * * @param call The active call. */ - @SuppressWarnings("MissingPermission") + @TargetApi(VERSION_CODES.N) + @SuppressWarnings(value = {"MissingPermission", "AndroidApiChecker"}) // Java 8 APIs. private void updateButtonsState(DialerCall call) { LogUtil.v("CallButtonPresenter.updateButtonsState", ""); final boolean isVideo = call.isVideoCall(); @@ -459,7 +462,15 @@ public class CallButtonPresenter final boolean showAddCall = TelecomAdapter.getInstance().canAddCall() && UserManagerCompat.isUserUnlocked(context); - final boolean showMerge = call.can(android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE); + // There can only be two calls so don't show the ability to merge when one of them + // is a speak easy call. + final boolean showMerge = + InCallPresenter.getInstance() + .getCallList() + .getAllCalls() + .stream() + .noneMatch(c -> c != null && c.isSpeakEasyCall()) + && call.can(android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE); final boolean showUpgradeToVideo = !isVideo && (hasVideoCallCapabilities(call)); final boolean showDowngradeToAudio = isVideo && isDowngradeToAudioSupported(call); final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE); -- cgit v1.2.3