diff options
| author | 2021-06-08 18:51:06 +0000 | |
|---|---|---|
| committer | 2021-06-08 18:51:06 +0000 | |
| commit | f9bf0a696b3385f3d3a3cd620930e3888cdb4e84 (patch) | |
| tree | c3f43f10832601d6f4dc2913d1368282b53316fd | |
| parent | 0503e1c13c369f218862e32ab7c2d140ae977d54 (diff) | |
| parent | a3fce76dab0ba3ffd46070bfee8527ed75d386fa (diff) | |
Merge "Add function to get APN types as ints from bitmask"
| -rw-r--r-- | telephony/java/android/telephony/data/ApnSetting.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java index 08f56132121e..bb90fb17f4bb 100644 --- a/telephony/java/android/telephony/data/ApnSetting.java +++ b/telephony/java/android/telephony/data/ApnSetting.java @@ -1551,6 +1551,20 @@ public class ApnSetting implements Parcelable { } /** + * Converts the APN type bitmask to an array of all APN types + * @param apnTypeBitmask bitmask of APN types. + * @return int array of APN types + * @hide + */ + @NonNull + public static int[] getApnTypesFromBitmask(int apnTypeBitmask) { + return APN_TYPE_INT_MAP.keySet().stream() + .filter(type -> ((apnTypeBitmask & type) == type)) + .mapToInt(Integer::intValue) + .toArray(); + } + + /** * Converts the integer representation of APN type to its string representation. * * @param apnType APN type as an integer |