Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebc8bf6d authored by Hyunho's avatar Hyunho Committed by Hyunho Shin
Browse files

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
parent 40eb4030
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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<java.lang.String>, @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;
+26 −12
Original line number Diff line number Diff line
@@ -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 {
     * <p>
     * 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 {
     * <p>
     * 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)}.
     * <p>
     * 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.
     * <p>
@@ -792,7 +804,8 @@ public class RcsUceAdapter {
     * cache associated with those contacts as the local cache becomes stale.
     * <p>
     * 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.
     * <p>
     * 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.
     * <p>
     * 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.
     * <p>
     * Note: This setting does not affect whether or not the device publishes its service
     * capabilities if the subscription supports presence publication.
+20 −0
Original line number Diff line number Diff line
@@ -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.
+2 −0
Original line number Diff line number Diff line
@@ -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<String> remoteCapabilities, IOptionsRequestCallback cb);
}
+24 −0
Original line number Diff line number Diff line
@@ -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.
     * <p>
     * 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.