Check both TETHER_DUN_APN and TETHER_DUN_REQUIRED to decide DUN APN behavior.
Bug: b/18158411
Change-Id: Ia1455b67143b968c919d65e9970d7a900eb19044
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e8cffa9..b465dbd 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1895,6 +1895,27 @@
}
/**
+ * Check TETHER_DUN_REQUIRED and TETHER_DUN_APN settings, net.tethering.noprovisioning
+ * SystemProperty, and config_tether_apndata to decide whether DUN APN is required for
+ * tethering.
+ *
+ * @return 0: Not required. 1: required. 2: Not set.
+ * @hide
+ */
+ @Override
+ public int getTetherApnRequired() {
+ enforceModifyPermissionOrCarrierPrivilege();
+ int dunRequired = Settings.Global.getInt(mPhone.getContext().getContentResolver(),
+ Settings.Global.TETHER_DUN_REQUIRED, 2);
+ // If not set, check net.tethering.noprovisioning, TETHER_DUN_APN setting and
+ // config_tether_apndata.
+ if (dunRequired == 2 && mPhone.hasMatchedTetherApnSetting()) {
+ dunRequired = 1;
+ }
+ return dunRequired;
+ }
+
+ /**
* Set mobile data enabled
* Used by the user through settings etc to turn on/off mobile data
*