Merge "Add SIP Transport create/destroy API defs"

This commit is contained in:
Brad Ebinger
2020-12-01 01:20:12 +00:00
committed by Gerrit Code Review
18 changed files with 309 additions and 103 deletions

View File

@@ -10693,6 +10693,61 @@ package android.telephony.ims {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.AudioCodecAttributes> CREATOR;
}
public interface DelegateMessageCallback {
method public void onMessageReceived(@NonNull android.telephony.ims.SipMessage);
method public void onMessageSendFailure(@NonNull String, int);
method public void onMessageSent(@NonNull String);
}
public final class DelegateRegistrationState implements android.os.Parcelable {
method public int describeContents();
method @NonNull public java.util.Set<android.telephony.ims.FeatureTagState> getDeregisteredFeatureTags();
method @NonNull public java.util.Set<android.telephony.ims.FeatureTagState> getDeregisteringFeatureTags();
method @NonNull public java.util.Set<java.lang.String> getRegisteredFeatureTags();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.DelegateRegistrationState> CREATOR;
field public static final int DEREGISTERED_REASON_NOT_PROVISIONED = 1; // 0x1
field public static final int DEREGISTERED_REASON_NOT_REGISTERED = 2; // 0x2
field public static final int DEREGISTERED_REASON_UNKNOWN = 0; // 0x0
field public static final int DEREGISTERING_REASON_DESTROY_PENDING = 6; // 0x6
field public static final int DEREGISTERING_REASON_FEATURE_TAGS_CHANGING = 5; // 0x5
field public static final int DEREGISTERING_REASON_PDN_CHANGE = 3; // 0x3
field public static final int DEREGISTERING_REASON_PROVISIONING_CHANGE = 4; // 0x4
}
public static final class DelegateRegistrationState.Builder {
ctor public DelegateRegistrationState.Builder();
method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addDeregisteredFeatureTag(@NonNull String, int);
method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addDeregisteringFeatureTag(@NonNull String, int);
method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addRegisteredFeatureTag(@NonNull String);
method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addRegisteredFeatureTags(@NonNull java.util.Set<java.lang.String>);
method @NonNull public android.telephony.ims.DelegateRegistrationState build();
}
public final class DelegateRequest implements android.os.Parcelable {
ctor public DelegateRequest(@NonNull java.util.Set<java.lang.String>);
method public int describeContents();
method @NonNull public java.util.Set<java.lang.String> getFeatureTags();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.DelegateRequest> CREATOR;
}
public interface DelegateStateCallback {
method public void onCreated(@NonNull android.telephony.ims.stub.SipDelegate, @Nullable java.util.Set<android.telephony.ims.FeatureTagState>);
method public void onDestroyed(int);
method public void onFeatureTagRegistrationChanged(@NonNull android.telephony.ims.DelegateRegistrationState);
method public void onImsConfigurationChanged(@NonNull android.telephony.ims.SipDelegateImsConfiguration);
}
public final class FeatureTagState implements android.os.Parcelable {
ctor public FeatureTagState(@NonNull String, int);
method public int describeContents();
method @NonNull public String getFeatureTag();
method public int getState();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.FeatureTagState> CREATOR;
}
public final class ImsCallForwardInfo implements android.os.Parcelable {
ctor public ImsCallForwardInfo(int, int, int, int, @NonNull String, int);
method public int describeContents();
@@ -11213,8 +11268,107 @@ package android.telephony.ims {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.RtpHeaderExtensionType> CREATOR;
}
public interface SipDelegateConnection {
method public void notifyMessageReceiveError(@NonNull String, int);
method public void notifyMessageReceived(@NonNull String);
method public void sendMessage(@NonNull android.telephony.ims.SipMessage, long);
}
public final class SipDelegateImsConfiguration implements android.os.Parcelable {
method public boolean containsKey(@NonNull String);
method @NonNull public android.os.PersistableBundle copyBundle();
method public int describeContents();
method public boolean getBoolean(@NonNull String, boolean);
method public int getInt(@NonNull String, int);
method @Nullable public String getString(@NonNull String);
method public long getVersion();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.SipDelegateImsConfiguration> CREATOR;
field public static final String IPTYPE_IPV4 = "IPV4";
field public static final String IPTYPE_IPV6 = "IPV6";
field public static final String KEY_SIP_CONFIG_AUTHENTICATION_HEADER_STRING = "sip_config_auhentication_header_string";
field public static final String KEY_SIP_CONFIG_AUTHENTICATION_NONCE_STRING = "sip_config_authentication_nonce_string";
field public static final String KEY_SIP_CONFIG_HOME_DOMAIN_STRING = "sip_config_home_domain_string";
field public static final String KEY_SIP_CONFIG_IMEI_STRING = "sip_config_imei_string";
field public static final String KEY_SIP_CONFIG_IPTYPE_STRING = "sip_config_iptype_string";
field public static final String KEY_SIP_CONFIG_IS_COMPACT_FORM_ENABLED_BOOL = "sip_config_is_compact_form_enabled_bool";
field public static final String KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL = "sip_config_is_gruu_enabled_bool";
field public static final String KEY_SIP_CONFIG_IS_IPSEC_ENABLED_BOOL = "sip_config_is_ipsec_enabled_bool";
field public static final String KEY_SIP_CONFIG_IS_KEEPALIVE_ENABLED_BOOL = "sip_config_is_keepalive_enabled_bool";
field public static final String KEY_SIP_CONFIG_IS_NAT_ENABLED_BOOL = "sip_config_is_nat_enabled_bool";
field public static final String KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT = "sip_config_udp_max_payload_size_int";
field public static final String KEY_SIP_CONFIG_PATH_HEADER_STRING = "sip_config_path_header_string";
field public static final String KEY_SIP_CONFIG_P_ACCESS_NETWORK_INFO_HEADER_STRING = "sip_config_p_access_network_info_header_string";
field public static final String KEY_SIP_CONFIG_P_ASSOCIATED_URI_HEADER_STRING = "sip_config_p_associated_uri_header_string";
field public static final String KEY_SIP_CONFIG_P_LAST_ACCESS_NETWORK_INFO_HEADER_STRING = "sip_config_p_last_access_network_info_header_string";
field public static final String KEY_SIP_CONFIG_SECURITY_VERIFY_HEADER_STRING = "sip_config_security_verify_header_string";
field public static final String KEY_SIP_CONFIG_SERVER_DEFAULT_IPADDRESS_STRING = "sip_config_server_default_ipaddress_string";
field public static final String KEY_SIP_CONFIG_SERVER_DEFAULT_PORT_INT = "sip_config_server_default_port_int";
field public static final String KEY_SIP_CONFIG_SERVER_IPSEC_CLIENT_PORT_INT = "sip_config_server_ipsec_client_port_int";
field public static final String KEY_SIP_CONFIG_SERVER_IPSEC_OLD_CLIENT_PORT_INT = "sip_config_server_ipsec_old_client_port_int";
field public static final String KEY_SIP_CONFIG_SERVER_IPSEC_SERVER_PORT_INT = "sip_config_server_ipsec_server_port_int";
field public static final String KEY_SIP_CONFIG_SERVICE_ROUTE_HEADER_STRING = "sip_config_service_route_header_string";
field public static final String KEY_SIP_CONFIG_TRANSPORT_TYPE_STRING = "sip_config_protocol_type_string";
field public static final String KEY_SIP_CONFIG_UE_DEFAULT_IPADDRESS_STRING = "sip_config_ue_default_ipaddress_string";
field public static final String KEY_SIP_CONFIG_UE_DEFAULT_PORT_INT = "sip_config_ue_default_port_int";
field public static final String KEY_SIP_CONFIG_UE_IPSEC_CLIENT_PORT_INT = "sip_config_ue_ipsec_client_port_int";
field public static final String KEY_SIP_CONFIG_UE_IPSEC_OLD_CLIENT_PORT_INT = "sip_config_ue_ipsec_old_client_port_int";
field public static final String KEY_SIP_CONFIG_UE_IPSEC_SERVER_PORT_INT = "sip_config_ue_ipsec_server_port_int";
field public static final String KEY_SIP_CONFIG_UE_PRIVATE_USER_ID_STRING = "sip_config_ue_private_user_id_string";
field public static final String KEY_SIP_CONFIG_UE_PUBLIC_GRUU_STRING = "sip_config_ue_public_gruu_string";
field public static final String KEY_SIP_CONFIG_UE_PUBLIC_IPADDRESS_WITH_NAT_STRING = "sip_config_ue_public_ipaddress_with_nat_string";
field public static final String KEY_SIP_CONFIG_UE_PUBLIC_PORT_WITH_NAT_INT = "sip_config_ue_public_port_with_nat_int";
field public static final String KEY_SIP_CONFIG_UE_PUBLIC_USER_ID_STRING = "sip_config_ue_public_user_id_string";
field public static final String KEY_SIP_CONFIG_URI_USER_PART_STRING = "sip_config_uri_user_part_string";
field public static final String SIP_TRANSPORT_TCP = "TCP";
field public static final String SIP_TRANSPORT_UDP = "UDP";
}
public static final class SipDelegateImsConfiguration.Builder {
ctor public SipDelegateImsConfiguration.Builder(int);
ctor public SipDelegateImsConfiguration.Builder(@NonNull android.telephony.ims.SipDelegateImsConfiguration);
method @NonNull public android.telephony.ims.SipDelegateImsConfiguration.Builder addBoolean(@NonNull String, boolean);
method @NonNull public android.telephony.ims.SipDelegateImsConfiguration.Builder addInt(@NonNull String, int);
method @NonNull public android.telephony.ims.SipDelegateImsConfiguration.Builder addString(@NonNull String, @NonNull String);
method @NonNull public android.telephony.ims.SipDelegateImsConfiguration build();
}
public class SipDelegateManager {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void createSipDelegate(@NonNull android.telephony.ims.DelegateRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.stub.DelegateConnectionStateCallback, @NonNull android.telephony.ims.stub.DelegateConnectionMessageCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void destroySipDelegate(@NonNull android.telephony.ims.SipDelegateConnection, int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isSupported() throws android.telephony.ims.ImsException;
field public static final int DENIED_REASON_INVALID = 4; // 0x4
field public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1; // 0x1
field public static final int DENIED_REASON_NOT_ALLOWED = 2; // 0x2
field public static final int DENIED_REASON_SINGLE_REGISTRATION_NOT_ALLOWED = 3; // 0x3
field public static final int DENIED_REASON_UNKNOWN = 0; // 0x0
field public static final int MESSAGE_FAILURE_REASON_DELEGATE_CLOSED = 2; // 0x2
field public static final int MESSAGE_FAILURE_REASON_DELEGATE_DEAD = 1; // 0x1
field public static final int MESSAGE_FAILURE_REASON_INTERNAL_DELEGATE_STATE_TRANSITION = 11; // 0xb
field public static final int MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT = 5; // 0x5
field public static final int MESSAGE_FAILURE_REASON_INVALID_FEATURE_TAG = 6; // 0x6
field public static final int MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS = 4; // 0x4
field public static final int MESSAGE_FAILURE_REASON_INVALID_START_LINE = 3; // 0x3
field public static final int MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE = 8; // 0x8
field public static final int MESSAGE_FAILURE_REASON_NOT_REGISTERED = 9; // 0x9
field public static final int MESSAGE_FAILURE_REASON_STALE_IMS_CONFIGURATION = 10; // 0xa
field public static final int MESSAGE_FAILURE_REASON_TAG_NOT_ENABLED_FOR_DELEGATE = 7; // 0x7
field public static final int MESSAGE_FAILURE_REASON_UNKNOWN = 0; // 0x0
field public static final int SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP = 2; // 0x2
field public static final int SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD = 1; // 0x1
field public static final int SIP_DELEGATE_DESTROY_REASON_SUBSCRIPTION_TORN_DOWN = 4; // 0x4
field public static final int SIP_DELEGATE_DESTROY_REASON_UNKNOWN = 0; // 0x0
field public static final int SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS = 3; // 0x3
}
public final class SipMessage implements android.os.Parcelable {
ctor public SipMessage(@NonNull String, @NonNull String, @NonNull byte[]);
method public int describeContents();
method @NonNull public byte[] getContent();
method @NonNull public String getHeaderSection();
method @NonNull public String getStartLine();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.SipMessage> CREATOR;
}
}
@@ -11308,6 +11462,19 @@ package android.telephony.ims.feature {
package android.telephony.ims.stub {
public interface DelegateConnectionMessageCallback {
method public void onMessageReceived(@NonNull android.telephony.ims.SipMessage);
method public void onMessageSendFailure(@NonNull String, int);
method public void onMessageSent(@NonNull String);
}
public interface DelegateConnectionStateCallback {
method public void onCreated(@NonNull android.telephony.ims.SipDelegateConnection);
method public void onDestroyed(int);
method public void onFeatureTagStatusChanged(@NonNull android.telephony.ims.DelegateRegistrationState, @NonNull java.util.Set<android.telephony.ims.FeatureTagState>);
method public void onImsConfigurationChanged(@NonNull android.telephony.ims.SipDelegateImsConfiguration);
}
public class ImsCallSessionImplBase implements java.lang.AutoCloseable {
ctor public ImsCallSessionImplBase();
method public void accept(int, android.telephony.ims.ImsStreamMediaProfile);
@@ -11468,8 +11635,17 @@ package android.telephony.ims.stub {
method public int updateColr(int);
}
public interface SipDelegate {
method public void closeDialog(@NonNull String);
method public void notifyMessageReceiveError(@NonNull String, int);
method public void notifyMessageReceived(@NonNull String);
method public void sendMessage(@NonNull android.telephony.ims.SipMessage, long);
}
public class SipTransportImplBase {
ctor public SipTransportImplBase(@NonNull java.util.concurrent.Executor);
method public void createSipDelegate(int, @NonNull android.telephony.ims.DelegateRequest, @NonNull android.telephony.ims.DelegateStateCallback, @NonNull android.telephony.ims.DelegateMessageCallback);
method public void destroySipDelegate(@NonNull android.telephony.ims.stub.SipDelegate, int);
}
}

View File

@@ -17,6 +17,7 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.telephony.ims.stub.SipDelegate;
/**
@@ -30,6 +31,7 @@ import android.telephony.ims.stub.SipDelegate;
* </ul>
* @hide
*/
@SystemApi
public interface DelegateMessageCallback {
/**

View File

@@ -18,14 +18,14 @@ package android.telephony.ims;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.ArraySet;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -34,6 +34,7 @@ import java.util.Set;
* ImsService.
* @hide
*/
@SystemApi
public final class DelegateRegistrationState implements Parcelable {
/**
@@ -114,14 +115,14 @@ public final class DelegateRegistrationState implements Parcelable {
})
public @interface DeregisteringReason {}
private final ArrayList<String> mRegisteredTags = new ArrayList<>();
private final ArrayList<FeatureTagState> mDeregisteringTags = new ArrayList<>();
private final ArrayList<FeatureTagState> mDeregisteredTags = new ArrayList<>();
private ArraySet<String> mRegisteredTags = new ArraySet<>();
private final ArraySet<FeatureTagState> mDeregisteringTags = new ArraySet<>();
private final ArraySet<FeatureTagState> mDeregisteredTags = new ArraySet<>();
/**
* Builder used to create new instances of {@link DelegateRegistrationState}.
*/
public static class Builder {
public static final class Builder {
private final DelegateRegistrationState mState;
@@ -135,10 +136,8 @@ public final class DelegateRegistrationState implements Parcelable {
* @param featureTag The IMS media feature tag included in the current IMS registration.
* @return The in-progress Builder instance for RegistrationState.
*/
public Builder addRegisteredFeatureTag(@NonNull String featureTag) {
if (!mState.mRegisteredTags.contains(featureTag)) {
mState.mRegisteredTags.add(featureTag);
}
public @NonNull Builder addRegisteredFeatureTag(@NonNull String featureTag) {
mState.mRegisteredTags.add(featureTag);
return this;
}
@@ -148,7 +147,8 @@ public final class DelegateRegistrationState implements Parcelable {
* @param featureTags The IMS media feature tags included in the current IMS registration.
* @return The in-progress Builder instance for RegistrationState.
*/
public Builder addRegisteredFeatureTags(@NonNull Set<String> featureTags) {
@SuppressLint("MissingGetterMatchingBuilder")
public @NonNull Builder addRegisteredFeatureTags(@NonNull Set<String> featureTags) {
mState.mRegisteredTags.addAll(featureTags);
return this;
}
@@ -167,13 +167,9 @@ public final class DelegateRegistrationState implements Parcelable {
* The availability of the feature tag depends on the {@link DeregisteringReason}.
* @return The in-progress Builder instance for RegistrationState.
*/
public Builder addDeregisteringFeatureTag(@NonNull String featureTag,
public @NonNull Builder addDeregisteringFeatureTag(@NonNull String featureTag,
@DeregisteringReason int reason) {
boolean ftExists = mState.mDeregisteringTags.stream().anyMatch(
f -> f.getFeatureTag().equals(featureTag));
if (!ftExists) {
mState.mDeregisteringTags.add(new FeatureTagState(featureTag, reason));
}
mState.mDeregisteringTags.add(new FeatureTagState(featureTag, reason));
return this;
}
@@ -185,20 +181,16 @@ public final class DelegateRegistrationState implements Parcelable {
* @param reason The reason why the media feature tag has been deregistered.
* @return The in-progress Builder instance for RegistrationState.
*/
public Builder addDeregisteredFeatureTag(@NonNull String featureTag,
public @NonNull Builder addDeregisteredFeatureTag(@NonNull String featureTag,
@DeregisteredReason int reason) {
boolean ftExists = mState.mDeregisteredTags.stream().anyMatch(
f -> f.getFeatureTag().equals(featureTag));
if (!ftExists) {
mState.mDeregisteredTags.add(new FeatureTagState(featureTag, reason));
}
mState.mDeregisteredTags.add(new FeatureTagState(featureTag, reason));
return this;
}
/**
* @return the finalized instance.
*/
public DelegateRegistrationState build() {
public @NonNull DelegateRegistrationState build() {
return mState;
}
}
@@ -212,7 +204,7 @@ public final class DelegateRegistrationState implements Parcelable {
* Used for unparcelling only.
*/
private DelegateRegistrationState(Parcel source) {
source.readList(mRegisteredTags, null /*classloader*/);
mRegisteredTags = (ArraySet<String>) source.readArraySet(null);
readStateFromParcel(source, mDeregisteringTags);
readStateFromParcel(source, mDeregisteredTags);
}
@@ -268,7 +260,8 @@ public final class DelegateRegistrationState implements Parcelable {
return new ArraySet<>(mDeregisteredTags);
}
public static final Creator<DelegateRegistrationState> CREATOR =
public static final @NonNull Creator<DelegateRegistrationState> CREATOR =
new Creator<DelegateRegistrationState>() {
@Override
public DelegateRegistrationState createFromParcel(Parcel source) {
@@ -287,13 +280,13 @@ public final class DelegateRegistrationState implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeList(mRegisteredTags);
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeArraySet(mRegisteredTags);
writeStateToParcel(dest, mDeregisteringTags);
writeStateToParcel(dest, mDeregisteredTags);
}
private void writeStateToParcel(Parcel dest, List<FeatureTagState> state) {
private void writeStateToParcel(Parcel dest, Set<FeatureTagState> state) {
dest.writeInt(state.size());
for (FeatureTagState s : state) {
dest.writeString(s.getFeatureTag());
@@ -301,11 +294,12 @@ public final class DelegateRegistrationState implements Parcelable {
}
}
private void readStateFromParcel(Parcel source, List<FeatureTagState> emptyState) {
private void readStateFromParcel(Parcel source, Set<FeatureTagState> emptyState) {
int len = source.readInt();
for (int i = 0; i < len; i++) {
String ft = source.readString();
int reason = source.readInt();
emptyState.add(new FeatureTagState(ft, reason));
}
}

View File

@@ -17,6 +17,7 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.ims.stub.SipDelegate;
@@ -31,6 +32,7 @@ import java.util.Set;
* SipDelegateConnection given back to the requesting application.
* @hide
*/
@SystemApi
public final class DelegateRequest implements Parcelable {
private final ArrayList<String> mFeatureTags;
@@ -52,7 +54,7 @@ public final class DelegateRequest implements Parcelable {
* @return the list of IMS feature tag associated with this DelegateRequest in the format
* defined in RCC.07 section 2.6.1.3.
*/
public Set<String> getFeatureTags() {
public @NonNull Set<String> getFeatureTags() {
return new ArraySet<>(mFeatureTags);
}
@@ -70,7 +72,7 @@ public final class DelegateRequest implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeList(mFeatureTags);
}

View File

@@ -18,10 +18,11 @@ package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.telephony.ims.stub.SipDelegate;
import android.telephony.ims.stub.SipTransportImplBase;
import java.util.List;
import java.util.Set;
/**
* Callback interface to notify a remote application of the following:
@@ -34,26 +35,24 @@ import java.util.List;
* </ul>
* @hide
*/
@SystemApi
public interface DelegateStateCallback {
/**
* This must be called by the ImsService after {@link SipTransportImplBase#createSipDelegate} is
* called by the framework to notify the framework and remote application that the
* {@link SipDelegate} has been successfully created.
*
* @param delegate The SipDelegate created to service the DelegateRequest.
* @param deniedTags A List of {@link FeatureTagState}, which contains the feature tags
* @param delegate The SipDelegate created to service the DelegateRequest.
* @param deniedTags A Set of {@link FeatureTagState}s, which contain the feature tags
* associated with this {@link SipDelegate} that have no access to send/receive SIP messages
* as well as a reason for why the feature tag is denied. For more information on the reason
* why the feature tag was denied access, see the
* {@link SipDelegateManager.DeniedReason} reasons. This is considered a permanent denial due
* to this {@link SipDelegate} not supporting a feature or this ImsService already
* implementing this feature elsewhere. If all features of this {@link SipDelegate} are
* denied, {@link #onCreated(SipDelegate, List)} should still be called as the framework will
* later call {@link SipTransportImplBase#destroySipDelegate(SipDelegate, int)} to clean the
* delegate up.
* denied, this method should still be called.
*/
void onCreated(@NonNull SipDelegate delegate, @Nullable List<FeatureTagState> deniedTags);
void onCreated(@NonNull SipDelegate delegate, @Nullable Set<FeatureTagState> deniedTags);
/**
* This must be called by the ImsService after the framework calls

View File

@@ -17,6 +17,7 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.ims.stub.DelegateConnectionStateCallback;
@@ -39,6 +40,7 @@ import java.util.Objects;
* currently available.
* @hide
*/
@SystemApi
public final class FeatureTagState implements Parcelable {
private final String mFeatureTag;
@@ -48,8 +50,8 @@ public final class FeatureTagState implements Parcelable {
* Associate an IMS feature tag with its current state. See {@link DelegateRegistrationState}
* and {@link DelegateConnectionStateCallback#onFeatureTagStatusChanged(
* DelegateRegistrationState, List)} and
* {@link DelegateStateCallback#onCreated(SipDelegate, List)} for examples on how and when this
* is used.
* {@link DelegateStateCallback#onCreated(SipDelegate, java.util.Set)} for examples on how and
* when this is used.
*
* @param featureTag The IMS feature tag that is deregistered, in the process of
* deregistering, or denied.
@@ -93,12 +95,12 @@ public final class FeatureTagState implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(mFeatureTag);
dest.writeInt(mState);
}
public static final Creator<FeatureTagState> CREATOR = new Creator<FeatureTagState>() {
public static final @NonNull Creator<FeatureTagState> CREATOR = new Creator<FeatureTagState>() {
@Override
public FeatureTagState createFromParcel(Parcel source) {
return new FeatureTagState(source);

View File

@@ -17,6 +17,7 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.telephony.ims.stub.SipDelegate;
/**
@@ -36,6 +37,7 @@ import android.telephony.ims.stub.SipDelegate;
* @see SipDelegateManager#createSipDelegate
* @hide
*/
@SystemApi
public interface SipDelegateConnection {
/**
@@ -47,9 +49,8 @@ public interface SipDelegateConnection {
* @param sipMessage The SipMessage to be sent.
* @param configVersion The SipDelegateImsConfiguration version used to construct the
* SipMessage. See {@link SipDelegateImsConfiguration#getVersion} for more
* information on this parameter and why it is used.
*/
void sendMessage(@NonNull SipMessage sipMessage, int configVersion);
void sendMessage(@NonNull SipMessage sipMessage, long configVersion);
/**
* Notify the {@link SipDelegate} that a SIP message received from

View File

@@ -17,7 +17,10 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringDef;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
@@ -47,7 +50,8 @@ import java.lang.annotation.RetentionPolicy;
* update.
* @hide
*/
public class SipDelegateImsConfiguration implements Parcelable {
@SystemApi
public final class SipDelegateImsConfiguration implements Parcelable {
/**
* IPV4 Address type.
@@ -354,7 +358,7 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* Builder class to be used when constructing a new SipDelegateImsConfiguration.
*/
public static class Builder {
public static final class Builder {
private final long mVersion;
private final PersistableBundle mBundle;
@@ -381,7 +385,10 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* Put a string value into this configuration bundle for the given key.
*/
public Builder putString(@StringConfigKey String key, String value) {
// getString is available below.
@SuppressLint("MissingGetterMatchingBuilder")
public @NonNull Builder addString(@NonNull @StringConfigKey String key,
@NonNull String value) {
mBundle.putString(key, value);
return this;
}
@@ -389,7 +396,9 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* Replace the existing default value with a new value for a given key.
*/
public Builder putInt(@IntConfigKey String key, int value) {
// getInt is available below.
@SuppressLint("MissingGetterMatchingBuilder")
public @NonNull Builder addInt(@NonNull @IntConfigKey String key, int value) {
mBundle.putInt(key, value);
return this;
}
@@ -397,7 +406,9 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* Replace the existing default value with a new value for a given key.
*/
public Builder putBoolean(@BooleanConfigKey String key, boolean value) {
// getBoolean is available below.
@SuppressLint("MissingGetterMatchingBuilder")
public @NonNull Builder addBoolean(@NonNull @BooleanConfigKey String key, boolean value) {
mBundle.putBoolean(key, value);
return this;
}
@@ -405,7 +416,7 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* @return a new SipDelegateImsConfiguration from this Builder.
*/
public SipDelegateImsConfiguration build() {
public @NonNull SipDelegateImsConfiguration build() {
return new SipDelegateImsConfiguration(mVersion, mBundle);
}
}
@@ -423,31 +434,39 @@ public class SipDelegateImsConfiguration implements Parcelable {
mBundle = source.readPersistableBundle();
}
/**
* @return {@code true} if this configuration object has a an entry for the key specified,
* {@code false} if it does not.
*/
public boolean containsKey(@NonNull String key) {
return mBundle.containsKey(key);
}
/**
* @return the string value associated with a given key or {@code null} if it doesn't exist.
*/
public @StringConfigKey String getString(String key) {
public @Nullable @StringConfigKey String getString(@NonNull String key) {
return mBundle.getString(key);
}
/**
* @return the Integer value associated with a given key or {@code null} if the value doesn't
* exist.
* @return the integer value associated with a given key if it exists or the supplied default
* value if it does not.
*/
public @IntConfigKey Integer getInt(String key) {
public @IntConfigKey int getInt(@NonNull String key, int defaultValue) {
if (!mBundle.containsKey(key)) {
return null;
return defaultValue;
}
return mBundle.getInt(key);
}
/**
* @return the Integer value associated with a given key or {@code null} if the value doesn't
* exist.
* @return the boolean value associated with a given key or the supplied default value if the
* value doesn't exist in the bundle.
*/
public @BooleanConfigKey Boolean getBoolen(String key) {
public @BooleanConfigKey boolean getBoolean(@NonNull String key, boolean defaultValue) {
if (!mBundle.containsKey(key)) {
return null;
return defaultValue;
}
return mBundle.getBoolean(key);
}
@@ -455,7 +474,7 @@ public class SipDelegateImsConfiguration implements Parcelable {
/**
* @return a shallow copy of the full configuration.
*/
public PersistableBundle copyBundle() {
public @NonNull PersistableBundle copyBundle() {
return new PersistableBundle(mBundle);
}
@@ -479,12 +498,12 @@ public class SipDelegateImsConfiguration implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeLong(mVersion);
dest.writePersistableBundle(mBundle);
}
public static final Creator<SipDelegateImsConfiguration> CREATOR =
public static final @NonNull Creator<SipDelegateImsConfiguration> CREATOR =
new Creator<SipDelegateImsConfiguration>() {
@Override
public SipDelegateImsConfiguration createFromParcel(Parcel source) {

View File

@@ -54,7 +54,6 @@ public class SipDelegateManager {
* The SIP message has failed being sent or received for an unknown reason.
* <p>
* The caller should retry a message that failed with this response.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_UNKNOWN = 0;
@@ -64,47 +63,40 @@ public class SipDelegateManager {
* <p>
* This is considered a permanent error and the system will automatically begin the teardown and
* destruction of the SipDelegate. No further messages should be sent on this transport.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_DELEGATE_DEAD = 1;
/**
* The message has not been sent/received because the delegate is in the process of closing and
* has become unavailable. No further messages should be sent/received on this delegate.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_DELEGATE_CLOSED = 2;
/**
* The SIP message has an invalid start line and the message can not be sent.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_START_LINE = 3;
/**
* One or more of the header fields in the header section of the outgoing SIP message is invalid
* and the SIP message can not be sent.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS = 4;
/**
* The body content of the SIP message is invalid and the message can not be sent.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT = 5;
/**
* The feature tag associated with the outgoing message does not match any known feature tags
* and this message can not be sent.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_INVALID_FEATURE_TAG = 6;
/**
* The feature tag associated with the outgoing message is not enabled for the associated
* SipDelegateConnection and can not be sent.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_TAG_NOT_ENABLED_FOR_DELEGATE = 7;
@@ -113,7 +105,6 @@ public class SipDelegateManager {
* <p>
* This message should be retried when connectivity to the network is re-established. See
* {@link android.net.ConnectivityManager.NetworkCallback} for how this can be determined.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE = 8;
@@ -124,7 +115,6 @@ public class SipDelegateManager {
* This is considered a temporary failure, the message should not be retried until an IMS
* registration change callback is received via
* {@link DelegateConnectionStateCallback#onFeatureTagStatusChanged}
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_NOT_REGISTERED = 9;
@@ -135,7 +125,6 @@ public class SipDelegateManager {
* <p>
* The @link SipMessage} should be recreated using the newest
* {@link SipDelegateImsConfiguration} and sent again.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_STALE_IMS_CONFIGURATION = 10;
@@ -146,7 +135,6 @@ public class SipDelegateManager {
* This is considered a temporary error and the {@link SipDelegateConnection} should resend the
* message once {@link DelegateRegistrationState#DEREGISTERING_REASON_FEATURE_TAGS_CHANGING} is
* no longer reported.
* @hide
*/
public static final int MESSAGE_FAILURE_REASON_INTERNAL_DELEGATE_STATE_TRANSITION = 11;
@@ -171,7 +159,6 @@ public class SipDelegateManager {
/**
* Access to use this feature tag has been denied for an unknown reason.
* @hide
*/
public static final int DENIED_REASON_UNKNOWN = 0;
@@ -179,14 +166,12 @@ public class SipDelegateManager {
* This feature tag is allowed to be used by this SipDelegateConnection, but it is in use by
* another SipDelegateConnection and can not be associated with this delegate. The feature tag
* will stay in this state until the feature tag is release by the other application.
* @hide
*/
public static final int DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE = 1;
/**
* Access to use this feature tag has been denied because this application does not have the
* permissions required to access this feature tag.
* @hide
*/
public static final int DENIED_REASON_NOT_ALLOWED = 2;
@@ -194,14 +179,12 @@ public class SipDelegateManager {
* Access to use this feature tag has been denied because single registration is not allowed by
* the carrier at this time. The application should fall back to dual registration if
* applicable.
* @hide
*/
public static final int DENIED_REASON_SINGLE_REGISTRATION_NOT_ALLOWED = 3;
/**
* This feature tag is not recognized as a valid feature tag by the SipDelegate and has been
* denied.
* @hide
*/
public static final int DENIED_REASON_INVALID = 4;
@@ -218,33 +201,28 @@ public class SipDelegateManager {
/**
* The SipDelegate has closed due to an unknown reason.
* @hide
*/
public static final int SIP_DELEGATE_DESTROY_REASON_UNKNOWN = 0;
/**
* The SipDelegate has closed because the IMS service has died unexpectedly.
* @hide
*/
public static final int SIP_DELEGATE_DESTROY_REASON_SERVICE_DEAD = 1;
/**
* The SipDelegate has closed because the IMS application has requested that the connection be
* destroyed.
* @hide
*/
public static final int SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP = 2;
/**
* The SipDelegate has been closed due to the user disabling RCS.
* @hide
*/
public static final int SIP_DELEGATE_DESTROY_REASON_USER_DISABLED_RCS = 3;
/**
* The SipDelegate has been closed due to the subscription associated with this delegate being
* torn down.
* @hide
*/
public static final int SIP_DELEGATE_DESTROY_REASON_SUBSCRIPTION_TORN_DOWN = 4;
@@ -331,7 +309,6 @@ public class SipDelegateManager {
* SipDelegateConnection.
* @throws ImsException Thrown if there was a problem communicating with the ImsService
* associated with this SipDelegateManager. See {@link ImsException#getCode()}.
* @hide
*/
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void createSipDelegate(@NonNull DelegateRequest request, @NonNull Executor executor,
@@ -366,7 +343,6 @@ public class SipDelegateManager {
* This will also clean up all related callbacks in the associated ImsService.
* @param delegateConnection The SipDelegateConnection to destroy.
* @param reason The reason for why this SipDelegateConnection was destroyed.
* @hide
*/
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void destroySipDelegate(@NonNull SipDelegateConnection delegateConnection,

View File

@@ -17,10 +17,14 @@
package android.telephony.ims;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.Arrays;
import java.util.Objects;
/**
* Represents a partially encoded SIP message. See RFC 3261 for more information on how SIP
* messages are structured and used.
@@ -29,6 +33,7 @@ import android.os.Parcelable;
* verification and should not be used as a generic SIP message container.
* @hide
*/
@SystemApi
public final class SipMessage implements Parcelable {
// Should not be set to true for production!
private static final boolean IS_DEBUGGING = Build.IS_ENG;
@@ -95,14 +100,14 @@ public final class SipMessage implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(mStartLine);
dest.writeString(mHeaderSection);
dest.writeInt(mContent.length);
dest.writeByteArray(mContent);
}
public static final Creator<SipMessage> CREATOR = new Creator<SipMessage>() {
public static final @NonNull Creator<SipMessage> CREATOR = new Creator<SipMessage>() {
@Override
public SipMessage createFromParcel(Parcel source) {
return new SipMessage(source);
@@ -152,4 +157,21 @@ public final class SipMessage implements Parcelable {
}
return startLine;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SipMessage that = (SipMessage) o;
return mStartLine.equals(that.mStartLine)
&& mHeaderSection.equals(that.mHeaderSection)
&& Arrays.equals(mContent, that.mContent);
}
@Override
public int hashCode() {
int result = Objects.hash(mStartLine, mHeaderSection);
result = 31 * result + Arrays.hashCode(mContent);
return result;
}
}

View File

@@ -23,7 +23,7 @@ import android.telephony.ims.SipMessage;
* {@hide}
*/
oneway interface ISipDelegate {
void sendMessage(in SipMessage sipMessage, int configVersion);
void sendMessage(in SipMessage sipMessage, long configVersion);
void notifyMessageReceived(in String viaTransactionId);
void notifyMessageReceiveError(in String viaTransactionId, int reason);

View File

@@ -29,12 +29,13 @@ import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.SipMessage;
import android.telephony.ims.stub.SipDelegate;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.Executor;
/**
* Implementation of callbacks by wrapping the internal AIDL from telephony. Also implements
* ISipDelegate internally when {@link DelegateStateCallback#onCreated(SipDelegate, List)} is called
* ISipDelegate internally when {@link DelegateStateCallback#onCreated(SipDelegate, Set)} is called
* in order to trampoline events back to telephony.
* @hide
*/
@@ -42,7 +43,7 @@ public class SipDelegateAidlWrapper implements DelegateStateCallback, DelegateMe
private final ISipDelegate.Stub mDelegateBinder = new ISipDelegate.Stub() {
@Override
public void sendMessage(SipMessage sipMessage, int configVersion) {
public void sendMessage(SipMessage sipMessage, long configVersion) {
SipDelegate d = mDelegate;
final long token = Binder.clearCallingIdentity();
try {
@@ -136,10 +137,10 @@ public class SipDelegateAidlWrapper implements DelegateStateCallback, DelegateMe
@Override
public void onCreated(@NonNull SipDelegate delegate,
@Nullable List<FeatureTagState> deniedTags) {
@Nullable Set<FeatureTagState> deniedTags) {
mDelegate = delegate;
try {
mStateBinder.onCreated(mDelegateBinder, deniedTags);
mStateBinder.onCreated(mDelegateBinder, new ArrayList<>(deniedTags));
} catch (RemoteException e) {
// BinderDied will trigger destroySipDelegate, so just ignore this locally.
}

View File

@@ -158,7 +158,7 @@ public class SipDelegateConnectionAidlWrapper implements SipDelegateConnection,
}
@Override
public void sendMessage(SipMessage sipMessage, int configVersion) {
public void sendMessage(SipMessage sipMessage, long configVersion) {
try {
ISipDelegate conn = getSipDelegateBinder();
if (conn == null) {

View File

@@ -17,6 +17,7 @@
package android.telephony.ims.stub;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.telephony.ims.SipDelegateConnection;
import android.telephony.ims.SipDelegateManager;
import android.telephony.ims.SipMessage;
@@ -26,6 +27,7 @@ import android.telephony.ims.SipMessage;
* messages as well as the result of sending a SIP message.
* @hide
*/
@SystemApi
public interface DelegateConnectionMessageCallback {
/**
@@ -49,6 +51,6 @@ public interface DelegateConnectionMessageCallback {
* previously sent {@link SipMessage}.
* @param reason The reason for the failure.
*/
void onMessageSendFailure(String viaTransactionId,
void onMessageSendFailure(@NonNull String viaTransactionId,
@SipDelegateManager.MessageFailureReason int reason);
}

View File

@@ -17,6 +17,7 @@
package android.telephony.ims.stub;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.telephony.ims.DelegateRegistrationState;
import android.telephony.ims.DelegateRequest;
import android.telephony.ims.FeatureTagState;
@@ -58,6 +59,7 @@ import java.util.Set;
*
* @hide
*/
@SystemApi
public interface DelegateConnectionStateCallback {
/**

View File

@@ -17,6 +17,7 @@
package android.telephony.ims.stub;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.telephony.ims.DelegateMessageCallback;
import android.telephony.ims.ImsService;
import android.telephony.ims.SipDelegateImsConfiguration;
@@ -40,6 +41,7 @@ import android.telephony.ims.SipMessage;
* {@link android.telephony.ims.DelegateStateCallback} for more information.
* @hide
*/
@SystemApi
public interface SipDelegate {
/**
@@ -57,7 +59,7 @@ public interface SipDelegate {
* {@link DelegateMessageCallback#onMessageSendFailure} should be called with code
* {@link SipDelegateManager#MESSAGE_FAILURE_REASON_STALE_IMS_CONFIGURATION}.
*/
void sendMessage(@NonNull SipMessage message, int configVersion);
void sendMessage(@NonNull SipMessage message, long configVersion);
/**
* The framework is requesting that routing resources associated with the SIP dialog using the

View File

@@ -17,6 +17,7 @@
package android.telephony.ims.stub;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.os.Binder;
import android.os.IBinder;
@@ -32,7 +33,6 @@ import android.telephony.ims.aidl.SipDelegateAidlWrapper;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
@@ -99,7 +99,8 @@ public class SipTransportImplBase {
/**
* Called by the Telephony framework to request the creation of a new {@link SipDelegate}.
* <p>
* The implementation must call {@link DelegateStateCallback#onCreated(SipDelegate, List)} with
* The implementation must call
* {@link DelegateStateCallback#onCreated(SipDelegate, java.util.Set)} with
* the {@link SipDelegate} that is associated with the {@link DelegateRequest}.
* <p>
* This method will be called on the Executor specified in
@@ -112,8 +113,9 @@ public class SipTransportImplBase {
* for the SipDelegate.
* @param mc A callback back to the remote application to be used to send SIP messages to the
* remote application and acknowledge the sending of outgoing SIP messages.
* @hide
*/
// executor used is defined in the constructor.
@SuppressLint("ExecutorRegistration")
public void createSipDelegate(int subscriptionId, @NonNull DelegateRequest request,
@NonNull DelegateStateCallback dc, @NonNull DelegateMessageCallback mc) {
throw new UnsupportedOperationException("createSipDelegate not implemented!");
@@ -130,7 +132,6 @@ public class SipTransportImplBase {
* @param delegate The delegate to be destroyed.
* @param reason The reason the remote connection to this {@link SipDelegate} is being
* destroyed.
* @hide
*/
public void destroySipDelegate(@NonNull SipDelegate delegate,
@SipDelegateManager.SipDelegateDestroyReason int reason) {

View File

@@ -855,6 +855,11 @@ interface ITelephony {
boolean setBoundImsServiceOverride(int slotIndex, boolean isCarrierService,
in int[] featureTypes, in String packageName);
/**
* @return true if the ImsService cleared any carrier ImsService overrides, false otherwise.
*/
boolean clearCarrierImsServiceOverride(int slotIndex);
/**
* @return the package name of the carrier/device ImsService associated with this slot.
*/