Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a8f9736 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

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
parent 82b29371
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -483,7 +483,7 @@ public class ContactSelectionActivity extends ContactsActivity
    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);
        }

+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class LegacyPhoneNumberPickerFragment extends PhoneNumberPickerFragment {
    }

    @Override
    protected void startPhoneNumberShortcutIntent(Uri uri) {
    protected void startPhoneNumberShortcutIntent(Uri uri, boolean isVideoCall) {
        throw new UnsupportedOperationException();
    }

+18 −9
Original line number Diff line number Diff line
@@ -1861,12 +1861,16 @@ public class QuickContactActivity extends ContactsActivity
                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,8 +1888,12 @@ public class QuickContactActivity extends ContactsActivity
                            phone.getFormattedPhoneNumber());
                    thirdExtras.putString(CallSubjectDialog.ARG_NUMBER_LABEL,
                            phoneLabel);
                } else if (CallUtil.isVideoEnabled(context)) {
                    // Add video call button if supported
                } 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(),
@@ -1894,6 +1902,7 @@ public class QuickContactActivity extends ContactsActivity
                                res.getString(R.string.description_video_call);
                    }
                }
            }
        } else if (dataItem instanceof EmailDataItem) {
            final EmailDataItem email = (EmailDataItem) dataItem;
            final String address = email.getData();