From 1588309ffce8962606e37ca0b49704d58894c2a7 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 15 Nov 2016 11:17:51 -0800 Subject: Add method to check for ongoing video call or conference call. Replace the isVideoCallPresent method on Phone (which is used only in the accessibility settings screen) with a version that determines if there are any ongoing video calls, downgraded video calls, or conference calls. Test: Manual testing. Bug: 28512893 Change-Id: If8b5db80aa0147234f6c4c0a8adf85f4643a2680 --- src/java/com/android/internal/telephony/Phone.java | 41 ++++++++++++++++------ 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java index c01be8597..13d0898c9 100644 --- a/src/java/com/android/internal/telephony/Phone.java +++ b/src/java/com/android/internal/telephony/Phone.java @@ -50,10 +50,12 @@ import android.telephony.SubscriptionManager; import android.telephony.VoLteServiceState; import android.text.TextUtils; +import com.android.ims.ImsCall; import com.android.ims.ImsConfig; import com.android.ims.ImsManager; import com.android.internal.R; import com.android.internal.telephony.dataconnection.DcTracker; +import com.android.internal.telephony.imsphone.ImsPhoneCall; import com.android.internal.telephony.test.SimulatedRadioControl; import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType; import com.android.internal.telephony.uicc.IccFileHandler; @@ -2072,23 +2074,40 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return videoState; } - private boolean isVideoCall(Call call) { - int videoState = getVideoState(call); - return (VideoProfile.isVideo(videoState)); + /** + * Determines if the specified call currently is or was at some point a video call, or if it is + * a conference call. + * @param call The call. + * @return {@code true} if the call is or was a video call or is a conference call, + * {@code false} otherwise. + */ + private boolean isVideoCallOrConference(Call call) { + if (call.isMultiparty()) { + return true; + } + + boolean isDowngradedVideoCall = false; + if (call instanceof ImsPhoneCall) { + ImsPhoneCall imsPhoneCall = (ImsPhoneCall) call; + ImsCall imsCall = imsPhoneCall.getImsCall(); + return imsCall != null && (imsCall.isVideoCall() || + imsCall.wasVideoCall()); + } + return isDowngradedVideoCall; } /** - * @return {@code true} if video call is present, false otherwise. + * @return {@code true} if an IMS video call or IMS conference is present, false otherwise. */ - public boolean isVideoCallPresent() { - boolean isVideoCallActive = false; + public boolean isImsVideoCallOrConferencePresent() { + boolean isPresent = false; if (mImsPhone != null) { - isVideoCallActive = isVideoCall(mImsPhone.getForegroundCall()) || - isVideoCall(mImsPhone.getBackgroundCall()) || - isVideoCall(mImsPhone.getRingingCall()); + isPresent = isVideoCallOrConference(mImsPhone.getForegroundCall()) || + isVideoCallOrConference(mImsPhone.getBackgroundCall()) || + isVideoCallOrConference(mImsPhone.getRingingCall()); } - Rlog.d(LOG_TAG, "isVideoCallActive: " + isVideoCallActive); - return isVideoCallActive; + Rlog.d(LOG_TAG, "isImsVideoCallOrConferencePresent: " + isPresent); + return isPresent; } /** -- cgit v1.2.3