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

Commit 791887d9 authored by Hyunho Shin's avatar Hyunho Shin Committed by Android (Google) Code Review
Browse files

Merge "Changed the interface between the caller and the framework for subscriptions."

parents d037da75 3bab8aaa
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -15568,8 +15568,10 @@ package android.telephony.ims {
  public static interface RcsUceAdapter.CapabilitiesCallback {
    method public void onCapabilitiesReceived(@NonNull java.util.List<android.telephony.ims.RcsContactUceCapability>);
    method public void onComplete();
    method public void onError(int, long);
    method @Deprecated public void onComplete();
    method public default void onComplete(@Nullable android.telephony.ims.SipDetails);
    method @Deprecated public void onError(int, long);
    method public default void onError(int, long, @Nullable android.telephony.ims.SipDetails);
  }
  public static interface RcsUceAdapter.OnPublishStateChangedListener {
@@ -16085,8 +16087,9 @@ package android.telephony.ims.stub {
  public static interface RcsCapabilityExchangeImplBase.SubscribeResponseCallback {
    method public void onCommandError(int) throws android.telephony.ims.ImsException;
    method public void onNetworkResponse(@IntRange(from=100, to=699) int, @NonNull String) throws android.telephony.ims.ImsException;
    method public void onNetworkResponse(@IntRange(from=100, to=699) int, @NonNull String, @IntRange(from=100, to=699) int, @NonNull String) throws android.telephony.ims.ImsException;
    method @Deprecated public void onNetworkResponse(@IntRange(from=100, to=699) int, @NonNull String) throws android.telephony.ims.ImsException;
    method @Deprecated public void onNetworkResponse(@IntRange(from=100, to=699) int, @NonNull String, @IntRange(from=100, to=699) int, @NonNull String) throws android.telephony.ims.ImsException;
    method public default void onNetworkResponse(@NonNull android.telephony.ims.SipDetails) throws android.telephony.ims.ImsException;
    method public void onNotifyCapabilitiesUpdate(@NonNull java.util.List<java.lang.String>) throws android.telephony.ims.ImsException;
    method public void onResourceTerminated(@NonNull java.util.List<android.util.Pair<android.net.Uri,java.lang.String>>) throws android.telephony.ims.ImsException;
    method public void onTerminated(@NonNull String, long) throws android.telephony.ims.ImsException;
+43 −8
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.Manifest;
import android.annotation.CallbackExecutor;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.content.Context;
@@ -472,7 +473,11 @@ public class RcsUceAdapter {
         * The pending request has completed successfully due to all requested contacts information
         * being delivered. The callback {@link #onCapabilitiesReceived(List)}
         * for each contacts is required to be called before {@link #onComplete} is called.
         *
         * @deprecated Replaced by {@link #onComplete(SipDetails)}, deprecated for
         * SIP information.
         */
        @Deprecated
        void onComplete();

        /**
@@ -481,8 +486,36 @@ public class RcsUceAdapter {
         * @param errorCode The reason for the framework being unable to process the request.
         * @param retryIntervalMillis The time in milliseconds the requesting application should
         * wait before retrying, if non-zero.
         *
         * @deprecated Replaced by {@link #onError(int, long, SipDetails)}, deprecated for
         * SIP information.
         */
        @Deprecated
        void onError(@ErrorCode int errorCode, long retryIntervalMillis);

        /**
         * The pending request has completed successfully due to all requested contacts information
         * being delivered. The callback {@link #onCapabilitiesReceived(List)}
         * for each contacts is required to be called before {@link #onComplete} is called.
         *
         * @param details The SIP information related to this request.
         */
        default void onComplete(@Nullable SipDetails details) {
            onComplete();
        };

        /**
         * The pending request has resulted in an error and may need to be retried, depending on the
         * error code.
         * @param errorCode The reason for the framework being unable to process the request.
         * @param retryIntervalMillis The time in milliseconds the requesting application should
         * wait before retrying, if non-zero.
         * @param details The SIP information related to this request.
         */
        default void onError(@ErrorCode int errorCode, long retryIntervalMillis,
                @Nullable SipDetails details) {
            onError(errorCode, retryIntervalMillis);
        };
    }

    private final Context mContext;
@@ -567,19 +600,20 @@ public class RcsUceAdapter {
                }
            }
            @Override
            public void onComplete() {
            public void onComplete(@Nullable SipDetails details) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    executor.execute(() -> c.onComplete());
                    executor.execute(() -> c.onComplete(details));
                } finally {
                    restoreCallingIdentity(callingIdentity);
                }
            }
            @Override
            public void onError(int errorCode, long retryAfterMilliseconds) {
            public void onError(int errorCode, long retryAfterMilliseconds,
                    @Nullable SipDetails details) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds));
                    executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds, details));
                } finally {
                    restoreCallingIdentity(callingIdentity);
                }
@@ -663,19 +697,20 @@ public class RcsUceAdapter {
                }
            }
            @Override
            public void onComplete() {
            public void onComplete(@Nullable SipDetails details) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    executor.execute(() -> c.onComplete());
                    executor.execute(() -> c.onComplete(details));
                } finally {
                    restoreCallingIdentity(callingIdentity);
                }
            }
            @Override
            public void onError(int errorCode, long retryAfterMilliseconds) {
            public void onError(int errorCode, long retryAfterMilliseconds,
                    @Nullable SipDetails details) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds));
                    executor.execute(() -> c.onError(errorCode, retryAfterMilliseconds, details));
                } finally {
                    restoreCallingIdentity(callingIdentity);
                }
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package android.telephony.ims.aidl;

import android.telephony.ims.RcsContactUceCapability;

import android.telephony.ims.SipDetails;
/**
 * Provides interface for RCS UCE when receive a change.
 *
@@ -25,6 +25,6 @@ import android.telephony.ims.RcsContactUceCapability;
 */
oneway interface IRcsUceControllerCallback {
    void onCapabilitiesReceived(in List<RcsContactUceCapability> contactCapabilities);
    void onComplete();
    void onError(int errorCode, long retryAfterMilliseconds);
    void onComplete(in SipDetails details);
    void onError(int errorCode, long retryAfterMilliseconds, in SipDetails details);
}
+2 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telephony.ims.aidl;

import android.net.Uri;
import android.telephony.ims.RcsContactTerminatedReason;
import android.telephony.ims.SipDetails;

import java.util.List;
import java.util.Map;
@@ -29,8 +30,7 @@ import java.util.Map;
 */
oneway interface ISubscribeResponseCallback {
    void onCommandError(int code);
    void onNetworkResponse(int code, in String reason);
    void onNetworkRespHeader(int code, String reasonPhrase, int reasonHeaderCause, String reasonHeaderText);
    void onNetworkResponse(in SipDetails detail);
    void onNotifyCapabilitiesUpdate(in List<String> pidfXmls);
    void onResourceTerminated(in List<RcsContactTerminatedReason> uriTerminatedReason);
    void onTerminated(in String reason, long retryAfterMilliseconds);
+23 −4
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package android.telephony.ims.aidl;

import android.annotation.NonNull;
import android.net.Uri;
import android.os.RemoteException;
import android.telephony.ims.ImsException;
import android.telephony.ims.RcsContactTerminatedReason;
import android.telephony.ims.SipDetails;
import android.telephony.ims.stub.RcsCapabilityExchangeImplBase.SubscribeResponseCallback;
import android.util.Pair;

@@ -49,20 +51,37 @@ public class RcsSubscribeResponseAidlWrapper implements SubscribeResponseCallbac
    }

    @Override
    public void onNetworkResponse(int code, String reason) throws ImsException {
    @Deprecated
    public void onNetworkResponse(int code, String reasonPhrase) throws ImsException {
        try {
            mResponseBinder.onNetworkResponse(code, reason);
            mResponseBinder.onNetworkResponse(new SipDetails.Builder(
                    SipDetails.METHOD_SUBSCRIBE)
                    .setSipResponseCode(code, reasonPhrase)
                    .build());
        } catch (RemoteException e) {
            throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
        }
    }

    @Override
    @Deprecated
    public void onNetworkResponse(int code, String reasonPhrase, int reasonHeaderCause,
            String reasonHeaderText) throws ImsException {
        try {
            mResponseBinder.onNetworkRespHeader(code, reasonPhrase, reasonHeaderCause,
                    reasonHeaderText);
            mResponseBinder.onNetworkResponse(new SipDetails.Builder(
                    SipDetails.METHOD_SUBSCRIBE)
                    .setSipResponseCode(code, reasonPhrase)
                    .setSipResponseReasonHeader(reasonHeaderCause, reasonHeaderText)
                    .build());
        } catch (RemoteException e) {
            throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
        }
    }

    @Override
    public void onNetworkResponse(@NonNull SipDetails details) throws ImsException {
        try {
            mResponseBinder.onNetworkResponse(details);
        } catch (RemoteException e) {
            throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
        }
Loading