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

Commit f9aea95a authored by Tony Mak's avatar Tony Mak
Browse files

Showing badge icon in incall ui if it is a work call

Work call means the call is placed through work phone account
or it is an outgoing call initiated from work dialer.
Please notice that both personal and work call is handled by personal
in-call UI, that's why we need to add a badge to indicate it.

There is another scenario we need to add badge, ie. having a work
contact caller, and it will be handled in ag/836110.


BUG=26022174

Change-Id: I96e72068f70674dbeabfbbf7bfffc6c15c3203bf
parent 6a8cd038
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -559,10 +559,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
     * @param isSipCall {@code true} if this is a SIP call.
     * @param isContactPhotoShown {@code true} if the contact photo should be shown (it will be
     *      updated even if it is not shown).
     * @param isWorkCall Whether the call is placed through a work phone account or caller is a work
              contact.
     */
    @Override
    public void setPrimary(String number, String name, boolean nameIsNumber, String label,
            Drawable photo, boolean isSipCall, boolean isContactPhotoShown, boolean isWorkContact) {
            Drawable photo, boolean isSipCall, boolean isContactPhotoShown, boolean isWorkCall) {
        Log.d(this, "Setting primary call");
        // set the name field.
        setPrimaryName(name, nameIsNumber);
@@ -584,7 +586,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr

        setDrawableToImageViews(photo);
        showImageView(mPhotoLarge, isContactPhotoShown);
        showImageView(mWorkProfileIcon, isWorkContact);
        showImageView(mWorkProfileIcon, isWorkCall);
    }

    @Override
+8 −4
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.incalluibind.ObjectFactory;

import java.lang.ref.WeakReference;

import static com.android.contacts.common.compat.CallSdkCompat.Details.PROPERTY_WORK_CALL;
/**
 * Presenter for the Call Card Fragment.
 * <p>
@@ -722,6 +723,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
        boolean showContactPhoto = !VideoCallPresenter
                .showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState());

        // Call placed through a work phone account.
        boolean hasWorkCallProperty = mPrimary.hasProperty(PROPERTY_WORK_CALL);

        if (mPrimary.isConferenceCall()) {
            Log.d(TAG, "Update primary display info for conference call.");

@@ -733,7 +737,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
                    getConferencePhoto(mPrimary),
                    false /* isSipCall */,
                    showContactPhoto,
                    false /* isWorkContact */);
                    hasWorkCallProperty);
        } else if (mPrimaryContactInfo != null) {
            Log.d(TAG, "Update primary display info for " + mPrimaryContactInfo);

@@ -765,6 +769,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
            maybeShowHdAudioIcon();

            boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number);
            // Call with caller that is a work contact.
            boolean isWorkContact = (mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
            ui.setPrimary(
                    number,
@@ -774,7 +779,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
                    mPrimaryContactInfo.photo,
                    mPrimaryContactInfo.isSipCall,
                    showContactPhoto,
                    isWorkContact);
                    hasWorkCallProperty || isWorkContact);

            updateContactInteractions();
        } else {
@@ -1095,8 +1100,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
        void showContactContext(boolean show);
        void setCallCardVisible(boolean visible);
        void setPrimary(String number, String name, boolean nameIsNumber, String label,
                Drawable photo, boolean isSipCall, boolean isContactPhotoShown,
                boolean isWorkContact);
                Drawable photo, boolean isSipCall, boolean isContactPhotoShown, boolean isWorkCall);
        void setSecondary(boolean show, String name, boolean nameIsNumber, String label,
                String providerLabel, boolean isConference, boolean isVideoCall,
                boolean isFullscreen);