diff options
| author | 2014-12-02 18:18:23 +0000 | |
|---|---|---|
| committer | 2014-12-02 18:18:24 +0000 | |
| commit | ef6178a99c57b6de3dc02455e570f932b154b8e1 (patch) | |
| tree | d6053edd4c017c6609e2384ba66e226d56aabe00 | |
| parent | dc1baa16b1c559b07d392f7d899fcfe18fa7036c (diff) | |
| parent | 38531581fc19f9172fabe56047b326e5dab88625 (diff) | |
Merge "Add hasMatchedTetherApnSetting to telmgr API." into lmp-mr1-dev
3 files changed, 35 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 7c303ffb2bfe..2c8e1dc547e0 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -42,6 +42,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.util.Log; import com.android.internal.telephony.Phone; @@ -630,8 +631,11 @@ public class Tethering extends BaseNetworkObserver { } public void checkDunRequired() { - int secureSetting = Settings.Global.getInt(mContext.getContentResolver(), - Settings.Global.TETHER_DUN_REQUIRED, 2); + int secureSetting = 2; + TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); + if (tm != null) { + secureSetting = tm.getTetherApnRequired(); + } synchronized (mPublicSync) { // 2 = not set, 0 = DUN not required, 1 = DUN required if (secureSetting != 2) { diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 53f194530c1d..de2a6da419c2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3087,6 +3087,26 @@ public class TelephonyManager { } /** + * 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 + */ + public int getTetherApnRequired() { + try { + return getITelephony().getTetherApnRequired(); + } catch (RemoteException ex) { + Rlog.e(TAG, "hasMatchedTetherApnSetting RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "hasMatchedTetherApnSetting NPE", ex); + } + return 2; + } + + + /** * Values used to return status for hasCarrierPrivileges call. */ /** @hide */ diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 0a50d5481d18..bf7f33273ffe 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -657,6 +657,15 @@ interface ITelephony { int getPreferredNetworkType(); /** + * 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. + */ + int getTetherApnRequired(); + + /** * Set the preferred network type. * Used for device configuration by some CDMA operators. * |