Opt-in VVM3 for OEMs
Certain feature in VVM3 is dangerous without dialer UI support,
such as randomizing the PIN.
VVM3 should be disabled by default on non nexus devices.
Change-Id: Ia73d926245981656aa743570e50721ab7c81ac72
Fixes: 29577838
diff --git a/res/values/config.xml b/res/values/config.xml
index 0b1f93c..12b35c4 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -207,6 +207,9 @@
<!-- Flag indicating whether to allow visual voicemail if available on the device.[DO NOT TRANSLATE] -->
<bool name="allow_visual_voicemail">true</bool>
+ <!-- Flag to enable VVM3 visual voicemail. VVM3 is used by Verizon Wireless. -->
+ <bool name="vvm3_enabled">false</bool>
+
<!-- Component for custom voicemail notification handling. [DO NOT TRANSLATE] -->
<string name="config_customVoicemailComponent">@null</string>
diff --git a/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java b/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
index 04fb8e5..23c607e 100644
--- a/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
+++ b/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelper.java
@@ -110,7 +110,7 @@
.getConfig(telephonyManager.getSimOperator(subId));
mVvmType = getVvmType();
- mProtocol = VisualVoicemailProtocolFactory.create(mVvmType);
+ mProtocol = VisualVoicemailProtocolFactory.create(mContext.getResources(), mVvmType);
}
public OmtpVvmCarrierConfigHelper(Context context, PhoneAccountHandle handle) {
@@ -119,14 +119,14 @@
}
@VisibleForTesting
- OmtpVvmCarrierConfigHelper(PersistableBundle carrierConfig,
+ OmtpVvmCarrierConfigHelper(Context context, PersistableBundle carrierConfig,
PersistableBundle telephonyConfig) {
- mContext = null;
+ mContext = context;
mSubId = 0;
mCarrierConfig = carrierConfig;
mTelephonyConfig = telephonyConfig;
mVvmType = getVvmType();
- mProtocol = VisualVoicemailProtocolFactory.create(mVvmType);
+ mProtocol = VisualVoicemailProtocolFactory.create(mContext.getResources(), mVvmType);
}
public Context getContext() {
diff --git a/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocolFactory.java b/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocolFactory.java
index 5f54a50..4d39ae2 100644
--- a/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocolFactory.java
+++ b/src/com/android/phone/vvm/omtp/protocol/VisualVoicemailProtocolFactory.java
@@ -17,8 +17,10 @@
package com.android.phone.vvm.omtp.protocol;
import android.annotation.Nullable;
+import android.content.res.Resources;
import android.telephony.TelephonyManager;
+import com.android.phone.R;
import com.android.phone.vvm.omtp.VvmLog;
public class VisualVoicemailProtocolFactory {
@@ -28,7 +30,7 @@
private static final String VVM_TYPE_VVM3 = "vvm_type_vvm3";
@Nullable
- public static VisualVoicemailProtocol create(String type) {
+ public static VisualVoicemailProtocol create(Resources resources, String type) {
if (type == null) {
return null;
}
@@ -38,7 +40,12 @@
case TelephonyManager.VVM_TYPE_CVVM:
return new CvvmProtocol();
case VVM_TYPE_VVM3:
- return new Vvm3Protocol();
+ if (resources.getBoolean(R.bool.vvm3_enabled)) {
+ return new Vvm3Protocol();
+ } else {
+ VvmLog.e(TAG, "VVM3 is disabled");
+ return null;
+ }
default:
VvmLog.e(TAG, "Unexpected visual voicemail type: " + type);
}
diff --git a/tests/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelperTest.java b/tests/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelperTest.java
index 63c7f60..bc0192c 100644
--- a/tests/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelperTest.java
+++ b/tests/src/com/android/phone/vvm/omtp/OmtpVvmCarrierConfigHelperTest.java
@@ -28,14 +28,13 @@
import static com.android.phone.vvm.omtp.OmtpVvmCarrierConfigHelper.KEY_VVM_TYPE_STRING;
import android.os.PersistableBundle;
-
-import junit.framework.TestCase;
+import android.test.AndroidTestCase;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-public class OmtpVvmCarrierConfigHelperTest extends TestCase {
+public class OmtpVvmCarrierConfigHelperTest extends AndroidTestCase {
private static final String CARRIER_TYPE = "omtp.carrier";
private static final String CARRIER_PACKAGE_NAME = "omtp.carrier.package";
@@ -58,19 +57,20 @@
private OmtpVvmCarrierConfigHelper mHelper;
public void testCarrierConfig() {
- mHelper = new OmtpVvmCarrierConfigHelper(createCarrierConfig(), null);
+ mHelper = new OmtpVvmCarrierConfigHelper(getContext(), createCarrierConfig(), null);
verifyCarrierConfig();
verifyDefaultExtraConfig();
}
public void testTelephonyConfig() {
- mHelper = new OmtpVvmCarrierConfigHelper(null, createTelephonyConfig());
+ mHelper = new OmtpVvmCarrierConfigHelper(getContext(), null, createTelephonyConfig());
verifyTelephonyConfig();
verifyTelephonyExtraConfig();
}
public void testMixedConfig() {
- mHelper = new OmtpVvmCarrierConfigHelper(createCarrierConfig(), createTelephonyConfig());
+ mHelper = new OmtpVvmCarrierConfigHelper(getContext(), createCarrierConfig(),
+ createTelephonyConfig());
verifyCarrierConfig();
verifyTelephonyExtraConfig();
}