summaryrefslogtreecommitdiff
path: root/telephony
diff options
context:
space:
mode:
Diffstat (limited to 'telephony')
-rw-r--r--telephony/common/com/android/internal/telephony/TelephonyPermissions.java21
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java69
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java9
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java9
-rw-r--r--telephony/java/android/telephony/TelephonyScanManager.java35
-rw-r--r--telephony/java/android/telephony/data/QosBearerFilter.java37
6 files changed, 135 insertions, 45 deletions
diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
index 4d81b5e54470..7a424c87d1d6 100644
--- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java
@@ -308,6 +308,12 @@ public final class TelephonyPermissions {
return checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
context, subId, callingPackage, callingFeatureId, message, false, reportFailure);
}
+
+ private static void throwSecurityExceptionAsUidDoesNotHaveAccess(String message, int uid) {
+ throw new SecurityException(message + ": The uid " + uid
+ + " does not meet the requirements to access device identifiers.");
+ }
+
/**
* Checks whether the app with the given pid/uid can read device identifiers.
*
@@ -343,9 +349,14 @@ public final class TelephonyPermissions {
LegacyPermissionManager permissionManager = (LegacyPermissionManager)
context.getSystemService(Context.LEGACY_PERMISSION_SERVICE);
- if (permissionManager.checkDeviceIdentifierAccess(callingPackage, message, callingFeatureId,
- pid, uid) == PackageManager.PERMISSION_GRANTED) {
- return true;
+ try {
+ if (permissionManager.checkDeviceIdentifierAccess(callingPackage, message,
+ callingFeatureId,
+ pid, uid) == PackageManager.PERMISSION_GRANTED) {
+ return true;
+ }
+ } catch (SecurityException se) {
+ throwSecurityExceptionAsUidDoesNotHaveAccess(message, uid);
}
if (reportFailure) {
@@ -410,8 +421,8 @@ public final class TelephonyPermissions {
return false;
}
}
- throw new SecurityException(message + ": The user " + uid
- + " does not meet the requirements to access device identifiers.");
+ throwSecurityExceptionAsUidDoesNotHaveAccess(message, uid);
+ return true;
}
/**
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index fb8255133c7e..eb21d6b379eb 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1938,6 +1938,20 @@ public class CarrierConfigManager {
"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.
*
@@ -3616,6 +3630,17 @@ public class CarrierConfigManager {
"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.
*
@@ -3931,6 +3956,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
@@ -5249,6 +5298,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
*
* @hide
@@ -5690,6 +5749,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);
@@ -5785,6 +5845,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);
@@ -5838,6 +5899,11 @@ 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(ImsServiceEntitlement.getDefaults());
sDefaults.putAll(Gps.getDefaults());
sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY,
new int[] {
@@ -5909,7 +5975,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.putStringArray(KEY_MULTI_APN_ARRAY_FOR_SAME_GID, new String[] {
"52FF:mms,supl,hipri,default,fota:SA:nrphone",
"52FF:mms,supl,hipri,default,fota:NSA:nxtgenphone",
@@ -5930,6 +5996,7 @@ public class CarrierConfigManager {
});
sDefaults.putBoolean(KEY_REQUIRE_APN_FILTERING_WITH_RADIO_CAPABILITY, false);
sDefaults.putBoolean(KEY_USE_SMS_CALLBACK_MODE_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
@@ -949,6 +949,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
*/
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index ba0d6afe25a4..943e5072775b 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -11933,12 +11933,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);
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:
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<LinkAddress> localAddresses;
- private List<LinkAddress> remoteAddresses;
- private PortRange localPort;
- private PortRange remotePort;
+ private @NonNull List<LinkAddress> localAddresses;
+ private @NonNull List<LinkAddress> 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<LinkAddress> localAddresses, List<LinkAddress> remoteAddresses,
- PortRange localPort, PortRange remotePort, int protocol, int tos,
- long flowLabel, long spi, int direction, int precedence) {
+ public QosBearerFilter(@NonNull List<LinkAddress> localAddresses,
+ @NonNull List<LinkAddress> 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<LinkAddress> getLocalAddresses() {
+ public @NonNull List<LinkAddress> getLocalAddresses() {
return localAddresses;
}
- public List<LinkAddress> getRemoteAddresses() {
+ public @NonNull List<LinkAddress> 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