summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl/protocol
diff options
context:
space:
mode:
authorZachary Heidepriem <zachh@google.com>2017-11-06 19:10:44 -0800
committerZachary Heidepriem <zachh@google.com>2017-11-06 19:10:44 -0800
commit7547d3e963dab2b1ef467ad27c3f0d25e150b50c (patch)
tree642c7b180b33d1371c1f474be03fbb8de2110f6d /java/com/android/voicemail/impl/protocol
parentb519cd522d472b5d7980cc015aa37c101be99386 (diff)
Move voicemail settings to dialer UI
The voicemail module should not contain any UI code. Bug: 37258159 Test: DialerSettingsActivityTest,VoicemailSettingsFragmentTest. A future CL is refactoring VoicemailChangePinActivity into a fragment. PiperOrigin-RevId: 174125949 Change-Id: I89cf6a083b0a0952332440d76e7ae0cb1c801931
Diffstat (limited to 'java/com/android/voicemail/impl/protocol')
-rw-r--r--java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java8
-rw-r--r--java/com/android/voicemail/impl/protocol/Vvm3Protocol.java18
2 files changed, 18 insertions, 8 deletions
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java b/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
index 24f530f6e..74ba8dde0 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3EventHandler.java
@@ -20,13 +20,13 @@ import android.content.Context;
import android.provider.VoicemailContract.Status;
import android.support.annotation.IntDef;
import android.telecom.PhoneAccountHandle;
+import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.impl.DefaultOmtpEventHandler;
import com.android.voicemail.impl.OmtpEvents;
import com.android.voicemail.impl.OmtpEvents.Type;
import com.android.voicemail.impl.OmtpVvmCarrierConfigHelper;
import com.android.voicemail.impl.VoicemailStatus;
import com.android.voicemail.impl.VvmLog;
-import com.android.voicemail.impl.settings.VoicemailChangePinActivity;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -302,6 +302,10 @@ public class Vvm3EventHandler {
VvmLog.e(TAG, "status editor has null phone account handle");
return false;
}
- return VoicemailChangePinActivity.isDefaultOldPinSet(context, phoneAccountHandle);
+ return VoicemailComponent.get(context)
+ .getVoicemailClient()
+ .createPinChanger(context, phoneAccountHandle)
+ .getScrambledPin()
+ != null;
}
}
diff --git a/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java b/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
index 5454bac54..782386db1 100644
--- a/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
+++ b/java/com/android/voicemail/impl/protocol/Vvm3Protocol.java
@@ -26,6 +26,8 @@ import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import com.android.dialer.logging.DialerImpression;
+import com.android.voicemail.PinChanger;
+import com.android.voicemail.VoicemailComponent;
import com.android.voicemail.impl.ActivationTask;
import com.android.voicemail.impl.OmtpConstants;
import com.android.voicemail.impl.OmtpEvents;
@@ -37,7 +39,6 @@ import com.android.voicemail.impl.imap.ImapHelper;
import com.android.voicemail.impl.imap.ImapHelper.InitializingException;
import com.android.voicemail.impl.mail.MessagingException;
import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil;
-import com.android.voicemail.impl.settings.VoicemailChangePinActivity;
import com.android.voicemail.impl.sms.OmtpMessageSender;
import com.android.voicemail.impl.sms.StatusMessage;
import com.android.voicemail.impl.sms.Vvm3MessageSender;
@@ -68,7 +69,7 @@ public class Vvm3Protocol extends VisualVoicemailProtocol {
private static final String IMAP_CHANGE_VM_LANG_FORMAT = "CHANGE_VM_LANG Lang=%1$s";
private static final String IMAP_CLOSE_NUT = "CLOSE_NUT";
- private static final String ISO639_Spanish = "es";
+ private static final String ISO639_SPANISH = "es";
/**
* For VVM3, if the STATUS SMS returns {@link StatusMessage#getProvisioningStatus()} of {@link
@@ -217,7 +218,7 @@ public class Vvm3Protocol extends VisualVoicemailProtocol {
// VVM3 has inconsistent error language code to OMTP. Just issue a raw command
// here.
// TODO(a bug): use LocaleList
- if (Locale.getDefault().getLanguage().equals(new Locale(ISO639_Spanish).getLanguage())) {
+ if (Locale.getDefault().getLanguage().equals(new Locale(ISO639_SPANISH).getLanguage())) {
// Spanish
helper.changeVoicemailTuiLanguage(VVM3_VM_LANGUAGE_SPANISH_STANDARD_NO_GUEST_PROMPTS);
} else {
@@ -257,14 +258,19 @@ public class Vvm3Protocol extends VisualVoicemailProtocol {
return false;
}
- if (VoicemailChangePinActivity.isDefaultOldPinSet(context, phoneAccountHandle)) {
+ PinChanger pinChanger =
+ VoicemailComponent.get(context)
+ .getVoicemailClient()
+ .createPinChanger(context, phoneAccountHandle);
+
+ if (pinChanger.getScrambledPin() != null) {
// The pin was already set
VvmLog.i(TAG, "PIN already set");
return true;
}
String newPin = generatePin(getMinimumPinLength(context, phoneAccountHandle));
- if (helper.changePin(defaultPin, newPin) == OmtpConstants.CHANGE_PIN_SUCCESS) {
- VoicemailChangePinActivity.setDefaultOldPIN(context, phoneAccountHandle, newPin);
+ if (helper.changePin(defaultPin, newPin) == PinChanger.CHANGE_PIN_SUCCESS) {
+ pinChanger.setScrambledPin(newPin);
helper.handleEvent(OmtpEvents.CONFIG_DEFAULT_PIN_REPLACED);
}
VvmLog.i(TAG, "new user: PIN set");