diff options
author | Sarah Chin <sarahchin@google.com> | 2021-06-04 15:39:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-06-04 15:39:14 +0000 |
commit | 327f915971a8139593cbb79d6ee24a730ad821c2 (patch) | |
tree | 99f9a910611dc79add234e6706a763272c27f1fa | |
parent | 35d25d11c4f9612e9dd7c7d3a868900c131d592e (diff) | |
parent | 6ca27717b214ccbec8ca1ab04bec473b56cc193a (diff) |
Merge "Add function to get APN types as ints from bitmask" into sc-dev
-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 8b6f2b5c8f08..be1502ad49f2 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 |