summaryrefslogtreecommitdiff
path: root/telephony/java/android
diff options
context:
space:
mode:
authorBrian Orr <brianorr@google.com>2021-05-13 20:42:01 -0700
committerBrian Orr <brianorr@google.com>2021-05-13 20:42:01 -0700
commit1b62159ffcebb2c102e129b2e778a8f65b7e5948 (patch)
treec28571796470b5c9e3d9e8c2dc8d49ddf819fd60 /telephony/java/android
parent86a43bb54c1ed3c75d072a2c465bf0447b5188c1 (diff)
parent3a582255fbbf0840208ec8cee02f8401982f0e39 (diff)
Merge SP1A.210510.001
Change-Id: Ia86f3e18206beabe334e3081cedbaf5b3274f78e
Diffstat (limited to 'telephony/java/android')
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java22
-rw-r--r--telephony/java/android/telephony/CellIdentityNr.java2
-rw-r--r--telephony/java/android/telephony/PhysicalChannelConfig.java10
-rw-r--r--telephony/java/android/telephony/SmsManager.java15
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java7
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java5
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java89
-rw-r--r--telephony/java/android/telephony/data/ApnSetting.java10
-rw-r--r--telephony/java/android/telephony/ims/DelegateMessageCallback.java6
-rw-r--r--telephony/java/android/telephony/ims/RcsConfig.aidl19
-rw-r--r--telephony/java/android/telephony/ims/RcsConfig.java285
-rw-r--r--telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java8
-rw-r--r--telephony/java/android/telephony/ims/SipDelegateManager.java41
-rw-r--r--telephony/java/android/telephony/ims/feature/RcsFeature.java14
14 files changed, 338 insertions, 195 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 6acc8ab991d3..6c1ad688dfee 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -4322,6 +4322,26 @@ public class CarrierConfigManager {
public static final String KEY_RCS_FEATURE_TAG_ALLOWED_STRING_ARRAY =
KEY_PREFIX + "rcs_feature_tag_allowed_string_array";
+ /**
+ * Flag indicating whether or not carrier forbids device send the RCS request when the
+ * device receive the network response with the SIP code 489 BAD EVENT.
+ * <p>
+ * The default value for this key is {@code false}.
+ * @hide
+ */
+ public static final String KEY_RCS_REQUEST_FORBIDDEN_BY_SIP_489_BOOL =
+ KEY_PREFIX + "rcs_request_forbidden_by_sip_489_bool";
+
+ /**
+ * Indicates the interval that SUBSCRIBE requests from applications will be retried at when
+ * the carrier network has responded to a previous request with a forbidden error.
+ * <p>
+ * The default value for this key is 20 minutes.
+ * @hide
+ */
+ public static final String KEY_RCS_REQUEST_RETRY_INTERVAL_MILLIS_LONG =
+ KEY_PREFIX + "rcs_request_retry_interval_millis_long";
+
private Ims() {}
private static PersistableBundle getDefaults() {
@@ -4335,6 +4355,8 @@ public class CarrierConfigManager {
defaults.putBoolean(KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL, false);
defaults.putBoolean(KEY_ENABLE_PRESENCE_GROUP_SUBSCRIBE_BOOL, true);
defaults.putInt(KEY_NON_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC_INT, 30 * 24 * 60 * 60);
+ defaults.putBoolean(KEY_RCS_REQUEST_FORBIDDEN_BY_SIP_489_BOOL, false);
+ defaults.putLong(KEY_RCS_REQUEST_RETRY_INTERVAL_MILLIS_LONG, 20 * 60 * 1000);
defaults.putStringArray(KEY_RCS_FEATURE_TAG_ALLOWED_STRING_ARRAY, new String[]{
"+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg\"",
"+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.largemsg\"",
diff --git a/telephony/java/android/telephony/CellIdentityNr.java b/telephony/java/android/telephony/CellIdentityNr.java
index cdd54cd25311..4f5052151af5 100644
--- a/telephony/java/android/telephony/CellIdentityNr.java
+++ b/telephony/java/android/telephony/CellIdentityNr.java
@@ -233,7 +233,7 @@ public final class CellIdentityNr extends CellIdentity {
}
/**
- * @return Mobile Network Code in string fomrat, or {@code null} if unknown.
+ * @return Mobile Network Code in string format, or {@code null} if unknown.
*/
@Nullable
public String getMncString() {
diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java
index 3b2861600b56..8df41fb6b288 100644
--- a/telephony/java/android/telephony/PhysicalChannelConfig.java
+++ b/telephony/java/android/telephony/PhysicalChannelConfig.java
@@ -183,16 +183,6 @@ public final class PhysicalChannelConfig implements Parcelable {
}
/**
- * @return the absolute radio frequency channel number for this physical channel,
- * {@link #CHANNEL_NUMBER_UNKNOWN} if unknown.
- * @deprecated Use {@link #getDownlinkChannelNumber()} to get the channel number.
- */
- @Deprecated
- public int getChannelNumber() {
- return getDownlinkChannelNumber();
- }
-
- /**
* @return the rough frequency range for this physical channel,
* {@link ServiceState#FREQUENCY_RANGE_UNKNOWN} if unknown.
* @see {@link ServiceState#FREQUENCY_RANGE_LOW}
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 6ad26250d3e3..e9796083a270 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -452,9 +452,6 @@ public final class SmsManager {
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
* the sentIntent may include the extra "errorCode" containing a radio technology specific
* value, generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
@@ -569,9 +566,6 @@ public final class SmsManager {
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
* the sentIntent may include the extra "errorCode" containing a radio technology specific
* value, generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
@@ -971,9 +965,6 @@ public final class SmsManager {
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
* the sentIntent may include the extra "errorCode" containing a radio technology specific
* value, generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntents if not null, an <code>ArrayList</code> of
* <code>PendingIntent</code>s (one for each message part) that is
* broadcast when the corresponding message part has been delivered
@@ -1230,9 +1221,6 @@ public final class SmsManager {
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
* the sentIntent may include the extra "errorCode" containing a radio technology specific
* value, generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntents if not null, an <code>ArrayList</code> of
* <code>PendingIntent</code>s (one for each message part) that is
* broadcast when the corresponding message part has been delivered
@@ -1431,9 +1419,6 @@ public final class SmsManager {
* For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
* the sentIntent may include the extra "errorCode" containing a radio technology specific
* value, generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
* @param deliveryIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is delivered to the recipient. The
* raw pdu of the status report is in the extended data ("pdu").
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index 4004e37dc4e0..21bb43cb6f32 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -572,6 +572,13 @@ public class SubscriptionInfo implements Parcelable {
/**
* @hide
*/
+ public void clearGroupUuid() {
+ this.mGroupUUID = null;
+ }
+
+ /**
+ * @hide
+ */
public List<String> getEhplmns() {
return mEhplmns == null ? Collections.emptyList() : Arrays.asList(mEhplmns);
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 2616ec8cc04f..114c90bbd87a 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -3402,7 +3402,10 @@ public class SubscriptionManager {
* Set uicc applications being enabled or disabled.
* The value will be remembered on the subscription and will be applied whenever it's present.
* If the subscription in currently present, it will also apply the setting to modem
- * immediately.
+ * immediately (the setting in the modem will not change until the modem receives and responds
+ * to the request, but typically this should only take a few seconds. The user visible setting
+ * available from SubscriptionInfo.areUiccApplicationsEnabled() will be updated
+ * immediately.)
*
* Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
*
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 931915f55960..c2d827773b75 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1936,11 +1936,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
@@ -1989,11 +1987,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
@@ -2059,11 +2055,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
@@ -2139,11 +2133,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
@@ -2177,11 +2169,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}) on any
* active subscription.
* <li>If the calling app is the default SMS role holder (see {@link
@@ -2261,11 +2251,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
@@ -2298,11 +2286,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
@@ -3786,11 +3772,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
@@ -3824,11 +3808,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
@@ -4079,11 +4061,9 @@ public class TelephonyManager {
* <ul>
* <li>If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this
* is a privileged permission that can only be granted to apps preloaded on the device.
- * <li>If the calling app is the device or profile owner and has been granted the
- * {@link Manifest.permission#READ_PHONE_STATE} permission. The profile owner is an app that
- * owns a managed profile on the device; for more details see <a
- * href="https://developer.android.com/work/managed-profiles">Work profiles</a>.
- * Profile owner access is deprecated and will be removed in a future release.
+ * <li>If the calling app is the device owner of a fully-managed device, a profile
+ * owner of an organization-owned device, or their delegates (see {@link
+ * android.app.admin.DevicePolicyManager#getEnrollmentSpecificId()}).
* <li>If the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
* <li>If the calling app is the default SMS role holder (see {@link
* RoleManager#isRoleHeld(String)}).
@@ -15042,6 +15022,15 @@ public class TelephonyManager {
"CAPABILITY_SLICING_CONFIG_SUPPORTED";
/**
+ * Indicates whether PHYSICAL_CHANNEL_CONFIG HAL1.6 is supported. See comments on
+ * respective methods for more information.
+ *
+ * @hide
+ */
+ public static final String CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED =
+ "CAPABILITY_PHYSICAL_CHANNEL_CONFIG_1_6_SUPPORTED";
+
+ /**
* A list of the radio interface capability values with public valid constants.
*
* Here is a related list for the systemapi-only valid constants:
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 7e84b372ae83..a81050bc3f38 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -1568,16 +1568,6 @@ public class ApnSetting implements Parcelable {
}
/**
- * Same as {@link #getApnTypeString(int)}, but returns "Unknown" instead of an empty string
- * when provided with an invalid int for compatibility purposes.
- * @hide
- */
- public static @NonNull String getApnTypeStringInternal(@ApnType int apnType) {
- String result = getApnTypeString(apnType);
- return TextUtils.isEmpty(result) ? "Unknown" : result;
- }
-
- /**
* Converts the string representation of an APN type to its integer representation.
*
* @param apnType APN type as a string
diff --git a/telephony/java/android/telephony/ims/DelegateMessageCallback.java b/telephony/java/android/telephony/ims/DelegateMessageCallback.java
index 0d82a54a0f32..a008cfdbc535 100644
--- a/telephony/java/android/telephony/ims/DelegateMessageCallback.java
+++ b/telephony/java/android/telephony/ims/DelegateMessageCallback.java
@@ -35,12 +35,12 @@ import android.telephony.ims.stub.SipDelegate;
public interface DelegateMessageCallback {
/**
- * Send a new incoming SIP message to the remote application for processing.
+ * Sends a new incoming SIP message to the remote application for processing.
*/
void onMessageReceived(@NonNull SipMessage message);
/**
- * Notify the remote application that a previous request to send a SIP message using
+ * Notifies the remote application that a previous request to send a SIP message using
* {@link SipDelegate#sendMessage} has succeeded.
*
* @param viaTransactionId The transaction ID found in the via header field of the
@@ -49,7 +49,7 @@ public interface DelegateMessageCallback {
void onMessageSent(@NonNull String viaTransactionId);
/**
- * Notify the remote application that a previous request to send a SIP message using
+ * Notifies the remote application that a previous request to send a SIP message using
* {@link SipDelegate#sendMessage} has failed.
*
* @param viaTransactionId The Transaction ID found in the via header field of the previously
diff --git a/telephony/java/android/telephony/ims/RcsConfig.aidl b/telephony/java/android/telephony/ims/RcsConfig.aidl
deleted file mode 100644
index cfd93fbe2edb..000000000000
--- a/telephony/java/android/telephony/ims/RcsConfig.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telephony.ims;
-
-parcelable RcsConfig;
diff --git a/telephony/java/android/telephony/ims/RcsConfig.java b/telephony/java/android/telephony/ims/RcsConfig.java
index d7c3f98fa997..fd8d8a76353b 100644
--- a/telephony/java/android/telephony/ims/RcsConfig.java
+++ b/telephony/java/android/telephony/ims/RcsConfig.java
@@ -22,10 +22,10 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.os.Build;
-import android.os.Parcel;
-import android.os.Parcelable;
import android.provider.Telephony.SimInfo;
import android.text.TextUtils;
+import android.util.ArrayMap;
+import android.util.ArraySet;
import com.android.telephony.Rlog;
@@ -36,7 +36,9 @@ import org.xmlpull.v1.XmlPullParserFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -44,27 +46,138 @@ import java.util.zip.GZIPOutputStream;
* RCS config data and methods to process the config
* @hide
*/
-public final class RcsConfig implements Parcelable {
+public final class RcsConfig {
private static final String LOG_TAG = "RcsConfig";
private static final boolean DBG = Build.IS_ENG;
// Tag and attribute defined in RCC.07 A.2
+ private static final String TAG_CHARACTERISTIC = "characteristic";
private static final String TAG_PARM = "parm";
+ private static final String ATTRIBUTE_TYPE = "type";
private static final String ATTRIBUTE_NAME = "name";
private static final String ATTRIBUTE_VALUE = "value";
// Keyword for Rcs Volte single registration defined in RCC.07 A.1.6.2
private static final String PARM_SINGLE_REGISTRATION = "rcsVolteSingleRegistration";
- private final HashMap<String, String> mValues = new HashMap<>();
+ /**
+ * Characteristic of the RCS provisioning config
+ */
+ public static class Characteristic {
+ private String mType;
+ private final Map<String, String> mParms = new ArrayMap<>();
+ private final Set<Characteristic> mSubs = new ArraySet<>();
+ private final Characteristic mParent;
+
+ private Characteristic(String type, Characteristic parent) {
+ mType = type;
+ mParent = parent;
+ }
+
+ private String getType() {
+ return mType;
+ }
+
+ private Map<String, String> getParms() {
+ return mParms;
+ }
+
+ private Set<Characteristic> getSubs() {
+ return mSubs;
+ }
+
+ private Characteristic getParent() {
+ return mParent;
+ }
+
+ private Characteristic getSubByType(String type) {
+ if (TextUtils.equals(mType, type)) {
+ return this;
+ }
+ Characteristic result = null;
+ for (Characteristic sub : mSubs) {
+ result = sub.getSubByType(type);
+ if (result != null) {
+ break;
+ }
+ }
+ return result;
+ }
- private RcsConfig(HashMap<String, String> values) {
- mValues.putAll(values);
+ private boolean hasSubByType(String type) {
+ return getSubByType(type) != null;
+ }
+
+ private String getParmValue(String name) {
+ String value = mParms.get(name);
+ if (value == null) {
+ for (Characteristic sub : mSubs) {
+ value = sub.getParmValue(name);
+ if (value != null) {
+ break;
+ }
+ }
+ }
+ return value;
+ }
+
+ boolean hasParm(String name) {
+ if (mParms.containsKey(name)) {
+ return true;
+ }
+
+ for (Characteristic sub : mSubs) {
+ if (sub.hasParm(name)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("[" + mType + "]: ");
+ if (DBG) {
+ sb.append(mParms);
+ }
+ for (Characteristic sub : mSubs) {
+ sb.append("\n");
+ sb.append(sub.toString().replace("\n", "\n\t"));
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Characteristic)) {
+ return false;
+ }
+
+ Characteristic o = (Characteristic) obj;
+
+ return TextUtils.equals(mType, o.mType) && mParms.equals(o.mParms)
+ && mSubs.equals(o.mSubs);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mType, mParms, mSubs);
+ }
}
+ private final Characteristic mRoot;
+ private Characteristic mCurrent;
+ private final byte[] mData;
+
public RcsConfig(byte[] data) throws IllegalArgumentException {
if (data == null || data.length == 0) {
throw new IllegalArgumentException("Empty data");
}
+ mRoot = new Characteristic(null, null);
+ mCurrent = mRoot;
+ mData = data;
+ Characteristic current = mRoot;
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
@@ -73,36 +186,51 @@ public final class RcsConfig implements Parcelable {
xpp.setInput(inputStream, null);
int eventType = xpp.getEventType();
String tag = null;
- while (eventType != XmlPullParser.END_DOCUMENT) {
+ while (eventType != XmlPullParser.END_DOCUMENT && current != null) {
if (eventType == XmlPullParser.START_TAG) {
tag = xpp.getName().trim().toLowerCase();
- if (tag.equals(TAG_PARM)) {
+ if (TAG_CHARACTERISTIC.equals(tag)) {
+ int count = xpp.getAttributeCount();
+ String type = null;
+ if (count > 0) {
+ for (int i = 0; i < count; i++) {
+ String name = xpp.getAttributeName(i).trim().toLowerCase();
+ if (ATTRIBUTE_TYPE.equals(name)) {
+ type = xpp.getAttributeValue(xpp.getAttributeNamespace(i),
+ name).trim().toLowerCase();
+ break;
+ }
+ }
+ }
+ Characteristic next = new Characteristic(type, current);
+ current.getSubs().add(next);
+ current = next;
+ } else if (TAG_PARM.equals(tag)) {
int count = xpp.getAttributeCount();
String key = null;
String value = null;
if (count > 1) {
for (int i = 0; i < count; i++) {
String name = xpp.getAttributeName(i).trim().toLowerCase();
- if (name.equals(ATTRIBUTE_NAME)) {
+ if (ATTRIBUTE_NAME.equals(name)) {
key = xpp.getAttributeValue(xpp.getAttributeNamespace(i),
name).trim().toLowerCase();
- } else if (name.equals(ATTRIBUTE_VALUE)) {
+ } else if (ATTRIBUTE_VALUE.equals(name)) {
value = xpp.getAttributeValue(xpp.getAttributeNamespace(i),
name).trim();
}
}
}
if (key != null && value != null) {
- mValues.put(key, value);
+ current.getParms().put(key, value);
}
}
} else if (eventType == XmlPullParser.END_TAG) {
- tag = null;
- } else if (eventType == XmlPullParser.TEXT) {
- String value = xpp.getText().trim();
- if (!TextUtils.isEmpty(tag) && !TextUtils.isEmpty(value)) {
- mValues.put(tag, value);
+ tag = xpp.getName().trim().toLowerCase();
+ if (TAG_CHARACTERISTIC.equals(tag)) {
+ current = current.getParent();
}
+ tag = null;
}
eventType = xpp.next();
}
@@ -126,8 +254,8 @@ public final class RcsConfig implements Parcelable {
* @return Returns the config value if it exists, or defaultVal.
*/
public @Nullable String getString(@NonNull String tag, @Nullable String defaultVal) {
- tag = tag.trim().toLowerCase();
- return mValues.containsKey(tag) ? mValues.get(tag) : defaultVal;
+ String value = mCurrent.getParmValue(tag.trim().toLowerCase());
+ return value != null ? value : defaultVal;
}
/**
@@ -139,9 +267,8 @@ public final class RcsConfig implements Parcelable {
* @return Returns the config value if it exists and is a valid int, or defaultVal.
*/
public int getInteger(@NonNull String tag, int defaultVal) {
- tag = tag.trim().toLowerCase();
try {
- return Integer.parseInt(mValues.get(tag));
+ return Integer.parseInt(getString(tag, null));
} catch (NumberFormatException e) {
logd("error to getInteger for " + tag + " due to " + e);
}
@@ -157,11 +284,8 @@ public final class RcsConfig implements Parcelable {
* @return Returns the config value if it exists, or defaultVal.
*/
public boolean getBoolean(@NonNull String tag, boolean defaultVal) {
- tag = tag.trim().toLowerCase();
- if (!mValues.containsKey(tag)) {
- return defaultVal;
- }
- return Boolean.parseBoolean(mValues.get(tag));
+ String value = getString(tag, null);
+ return value != null ? Boolean.parseBoolean(value) : defaultVal;
}
/**
@@ -172,15 +296,70 @@ public final class RcsConfig implements Parcelable {
* @return Returns true if it exists, or false.
*/
public boolean hasConfig(@NonNull String tag) {
- return mValues.containsKey(tag.trim().toLowerCase());
+ return mCurrent.hasParm(tag.trim().toLowerCase());
+ }
+
+ /**
+ * Return the Characteristic with the given type
+ */
+ public @Nullable Characteristic getCharacteristic(@NonNull String type) {
+ return mCurrent.getSubByType(type.trim().toLowerCase());
+ }
+
+ /**
+ * Check whether the Characteristic with the given type exists
+ */
+ public boolean hasCharacteristic(@NonNull String type) {
+ return mCurrent.getSubByType(type.trim().toLowerCase()) != null;
+ }
+
+ /**
+ * Set current Characteristic to given Characteristic
+ */
+ public void setCurrentCharacteristic(@NonNull Characteristic current) {
+ if (current != null) {
+ mCurrent = current;
+ }
+ }
+
+ /**
+ * Move current Characteristic to parent layer
+ */
+ public boolean moveToParent() {
+ if (mCurrent.getParent() == null) {
+ return false;
+ }
+ mCurrent = mCurrent.getParent();
+ return true;
+ }
+
+ /**
+ * Move current Characteristic to the root
+ */
+ public void moveToRoot() {
+ mCurrent = mRoot;
+ }
+
+ /**
+ * Return root Characteristic
+ */
+ public @NonNull Characteristic getRoot() {
+ return mRoot;
+ }
+
+ /**
+ * Return current Characteristic
+ */
+ public @NonNull Characteristic getCurrentCharacteristic() {
+ return mCurrent;
}
/**
* Check whether Rcs Volte single registration is supported by the config.
*/
- public boolean isRcsVolteSingleRegistrationSupported() {
- return getBoolean(PARM_SINGLE_REGISTRATION, false)
- || getInteger(PARM_SINGLE_REGISTRATION, 0) != 0;
+ public boolean isRcsVolteSingleRegistrationSupported(boolean isRoaming) {
+ int val = getInteger(PARM_SINGLE_REGISTRATION, 1);
+ return isRoaming ? val == 1 : val > 0;
}
@Override
@@ -188,12 +367,10 @@ public final class RcsConfig implements Parcelable {
final StringBuilder sb = new StringBuilder();
sb.append("[RCS Config]");
if (DBG) {
- mValues.forEach((t, v) -> {
- sb.append("\n");
- sb.append(t);
- sb.append(" : ");
- sb.append(v);
- });
+ sb.append("=== Root ===\n");
+ sb.append(mRoot);
+ sb.append("=== Current ===\n");
+ sb.append(mCurrent);
}
return sb.toString();
}
@@ -206,12 +383,12 @@ public final class RcsConfig implements Parcelable {
RcsConfig other = (RcsConfig) obj;
- return mValues.equals(other.mValues);
+ return mRoot.equals(other.mRoot) && mCurrent.equals(other.mCurrent);
}
@Override
public int hashCode() {
- return mValues.hashCode();
+ return Objects.hash(mRoot, mCurrent);
}
/**
@@ -302,38 +479,6 @@ public final class RcsConfig implements Parcelable {
return isCompressed ? data : decompressGzip(data);
}
- /**
- * {@link Parcelable#writeToParcel}
- */
- public void writeToParcel(@NonNull Parcel out, int flags) {
- out.writeMap(mValues);
- }
-
- /**
- * {@link Parcelable.Creator}
- *
- */
- public static final @NonNull Parcelable.Creator<RcsConfig>
- CREATOR = new Creator<RcsConfig>() {
- @Override
- public RcsConfig createFromParcel(Parcel in) {
- HashMap<String, String> values = in.readHashMap(null);
- return values == null ? null : new RcsConfig(values);
- }
-
- @Override
- public RcsConfig[] newArray(int size) {
- return new RcsConfig[size];
- }
- };
-
- /**
- * {@link Parcelable#describeContents}
- */
- public int describeContents() {
- return 0;
- }
-
private static void logd(String msg) {
Rlog.d(LOG_TAG, msg);
}
diff --git a/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java b/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
index ffbfde65e2d3..08513c23291a 100644
--- a/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
+++ b/telephony/java/android/telephony/ims/SipDelegateImsConfiguration.java
@@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
+import android.text.TextUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -561,7 +562,12 @@ public final class SipDelegateImsConfiguration implements Parcelable {
builder.setSipCniHeader(getString(KEY_SIP_CONFIG_CELLULAR_NETWORK_INFO_HEADER_STRING));
builder.setSipAssociatedUriHeader(getString(KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING));
if (getBoolean(KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false)) {
- builder.setPublicGruuUri(Uri.parse(getString(KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING)));
+ String uri = getString(KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING);
+ Uri gruuUri = null;
+ if (!TextUtils.isEmpty(uri)) {
+ gruuUri = Uri.parse(uri);
+ }
+ builder.setPublicGruuUri(gruuUri);
}
if (getBoolean(KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL, false)) {
builder.setIpSecConfiguration(new SipDelegateConfiguration.IpSecConfiguration(
diff --git a/telephony/java/android/telephony/ims/SipDelegateManager.java b/telephony/java/android/telephony/ims/SipDelegateManager.java
index ca01d0f664db..5a8066320e99 100644
--- a/telephony/java/android/telephony/ims/SipDelegateManager.java
+++ b/telephony/java/android/telephony/ims/SipDelegateManager.java
@@ -34,6 +34,7 @@ import android.telephony.ims.aidl.SipDelegateConnectionAidlWrapper;
import android.telephony.ims.stub.DelegateConnectionMessageCallback;
import android.telephony.ims.stub.DelegateConnectionStateCallback;
import android.telephony.ims.stub.SipDelegate;
+import android.util.ArrayMap;
import com.android.internal.annotations.VisibleForTesting;
@@ -80,13 +81,18 @@ public class SipDelegateManager {
public static final int MESSAGE_FAILURE_REASON_DELEGATE_CLOSED = 2;
/**
- * The SIP message has an invalid start line and the message can not be sent.
+ * The SIP message has an invalid start line and the message can not be sent or the start line
+ * failed validation due to the request containing a restricted SIP request method.
+ * {@link SipDelegateConnection}s can not send SIP requests for the methods: REGISTER, PUBLISH,
+ * or OPTIONS.
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_START_LINE = 3;
/**
* One or more of the header fields in the header section of the outgoing SIP message is invalid
- * and the SIP message can not be sent.
+ * or contains a restricted header value and the SIP message can not be sent.
+ * {@link SipDelegateConnection}s can not send SIP SUBSCRIBE requests for the "Event" header
+ * value of "presence".
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS = 4;
@@ -97,7 +103,7 @@ public class SipDelegateManager {
/**
* The feature tag associated with the outgoing message does not match any known feature tags
- * and this message can not be sent.
+ * or it matches a denied tag and this message can not be sent.
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_FEATURE_TAG = 6;
@@ -163,6 +169,35 @@ public class SipDelegateManager {
})
public @interface MessageFailureReason {}
+ /**@hide*/
+ public static final ArrayMap<Integer, String> MESSAGE_FAILURE_REASON_STRING_MAP =
+ new ArrayMap<>(11);
+ static {
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_UNKNOWN,
+ "MESSAGE_FAILURE_REASON_UNKNOWN");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_DELEGATE_DEAD,
+ "MESSAGE_FAILURE_REASON_DELEGATE_DEAD");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_DELEGATE_CLOSED,
+ "MESSAGE_FAILURE_REASON_DELEGATE_CLOSED");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS,
+ "MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT,
+ "MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_INVALID_FEATURE_TAG,
+ "MESSAGE_FAILURE_REASON_INVALID_FEATURE_TAG");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(
+ MESSAGE_FAILURE_REASON_TAG_NOT_ENABLED_FOR_DELEGATE,
+ "MESSAGE_FAILURE_REASON_TAG_NOT_ENABLED_FOR_DELEGATE");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE,
+ "MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_NOT_REGISTERED,
+ "MESSAGE_FAILURE_REASON_NOT_REGISTERED");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(MESSAGE_FAILURE_REASON_STALE_IMS_CONFIGURATION,
+ "MESSAGE_FAILURE_REASON_STALE_IMS_CONFIGURATION");
+ MESSAGE_FAILURE_REASON_STRING_MAP.append(
+ MESSAGE_FAILURE_REASON_INTERNAL_DELEGATE_STATE_TRANSITION,
+ "MESSAGE_FAILURE_REASON_INTERNAL_DELEGATE_STATE_TRANSITION");
+ }
/**
* Access to use this feature tag has been denied for an unknown reason.
diff --git a/telephony/java/android/telephony/ims/feature/RcsFeature.java b/telephony/java/android/telephony/ims/feature/RcsFeature.java
index ddd6fbe38cf4..18cc37d7fbda 100644
--- a/telephony/java/android/telephony/ims/feature/RcsFeature.java
+++ b/telephony/java/android/telephony/ims/feature/RcsFeature.java
@@ -398,16 +398,6 @@ public class RcsFeature extends ImsFeature {
/**
* Remove the given CapabilityExchangeImplBase instance.
- * @param capExchangeImpl The {@link RcsCapabilityExchangeImplBase} instance to be removed.
- * @hide
- */
- public void removeCapabilityExchangeImpl(
- @NonNull RcsCapabilityExchangeImplBase capExchangeImpl) {
- // Override to implement the process of removing RcsCapabilityExchangeImplBase instance.
- }
-
- /**
- * Remove the given CapabilityExchangeImplBase instance.
* @param capExchangeImpl The {@link RcsCapabilityExchangeImplBase} instance to be destroyed.
*/
public void destroyCapabilityExchangeImpl(
@@ -450,7 +440,7 @@ public class RcsFeature extends ImsFeature {
// Remove the RcsCapabilityExchangeImplBase instance when the capability exchange
// instance has been removed in the framework.
if (mCapabilityExchangeImpl != null) {
- removeCapabilityExchangeImpl(mCapabilityExchangeImpl);
+ destroyCapabilityExchangeImpl(mCapabilityExchangeImpl);
}
mCapabilityExchangeImpl = null;
}
@@ -468,7 +458,7 @@ public class RcsFeature extends ImsFeature {
synchronized (mLock) {
// Remove the original instance
if (mCapabilityExchangeImpl != null) {
- removeCapabilityExchangeImpl(mCapabilityExchangeImpl);
+ destroyCapabilityExchangeImpl(mCapabilityExchangeImpl);
}
mCapabilityExchangeImpl = createCapabilityExchangeImpl(listener);
}