From cda81c2ef1ba595c35ae1d4ad72c44f3443e08fd Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 22 Aug 2014 14:05:57 -0700 Subject: Ensuring Video APIs are only called when video is available. Bug: 17179079 Change-Id: I3b327250c181f821ec37d574ae804f8003d04603 --- InCallUI/src/com/android/incallui/AnswerFragment.java | 5 +++++ InCallUI/src/com/android/incallui/AnswerPresenter.java | 3 ++- InCallUI/src/com/android/incallui/Call.java | 8 ++++++-- InCallUI/src/com/android/incallui/CallButtonFragment.java | 5 +++++ InCallUI/src/com/android/incallui/CallButtonPresenter.java | 4 +++- InCallUI/src/com/android/incallui/CallCardPresenter.java | 3 ++- InCallUI/src/com/android/incallui/StatusBarNotifier.java | 2 +- InCallUI/src/com/android/incallui/VideoCallPresenter.java | 10 ++++++++-- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java index 4fb79ac06..29747dabd 100644 --- a/InCallUI/src/com/android/incallui/AnswerFragment.java +++ b/InCallUI/src/com/android/incallui/AnswerFragment.java @@ -331,6 +331,11 @@ public class AnswerFragment extends BaseFragment getUi().showAnswerUi(true); boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && textMsgs != null; - if (call.isVideoCall()) { + if (call.isVideoCall(getUi().getContext())) { if (withSms) { getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS); getUi().configureMessageDialog(textMsgs); @@ -187,5 +187,6 @@ public class AnswerPresenter extends Presenter public void showTargets(int targetSet); public void showMessageDialog(); public void configureMessageDialog(List textResponses); + public Context getContext(); } } diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index 6bd3d0b9d..9948c2172 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -16,6 +16,9 @@ package com.android.incallui; +import com.android.contacts.common.CallUtil; + +import android.content.Context; import android.net.Uri; import android.telecomm.PhoneCapabilities; import android.telecomm.GatewayInfo; @@ -349,8 +352,9 @@ public final class Call { return mTelecommCall.getDetails().getVideoState(); } - public boolean isVideoCall() { - return VideoProfile.VideoState.isBidirectional(getVideoState()); + public boolean isVideoCall(Context context) { + return CallUtil.isVideoEnabled(context) && + VideoProfile.VideoState.isBidirectional(getVideoState()); } public void setSessionModificationState(int state) { diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 09a3bc292..74aeaf393 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -670,6 +670,11 @@ public class CallButtonFragment } } + @Override + public Context getContext() { + return getActivity(); + } + @Override public void showManageConferenceCallButton() { mExtraRowButton.setVisibility(View.VISIBLE); diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 93548dd7a..6cdc657ac 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.content.Context; import android.telecomm.AudioState; import android.telecomm.InCallService.VideoCall; import android.telecomm.PhoneCapabilities; @@ -297,7 +298,7 @@ public class CallButtonPresenter extends Presenter // If the primary call is a video call on hold, still show the contact photo. // If the primary call is an active video call, hide the contact photo. if (mPrimary != null) { - getUi().setPhotoVisible(!(mPrimary.isVideoCall() && callState != Call.State.ONHOLD)); + getUi().setPhotoVisible(!(mPrimary.isVideoCall(mContext) && + callState != Call.State.ONHOLD)); } final boolean enableEndCallButton = Call.State.isConnectingOrConnected(callState) && diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 809d294a7..35f266d9e 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -328,7 +328,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener { addHangupAction(builder); } else if (state == Call.State.INCOMING || state == Call.State.CALL_WAITING) { addDismissAction(builder); - if (call.isVideoCall()) { + if (call.isVideoCall(mContext)) { addVoiceAction(builder); addVideoCallAction(builder); } else { diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index dbbf0387d..f218de265 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -24,6 +24,7 @@ import android.telecomm.CameraCapabilities; import android.telecomm.InCallService.VideoCall; import android.view.Surface; +import com.android.contacts.common.CallUtil; import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallOrientationListener; import com.android.incallui.InCallPresenter.InCallStateListener; @@ -302,6 +303,11 @@ public class VideoCallPresenter extends Presenter