diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsFeature.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsFeature.aidl index b47e3c75b5585..10c50bed34d7c 100644 --- a/telephony/java/android/telephony/ims/aidl/IImsRcsFeature.aidl +++ b/telephony/java/android/telephony/ims/aidl/IImsRcsFeature.aidl @@ -22,7 +22,6 @@ import android.telephony.ims.aidl.ICapabilityExchangeEventListener; import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IOptionsResponseCallback; import android.telephony.ims.aidl.IPublishResponseCallback; -import android.telephony.ims.aidl.IRcsFeatureListener; import android.telephony.ims.aidl.ISubscribeResponseCallback; import android.telephony.ims.feature.CapabilityChangeRequest; @@ -34,7 +33,6 @@ import java.util.List; */ interface IImsRcsFeature { // Not oneway because we need to verify this completes before doing anything else. - void setListener(IRcsFeatureListener listener); int queryCapabilityStatus(); // Inherited from ImsFeature int getFeatureState(); @@ -50,14 +48,4 @@ interface IImsRcsFeature { oneway void subscribeForCapabilities(in List uris, ISubscribeResponseCallback cb); oneway void sendOptionsCapabilityRequest(in Uri contactUri, in List myCapabilities, IOptionsResponseCallback cb); - // RcsPresenceExchangeImplBase specific api - oneway void requestCapabilities(in List uris, int operationToken); - oneway void updateCapabilities(in RcsContactUceCapability capabilities, int operationToken); - // RcsSipOptionsImplBase specific api - oneway void sendCapabilityRequest(in Uri contactUri, - in RcsContactUceCapability capabilities, int operationToken); - oneway void respondToCapabilityRequest(in String contactUri, - in RcsContactUceCapability ownCapabilities, int operationToken); - oneway void respondToCapabilityRequestWithError(in Uri contactUri, int code, in String reason, - int operationToken); } diff --git a/telephony/java/android/telephony/ims/aidl/IRcsFeatureListener.aidl b/telephony/java/android/telephony/ims/aidl/IRcsFeatureListener.aidl deleted file mode 100644 index 70cf651d39246..0000000000000 --- a/telephony/java/android/telephony/ims/aidl/IRcsFeatureListener.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony.ims.aidl; - -import android.net.Uri; -import android.telephony.ims.RcsContactUceCapability; - -import java.util.List; - -/** - * Listener interface for updates from the RcsFeature back to the framework. - * {@hide} - */ -interface IRcsFeatureListener { - //RcsCapabilityExchange specific - oneway void onCommandUpdate(int commandCode, int operationToken); - // RcsPresenceExchangeImplBase Specific - oneway void onNetworkResponse(int code, in String reason, int operationToken); - oneway void onCapabilityRequestResponsePresence(in List infos, - int operationToken); - oneway void onNotifyUpdateCapabilities(int publishTriggerType); - oneway void onUnpublish(); - // RcsSipOptionsImplBase specific - oneway void onCapabilityRequestResponseOptions(int code, in String reason, - in RcsContactUceCapability info, int operationToken); - oneway void onRemoteCapabilityRequest(in Uri contactUri, in RcsContactUceCapability remoteInfo, - int operationToken); -} diff --git a/telephony/java/android/telephony/ims/feature/RcsFeature.java b/telephony/java/android/telephony/ims/feature/RcsFeature.java index 5de2ddc578a1c..cde7067e8bf36 100644 --- a/telephony/java/android/telephony/ims/feature/RcsFeature.java +++ b/telephony/java/android/telephony/ims/feature/RcsFeature.java @@ -19,17 +19,16 @@ package android.telephony.ims.feature; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.Uri; import android.os.RemoteException; -import android.telephony.ims.RcsContactUceCapability; import android.telephony.ims.RcsUceAdapter; import android.telephony.ims.aidl.ICapabilityExchangeEventListener; import android.telephony.ims.aidl.IImsCapabilityCallback; import android.telephony.ims.aidl.IImsRcsFeature; import android.telephony.ims.aidl.IOptionsResponseCallback; import android.telephony.ims.aidl.IPublishResponseCallback; -import android.telephony.ims.aidl.IRcsFeatureListener; import android.telephony.ims.aidl.ISubscribeResponseCallback; import android.telephony.ims.aidl.RcsOptionsResponseAidlWrapper; import android.telephony.ims.aidl.RcsPublishResponseAidlWrapper; @@ -74,16 +73,6 @@ public class RcsFeature extends ImsFeature { mExecutor = executor; } - /** - * @deprecated This method is deprecated. Please call the method - * setCapabilityExchangeEventListener instead. - */ - @Override - @Deprecated - public void setListener(IRcsFeatureListener listener) { - Log.w(LOG_TAG, "The method setListener is deprecated"); - } - @Override public int queryCapabilityStatus() throws RemoteException { return executeMethodAsyncForResult( @@ -124,7 +113,7 @@ public class RcsFeature extends ImsFeature { // RcsCapabilityExchangeImplBase specific APIs @Override public void setCapabilityExchangeEventListener( - @NonNull ICapabilityExchangeEventListener listener) throws RemoteException { + @Nullable ICapabilityExchangeEventListener listener) throws RemoteException { executeMethodAsync(() -> mReference.setCapabilityExchangeEventListener(listener), "setCapabilityExchangeEventListener"); } @@ -155,34 +144,6 @@ public class RcsFeature extends ImsFeature { "sendOptionsCapabilityRequest"); } - // RcsPresenceExchangeImplBase specific APIS - @Override - public void requestCapabilities(List uris, int operationToken) throws RemoteException { - throw new RemoteException("Unsupported operation: requestCapabilities"); - } - @Override - public void updateCapabilities(RcsContactUceCapability capabilities, int operationToken) - throws RemoteException { - throw new RemoteException("Unsupported operation: updateCapabilities"); - } - // RcsSipOptionsImplBase specific APIS - @Override - public void sendCapabilityRequest(Uri contactUri, RcsContactUceCapability capabilities, - int operationToken) throws RemoteException { - throw new RemoteException("Unsupported operation: sendCapabilityRequest"); - } - @Override - public void respondToCapabilityRequest(String contactUri, - RcsContactUceCapability ownCapabilities, int operationToken) - throws RemoteException { - throw new RemoteException("Unsupported operation: respondToCapabilityRequest"); - } - @Override - public void respondToCapabilityRequestWithError(Uri contactUri, int code, String reason, - int operationToken) throws RemoteException { - throw new RemoteException("Unsupported operation: respondToCapabilityRequestWithError"); - } - // Call the methods with a clean calling identity on the executor and wait indefinitely for // the future to return. private void executeMethodAsync(Runnable r, String errorLogName) diff --git a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java b/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java deleted file mode 100644 index 0b13efb7b4b48..0000000000000 --- a/telephony/java/android/telephony/ims/stub/RcsCapabilityExchange.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony.ims.stub; - -import android.annotation.IntDef; -import android.os.RemoteException; -import android.telephony.ims.ImsException; -import android.telephony.ims.aidl.IRcsFeatureListener; -import android.telephony.ims.feature.ImsFeature; -import android.telephony.ims.feature.RcsFeature; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Base class for different types of Capability exchange, presence using - * {@link RcsPresenceExchangeImplBase} and SIP OPTIONS exchange using {@link RcsSipOptionsImplBase}. - * - * @hide - */ -public class RcsCapabilityExchange { - - /** Service is unknown. */ - public static final int COMMAND_CODE_SERVICE_UNKNOWN = 0; - /** The command completed successfully. */ - public static final int COMMAND_CODE_SUCCESS = 1; - /** The command failed with an unknown error. */ - public static final int COMMAND_CODE_GENERIC_FAILURE = 2; - /** Invalid parameter(s). */ - public static final int COMMAND_CODE_INVALID_PARAM = 3; - /** Fetch error. */ - public static final int COMMAND_CODE_FETCH_ERROR = 4; - /** Request timed out. */ - public static final int COMMAND_CODE_REQUEST_TIMEOUT = 5; - /** Failure due to insufficient memory available. */ - public static final int COMMAND_CODE_INSUFFICIENT_MEMORY = 6; - /** Network connection is lost. */ - public static final int COMMAND_CODE_LOST_NETWORK_CONNECTION = 7; - /** Requested feature/resource is not supported. */ - public static final int COMMAND_CODE_NOT_SUPPORTED = 8; - /** Contact or resource is not found. */ - public static final int COMMAND_CODE_NOT_FOUND = 9; - /** Service is not available. */ - public static final int COMMAND_CODE_SERVICE_UNAVAILABLE = 10; - /** No Change in Capabilities */ - public static final int COMMAND_CODE_NO_CHANGE_IN_CAP = 11; - - /** @hide*/ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = "COMMAND_CODE_", value = { - COMMAND_CODE_SERVICE_UNKNOWN, - COMMAND_CODE_SUCCESS, - COMMAND_CODE_GENERIC_FAILURE, - COMMAND_CODE_INVALID_PARAM, - COMMAND_CODE_FETCH_ERROR, - COMMAND_CODE_REQUEST_TIMEOUT, - COMMAND_CODE_INSUFFICIENT_MEMORY, - COMMAND_CODE_LOST_NETWORK_CONNECTION, - COMMAND_CODE_NOT_SUPPORTED, - COMMAND_CODE_NOT_FOUND, - COMMAND_CODE_SERVICE_UNAVAILABLE, - COMMAND_CODE_NO_CHANGE_IN_CAP - }) - public @interface CommandCode {} - - - private RcsFeature mFeature; - - /** @hide */ - public final void initialize(RcsFeature feature) { - mFeature = feature; - } - - /** @hide */ - protected final IRcsFeatureListener getListener() throws ImsException { - throw new ImsException("This method is deprecated.", - ImsException.CODE_ERROR_UNSUPPORTED_OPERATION); - } - - /** - * Provides the framework with an update as to whether or not a command completed successfully - * locally. This includes capabilities requests and updates from the network. If it does not - * complete successfully, then the framework may retry the command again later, depending on the - * error. If the command does complete successfully, the framework will then wait for network - * updates. - * - * @param code The result of the pending command. If {@link #COMMAND_CODE_SUCCESS}, further - * updates will be sent for this command using the associated operationToken. - * @param operationToken the token associated with the pending command. - * @throws ImsException If this {@link RcsCapabilityExchange} 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. - */ - public final void onCommandUpdate(@CommandCode int code, int operationToken) - throws ImsException { - try { - getListener().onCommandUpdate(code, operationToken); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } -} diff --git a/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java b/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java deleted file mode 100644 index bb034489a2962..0000000000000 --- a/telephony/java/android/telephony/ims/stub/RcsPresenceExchangeImplBase.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony.ims.stub; - -import android.annotation.IntDef; -import android.annotation.NonNull; -import android.net.Uri; -import android.os.RemoteException; -import android.telephony.ims.ImsException; -import android.telephony.ims.RcsContactUceCapability; -import android.telephony.ims.feature.ImsFeature; -import android.telephony.ims.feature.RcsFeature; -import android.util.Log; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.List; - -/** - * Base implementation for RCS User Capability Exchange using Presence. Any ImsService implementing - * this service must implement the stub methods {@link #requestCapabilities(List, int)} and - * {@link #updateCapabilities(RcsContactUceCapability, int)}. - * - * @hide - */ -public class RcsPresenceExchangeImplBase extends RcsCapabilityExchange { - - private static final String LOG_TAG = "RcsPresenceExchangeIB"; - - /** - * The request has resulted in any other 4xx/5xx/6xx that is not covered below. No retry will be - * attempted. - */ - public static final int RESPONSE_SUBSCRIBE_GENERIC_FAILURE = -1; - - /** - * The request has succeeded with a “200” message from the network. - */ - public static final int RESPONSE_SUCCESS = 0; - - /** - * The request has resulted in a “403” (User Not Registered) error from the network. Will retry - * capability polling with an exponential backoff. - */ - public static final int RESPONSE_NOT_REGISTERED = 1; - - /** - * The request has resulted in a “403” (not authorized (Requestor)) error from the network. No - * retry will be attempted. - */ - public static final int RESPONSE_NOT_AUTHORIZED_FOR_PRESENCE = 2; - - /** - * The request has resulted in a "403” (Forbidden) or other “403” error from the network and - * will be handled the same as “404” Not found. No retry will be attempted. - */ - public static final int RESPONSE_FORBIDDEN = 3; - - /** - * The request has resulted in a “404” (Not found) result from the network. No retry will be - * attempted. - */ - public static final int RESPONSE_NOT_FOUND = 4; - - /** - * The request has resulted in a “408” response. Retry after exponential backoff. - */ - public static final int RESPONSE_SIP_REQUEST_TIMEOUT = 5; - - /** - * The network has responded with a “413” (Too Large) response from the network. Capability - * request contains too many items and must be shrunk before the request will be accepted. - */ - public static final int RESPONSE_SUBSCRIBE_TOO_LARGE = 6; - - /** - * The request has resulted in a “423” response. Retry after exponential backoff. - */ - public static final int RESPONSE_SIP_INTERVAL_TOO_SHORT = 7; - - /** - * The request has resulted in a “503” response. Retry after exponential backoff. - */ - public static final int RESPONSE_SIP_SERVICE_UNAVAILABLE = 8; - - /** @hide*/ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = "RESPONSE_", value = { - RESPONSE_SUBSCRIBE_GENERIC_FAILURE, - RESPONSE_SUCCESS, - RESPONSE_NOT_REGISTERED, - RESPONSE_NOT_AUTHORIZED_FOR_PRESENCE, - RESPONSE_FORBIDDEN, - RESPONSE_NOT_FOUND, - RESPONSE_SIP_REQUEST_TIMEOUT, - RESPONSE_SUBSCRIBE_TOO_LARGE, - RESPONSE_SIP_INTERVAL_TOO_SHORT, - RESPONSE_SIP_SERVICE_UNAVAILABLE - }) - public @interface PresenceResponseCode {} - - - /** A capability update has been requested due to the Entity Tag (ETag) expiring. */ - public static final int CAPABILITY_UPDATE_TRIGGER_ETAG_EXPIRED = 0; - /** A capability update has been requested due to moving to LTE with VoPS disabled. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_DISABLED = 1; - /** A capability update has been requested due to moving to LTE with VoPS enabled. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_ENABLED = 2; - /** A capability update has been requested due to moving to eHRPD. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_EHRPD = 3; - /** A capability update has been requested due to moving to HSPA+. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_HSPAPLUS = 4; - /** A capability update has been requested due to moving to 3G. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_3G = 5; - /** A capability update has been requested due to moving to 2G. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_2G = 6; - /** A capability update has been requested due to moving to WLAN */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_WLAN = 7; - /** A capability update has been requested due to moving to IWLAN */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_IWLAN = 8; - /** A capability update has been requested but the reason is unknown. */ - public static final int CAPABILITY_UPDATE_TRIGGER_UNKNOWN = 9; - /** A capability update has been requested due to moving to 5G NR with VoPS disabled. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_DISABLED = 10; - /** A capability update has been requested due to moving to 5G NR with VoPS enabled. */ - public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_ENABLED = 11; - - /** @hide*/ - @IntDef(value = { - CAPABILITY_UPDATE_TRIGGER_ETAG_EXPIRED, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_DISABLED, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_LTE_VOPS_ENABLED, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_EHRPD, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_HSPAPLUS, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_3G, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_2G, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_WLAN, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_IWLAN, - CAPABILITY_UPDATE_TRIGGER_UNKNOWN, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_DISABLED, - CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_ENABLED - }, prefix = "CAPABILITY_UPDATE_TRIGGER_") - @Retention(RetentionPolicy.SOURCE) - public @interface StackPublishTriggerType { - } - - /** - * Provide the framework with a subsequent network response update to - * {@link #updateCapabilities(RcsContactUceCapability, int)} and - * {@link #requestCapabilities(List, int)} operations. - * - * @param code The SIP response code sent from the network for the operation token specified. - * @param reason The optional reason response from the network. If the network provided no - * reason with the code, the string should be empty. - * @param operationToken The token associated with the operation this service is providing a - * response for. - * @throws ImsException If this {@link RcsPresenceExchangeImplBase} 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. - */ - public final void onNetworkResponse(@PresenceResponseCode int code, @NonNull String reason, - int operationToken) throws ImsException { - try { - getListener().onNetworkResponse(code, reason, operationToken); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Provides the framework with the requested contacts’ capabilities requested by the framework - * using {@link #requestCapabilities(List, int)}. - * - * @throws ImsException If this {@link RcsPresenceExchangeImplBase} 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. - */ - public final void onCapabilityRequestResponse(@NonNull List infos, - int operationToken) throws ImsException { - try { - getListener().onCapabilityRequestResponsePresence(infos, operationToken); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Trigger the framework to provide a capability update using - * {@link #updateCapabilities(RcsContactUceCapability, int)}. - *

- * This is typically used when trying to generate an initial PUBLISH for a new subscription to - * the network. The device will cache all presence publications after boot until this method is - * called once. - * @param publishTriggerType {@link StackPublishTriggerType} The reason for the capability - * update request. - * @throws ImsException If this {@link RcsPresenceExchangeImplBase} 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. - */ - public final void onNotifyUpdateCapabilites(@StackPublishTriggerType int publishTriggerType) - throws ImsException { - try { - getListener().onNotifyUpdateCapabilities(publishTriggerType); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Notify the framework that the device’s capabilities have been unpublished from the network. - * - * @throws ImsException If this {@link RcsPresenceExchangeImplBase} 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. - */ - public final void onUnpublish() throws ImsException { - try { - getListener().onUnpublish(); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * The user capabilities of one or multiple contacts have been requested by the framework. - *

- * The implementer must follow up this call with an {@link #onCommandUpdate(int, int)} call to - * indicate whether or not this operation succeeded. If this operation succeeds, network - * response updates should be sent to the framework using - * {@link #onNetworkResponse(int, String, int)}. When the operation is completed, - * {@link #onCapabilityRequestResponse(List, int)} should be called with the presence - * information for the contacts specified. - * @param uris A {@link List} of the {@link Uri}s that the framework is requesting the UCE - * capabilities for. - * @param operationToken The token associated with this operation. Updates to this request using - * {@link #onCommandUpdate(int, int)}, {@link #onNetworkResponse(int, String, int)}, and - * {@link #onCapabilityRequestResponse(List, int)} must use the same operation token - * in response. - */ - public void requestCapabilities(@NonNull List uris, int operationToken) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "requestCapabilities called with no implementation."); - try { - getListener().onCommandUpdate(COMMAND_CODE_NOT_SUPPORTED, operationToken); - } catch (RemoteException | ImsException e) { - // Do not do anything, this is a stub implementation. - } - } - - /** - * The capabilities of this device have been updated and should be published to the network. - *

- * The implementer must follow up this call with an {@link #onCommandUpdate(int, int)} call to - * indicate whether or not this operation succeeded. If this operation succeeds, network - * response updates should be sent to the framework using - * {@link #onNetworkResponse(int, String, int)}. - * @param capabilities The capabilities for this device. - * @param operationToken The token associated with this operation. Any subsequent - * {@link #onCommandUpdate(int, int)} or {@link #onNetworkResponse(int, String, int)} - * calls regarding this update must use the same token. - */ - public void updateCapabilities(@NonNull RcsContactUceCapability capabilities, - int operationToken) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "updateCapabilities called with no implementation."); - try { - getListener().onCommandUpdate(COMMAND_CODE_NOT_SUPPORTED, operationToken); - } catch (RemoteException | ImsException e) { - // Do not do anything, this is a stub implementation. - } - } -} diff --git a/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java b/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java deleted file mode 100644 index 2035fac4fae00..0000000000000 --- a/telephony/java/android/telephony/ims/stub/RcsSipOptionsImplBase.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.telephony.ims.stub; - -import android.annotation.IntDef; -import android.annotation.NonNull; -import android.annotation.Nullable; -import android.net.Uri; -import android.os.RemoteException; -import android.telephony.ims.ImsException; -import android.telephony.ims.RcsContactUceCapability; -import android.telephony.ims.feature.ImsFeature; -import android.telephony.ims.feature.RcsFeature; -import android.util.Log; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Base implementation for RCS User Capability Exchange using SIP OPTIONS. - * - * @hide - */ -public class RcsSipOptionsImplBase extends RcsCapabilityExchange { - - private static final String LOG_TAG = "RcsSipOptionsImplBase"; - - /** - * Indicates a SIP response from the remote user other than 200, 480, 408, 404, or 604. - */ - public static final int RESPONSE_GENERIC_FAILURE = -1; - - /** - * Indicates that the remote user responded with a 200 OK response. - */ - public static final int RESPONSE_SUCCESS = 0; - - /** - * Indicates that the remote user responded with a 480 TEMPORARY UNAVAILABLE response. - */ - public static final int RESPONSE_TEMPORARILY_UNAVAILABLE = 1; - - /** - * Indicates that the remote user responded with a 408 REQUEST TIMEOUT response. - */ - public static final int RESPONSE_REQUEST_TIMEOUT = 2; - - /** - * Indicates that the remote user responded with a 404 NOT FOUND response. - */ - public static final int RESPONSE_NOT_FOUND = 3; - - /** - * Indicates that the remote user responded with a 604 DOES NOT EXIST ANYWHERE response. - */ - public static final int RESPONSE_DOES_NOT_EXIST_ANYWHERE = 4; - - /** - * Indicates that the remote user responded with a 400 BAD REQUEST response. - */ - public static final int RESPONSE_BAD_REQUEST = 5; - - /** @hide*/ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = "RESPONSE_", value = { - RESPONSE_GENERIC_FAILURE, - RESPONSE_SUCCESS, - RESPONSE_TEMPORARILY_UNAVAILABLE, - RESPONSE_REQUEST_TIMEOUT, - RESPONSE_NOT_FOUND, - RESPONSE_DOES_NOT_EXIST_ANYWHERE, - RESPONSE_BAD_REQUEST - }) - public @interface SipResponseCode {} - - /** - * Send the response of a SIP OPTIONS capability exchange to the framework. If {@code code} is - * {@link #RESPONSE_SUCCESS}, info must be non-null. - * @param code The SIP response code that was sent by the network in response to the request - * sent by {@link #sendCapabilityRequest(Uri, RcsContactUceCapability, int)}. - * @param reason The optional SIP response reason sent by the network. If none was sent, this - * should be an empty string. - * @param info the contact's UCE capabilities associated with the capability request. - * @param operationToken The token associated with the original capability request, set by - * {@link #sendCapabilityRequest(Uri, RcsContactUceCapability, int)}. - * @throws ImsException If this {@link RcsSipOptionsImplBase} 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. - */ - public final void onCapabilityRequestResponse(@SipResponseCode int code, @NonNull String reason, - @Nullable RcsContactUceCapability info, int operationToken) throws ImsException { - try { - getListener().onCapabilityRequestResponseOptions(code, reason, info, operationToken); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Inform the framework of a query for this device's UCE capabilities. - *

- * The framework will respond via the - * {@link #respondToCapabilityRequest(String, RcsContactUceCapability, int)} or - * {@link #respondToCapabilityRequestWithError(Uri, int, String, int)} method. - * @param contactUri The URI associated with the remote contact that is requesting capabilities. - * @param remoteInfo The remote contact's capability information. - * @param operationToken An unique operation token that you have generated that will be returned - * by the framework in - * {@link #respondToCapabilityRequest(String, RcsContactUceCapability, int)}. - * @throws ImsException If this {@link RcsSipOptionsImplBase} 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. - */ - public final void onRemoteCapabilityRequest(@NonNull Uri contactUri, - @NonNull RcsContactUceCapability remoteInfo, int operationToken) throws ImsException { - try { - getListener().onRemoteCapabilityRequest(contactUri, remoteInfo, operationToken); - } catch (RemoteException e) { - throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE); - } - } - - /** - * Push one's own capabilities to a remote user via the SIP OPTIONS presence exchange mechanism - * in order to receive the capabilities of the remote user in response. - *

- * The implementer must call - * {@link #onCapabilityRequestResponse(int, String, RcsContactUceCapability, int)} to send the - * response of this query back to the framework. - * @param contactUri The URI of the remote user that we wish to get the capabilities of. - * @param capabilities The capabilities of this device to send to the remote user. - * @param operationToken A token generated by the framework that will be passed through - * {@link #onCapabilityRequestResponse(int, String, RcsContactUceCapability, int)} when this - * operation has succeeded. - */ - public void sendCapabilityRequest(@NonNull Uri contactUri, - @NonNull RcsContactUceCapability capabilities, int operationToken) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "sendCapabilityRequest called with no implementation."); - try { - getListener().onCommandUpdate(COMMAND_CODE_NOT_SUPPORTED, operationToken); - } catch (RemoteException | ImsException e) { - // Do not do anything, this is a stub implementation. - } - } - - /** - * Respond to a remote capability request from the contact specified with the capabilities of - * this device. - *

- * The framework will use the same token and uri as what was passed in to - * {@link #onRemoteCapabilityRequest(Uri, RcsContactUceCapability, int)}. - * @param contactUri The URI of the remote contact. - * @param ownCapabilities The capabilities of this device. - * @param operationToken The token generated by the framework that this service obtained when - * {@link #onRemoteCapabilityRequest(Uri, RcsContactUceCapability, int)} was called. - */ - public void respondToCapabilityRequest(@NonNull String contactUri, - @NonNull RcsContactUceCapability ownCapabilities, int operationToken) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "respondToCapabilityRequest called with no implementation."); - try { - getListener().onCommandUpdate(COMMAND_CODE_NOT_SUPPORTED, operationToken); - } catch (RemoteException | ImsException e) { - // Do not do anything, this is a stub implementation. - } - } - - /** - * Respond to a remote capability request from the contact specified with the specified error. - *

- * The framework will use the same token and uri as what was passed in to - * {@link #onRemoteCapabilityRequest(Uri, RcsContactUceCapability, int)}. - * @param contactUri A URI containing the remote contact. - * @param code The SIP response code to respond with. - * @param reason A non-null String containing the reason associated with the SIP code. - * @param operationToken The token provided by the framework when - * {@link #onRemoteCapabilityRequest(Uri, RcsContactUceCapability, int)} was called. - */ - public void respondToCapabilityRequestWithError(@NonNull Uri contactUri, - @SipResponseCode int code, @NonNull String reason, int operationToken) { - // Stub - to be implemented by service - Log.w(LOG_TAG, "respondToCapabiltyRequestWithError called with no implementation."); - try { - getListener().onCommandUpdate(COMMAND_CODE_NOT_SUPPORTED, operationToken); - } catch (RemoteException | ImsException e) { - // Do not do anything, this is a stub implementation. - } - } -}