Merge "Expose CdmaSmsCbProgramData as SystemApi"

This commit is contained in:
Jordan Liu
2019-10-01 20:33:29 +00:00
committed by Gerrit Code Review
3 changed files with 125 additions and 28 deletions

View File

@@ -8275,6 +8275,27 @@ package android.telephony {
} }
package android.telephony.cdma {
public final class CdmaSmsCbProgramData implements android.os.Parcelable {
method public int describeContents();
method public int getCategory();
method public int getOperation();
method public void writeToParcel(android.os.Parcel, int);
field public static final int CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 4099; // 0x1003
field public static final int CATEGORY_CMAS_EXTREME_THREAT = 4097; // 0x1001
field public static final int CATEGORY_CMAS_LAST_RESERVED_VALUE = 4351; // 0x10ff
field public static final int CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 4096; // 0x1000
field public static final int CATEGORY_CMAS_SEVERE_THREAT = 4098; // 0x1002
field public static final int CATEGORY_CMAS_TEST_MESSAGE = 4100; // 0x1004
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.cdma.CdmaSmsCbProgramData> CREATOR;
field public static final int OPERATION_ADD_CATEGORY = 1; // 0x1
field public static final int OPERATION_CLEAR_CATEGORIES = 2; // 0x2
field public static final int OPERATION_DELETE_CATEGORY = 0; // 0x0
}
}
package android.telephony.data { package android.telephony.data {
public final class DataCallResponse implements android.os.Parcelable { public final class DataCallResponse implements android.os.Parcelable {

View File

@@ -16,12 +16,19 @@
package android.telephony.cdma; package android.telephony.cdma;
import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** /**
* CDMA Service Category Program Data from SCPT teleservice SMS. * CDMA Service Category Program Data from SCPT (Service Category Programming Teleservice) SMS,
* as defined in 3GPP2 C.S0015-B section 4.5.19.
* <p>
* The CellBroadcastReceiver app receives an Intent with action * The CellBroadcastReceiver app receives an Intent with action
* {@link android.provider.Telephony.Sms.Intents#SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION} * {@link android.provider.Telephony.Sms.Intents#SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION}
* containing an array of these objects to update its list of cell broadcast service categories * containing an array of these objects to update its list of cell broadcast service categories
@@ -29,6 +36,7 @@ import android.os.Parcelable;
* *
* {@hide} * {@hide}
*/ */
@SystemApi
public final class CdmaSmsCbProgramData implements Parcelable { public final class CdmaSmsCbProgramData implements Parcelable {
/** Delete the specified service category from the list of enabled categories. */ /** Delete the specified service category from the list of enabled categories. */
@@ -40,40 +48,83 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** Clear all service categories from the list of enabled categories. */ /** Clear all service categories from the list of enabled categories. */
public static final int OPERATION_CLEAR_CATEGORIES = 2; public static final int OPERATION_CLEAR_CATEGORIES = 2;
/** Alert option: no alert. */ /** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"OPERATION_"},
value = {
OPERATION_DELETE_CATEGORY,
OPERATION_ADD_CATEGORY,
OPERATION_CLEAR_CATEGORIES,
})
public @interface Operation {}
// CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
/** Indicates a presidential-level alert */
public static final int CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000;
/** Indicates an extreme threat to life and property */
public static final int CATEGORY_CMAS_EXTREME_THREAT = 0x1001;
/** Indicates an severe threat to life and property */
public static final int CATEGORY_CMAS_SEVERE_THREAT = 0x1002;
/** Indicates an AMBER child abduction emergency */
public static final int CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003;
/** Indicates a CMAS test message */
public static final int CATEGORY_CMAS_TEST_MESSAGE = 0x1004;
/** The last reserved value of a CMAS service category according to 3GPP C.R1001 table
* 9.3.3-1. */
public static final int CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"CATEGORY_"},
value = {
CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT,
CATEGORY_CMAS_EXTREME_THREAT,
CATEGORY_CMAS_SEVERE_THREAT,
CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY,
CATEGORY_CMAS_TEST_MESSAGE,
CATEGORY_CMAS_LAST_RESERVED_VALUE,
})
public @interface Category {}
/** Alert option: no alert. @hide */
public static final int ALERT_OPTION_NO_ALERT = 0; public static final int ALERT_OPTION_NO_ALERT = 0;
/** Alert option: default alert. */ /** Alert option: default alert. @hide */
public static final int ALERT_OPTION_DEFAULT_ALERT = 1; public static final int ALERT_OPTION_DEFAULT_ALERT = 1;
/** Alert option: vibrate alert once. */ /** Alert option: vibrate alert once. @hide */
public static final int ALERT_OPTION_VIBRATE_ONCE = 2; public static final int ALERT_OPTION_VIBRATE_ONCE = 2;
/** Alert option: vibrate alert - repeat. */ /** Alert option: vibrate alert - repeat. @hide */
public static final int ALERT_OPTION_VIBRATE_REPEAT = 3; public static final int ALERT_OPTION_VIBRATE_REPEAT = 3;
/** Alert option: visual alert once. */ /** Alert option: visual alert once. @hide */
public static final int ALERT_OPTION_VISUAL_ONCE = 4; public static final int ALERT_OPTION_VISUAL_ONCE = 4;
/** Alert option: visual alert - repeat. */ /** Alert option: visual alert - repeat. @hide */
public static final int ALERT_OPTION_VISUAL_REPEAT = 5; public static final int ALERT_OPTION_VISUAL_REPEAT = 5;
/** Alert option: low-priority alert once. */ /** Alert option: low-priority alert once. @hide */
public static final int ALERT_OPTION_LOW_PRIORITY_ONCE = 6; public static final int ALERT_OPTION_LOW_PRIORITY_ONCE = 6;
/** Alert option: low-priority alert - repeat. */ /** Alert option: low-priority alert - repeat. @hide */
public static final int ALERT_OPTION_LOW_PRIORITY_REPEAT = 7; public static final int ALERT_OPTION_LOW_PRIORITY_REPEAT = 7;
/** Alert option: medium-priority alert once. */ /** Alert option: medium-priority alert once. @hide */
public static final int ALERT_OPTION_MED_PRIORITY_ONCE = 8; public static final int ALERT_OPTION_MED_PRIORITY_ONCE = 8;
/** Alert option: medium-priority alert - repeat. */ /** Alert option: medium-priority alert - repeat. @hide */
public static final int ALERT_OPTION_MED_PRIORITY_REPEAT = 9; public static final int ALERT_OPTION_MED_PRIORITY_REPEAT = 9;
/** Alert option: high-priority alert once. */ /** Alert option: high-priority alert once. @hide */
public static final int ALERT_OPTION_HIGH_PRIORITY_ONCE = 10; public static final int ALERT_OPTION_HIGH_PRIORITY_ONCE = 10;
/** Alert option: high-priority alert - repeat. */ /** Alert option: high-priority alert - repeat. @hide */
public static final int ALERT_OPTION_HIGH_PRIORITY_REPEAT = 11; public static final int ALERT_OPTION_HIGH_PRIORITY_REPEAT = 11;
/** Service category operation (add/delete/clear). */ /** Service category operation (add/delete/clear). */
@@ -94,9 +145,12 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** Name of service category. */ /** Name of service category. */
private final String mCategoryName; private final String mCategoryName;
/** Create a new CdmaSmsCbProgramData object with the specified values. */ /**
public CdmaSmsCbProgramData(int operation, int category, int language, int maxMessages, * Create a new CdmaSmsCbProgramData object with the specified values.
int alertOption, @NonNull String categoryName) { * @hide
*/
public CdmaSmsCbProgramData(@Operation int operation, @Category int category, int language,
int maxMessages, int alertOption, @NonNull String categoryName) {
mOperation = operation; mOperation = operation;
mCategory = category; mCategory = category;
mLanguage = language; mLanguage = language;
@@ -105,7 +159,10 @@ public final class CdmaSmsCbProgramData implements Parcelable {
mCategoryName = categoryName; mCategoryName = categoryName;
} }
/** Create a new CdmaSmsCbProgramData object from a Parcel. */ /**
* Create a new CdmaSmsCbProgramData object from a Parcel.
* @hide
*/
CdmaSmsCbProgramData(Parcel in) { CdmaSmsCbProgramData(Parcel in) {
mOperation = in.readInt(); mOperation = in.readInt();
mCategory = in.readInt(); mCategory = in.readInt();
@@ -133,23 +190,28 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** /**
* Returns the service category operation, e.g. {@link #OPERATION_ADD_CATEGORY}. * Returns the service category operation, e.g. {@link #OPERATION_ADD_CATEGORY}.
* @return one of the {@code OPERATION_*} values *
* @return the service category operation
*/ */
public int getOperation() { public @Operation int getOperation() {
return mOperation; return mOperation;
} }
/** /**
* Returns the CDMA service category to modify. * Returns the CDMA service category to modify. See 3GPP2 C.S0015-B section 3.4.3.2 for more
* information on the service category. Currently only CMAS service categories 0x1000 through
* 0x10FF are supported.
*
* @return a 16-bit CDMA service category value * @return a 16-bit CDMA service category value
*/ */
public int getCategory() { public @Category int getCategory() {
return mCategory; return mCategory;
} }
/** /**
* Returns the CDMA language code for this service category. * Returns the CDMA language code for this service category.
* @return one of the language values defined in BearerData.LANGUAGE_* * @return one of the language values defined in BearerData.LANGUAGE_*
* @hide
*/ */
public int getLanguage() { public int getLanguage() {
return mLanguage; return mLanguage;
@@ -158,6 +220,7 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** /**
* Returns the maximum number of messages to store for this service category. * Returns the maximum number of messages to store for this service category.
* @return the maximum number of messages to store for this service category * @return the maximum number of messages to store for this service category
* @hide
*/ */
public int getMaxMessages() { public int getMaxMessages() {
return mMaxMessages; return mMaxMessages;
@@ -166,6 +229,7 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** /**
* Returns the service category alert option, e.g. {@link #ALERT_OPTION_DEFAULT_ALERT}. * Returns the service category alert option, e.g. {@link #ALERT_OPTION_DEFAULT_ALERT}.
* @return one of the {@code ALERT_OPTION_*} values * @return one of the {@code ALERT_OPTION_*} values
* @hide
*/ */
public int getAlertOption() { public int getAlertOption() {
return mAlertOption; return mAlertOption;
@@ -174,6 +238,7 @@ public final class CdmaSmsCbProgramData implements Parcelable {
/** /**
* Returns the service category name, in the language specified by {@link #getLanguage()}. * Returns the service category name, in the language specified by {@link #getLanguage()}.
* @return an optional service category name * @return an optional service category name
* @hide
*/ */
@NonNull @NonNull
public String getCategoryName() { public String getCategoryName() {
@@ -196,7 +261,10 @@ public final class CdmaSmsCbProgramData implements Parcelable {
return 0; return 0;
} }
/** Creator for unparcelling objects. */ /**
* Creator for unparcelling objects.
*/
@NonNull
public static final Parcelable.Creator<CdmaSmsCbProgramData> public static final Parcelable.Creator<CdmaSmsCbProgramData>
CREATOR = new Parcelable.Creator<CdmaSmsCbProgramData>() { CREATOR = new Parcelable.Creator<CdmaSmsCbProgramData>() {
@Override @Override

View File

@@ -17,6 +17,8 @@
package com.android.internal.telephony.cdma.sms; package com.android.internal.telephony.cdma.sms;
import android.telephony.cdma.CdmaSmsCbProgramData;
import com.android.internal.telephony.cdma.sms.CdmaSmsSubaddress; import com.android.internal.telephony.cdma.sms.CdmaSmsSubaddress;
public final class SmsEnvelope { public final class SmsEnvelope {
@@ -55,12 +57,18 @@ public final class SmsEnvelope {
//... //...
// CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1 // CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000; public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT =
public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT = 0x1001; CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT;
public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT = 0x1002; public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT =
public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003; CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT;
public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE = 0x1004; public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT =
public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff; CdmaSmsCbProgramData.CATEGORY_CMAS_SEVERE_THREAT;
public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY =
CdmaSmsCbProgramData.CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY;
public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE =
CdmaSmsCbProgramData.CATEGORY_CMAS_TEST_MESSAGE;
public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE =
CdmaSmsCbProgramData.CATEGORY_CMAS_LAST_RESERVED_VALUE;
/** /**
* Provides the type of a SMS message like point to point, broadcast or acknowledge * Provides the type of a SMS message like point to point, broadcast or acknowledge