am ef6178a9: Merge "Add hasMatchedTetherApnSetting to telmgr API." into lmp-mr1-dev
* commit 'ef6178a99c57b6de3dc02455e570f932b154b8e1': Add hasMatchedTetherApnSetting to telmgr API.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user