Search in sources :

Example 1 with EnrichedCallCapabilities

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();
}
Also used : Assert(com.android.dialer.common.Assert) Context(android.content.Context) LogUtil(com.android.dialer.common.LogUtil) DialerImpression(com.android.dialer.logging.DialerImpression) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) Intent(android.content.Intent) ConfigProvider(com.android.dialer.configprovider.ConfigProvider) EnrichedCallComponent(com.android.dialer.enrichedcall.EnrichedCallComponent) PerformanceReport(com.android.dialer.performancereport.PerformanceReport) SharedPreferences(android.content.SharedPreferences) TelephonyManager(android.telephony.TelephonyManager) View(android.view.View) ConfigProviderBindings(com.android.dialer.configprovider.ConfigProviderBindings) Logger(com.android.dialer.logging.Logger) IntentUtil(com.android.dialer.util.IntentUtil) DialerUtils(com.android.dialer.util.DialerUtils) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) Activity(android.app.Activity) EnrichedCallCapabilities(com.android.dialer.enrichedcall.EnrichedCallCapabilities) BaseCallback(android.support.design.widget.BaseTransientBottomBar.BaseCallback) OnClickListener(android.view.View.OnClickListener) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) OnClickListener(android.view.View.OnClickListener) EnrichedCallCapabilities(com.android.dialer.enrichedcall.EnrichedCallCapabilities)

Example 2 with EnrichedCallCapabilities

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();
    }
}
Also used : EnrichedCallCapabilities(com.android.dialer.enrichedcall.EnrichedCallCapabilities)

Example 3 with EnrichedCallCapabilities

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);
}
Also used : CallToAction(com.android.contacts.common.list.ContactListItemView.CallToAction) EnrichedCallManager(com.android.dialer.enrichedcall.EnrichedCallManager) EnrichedCallCapabilities(com.android.dialer.enrichedcall.EnrichedCallCapabilities) VisibleForTesting(android.support.annotation.VisibleForTesting)

Aggregations

EnrichedCallCapabilities (com.android.dialer.enrichedcall.EnrichedCallCapabilities)3 EnrichedCallManager (com.android.dialer.enrichedcall.EnrichedCallManager)2 Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Nullable (android.support.annotation.Nullable)1 VisibleForTesting (android.support.annotation.VisibleForTesting)1 BaseCallback (android.support.design.widget.BaseTransientBottomBar.BaseCallback)1 Snackbar (android.support.design.widget.Snackbar)1 TelephonyManager (android.telephony.TelephonyManager)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 CallToAction (com.android.contacts.common.list.ContactListItemView.CallToAction)1 Assert (com.android.dialer.common.Assert)1 LogUtil (com.android.dialer.common.LogUtil)1 ConfigProvider (com.android.dialer.configprovider.ConfigProvider)1 ConfigProviderBindings (com.android.dialer.configprovider.ConfigProviderBindings)1 EnrichedCallComponent (com.android.dialer.enrichedcall.EnrichedCallComponent)1 DialerImpression (com.android.dialer.logging.DialerImpression)1