Merge "Add subid to SipTransportImplBase#createSipDelegate" am: 48695cb073 am: 6975aa858d

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

Change-Id: I5f29125348a206edd917cc28d187611703ddc548
This commit is contained in:
Brad Ebinger
2020-11-21 03:12:44 +00:00
committed by Automerger Merge Worker
5 changed files with 31 additions and 22 deletions

View File

@@ -98,4 +98,9 @@ public final class DelegateRequest implements Parcelable {
public int hashCode() { public int hashCode() {
return Objects.hash(mFeatureTags); return Objects.hash(mFeatureTags);
} }
@Override
public String toString() {
return "DelegateRequest{mFeatureTags=" + mFeatureTags + '}';
}
} }

View File

@@ -235,18 +235,18 @@ public class SipDelegateManager {
*/ */
public static final int SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP = 2; 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. * The SipDelegate has been closed due to the user disabling RCS.
* @hide * @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 */ /** @hide */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@@ -254,8 +254,8 @@ public class SipDelegateManager {
SIP_DELEGATE_DESTROY_REASON_UNKNOWN, SIP_DELEGATE_DESTROY_REASON_UNKNOWN,
SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD, SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD,
SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP, 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 {} public @interface SipDelegateDestroyReason {}
@@ -316,6 +316,9 @@ public class SipDelegateManager {
* always be available to handle incoming messages. One mechanism that can be used for this is * 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 * the {@link android.service.carrier.CarrierMessagingClientService}, which the framework keeps
* a persistent binding to when the app is the default SMS application. * 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 * @param request The parameters that are associated with the SipDelegate creation request that
* will be used to create the SipDelegate connection. * will be used to create the SipDelegate connection.
* @param executor The executor that will be used to call the callbacks associated with this * @param executor The executor that will be used to call the callbacks associated with this
@@ -346,8 +349,8 @@ public class SipDelegateManager {
throw new ImsException("Telephony server is down", throw new ImsException("Telephony server is down",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
} }
controller.createSipDelegate(mSubId, request, wrapper.getStateCallbackBinder(), controller.createSipDelegate(mSubId, request, mContext.getOpPackageName(),
wrapper.getMessageCallbackBinder()); wrapper.getStateCallbackBinder(), wrapper.getMessageCallbackBinder());
} catch (ServiceSpecificException e) { } catch (ServiceSpecificException e) {
throw new ImsException(e.getMessage(), e.errorCode); throw new ImsException(e.getMessage(), e.errorCode);
} catch (RemoteException e) { } catch (RemoteException e) {

View File

@@ -63,7 +63,7 @@ interface IImsRcsController {
// SipDelegateManager // SipDelegateManager
boolean isSipDelegateSupported(int subId); boolean isSipDelegateSupported(int subId);
void createSipDelegate(int subId, in DelegateRequest request, void createSipDelegate(int subId, in DelegateRequest request, String packageName,
ISipDelegateConnectionStateCallback delegateState, ISipDelegateConnectionStateCallback delegateState,
ISipDelegateMessageCallback delegateMessage); ISipDelegateMessageCallback delegateMessage);
void destroySipDelegate(int subId, ISipDelegate connection, int reason); void destroySipDelegate(int subId, ISipDelegate connection, int reason);

View File

@@ -26,7 +26,7 @@ import android.telephony.ims.aidl.ISipDelegateStateCallback;
* {@hide} * {@hide}
*/ */
oneway interface ISipTransport { oneway interface ISipTransport {
void createSipDelegate(in DelegateRequest request, ISipDelegateStateCallback dc, void createSipDelegate(int subId, in DelegateRequest request, ISipDelegateStateCallback dc,
ISipDelegateMessageCallback mc); ISipDelegateMessageCallback mc);
void destroySipDelegate(ISipDelegate delegate, int reason); void destroySipDelegate(ISipDelegate delegate, int reason);
} }

View File

@@ -58,11 +58,11 @@ public class SipTransportImplBase {
private final ISipTransport.Stub mSipTransportImpl = new ISipTransport.Stub() { private final ISipTransport.Stub mSipTransportImpl = new ISipTransport.Stub() {
@Override @Override
public void createSipDelegate(DelegateRequest request, ISipDelegateStateCallback dc, public void createSipDelegate(int subId, DelegateRequest request,
ISipDelegateMessageCallback mc) { ISipDelegateStateCallback dc, ISipDelegateMessageCallback mc) {
final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity();
try { try {
mBinderExecutor.execute(() -> createSipDelegateInternal(request, dc, mc)); mBinderExecutor.execute(() -> createSipDelegateInternal(subId, request, dc, mc));
} finally { } finally {
Binder.restoreCallingIdentity(token); Binder.restoreCallingIdentity(token);
} }
@@ -105,6 +105,7 @@ public class SipTransportImplBase {
* This method will be called on the Executor specified in * This method will be called on the Executor specified in
* {@link SipTransportImplBase#SipTransportImplBase(Executor)}. * {@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 * @param request A SIP delegate request containing the parameters that the remote RCS
* application wishes to use. * application wishes to use.
* @param dc A callback back to the remote application to be used to communicate state callbacks * @param dc A callback back to the remote application to be used to communicate state callbacks
@@ -113,9 +114,9 @@ public class SipTransportImplBase {
* remote application and acknowledge the sending of outgoing SIP messages. * remote application and acknowledge the sending of outgoing SIP messages.
* @hide * @hide
*/ */
public void createSipDelegate(@NonNull DelegateRequest request, public void createSipDelegate(int subscriptionId, @NonNull DelegateRequest request,
@NonNull DelegateStateCallback dc, @NonNull DelegateMessageCallback mc) { @NonNull DelegateStateCallback dc, @NonNull DelegateMessageCallback mc) {
throw new UnsupportedOperationException("destroySipDelegate not implemented!"); throw new UnsupportedOperationException("createSipDelegate not implemented!");
} }
/** /**
@@ -136,11 +137,11 @@ public class SipTransportImplBase {
throw new UnsupportedOperationException("destroySipDelegate not implemented!"); throw new UnsupportedOperationException("destroySipDelegate not implemented!");
} }
private void createSipDelegateInternal(DelegateRequest r, ISipDelegateStateCallback cb, private void createSipDelegateInternal(int subId, DelegateRequest r,
ISipDelegateMessageCallback mc) { ISipDelegateStateCallback cb, ISipDelegateMessageCallback mc) {
SipDelegateAidlWrapper wrapper = new SipDelegateAidlWrapper(mBinderExecutor, cb, mc); SipDelegateAidlWrapper wrapper = new SipDelegateAidlWrapper(mBinderExecutor, cb, mc);
mDelegates.add(wrapper); mDelegates.add(wrapper);
createSipDelegate(r, wrapper, wrapper); createSipDelegate(subId, r, wrapper, wrapper);
} }
private void destroySipDelegateInternal(ISipDelegate d, int reason) { private void destroySipDelegateInternal(ISipDelegate d, int reason) {