diff options
author | Maria Yang <mariay@google.com> | 2022-01-14 05:58:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-01-14 05:58:10 +0000 |
commit | d36f3eb79592b827e0823c6b8b46fd3d3c0f3a9f (patch) | |
tree | de9b49c6afa4535fc8726cd9c211070f87eab0d4 | |
parent | 446346bc4ed77cc1b48b7bf08686005f2c2b948d (diff) | |
parent | 898e2b53a7d095ed5b0fd5a17f4557021ed56e31 (diff) | |
download | base-d36f3eb79592b827e0823c6b8b46fd3d3c0f3a9f.tar.gz |
Merge "Handle setAllowedCarriers() with empty list of carriers" into sc-v2-dev
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 989663406a6b..8bc4d381e2dd 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -11898,12 +11898,15 @@ public class TelephonyManager { if (carriers == null || !SubscriptionManager.isValidPhoneId(slotIndex)) { return -1; } - // Execute the method setCarrierRestrictionRules with an empty excluded list and - // indicating priority for the allowed list. + // Execute the method setCarrierRestrictionRules with an empty excluded list. + // If the allowed list is empty, it means that all carriers are allowed (default allowed), + // otherwise it means that only specified carriers are allowed (default not allowed). CarrierRestrictionRules carrierRestrictionRules = CarrierRestrictionRules.newBuilder() .setAllowedCarriers(carriers) .setDefaultCarrierRestriction( - CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED) + carriers.isEmpty() + ? CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_ALLOWED + : CarrierRestrictionRules.CARRIER_RESTRICTION_DEFAULT_NOT_ALLOWED) .build(); int result = setCarrierRestrictionRules(carrierRestrictionRules); |