Merge "Change the 'dt' field of CVVM to 6" into nyc-mr2-dev
diff --git a/src/com/android/phone/vvm/omtp/protocol/OmtpProtocol.java b/src/com/android/phone/vvm/omtp/protocol/OmtpProtocol.java
index d002652..7ec3dba 100644
--- a/src/com/android/phone/vvm/omtp/protocol/OmtpProtocol.java
+++ b/src/com/android/phone/vvm/omtp/protocol/OmtpProtocol.java
@@ -28,6 +28,7 @@
     public OmtpMessageSender createMessageSender(SmsManager smsManager, short applicationPort,
             String destinationNumber) {
         return new OmtpStandardMessageSender(smsManager, applicationPort, destinationNumber,
-                null, OmtpConstants.PROTOCOL_VERSION1_1, null);
+                OmtpConstants.CLIENT_TYPE_GOOGLE_10, OmtpConstants.PROTOCOL_VERSION1_1,
+                null /*clientPrefix*/);
     }
 }
diff --git a/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java b/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
index d95879f..524c96d 100644
--- a/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
+++ b/src/com/android/phone/vvm/omtp/protocol/Vvm3EventHandler.java
@@ -18,13 +18,17 @@
 
 import android.annotation.IntDef;
 import android.content.Context;
+import android.provider.VoicemailContract.Status;
+import android.telecom.PhoneAccountHandle;
 import android.util.Log;
+
 import com.android.phone.VoicemailStatus;
 import com.android.phone.settings.VoicemailChangePinActivity;
 import com.android.phone.vvm.omtp.DefaultOmtpEventHandler;
 import com.android.phone.vvm.omtp.OmtpEvents;
 import com.android.phone.vvm.omtp.OmtpEvents.Type;
 import com.android.phone.vvm.omtp.OmtpVvmCarrierConfigHelper;
+
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 
@@ -113,19 +117,22 @@
         OmtpEvents event) {
         switch (event) {
             case CONFIG_REQUEST_STATUS_SUCCESS:
-                if (status.getPhoneAccountHandle() == null) {
-                    // This should never happen.
-                    Log.e(TAG, "status editor has null phone account handle");
-                    return true;
-                }
-
-                if (!VoicemailChangePinActivity
-                    .isDefaultOldPinSet(context, status.getPhoneAccountHandle())) {
+                if (!isPinRandomized(context, status.getPhoneAccountHandle())) {
                     return false;
                 } else {
                     postError(status, PIN_NOT_SET);
                 }
                 break;
+            case CONFIG_ACTIVATING_SUBSEQUENT:
+                if (isPinRandomized(context, status.getPhoneAccountHandle())) {
+                    status.setConfigurationState(PIN_NOT_SET);
+                } else {
+                    status.setConfigurationState(Status.CONFIGURATION_STATE_OK);
+                }
+                status
+                        .setNotificationChannelState(Status.NOTIFICATION_CHANNEL_STATE_OK)
+                        .setDataChannelState(Status.DATA_CHANNEL_STATE_OK).apply();
+                break;
             case CONFIG_DEFAULT_PIN_REPLACED:
                 postError(status, PIN_NOT_SET);
                 break;
@@ -269,4 +276,13 @@
         }
         editor.apply();
     }
+
+    private static boolean isPinRandomized(Context context, PhoneAccountHandle phoneAccountHandle) {
+        if (phoneAccountHandle == null) {
+            // This should never happen.
+            Log.e(TAG, "status editor has null phone account handle");
+            return false;
+        }
+        return VoicemailChangePinActivity.isDefaultOldPinSet(context, phoneAccountHandle);
+    }
 }