diff options
author | Tony Mak <tonymak@google.com> | 2016-01-13 23:03:26 +0000 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2016-01-13 23:03:26 +0000 |
commit | f9aea95a921900b552bc808513f7c42c15e16f6c (patch) | |
tree | e2fb0147cbf0e61cc494113f101c4c9139598369 /InCallUI | |
parent | 6a8cd0381df990473c8362e6478f4f89e0c9c9d7 (diff) |
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
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 6 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 93d499e38..efd4818a4 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -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 diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index a52a36d01..fed229d76 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -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); |