From ebc8bf6daa1baa857c5f327594a640aee2f4f488 Mon Sep 17 00:00:00 2001 From: Hyunho Date: Tue, 16 Nov 2021 09:07:51 +0000 Subject: IMS RCS UCE API Improvement Changed API to receive uid as parameter when registering PublishStateCallback Bug: b/203406296 Test: atest UceControllerManagerTest Change-Id: I6f204b8875e0ae8cd4312cf9938ea9d673b31016 Merged-In: I6f204b8875e0ae8cd4312cf9938ea9d673b31016 --- core/api/system-current.txt | 2 ++ .../java/android/telephony/ims/RcsUceAdapter.java | 38 +++++++++++++++------- .../ims/aidl/CapabilityExchangeAidlWrapper.java | 20 ++++++++++++ .../ims/aidl/ICapabilityExchangeEventListener.aidl | 2 ++ .../ims/stub/CapabilityExchangeEventListener.java | 24 ++++++++++++++ 5 files changed, 74 insertions(+), 12 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index cd1fef9d18ba..4f97dd41a585 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13631,6 +13631,7 @@ package android.telephony.ims { field public static final int PUBLISH_STATE_NOT_PUBLISHED = 2; // 0x2 field public static final int PUBLISH_STATE_OK = 1; // 0x1 field public static final int PUBLISH_STATE_OTHER_ERROR = 6; // 0x6 + field public static final int PUBLISH_STATE_PUBLISHING = 7; // 0x7 field public static final int PUBLISH_STATE_RCS_PROVISION_ERROR = 4; // 0x4 field public static final int PUBLISH_STATE_REQUEST_TIMEOUT = 5; // 0x5 field public static final int PUBLISH_STATE_VOICE_PROVISION_ERROR = 3; // 0x3 @@ -13893,6 +13894,7 @@ package android.telephony.ims.feature { package android.telephony.ims.stub { public interface CapabilityExchangeEventListener { + method public default void onPublishUpdated(int, @NonNull String, int, @NonNull String) throws android.telephony.ims.ImsException; method public void onRemoteCapabilityRequest(@NonNull android.net.Uri, @NonNull java.util.Set, @NonNull android.telephony.ims.stub.CapabilityExchangeEventListener.OptionsRequestCallback) throws android.telephony.ims.ImsException; method public void onRequestPublishCapabilities(int) throws android.telephony.ims.ImsException; method public void onUnpublish() throws android.telephony.ims.ImsException; diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java index 7a1c09275a6d..61de3ac2b25e 100644 --- a/telephony/java/android/telephony/ims/RcsUceAdapter.java +++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java @@ -28,13 +28,10 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceSpecificException; -import android.telephony.CarrierConfigManager; -import android.telephony.SubscriptionManager; import android.telephony.TelephonyFrameworkInitializer; import android.telephony.ims.aidl.IImsRcsController; import android.telephony.ims.aidl.IRcsUceControllerCallback; import android.telephony.ims.aidl.IRcsUcePublishStateCallback; -import android.telephony.ims.feature.RcsFeature; import android.util.Log; import java.lang.annotation.Retention; @@ -337,6 +334,14 @@ public class RcsUceAdapter { @SystemApi public static final int PUBLISH_STATE_OTHER_ERROR = 6; + /** + * The device is currently trying to publish its capabilities to the network. + * @hide + */ + @SystemApi + public static final int PUBLISH_STATE_PUBLISHING = 7; + + /**@hide*/ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "PUBLISH_STATE_", value = { @@ -345,7 +350,8 @@ public class RcsUceAdapter { PUBLISH_STATE_VOICE_PROVISION_ERROR, PUBLISH_STATE_RCS_PROVISION_ERROR, PUBLISH_STATE_REQUEST_TIMEOUT, - PUBLISH_STATE_OTHER_ERROR + PUBLISH_STATE_OTHER_ERROR, + PUBLISH_STATE_PUBLISHING }) public @interface PublishState {} @@ -480,9 +486,12 @@ public class RcsUceAdapter { *

* Be sure to check the availability of this feature using * {@link ImsRcsManager#isAvailable(int, int)} and ensuring - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} or - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} is enabled or else - * this operation will fail with {@link #ERROR_NOT_AVAILABLE} or {@link #ERROR_NOT_ENABLED}. + * {@link + * android.telephony.ims.feature.RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} or + * {@link + * android.telephony.ims.feature.RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} is + * enabled or else this operation will fail with {@link #ERROR_NOT_AVAILABLE} or + * {@link #ERROR_NOT_ENABLED}. * * @param contactNumbers A list of numbers that the capabilities are being requested for. * @param executor The executor that will be used when the request is completed and the @@ -573,8 +582,10 @@ public class RcsUceAdapter { *

* Be sure to check the availability of this feature using * {@link ImsRcsManager#isAvailable(int, int)} and ensuring - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} or - * {@link RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} is + * {@link + * android.telephony.ims.feature.RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_OPTIONS_UCE} or + * {@link + * android.telephony.ims.feature.RcsFeature.RcsImsCapabilities#CAPABILITY_TYPE_PRESENCE_UCE} is * enabled or else this operation will fail with * {@link #ERROR_NOT_AVAILABLE} or {@link #ERROR_NOT_ENABLED}. * @@ -690,7 +701,8 @@ public class RcsUceAdapter { * Registers a {@link OnPublishStateChangedListener} with the system, which will provide publish * state updates for the subscription specified in {@link ImsManager@getRcsManager(subid)}. *

- * Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to subscription + * Use {@link android.telephony.SubscriptionManager.OnSubscriptionsChangedListener} to listen + * to subscription * changed events and call * {@link #removeOnPublishStateChangedListener(OnPublishStateChangedListener)} to clean up. *

@@ -792,7 +804,8 @@ public class RcsUceAdapter { * cache associated with those contacts as the local cache becomes stale. *

* This setting will only enable this feature if - * {@link CarrierConfigManager.Ims#KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL} is also enabled. + * {@link android.telephony.CarrierConfigManager.Ims#KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL} is + * also enabled. *

* Note: This setting does not affect whether or not the device publishes its service * capabilities if the subscription supports presence publication. @@ -843,7 +856,8 @@ public class RcsUceAdapter { * session. *

* This setting will only enable this feature if - * {@link CarrierConfigManager.Ims#KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL} is also enabled. + * {@link android.telephony.CarrierConfigManager.Ims#KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL} is + * also enabled. *

* Note: This setting does not affect whether or not the device publishes its service * capabilities if the subscription supports presence publication. diff --git a/telephony/java/android/telephony/ims/aidl/CapabilityExchangeAidlWrapper.java b/telephony/java/android/telephony/ims/aidl/CapabilityExchangeAidlWrapper.java index c3d7325f2e0a..c27fa4fc882d 100644 --- a/telephony/java/android/telephony/ims/aidl/CapabilityExchangeAidlWrapper.java +++ b/telephony/java/android/telephony/ims/aidl/CapabilityExchangeAidlWrapper.java @@ -80,6 +80,26 @@ public class CapabilityExchangeAidlWrapper implements CapabilityExchangeEventLis } } + /** + * Receives the status of changes in the publishing connection from ims service + * and deliver this callback to the framework. + */ + public void onPublishUpdated(int reasonCode, @NonNull String reasonPhrase, + int reasonHeaderCause, @NonNull String reasonHeaderText) throws ImsException { + ICapabilityExchangeEventListener listener = mListenerBinder; + if (listener == null) { + return; + } + try { + listener.onPublishUpdated(reasonCode, reasonPhrase, + reasonHeaderCause, reasonHeaderText); + } catch (RemoteException e) { + Log.w(LOG_TAG, "onPublishUpdated exception: " + e); + throw new ImsException("Remote is not available", + ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); + } + } + /** * Receives the callback of the remote capability request from the network and deliver this * request to the framework. diff --git a/telephony/java/android/telephony/ims/aidl/ICapabilityExchangeEventListener.aidl b/telephony/java/android/telephony/ims/aidl/ICapabilityExchangeEventListener.aidl index 078ac919b75e..c675bc3204f6 100644 --- a/telephony/java/android/telephony/ims/aidl/ICapabilityExchangeEventListener.aidl +++ b/telephony/java/android/telephony/ims/aidl/ICapabilityExchangeEventListener.aidl @@ -31,6 +31,8 @@ import java.util.List; oneway interface ICapabilityExchangeEventListener { void onRequestPublishCapabilities(int publishTriggerType); void onUnpublish(); + void onPublishUpdated(int reasonCode, String reasonPhrase, int reasonHeaderCause, + String reasonHeaderText); void onRemoteCapabilityRequest(in Uri contactUri, in List remoteCapabilities, IOptionsRequestCallback cb); } diff --git a/telephony/java/android/telephony/ims/stub/CapabilityExchangeEventListener.java b/telephony/java/android/telephony/ims/stub/CapabilityExchangeEventListener.java index a3be8dab2891..9293a40d9a33 100644 --- a/telephony/java/android/telephony/ims/stub/CapabilityExchangeEventListener.java +++ b/telephony/java/android/telephony/ims/stub/CapabilityExchangeEventListener.java @@ -89,6 +89,30 @@ public interface CapabilityExchangeEventListener { */ void onUnpublish() throws ImsException; + /** + * Notify the framework that the ImsService has refreshed the PUBLISH + * internally, which has resulted in a new PUBLISH result. + *

+ * This method must return both SUCCESS (200 OK) and FAILURE (300+) codes in order to + * keep the AOSP stack up to date. + * @param reasonCode The SIP response code sent from the network. + * @param reasonPhrase The optional reason response from the network. If the + * network provided no reason with the sip code, the string should be empty. + * @param reasonHeaderCause The “cause” parameter of the “reason” header + * included in the SIP message. + * @param reasonHeaderText The “text” parameter of the “reason” header + * included in the SIP message. + * @throws ImsException If this {@link RcsCapabilityExchangeImplBase} instance is not + * currently connected to the framework. This can happen if the {@link RcsFeature} is not + * {@link ImsFeature#STATE_READY} and the {@link RcsFeature} has not received + * the {@link ImsFeature#onFeatureReady()} callback. This may also happen in rare + * cases when the Telephony stack has crashed. + * + */ + default void onPublishUpdated(int reasonCode, @NonNull String reasonPhrase, + int reasonHeaderCause, @NonNull String reasonHeaderText) throws ImsException { + } + /** * Inform the framework of an OPTIONS query from a remote device for this device's UCE * capabilities. -- cgit v1.2.3-59-g8ed1b