Search in sources :

Example 6 with VisualVoicemailPreferences

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

the class VvmAccountManager method addAccount.

public static void addAccount(Context context, PhoneAccountHandle phoneAccountHandle, StatusMessage statusMessage) {
    VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(context, phoneAccountHandle);
    statusMessage.putStatus(preferences.edit()).apply();
    setAccountActivated(context, phoneAccountHandle, true);
    ThreadUtil.postOnUiThread(() -> {
        for (Listener listener : listeners) {
            listener.onActivationStateChanged(phoneAccountHandle, true);
        }
    });
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Example 7 with VisualVoicemailPreferences

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

the class VvmAccountManager method migrateActivationState.

/**
 * The activation state is moved from credential protected storage to device protected storage
 * after v10, so it can be checked under FBE. The state should be migrated to avoid reactivation.
 */
private static void migrateActivationState(Context context, PerAccountSharedPreferences deviceProtectedPreference, PhoneAccountHandle phoneAccountHandle) {
    if (!context.getSystemService(UserManager.class).isUserUnlocked()) {
        return;
    }
    if (deviceProtectedPreference.contains(IS_ACCOUNT_ACTIVATED)) {
        return;
    }
    PerAccountSharedPreferences credentialProtectedPreference = new VisualVoicemailPreferences(context, phoneAccountHandle);
    deviceProtectedPreference.edit().putBoolean(IS_ACCOUNT_ACTIVATED, credentialProtectedPreference.getBoolean(IS_ACCOUNT_ACTIVATED, false)).apply();
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences) PerAccountSharedPreferences(com.android.dialer.common.PerAccountSharedPreferences)

Example 8 with VisualVoicemailPreferences

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

the class Vvm3Protocol method startProvisioning.

@Override
public void startProvisioning(ActivationTask task, PhoneAccountHandle phoneAccountHandle, OmtpVvmCarrierConfigHelper config, VoicemailStatus.Editor status, StatusMessage message, Bundle data) {
    VvmLog.i(TAG, "start vvm3 provisioning");
    LoggerUtils.logImpressionOnMainThread(config.getContext(), DialerImpression.Type.VVM_PROVISIONING_STARTED);
    if (OmtpConstants.SUBSCRIBER_UNKNOWN.equals(message.getProvisioningStatus())) {
        VvmLog.i(TAG, "Provisioning status: Unknown");
        if (VVM3_UNKNOWN_SUBSCRIBER_CAN_SUBSCRIBE_RESPONSE_CODE.equals(message.getReturnCode())) {
            VvmLog.i(TAG, "Self provisioning available, subscribing");
            new Vvm3Subscriber(task, phoneAccountHandle, config, status, data).subscribe();
        } else {
            config.handleEvent(status, OmtpEvents.VVM3_SUBSCRIBER_UNKNOWN);
        }
    } else if (OmtpConstants.SUBSCRIBER_NEW.equals(message.getProvisioningStatus())) {
        VvmLog.i(TAG, "setting up new user");
        // Save the IMAP credentials in preferences so they are persistent and can be retrieved.
        VisualVoicemailPreferences prefs = new VisualVoicemailPreferences(config.getContext(), phoneAccountHandle);
        message.putStatus(prefs.edit()).apply();
        startProvisionNewUser(task, phoneAccountHandle, config, status, message);
    } else if (OmtpConstants.SUBSCRIBER_PROVISIONED.equals(message.getProvisioningStatus())) {
        VvmLog.i(TAG, "User provisioned but not activated, disabling VVM");
        VisualVoicemailSettingsUtil.setEnabled(config.getContext(), phoneAccountHandle, false);
    } else if (OmtpConstants.SUBSCRIBER_BLOCKED.equals(message.getProvisioningStatus())) {
        VvmLog.i(TAG, "User blocked");
        config.handleEvent(status, OmtpEvents.VVM3_SUBSCRIBER_BLOCKED);
    }
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Example 9 with VisualVoicemailPreferences

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

the class VisualVoicemailSettingsUtil method isArchiveEnabled.

public static boolean isArchiveEnabled(Context context, PhoneAccountHandle phoneAccount) {
    Assert.isNotNull(phoneAccount);
    VisualVoicemailPreferences prefs = new VisualVoicemailPreferences(context, phoneAccount);
    return prefs.getBoolean(context.getString(R.string.voicemail_visual_voicemail_archive_key), false);
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Aggregations

VisualVoicemailPreferences (com.android.voicemail.impl.VisualVoicemailPreferences)9 PerAccountSharedPreferences (com.android.dialer.common.PerAccountSharedPreferences)1 OmtpVvmCarrierConfigHelper (com.android.voicemail.impl.OmtpVvmCarrierConfigHelper)1