use of com.android.incallui.incall.protocol.PrimaryInfo in project android_packages_apps_Dialer by LineageOS.
the class TopRow method getInfo.
public static Info getInfo(Context context, PrimaryCallState state, PrimaryInfo primaryInfo) {
CharSequence label = null;
Drawable icon = state.connectionIcon;
boolean labelIsSingleLine = true;
if (state.isWifi && icon == null) {
icon = context.getDrawable(R.drawable.quantum_ic_network_wifi_vd_theme_24);
}
if (state.state == State.INCOMING || state.state == State.CALL_WAITING) {
// Hey Jake, pick up!
if (!TextUtils.isEmpty(state.callSubject)) {
label = state.callSubject;
labelIsSingleLine = false;
} else {
label = getLabelForIncoming(context, state);
// row).
if (shouldShowNumber(primaryInfo)) {
label = TextUtils.concat(label, " ", spanDisplayNumber(primaryInfo.number));
}
}
} else if (VideoUtils.hasSentVideoUpgradeRequest(state.sessionModificationState) || VideoUtils.hasReceivedVideoUpgradeRequest(state.sessionModificationState)) {
label = getLabelForVideoRequest(context, state);
} else if (state.state == State.PULLING) {
label = context.getString(R.string.incall_transferring);
} else if (state.state == State.DIALING || state.state == State.CONNECTING) {
// [Wi-Fi icon] Calling via Google Guest
// Calling...
label = getLabelForDialing(context, state);
} else if (state.state == State.ACTIVE && state.isRemotelyHeld) {
label = context.getString(R.string.incall_remotely_held);
} else if (state.state == State.ACTIVE && shouldShowNumber(primaryInfo)) {
label = spanDisplayNumber(primaryInfo.number);
} else {
// Video calling...
// [Wi-Fi icon] Starbucks Wi-Fi
label = getConnectionLabel(state);
}
return new Info(label, icon, labelIsSingleLine);
}
use of com.android.incallui.incall.protocol.PrimaryInfo in project android_packages_apps_Dialer by LineageOS.
the class CallCardPresenter method updatePrimaryDisplayInfo.
private void updatePrimaryDisplayInfo() {
if (mInCallScreen == null) {
// TODO: May also occur if search result comes back after ui is destroyed. Look into
// removing that case completely.
LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "updatePrimaryDisplayInfo called but ui is null!");
return;
}
if (mPrimary == null) {
// Clear the primary display info.
mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
return;
}
// Hide the contact photo if we are in a video call and the incoming video surface is
// showing.
boolean showContactPhoto = !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState());
// DialerCall placed through a work phone account.
boolean hasWorkCallProperty = mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL);
MultimediaData multimediaData = null;
if (mPrimary.getEnrichedCallSession() != null) {
multimediaData = mPrimary.getEnrichedCallSession().getMultimediaData();
}
if (mPrimary.isConferenceCall()) {
LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for conference call.");
mInCallScreen.setPrimary(new PrimaryInfo(null, /* number */
CallerInfoUtils.getConferenceString(mContext, mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), false, /* nameIsNumber */
null, /* location */
null, /* label */
null, /* photo */
ContactPhotoType.DEFAULT_PLACEHOLDER, false, /* isSipCall */
showContactPhoto, hasWorkCallProperty, false, /* isSpam */
false, /* answeringDisconnectsOngoingCall */
shouldShowLocation(), null, /* contactInfoLookupKey */
null, /* enrichedCallMultimediaData */
mPrimary.getNumberPresentation()));
} else if (mPrimaryContactInfo != null) {
LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for " + mPrimaryContactInfo);
String name = getNameForCall(mPrimaryContactInfo);
String number;
boolean isChildNumberShown = !TextUtils.isEmpty(mPrimary.getChildNumber());
boolean isForwardedNumberShown = !TextUtils.isEmpty(mPrimary.getLastForwardedNumber());
boolean isCallSubjectShown = shouldShowCallSubject(mPrimary);
if (isCallSubjectShown) {
number = null;
} else if (isChildNumberShown) {
number = mContext.getString(R.string.child_number, mPrimary.getChildNumber());
} else if (isForwardedNumberShown) {
// Use last forwarded number instead of second line, if present.
number = mPrimary.getLastForwardedNumber();
} else {
number = mPrimaryContactInfo.number;
}
boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number);
// DialerCall with caller that is a work contact.
boolean isWorkContact = (mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
mInCallScreen.setPrimary(new PrimaryInfo(number, mPrimary.updateNameIfRestricted(name), nameIsNumber, shouldShowLocationAsLabel(nameIsNumber, mPrimaryContactInfo.shouldShowLocation) ? mPrimaryContactInfo.location : null, isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label, mPrimaryContactInfo.photo, mPrimaryContactInfo.photoType, mPrimaryContactInfo.isSipCall, showContactPhoto, hasWorkCallProperty || isWorkContact, mPrimary.isSpam(), mPrimary.answeringDisconnectsForegroundVideoCall(), shouldShowLocation(), mPrimaryContactInfo.lookupKey, multimediaData, mPrimary.getNumberPresentation()));
} else {
// Clear the primary display info.
mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
}
if (isInCallScreenReady) {
mInCallScreen.showLocationUi(getLocationFragment());
} else {
LogUtil.i("CallCardPresenter.updatePrimaryDisplayInfo", "UI not ready, not showing location");
}
}
Aggregations