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

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

Change-Id: I2ae0edbad6ea1ccb120d69f0e131f6df23740e26
This commit is contained in:
Brad Ebinger
2020-11-21 03:48:39 +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() {
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;
/**
* 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 @@ public class SipDelegateManager {
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 @@ public class SipDelegateManager {
* 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 @@ public class SipDelegateManager {
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) {

View File

@@ -63,7 +63,7 @@ interface IImsRcsController {
// 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);

View File

@@ -26,7 +26,7 @@ import android.telephony.ims.aidl.ISipDelegateStateCallback;
* {@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);
}

View File

@@ -58,11 +58,11 @@ public class SipTransportImplBase {
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 @@ public class SipTransportImplBase {
* 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 @@ public class SipTransportImplBase {
* 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 @@ public class SipTransportImplBase {
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) {