Search in sources :

Example 6 with OmtpVvmCarrierConfigHelper

use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.

the class StatusSmsFetcher method onReceive.

@Override
@MainThread
public void onReceive(Context context, Intent intent) {
    Assert.isMainThread();
    if (ACTION_REQUEST_SENT_INTENT.equals(intent.getAction())) {
        int resultCode = getResultCode();
        if (resultCode == Activity.RESULT_OK) {
            VvmLog.d(TAG, "Request SMS successfully sent");
            return;
        }
        VvmLog.e(TAG, "Request SMS send failed: " + sentSmsResultToString(resultCode));
        mFuture.cancel(true);
        return;
    }
    VisualVoicemailSms sms = intent.getExtras().getParcelable(OmtpService.EXTRA_VOICEMAIL_SMS);
    if (!mPhoneAccountHandle.equals(sms.getPhoneAccountHandle())) {
        return;
    }
    String eventType = sms.getPrefix();
    if (eventType.equals(OmtpConstants.STATUS_SMS_PREFIX)) {
        mFuture.complete(sms.getFields());
        return;
    }
    if (eventType.equals(OmtpConstants.SYNC_SMS_PREFIX)) {
        return;
    }
    VvmLog.i(TAG, "VVM SMS with event " + eventType + " received, attempting to translate to STATUS SMS");
    OmtpVvmCarrierConfigHelper helper = new OmtpVvmCarrierConfigHelper(context, mPhoneAccountHandle);
    VisualVoicemailProtocol protocol = helper.getProtocol();
    if (protocol == null) {
        return;
    }
    Bundle translatedBundle = protocol.translateStatusSmsBundle(helper, eventType, sms.getFields());
    if (translatedBundle != null) {
        VvmLog.i(TAG, "Translated to STATUS SMS");
        mFuture.complete(translatedBundle);
    }
}
Also used : OmtpVvmCarrierConfigHelper(com.android.voicemail.impl.OmtpVvmCarrierConfigHelper) Bundle(android.os.Bundle) VisualVoicemailSms(android.telephony.VisualVoicemailSms) VisualVoicemailProtocol(com.android.voicemail.impl.protocol.VisualVoicemailProtocol) MainThread(android.support.annotation.MainThread)

Example 7 with OmtpVvmCarrierConfigHelper

use of com.android.voicemail.impl.OmtpVvmCarrierConfigHelper in project android_packages_apps_Dialer by LineageOS.

the class VoicemailSettingsFragment method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    phoneAccountHandle = Assert.isNotNull(getArguments().getParcelable(VoicemailClient.PARAM_PHONE_ACCOUNT_HANDLE));
    omtpVvmCarrierConfigHelper = new OmtpVvmCarrierConfigHelper(getContext(), phoneAccountHandle);
}
Also used : OmtpVvmCarrierConfigHelper(com.android.voicemail.impl.OmtpVvmCarrierConfigHelper)

Aggregations

OmtpVvmCarrierConfigHelper (com.android.voicemail.impl.OmtpVvmCarrierConfigHelper)7 Bundle (android.os.Bundle)2 PhoneAccountHandle (android.telecom.PhoneAccountHandle)2 VisualVoicemailSms (android.telephony.VisualVoicemailSms)2 VisualVoicemailProtocol (com.android.voicemail.impl.protocol.VisualVoicemailProtocol)2 MainThread (android.support.annotation.MainThread)1 TelecomManager (android.telecom.TelecomManager)1 LengthFilter (android.text.InputFilter.LengthFilter)1 View (android.view.View)1 TextView (android.widget.TextView)1 VisualVoicemailPreferences (com.android.voicemail.impl.VisualVoicemailPreferences)1 NetworkWrapper (com.android.voicemail.impl.sync.VvmNetworkRequest.NetworkWrapper)1 RequestFailedException (com.android.voicemail.impl.sync.VvmNetworkRequest.RequestFailedException)1