use of com.android.dialer.enrichedcall.EnrichedCallCapabilities in project android_packages_apps_Dialer by LineageOS.
the class PostCall method promptUserToSendMessage.
private static void promptUserToSendMessage(Activity activity, View rootView) {
LogUtil.i("PostCall.promptUserToSendMessage", "returned from call, showing post call SnackBar");
String message = activity.getString(R.string.post_call_message);
EnrichedCallManager manager = EnrichedCallComponent.get(activity).getEnrichedCallManager();
EnrichedCallCapabilities capabilities = manager.getCapabilities(getPhoneNumber(activity));
LogUtil.i("PostCall.promptUserToSendMessage", "number: %s, capabilities: %s", LogUtil.sanitizePhoneNumber(getPhoneNumber(activity)), capabilities);
boolean isRcsPostCall = capabilities != null && capabilities.supportsPostCall();
String actionText = isRcsPostCall ? activity.getString(R.string.post_call_add_message) : activity.getString(R.string.post_call_send_message);
String number = Assert.isNotNull(getPhoneNumber(activity));
OnClickListener onClickListener = v -> {
Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE_CLICKED);
activity.startActivity(PostCallActivity.newIntent(activity, number, isRcsPostCall));
};
int durationMs = (int) ConfigProviderBindings.get(activity).getLong("post_call_prompt_duration_ms", 8_000);
activeSnackbar = Snackbar.make(rootView, message, durationMs).setAction(actionText, onClickListener).setActionTextColor(activity.getResources().getColor(R.color.dialer_snackbar_action_text_color));
activeSnackbar.show();
Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE);
DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity).edit().remove(KEY_POST_CALL_CALL_DISCONNECT_TIME).apply();
}
use of com.android.dialer.enrichedcall.EnrichedCallCapabilities in project android_packages_apps_Dialer by LineageOS.
the class DialerCall method onCapabilitiesUpdated.
@Override
public void onCapabilitiesUpdated() {
if (getNumber() == null) {
return;
}
EnrichedCallCapabilities capabilities = EnrichedCallComponent.get(mContext).getEnrichedCallManager().getCapabilities(getNumber());
if (capabilities != null) {
setEnrichedCallCapabilities(capabilities);
update();
}
}
use of com.android.dialer.enrichedcall.EnrichedCallCapabilities in project android_packages_apps_Dialer by LineageOS.
the class PhoneNumberListAdapter method bindPhoneNumber.
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
public void bindPhoneNumber(ContactListItemView view, Cursor cursor, boolean displayNumber, int position) {
CharSequence label = null;
if (displayNumber && !cursor.isNull(PhoneQuery.PHONE_TYPE)) {
final int type = cursor.getInt(PhoneQuery.PHONE_TYPE);
final String customLabel = cursor.getString(PhoneQuery.PHONE_LABEL);
// TODO cache
label = Phone.getTypeLabel(mContext.getResources(), type, customLabel);
}
view.setLabel(label);
final String text;
String number = cursor.getString(PhoneQuery.PHONE_NUMBER);
if (displayNumber) {
text = number;
} else {
// Display phone label. If that's null, display geocoded location for the number
final String phoneLabel = cursor.getString(PhoneQuery.PHONE_LABEL);
if (phoneLabel != null) {
text = phoneLabel;
} else {
final String phoneNumber = cursor.getString(PhoneQuery.PHONE_NUMBER);
text = GeoUtil.getGeocodedLocationFor(mContext, phoneNumber);
}
}
view.setPhoneNumber(text);
@CallToAction int action = ContactListItemView.NONE;
if (CompatUtils.isVideoCompatible()) {
// Determine if carrier presence indicates the number supports video calling.
int carrierPresence = cursor.getInt(PhoneQuery.CARRIER_PRESENCE);
boolean isPresent = (carrierPresence & Phone.CARRIER_PRESENCE_VT_CAPABLE) != 0;
boolean showViewIcon = mIsImsVideoEnabled && isPresent;
if (showViewIcon) {
action = ContactListItemView.VIDEO;
}
}
if (action == ContactListItemView.NONE && LightbringerComponent.get(mContext).getLightbringer().isReachable(mContext, number)) {
action = ContactListItemView.LIGHTBRINGER;
}
if (action == ContactListItemView.NONE) {
EnrichedCallManager manager = EnrichedCallComponent.get(mContext).getEnrichedCallManager();
EnrichedCallCapabilities capabilities = manager.getCapabilities(number);
if (capabilities != null && capabilities.supportsCallComposer()) {
action = ContactListItemView.CALL_AND_SHARE;
} else if (capabilities == null && getQueryString() != null && getQueryString().length() >= 3) {
manager.requestCapabilities(number);
}
}
view.setCallToAction(action, mListener, position);
}
Aggregations