2929import com .android .internal .telephony .TelephonyProperties ;
3030import com .android .internal .telephony .cdma .sms .BearerData ;
3131import com .android .internal .telephony .cdma .sms .CdmaSmsAddress ;
32+ import com .android .internal .telephony .cdma .sms .CdmaSmsSubaddress ;
3233import com .android .internal .telephony .cdma .sms .SmsEnvelope ;
3334import com .android .internal .telephony .cdma .sms .UserData ;
3435import com .android .internal .util .HexDump ;
@@ -138,6 +139,7 @@ public static SmsMessage newFromParcel(Parcel p) {
138139 SmsMessage msg = new SmsMessage ();
139140 SmsEnvelope env = new SmsEnvelope ();
140141 CdmaSmsAddress addr = new CdmaSmsAddress ();
142+ CdmaSmsSubaddress subaddr = new CdmaSmsSubaddress ();
141143 byte [] data ;
142144 byte count ;
143145 int countInt ;
@@ -180,15 +182,24 @@ public static SmsMessage newFromParcel(Parcel p) {
180182
181183 addr .origBytes = data ;
182184
183- // ignore subaddress
184- p .readInt (); //p_cur->sSubAddress.subaddressType
185- p .readInt (); //p_cur->sSubAddress.odd
186- count = p .readByte (); //p_cur->sSubAddress.number_of_digits
187- //p_cur->sSubAddress.digits[digitCount] :
188- for (int index =0 ; index < count ; index ++) {
189- p .readByte ();
185+ subaddr .type = p .readInt (); // p_cur->sSubAddress.subaddressType
186+ subaddr .odd = p .readByte (); // p_cur->sSubAddress.odd
187+ count = p .readByte (); // p_cur->sSubAddress.number_of_digits
188+
189+ if (count < 0 ) {
190+ count = 0 ;
190191 }
191192
193+ // p_cur->sSubAddress.digits[digitCount] :
194+
195+ data = new byte [count ];
196+
197+ for (int index = 0 ; index < count ; ++index ) {
198+ data [index ] = p .readByte ();
199+ }
200+
201+ subaddr .origBytes = data ;
202+
192203 /* currently not supported by the modem-lib:
193204 env.bearerReply
194205 env.replySeqNo
@@ -210,6 +221,7 @@ public static SmsMessage newFromParcel(Parcel p) {
210221
211222 // link the the filled objects to the SMS
212223 env .origAddress = addr ;
224+ env .origSubaddress = subaddr ;
213225 msg .originatingAddress = addr ;
214226 msg .mEnvelope = env ;
215227
@@ -818,6 +830,8 @@ private byte convertDtmfToAscii(byte dtmfDigit) {
818830 output .write (mEnvelope .teleService );
819831 output .write (mEnvelope .origAddress .origBytes , 0 , mEnvelope .origAddress .origBytes .length );
820832 output .write (mEnvelope .bearerData , 0 , mEnvelope .bearerData .length );
833+ output .write (mEnvelope .origSubaddress .origBytes , 0 ,
834+ mEnvelope .origSubaddress .origBytes .length );
821835
822836 return output .toByteArray ();
823837 }
0 commit comments