Merge "Add subid to SipTransportImplBase#createSipDelegate"
diff --git a/telephony/java/android/telephony/ims/DelegateRequest.java b/telephony/java/android/telephony/ims/DelegateRequest.java
index f384901..73d0840 100644
--- a/telephony/java/android/telephony/ims/DelegateRequest.java
+++ b/telephony/java/android/telephony/ims/DelegateRequest.java
@@ -98,4 +98,9 @@
public int hashCode() {
return Objects.hash(mFeatureTags);
}
+
+ @Override
+ public String toString() {
+ return "DelegateRequest{mFeatureTags=" + mFeatureTags + '}';
+ }
}
diff --git a/telephony/java/android/telephony/ims/SipDelegateManager.java b/telephony/java/android/telephony/ims/SipDelegateManager.java
index 337b7d4..190a792 100644
--- a/telephony/java/android/telephony/ims/SipDelegateManager.java
+++ b/telephony/java/android/telephony/ims/SipDelegateManager.java
@@ -236,17 +236,17 @@
public static final int SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP = 2;
/**
- * The SipDelegate has closed because the IMS service does not support the creation of
- * SipDelegates.
- * @hide
- */
- public static final int SIP_DELEGATE_DESTROY_REASON_SERVICE_NOT_SUPPORTED = 3;
-
- /**
* The SipDelegate has been closed due to the user disabling RCS.
* @hide
*/
- public static final int SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS = 4;
+ public static final int SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS = 3;
+
+ /**
+ * The SipDelegate has been closed due to the subscription associated with this delegate being
+ * torn down.
+ * @hide
+ */
+ public static final int SIP_DELEGATE_DESTROY_REASON_SUBSCRIPTION_TORN_DOWN = 4;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@@ -254,8 +254,8 @@
SIP_DELEGATE_DESTROY_REASON_UNKNOWN,
SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD,
SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP,
- SIP_DELEGATE_DESTROY_REASON_SERVICE_NOT_SUPPORTED,
- SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS
+ SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS,
+ SIP_DELEGATE_DESTROY_REASON_SUBSCRIPTION_TORN_DOWN
})
public @interface SipDelegateDestroyReason {}
@@ -316,6 +316,9 @@
* always be available to handle incoming messages. One mechanism that can be used for this is
* the {@link android.service.carrier.CarrierMessagingClientService}, which the framework keeps
* a persistent binding to when the app is the default SMS application.
+ * <p>
+ * Note: the ability to create SipDelegates is only available applications running as the
+ * primary user.
* @param request The parameters that are associated with the SipDelegate creation request that
* will be used to create the SipDelegate connection.
* @param executor The executor that will be used to call the callbacks associated with this
@@ -346,8 +349,8 @@
throw new ImsException("Telephony server is down",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
- controller.createSipDelegate(mSubId, request, wrapper.getStateCallbackBinder(),
- wrapper.getMessageCallbackBinder());
+ controller.createSipDelegate(mSubId, request, mContext.getOpPackageName(),
+ wrapper.getStateCallbackBinder(), wrapper.getMessageCallbackBinder());
} catch (ServiceSpecificException e) {
throw new ImsException(e.getMessage(), e.errorCode);
} catch (RemoteException e) {
diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
index f218e35..c6d9a86 100644
--- a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
@@ -63,7 +63,7 @@
// SipDelegateManager
boolean isSipDelegateSupported(int subId);
- void createSipDelegate(int subId, in DelegateRequest request,
+ void createSipDelegate(int subId, in DelegateRequest request, String packageName,
ISipDelegateConnectionStateCallback delegateState,
ISipDelegateMessageCallback delegateMessage);
void destroySipDelegate(int subId, ISipDelegate connection, int reason);
diff --git a/telephony/java/android/telephony/ims/aidl/ISipTransport.aidl b/telephony/java/android/telephony/ims/aidl/ISipTransport.aidl
index cd88839..3438587 100644
--- a/telephony/java/android/telephony/ims/aidl/ISipTransport.aidl
+++ b/telephony/java/android/telephony/ims/aidl/ISipTransport.aidl
@@ -26,7 +26,7 @@
* {@hide}
*/
oneway interface ISipTransport {
- void createSipDelegate(in DelegateRequest request, ISipDelegateStateCallback dc,
+ void createSipDelegate(int subId, in DelegateRequest request, ISipDelegateStateCallback dc,
ISipDelegateMessageCallback mc);
void destroySipDelegate(ISipDelegate delegate, int reason);
}
diff --git a/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java b/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java
index b48f631..93d438c 100644
--- a/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/SipTransportImplBase.java
@@ -58,11 +58,11 @@
private final ISipTransport.Stub mSipTransportImpl = new ISipTransport.Stub() {
@Override
- public void createSipDelegate(DelegateRequest request, ISipDelegateStateCallback dc,
- ISipDelegateMessageCallback mc) {
+ public void createSipDelegate(int subId, DelegateRequest request,
+ ISipDelegateStateCallback dc, ISipDelegateMessageCallback mc) {
final long token = Binder.clearCallingIdentity();
try {
- mBinderExecutor.execute(() -> createSipDelegateInternal(request, dc, mc));
+ mBinderExecutor.execute(() -> createSipDelegateInternal(subId, request, dc, mc));
} finally {
Binder.restoreCallingIdentity(token);
}
@@ -105,6 +105,7 @@
* This method will be called on the Executor specified in
* {@link SipTransportImplBase#SipTransportImplBase(Executor)}.
*
+ * @param subscriptionId The subscription ID associated with the requested {@link SipDelegate}.
* @param request A SIP delegate request containing the parameters that the remote RCS
* application wishes to use.
* @param dc A callback back to the remote application to be used to communicate state callbacks
@@ -113,9 +114,9 @@
* remote application and acknowledge the sending of outgoing SIP messages.
* @hide
*/
- public void createSipDelegate(@NonNull DelegateRequest request,
+ public void createSipDelegate(int subscriptionId, @NonNull DelegateRequest request,
@NonNull DelegateStateCallback dc, @NonNull DelegateMessageCallback mc) {
- throw new UnsupportedOperationException("destroySipDelegate not implemented!");
+ throw new UnsupportedOperationException("createSipDelegate not implemented!");
}
/**
@@ -136,11 +137,11 @@
throw new UnsupportedOperationException("destroySipDelegate not implemented!");
}
- private void createSipDelegateInternal(DelegateRequest r, ISipDelegateStateCallback cb,
- ISipDelegateMessageCallback mc) {
+ private void createSipDelegateInternal(int subId, DelegateRequest r,
+ ISipDelegateStateCallback cb, ISipDelegateMessageCallback mc) {
SipDelegateAidlWrapper wrapper = new SipDelegateAidlWrapper(mBinderExecutor, cb, mc);
mDelegates.add(wrapper);
- createSipDelegate(r, wrapper, wrapper);
+ createSipDelegate(subId, r, wrapper, wrapper);
}
private void destroySipDelegateInternal(ISipDelegate d, int reason) {