summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorJake Hamby <jhamby@google.com>2012-12-06 19:00:38 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-12-06 19:00:38 -0800
commit5fe4be69141ab67b32f99d86cad9817653764417 (patch)
tree79c7022c2fda154d14f9e830f7b107538272f7a1 /telephony/java
parentb38ecce234b0ab32a33f8f65d4f7b1b6f13006cd (diff)
parent6fb126b5bbcf51f50064477f5070fe845cfd5454 (diff)
downloadframeworks_base-5fe4be69141ab67b32f99d86cad9817653764417.zip
frameworks_base-5fe4be69141ab67b32f99d86cad9817653764417.tar.gz
frameworks_base-5fe4be69141ab67b32f99d86cad9817653764417.tar.bz2
am 6fb126b5: am 91bb0771: Merge "Enable Turkish language encoding for Turkish SIM cards." into jb-mr1.1-dev
* commit '6fb126b5bbcf51f50064477f5070fe845cfd5454': Enable Turkish language encoding for Turkish SIM cards.
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/com/android/internal/telephony/GsmAlphabet.java39
1 files changed, 28 insertions, 11 deletions
diff --git a/telephony/java/com/android/internal/telephony/GsmAlphabet.java b/telephony/java/com/android/internal/telephony/GsmAlphabet.java
index 04b1220..ba14ea7 100644
--- a/telephony/java/com/android/internal/telephony/GsmAlphabet.java
+++ b/telephony/java/com/android/internal/telephony/GsmAlphabet.java
@@ -803,6 +803,10 @@ public class GsmAlphabet {
*/
public static TextEncodingDetails
countGsmSeptets(CharSequence s, boolean use7bitOnly) {
+ // Load enabled language tables from config.xml, including any MCC overlays
+ if (!sDisableCountryEncodingCheck) {
+ enableCountrySpecificEncodings();
+ }
// fast path for common case where no national language shift tables are enabled
if (sEnabledSingleShiftTables.length + sEnabledLockingShiftTables.length == 0) {
TextEncodingDetails ted = new TextEncodingDetails();
@@ -989,6 +993,7 @@ public class GsmAlphabet {
*/
static synchronized void setEnabledSingleShiftTables(int[] tables) {
sEnabledSingleShiftTables = tables;
+ sDisableCountryEncodingCheck = true;
if (tables.length > 0) {
sHighestEnabledSingleShiftCode = tables[tables.length - 1];
@@ -1006,6 +1011,7 @@ public class GsmAlphabet {
*/
static synchronized void setEnabledLockingShiftTables(int[] tables) {
sEnabledLockingShiftTables = tables;
+ sDisableCountryEncodingCheck = true;
}
/**
@@ -1030,6 +1036,24 @@ public class GsmAlphabet {
return sEnabledLockingShiftTables;
}
+ /**
+ * Enable country-specific language tables from MCC-specific overlays.
+ * @context the context to use to get the TelephonyManager
+ */
+ private static void enableCountrySpecificEncodings() {
+ Resources r = Resources.getSystem();
+ // See comments in frameworks/base/core/res/res/values/config.xml for allowed values
+ sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables);
+ sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables);
+
+ if (sEnabledSingleShiftTables.length > 0) {
+ sHighestEnabledSingleShiftCode =
+ sEnabledSingleShiftTables[sEnabledSingleShiftTables.length-1];
+ } else {
+ sHighestEnabledSingleShiftCode = 0;
+ }
+ }
+
/** Reverse mapping from Unicode characters to indexes into language tables. */
private static final SparseIntArray[] sCharsToGsmTables;
@@ -1045,6 +1069,9 @@ public class GsmAlphabet {
/** Highest language code to include in array of single shift counters. */
private static int sHighestEnabledSingleShiftCode;
+ /** Flag to bypass check for country-specific overlays (for test cases only). */
+ private static boolean sDisableCountryEncodingCheck = false;
+
/**
* Septet counter for a specific locking shift table and all of
* the single shift tables that it can be paired with.
@@ -1408,10 +1435,7 @@ public class GsmAlphabet {
};
static {
- Resources r = Resources.getSystem();
- // See comments in frameworks/base/core/res/res/values/config.xml for allowed values
- sEnabledSingleShiftTables = r.getIntArray(R.array.config_sms_enabled_single_shift_tables);
- sEnabledLockingShiftTables = r.getIntArray(R.array.config_sms_enabled_locking_shift_tables);
+ enableCountrySpecificEncodings();
int numTables = sLanguageTables.length;
int numShiftTables = sLanguageShiftTables.length;
if (numTables != numShiftTables) {
@@ -1419,13 +1443,6 @@ public class GsmAlphabet {
" != shift tables array length " + numShiftTables);
}
- if (sEnabledSingleShiftTables.length > 0) {
- sHighestEnabledSingleShiftCode =
- sEnabledSingleShiftTables[sEnabledSingleShiftTables.length-1];
- } else {
- sHighestEnabledSingleShiftCode = 0;
- }
-
sCharsToGsmTables = new SparseIntArray[numTables];
for (int i = 0; i < numTables; i++) {
String table = sLanguageTables[i];