ImsSsData needs a public constructor for vendors to use
Expose Builder for IMS Supp Service APIs as well as clean
up some of the ambiguous int[] usage.
Bug: 117555643
Test: Manual
Change-Id: I5cad08e0a032f4e38a62ac033c01111319cf9fd5
diff --git a/api/system-current.txt b/api/system-current.txt
index 082e067..b975a05 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5628,7 +5628,18 @@
method public int getTimeSeconds();
method public int getToA();
method public void writeToParcel(android.os.Parcel, int);
+ field public static final int CDIV_CF_REASON_ALL = 4; // 0x4
+ field public static final int CDIV_CF_REASON_ALL_CONDITIONAL = 5; // 0x5
+ field public static final int CDIV_CF_REASON_BUSY = 1; // 0x1
+ field public static final int CDIV_CF_REASON_NOT_LOGGED_IN = 6; // 0x6
+ field public static final int CDIV_CF_REASON_NOT_REACHABLE = 3; // 0x3
+ field public static final int CDIV_CF_REASON_NO_REPLY = 2; // 0x2
+ field public static final int CDIV_CF_REASON_UNCONDITIONAL = 0; // 0x0
field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsCallForwardInfo> CREATOR;
+ field public static final int STATUS_ACTIVE = 1; // 0x1
+ field public static final int STATUS_NOT_ACTIVE = 0; // 0x0
+ field public static final int TYPE_OF_ADDRESS_INTERNATIONAL = 145; // 0x91
+ field public static final int TYPE_OF_ADDRESS_UNKNOWN = 129; // 0x81
}
public final class ImsCallProfile implements android.os.Parcelable {
@@ -5963,6 +5974,13 @@
public final class ImsSsData implements android.os.Parcelable {
ctor public ImsSsData(int, int, int, int, int);
method public int describeContents();
+ method public android.telephony.ims.ImsCallForwardInfo[] getCallForwardInfo();
+ method public int getRequestType();
+ method public int getResult();
+ method public int getServiceClass();
+ method public int getServiceType();
+ method public android.telephony.ims.ImsSsInfo[] getSuppServiceInfo();
+ method public int getTeleserviceType();
method public boolean isTypeBarring();
method public boolean isTypeCf();
method public boolean isTypeClip();
@@ -5975,6 +5993,16 @@
method public boolean isTypeUnConditional();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsData> CREATOR;
+ field public static final int RESULT_SUCCESS = 0; // 0x0
+ field public static final int SERVICE_CLASS_DATA = 2; // 0x2
+ field public static final int SERVICE_CLASS_DATA_CIRCUIT_ASYNC = 32; // 0x20
+ field public static final int SERVICE_CLASS_DATA_CIRCUIT_SYNC = 16; // 0x10
+ field public static final int SERVICE_CLASS_DATA_PACKET_ACCESS = 64; // 0x40
+ field public static final int SERVICE_CLASS_DATA_PAD = 128; // 0x80
+ field public static final int SERVICE_CLASS_FAX = 4; // 0x4
+ field public static final int SERVICE_CLASS_NONE = 0; // 0x0
+ field public static final int SERVICE_CLASS_SMS = 8; // 0x8
+ field public static final int SERVICE_CLASS_VOICE = 1; // 0x1
field public static final int SS_ACTIVATION = 0; // 0x0
field public static final int SS_ALL_BARRING = 18; // 0x12
field public static final int SS_ALL_DATA_TELESERVICES = 3; // 0x3
@@ -6011,13 +6039,31 @@
field public static final int SS_WAIT = 12; // 0xc
}
+ public static class ImsSsData.Builder {
+ ctor public ImsSsData.Builder(int, int, int, int, int);
+ method public android.telephony.ims.ImsSsData build();
+ method public android.telephony.ims.ImsSsData.Builder setCallForwardingInfo(android.telephony.ims.ImsCallForwardInfo[]);
+ method public android.telephony.ims.ImsSsData.Builder setSuppServiceInfo(android.telephony.ims.ImsSsInfo[]);
+ }
+
public final class ImsSsInfo implements android.os.Parcelable {
- ctor public ImsSsInfo(int, java.lang.String);
+ ctor public deprecated ImsSsInfo(int, java.lang.String);
method public int describeContents();
- method public java.lang.String getIcbNum();
+ method public int getClirInterrogationStatus();
+ method public int getClirOutgoingState();
+ method public deprecated java.lang.String getIcbNum();
+ method public java.lang.String getIncomingCommunicationBarringNumber();
method public int getProvisionStatus();
method public int getStatus();
method public void writeToParcel(android.os.Parcel, int);
+ field public static final int CLIR_OUTGOING_DEFAULT = 0; // 0x0
+ field public static final int CLIR_OUTGOING_INVOCATION = 1; // 0x1
+ field public static final int CLIR_OUTGOING_SUPPRESSION = 2; // 0x2
+ field public static final int CLIR_STATUS_NOT_PROVISIONED = 0; // 0x0
+ field public static final int CLIR_STATUS_PROVISIONED_PERMANENT = 1; // 0x1
+ field public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4; // 0x4
+ field public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3; // 0x3
+ field public static final int CLIR_STATUS_UNKNOWN = 2; // 0x2
field public static final android.os.Parcelable.Creator<android.telephony.ims.ImsSsInfo> CREATOR;
field public static final int DISABLED = 0; // 0x0
field public static final int ENABLED = 1; // 0x1
@@ -6027,6 +6073,21 @@
field public static final int SERVICE_PROVISIONING_UNKNOWN = -1; // 0xffffffff
}
+ public static class ImsSsInfo.Builder {
+ ctor public ImsSsInfo.Builder(int);
+ method public android.telephony.ims.ImsSsInfo build();
+ method public android.telephony.ims.ImsSsInfo.Builder setClirInterrogationStatus(int);
+ method public android.telephony.ims.ImsSsInfo.Builder setClirOutgoingState(int);
+ method public android.telephony.ims.ImsSsInfo.Builder setIncomingCommunicationBarringNumber(java.lang.String);
+ method public android.telephony.ims.ImsSsInfo.Builder setProvisionStatus(int);
+ }
+
+ public static abstract class ImsSsInfo.ClirInterrogationStatus implements java.lang.annotation.Annotation {
+ }
+
+ public static abstract class ImsSsInfo.ClirOutgoingState implements java.lang.annotation.Annotation {
+ }
+
public final class ImsStreamMediaProfile implements android.os.Parcelable {
ctor public ImsStreamMediaProfile(int, int, int, int, int);
method public void copyFrom(android.telephony.ims.ImsStreamMediaProfile);
diff --git a/telephony/java/android/telephony/ims/ImsCallForwardInfo.java b/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
index 34b8884..70daa8b 100644
--- a/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
+++ b/telephony/java/android/telephony/ims/ImsCallForwardInfo.java
@@ -16,11 +16,16 @@
package android.telephony.ims;
+import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* Provides the call forward information for the supplementary service configuration.
*
@@ -28,39 +33,120 @@
*/
@SystemApi
public final class ImsCallForwardInfo implements Parcelable {
- // Refer to ImsUtInterface#CDIV_CF_XXX
- /** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for unconditional call
+ * forwarding. See TC 27.007
+ */
+ public static final int CDIV_CF_REASON_UNCONDITIONAL = 0;
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for call forwarding
+ * when the user is busy.
+ */
+ public static final int CDIV_CF_REASON_BUSY = 1;
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for call forwarding
+ * when there is no reply from the user.
+ */
+ public static final int CDIV_CF_REASON_NO_REPLY = 2;
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for call forwarding
+ * when the user is not reachable.
+ */
+ public static final int CDIV_CF_REASON_NOT_REACHABLE = 3;
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for setting all call
+ * forwarding reasons simultaneously (i.e. unconditional, busy, no reply, and not reachable).
+ */
+ public static final int CDIV_CF_REASON_ALL = 4;
+
+ /**
+ * CDIV (Communication Diversion, 3GPP TS 24.604) call forwarding reason for setting all
+ * conditional call forwarding reasons simultaneously (i.e. if busy, if no reply, and if not
+ * reachable).
+ */
+ public static final int CDIV_CF_REASON_ALL_CONDITIONAL = 5;
+
+ /**
+ * CDIV (Communication Diversion) IMS only call forwarding reason for call forwarding when the
+ * user is not logged in.
+ */
+ public static final int CDIV_CF_REASON_NOT_LOGGED_IN = 6;
+
+ /**@hide*/
+ @IntDef(prefix = {"CDIV_CF_REASON_"}, value = {
+ CDIV_CF_REASON_UNCONDITIONAL,
+ CDIV_CF_REASON_BUSY,
+ CDIV_CF_REASON_NO_REPLY,
+ CDIV_CF_REASON_NOT_REACHABLE,
+ CDIV_CF_REASON_ALL,
+ CDIV_CF_REASON_ALL_CONDITIONAL,
+ CDIV_CF_REASON_NOT_LOGGED_IN})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CallForwardReasons{}
+
+ /**
+ * Call forwarding is not active for any service class.
+ */
+ public static final int STATUS_NOT_ACTIVE = 0;
+
+ /**
+ * Call forwarding is active for one or more service classes.
+ */
+ public static final int STATUS_ACTIVE = 1;
+
+ /**@hide*/
+ @IntDef(prefix = {"STATUS_"}, value = {
+ STATUS_NOT_ACTIVE,
+ STATUS_ACTIVE})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CallForwardStatus{}
+
+ /**
+ * The address defined in {@link #getNumber()} is in an unknown format.
+ *
+ * See TS 27.007, section 7.11 for more information.
+ */
+ public static final int TYPE_OF_ADDRESS_UNKNOWN = 0x81;
+ /**
+ * The address defined in {@link #getNumber()} is in E.164 international format, which includes
+ * international access code "+".
+ *
+ * See TS 27.007, section 7.11 for more information.
+ */
+ public static final int TYPE_OF_ADDRESS_INTERNATIONAL = 0x91;
+
+ /**@hide*/
+ @IntDef(prefix = {"TYPE_OF_ADDRESS_"}, value = {
+ TYPE_OF_ADDRESS_INTERNATIONAL,
+ TYPE_OF_ADDRESS_UNKNOWN})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface TypeOfAddress{}
+
+ /**@hide*/
@UnsupportedAppUsage
- public int mCondition;
- // 0: disabled, 1: enabled
+ public @CallForwardReasons int mCondition;
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
@UnsupportedAppUsage
- public int mStatus;
- // 0x91: International, 0x81: Unknown
+ public @CallForwardStatus int mStatus;
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
@UnsupportedAppUsage
- public int mToA;
- // Service class
+ public @TypeOfAddress int mToA;
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
@UnsupportedAppUsage
- public int mServiceClass;
- // Number (it will not include the "sip" or "tel" URI scheme)
+ public @ImsSsData.ServiceClassFlags int mServiceClass;
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
@UnsupportedAppUsage
public String mNumber;
- // No reply timer for CF
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter.
@UnsupportedAppUsage
public int mTimeSeconds;
/** @hide */
- // TODO: Will be removed in the future, use public constructor instead.
@UnsupportedAppUsage
public ImsCallForwardInfo() {
}
@@ -68,9 +154,10 @@
/**
* IMS Call Forward Information.
*/
- public ImsCallForwardInfo(int condition, int status, int toA, int serviceClass, String number,
- int replyTimerSec) {
- mCondition = condition;
+ public ImsCallForwardInfo(@CallForwardReasons int reason, @CallForwardStatus int status,
+ @TypeOfAddress int toA, @ImsSsData.ServiceClassFlags int serviceClass,
+ @NonNull String number, int replyTimerSec) {
+ mCondition = reason;
mStatus = status;
mToA = toA;
mServiceClass = serviceClass;
@@ -130,26 +217,47 @@
}
};
- public int getCondition() {
+ /**
+ * @return the condition of call forwarding for the service classes specified.
+ */
+ public @CallForwardReasons int getCondition() {
return mCondition;
}
- public int getStatus() {
+ /**
+ * @return The call forwarding status.
+ */
+ public @CallForwardStatus int getStatus() {
return mStatus;
}
- public int getToA() {
+ /**
+ * @return the type of address (ToA) for the number.
+ * @see #getNumber()
+ */
+ public @TypeOfAddress int getToA() {
return mToA;
}
- public int getServiceClass() {
+ /**
+ * @return a bitfield containing the service classes that are enabled for call forwarding.
+ */
+ public @ImsSsData.ServiceClassFlags int getServiceClass() {
return mServiceClass;
}
+ /**
+ * @return the call forwarding number associated with call forwarding, with a number type
+ * defined by {@link #getToA()}.
+ */
public String getNumber() {
return mNumber;
}
+ /**
+ * @return the number in seconds to wait before the call is forwarded for call forwarding
+ * condition {@link #CDIV_CF_REASON_NO_REPLY}
+ */
public int getTimeSeconds() {
return mTimeSeconds;
}
diff --git a/telephony/java/android/telephony/ims/ImsSsData.java b/telephony/java/android/telephony/ims/ImsSsData.java
index b68055e..db5ba47 100644
--- a/telephony/java/android/telephony/ims/ImsSsData.java
+++ b/telephony/java/android/telephony/ims/ImsSsData.java
@@ -16,9 +16,11 @@
package android.telephony.ims;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.Rlog;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -31,6 +33,8 @@
@SystemApi
public final class ImsSsData implements Parcelable {
+ private static final String TAG = ImsSsData.class.getCanonicalName();
+
// Supplementary Service Type
// Call Forwarding
public static final int SS_CFU = 0;
@@ -76,30 +80,85 @@
public static final int SS_SMS_SERVICES = 4;
public static final int SS_ALL_TELESERVICES_EXCEPT_SMS = 5;
- // Service Class of Supplementary Service
- // See 27.007 +CCFC or +CLCK
- /** @hide */
- public static final int SERVICE_CLASS_NONE = 0; // no user input
- /** @hide */
- public static final int SERVICE_CLASS_VOICE = 1;
- /** @hide */
- public static final int SERVICE_CLASS_DATA = (1 << 1);
- /** @hide */
- public static final int SERVICE_CLASS_FAX = (1 << 2);
- /** @hide */
- public static final int SERVICE_CLASS_SMS = (1 << 3);
- /** @hide */
- public static final int SERVICE_CLASS_DATA_SYNC = (1 << 4);
- /** @hide */
- public static final int SERVICE_CLASS_DATA_ASYNC = (1 << 5);
- /** @hide */
- public static final int SERVICE_CLASS_PACKET = (1 << 6);
- /** @hide */
- public static final int SERVICE_CLASS_PAD = (1 << 7);
+ /**
+ * No call forwarding service class defined.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_NONE = 0;
/**
- * Result code used if the operation was successful. See {@link #result}.
- * @hide
+ * Service class flag for voice telephony.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_VOICE = 1;
+
+ /**
+ * Service class flag for all data bearers (including
+ * {@link #SERVICE_CLASS_DATA_CIRCUIT_SYNC,
+ * {@link #SERVICE_CLASS_DATA_CIRCUIT_ASYNC}, {@link #SERVICE_CLASS_PACKET_ACCESS},
+ * {@link #SERVICE_CLASS_PAD}}) if supported by the carrier.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_DATA = (1 << 1);
+ /**
+ * Service class flag for fax services.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_FAX = (1 << 2);
+ /**
+ * Service class flag for SMS services.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_SMS = (1 << 3);
+ /**
+ * Service class flag for the synchronous bearer service.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_DATA_CIRCUIT_SYNC = (1 << 4);
+
+ /**
+ * Service class flag for the asynchronous bearer service.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_DATA_CIRCUIT_ASYNC = (1 << 5);
+
+ /**
+ * Service class flag for the packet access bearer service.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_DATA_PACKET_ACCESS = (1 << 6);
+
+ /**
+ * Service class flag for the Packet Assembly/Disassembly bearer service.
+ *
+ * See TS 27.007 7.11 (+CCFC) and 7.4 (CLCK)
+ */
+ public static final int SERVICE_CLASS_DATA_PAD = (1 << 7);
+
+ /**@hide*/
+ @IntDef(flag = true, prefix = {"SERVICE_CLASS_"}, value = {
+ SERVICE_CLASS_NONE,
+ SERVICE_CLASS_VOICE,
+ SERVICE_CLASS_DATA,
+ SERVICE_CLASS_FAX,
+ SERVICE_CLASS_SMS,
+ SERVICE_CLASS_DATA_CIRCUIT_SYNC,
+ SERVICE_CLASS_DATA_CIRCUIT_ASYNC,
+ SERVICE_CLASS_DATA_PACKET_ACCESS,
+ SERVICE_CLASS_DATA_PAD})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ServiceClassFlags{}
+
+ /**
+ * Result code used if the operation was successful. See {@link #getResult()}.
*/
public static final int RESULT_SUCCESS = 0;
@@ -139,97 +198,58 @@
SERVICE_CLASS_DATA,
SERVICE_CLASS_FAX,
SERVICE_CLASS_SMS,
- SERVICE_CLASS_DATA_SYNC,
- SERVICE_CLASS_DATA_ASYNC,
- SERVICE_CLASS_PACKET,
- SERVICE_CLASS_PAD
+ SERVICE_CLASS_DATA_CIRCUIT_SYNC,
+ SERVICE_CLASS_DATA_CIRCUIT_ASYNC,
+ SERVICE_CLASS_DATA_PACKET_ACCESS,
+ SERVICE_CLASS_DATA_PAD
})
@Retention(RetentionPolicy.SOURCE)
public @interface ServiceClass{}
/**
- * The Service type of this Supplementary service. Valid values include:
- * SS_CFU,
- * SS_CF_BUSY,
- * SS_CF_NO_REPLY,
- * SS_CF_NOT_REACHABLE,
- * SS_CF_ALL,
- * SS_CF_ALL_CONDITIONAL,
- * SS_CFUT,
- * SS_CLIP,
- * SS_CLIR,
- * SS_COLP,
- * SS_COLR,
- * SS_CNAP,
- * SS_WAIT,
- * SS_BAOC,
- * SS_BAOIC,
- * SS_BAOIC_EXC_HOME,
- * SS_BAIC,
- * SS_BAIC_ROAMING,
- * SS_ALL_BARRING,
- * SS_OUTGOING_BARRING,
- * SS_INCOMING_BARRING,
- * SS_INCOMING_BARRING_DN,
- * SS_INCOMING_BARRING_ANONYMOUS
- *
+ * The Service type of this Supplementary service.
* @hide
*/
- // TODO: Make final, do not modify this field directly!
- public int serviceType;
+ public final @ServiceType int serviceType;
/**
- * Supplementary Service request Type. Valid values are:
- * SS_ACTIVATION,
- * SS_DEACTIVATION,
- * SS_INTERROGATION,
- * SS_REGISTRATION,
- * SS_ERASURE
- *
+ * Supplementary Service request Type:
+ * {@link #SS_ACTIVATION),
+ * {@link #SS_DEACTIVATION},
+ * {@link #SS_INTERROGATION},
+ * {@link #SS_REGISTRATION},
+ * {@link #SS_ERASURE}
* @hide
*/
- // TODO: Make final, do not modify this field directly!
- public int requestType;
+ public final int requestType;
/**
* Supplementary Service teleservice type:
- * SS_TELESERVICE_ALL_TELE_AND_BEARER,
- * SS_TELESERVICE_ALL_TELESEVICES,
- * SS_TELESERVICE_TELEPHONY,
- * SS_TELESERVICE_ALL_DATA,
- * SS_TELESERVICE_SMS,
- * SS_TELESERVICE_ALL_TELESERVICES_EXCEPT_SMS
+ * {@link #SS_ALL_TELE_AND_BEARER_SERVICES},
+ * {@link #SS_ALL_TELESEVICES},
+ * {@link #SS_TELEPHONY},
+ * {@link #SS_ALL_DATA_TELESERVICES},
+ * {@link #SS_SMS_SERVICES},
+ * {@link #SS_ALL_TELESERVICES_EXCEPT_SMS}
*
* @hide
*/
- // TODO: Make this param final! Do not try to modify this param directly.
- public int teleserviceType;
+ public final int teleserviceType;
/**
- * Supplementary Service service class. Valid values are:
- * SERVICE_CLASS_NONE,
- * SERVICE_CLASS_VOICE,
- * SERVICE_CLASS_DATA,
- * SERVICE_CLASS_FAX,
- * SERVICE_CLASS_SMS,
- * SERVICE_CLASS_DATA_SYNC,
- * SERVICE_CLASS_DATA_ASYNC,
- * SERVICE_CLASS_PACKET,
- * SERVICE_CLASS_PAD
+ * Supplementary Service service class.
*
* @hide
*/
- // TODO: Make this param final! Do not try to modify this param directly.
- public int serviceClass;
+ public final @ServiceClass int serviceClass;
/**
* Result of Supplementary Service operation. Valid values are:
- * RESULT_SUCCESS if the result is success, or
+ * {@link #RESULT_SUCCESS} if the result is success, or
* ImsReasonInfo code if the result is a failure.
*
* @hide
*/
- // TODO: Make this param final! Do not try to modify this param directly.
public final int result;
private int[] mSsInfo;
@@ -237,44 +257,81 @@
private ImsSsInfo[] mImsSsInfo;
/**
+ * Builder for optional ImsSsData parameters.
+ */
+ public static class Builder {
+ private ImsSsData mImsSsData;
+
+ /**
+ * Generate IMS Supplementary Service information.
+ * @param serviceType The Supplementary Service type.
+ * @param requestType Supplementary Service request Type:
+ * {@link #SS_ACTIVATION},
+ * {@link #SS_DEACTIVATION},
+ * {@link #SS_INTERROGATION},
+ * {@link #SS_REGISTRATION},
+ * {@link #SS_ERASURE}
+ * @param teleserviceType Supplementary Service teleservice type:
+ * {@link #SS_ALL_TELE_AND_BEARER_SERVICES},
+ * {@link #SS_ALL_TELESEVICES},
+ * {@link #SS_TELEPHONY},
+ * {@link #SS_ALL_DATA_TELESERVICES},
+ * {@link #SS_SMS_SERVICES},
+ * {@link #SS_ALL_TELESERVICES_EXCEPT_SMS}
+ * @param serviceClass Supplementary Service service class. See See 27.007 +CCFC or +CLCK.
+ * @param result Result of Supplementary Service operation. Valid values are 0 if the result
+ * is success, or {@link ImsReasonInfo} code if the result is a failure.
+ * @return this Builder instance for further constructing.
+ * @see #build()
+ */
+ public Builder(@ServiceType int serviceType, int requestType, int teleserviceType,
+ @ServiceClass int serviceClass, int result) {
+ mImsSsData = new ImsSsData(serviceType, requestType, teleserviceType, serviceClass,
+ result);
+ }
+
+ /**
+ * Set the array of {@link ImsSsInfo}s that are associated with this supplementary service
+ * data.
+ */
+ public Builder setSuppServiceInfo(@NonNull ImsSsInfo[] imsSsInfos) {
+ mImsSsData.mImsSsInfo = imsSsInfos;
+ return this;
+ }
+
+ /**
+ * Set the array of {@link ImsCallForwardInfo}s that are associated with this supplementary
+ * service data.
+ */
+ public Builder setCallForwardingInfo(@NonNull ImsCallForwardInfo[] imsCallForwardInfos) {
+ mImsSsData.mCfInfo = imsCallForwardInfos;
+ return this;
+ }
+
+ /**
+ * @return an {@link ImsSsData} containing optional parameters.
+ */
+ public ImsSsData build() {
+ return mImsSsData;
+ }
+ }
+
+ /**
* Generate IMS Supplementary Service information.
- * @param serviceType The Supplementary Service type. Valid entries:
- * SS_CFU,
- * SS_CF_BUSY,
- * SS_CF_NO_REPLY,
- * SS_CF_NOT_REACHABLE,
- * SS_CF_ALL,
- * SS_CF_ALL_CONDITIONAL,
- * SS_CFUT,
- * SS_CLIP,
- * SS_CLIR,
- * SS_COLP,
- * SS_COLR,
- * SS_CNAP,
- * SS_WAIT,
- * SS_BAOC,
- * SS_BAOIC,
- * SS_BAOIC_EXC_HOME,
- * SS_BAIC,
- * SS_BAIC_ROAMING,
- * SS_ALL_BARRING,
- * SS_OUTGOING_BARRING,
- * SS_INCOMING_BARRING,
- * SS_INCOMING_BARRING_DN,
- * SS_INCOMING_BARRING_ANONYMOUS
+ * @param serviceType The Supplementary Service type.
* @param requestType Supplementary Service request Type. Valid values are:
- * SS_ACTIVATION,
- * SS_DEACTIVATION,
- * SS_INTERROGATION,
- * SS_REGISTRATION,
- * SS_ERASURE
+ * {@link #SS_ACTIVATION},
+ * {@link #SS_DEACTIVATION},
+ * {@link #SS_INTERROGATION},
+ * {@link #SS_REGISTRATION},
+ * {@link #SS_ERASURE}
* @param teleserviceType Supplementary Service teleservice type:
- * SS_TELESERVICE_ALL_TELE_AND_BEARER,
- * SS_TELESERVICE_ALL_TELESEVICES,
- * SS_TELESERVICE_TELEPHONY,
- * SS_TELESERVICE_ALL_DATA,
- * SS_TELESERVICE_SMS,
- * SS_TELESERVICE_ALL_TELESERVICES_EXCEPT_SMS
+ * {@link #SS_ALL_TELE_AND_BEARER_SERVICES},
+ * {@link #SS_ALL_TELESEVICES},
+ * {@link #SS_TELEPHONY},
+ * {@link #SS_ALL_DATA_TELESERVICES},
+ * {@link #SS_SMS_SERVICES},
+ * {@link #SS_ALL_TELESERVICES_EXCEPT_SMS}
* @param serviceClass Supplementary Service service class. See See 27.007 +CCFC or +CLCK.
* @param result Result of Supplementary Service operation. Valid values are 0 if the result is
* success, or ImsReasonInfo code if the result is a failure.
@@ -313,11 +370,11 @@
@Override
public void writeToParcel(Parcel out, int flags) {
- out.writeInt(serviceType);
- out.writeInt(requestType);
- out.writeInt(teleserviceType);
- out.writeInt(serviceClass);
- out.writeInt(result);
+ out.writeInt(getServiceType());
+ out.writeInt(getRequestType());
+ out.writeInt(getTeleserviceType());
+ out.writeInt(getServiceClass());
+ out.writeInt(getResult());
out.writeIntArray(mSsInfo);
out.writeParcelableArray(mCfInfo, 0);
out.writeParcelableArray(mImsSsInfo, 0);
@@ -333,9 +390,9 @@
* @hide
*/
public boolean isTypeCF() {
- return (serviceType == SS_CFU || serviceType == SS_CF_BUSY ||
- serviceType == SS_CF_NO_REPLY || serviceType == SS_CF_NOT_REACHABLE ||
- serviceType == SS_CF_ALL || serviceType == SS_CF_ALL_CONDITIONAL);
+ return (getServiceType() == SS_CFU || getServiceType() == SS_CF_BUSY
+ || getServiceType() == SS_CF_NO_REPLY || getServiceType() == SS_CF_NOT_REACHABLE
+ || getServiceType() == SS_CF_ALL || getServiceType() == SS_CF_ALL_CONDITIONAL);
}
public boolean isTypeCf() {
@@ -343,7 +400,7 @@
}
public boolean isTypeUnConditional() {
- return (serviceType == SS_CFU || serviceType == SS_CF_ALL);
+ return (getServiceType() == SS_CFU || getServiceType() == SS_CF_ALL);
}
/**
@@ -351,7 +408,7 @@
* @hide
*/
public boolean isTypeCW() {
- return (serviceType == SS_WAIT);
+ return (getServiceType() == SS_WAIT);
}
public boolean isTypeCw() {
@@ -359,35 +416,84 @@
}
public boolean isTypeClip() {
- return (serviceType == SS_CLIP);
+ return (getServiceType() == SS_CLIP);
}
public boolean isTypeColr() {
- return (serviceType == SS_COLR);
+ return (getServiceType() == SS_COLR);
}
public boolean isTypeColp() {
- return (serviceType == SS_COLP);
+ return (getServiceType() == SS_COLP);
}
public boolean isTypeClir() {
- return (serviceType == SS_CLIR);
+ return (getServiceType() == SS_CLIR);
}
public boolean isTypeIcb() {
- return (serviceType == SS_INCOMING_BARRING_DN ||
- serviceType == SS_INCOMING_BARRING_ANONYMOUS);
+ return (getServiceType() == SS_INCOMING_BARRING_DN
+ || getServiceType() == SS_INCOMING_BARRING_ANONYMOUS);
}
public boolean isTypeBarring() {
- return (serviceType == SS_BAOC || serviceType == SS_BAOIC ||
- serviceType == SS_BAOIC_EXC_HOME || serviceType == SS_BAIC ||
- serviceType == SS_BAIC_ROAMING || serviceType == SS_ALL_BARRING ||
- serviceType == SS_OUTGOING_BARRING || serviceType == SS_INCOMING_BARRING);
+ return (getServiceType() == SS_BAOC || getServiceType() == SS_BAOIC
+ || getServiceType() == SS_BAOIC_EXC_HOME || getServiceType() == SS_BAIC
+ || getServiceType() == SS_BAIC_ROAMING || getServiceType() == SS_ALL_BARRING
+ || getServiceType() == SS_OUTGOING_BARRING
+ || getServiceType() == SS_INCOMING_BARRING);
}
public boolean isTypeInterrogation() {
- return (serviceType == SS_INTERROGATION);
+ return (getServiceType() == SS_INTERROGATION);
+ }
+
+ /**
+ * Supplementary Service request Type:
+ * {@link #SS_ACTIVATION),
+ * {@link #SS_DEACTIVATION},
+ * {@link #SS_INTERROGATION},
+ * {@link #SS_REGISTRATION},
+ * {@link #SS_ERASURE}
+ */
+ public int getRequestType() {
+ return requestType;
+ }
+
+ /**
+ * The Service type of this Supplementary service.
+ */
+ public @ServiceType int getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * Supplementary Service teleservice type:
+ * {@link #SS_ALL_TELE_AND_BEARER_SERVICES},
+ * {@link #SS_ALL_TELESEVICES},
+ * {@link #SS_TELEPHONY},
+ * {@link #SS_ALL_DATA_TELESERVICES},
+ * {@link #SS_SMS_SERVICES},
+ * {@link #SS_ALL_TELESERVICES_EXCEPT_SMS}
+ */
+ public int getTeleserviceType() {
+ return teleserviceType;
+ }
+
+ /**
+ * Supplementary Service service class.
+ */
+ public @ServiceClass int getServiceClass() {
+ return serviceClass;
+ }
+
+ /**
+ * Result of Supplementary Service operation. Valid values are:
+ * {@link #RESULT_SUCCESS} if the result is success, or
+ * {@link ImsReasonInfo} CODE_* code if the result is a failure.
+ */
+ public int getResult() {
+ return result;
}
/** @hide */
@@ -406,43 +512,68 @@
}
/**
- * This field will be null for RequestType SS_INTERROGATION
- * and ServiceType SS_CF_*, SS_INCOMING_BARRING_DN,
- * SS_INCOMING_BARRING_ANONYMOUS.
+ * This is a compatibility function to transform the public API to a form that can be processed
+ * by telephony.
*
* @hide
*/
- public int[] getSuppServiceInfo() {
- return mSsInfo;
+ //TODO: Refactor Telephony to use well defined classes instead of an int[] to process SS.
+ public int[] getSuppServiceInfoCompat() {
+ if (mSsInfo != null) {
+ // Something has set the ssInfo using hidden APIs, so for compatibility just return that
+ // structure directly.
+ return mSsInfo;
+ }
+
+
+ int[] result = new int[2];
+ if (mImsSsInfo == null || mImsSsInfo.length == 0) {
+ Rlog.e(TAG, "getSuppServiceInfoCompat: Could not parse mImsSsInfo, returning empty "
+ + "int[]");
+ return result;
+ }
+
+ // Convert ImsSsInfo into a form that telephony can read (as per 3GPP 27.007)
+ // CLIR (section 7.7)
+ if (isTypeClir()) {
+ // Assume there will only be one ImsSsInfo.
+ // contains {"n","m"} parameters
+ result[0] = mImsSsInfo[0].getClirOutgoingState();
+ result[1] = mImsSsInfo[0].getClirInterrogationStatus();
+ return result;
+ }
+ // COLR 7.31
+ if (isTypeColr()) {
+ result[0] = mImsSsInfo[0].getProvisionStatus();
+ }
+ // Facility Lock CLCK 7.4 (for call barring), CLIP 7.6, COLP 7.8, as well as any
+ // other result, just return the status for the "n" parameter and provisioning status for
+ // "m" as the default.
+ result[0] = mImsSsInfo[0].getStatus();
+ result[1] = mImsSsInfo[0].getProvisionStatus();
+ return result;
}
/**
- * Valid only for ServiceTypes
- * - SS_INCOMING_BARRING_DN and
- * - ServiceType SS_INCOMING_BARRING_ANONYMOUS.
- * Will be null otherwise.
- * @hide
+ * @return an array of {@link ImsSsInfo}s associated with this supplementary service data.
*/
- public ImsSsInfo[] getImsSpecificSuppServiceInfo() {
+ public @NonNull ImsSsInfo[] getSuppServiceInfo() {
return mImsSsInfo;
}
/**
- * Valid only for supplementary services
- * - ServiceType SS_CF_* and
- * - RequestType SS_INTERROGATION.
- * Will be null otherwise.
- * @hide
+ * @return an array of {@link ImsCallForwardInfo}s associated with this supplementary service
+ * data.
**/
public ImsCallForwardInfo[] getCallForwardInfo() {
return mCfInfo;
}
public String toString() {
- return "[ImsSsData] " + "ServiceType: " + serviceType
- + " RequestType: " + requestType
- + " TeleserviceType: " + teleserviceType
- + " ServiceClass: " + serviceClass
- + " Result: " + result;
+ return "[ImsSsData] " + "ServiceType: " + getServiceType()
+ + " RequestType: " + getRequestType()
+ + " TeleserviceType: " + getTeleserviceType()
+ + " ServiceClass: " + getServiceClass()
+ + " Result: " + getResult();
}
}
diff --git a/telephony/java/android/telephony/ims/ImsSsInfo.java b/telephony/java/android/telephony/ims/ImsSsInfo.java
index 3a784c1..0af6e62 100644
--- a/telephony/java/android/telephony/ims/ImsSsInfo.java
+++ b/telephony/java/android/telephony/ims/ImsSsInfo.java
@@ -17,6 +17,8 @@
package android.telephony.ims;
import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
@@ -28,10 +30,24 @@
/**
* Provides the result to the update operation for the supplementary service configuration.
*
+ * Also supports IMS specific Incoming Communication Barring (ICB) as well as Anonymous
+ * Communication Rejection (ACR), as per 3GPP 24.611.
+ *
+ * @see Builder
* @hide
*/
@SystemApi
public final class ImsSsInfo implements Parcelable {
+
+ /**@hide*/
+ @IntDef(value = {
+ NOT_REGISTERED,
+ DISABLED,
+ ENABLED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ServiceStatus {}
+
/**
* For the status of service registration or activation/deactivation.
*/
@@ -40,57 +56,180 @@
public static final int ENABLED = 1;
/**
- * Provision status of service
+ * Provision status of service.
+ * @hide
*/
- /** @hide */
- @IntDef({
+ @IntDef(value = {
SERVICE_PROVISIONING_UNKNOWN,
SERVICE_NOT_PROVISIONED,
SERVICE_PROVISIONED
- })
+ }, prefix = "SERVICE_")
@Retention(RetentionPolicy.SOURCE)
public @interface ServiceProvisionStatus {}
+
/**
* Unknown provision status for the service.
*/
public static final int SERVICE_PROVISIONING_UNKNOWN = (-1);
+
/**
* Service is not provisioned.
*/
public static final int SERVICE_NOT_PROVISIONED = 0;
+
/**
* Service is provisioned.
*/
public static final int SERVICE_PROVISIONED = 1;
+ @IntDef(value = {
+ CLIR_OUTGOING_DEFAULT,
+ CLIR_OUTGOING_INVOCATION,
+ CLIR_OUTGOING_SUPPRESSION
+ }, prefix = "CLIR_OUTGOING_")
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ClirOutgoingState {}
+
+ /**
+ * Calling line identification restriction (CLIR) is set to the default according to the
+ * subscription of the CLIR service.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_OUTGOING_DEFAULT = 0;
+ /**
+ * Activate Calling line identification restriction for outgoing calls.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_OUTGOING_INVOCATION = 1;
+ /**
+ * Deactivate Calling line identification restriction for outgoing calls.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_OUTGOING_SUPPRESSION = 2;
+
+ /**
+ * Calling line identification restriction is currently not provisioned.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_STATUS_NOT_PROVISIONED = 0;
+ /**
+ * Calling line identification restriction is currently provisioned in permanent mode.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_STATUS_PROVISIONED_PERMANENT = 1;
+ /**
+ * Calling line identification restriction is currently unknown, e.g. no network, etc.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_STATUS_UNKNOWN = 2;
+ /**
+ * Calling line identification restriction temporary mode, temporarily restricted.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_STATUS_TEMPORARILY_RESTRICTED = 3;
+ /**
+ * Calling line identification restriction temporary mode, temporarily allowed.
+ *
+ * See TS 27.007, section 7.7 for more information.
+ */
+ public static final int CLIR_STATUS_TEMPORARILY_ALLOWED = 4;
+
+ @IntDef(value = {
+ CLIR_STATUS_NOT_PROVISIONED,
+ CLIR_STATUS_PROVISIONED_PERMANENT,
+ CLIR_STATUS_UNKNOWN,
+ CLIR_STATUS_TEMPORARILY_RESTRICTED,
+ CLIR_STATUS_TEMPORARILY_ALLOWED
+ }, prefix = "CLIR_STATUS_")
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ClirInterrogationStatus {}
+
// 0: disabled, 1: enabled
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter!
@UnsupportedAppUsage
public int mStatus;
/** @hide */
- // TODO: Make private, do not modify this field directly, use getter!
@UnsupportedAppUsage
public String mIcbNum;
/** @hide */
public int mProvisionStatus = SERVICE_PROVISIONING_UNKNOWN;
+ private int mClirInterrogationStatus = CLIR_STATUS_UNKNOWN;
+ private int mClirOutgoingState = CLIR_OUTGOING_DEFAULT;
/**@hide*/
- // TODO: Remove! Do not use this constructor, instead use public version.
@UnsupportedAppUsage
public ImsSsInfo() {
}
/**
- *
- * @param status The status of the service registration of activation/deactiviation. Valid
- * entries include:
- * {@link #NOT_REGISTERED},
- * {@link #DISABLED},
- * {@link #ENABLED}
- * @param icbNum The Incoming barring number.
+ * Builds {@link ImsSsInfo} instances, which may include optional parameters.
*/
- public ImsSsInfo(int status, String icbNum) {
+ public static class Builder {
+
+ private final ImsSsInfo mImsSsInfo;
+
+ public Builder(@ServiceStatus int status) {
+ mImsSsInfo = new ImsSsInfo();
+ mImsSsInfo.mStatus = status;
+ }
+
+ /**
+ * Set the ICB number for IMS call barring.
+ * @param number The number in E.164 international format.
+ */
+ public Builder setIncomingCommunicationBarringNumber(@NonNull String number) {
+ mImsSsInfo.mIcbNum = number;
+ return this;
+ }
+
+ /**
+ * Set the provisioning status for a Supplementary Service interrogation response.
+ */
+ public Builder setProvisionStatus(@ServiceProvisionStatus int provisionStatus) {
+ mImsSsInfo.mProvisionStatus = provisionStatus;
+ return this;
+ }
+
+ /**
+ * Set the Calling Line Identification Restriction (CLIR) status for a supplementary service
+ * interrogation response.
+ */
+ public Builder setClirInterrogationStatus(@ClirInterrogationStatus int status) {
+ mImsSsInfo.mClirInterrogationStatus = status;
+ return this;
+ }
+
+ /**
+ * Set the Calling line identification Restriction (CLIR) state for outgoing calls.
+ */
+ public Builder setClirOutgoingState(@ClirOutgoingState int state) {
+ mImsSsInfo.mClirOutgoingState = state;
+ return this;
+ }
+
+ /**
+ * @return a built {@link ImsSsInfo} containing optional the parameters that were set.
+ */
+ public ImsSsInfo build() {
+ return mImsSsInfo;
+ }
+ }
+
+ /**
+ *
+ * @param status The status of the service registration of activation/deactiviation.
+ * @param icbNum The Incoming barring number.
+ * @deprecated use {@link ImsSsInfo.Builder} instead.
+ */
+ @Deprecated
+ public ImsSsInfo(@ServiceStatus int status, @Nullable String icbNum) {
mStatus = status;
mIcbNum = icbNum;
}
@@ -148,27 +287,46 @@
};
/**
- * @return Supplementary Service Configuration status. Valid Values are:
- * {@link #NOT_REGISTERED},
- * {@link #DISABLED},
- * {@link #ENABLED}
+ * @return Supplementary Service Configuration status.
*/
- public int getStatus() {
+ public @ServiceStatus int getStatus() {
return mStatus;
}
+ /** @deprecated Use {@link #getIncomingCommunicationBarringNumber()} instead.*/
+ @Deprecated
public String getIcbNum() {
return mIcbNum;
}
/**
- * @return Supplementary Service Provision status. Valid Values are:
- * {@link #SERVICE_PROVISIONING_UNKNOWN},
- * {@link #SERVICE_NOT_PROVISIONED},
- * {@link #SERVICE_PROVISIONED}
+ * @return The Incoming Communication Barring (ICB) number.
*/
- @ServiceProvisionStatus
- public int getProvisionStatus() {
+ public String getIncomingCommunicationBarringNumber() {
+ return mIcbNum;
+ }
+
+ /**
+ * @return Supplementary Service Provision status.
+ */
+ public @ServiceProvisionStatus int getProvisionStatus() {
return mProvisionStatus;
}
+
+ /**
+ * @return the Calling Line Identification Restriction State for outgoing calls with respect to
+ * this subscription. Will be {@link #CLIR_OUTGOING_DEFAULT} if not applicable to this SS info.
+ */
+ public @ClirOutgoingState int getClirOutgoingState() {
+ return mClirOutgoingState;
+ }
+
+ /**
+ * @return the calling line identification restriction provisioning status upon interrogation of
+ * the service for this subscription. Will be {@link #CLIR_STATUS_UNKNOWN} if not applicable to
+ * this SS info.
+ */
+ public @ClirInterrogationStatus int getClirInterrogationStatus() {
+ return mClirInterrogationStatus;
+ }
}