Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50e2d6c2 authored by Junda Liu's avatar Junda Liu Committed by Android Git Automerger
Browse files

am ef6178a9: Merge "Add hasMatchedTetherApnSetting to telmgr API." into lmp-mr1-dev

* commit 'ef6178a9':
  Add hasMatchedTetherApnSetting to telmgr API.
parents a7ee1243 ef6178a9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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) {
+20 −0
Original line number Diff line number Diff line
@@ -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.
     */
+9 −0
Original line number Diff line number Diff line
@@ -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.