From 33437bd046e6d93d443c48c6769ccce8bb8052c7 Mon Sep 17 00:00:00 2001 From: Brad Ebinger Date: Fri, 29 Jan 2021 00:53:26 +0000 Subject: [PATCH] Define FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION feature Define a new feature that determines if a device supports IMS single registration and integrate this feature tag into the SIP transport and provisioning APIs. Bug: 149426399 Bug: 173715911 Test: atest CtsTelephonyTestCases FrameworksTelephonyTests Change-Id: Id9ac6a3a69be2072cf28136e98408118b7d9f07f --- core/api/system-current.txt | 1 + .../android/content/pm/PackageManager.java | 38 +++++++++++++++++++ .../telephony/ims/ProvisioningManager.java | 21 +++++----- .../telephony/ims/SipDelegateManager.java | 5 +++ 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 242c7375b1fd7..6f4206adc5671 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -2117,6 +2117,7 @@ package android.content.pm { field public static final String FEATURE_INCREMENTAL_DELIVERY = "android.software.incremental_delivery"; field public static final String FEATURE_REBOOT_ESCROW = "android.hardware.reboot_escrow"; field public static final String FEATURE_TELEPHONY_CARRIERLOCK = "android.hardware.telephony.carrierlock"; + field public static final String FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION = "android.hardware.telephony.ims.singlereg"; field public static final int FLAGS_PERMISSION_RESERVED_PERMISSION_CONTROLLER = -268435456; // 0xf0000000 field public static final int FLAG_PERMISSION_APPLY_RESTRICTION = 16384; // 0x4000 field public static final int FLAG_PERMISSION_AUTO_REVOKED = 131072; // 0x20000 diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 00f5fb95768fe..28d6c8d9ae03d 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -59,6 +59,7 @@ import android.content.res.XmlResourceParser; import android.graphics.Rect; import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.Drawable; +import android.net.ConnectivityManager; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; @@ -71,6 +72,12 @@ import android.os.incremental.IncrementalManager; import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; import android.permission.PermissionManager; +import android.telephony.TelephonyManager; +import android.telephony.gba.GbaService; +import android.telephony.ims.ImsService; +import android.telephony.ims.ProvisioningManager; +import android.telephony.ims.RcsUceAdapter; +import android.telephony.ims.SipDelegateManager; import android.util.AndroidException; import android.util.Log; @@ -2569,6 +2576,37 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; + /** + * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: The device + * supports a single IMS registration as defined by carrier networks in the IMS service + * implementation using the {@link ImsService} API, {@link GbaService} API, and IRadio 1.6 HAL. + *

+ * When set, the device must fully support the following APIs for an application to implement + * IMS single registration: + *

+ *

+ * This feature should only be defined if {@link #FEATURE_TELEPHONY_IMS} is also defined. + * @hide + */ + @SystemApi + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION = + "android.hardware.telephony.ims.singlereg"; + /** * Feature for {@link #getSystemAvailableFeatures} and * {@link #hasSystemFeature}: The device is capable of communicating with diff --git a/telephony/java/android/telephony/ims/ProvisioningManager.java b/telephony/java/android/telephony/ims/ProvisioningManager.java index f3c38bcba98a9..08eec29d5ac2f 100644 --- a/telephony/java/android/telephony/ims/ProvisioningManager.java +++ b/telephony/java/android/telephony/ims/ProvisioningManager.java @@ -25,6 +25,7 @@ import android.annotation.SdkConstant; import android.annotation.StringDef; import android.annotation.SystemApi; import android.annotation.WorkerThread; +import android.content.pm.PackageManager; import android.os.Binder; import android.os.RemoteException; import android.os.ServiceSpecificException; @@ -1325,7 +1326,7 @@ public class ProvisioningManager { * the RCS VoLTE single registration feature. Only default messaging application may receive * the intent. * - *

Contains {@link #EXTRA_SUBSCRIPTION_INDEX} to specify the subscription index for which + *

Contains {@link #EXTRA_SUBSCRIPTION_ID} to specify the subscription index for which * the intent is valid. and {@link #EXTRA_STATUS} to specify RCS VoLTE single registration * status. */ @@ -1371,7 +1372,7 @@ public class ProvisioningManager { * provisioning is done using autoconfiguration, then these parameters shall be * sent in the HTTP get request to fetch the RCS provisioning. RCS client * configuration must be provided by the application before registering for the - * provisioning status events {@link #registerRcsProvisioningChangedCallback()} + * provisioning status events {@link #registerRcsProvisioningChangedCallback} * @param rcc RCS client configuration {@link RcsClientConfiguration} */ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @@ -1387,13 +1388,15 @@ public class ProvisioningManager { } /** - * Returns a flag to indicate if the device software and the carrier - * have the capability to support RCS Volte single IMS registration. - * @return true if this single registration is capable, false otherwise + * Returns a flag to indicate whether or not the device supports IMS single registration for + * MMTEL and RCS features as well as if the carrier has provisioned the feature. + * @return true if IMS single registration is capable at this time, or false otherwise * @throws ImsException If the remote ImsService is not available for * any reason or the subscription associated with this instance is no * longer active. See {@link ImsException#getCode()} for more * information. + * @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION for whether or not this + * device supports IMS single registration. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isRcsVolteSingleRegistrationCapable() throws ImsException { @@ -1430,7 +1433,7 @@ public class ProvisioningManager { * available. This can happen if the service crashed, for example. * It shall also throw this exception when the RCS client parameters for the * application are not valid. In that case application must set the client - * params (See {@link #setRcsClientConfiguration()}) and re register the + * params (See {@link #setRcsClientConfiguration}) and re register the * callback. * See {@link ImsException#getCode()} for a more detailed reason. */ @@ -1458,9 +1461,9 @@ public class ProvisioningManager { * will result in a no-op. * @param callback The existing {@link RcsProvisioningCallback} to be * removed. - * @see #registerRcsProvisioningChangedCallback(RcsClientConfiguration, - * Executor, RcsProvisioningCallback) @throws IllegalArgumentException - * if the subscription associated with this callback is invalid. + * @see #registerRcsProvisioningChangedCallback + * @throws IllegalArgumentException if the subscription associated with this callback is + * invalid. */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterRcsProvisioningChangedCallback( diff --git a/telephony/java/android/telephony/ims/SipDelegateManager.java b/telephony/java/android/telephony/ims/SipDelegateManager.java index 2e9eb94605a59..04421c9a24495 100644 --- a/telephony/java/android/telephony/ims/SipDelegateManager.java +++ b/telephony/java/android/telephony/ims/SipDelegateManager.java @@ -24,6 +24,7 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.content.Context; +import android.content.pm.PackageManager; import android.os.RemoteException; import android.os.ServiceSpecificException; import android.telephony.BinderCacheManager; @@ -47,6 +48,9 @@ import java.util.concurrent.Executor; * This allows multiple IMS applications to forward SIP messages to/from their application for the * purposes of providing a single IMS registration to the carrier's IMS network from potentially * many IMS stacks implementing a subset of the supported MMTEL/RCS features. + *

+ * This API is only supported if the device supports the + * {@link PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION} feature. * @hide */ @SystemApi @@ -269,6 +273,7 @@ public class SipDelegateManager { * {@link ImsException#getCode()} for more information. * * @see CarrierConfigManager.Ims#KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL + * @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION */ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSupported() throws ImsException {