diff options
| author | 2019-06-24 16:18:48 -0700 | |
|---|---|---|
| committer | 2019-06-24 16:18:48 -0700 | |
| commit | 51867b4380ad9bc897d53d9db145cfacad4520af (patch) | |
| tree | 1cba667e05bde91f74d8cd53e0ebadd4102c33e8 | |
| parent | 99c185a729607f882ccc1706a83b665628a762db (diff) | |
| parent | 5d02fcb146759a559505480f5990f1b04e263d9d (diff) | |
Merge "Reverted to the old logic for APN selection" into qt-dev
am: 5d02fcb146
Change-Id: Iec56dfbbaeced79fb02973360ddf5df89b69609f
| -rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 38 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/ApnSetting.java | 22 |
2 files changed, 22 insertions, 38 deletions
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index b7e40336c754..2651346ad393 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -16,8 +16,6 @@ package android.telephony; -import static android.telephony.TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN; - import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; @@ -1607,12 +1605,6 @@ public class ServiceState implements Parcelable { } } - /** @hide */ - public static int networkTypeToAccessNetworkType(@TelephonyManager.NetworkType - int networkType) { - return rilRadioTechnologyToAccessNetworkType(networkTypeToRilRadioTechnology(networkType)); - } - /** * Get current data network type. * @@ -1738,36 +1730,6 @@ public class ServiceState implements Parcelable { return false; } - /** - * - * Returns whether the bearerBitmask includes a networkType that matches the accessNetworkType. - * - * The NetworkType refers to NetworkType in TelephonyManager. For example - * {@link TelephonyManager#NETWORK_TYPE_GPRS}. - * - * The accessNetworkType refers to {@link AccessNetworkType}. - * - * @hide - * */ - public static boolean networkBitmaskHasAccessNetworkType( - @TelephonyManager.NetworkTypeBitMask int networkBitmask, int accessNetworkType) { - if (networkBitmask == NETWORK_TYPE_BITMASK_UNKNOWN) return true; - if (accessNetworkType == AccessNetworkType.UNKNOWN) return false; - - int networkType = 1; - while (networkBitmask != 0) { - if ((networkBitmask & 1) != 0) { - if (networkTypeToAccessNetworkType(networkType) == accessNetworkType) { - return true; - } - } - networkBitmask = networkBitmask >> 1; - networkType++; - } - - return false; - } - /** @hide */ public static int getBitmaskForTech(int radioTech) { if (radioTech >= 1) { diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 165be641032c..116c05129a96 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -1417,6 +1417,28 @@ public class ApnSetting implements Parcelable { return port == UNSPECIFIED_INT ? null : Integer.toString(port); } + /** + * Check if this APN setting can support the given network + * + * @param networkType The network type + * @return {@code true} if this APN setting can support the given network. + * + * @hide + */ + public boolean canSupportNetworkType(@TelephonyManager.NetworkType int networkType) { + // Do a special checking for GSM. In reality, GSM is a voice only network type and can never + // be used for data. We allow it here because in some DSDS corner cases, on the non-DDS + // sub, modem reports data rat unknown. In that case if voice is GSM and this APN supports + // GPRS or EDGE, this APN setting should be selected. + if (networkType == TelephonyManager.NETWORK_TYPE_GSM + && (mNetworkTypeBitmask & (TelephonyManager.NETWORK_TYPE_BITMASK_GPRS + | TelephonyManager.NETWORK_TYPE_BITMASK_EDGE)) != 0) { + return true; + } + + return ServiceState.bitmaskHasTech(mNetworkTypeBitmask, networkType); + } + // Implement Parcelable. @Override /** @hide */ |