Merge "Expose the RCS UCE APIs for capabilities request with presence mechanism." am: 4548fab7d6 am: 795855ec7b

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If010dd634828edb03ecb115c7cdc42f3faade053
This commit is contained in:
James Lin
2021-01-28 21:06:35 +00:00
committed by Automerger Merge Worker
7 changed files with 383 additions and 81 deletions

View File

@@ -11782,11 +11782,100 @@ package android.telephony.ims {
field public static final String RCS_PROFILE_2_3 = "UP_2.3";
}
public final class RcsContactPresenceTuple implements android.os.Parcelable {
method public int describeContents();
method @Nullable public android.net.Uri getContactUri();
method @Nullable public android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities getServiceCapabilities();
method @Nullable public String getServiceDescription();
method @NonNull public String getServiceId();
method @NonNull public String getServiceVersion();
method @NonNull public String getStatus();
method @Nullable public String getTimestamp();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.RcsContactPresenceTuple> CREATOR;
field public static final String SERVICE_ID_CALL_COMPOSER = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.callcomposer";
field public static final String SERVICE_ID_CHATBOT = "org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.chatbot";
field public static final String SERVICE_ID_CHATBOT_ROLE = "org.gsma.rcs.isbot";
field public static final String SERVICE_ID_CHATBOT_STANDALONE = " org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.chatbot.sa";
field public static final String SERVICE_ID_CHAT_V1 = "org.openmobilealliance:IM-session";
field public static final String SERVICE_ID_CHAT_V2 = "org.openmobilealliance:ChatSession";
field public static final String SERVICE_ID_FT = "org.openmobilealliance:File-Transfer-HTTP";
field public static final String SERVICE_ID_FT_OVER_SMS = "org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.ftsms";
field public static final String SERVICE_ID_GEO_PUSH = "org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.geopush";
field public static final String SERVICE_ID_GEO_PUSH_VIA_SMS = "org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.geosms";
field public static final String SERVICE_ID_MMTEL = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.mmtel";
field public static final String SERVICE_ID_POST_CALL = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.callunanswered";
field public static final String SERVICE_ID_SHARED_MAP = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.sharedmap";
field public static final String SERVICE_ID_SHARED_SKETCH = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.sharedsketch";
field public static final String TUPLE_BASIC_STATUS_CLOSED = "closed";
field public static final String TUPLE_BASIC_STATUS_OPEN = "open";
}
public static final class RcsContactPresenceTuple.Builder {
ctor public RcsContactPresenceTuple.Builder(@NonNull String, @NonNull String, @NonNull String);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple build();
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.Builder setContactUri(@NonNull android.net.Uri);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.Builder setServiceCapabilities(@NonNull android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.Builder setServiceDescription(@NonNull String);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.Builder setTimestamp(@NonNull String);
}
public static final class RcsContactPresenceTuple.ServiceCapabilities implements android.os.Parcelable {
method public int describeContents();
method @NonNull public java.util.List<java.lang.String> getSupportedDuplexModes();
method @NonNull public java.util.List<java.lang.String> getUnsupportedDuplexModes();
method public boolean isAudioCapable();
method public boolean isVideoCapable();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities> CREATOR;
field public static final String DUPLEX_MODE_FULL = "full";
field public static final String DUPLEX_MODE_HALF = "half";
field public static final String DUPLEX_MODE_RECEIVE_ONLY = "receive-only";
field public static final String DUPLEX_MODE_SEND_ONLY = "send-only";
}
public static final class RcsContactPresenceTuple.ServiceCapabilities.Builder {
ctor public RcsContactPresenceTuple.ServiceCapabilities.Builder(boolean, boolean);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities.Builder addSupportedDuplexMode(@NonNull String);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities.Builder addUnsupportedDuplexMode(@NonNull String);
method @NonNull public android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities build();
}
public final class RcsContactUceCapability implements android.os.Parcelable {
method public int describeContents();
method public int getCapabilityMechanism();
method @Nullable public android.telephony.ims.RcsContactPresenceTuple getCapabilityTuple(@NonNull String);
method @NonNull public java.util.List<android.telephony.ims.RcsContactPresenceTuple> getCapabilityTuples();
method @NonNull public android.net.Uri getContactUri();
method public int getRequestResult();
method public int getSourceType();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field public static final int CAPABILITY_MECHANISM_OPTIONS = 2; // 0x2
field public static final int CAPABILITY_MECHANISM_PRESENCE = 1; // 0x1
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.RcsContactUceCapability> CREATOR;
field public static final int REQUEST_RESULT_FOUND = 3; // 0x3
field public static final int REQUEST_RESULT_NOT_FOUND = 2; // 0x2
field public static final int REQUEST_RESULT_NOT_ONLINE = 1; // 0x1
field public static final int REQUEST_RESULT_UNKNOWN = 0; // 0x0
field public static final int SOURCE_TYPE_CACHED = 1; // 0x1
field public static final int SOURCE_TYPE_NETWORK = 0; // 0x0
}
public static final class RcsContactUceCapability.PresenceBuilder {
ctor public RcsContactUceCapability.PresenceBuilder(@NonNull android.net.Uri, int, int);
method @NonNull public android.telephony.ims.RcsContactUceCapability.PresenceBuilder addCapabilityTuple(@NonNull android.telephony.ims.RcsContactPresenceTuple);
method @NonNull public android.telephony.ims.RcsContactUceCapability.PresenceBuilder addCapabilityTuples(@NonNull java.util.List<android.telephony.ims.RcsContactPresenceTuple>);
method @NonNull public android.telephony.ims.RcsContactUceCapability build();
}
public class RcsUceAdapter {
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void addOnPublishStateChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RcsUceAdapter.OnPublishStateChangedListener) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getUcePublishState() throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void removeOnPublishStateChangedListener(@NonNull android.telephony.ims.RcsUceAdapter.OnPublishStateChangedListener) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestAvailability(@NonNull android.net.Uri, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RcsUceAdapter.CapabilitiesCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void requestCapabilities(@NonNull java.util.List<android.net.Uri>, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RcsUceAdapter.CapabilitiesCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUceSettingEnabled(boolean) throws android.telephony.ims.ImsException;
field public static final int CAPABILITY_TYPE_PRESENCE_UCE = 2; // 0x2
field public static final int CAPABILITY_UPDATE_TRIGGER_ETAG_EXPIRED = 1; // 0x1
field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_2G = 7; // 0x7
field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_3G = 6; // 0x6
@@ -11799,6 +11888,18 @@ package android.telephony.ims {
field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_NR5G_VOPS_ENABLED = 11; // 0xb
field public static final int CAPABILITY_UPDATE_TRIGGER_MOVE_TO_WLAN = 8; // 0x8
field public static final int CAPABILITY_UPDATE_TRIGGER_UNKNOWN = 0; // 0x0
field public static final int ERROR_FORBIDDEN = 6; // 0x6
field public static final int ERROR_GENERIC_FAILURE = 1; // 0x1
field public static final int ERROR_INSUFFICIENT_MEMORY = 10; // 0xa
field public static final int ERROR_LOST_NETWORK = 11; // 0xb
field public static final int ERROR_NOT_AUTHORIZED = 5; // 0x5
field public static final int ERROR_NOT_AVAILABLE = 3; // 0x3
field public static final int ERROR_NOT_ENABLED = 2; // 0x2
field public static final int ERROR_NOT_FOUND = 7; // 0x7
field public static final int ERROR_NOT_REGISTERED = 4; // 0x4
field public static final int ERROR_REQUEST_TIMEOUT = 9; // 0x9
field public static final int ERROR_REQUEST_TOO_LARGE = 8; // 0x8
field public static final int ERROR_SERVER_UNAVAILABLE = 12; // 0xc
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
@@ -11807,6 +11908,12 @@ package android.telephony.ims {
field public static final int PUBLISH_STATE_VOICE_PROVISION_ERROR = 3; // 0x3
}
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);
}
public static interface RcsUceAdapter.OnPublishStateChangedListener {
method public void onPublishStateChange(int);
}
@@ -12217,6 +12324,7 @@ package android.telephony.ims.stub {
public class RcsCapabilityExchangeImplBase {
ctor public RcsCapabilityExchangeImplBase(@NonNull java.util.concurrent.Executor);
method public void publishCapabilities(@NonNull String, @NonNull android.telephony.ims.stub.RcsCapabilityExchangeImplBase.PublishResponseCallback);
method public void subscribeForCapabilities(@NonNull java.util.List<android.net.Uri>, @NonNull android.telephony.ims.stub.RcsCapabilityExchangeImplBase.SubscribeResponseCallback);
field public static final int COMMAND_CODE_FETCH_ERROR = 3; // 0x3
field public static final int COMMAND_CODE_GENERIC_FAILURE = 1; // 0x1
field public static final int COMMAND_CODE_INSUFFICIENT_MEMORY = 5; // 0x5
@@ -12235,6 +12343,14 @@ package android.telephony.ims.stub {
method public void onNetworkResponse(@IntRange(from=100, to=699) int, @NonNull String) throws android.telephony.ims.ImsException;
}
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 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;
}
public interface SipDelegate {
method public void closeDialog(@NonNull String);
method public void notifyMessageReceiveError(@NonNull String, int);

View File

@@ -19,6 +19,7 @@ package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -34,14 +35,135 @@ import java.util.List;
* network during a SUBSCRIBE request. See RFC3863 for more information.
* @hide
*/
@SystemApi
public final class RcsContactPresenceTuple implements Parcelable {
/** The service id of the MMTEL */
/**
* The service ID used to indicate that MMTEL service is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_MMTEL = "org.3gpp.urn:urn-7:3gpp-service.ims.icsi.mmtel";
/** The service id of the Call Composer */
/**
* The service ID used to indicate that the chat(v1.0) is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CHAT_V1 = "org.openmobilealliance:IM-session";
/**
* The service ID used to indicate that the chat(v2.0) is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CHAT_V2 = "org.openmobilealliance:ChatSession";
/**
* The service ID used to indicate that the File Transfer is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_FT = "org.openmobilealliance:File-Transfer-HTTP";
/**
* The service ID used to indicate that the File Transfer over SMS is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_FT_OVER_SMS =
"org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.ftsms";
/**
* The service ID used to indicate that the Geolocation Push is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_GEO_PUSH =
"org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.geopush";
/**
* The service ID used to indicate that the Geolocation Push via SMS is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_GEO_PUSH_VIA_SMS =
"org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.geosms";
/**
* The service ID used to indicate that the Call Composer is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CALL_COMPOSER =
"org.3gpp.urn:urn-7:3gppservice.ims.icsi.gsma.callcomposer";
"org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.callcomposer";
/**
* The service ID used to indicate that the Post Call is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_POST_CALL =
"org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.callunanswered";
/**
* The service ID used to indicate that the Shared Map is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_SHARED_MAP =
"org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.sharedmap";
/**
* The service ID used to indicate that the Shared Sketch is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_SHARED_SKETCH =
"org.3gpp.urn:urn-7:3gpp-service.ims.icsi.gsma.sharedsketch";
/**
* The service ID used to indicate that the Chatbot using Session is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CHATBOT =
"org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.chatbot";
/**
* The service ID used to indicate that the Standalone Messaging is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CHATBOT_STANDALONE =
" org.3gpp.urn:urn-7:3gpp-application.ims.iari.rcs.chatbot.sa";
/**
* The service ID used to indicate that the Chatbot Role is available.
* <p>
* See the GSMA RCC.07 specification for more information.
*/
public static final String SERVICE_ID_CHATBOT_ROLE = "org.gsma.rcs.isbot";
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@StringDef(prefix = "SERVICE_ID_", value = {
SERVICE_ID_MMTEL,
SERVICE_ID_CHAT_V1,
SERVICE_ID_CHAT_V2,
SERVICE_ID_FT,
SERVICE_ID_FT_OVER_SMS,
SERVICE_ID_GEO_PUSH,
SERVICE_ID_GEO_PUSH_VIA_SMS,
SERVICE_ID_CALL_COMPOSER,
SERVICE_ID_POST_CALL,
SERVICE_ID_SHARED_MAP,
SERVICE_ID_SHARED_SKETCH,
SERVICE_ID_CHATBOT,
SERVICE_ID_CHATBOT_STANDALONE,
SERVICE_ID_CHATBOT_ROLE
})
public @interface ServiceId {}
/** The service capabilities is available. */
public static final String TUPLE_BASIC_STATUS_OPEN = "open";
@@ -149,6 +271,7 @@ public final class RcsContactPresenceTuple implements Parcelable {
in.readStringList(mSupportedDuplexModeList);
in.readStringList(mUnsupportedDuplexModeList);
}
@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
out.writeBoolean(mIsAudioCapable);
@@ -217,12 +340,14 @@ public final class RcsContactPresenceTuple implements Parcelable {
/**
* Builds a RcsContactPresenceTuple instance.
* @param status The status associated with the service capability. See RFC3865 for more
* information.
* @param serviceId The OMA Presence service-id associated with this capability. See the
* OMA Presence SIMPLE specification v1.1, section 10.5.1.
* @param serviceVersion The OMA Presence version associated with the service capability.
* See the OMA Presence SIMPLE specification v1.1, section 10.5.1.
*/
public Builder(@NonNull @BasicStatus String status, @NonNull String serviceId,
public Builder(@NonNull @BasicStatus String status, @NonNull @ServiceId String serviceId,
@NonNull String serviceVersion) {
mPresenceTuple = new RcsContactPresenceTuple(status, serviceId, serviceVersion);
}
@@ -230,16 +355,17 @@ public final class RcsContactPresenceTuple implements Parcelable {
/**
* The optional SIP Contact URI associated with the PIDF tuple element.
*/
public @NonNull Builder addContactUri(@NonNull Uri contactUri) {
public @NonNull Builder setContactUri(@NonNull Uri contactUri) {
mPresenceTuple.mContactUri = contactUri;
return this;
}
/**
* The optional timestamp indicating the data and time of the status change of this tuple.
* See RFC3863, section 4.1.7 for more information on the expected format.
* Per RFC3863 section 4.1.7, the timestamp is formatted as an IMPP datetime format
* string per RFC3339.
*/
public @NonNull Builder addTimeStamp(@NonNull String timestamp) {
public @NonNull Builder setTimestamp(@NonNull String timestamp) {
mPresenceTuple.mTimestamp = timestamp;
return this;
}
@@ -248,7 +374,7 @@ public final class RcsContactPresenceTuple implements Parcelable {
* An optional parameter containing the description element of the service-description. See
* OMA Presence SIMPLE specification v1.1
*/
public @NonNull Builder addDescription(@NonNull String description) {
public @NonNull Builder setServiceDescription(@NonNull String description) {
mPresenceTuple.mServiceDescription = description;
return this;
}
@@ -257,7 +383,7 @@ public final class RcsContactPresenceTuple implements Parcelable {
* An optional parameter containing the service capabilities of the presence tuple if they
* are present in the servcaps element.
*/
public @NonNull Builder addServiceCapabilities(@NonNull ServiceCapabilities caps) {
public @NonNull Builder setServiceCapabilities(@NonNull ServiceCapabilities caps) {
mPresenceTuple.mServiceCapabilities = caps;
return this;
}

View File

@@ -19,6 +19,7 @@ package android.telephony.ims;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -33,6 +34,7 @@ import java.util.List;
* Contains the User Capability Exchange capabilities corresponding to a contact's URI.
* @hide
*/
@SystemApi
public final class RcsContactUceCapability implements Parcelable {
/** Contains presence information associated with the contact */
@@ -69,53 +71,47 @@ public final class RcsContactUceCapability implements Parcelable {
})
public @interface SourceType {}
/**
* Capability information for the requested contact has expired and can not be refreshed due to
* a temporary network error. This is a temporary error and the capabilities of the contact
* should be queried again at a later time.
*/
public static final int REQUEST_RESULT_UNKNOWN = 0;
/**
* The requested contact was found to be offline when queried. This is only applicable to
* contact capabilities that were queried via OPTIONS requests and the network returned a
* 408/480 response.
*/
public static final int REQUEST_RESULT_NOT_ONLINE = 0;
public static final int REQUEST_RESULT_NOT_ONLINE = 1;
/**
* Capability information for the requested contact was not found. The contact should not be
* considered an RCS user.
*/
public static final int REQUEST_RESULT_NOT_FOUND = 1;
public static final int REQUEST_RESULT_NOT_FOUND = 2;
/**
* Capability information for the requested contact was found successfully.
*/
public static final int REQUEST_RESULT_FOUND = 2;
/**
* Capability information for the requested contact has expired and can not be refreshed due to
* a temporary network error. This is a temporary error and the capabilities of the contact
* should be queried again at a later time.
*/
public static final int REQUEST_RESULT_UNKNOWN = 3;
public static final int REQUEST_RESULT_FOUND = 3;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = "REQUEST_RESULT_", value = {
REQUEST_RESULT_UNKNOWN,
REQUEST_RESULT_NOT_ONLINE,
REQUEST_RESULT_NOT_FOUND,
REQUEST_RESULT_FOUND,
REQUEST_RESULT_UNKNOWN
REQUEST_RESULT_FOUND
})
public @interface RequestResult {}
/**
* The base class of {@link OptionsBuilder} and {@link PresenceBuilder}
*/
public static abstract class RcsUcsCapabilityBuilder {
public abstract @NonNull RcsContactUceCapability build();
}
/**
* Builder to help construct {@link RcsContactUceCapability} instances when capabilities were
* queried through SIP OPTIONS.
* @hide
*/
public static class OptionsBuilder extends RcsUcsCapabilityBuilder {
public static final class OptionsBuilder {
private final RcsContactUceCapability mCapabilities;
@@ -162,7 +158,6 @@ public final class RcsContactUceCapability implements Parcelable {
/**
* @return the constructed instance.
*/
@Override
public @NonNull RcsContactUceCapability build() {
return mCapabilities;
}
@@ -172,7 +167,7 @@ public final class RcsContactUceCapability implements Parcelable {
* Builder to help construct {@link RcsContactUceCapability} instances when capabilities were
* queried through a presence server.
*/
public static class PresenceBuilder extends RcsUcsCapabilityBuilder {
public static final class PresenceBuilder {
private final RcsContactUceCapability mCapabilities;
@@ -214,7 +209,6 @@ public final class RcsContactUceCapability implements Parcelable {
/**
* @return the RcsContactUceCapability instance.
*/
@Override
public @NonNull RcsContactUceCapability build() {
return mCapabilities;
}
@@ -284,6 +278,7 @@ public final class RcsContactUceCapability implements Parcelable {
* <p>
* Note: this is only populated if {@link #getCapabilityMechanism} is
* {@link RcsContactUceCapability#CAPABILITY_MECHANISM_OPTIONS}
* @hide
*/
public @NonNull List<String> getOptionsFeatureTags() {
if (mCapabilityMechanism != CAPABILITY_MECHANISM_OPTIONS) {
@@ -299,7 +294,7 @@ public final class RcsContactUceCapability implements Parcelable {
* Note: this is only populated if {@link #getCapabilityMechanism} is
* {@link RcsContactUceCapability#CAPABILITY_MECHANISM_PRESENCE}
*/
public @NonNull List<RcsContactPresenceTuple> getPresenceTuples() {
public @NonNull List<RcsContactPresenceTuple> getCapabilityTuples() {
if (mCapabilityMechanism != CAPABILITY_MECHANISM_PRESENCE) {
return Collections.emptyList();
}
@@ -309,13 +304,14 @@ public final class RcsContactUceCapability implements Parcelable {
/**
* Get the RcsContactPresenceTuple associated with the given service id.
* @param serviceId The service id to get the presence tuple.
* @return The RcsContactPresenceTuple which has the given service id.
* @return The RcsContactPresenceTuple which has the given service id or {@code null} if the
* service id does not exist in the list of presence tuples returned from the network.
*
* <p>
* Note: this is only populated if {@link #getCapabilityMechanism} is
* {@link RcsContactUceCapability#CAPABILITY_MECHANISM_PRESENCE}
*/
public @Nullable RcsContactPresenceTuple getPresenceTuple(@NonNull String serviceId) {
public @Nullable RcsContactPresenceTuple getCapabilityTuple(@NonNull String serviceId) {
if (mCapabilityMechanism != CAPABILITY_MECHANISM_PRESENCE) {
return null;
}

View File

@@ -63,6 +63,7 @@ public class RcsUceAdapter {
* RcsFeature should not publish capabilities or service capability requests.
* @hide
*/
@SystemApi
public static final int CAPABILITY_TYPE_PRESENCE_UCE = 1 << 1;
/**@hide*/
@@ -77,12 +78,14 @@ public class RcsUceAdapter {
* An unknown error has caused the request to fail.
* @hide
*/
@SystemApi
public static final int ERROR_GENERIC_FAILURE = 1;
/**
* The carrier network does not have UCE support enabled for this subscriber.
* @hide
*/
@SystemApi
public static final int ERROR_NOT_ENABLED = 2;
/**
@@ -90,12 +93,14 @@ public class RcsUceAdapter {
* 1x only currently).
* @hide
*/
@SystemApi
public static final int ERROR_NOT_AVAILABLE = 3;
/**
* The network has responded with SIP 403 error and a reason "User not registered."
* @hide
*/
@SystemApi
public static final int ERROR_NOT_REGISTERED = 4;
/**
@@ -103,12 +108,14 @@ public class RcsUceAdapter {
* presence" for this subscriber.
* @hide
*/
@SystemApi
public static final int ERROR_NOT_AUTHORIZED = 5;
/**
* The network has responded to this request with a SIP 403 error and no reason.
* @hide
*/
@SystemApi
public static final int ERROR_FORBIDDEN = 6;
/**
@@ -116,6 +123,7 @@ public class RcsUceAdapter {
* subscriber to the carrier network.
* @hide
*/
@SystemApi
public static final int ERROR_NOT_FOUND = 7;
/**
@@ -123,6 +131,7 @@ public class RcsUceAdapter {
* with a lower number of contact numbers. The number varies per carrier.
* @hide
*/
@SystemApi
// TODO: Try to integrate this into the API so that the service will split based on carrier.
public static final int ERROR_REQUEST_TOO_LARGE = 8;
@@ -130,18 +139,21 @@ public class RcsUceAdapter {
* The network did not respond to the capabilities request before the request timed out.
* @hide
*/
@SystemApi
public static final int ERROR_REQUEST_TIMEOUT = 9;
/**
* The request failed due to the service having insufficient memory.
* @hide
*/
@SystemApi
public static final int ERROR_INSUFFICIENT_MEMORY = 10;
/**
* The network was lost while trying to complete the request.
* @hide
*/
@SystemApi
public static final int ERROR_LOST_NETWORK = 11;
/**
@@ -149,6 +161,7 @@ public class RcsUceAdapter {
* time returned in {@link CapabilitiesCallback#onError} has elapsed.
* @hide
*/
@SystemApi
public static final int ERROR_SERVER_UNAVAILABLE = 12;
/**@hide*/
@@ -405,6 +418,7 @@ public class RcsUceAdapter {
* @see #requestCapabilities(Executor, List, CapabilitiesCallback)
* @hide
*/
@SystemApi
public interface CapabilitiesCallback {
/**
@@ -424,10 +438,10 @@ public class RcsUceAdapter {
* 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 retryAfterMilliseconds The time in milliseconds the requesting application should
* @param retryIntervalMillis The time in milliseconds the requesting application should
* wait before retrying, if non-zero.
*/
void onError(@ErrorCode int errorCode, long retryAfterMilliseconds);
void onError(@ErrorCode int errorCode, long retryIntervalMillis);
}
private final Context mContext;
@@ -458,9 +472,9 @@ public class RcsUceAdapter {
* {@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}.
*
* @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
* {@link CapabilitiesCallback} is called.
* @param contactNumbers A list of numbers that the capabilities are being requested for.
* @param c A one-time callback for when the request for capabilities completes or there is an
* error processing the request.
* @throws ImsException if the subscription associated with this instance of
@@ -469,9 +483,10 @@ public class RcsUceAdapter {
* becomes inactive. See {@link ImsException#getCode()} for more information on the error codes.
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void requestCapabilities(@NonNull @CallbackExecutor Executor executor,
@NonNull List<Uri> contactNumbers,
public void requestCapabilities(@NonNull List<Uri> contactNumbers,
@NonNull @CallbackExecutor Executor executor,
@NonNull CapabilitiesCallback c) throws ImsException {
if (c == null) {
throw new IllegalArgumentException("Must include a non-null CapabilitiesCallback.");
@@ -495,8 +510,7 @@ public class RcsUceAdapter {
public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() ->
c.onCapabilitiesReceived(contactCapabilities));
executor.execute(() -> c.onCapabilitiesReceived(contactCapabilities));
} finally {
restoreCallingIdentity(callingIdentity);
}
@@ -550,13 +564,17 @@ public class RcsUceAdapter {
* {@link #ERROR_NOT_AVAILABLE} or {@link #ERROR_NOT_ENABLED}.
*
* @param contactNumber The contact of the capabilities is being requested for.
* @param executor The executor that will be used when the request is completed and the
* {@link CapabilitiesCallback} is called.
* @param c A one-time callback for when the request for capabilities completes or there is
* an error processing the request.
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void requestNetworkAvailability(@NonNull @CallbackExecutor Executor executor,
@NonNull Uri contactNumber, @NonNull CapabilitiesCallback c) throws ImsException {
public void requestAvailability(@NonNull Uri contactNumber,
@NonNull @CallbackExecutor Executor executor,
@NonNull CapabilitiesCallback c) throws ImsException {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
@@ -569,7 +587,7 @@ public class RcsUceAdapter {
IImsRcsController imsRcsController = getIImsRcsController();
if (imsRcsController == null) {
Log.e(TAG, "requestNetworkAvailability: IImsRcsController is null");
Log.e(TAG, "requestAvailability: IImsRcsController is null");
throw new ImsException("Cannot find remote IMS service",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
@@ -579,8 +597,7 @@ public class RcsUceAdapter {
public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) {
final long callingIdentity = Binder.clearCallingIdentity();
try {
executor.execute(() ->
c.onCapabilitiesReceived(contactCapabilities));
executor.execute(() -> c.onCapabilitiesReceived(contactCapabilities));
} finally {
restoreCallingIdentity(callingIdentity);
}
@@ -606,12 +623,12 @@ public class RcsUceAdapter {
};
try {
imsRcsController.requestNetworkAvailability(mSubId, mContext.getOpPackageName(),
imsRcsController.requestAvailability(mSubId, mContext.getOpPackageName(),
mContext.getAttributionTag(), contactNumber, internalCallback);
} catch (ServiceSpecificException e) {
throw new ImsException(e.toString(), e.errorCode);
} catch (RemoteException e) {
Log.e(TAG, "Error calling IImsRcsController#requestNetworkAvailability", e);
Log.e(TAG, "Error calling IImsRcsController#requestAvailability", e);
throw new ImsException("Remote IMS Service is not available",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
@@ -683,7 +700,7 @@ public class RcsUceAdapter {
if (imsRcsController == null) {
Log.e(TAG, "addOnPublishStateChangedListener : IImsRcsController is null");
throw new ImsException("Cannot find remote IMS service",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
PublishStateCallbackAdapter stateCallback = addPublishStateCallback(executor, listener);
@@ -694,7 +711,7 @@ public class RcsUceAdapter {
} catch (RemoteException e) {
Log.e(TAG, "Error calling IImsRcsController#registerUcePublishStateCallback", e);
throw new ImsException("Remote IMS Service is not available",
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
}

View File

@@ -52,7 +52,7 @@ interface IImsRcsController {
// ImsUceAdapter specific
void requestCapabilities(int subId, String callingPackage, String callingFeatureId,
in List<Uri> contactNumbers, IRcsUceControllerCallback c);
void requestNetworkAvailability(int subId, String callingPackage,
void requestAvailability(int subId, String callingPackage,
String callingFeatureId, in Uri contactNumber,
IRcsUceControllerCallback c);
int getUcePublishState(int subId);

View File

@@ -24,6 +24,7 @@ import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.net.Uri;
import android.telephony.ims.ImsException;
import android.telephony.ims.RcsUceAdapter;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.RcsFeature;
import android.util.Log;
@@ -139,18 +140,19 @@ public class RcsCapabilityExchangeImplBase {
* Provide the framework with a subsequent network response update to
* {@link #publishCapabilities(String, PublishResponseCallback)}.
*
* @param code The SIP response code sent from the network for the operation
* @param sipCode The SIP response code sent from the network for the operation
* token specified.
* @param reason The optional reason response from the network. If there is a reason header
* included in the response, that should take precedence over the reason provided in the
* status line. If the network provided no reason with the code, the string should be empty.
* status line. If the network provided no reason with the sip code, the string should be
* empty.
* @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.
*/
void onNetworkResponse(@IntRange(from = 100, to = 699) int code,
void onNetworkResponse(@IntRange(from = 100, to = 699) int sipCode,
@NonNull String reason) throws ImsException;
}
@@ -173,7 +175,7 @@ public class RcsCapabilityExchangeImplBase {
/**
* Send the response of a SIP OPTIONS capability exchange to the framework.
* @param code The SIP response code that was sent by the network in response
* @param sipCode The SIP response code that was sent by the network in response
* to the request sent by {@link #sendOptionsCapabilityRequest}.
* @param reason The optional SIP response reason sent by the network.
* If none was sent, this should be an empty string.
@@ -186,17 +188,20 @@ public class RcsCapabilityExchangeImplBase {
* {@link ImsFeature#onFeatureReady()} callback. This may also happen in rare
* cases when the Telephony stack has crashed.
*/
void onNetworkResponse(int code, @NonNull String reason,
void onNetworkResponse(int sipCode, @NonNull String reason,
@Nullable List<String> theirCaps) throws ImsException;
}
/**
* Interface used by the framework to receive the response of the subscribe request.
* @hide
*/
public interface SubscribeResponseCallback {
/**
* Notify the framework that the command associated with this callback has failed.
* <p>
* Must only be called when there was an error generating a SUBSCRIBE request due to an
* IMS stack error. This is a terminating event, so no other callback event will be
* expected after this callback.
*
* @param code The reason why the associated command has failed.
* @throws ImsException If this {@link RcsCapabilityExchangeImplBase} instance is
@@ -211,27 +216,38 @@ public class RcsCapabilityExchangeImplBase {
/**
* Notify the framework of the response to the SUBSCRIBE request from
* {@link #subscribeForCapabilities(List<Uri>, SubscribeResponseCallback)}.
* <p>
* If the carrier network responds to the SUBSCRIBE request with a 2XX response, then the
* framework will expect the IMS stack to call {@link #onNotifyCapabilitiesUpdate},
* {@link #onResourceTerminated}, and {@link #onTerminated} as required for the
* subsequent NOTIFY responses to the subscription.
*
* @param code The SIP response code sent from the network for the operation
* @param sipCode 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.
* provided no reason with the sip code, the string should be empty.
* @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.
*/
void onNetworkResponse(@IntRange(from = 100, to = 699) int code,
void onNetworkResponse(@IntRange(from = 100, to = 699) int sipCode,
@NonNull String reason) throws ImsException;
/**
* Provides the framework with latest XML PIDF documents included in the
* network response for the requested contacts' capabilities requested by the
* Framework using {@link #requestCapabilities(List, int)}. This should be
* called every time a new NOTIFY event is received with new capability
* information.
* Notify the framework of the latest XML PIDF documents included in the network response
* for the requested contacts' capabilities requested by the Framework using
* {@link RcsUceAdapter#requestCapabilities(Executor, List<Uri>, CapabilitiesCallback)}.
* <p>
* The expected format for the PIDF XML is defined in RFC3861. Each XML document must be a
* "application/pidf+xml" object and start with a root <presence> element. For NOTIFY
* responses that contain RLMI information and potentially multiple PIDF XMLs, each
* PIDF XML should be separated and added as a separate item in the List. This should be
* called every time a new NOTIFY event is received with new capability information.
*
* @param pidfXmls The list of the PIDF XML data for the contact URIs that it subscribed
* for.
* @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
@@ -242,21 +258,42 @@ public class RcsCapabilityExchangeImplBase {
void onNotifyCapabilitiesUpdate(@NonNull List<String> pidfXmls) throws ImsException;
/**
* A resource in the resource list for the presence subscribe event has been terminated.
* Notify the framework that a resource in the RLMI XML contained in the NOTIFY response
* for the ongoing SUBSCRIBE dialog has been terminated.
* <p>
* This allows the framework to know that there will not be any capability information for
* a specific contact URI that they subscribed for.
* This will be used to notify the framework that a contact URI that the IMS stack has
* subscribed to on the Resource List Server has been terminated as well as the reason why.
* Usually this means that there will not be any capability information for the contact URI
* that they subscribed for. See RFC 4662 for more information.
*
* @param uriTerminatedReason The contact URIs which have been terminated. Each pair in the
* list is the contact URI and its terminated reason.
* @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} {@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.
*/
void onResourceTerminated(
@NonNull List<Pair<Uri, String>> uriTerminatedReason) throws ImsException;
/**
* The subscription associated with a previous #requestCapabilities operation
* has been terminated. This will mostly be due to the subscription expiring,
* but may also happen due to an error.
* <p>
* This allows the framework to know that there will no longer be any
* capability updates for the requested operationToken.
* The subscription associated with a previous
* {@link RcsUceAdapter#requestCapabilities(Executor, List<Uri>, CapabilitiesCallback)}
* operation has been terminated. This will mostly be due to the network sending a final
* NOTIFY response due to the subscription expiring, but this may also happen due to a
* network error.
*
* @param reason The reason for the request being unable to process.
* @param retryAfterMilliseconds The time in milliseconds the requesting application should
* wait before retrying, if non-zero.
* @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} {@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.
*/
void onTerminated(@NonNull String reason, long retryAfterMilliseconds) throws ImsException;
}
@@ -278,18 +315,23 @@ public class RcsCapabilityExchangeImplBase {
/**
* The user capabilities of one or multiple contacts have been requested by the framework.
* <p>
* The implementer must follow up this call with an
* {@link SubscribeResponseCallback#onCommandError} call to indicate this operation has failed.
* The response from the network to the SUBSCRIBE request must be sent back to the framework
* using {@link #onSubscribeNetworkResponse(int, String, int)}. As NOTIFY requests come in from
* the network, the requested contacts capabilities should be sent back to the framework using
* {@link #onSubscribeNotifyRequest} and {@link onSubscribeResourceTerminated}
* using {@link SubscribeResponseCallback#onNetworkResponse(int, String)}.
* As NOTIFY requests come in from the network, the requested contacts capabilities should be
* sent back to the framework using
* {@link SubscribeResponseCallback#onNotifyCapabilitiesUpdate(List<String>}) and
* {@link SubscribeResponseCallback#onResourceTerminated(List<Pair<Uri, String>>)}
* should be called with the presence information for the contacts specified.
* <p>
* Once the subscription is terminated, {@link #onSubscriptionTerminated} must be called for
* the framework to finish listening for NOTIFY responses.
* Once the subscription is terminated,
* {@link SubscribeResponseCallback#onTerminated(String, long)} must be called for the
* framework to finish listening for NOTIFY responses.
*
* @param uris A {@link List} of the {@link Uri}s that the framework is requesting the UCE
* capabilities for.
* @param cb The callback of the subscribe request.
* @hide
*/
// executor used is defined in the constructor.
@SuppressLint("ExecutorRegistration")

View File

@@ -2382,6 +2382,11 @@ interface ITelephony {
*/
String getMobileProvisioningUrl();
/*
* Remove the EAB contacts from the EAB database.
*/
int removeContactFromEab(int subId, String contacts);
/**
* Set a SignalStrengthUpdateRequest to receive notification when Signal Strength breach the
* specified thresholds.