Skip to content

Commit 0c8a776

Browse files
Jake HambyAndroid Git Automerger
authored andcommitted
am 893d93d: Implement CMAS service category program results.
* commit '893d93d2076ccbb4d8c9d37bf6ffe14e4847a470': Implement CMAS service category program results.
2 parents 58ae40e + 893d93d commit 0c8a776

File tree

2 files changed

+153
-9
lines changed

2 files changed

+153
-9
lines changed

telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public class CdmaSmsCbProgramData implements Parcelable {
8181
/** Service category to modify. */
8282
private final int mCategory;
8383

84-
/** Language used for service category name (ISO 639 two character code). */
85-
private final String mLanguage;
84+
/** Language used for service category name (defined in BearerData.LANGUAGE_*). */
85+
private final int mLanguage;
8686

8787
/** Maximum number of messages to store for this service category. */
8888
private final int mMaxMessages;
@@ -94,7 +94,7 @@ public class CdmaSmsCbProgramData implements Parcelable {
9494
private final String mCategoryName;
9595

9696
/** Create a new CdmaSmsCbProgramData object with the specified values. */
97-
public CdmaSmsCbProgramData(int operation, int category, String language, int maxMessages,
97+
public CdmaSmsCbProgramData(int operation, int category, int language, int maxMessages,
9898
int alertOption, String categoryName) {
9999
mOperation = operation;
100100
mCategory = category;
@@ -108,7 +108,7 @@ public CdmaSmsCbProgramData(int operation, int category, String language, int ma
108108
CdmaSmsCbProgramData(Parcel in) {
109109
mOperation = in.readInt();
110110
mCategory = in.readInt();
111-
mLanguage = in.readString();
111+
mLanguage = in.readInt();
112112
mMaxMessages = in.readInt();
113113
mAlertOption = in.readInt();
114114
mCategoryName = in.readString();
@@ -124,7 +124,7 @@ public CdmaSmsCbProgramData(int operation, int category, String language, int ma
124124
public void writeToParcel(Parcel dest, int flags) {
125125
dest.writeInt(mOperation);
126126
dest.writeInt(mCategory);
127-
dest.writeString(mLanguage);
127+
dest.writeInt(mLanguage);
128128
dest.writeInt(mMaxMessages);
129129
dest.writeInt(mAlertOption);
130130
dest.writeString(mCategoryName);
@@ -147,10 +147,10 @@ public int getCategory() {
147147
}
148148

149149
/**
150-
* Returns the ISO-639-1 language code for the service category name, or null if not present.
151-
* @return a two-digit ISO-639-1 language code, e.g. "en" for English
150+
* Returns the CDMA language code for this service category.
151+
* @return one of the language values defined in BearerData.LANGUAGE_*
152152
*/
153-
public String getLanguageCode() {
153+
public int getLanguage() {
154154
return mLanguage;
155155
}
156156

@@ -171,7 +171,7 @@ public int getAlertOption() {
171171
}
172172

173173
/**
174-
* Returns the service category name, in the language specified by {@link #getLanguageCode()}.
174+
* Returns the service category name, in the language specified by {@link #getLanguage()}.
175175
* @return an optional service category name
176176
*/
177177
public String getCategoryName() {
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* Copyright (C) 2012 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package android.telephony.cdma;
18+
19+
import android.os.Parcel;
20+
import android.os.Parcelable;
21+
22+
/**
23+
* CDMA Service Category Program Results from SCPT teleservice SMS.
24+
*
25+
* {@hide}
26+
*/
27+
public class CdmaSmsCbProgramResults implements Parcelable {
28+
29+
/** Program result: success. */
30+
public static final int RESULT_SUCCESS = 0;
31+
32+
/** Program result: memory limit exceeded. */
33+
public static final int RESULT_MEMORY_LIMIT_EXCEEDED = 1;
34+
35+
/** Program result: limit exceeded. */
36+
public static final int RESULT_CATEGORY_LIMIT_EXCEEDED = 2;
37+
38+
/** Program result: category already opted in. */
39+
public static final int RESULT_CATEGORY_ALREADY_ADDED = 3;
40+
41+
/** Program result: category already opted in. */
42+
public static final int RESULT_CATEGORY_ALREADY_DELETED = 4;
43+
44+
/** Program result: invalid MAX_MESSAGES. */
45+
public static final int RESULT_INVALID_MAX_MESSAGES = 5;
46+
47+
/** Program result: invalid ALERT_OPTION. */
48+
public static final int RESULT_INVALID_ALERT_OPTION = 6;
49+
50+
/** Program result: invalid service category name. */
51+
public static final int RESULT_INVALID_CATEGORY_NAME = 7;
52+
53+
/** Program result: unspecified programming failure. */
54+
public static final int RESULT_UNSPECIFIED_FAILURE = 8;
55+
56+
/** Service category to modify. */
57+
private final int mCategory;
58+
59+
/** Language used for service category name (defined in BearerData.LANGUAGE_*). */
60+
private final int mLanguage;
61+
62+
/** Result of service category programming for this category. */
63+
private final int mCategoryResult;
64+
65+
/** Create a new CdmaSmsCbProgramResults object with the specified values. */
66+
public CdmaSmsCbProgramResults(int category, int language, int categoryResult) {
67+
mCategory = category;
68+
mLanguage = language;
69+
mCategoryResult = categoryResult;
70+
}
71+
72+
/** Create a new CdmaSmsCbProgramResults object from a Parcel. */
73+
CdmaSmsCbProgramResults(Parcel in) {
74+
mCategory = in.readInt();
75+
mLanguage = in.readInt();
76+
mCategoryResult = in.readInt();
77+
}
78+
79+
/**
80+
* Flatten this object into a Parcel.
81+
*
82+
* @param dest The Parcel in which the object should be written.
83+
* @param flags Additional flags about how the object should be written (ignored).
84+
*/
85+
@Override
86+
public void writeToParcel(Parcel dest, int flags) {
87+
dest.writeInt(mCategory);
88+
dest.writeInt(mLanguage);
89+
dest.writeInt(mCategoryResult);
90+
}
91+
92+
/**
93+
* Returns the CDMA service category to modify.
94+
* @return a 16-bit CDMA service category value
95+
*/
96+
public int getCategory() {
97+
return mCategory;
98+
}
99+
100+
/**
101+
* Returns the CDMA language code for this service category.
102+
* @return one of the language values defined in BearerData.LANGUAGE_*
103+
*/
104+
public int getLanguage() {
105+
return mLanguage;
106+
}
107+
108+
/**
109+
* Returns the result of service programming for this category
110+
* @return the result of service programming for this category
111+
*/
112+
public int getCategoryResult() {
113+
return mCategoryResult;
114+
}
115+
116+
@Override
117+
public String toString() {
118+
return "CdmaSmsCbProgramResults{category=" + mCategory
119+
+ ", language=" + mLanguage + ", result=" + mCategoryResult + '}';
120+
}
121+
122+
/**
123+
* Describe the kinds of special objects contained in the marshalled representation.
124+
* @return a bitmask indicating this Parcelable contains no special objects
125+
*/
126+
@Override
127+
public int describeContents() {
128+
return 0;
129+
}
130+
131+
/** Creator for unparcelling objects. */
132+
public static final Parcelable.Creator<CdmaSmsCbProgramResults>
133+
CREATOR = new Parcelable.Creator<CdmaSmsCbProgramResults>() {
134+
@Override
135+
public CdmaSmsCbProgramResults createFromParcel(Parcel in) {
136+
return new CdmaSmsCbProgramResults(in);
137+
}
138+
139+
@Override
140+
public CdmaSmsCbProgramResults[] newArray(int size) {
141+
return new CdmaSmsCbProgramResults[size];
142+
}
143+
};
144+
}

0 commit comments

Comments
 (0)