summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-06-04 22:21:36 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-06-04 22:21:36 +0000
commit444a3aea729cdc50ba2df51297da22f8e6a59c4b (patch)
tree6c3ec8f97228f1c7389f9c58be1d8ed8044f6436
parentf9af28c9447b78bc24004d7c3baa887387ff21fc (diff)
parent26fe89b6e62030ed5b4c8eb7c07c561b7b77c71a (diff)
Merge "Fix assert when disabling VVM"
-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());