Do not check single reg permission for destroying SipDelegate
When destroying the SipDelegate, the app may have lost single reg
permission due to it not being the default SMS app anymore. Do not
throw a SecurityException in this case, since the app would already
need a valid token (in the form of a ISipDelegate instance) in order
to call this API.
Bug: 192371276
Test: atest CtsTelephonyTestCases:SipDelegateManagerTest
Change-Id: I5681ab9ba1c4e85f4a127937250485cd4c482890
diff --git a/src/com/android/phone/ImsRcsController.java b/src/com/android/phone/ImsRcsController.java
index 64e93a5..82d64d5 100644
--- a/src/com/android/phone/ImsRcsController.java
+++ b/src/com/android/phone/ImsRcsController.java
@@ -601,8 +601,11 @@
@Override
public void destroySipDelegate(int subId, ISipDelegate connection, int reason) {
- enforceImsSingleRegistrationPermission("destroySipDelegate");
-
+ // Do not check permissions here - the caller needs to have a connection already from the
+ // create method to call this method.
+ if (connection == null) {
+ return;
+ }
final long identity = Binder.clearCallingIdentity();
try {
SipTransportController transport = getRcsFeatureController(subId).getFeature(