summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2009-07-10 11:34:33 -0700
committerWink Saville <wink@google.com>2009-07-10 11:34:33 -0700
commit05b301b9df83ee7aa7ac2a93e137bc1fd58d3fce (patch)
tree991894970ce8cf7b060ad056e9956b0a281e0be8 /telephony
parent89fe27366bad06f1ed0b8fc05e7a4ee48fe24ebd (diff)
downloadframeworks_base-05b301b9df83ee7aa7ac2a93e137bc1fd58d3fce.zip
frameworks_base-05b301b9df83ee7aa7ac2a93e137bc1fd58d3fce.tar.gz
frameworks_base-05b301b9df83ee7aa7ac2a93e137bc1fd58d3fce.tar.bz2
Changes 203 and 225 from partner repo.
These are combined to save testing time. Change 225: make NV_READY return State.READY. Change 203: CDMA SMS decoding support for Latin and fix for WAP concatenation 1. Enabled support for 8bit Latin decoding. 2. Change octet decoding to remove an extra pad byte from the payload. This caused problems with the concatenation of WAP PUSH messages. 3. Decode octet encoded data as if it was Latin. There are devices out there that will use 0 instead of 8.
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/IccCard.java2
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java26
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/UserData.java2
3 files changed, 28 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index be4c72c..c2bed88 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -122,8 +122,8 @@ public abstract class IccCard {
return State.UNKNOWN;
case SIM_READY:
case RUIM_READY:
- return State.READY;
case NV_READY:
+ return State.READY;
case NV_NOT_READY:
return State.ABSENT;
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index ef3afff..2b32872 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -901,6 +901,16 @@ public final class BearerData {
return result;
}
+ private static String decodeLatin(byte[] data, int offset, int numFields)
+ throws CodingException
+ {
+ try {
+ return new String(data, offset, numFields - offset, "ISO-8859-1");
+ } catch (java.io.UnsupportedEncodingException ex) {
+ throw new CodingException("ISO-8859-1 decode failed: " + ex);
+ }
+ }
+
private static void decodeUserDataPayload(UserData userData, boolean hasUserDataHeader)
throws CodingException
{
@@ -914,6 +924,19 @@ public final class BearerData {
}
switch (userData.msgEncoding) {
case UserData.ENCODING_OCTET:
+ // Strip off any padding bytes, meaning any differences between the length of the
+ // array and the target length specified by numFields. This is to avoid any confusion
+ // by code elsewhere that only considers the payload array length.
+ byte[] payload = new byte[userData.numFields];
+ int copyLen = userData.numFields < userData.payload.length
+ ? userData.numFields : userData.payload.length;
+
+ System.arraycopy(userData.payload, 0, payload, 0, copyLen);
+ userData.payload = payload;
+
+ // There are many devices in the market that send 8bit text sms (latin encoded) as
+ // octet encoded.
+ userData.payloadStr = decodeLatin(userData.payload, offset, userData.numFields);
break;
case UserData.ENCODING_7BIT_ASCII:
userData.payloadStr = decode7bitAscii(userData.payload, offset, userData.numFields);
@@ -927,6 +950,9 @@ public final class BearerData {
case UserData.ENCODING_GSM_7BIT_ALPHABET:
userData.payloadStr = decode7bitGsm(userData.payload, offset, userData.numFields);
break;
+ case UserData.ENCODING_LATIN:
+ userData.payloadStr = decodeLatin(userData.payload, offset, userData.numFields);
+ break;
default:
throw new CodingException("unsupported user data encoding ("
+ userData.msgEncoding + ")");
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
index 34cbbfa..04796b8 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
@@ -35,7 +35,7 @@ public class UserData {
//public static final int ENCODING_SHIFT_JIS = 0x05;
//public static final int ENCODING_KOREAN = 0x06;
//public static final int ENCODING_LATIN_HEBREW = 0x07;
- //public static final int ENCODING_LATIN = 0x08;
+ public static final int ENCODING_LATIN = 0x08;
public static final int ENCODING_GSM_7BIT_ALPHABET = 0x09;
public static final int ENCODING_GSM_DCS = 0x0A;