Merge "Define new permission to perform IMS RCS Reg actions and integrate ACCESS_IMS_SINGLE_REGISTRATION into APIS" am: ca282c8cbf am: a0f85ebf75

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596514

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I11af5489b456fd6e84586c5f3ae8ee8da0aede11
This commit is contained in:
Brad Ebinger
2021-03-05 05:11:15 +00:00
committed by Automerger Merge Worker
8 changed files with 162 additions and 54 deletions

View File

@@ -165,6 +165,7 @@ package android {
field public static final String PACKET_KEEPALIVE_OFFLOAD = "android.permission.PACKET_KEEPALIVE_OFFLOAD"; field public static final String PACKET_KEEPALIVE_OFFLOAD = "android.permission.PACKET_KEEPALIVE_OFFLOAD";
field public static final String PEERS_MAC_ADDRESS = "android.permission.PEERS_MAC_ADDRESS"; field public static final String PEERS_MAC_ADDRESS = "android.permission.PEERS_MAC_ADDRESS";
field public static final String PERFORM_CDMA_PROVISIONING = "android.permission.PERFORM_CDMA_PROVISIONING"; field public static final String PERFORM_CDMA_PROVISIONING = "android.permission.PERFORM_CDMA_PROVISIONING";
field public static final String PERFORM_IMS_SINGLE_REGISTRATION = "android.permission.PERFORM_IMS_SINGLE_REGISTRATION";
field public static final String PERFORM_SIM_ACTIVATION = "android.permission.PERFORM_SIM_ACTIVATION"; field public static final String PERFORM_SIM_ACTIVATION = "android.permission.PERFORM_SIM_ACTIVATION";
field public static final String POWER_SAVER = "android.permission.POWER_SAVER"; field public static final String POWER_SAVER = "android.permission.POWER_SAVER";
field public static final String PROVIDE_RESOLVER_RANKER_SERVICE = "android.permission.PROVIDE_RESOLVER_RANKER_SERVICE"; field public static final String PROVIDE_RESOLVER_RANKER_SERVICE = "android.permission.PROVIDE_RESOLVER_RANKER_SERVICE";
@@ -10069,7 +10070,7 @@ package android.telephony {
} }
public class TelephonyManager { public class TelephonyManager {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void bootstrapAuthenticationRequest(int, @NonNull android.net.Uri, @NonNull android.telephony.gba.UaSecurityProtocolIdentifier, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.BootstrapAuthenticationCallback); method @RequiresPermission(anyOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) @WorkerThread public void bootstrapAuthenticationRequest(int, @NonNull android.net.Uri, @NonNull android.telephony.gba.UaSecurityProtocolIdentifier, boolean, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.BootstrapAuthenticationCallback);
method @Deprecated @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void call(String, String); method @Deprecated @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void call(String, String);
method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.PinResult changeIccLockPin(@NonNull String, @NonNull String); method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.PinResult changeIccLockPin(@NonNull String, @NonNull String);
method public int checkCarrierPrivilegesForPackage(String); method public int checkCarrierPrivilegesForPackage(String);
@@ -11510,19 +11511,19 @@ package android.telephony.ims {
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getProvisioningStatusForCapability(int, int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getProvisioningStatusForCapability(int, int);
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public String getProvisioningStringValue(int); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public String getProvisioningStringValue(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getRcsProvisioningStatusForCapability(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getRcsProvisioningStatusForCapability(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isRcsVolteSingleRegistrationCapable() throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public boolean isRcsVolteSingleRegistrationCapable() throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void notifyRcsAutoConfigurationReceived(@NonNull byte[], boolean);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerRcsProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.RcsProvisioningCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public void registerRcsProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.RcsProvisioningCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setProvisioningStatusForCapability(int, int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setProvisioningStatusForCapability(int, int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRcsClientConfiguration(@NonNull android.telephony.ims.RcsClientConfiguration) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void setRcsClientConfiguration(@NonNull android.telephony.ims.RcsClientConfiguration) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setRcsProvisioningStatusForCapability(int, boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setRcsProvisioningStatusForCapability(int, boolean);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void triggerRcsReconfiguration(); method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void triggerRcsReconfiguration();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterRcsProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.RcsProvisioningCallback); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public void unregisterRcsProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.RcsProvisioningCallback);
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE = "android.telephony.ims.action.RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE"; field @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public static final String ACTION_RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE = "android.telephony.ims.action.RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE";
field public static final String EXTRA_STATUS = "android.telephony.ims.extra.STATUS"; field public static final String EXTRA_STATUS = "android.telephony.ims.extra.STATUS";
field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.ims.extra.SUBSCRIPTION_ID"; field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.ims.extra.SUBSCRIPTION_ID";
field public static final int KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID = 67; // 0x43 field public static final int KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID = 67; // 0x43
@@ -11787,10 +11788,10 @@ package android.telephony.ims {
} }
public class SipDelegateManager { public class SipDelegateManager {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void createSipDelegate(@NonNull android.telephony.ims.DelegateRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.stub.DelegateConnectionStateCallback, @NonNull android.telephony.ims.stub.DelegateConnectionMessageCallback) throws android.telephony.ims.ImsException; method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void createSipDelegate(@NonNull android.telephony.ims.DelegateRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.stub.DelegateConnectionStateCallback, @NonNull android.telephony.ims.stub.DelegateConnectionMessageCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void destroySipDelegate(@NonNull android.telephony.ims.SipDelegateConnection, int); method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void destroySipDelegate(@NonNull android.telephony.ims.SipDelegateConnection, int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSupported() throws android.telephony.ims.ImsException; method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION}) public boolean isSupported() throws android.telephony.ims.ImsException;
method public void triggerFullNetworkRegistration(@NonNull android.telephony.ims.SipDelegateConnection, @IntRange(from=100, to=699) int, @Nullable String); method @RequiresPermission(android.Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION) public void triggerFullNetworkRegistration(@NonNull android.telephony.ims.SipDelegateConnection, @IntRange(from=100, to=699) int, @Nullable String);
field public static final int DENIED_REASON_INVALID = 4; // 0x4 field public static final int DENIED_REASON_INVALID = 4; // 0x4
field public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1; // 0x1 field public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1; // 0x1
field public static final int DENIED_REASON_NOT_ALLOWED = 2; // 0x2 field public static final int DENIED_REASON_NOT_ALLOWED = 2; // 0x2

View File

@@ -1038,6 +1038,14 @@
android:description="@string/permdesc_accessImsCallService" android:description="@string/permdesc_accessImsCallService"
android:protectionLevel="signature|privileged" /> android:protectionLevel="signature|privileged" />
<!-- @SystemApi @hide Allows an application to perform IMS Single Registration related actions.
Only granted if the application is a system app AND is in the Default SMS Role.
The permission is revoked when the app is taken out of the Default SMS Role.
<p>Protection level: signature|privileged
-->
<permission android:name="android.permission.PERFORM_IMS_SINGLE_REGISTRATION"
android:protectionLevel="signature|privileged" />
<!-- Allows an application to read the user's call log. <!-- Allows an application to read the user's call log.
<p class="note"><strong>Note:</strong> If your app uses the <p class="note"><strong>Note:</strong> If your app uses the
{@link #READ_CONTACTS} permission and <em>both</em> your <a {@link #READ_CONTACTS} permission and <em>both</em> your <a

View File

@@ -353,6 +353,7 @@ applications that come with the platform
<permission name="android.permission.PACKAGE_USAGE_STATS" /> <permission name="android.permission.PACKAGE_USAGE_STATS" />
<!-- Needed for test only --> <!-- Needed for test only -->
<permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD" /> <permission name="android.permission.PACKET_KEEPALIVE_OFFLOAD" />
<permission name="android.permission.PERFORM_IMS_SINGLE_REGISTRATION" />
<permission name="android.permission.POWER_SAVER" /> <permission name="android.permission.POWER_SAVER" />
<permission name="android.permission.READ_CARRIER_APP_INFO"/> <permission name="android.permission.READ_CARRIER_APP_INFO"/>
<permission name="android.permission.READ_FRAME_BUFFER"/> <permission name="android.permission.READ_FRAME_BUFFER"/>

View File

@@ -339,6 +339,9 @@
<!-- Permission required for CTS test - CtsTelephonyTestCases --> <!-- Permission required for CTS test - CtsTelephonyTestCases -->
<uses-permission android:name="android.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE" /> <uses-permission android:name="android.permission.ACCESS_RCS_USER_CAPABILITY_EXCHANGE" />
<!-- Permission required for CTS test - CtsTelephonyTestCases -->
<uses-permission android:name="android.permission.PERFORM_IMS_SINGLE_REGISTRATION" />
<!-- Permission needed for CTS test - DisplayTest --> <!-- Permission needed for CTS test - DisplayTest -->
<uses-permission android:name="android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS" /> <uses-permission android:name="android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS" />

View File

@@ -639,6 +639,67 @@ public final class TelephonyPermissions {
} }
} }
/**
* Given a list of permissions, check to see if the caller has at least one of them. If the
* caller has none of these permissions, throw a SecurityException.
*/
public static void enforceAnyPermissionGranted(Context context, int uid, String message,
String... permissions) {
if (permissions.length == 0) return;
boolean isGranted = false;
for (String perm : permissions) {
if (context.checkCallingOrSelfPermission(perm) == PERMISSION_GRANTED) {
isGranted = true;
break;
}
}
if (isGranted) return;
StringBuilder b = new StringBuilder(message);
b.append(": Neither user ");
b.append(uid);
b.append(" nor current process has ");
b.append(permissions[0]);
for (int i = 1; i < permissions.length; i++) {
b.append(" or ");
b.append(permissions[i]);
}
throw new SecurityException(b.toString());
}
/**
* Given a list of permissions, check to see if the caller has at least one of them granted. If
* not, check to see if the caller has carrier privileges. If the caller does not have any of
* these permissions, throw a SecurityException.
*/
public static void enforceAnyPermissionGrantedOrCarrierPrivileges(Context context, int subId,
int uid, String message, String... permissions) {
if (permissions.length == 0) return;
boolean isGranted = false;
for (String perm : permissions) {
if (context.checkCallingOrSelfPermission(perm) == PERMISSION_GRANTED) {
isGranted = true;
break;
}
}
if (isGranted) return;
if (checkCarrierPrivilegeForSubId(context, subId)) return;
StringBuilder b = new StringBuilder(message);
b.append(": Neither user ");
b.append(uid);
b.append(" nor current process has ");
b.append(permissions[0]);
for (int i = 1; i < permissions.length; i++) {
b.append(" or ");
b.append(permissions[i]);
}
b.append(" or carrier privileges");
throw new SecurityException(b.toString());
}
/** /**
* Throws if the caller is not of a shell (or root) UID. * Throws if the caller is not of a shell (or root) UID.
* *

View File

@@ -14610,8 +14610,13 @@ public class TelephonyManager {
* <li>Generate the ks_NAF/ ks_Ext_NAF to be returned via the callback.</li> * <li>Generate the ks_NAF/ ks_Ext_NAF to be returned via the callback.</li>
* </ol> * </ol>
* *
* <p> Requires Permission: MODIFY_PHONE_STATE or that the calling app has carrier * <p> Requires Permission:
* privileges (see {@link #hasCarrierPrivileges}). * <ul>
* <li>{@link android.Manifest.permission#MODIFY_PHONE_STATE},</li>
* <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li>
* <li>or that the caller has carrier privileges (see
* {@link TelephonyManager#hasCarrierPrivileges()}).</li>
* </ul>
* @param appType icc application type, like {@link #APPTYPE_USIM} or {@link * @param appType icc application type, like {@link #APPTYPE_USIM} or {@link
* #APPTYPE_ISIM} or {@link#APPTYPE_UNKNOWN} * #APPTYPE_ISIM} or {@link#APPTYPE_UNKNOWN}
* @param nafId Network Application Function(NAF) fully qualified domain name and * @param nafId Network Application Function(NAF) fully qualified domain name and
@@ -14638,7 +14643,8 @@ public class TelephonyManager {
*/ */
@SystemApi @SystemApi
@WorkerThread @WorkerThread
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(anyOf = {android.Manifest.permission.MODIFY_PHONE_STATE,
Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION})
public void bootstrapAuthenticationRequest( public void bootstrapAuthenticationRequest(
@UiccAppTypeExt int appType, @NonNull Uri nafId, @UiccAppTypeExt int appType, @NonNull Uri nafId,
@NonNull UaSecurityProtocolIdentifier securityProtocol, @NonNull UaSecurityProtocolIdentifier securityProtocol,

View File

@@ -32,6 +32,7 @@ import android.os.ServiceSpecificException;
import android.telephony.CarrierConfigManager; import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer; import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.ims.aidl.IImsConfigCallback; import android.telephony.ims.aidl.IImsConfigCallback;
import android.telephony.ims.aidl.IRcsConfigCallback; import android.telephony.ims.aidl.IRcsConfigCallback;
import android.telephony.ims.feature.MmTelFeature; import android.telephony.ims.feature.MmTelFeature;
@@ -1300,7 +1301,7 @@ public class ProvisioningManager {
* provisioning. * provisioning.
* <p> * <p>
* Requires Permission: Manifest.permission.MODIFY_PHONE_STATE or that the calling app has * Requires Permission: Manifest.permission.MODIFY_PHONE_STATE or that the calling app has
* carrier privileges (see {@link #hasCarrierPrivileges}). * carrier privileges (see {@link TelephonyManager#hasCarrierPrivileges}).
* @param config The XML file to be read. ASCII/UTF8 encoded text if not compressed. * @param config The XML file to be read. ASCII/UTF8 encoded text if not compressed.
* @param isCompressed The XML file is compressed in gzip format and must be decompressed * @param isCompressed The XML file is compressed in gzip format and must be decompressed
* before being read. * before being read.
@@ -1330,7 +1331,7 @@ public class ProvisioningManager {
* the intent is valid. and {@link #EXTRA_STATUS} to specify RCS VoLTE single registration * the intent is valid. and {@link #EXTRA_STATUS} to specify RCS VoLTE single registration
* status. * status.
*/ */
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
@SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE = public static final String ACTION_RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE =
"android.telephony.ims.action.RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE"; "android.telephony.ims.action.RCS_SINGLE_REGISTRATION_CAPABILITY_UPDATE";
@@ -1375,7 +1376,7 @@ public class ProvisioningManager {
* provisioning status events {@link #registerRcsProvisioningChangedCallback} * provisioning status events {@link #registerRcsProvisioningChangedCallback}
* @param rcc RCS client configuration {@link RcsClientConfiguration} * @param rcc RCS client configuration {@link RcsClientConfiguration}
*/ */
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void setRcsClientConfiguration( public void setRcsClientConfiguration(
@NonNull RcsClientConfiguration rcc) throws ImsException { @NonNull RcsClientConfiguration rcc) throws ImsException {
try { try {
@@ -1390,6 +1391,14 @@ public class ProvisioningManager {
/** /**
* Returns a flag to indicate whether or not the device supports IMS single registration for * 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. * MMTEL and RCS features as well as if the carrier has provisioned the feature.
*
* <p> Requires Permission:
* <ul>
* <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li>
* <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li>
* <li>or that the caller has carrier privileges (see
* {@link TelephonyManager#hasCarrierPrivileges()}).</li>
* </ul>
* @return true if IMS single registration is capable at this time, or false otherwise * @return true if IMS single registration is capable at this time, or false otherwise
* @throws ImsException If the remote ImsService is not available for * @throws ImsException If the remote ImsService is not available for
* any reason or the subscription associated with this instance is no * any reason or the subscription associated with this instance is no
@@ -1398,7 +1407,8 @@ public class ProvisioningManager {
* @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION for whether or not this * @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION for whether or not this
* device supports IMS single registration. * device supports IMS single registration.
*/ */
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(anyOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION})
public boolean isRcsVolteSingleRegistrationCapable() throws ImsException { public boolean isRcsVolteSingleRegistrationCapable() throws ImsException {
try { try {
return getITelephony().isRcsVolteSingleRegistrationCapable(mSubId); return getITelephony().isRcsVolteSingleRegistrationCapable(mSubId);
@@ -1408,36 +1418,44 @@ public class ProvisioningManager {
} }
/** /**
* Registers a new {@link RcsProvisioningCallback} to listen to changes to * Registers a new {@link RcsProvisioningCallback} to listen to changes to
* RCS provisioning xml. * RCS provisioning xml.
* *
* <p>RCS application must be the default messaging application and must * <p>RCS application must be the default messaging application and must
* have already registered its {@link RcsClientConfiguration} by using * have already registered its {@link RcsClientConfiguration} by using
* {@link #setRcsClientConfiguration} before it registers the provisioning * {@link #setRcsClientConfiguration} before it registers the provisioning
* callback. If ProvisioningManager has a valid RCS configuration at the * callback. If ProvisioningManager has a valid RCS configuration at the
* time of callback registration and a reconfiguration is not required * time of callback registration and a reconfiguration is not required
* due to RCS client parameters change, then the callback shall be invoked * due to RCS client parameters change, then the callback shall be invoked
* immediately with the xml. * immediately with the xml.
* When the subscription associated with this callback is removed (SIM removed, * When the subscription associated with this callback is removed (SIM removed,
* ESIM swap,etc...), this callback will automatically be removed. * ESIM swap,etc...), this callback will automatically be removed.
* * <p> Requires Permission:
* @param executor The {@link Executor} to call the callback methods on * <ul>
* @param callback The rcs provisioning callback to be registered. * <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li>
* @see #unregisterRcsProvisioningChangedCallback(RcsProvisioningCallback) * <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li>
* @see SubscriptionManager.OnSubscriptionsChangedListener * <li>or that the caller has carrier privileges (see
* @throws IllegalArgumentException if the subscription associated with this * {@link TelephonyManager#hasCarrierPrivileges()}).</li>
* callback is not active (SIM is not inserted, ESIM inactive) or the * </ul>
* subscription is invalid. *
* @throws ImsException if the subscription associated with this callback is * @param executor The {@link Executor} to call the callback methods on
* valid, but the {@link ImsService} associated with the subscription is not * @param callback The rcs provisioning callback to be registered.
* available. This can happen if the service crashed, for example. * @see #unregisterRcsProvisioningChangedCallback(RcsProvisioningCallback)
* It shall also throw this exception when the RCS client parameters for the * @see SubscriptionManager.OnSubscriptionsChangedListener
* application are not valid. In that case application must set the client * @throws IllegalArgumentException if the subscription associated with this
* params (See {@link #setRcsClientConfiguration}) and re register the * callback is not active (SIM is not inserted, ESIM inactive) or the
* callback. * subscription is invalid.
* See {@link ImsException#getCode()} for a more detailed reason. * @throws ImsException if the subscription associated with this callback is
*/ * valid, but the {@link ImsService} associated with the subscription is not
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) * 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
* callback.
* See {@link ImsException#getCode()} for a more detailed reason.
*/
@RequiresPermission(anyOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION})
public void registerRcsProvisioningChangedCallback( public void registerRcsProvisioningChangedCallback(
@NonNull @CallbackExecutor Executor executor, @NonNull @CallbackExecutor Executor executor,
@NonNull RcsProvisioningCallback callback) throws ImsException { @NonNull RcsProvisioningCallback callback) throws ImsException {
@@ -1459,13 +1477,22 @@ public class ProvisioningManager {
* removed, ESIM swap, etc...), this callback will automatically be * removed, ESIM swap, etc...), this callback will automatically be
* removed. If this method is called for an inactive subscription, it * removed. If this method is called for an inactive subscription, it
* will result in a no-op. * will result in a no-op.
* <p> Requires Permission:
* <ul>
* <li>{@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE},</li>
* <li>{@link android.Manifest.permission#PERFORM_IMS_SINGLE_REGISTRATION},</li>
* <li>or that the caller has carrier privileges (see
* {@link TelephonyManager#hasCarrierPrivileges()}).</li>
* </ul>
*
* @param callback The existing {@link RcsProvisioningCallback} to be * @param callback The existing {@link RcsProvisioningCallback} to be
* removed. * removed.
* @see #registerRcsProvisioningChangedCallback * @see #registerRcsProvisioningChangedCallback
* @throws IllegalArgumentException if the subscription associated with this callback is * @throws IllegalArgumentException if the subscription associated with this callback is
* invalid. * invalid.
*/ */
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(anyOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION})
public void unregisterRcsProvisioningChangedCallback( public void unregisterRcsProvisioningChangedCallback(
@NonNull RcsProvisioningCallback callback) { @NonNull RcsProvisioningCallback callback) {
try { try {
@@ -1480,7 +1507,7 @@ public class ProvisioningManager {
* Reconfiguration triggered by the RCS application. Most likely cause * Reconfiguration triggered by the RCS application. Most likely cause
* is the 403 forbidden to a HTTP request. * is the 403 forbidden to a HTTP request.
*/ */
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void triggerRcsReconfiguration() { public void triggerRcsReconfiguration() {
try { try {
getITelephony().triggerRcsReconfiguration(mSubId); getITelephony().triggerRcsReconfiguration(mSubId);

View File

@@ -28,7 +28,6 @@ import android.content.pm.PackageManager;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceSpecificException; import android.os.ServiceSpecificException;
import android.telephony.BinderCacheManager; import android.telephony.BinderCacheManager;
import android.telephony.CarrierConfigManager;
import android.telephony.ims.aidl.IImsRcsController; import android.telephony.ims.aidl.IImsRcsController;
import android.telephony.ims.aidl.SipDelegateConnectionAidlWrapper; import android.telephony.ims.aidl.SipDelegateConnectionAidlWrapper;
import android.telephony.ims.stub.DelegateConnectionMessageCallback; import android.telephony.ims.stub.DelegateConnectionMessageCallback;
@@ -275,7 +274,8 @@ public class SipDelegateManager {
* @see CarrierConfigManager.Ims#KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL * @see CarrierConfigManager.Ims#KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL
* @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION * @see PackageManager#FEATURE_TELEPHONY_IMS_SINGLE_REGISTRATION
*/ */
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresPermission(anyOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION})
public boolean isSupported() throws ImsException { public boolean isSupported() throws ImsException {
try { try {
IImsRcsController controller = mBinderCache.getBinder(); IImsRcsController controller = mBinderCache.getBinder();
@@ -317,7 +317,7 @@ public class SipDelegateManager {
* @throws ImsException Thrown if there was a problem communicating with the ImsService * @throws ImsException Thrown if there was a problem communicating with the ImsService
* associated with this SipDelegateManager. See {@link ImsException#getCode()}. * associated with this SipDelegateManager. See {@link ImsException#getCode()}.
*/ */
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void createSipDelegate(@NonNull DelegateRequest request, @NonNull Executor executor, public void createSipDelegate(@NonNull DelegateRequest request, @NonNull Executor executor,
@NonNull DelegateConnectionStateCallback dc, @NonNull DelegateConnectionStateCallback dc,
@NonNull DelegateConnectionMessageCallback mc) throws ImsException { @NonNull DelegateConnectionMessageCallback mc) throws ImsException {
@@ -351,7 +351,7 @@ public class SipDelegateManager {
* @param delegateConnection The SipDelegateConnection to destroy. * @param delegateConnection The SipDelegateConnection to destroy.
* @param reason The reason for why this SipDelegateConnection was destroyed. * @param reason The reason for why this SipDelegateConnection was destroyed.
*/ */
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) @RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void destroySipDelegate(@NonNull SipDelegateConnection delegateConnection, public void destroySipDelegate(@NonNull SipDelegateConnection delegateConnection,
@SipDelegateDestroyReason int reason) { @SipDelegateDestroyReason int reason) {
@@ -392,6 +392,7 @@ public class SipDelegateManager {
* this condition. May be {@code null} if there was no reason String provided from the * this condition. May be {@code null} if there was no reason String provided from the
* network. * network.
*/ */
@RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void triggerFullNetworkRegistration(@NonNull SipDelegateConnection connection, public void triggerFullNetworkRegistration(@NonNull SipDelegateConnection connection,
@IntRange(from = 100, to = 699) int sipCode, @Nullable String sipReason) { @IntRange(from = 100, to = 699) int sipCode, @Nullable String sipReason) {
if (connection == null) { if (connection == null) {