From 5e7b8533ef4b9d355c8df051d377e91ff7bed85a Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Tue, 19 Oct 2021 21:21:28 -0700 Subject: Supported minimum aggregated bandwidth and roaming for 5G+ 1. Added minimum bandwidth support. 5G+ icon is only shown when the aggregated bandwidth is above the threshold. 2. Allowed carrier to disable 5G+ while roaming. Bug: 198831438 Bug: 201455505 Test: atest NetworkTypeControllerTest Change-Id: I1f40de5ee559a6d703806e74d305267bde295dcc --- .../android/telephony/CarrierConfigManager.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 68ef7543c33f..0b178e2a6824 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1873,6 +1873,20 @@ public class CarrierConfigManager { public static final String KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT = "lte_plus_threshold_bandwidth_khz_int"; + /** + * The combined channel bandwidth threshold (non-inclusive) in KHz required to display the + * NR advanced (i.e. 5G+) data icon. It is 0 by default, meaning minimum bandwidth check is + * not enabled. Other factors like bands or frequency can also determine whether the NR + * advanced data icon is shown or not. + * + * @see #KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY + * @see #KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT + * + * @hide + */ + public static final String KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT = + "nr_advanced_threshold_bandwidth_khz_int"; + /** * The string is used to filter redundant string from PLMN Network Name that's supplied by * specific carrier. @@ -3537,6 +3551,17 @@ public class CarrierConfigManager { public static final String KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT = "nr_advanced_capable_pco_id_int"; + /** + * Enabled NR advanced (i.e. 5G+) icon while roaming. The default value is {@code true}, meaming + * the same NR advanced logic used for home network will be used for roaming network as well. + * Set this to {@code false} will disable NR advanced icon while the device is roaming, + * regardless meeting NR advanced criteria or not. + * + * @hide + */ + public static final String KEY_ENABLE_NR_ADVANCED_WHILE_ROAMING_BOOL = + "enable_nr_advanced_for_roaming_bool"; + /** * This configuration allows the framework to use user data communication to detect Idle state, * and this is used on the 5G icon. @@ -5565,6 +5590,7 @@ public class CarrierConfigManager { sDefaults.putString(KEY_SHOW_CARRIER_DATA_ICON_PATTERN_STRING, ""); sDefaults.putBoolean(KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, true); sDefaults.putInt(KEY_LTE_PLUS_THRESHOLD_BANDWIDTH_KHZ_INT, 20000); + sDefaults.putInt(KEY_NR_ADVANCED_THRESHOLD_BANDWIDTH_KHZ_INT, 0); sDefaults.putIntArray(KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY, new int[]{CARRIER_NR_AVAILABILITY_NSA, CARRIER_NR_AVAILABILITY_SA}); sDefaults.putBoolean(KEY_LTE_ENABLED_BOOL, true); @@ -5660,6 +5686,7 @@ public class CarrierConfigManager { sDefaults.putLong(KEY_5G_WATCHDOG_TIME_MS_LONG, 3600000); sDefaults.putIntArray(KEY_ADDITIONAL_NR_ADVANCED_BANDS_INT_ARRAY, new int[0]); sDefaults.putInt(KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT, 0); + sDefaults.putBoolean(KEY_ENABLE_NR_ADVANCED_WHILE_ROAMING_BOOL, true); sDefaults.putBoolean(KEY_LTE_ENDC_USING_USER_DATA_FOR_RRC_DETECTION_BOOL, false); sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_BOOL, false); sDefaults.putBoolean(KEY_UNMETERED_NR_NSA_MMWAVE_BOOL, false); -- cgit v1.2.3 From 6a837e535294394573f33ec0b7f3a7aaa35b6e85 Mon Sep 17 00:00:00 2001 From: Gary Jian Date: Tue, 12 Oct 2021 18:06:32 +0800 Subject: Added nr advanced calling settings support - Added a telephony provider entry for storing the user's settings. - Added new vonr_enabled_bool config to determine whether VoNR should be enabled for carrier Bug: 202150953 Test: manual Change-Id: Ie56a7de3fdb978353af77bafb55b0e37c22b58a4 Merged-In: Ie56a7de3fdb978353af77bafb55b0e37c22b58a4 --- telephony/java/android/telephony/CarrierConfigManager.java | 11 +++++++++++ telephony/java/android/telephony/SubscriptionManager.java | 9 +++++++++ 2 files changed, 20 insertions(+) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 68ef7543c33f..8720a4388c5a 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -5170,6 +5170,16 @@ public class CarrierConfigManager { */ public static final String KEY_VONR_SETTING_VISIBILITY_BOOL = "vonr_setting_visibility_bool"; + /** + * Flag specifying whether VoNR should be enabled for carrier. + * If true, VoNr will be enabled. If false, hard disabled. + * + * Disabled by default. + * + * @hide + */ + public static final String KEY_VONR_ENABLED_BOOL = "vonr_enabled_bool"; + /** * Determine whether unthrottle data retry when tracking area code (TAC/LAC) from cell changes * @@ -5785,6 +5795,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL, false); sDefaults.putBoolean(KEY_UNTHROTTLE_DATA_RETRY_WHEN_TAC_CHANGES_BOOL, false); sDefaults.putBoolean(KEY_VONR_SETTING_VISIBILITY_BOOL, false); + sDefaults.putBoolean(KEY_VONR_ENABLED_BOOL, false); } /** diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 114c90bbd87a..1be1f2f8de30 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -948,6 +948,15 @@ public class SubscriptionManager { */ public static final String VOIMS_OPT_IN_STATUS = SimInfo.COLUMN_VOIMS_OPT_IN_STATUS; + /** + * TelephonyProvider column name for NR Advanced calling + * Determines if the user has enabled VoNR settings for this subscription. + * + * @hide + */ + public static final String NR_ADVANCED_CALLING_ENABLED = + SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED; + /** * Profile class of the subscription * @hide -- cgit v1.2.3 From f183b69cf57f037987fca8a5abdb448f90b18612 Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Wed, 20 Oct 2021 12:42:27 -0700 Subject: Ensure that ScanInfo is cached before callbacks fire Fixes a regression that was introduced in aosp/1312940. There is a critical section in requestNetworkScan after the scanId has been generated and before the ScanInfo is added to the cache. If during this time a callback fires on a separate thread, it will not yet find the ScanInfo record, and due to strict checking, this causes a RuntimeException. This CL re-expands the synchronized block to cover the critical section, and clarifies a little bounds checking. Note: this change is not ideal. This means that all callbacks for all scans will be blocked while a request for a new scan is being made, which was the motivation behind the change that introduced this regression. But, a narrow performance hit is better than a crash, and it's not worth the complexity of a bigger fix. Bug: 200634560 Test: compilation Merged-In: I4670da109256170121ceb6d8fbad0efda310335f Change-Id: I4670da109256170121ceb6d8fbad0efda310335f --- .../android/telephony/TelephonyScanManager.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java index e890acb36b48..9572154ec773 100644 --- a/telephony/java/android/telephony/TelephonyScanManager.java +++ b/telephony/java/android/telephony/TelephonyScanManager.java @@ -36,6 +36,7 @@ import com.android.telephony.Rlog; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.concurrent.Executor; /** @@ -152,16 +153,9 @@ public final class TelephonyScanManager { throw new RuntimeException( "Failed to find NetworkScanInfo with id " + message.arg2); } - NetworkScanCallback callback = nsi.mCallback; - Executor executor = nsi.mExecutor; - if (callback == null) { - throw new RuntimeException( - "Failed to find NetworkScanCallback with id " + message.arg2); - } - if (executor == null) { - throw new RuntimeException( - "Failed to find Executor with id " + message.arg2); - } + + final NetworkScanCallback callback = nsi.mCallback; + final Executor executor = nsi.mExecutor; switch (message.what) { case CALLBACK_RESTRICTED_SCAN_RESULTS: @@ -246,17 +240,24 @@ public final class TelephonyScanManager { NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage, @Nullable String callingFeatureId) { try { + Objects.requireNonNull(request, "Request was null"); + Objects.requireNonNull(callback, "Callback was null"); + Objects.requireNonNull(executor, "Executor was null"); final ITelephony telephony = getITelephony(); if (telephony == null) return null; - int scanId = telephony.requestNetworkScan( - subId, request, mMessenger, new Binder(), callingPackage, - callingFeatureId); - if (scanId == INVALID_SCAN_ID) { - Rlog.e(TAG, "Failed to initiate network scan"); - return null; - } + // The lock must be taken before calling requestNetworkScan because the resulting + // scanId can be invoked asynchronously on another thread at any time after + // requestNetworkScan invoked, leaving a critical section between that call and adding + // the record to the ScanInfo cache. synchronized (mScanInfo) { + int scanId = telephony.requestNetworkScan( + subId, request, mMessenger, new Binder(), callingPackage, + callingFeatureId); + if (scanId == INVALID_SCAN_ID) { + Rlog.e(TAG, "Failed to initiate network scan"); + return null; + } // We link to death whenever a scan is started to ensure that we are linked // at the point that phone process death might matter. // We never unlink because: -- cgit v1.2.3 From 11dd6452d6621328b0bd430eeebacb55fd478cf3 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Wed, 27 Oct 2021 14:24:49 -0700 Subject: Add config to detect e-call call based on dialed sim emerg # list. We normally use the combined emergency number list from the emergency number lists of both sims when placing emergency calls, with the provision that the routing may be unspecified if a dialed number is an emergency number on one sim but not the other. This config allows a carrier to mandate that calls are only treated as an emergency call on their network based on their own emergency number list. Test: TBD Bug: 203947159 Change-Id: Id5cd4123f1bb7bdd85e564fc6997dfbc50652a5f --- .../java/android/telephony/CarrierConfigManager.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 68ef7543c33f..45fd7a3467c4 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -962,6 +962,21 @@ public class CarrierConfigManager { public static final String KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL = "carrier_use_ims_first_for_emergency_bool"; + /** + * When {@code true}, the determination of whether to place a call as an emergency call will be + * based on the known {@link android.telephony.emergency.EmergencyNumber}s for the SIM on which + * the call is being placed. In a dual SIM scenario, if Sim A has the emergency numbers + * 123, 456 and Sim B has the emergency numbers 789, and the user places a call on SIM A to 789, + * it will not be treated as an emergency call in this case. + * When {@code false}, the determination is based on the emergency numbers from all device SIMs, + * regardless of which SIM the call is being placed on. If Sim A has the emergency numbers + * 123, 456 and Sim B has the emergency numbers 789, and the user places a call on SIM A to 789, + * the call will be dialed as an emergency number, but with an unspecified routing. + * @hide + */ + public static final String KEY_USE_ONLY_DIALED_SIM_ECC_LIST_BOOL = + "use_only_dialed_sim_ecc_list_bool"; + /** * When IMS instant lettering is available for a carrier (see * {@link #KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL}), determines the list of characters @@ -5230,6 +5245,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_CARRIER_IMS_GBA_REQUIRED_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL, false); sDefaults.putBoolean(KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL, true); + sDefaults.putBoolean(KEY_USE_ONLY_DIALED_SIM_ECC_LIST_BOOL, false); sDefaults.putString(KEY_CARRIER_NETWORK_SERVICE_WWAN_PACKAGE_OVERRIDE_STRING, ""); sDefaults.putString(KEY_CARRIER_NETWORK_SERVICE_WLAN_PACKAGE_OVERRIDE_STRING, ""); sDefaults.putString(KEY_CARRIER_QUALIFIED_NETWORKS_SERVICE_PACKAGE_OVERRIDE_STRING, ""); -- cgit v1.2.3 From 5914c4592ee75eb85ee598127eee9b5896833745 Mon Sep 17 00:00:00 2001 From: Jack Nudelman Date: Thu, 7 Oct 2021 14:20:55 -0700 Subject: Adds new configs to support 5g+4g opportunistic switching. Bug: 186688682 Test: manual testing Change-Id: Ia78bde63f2471823bb5765cd8022b1aca0074923 Merged-In: Ia78bde63f2471823bb5765cd8022b1aca0074923 --- .../android/telephony/CarrierConfigManager.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 68ef7543c33f..6781cce6448b 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3853,6 +3853,30 @@ public class CarrierConfigManager { public static final String KEY_ENABLE_4G_OPPORTUNISTIC_NETWORK_SCAN_BOOL = "enabled_4g_opportunistic_network_scan_bool"; + /** + * Only relevant when the device supports opportunistic networks but does not support + * simultaneuous 5G+5G. Controls how long, in milliseconds, to wait before opportunistic network + * goes out of service before switching the 5G capability back to primary stack. The idea of + * waiting a few seconds is to minimize the calling of the expensive capability switching + * operation in the case where CBRS goes back into service shortly after going out of it. + * + * @hide + */ + public static final String KEY_TIME_TO_SWITCH_BACK_TO_PRIMARY_IF_OPPORTUNISTIC_OOS_LONG = + "time_to_switch_back_to_primary_if_opportunistic_oos_long"; + + /** + * Only relevant when the device supports opportunistic networks but does not support + * simultaneuous 5G+5G. Controls how long, in milliseconds, after 5G capability has switched back + * to primary stack due to opportunistic network being OOS. The idea is to minimizing the + * 'ping-ponging' effect where device is constantly witching capability back and forth between + * primary and opportunistic stack. + * + * @hide + */ + public static final String KEY_OPPORTUNISTIC_TIME_TO_SCAN_AFTER_CAPABILITY_SWITCH_TO_PRIMARY_LONG + = "opportunistic_time_to_scan_after_capability_switch_to_primary_long"; + /** * Indicates zero or more emergency number prefix(es), because some carrier requires * if users dial an emergency number address with a specific prefix, the combination of the @@ -5713,6 +5737,10 @@ public class CarrierConfigManager { /* Default value is 2 seconds. */ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_5G_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG, 2000); sDefaults.putBoolean(KEY_ENABLE_4G_OPPORTUNISTIC_NETWORK_SCAN_BOOL, true); + sDefaults.putInt(KEY_TIME_TO_SWITCH_BACK_TO_PRIMARY_IF_OPPORTUNISTIC_OOS_LONG, 60000); + sDefaults.putInt( + KEY_OPPORTUNISTIC_TIME_TO_SCAN_AFTER_CAPABILITY_SWITCH_TO_PRIMARY_LONG, + 120000); sDefaults.putAll(Gps.getDefaults()); sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY, new int[] { -- cgit v1.2.3 From eaa09ebfab645147804d2b62e69e55e32eb288cf Mon Sep 17 00:00:00 2001 From: Gary Jian Date: Mon, 15 Nov 2021 19:26:34 +0800 Subject: Make KEY_VONR_SETTING_VISIBILITY_BOOL default to true Bug: 205809218 Test: make Change-Id: I02ea3ad61a0dc1cd09f0bd541008de0e46e3d0ab --- telephony/java/android/telephony/CarrierConfigManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 4d2e00785d49..9c9e41b64892 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -5865,7 +5865,7 @@ public class CarrierConfigManager { sDefaults.putString(KEY_CARRIER_PROVISIONING_APP_STRING, ""); sDefaults.putBoolean(KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL, false); sDefaults.putBoolean(KEY_UNTHROTTLE_DATA_RETRY_WHEN_TAC_CHANGES_BOOL, false); - sDefaults.putBoolean(KEY_VONR_SETTING_VISIBILITY_BOOL, false); + sDefaults.putBoolean(KEY_VONR_SETTING_VISIBILITY_BOOL, true); sDefaults.putBoolean(KEY_VONR_ENABLED_BOOL, false); } -- cgit v1.2.3 From 33c6221c5bf0bf966cd6f2da956c1b566be54ce4 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Mon, 13 Dec 2021 19:04:25 +0000 Subject: ImsServiceEntitlement default values missing ImsServiceEntitlement.* configs and their default values were added in S at commit e600a8e4e8615410f2f45a4c35f2250d6b1b32b1. Somehow the default values are missing now. Add back. Bug: 210485357 Change-Id: I98d943394ed308956c5271b8efaa5094d15dc8ca --- telephony/java/android/telephony/CarrierConfigManager.java | 1 + 1 file changed, 1 insertion(+) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 9c9e41b64892..b8a14b8ea72e 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -5794,6 +5794,7 @@ public class CarrierConfigManager { sDefaults.putInt( KEY_OPPORTUNISTIC_TIME_TO_SCAN_AFTER_CAPABILITY_SWITCH_TO_PRIMARY_LONG, 120000); + sDefaults.putAll(ImsServiceEntitlement.getDefaults()); sDefaults.putAll(Gps.getDefaults()); sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY, new int[] { -- cgit v1.2.3 From e7ca21aa12f63afcc769dc701786d0a4b3c0a935 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 8 Jan 2022 17:14:01 -0800 Subject: Fixed NPE when local or remote port range does not exist Added null check for local and remote port range. Bug: 213523984 Bug: 213139361 Test: atest QosBearerSessionTest Merged-In: I749f369c0daa5c840a77d37828f65e42262d85f5 Change-Id: I749f369c0daa5c840a77d37828f65e42262d85f5 --- .../android/telephony/data/QosBearerFilter.java | 37 +++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'telephony/java/android') diff --git a/telephony/java/android/telephony/data/QosBearerFilter.java b/telephony/java/android/telephony/data/QosBearerFilter.java index 54930d0266b7..fdb61ba6c606 100644 --- a/telephony/java/android/telephony/data/QosBearerFilter.java +++ b/telephony/java/android/telephony/data/QosBearerFilter.java @@ -18,6 +18,7 @@ package android.telephony.data; import android.annotation.IntDef; import android.annotation.NonNull; +import android.annotation.Nullable; import android.net.InetAddresses; import android.net.LinkAddress; import android.os.Parcel; @@ -38,11 +39,10 @@ import java.util.Objects; * @hide */ public final class QosBearerFilter implements Parcelable { - - private List localAddresses; - private List remoteAddresses; - private PortRange localPort; - private PortRange remotePort; + private @NonNull List localAddresses; + private @NonNull List remoteAddresses; + private @Nullable PortRange localPort; + private @Nullable PortRange remotePort; /** @hide */ @Retention(RetentionPolicy.SOURCE) @@ -59,13 +59,12 @@ public final class QosBearerFilter implements Parcelable { public static final int QOS_PROTOCOL_AH = android.hardware.radio.V1_6.QosProtocol.AH; public static final int QOS_MIN_PORT = android.hardware.radio.V1_6.QosPortRange.MIN; /** - * Hardcoded inplace of android.hardware.radio.V1_6.QosPortRange.MAX as it + * Hardcoded in place of android.hardware.radio.V1_6.QosPortRange.MAX as it * returns -1 due to uint16_t to int conversion in java. (TODO: Fix the HAL) */ public static final int QOS_MAX_PORT = 65535; // android.hardware.radio.V1_6.QosPortRange.MIN; - @QosProtocol - private int protocol; + private @QosProtocol int protocol; private int typeOfServiceMask; @@ -88,8 +87,7 @@ public final class QosBearerFilter implements Parcelable { public static final int QOS_FILTER_DIRECTION_BIDIRECTIONAL = android.hardware.radio.V1_6.QosFilterDirection.BIDIRECTIONAL; - @QosBearerFilterDirection - private int filterDirection; + private @QosBearerFilterDirection int filterDirection; /** * Specified the order in which the filter needs to be matched. @@ -106,9 +104,10 @@ public final class QosBearerFilter implements Parcelable { filterDirection = QOS_FILTER_DIRECTION_BIDIRECTIONAL; } - public QosBearerFilter(List localAddresses, List remoteAddresses, - PortRange localPort, PortRange remotePort, int protocol, int tos, - long flowLabel, long spi, int direction, int precedence) { + public QosBearerFilter(@NonNull List localAddresses, + @NonNull List remoteAddresses, @Nullable PortRange localPort, + @Nullable PortRange remotePort, @QosProtocol int protocol, int tos, long flowLabel, + long spi, @QosBearerFilterDirection int direction, int precedence) { this.localAddresses = localAddresses; this.remoteAddresses = remoteAddresses; this.localPort = localPort; @@ -121,19 +120,19 @@ public final class QosBearerFilter implements Parcelable { this.precedence = precedence; } - public List getLocalAddresses() { + public @NonNull List getLocalAddresses() { return localAddresses; } - public List getRemoteAddresses() { + public @NonNull List getRemoteAddresses() { return remoteAddresses; } - public PortRange getLocalPortRange() { + public @Nullable PortRange getLocalPortRange() { return localPort; } - public PortRange getRemotePortRange() { + public @Nullable PortRange getRemotePortRange() { return remotePort; } @@ -327,8 +326,8 @@ public final class QosBearerFilter implements Parcelable { && localAddresses.containsAll(other.localAddresses) && remoteAddresses.size() == other.remoteAddresses.size() && remoteAddresses.containsAll(other.remoteAddresses) - && localPort.equals(other.localPort) - && remotePort.equals(other.remotePort) + && Objects.equals(localPort, other.localPort) + && Objects.equals(remotePort, other.remotePort) && protocol == other.protocol && typeOfServiceMask == other.typeOfServiceMask && flowLabel == other.flowLabel -- cgit v1.2.3 From 898e2b53a7d095ed5b0fd5a17f4557021ed56e31 Mon Sep 17 00:00:00 2001 From: Michele Berionne Date: Wed, 12 Jan 2022 22:37:44 +0000 Subject: Handle setAllowedCarriers() with empty list of carriers Bug: 204136145 Test: unit testing Change-Id: I9779180ff1c3e926f97e010ca6026c5fb950046d --- telephony/java/android/telephony/TelephonyManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'telephony/java/android') 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); -- cgit v1.2.3