Loading services/core/java/com/android/server/connectivity/Tethering.java +6 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading telephony/java/android/telephony/TelephonyManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -3086,6 +3086,26 @@ public class TelephonyManager { return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA); } /** * 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. */ Loading telephony/java/com/android/internal/telephony/ITelephony.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,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. Loading Loading
services/core/java/com/android/server/connectivity/Tethering.java +6 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading
telephony/java/android/telephony/TelephonyManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -3086,6 +3086,26 @@ public class TelephonyManager { return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA); } /** * 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. */ Loading
telephony/java/com/android/internal/telephony/ITelephony.aidl +9 −0 Original line number Diff line number Diff line Loading @@ -656,6 +656,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. Loading