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();
}
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();
}
}
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;
}
}
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;
}
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);
}
});
}
Aggregations