summaryrefslogtreecommitdiff
path: root/java/com/android/voicemail/impl
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-06-04 12:25:01 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-04 15:05:11 -0700
commit26fe89b6e62030ed5b4c8eb7c07c561b7b77c71a (patch)
tree6c3ec8f97228f1c7389f9c58be1d8ed8044f6436 /java/com/android/voicemail/impl
parentf9af28c9447b78bc24004d7c3baa887387ff21fc (diff)
Fix assert when disabling VVM
The SIM may no longer be valid, but the rest of the deactivation process should still go through. TEST=TAP Bug: 79476712 Test: TAP PiperOrigin-RevId: 199174445 Change-Id: I52d6030320f2675ac74fc06470e3cd8f33b613b8
Diffstat (limited to 'java/com/android/voicemail/impl')
-rw-r--r--java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java37
1 files changed, 17 insertions, 20 deletions
diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
index 4c4df27a7..3b97e3d8e 100644
--- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
+++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java
@@ -142,10 +142,14 @@ public class OmtpVvmCarrierConfigHelper {
@VisibleForTesting
OmtpVvmCarrierConfigHelper(
- Context context, PersistableBundle carrierConfig, PersistableBundle telephonyConfig) {
+ Context context,
+ PersistableBundle carrierConfig,
+ PersistableBundle telephonyConfig,
+ @Nullable PhoneAccountHandle phoneAccountHandle) {
this.context = context;
this.carrierConfig = carrierConfig;
this.telephonyConfig = telephonyConfig;
+ this.phoneAccountHandle = phoneAccountHandle;
overrideConfig = null;
vvmType = getVvmType();
protocol = VisualVoicemailProtocolFactory.create(this.context.getResources(), vvmType);
@@ -345,7 +349,6 @@ public class OmtpVvmCarrierConfigHelper {
}
public void startActivation() {
- Assert.checkArgument(isValid());
PhoneAccountHandle phoneAccountHandle = getPhoneAccountHandle();
if (phoneAccountHandle == null) {
// This should never happen
@@ -353,17 +356,12 @@ public class OmtpVvmCarrierConfigHelper {
return;
}
- if (vvmType == null || vvmType.isEmpty()) {
- // The VVM type is invalid; we should never have gotten here in the first place since
- // this is loaded initially in the constructor, and callers should check isValid()
- // before trying to start activation anyways.
- VvmLog.e(TAG, "startActivation : vvmType is null or empty for account " + phoneAccountHandle);
+ if (!isValid()) {
+ VvmLog.e(TAG, "startActivation : invalid config for account " + phoneAccountHandle);
return;
}
- if (protocol != null) {
- ActivationTask.start(context, this.phoneAccountHandle, null);
- }
+ ActivationTask.start(context, this.phoneAccountHandle, null);
}
public void activateSmsFilter() {
@@ -378,17 +376,16 @@ public class OmtpVvmCarrierConfigHelper {
}
public void startDeactivation() {
- Assert.checkArgument(isValid());
VvmLog.i(TAG, "startDeactivation");
- if (!isLegacyModeEnabled()) {
- // SMS should still be filtered in legacy mode
- context
- .getSystemService(TelephonyManager.class)
- .createForPhoneAccountHandle(getPhoneAccountHandle())
- .setVisualVoicemailSmsFilterSettings(null);
- VvmLog.i(TAG, "filter disabled");
- }
- if (protocol != null) {
+ if (isValid()) {
+ if (!isLegacyModeEnabled()) {
+ // SMS should still be filtered in legacy mode
+ context
+ .getSystemService(TelephonyManager.class)
+ .createForPhoneAccountHandle(getPhoneAccountHandle())
+ .setVisualVoicemailSmsFilterSettings(null);
+ VvmLog.i(TAG, "filter disabled");
+ }
protocol.startDeactivation(this);
}
VvmAccountManager.removeAccount(context, getPhoneAccountHandle());