Handle non-ready provisioning status on non-VVM3

Currently only VVM3 has implemented provisioning steps.
Before implementing provisioning we used to ignore the provisioning
status and attempt to access the server. By having all protocol
going through the provisioning process non-VVM3 protocols will do
nothing and not complete the activation.

In this CL if provisioning is not supported for the protocol, the old
behavior will be used. Meaning the provisioning status will once again
be ignored.

Change-Id: Iebf9c159bc4a1c4fe91d5734f5f53c6d90c0fa8a
Fixes: 30063031
diff --git a/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java b/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
index b570744..e8ae403 100644
--- a/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
+++ b/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
@@ -313,6 +313,13 @@
         }
     }
 
+    public boolean supportsProvisioning() {
+        if (mProtocol != null) {
+            return mProtocol.supportsProvisioning();
+        }
+        return false;
+    }
+
     public void startProvisioning(PhoneAccountHandle phone, StatusMessage message, Bundle data) {
         if (mProtocol != null) {
             mProtocol.startProvisioning(phone, this, message, data);
@@ -395,4 +402,5 @@
         }
         return defaultValue;
     }
+
 }
\ No newline at end of file
diff --git a/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocol.java b/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocol.java
index be2a77f..4ceb88b 100644
--- a/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocol.java
+++ b/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocol.java
@@ -43,6 +43,10 @@
         }
     }
 
+    public boolean supportsProvisioning() {
+        return false;
+    }
+
     public void startProvisioning(PhoneAccountHandle handle, OmtpVvmCarrierConfigHelper config,
             StatusMessage message, Bundle data) {
         // Do nothing
diff --git a/src/com/android/phone/vvm/omtp/protocol/Vvm3Protocol.java b/src/com/android/phone/vvm/omtp/protocol/Vvm3Protocol.java
index 306006d..b00ed2a 100644
--- a/src/com/android/phone/vvm/omtp/protocol/Vvm3Protocol.java
+++ b/src/com/android/phone/vvm/omtp/protocol/Vvm3Protocol.java
@@ -79,6 +79,11 @@
     }
 
     @Override
+    public boolean supportsProvisioning() {
+        return true;
+    }
+
+    @Override
     public void startProvisioning(PhoneAccountHandle phoneAccountHandle,
             OmtpVvmCarrierConfigHelper config, StatusMessage message, Bundle data) {
         VvmLog.i(TAG, "start vvm3 provisioning");
diff --git a/src/com/android/phone/vvm/omtp/sms/OmtpMessageReceiver.java b/src/com/android/phone/vvm/omtp/sms/OmtpMessageReceiver.java
index c930a98..5bf7900 100644
--- a/src/com/android/phone/vvm/omtp/sms/OmtpMessageReceiver.java
+++ b/src/com/android/phone/vvm/omtp/sms/OmtpMessageReceiver.java
@@ -88,8 +88,18 @@
             if (message.getProvisioningStatus().equals(OmtpConstants.SUBSCRIBER_READY)) {
                 updateSource(phone, subId, message);
             } else {
-                VvmLog.v(TAG, "Subscriber not ready, start provisioning");
-                mContext.startService(OmtpProvisioningService.getProvisionIntent(mContext, intent));
+                if (helper.supportsProvisioning()) {
+                    VvmLog.i(TAG, "Subscriber not ready, start provisioning");
+                    mContext.startService(
+                            OmtpProvisioningService.getProvisionIntent(mContext, intent));
+                } else {
+                    VvmLog.i(TAG, "Subscriber not ready but provisioning is not supported");
+                    VvmLog.i(TAG, "st=" + message.getProvisioningStatus() +
+                            ",rc=" + message.getReturnCode());
+                    // Ignore the non-ready state and attempt to use the provided info as is.
+                    // This is probably caused by not completing the new user tutorial.
+                    updateSource(phone, subId, message);
+                }
             }
         } else {
             VvmLog.e(TAG, "Unknown prefix: " + eventType);