summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-08-22 14:05:57 -0700
committerTyler Gunn <tgunn@google.com>2014-08-22 21:08:10 +0000
commitcda81c2ef1ba595c35ae1d4ad72c44f3443e08fd (patch)
treec107fd9c9f1ed60b26dc8912c241196617d592a3
parent9593853ba1d72249b2405bfca1fa410dcde3f290 (diff)
Ensuring Video APIs are only called when video is available.
Bug: 17179079 Change-Id: I3b327250c181f821ec37d574ae804f8003d04603
-rw-r--r--InCallUI/src/com/android/incallui/AnswerFragment.java5
-rw-r--r--InCallUI/src/com/android/incallui/AnswerPresenter.java3
-rw-r--r--InCallUI/src/com/android/incallui/Call.java8
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java5
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java3
-rw-r--r--InCallUI/src/com/android/incallui/StatusBarNotifier.java2
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java10
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
@@ -332,6 +332,11 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
}
@Override
+ public Context getContext() {
+ return getActivity();
+ }
+
+ @Override
public void onAnswer(int videoState, Context context) {
getPresenter().onAnswer(videoState, context);
}
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index 5b4e39abd..4022bb49d 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -99,7 +99,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
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<AnswerPresenter.AnswerUi>
public void showTargets(int targetSet);
public void showMessageDialog();
public void configureMessageDialog(List<String> 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
@@ -671,6 +671,11 @@ public class CallButtonFragment
}
@Override
+ public Context getContext() {
+ return getActivity();
+ }
+
+ @Override
public void showManageConferenceCallButton() {
mExtraRowButton.setVisibility(View.VISIBLE);
mManageConferenceButton.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<CallButtonPresenter.CallButto
return;
}
- if (call.isVideoCall()) {
+ if (call.isVideoCall(ui.getContext())) {
updateVideoCallButtons();
} else {
updateVoiceCallButtons(call);
@@ -469,5 +470,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
void showGenericMergeButton();
void hideExtraRow();
void displayManageConferencePanel(boolean on);
+ Context getContext();
}
}
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 2dc4274c4..5f98aa9df 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -245,7 +245,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
// 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<VideoCallPresenter.VideoCallUi
@Override
public void onStateChange(InCallPresenter.InCallState oldState,
InCallPresenter.InCallState newState, CallList callList) {
+ // Bail if video calling is disabled for the device.
+ if (!CallUtil.isVideoEnabled(mContext)) {
+ return;
+ }
+
if (newState == InCallPresenter.InCallState.NO_CALLS) {
exitVideoMode();
}
@@ -322,7 +328,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (primary != null) {
checkForVideoCallChange();
- mIsVideoCall = mPrimaryCall.isVideoCall();
+ mIsVideoCall = mPrimaryCall.isVideoCall(mContext);
if (mIsVideoCall) {
enterVideoMode();
} else {
@@ -366,7 +372,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* Checks to see if the current video state has changed and updates the UI if required.
*/
private void checkForVideoStateChange() {
- boolean newVideoState = mPrimaryCall.isVideoCall();
+ boolean newVideoState = mPrimaryCall.isVideoCall(mContext);
// Check if video state changed
if (mIsVideoCall != newVideoState) {