use of com.android.voicemail.impl.imap.ImapHelper.InitializingException in project android_packages_apps_Dialer by LineageOS.
the class Vvm3Protocol method startProvisionNewUser.
private void startProvisionNewUser(ActivationTask task, PhoneAccountHandle phoneAccountHandle, OmtpVvmCarrierConfigHelper config, VoicemailStatus.Editor status, StatusMessage message) {
try (NetworkWrapper wrapper = VvmNetworkRequest.getNetwork(config, phoneAccountHandle, status)) {
Network network = wrapper.get();
VvmLog.i(TAG, "new user: network available");
try (ImapHelper helper = new ImapHelper(config.getContext(), phoneAccountHandle, network, status)) {
// TODO(b/29082671): use LocaleList
if (Locale.getDefault().getLanguage().equals(new Locale(ISO639_Spanish).getLanguage())) {
// Spanish
helper.changeVoicemailTuiLanguage(VVM3_VM_LANGUAGE_SPANISH_STANDARD_NO_GUEST_PROMPTS);
} else {
// English
helper.changeVoicemailTuiLanguage(VVM3_VM_LANGUAGE_ENGLISH_STANDARD_NO_GUEST_PROMPTS);
}
VvmLog.i(TAG, "new user: language set");
if (setPin(config.getContext(), phoneAccountHandle, helper, message)) {
// Only close new user tutorial if the PIN has been changed.
helper.closeNewUserTutorial();
VvmLog.i(TAG, "new user: NUT closed");
LoggerUtils.logImpressionOnMainThread(config.getContext(), DialerImpression.Type.VVM_PROVISIONING_COMPLETED);
config.requestStatus(null);
}
} catch (InitializingException | MessagingException | IOException e) {
config.handleEvent(status, OmtpEvents.VVM3_NEW_USER_SETUP_FAILED);
task.fail();
VvmLog.e(TAG, e.toString());
}
} catch (RequestFailedException e) {
config.handleEvent(status, OmtpEvents.DATA_NO_CONNECTION_CELLULAR_REQUIRED);
task.fail();
}
}
use of com.android.voicemail.impl.imap.ImapHelper.InitializingException in project android_packages_apps_Dialer by LineageOS.
the class OmtpVvmSyncService method doSync.
private void doSync(BaseTask task, Network network, PhoneAccountHandle phoneAccount, Voicemail voicemail, String action, VoicemailStatus.Editor status) {
try (ImapHelper imapHelper = new ImapHelper(mContext, phoneAccount, network, status)) {
boolean success;
if (voicemail == null) {
success = syncAll(action, imapHelper, phoneAccount);
} else {
success = syncOne(imapHelper, voicemail, phoneAccount);
}
if (success) {
// TODO: b/30569269 failure should interrupt all subsequent task via exceptions
imapHelper.updateQuota();
autoDeleteAndArchiveVM(imapHelper, phoneAccount);
imapHelper.handleEvent(OmtpEvents.DATA_IMAP_OPERATION_COMPLETED);
LoggerUtils.logImpressionOnMainThread(mContext, DialerImpression.Type.VVM_SYNC_COMPLETED);
} else {
task.fail();
}
} catch (InitializingException e) {
VvmLog.w(TAG, "Can't retrieve Imap credentials.", e);
return;
}
}
use of com.android.voicemail.impl.imap.ImapHelper.InitializingException in project android_packages_apps_Dialer by LineageOS.
the class FetchVoicemailReceiver method fetchVoicemail.
private void fetchVoicemail(final Network network, final VoicemailStatus.Editor status) {
Executor executor = Executors.newCachedThreadPool();
executor.execute(new Runnable() {
@Override
public void run() {
try {
while (mRetryCount > 0) {
VvmLog.i(TAG, "fetching voicemail, retry count=" + mRetryCount);
try (ImapHelper imapHelper = new ImapHelper(mContext, mPhoneAccount, network, status)) {
boolean success = imapHelper.fetchVoicemailPayload(new VoicemailFetchedCallback(mContext, mUri, mPhoneAccount), mUid);
if (!success && mRetryCount > 0) {
VvmLog.i(TAG, "fetch voicemail failed, retrying");
mRetryCount--;
} else {
return;
}
} catch (InitializingException e) {
VvmLog.w(TAG, "Can't retrieve Imap credentials ", e);
return;
}
}
} finally {
if (mNetworkCallback != null) {
mNetworkCallback.releaseNetwork();
}
}
}
});
}
Aggregations