Check carrier presence when displaying the "video call" button.
- Check the carrier presence data field when determining if the
video call button should be shown.
Bug: 20257833
Change-Id: Ic705c789bcd6d78a5a492166f4877b488534e8c2
diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java
index ee6173e..13228e4 100644
--- a/src/com/android/contacts/activities/ContactSelectionActivity.java
+++ b/src/com/android/contacts/activities/ContactSelectionActivity.java
@@ -483,7 +483,7 @@
private final class PhoneNumberPickerActionListener implements
OnPhoneNumberPickerActionListener {
@Override
- public void onPickDataUri(Uri dataUri, int callInitiationType) {
+ public void onPickDataUri(Uri dataUri, boolean isVideoCall, int callInitiationType) {
returnPickerResult(dataUri);
}
diff --git a/src/com/android/contacts/list/LegacyPhoneNumberPickerFragment.java b/src/com/android/contacts/list/LegacyPhoneNumberPickerFragment.java
index d62c730..5b6e11f 100644
--- a/src/com/android/contacts/list/LegacyPhoneNumberPickerFragment.java
+++ b/src/com/android/contacts/list/LegacyPhoneNumberPickerFragment.java
@@ -60,7 +60,7 @@
}
@Override
- protected void startPhoneNumberShortcutIntent(Uri uri) {
+ protected void startPhoneNumberShortcutIntent(Uri uri, boolean isVideoCall) {
throw new UnsupportedOperationException();
}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index a3d92d4..b6b60db 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1861,12 +1861,16 @@
smsContentDescription = com.android.contacts.common.util.ContactDisplayUtils
.getTelephoneTtsSpannable(alternateContentDescription.toString(), header);
+ int videoCapability = CallUtil.getVideoCallingAvailability(context);
+ boolean isPresenceEnabled =
+ (videoCapability & CallUtil.VIDEO_CALLING_PRESENCE) != 0;
+ boolean isVideoEnabled = (videoCapability & CallUtil.VIDEO_CALLING_ENABLED) != 0;
+
if (CallUtil.isCallWithSubjectSupported(context)) {
thirdIcon = res.getDrawable(R.drawable.ic_call_note_white_24dp);
thirdAction = Entry.ACTION_CALL_WITH_SUBJECT;
thirdContentDescription =
res.getString(R.string.call_with_a_note);
-
// Create a bundle containing the data the call subject dialog requires.
thirdExtras = new Bundle();
thirdExtras.putLong(CallSubjectDialog.ARG_PHOTO_ID,
@@ -1884,14 +1888,19 @@
phone.getFormattedPhoneNumber());
thirdExtras.putString(CallSubjectDialog.ARG_NUMBER_LABEL,
phoneLabel);
- } else if (CallUtil.isVideoEnabled(context)) {
- // Add video call button if supported
- thirdIcon = res.getDrawable(R.drawable.ic_videocam);
- thirdAction = Entry.ACTION_INTENT;
- thirdIntent = CallUtil.getVideoCallIntent(phone.getNumber(),
- CALL_ORIGIN_QUICK_CONTACTS_ACTIVITY);
- thirdContentDescription =
- res.getString(R.string.description_video_call);
+ } else if (isVideoEnabled) {
+ // Check to ensure carrier presence indicates the number supports video calling.
+ int carrierPresence = dataItem.getCarrierPresence();
+ boolean isPresent = (carrierPresence & Phone.CARRIER_PRESENCE_VT_CAPABLE) != 0;
+
+ if ((isPresenceEnabled && isPresent) || !isPresenceEnabled) {
+ thirdIcon = res.getDrawable(R.drawable.ic_videocam);
+ thirdAction = Entry.ACTION_INTENT;
+ thirdIntent = CallUtil.getVideoCallIntent(phone.getNumber(),
+ CALL_ORIGIN_QUICK_CONTACTS_ACTIVITY);
+ thirdContentDescription =
+ res.getString(R.string.description_video_call);
+ }
}
}
} else if (dataItem instanceof EmailDataItem) {