AOSP API support for Sip Dialog status callback
All active RCS services must be maintained from WiFi to RAN or from RAN to WiFi.
According to the carrier specification, QNS applied this API because it needs to know if the MSRP service is activated during handover.
Test: atest SipSessionTrackerTest
Test: cts SipDelegateManagerTest
Bug: b/244429207
Change-Id: Id97d17364a11ed0ce50ade8d5469a7dc07eb6489
diff --git a/src/com/android/phone/ImsRcsController.java b/src/com/android/phone/ImsRcsController.java
index d4a0f1e..3f35454 100644
--- a/src/com/android/phone/ImsRcsController.java
+++ b/src/com/android/phone/ImsRcsController.java
@@ -50,6 +50,7 @@
import com.android.ims.ImsManager;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.telephony.IIntegerConsumer;
+import com.android.internal.telephony.ISipDialogStateCallback;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.TelephonyPermissions;
import com.android.internal.telephony.ims.ImsResolver;
@@ -667,6 +668,60 @@
}
/**
+ * Register a state of Sip Dialog callback
+ */
+ @Override
+ public void registerSipDialogStateCallback(int subId, ISipDialogStateCallback cb) {
+ enforceReadPrivilegedPermission("registerSipDialogStateCallback");
+ if (cb == null) {
+ throw new IllegalArgumentException("SipDialogStateCallback is null");
+ }
+ final long identity = Binder.clearCallingIdentity();
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ throw new IllegalArgumentException("Invalid Subscription ID: " + subId);
+ }
+ try {
+ SipTransportController transport = getRcsFeatureController(subId).getFeature(
+ SipTransportController.class);
+ if (transport == null) {
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_SERVICE_UNAVAILABLE,
+ "This transport does not support the registerSipDialogStateCallback"
+ + " of SIP delegates");
+ }
+ transport.addCallbackForSipDialogState(subId, cb);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
+ * Unregister a state of Sip Dialog callback
+ */
+ @Override
+ public void unregisterSipDialogStateCallback(int subId, ISipDialogStateCallback cb) {
+ enforceReadPrivilegedPermission("unregisterSipDialogStateCallback");
+ if (cb == null) {
+ throw new IllegalArgumentException("SipDialogStateCallback is null");
+ }
+ final long identity = Binder.clearCallingIdentity();
+ if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+ throw new IllegalArgumentException("Invalid Subscription ID: " + subId);
+ }
+ try {
+ SipTransportController transport = getRcsFeatureController(subId).getFeature(
+ SipTransportController.class);
+ if (transport == null) {
+ throw new ServiceSpecificException(ImsException.CODE_ERROR_SERVICE_UNAVAILABLE,
+ "This transport does not support the unregisterSipDialogStateCallback"
+ + " of SIP delegates");
+ }
+ transport.removeCallbackForSipDialogState(subId, cb);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
* Registers for updates to the RcsFeature connection through the IImsServiceFeatureCallback
* callback.
*/