diff options
Diffstat (limited to 'java/com/android/voicemail/impl/ActivationTask.java')
| -rw-r--r-- | java/com/android/voicemail/impl/ActivationTask.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java index 320ea2aaa..d7a122ce3 100644 --- a/java/com/android/voicemail/impl/ActivationTask.java +++ b/java/com/android/voicemail/impl/ActivationTask.java @@ -23,6 +23,7 @@ import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.provider.Settings; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.support.annotation.WorkerThread; import android.telecom.PhoneAccountHandle; import android.telephony.ServiceState; @@ -64,6 +65,8 @@ public class ActivationTask extends BaseTask { private final RetryPolicy mRetryPolicy; + @Nullable private OmtpVvmCarrierConfigHelper configForTest; + private Bundle mMessageData; public ActivationTask() { @@ -132,19 +135,27 @@ public class ActivationTask extends BaseTask { PreOMigrationHandler.migrate(getContext(), phoneAccountHandle); - if (!VisualVoicemailSettingsUtil.isEnabled(getContext(), phoneAccountHandle)) { - VvmLog.i(TAG, "VVM is disabled"); - return; + OmtpVvmCarrierConfigHelper helper; + if (configForTest != null) { + helper = configForTest; + } else { + helper = new OmtpVvmCarrierConfigHelper(getContext(), phoneAccountHandle); } - - OmtpVvmCarrierConfigHelper helper = - new OmtpVvmCarrierConfigHelper(getContext(), phoneAccountHandle); if (!helper.isValid()) { VvmLog.i(TAG, "VVM not supported on phoneAccountHandle " + phoneAccountHandle); VvmAccountManager.removeAccount(getContext(), phoneAccountHandle); return; } + if (!VisualVoicemailSettingsUtil.isEnabled(getContext(), phoneAccountHandle)) { + if (helper.isLegacyModeEnabled()) { + VvmLog.i(TAG, "Setting up filter for legacy mode"); + helper.activateSmsFilter(); + } + VvmLog.i(TAG, "VVM is disabled"); + return; + } + // OmtpVvmCarrierConfigHelper can start the activation process; it will pass in a vvm // content provider URI which we will use. On some occasions, setting that URI will // fail, so we will perform a few attempts to ensure that the vvm content provider has @@ -278,4 +289,9 @@ public class ActivationTask extends BaseTask { .createForPhoneAccountHandle(phoneAccountHandle); return telephonyManager.getServiceState().getState() == ServiceState.STATE_IN_SERVICE; } + + @VisibleForTesting + void setConfigForTest(OmtpVvmCarrierConfigHelper config) { + configForTest = config; + } } |
