Search in sources :

Example 1 with VisualVoicemailPreferences

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

the class VisualVoicemailSettingsUtil method setArchiveEnabled.

public static void setArchiveEnabled(Context context, PhoneAccountHandle phoneAccount, boolean isEnabled) {
    Assert.checkArgument(VoicemailComponent.get(context).getVoicemailClient().isVoicemailArchiveAvailable(context));
    new VisualVoicemailPreferences(context, phoneAccount).edit().putBoolean(context.getString(R.string.voicemail_visual_voicemail_archive_key), isEnabled).apply();
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Example 2 with VisualVoicemailPreferences

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

the class VisualVoicemailSettingsUtil method setEnabled.

public static void setEnabled(Context context, PhoneAccountHandle phoneAccount, boolean isEnabled) {
    VvmLog.i("VisualVoicemailSettingsUtil.setEnable", phoneAccount + " enabled:" + isEnabled);
    new VisualVoicemailPreferences(context, phoneAccount).edit().putBoolean(IS_ENABLED_KEY, isEnabled).apply();
    OmtpVvmCarrierConfigHelper config = new OmtpVvmCarrierConfigHelper(context, phoneAccount);
    if (isEnabled) {
        config.startActivation();
    } else {
        VvmAccountManager.removeAccount(context, phoneAccount);
        config.startDeactivation();
    }
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences) OmtpVvmCarrierConfigHelper(com.android.voicemail.impl.OmtpVvmCarrierConfigHelper)

Example 3 with VisualVoicemailPreferences

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

the class VoicemailChangePinActivity method readPinLength.

/**
 * Extracts the pin length requirement sent by the server with a STATUS SMS.
 */
private void readPinLength() {
    VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(this, mPhoneAccountHandle);
    // The OMTP pin length format is {min}-{max}
    String[] lengths = preferences.getString(OmtpConstants.TUI_PASSWORD_LENGTH, "").split("-");
    if (lengths.length == 2) {
        try {
            mPinMinLength = Integer.parseInt(lengths[0]);
            mPinMaxLength = Integer.parseInt(lengths[1]);
        } catch (NumberFormatException e) {
            mPinMinLength = 0;
            mPinMaxLength = 0;
        }
    } else {
        mPinMinLength = 0;
        mPinMaxLength = 0;
    }
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Example 4 with VisualVoicemailPreferences

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

the class Vvm3Protocol method getMinimumPinLength.

private static int getMinimumPinLength(Context context, PhoneAccountHandle phoneAccountHandle) {
    VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(context, phoneAccountHandle);
    // The OMTP pin length format is {min}-{max}
    String[] lengths = preferences.getString(OmtpConstants.TUI_PASSWORD_LENGTH, "").split("-");
    if (lengths.length == 2) {
        try {
            return Integer.parseInt(lengths[0]);
        } catch (NumberFormatException e) {
            return DEFAULT_PIN_LENGTH;
        }
    }
    return DEFAULT_PIN_LENGTH;
}
Also used : VisualVoicemailPreferences(com.android.voicemail.impl.VisualVoicemailPreferences)

Example 5 with VisualVoicemailPreferences

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

the class VvmAccountManager method removeAccount.

public static void removeAccount(Context context, PhoneAccountHandle phoneAccount) {
    VoicemailStatus.disable(context, phoneAccount);
    setAccountActivated(context, phoneAccount, false);
    VisualVoicemailPreferences preferences = new VisualVoicemailPreferences(context, phoneAccount);
    preferences.edit().putString(OmtpConstants.IMAP_USER_NAME, null).putString(OmtpConstants.IMAP_PASSWORD, null).apply();
    ThreadUtil.postOnUiThread(() -> {
        for (Listener listener : listeners) {
            listener.onActivationStateChanged(phoneAccount, 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