Allow VVM activation to be rerun if carrier sent STATUS SMS
Carrier might send STATUS SMS actively if the account configuration has changed. Previously it will be discarded if the account is already activated. In this CL activation will be rerun if the messageData already exist since it is initiated by an STATUS SMS.
Bug: 69857261
Test: ActivationTaskTest
PiperOrigin-RevId: 178028542
Change-Id: I6d103569c2be4eeadc3a7877d160fff03ad8b40e
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java
index 29c91e0..83f2fd8 100644
--- a/java/com/android/voicemail/impl/ActivationTask.java
+++ b/java/com/android/voicemail/impl/ActivationTask.java
@@ -61,7 +61,7 @@
private static final int RETRY_TIMES = 4;
private static final int RETRY_INTERVAL_MILLIS = 5_000;
- private static final String EXTRA_MESSAGE_DATA_BUNDLE = "extra_message_data_bundle";
+ @VisibleForTesting static final String EXTRA_MESSAGE_DATA_BUNDLE = "extra_message_data_bundle";
private final RetryPolicy mRetryPolicy;
@@ -168,7 +168,8 @@
}
VvmLog.i(TAG, "VVM content provider configured - " + helper.getVvmType());
- if (VvmAccountManager.isAccountActivated(getContext(), phoneAccountHandle)) {
+ if (mMessageData == null
+ && VvmAccountManager.isAccountActivated(getContext(), phoneAccountHandle)) {
VvmLog.i(TAG, "Account is already activated");
// The activated state might come from restored data, the filter still needs to be set up.
helper.activateSmsFilter();
diff --git a/java/com/android/voicemail/impl/PreOMigrationHandler.java b/java/com/android/voicemail/impl/PreOMigrationHandler.java
index 3ec5e08..2c45471 100644
--- a/java/com/android/voicemail/impl/PreOMigrationHandler.java
+++ b/java/com/android/voicemail/impl/PreOMigrationHandler.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.os.Bundle;
+import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;
import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
@@ -49,7 +50,7 @@
private static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING =
"android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
- private static final String PRE_O_MIGRATION_FINISHED = "pre_o_migration_finished";
+ @VisibleForTesting static final String PRE_O_MIGRATION_FINISHED = "pre_o_migration_finished";
@WorkerThread
public static void migrate(Context context, PhoneAccountHandle phoneAccountHandle) {