Skip to content

Commit 4d53cb0

Browse files
Jake HambyAndroid (Google) Code Review
authored andcommitted
Merge "Enable support for SMS national language shift tables." into gingerbread
2 parents 1a5b609 + b49a73d commit 4d53cb0

File tree

14 files changed

+1675
-462
lines changed

14 files changed

+1675
-462
lines changed

core/res/res/values/config.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,46 @@
404404
option to enable/disable read reports is removed in the Messaging app. -->
405405
<bool name="config_mms_read_reports_support">true</bool>
406406

407+
<!-- National Language Identifier codes for the following two config items.
408+
(from 3GPP TS 23.038 V9.1.1 Table 6.2.1.2.4.1):
409+
0 - reserved
410+
1 - Turkish
411+
2 - Spanish (single shift table only)
412+
3 - Portuguese
413+
4 - Bengali
414+
5 - Gujarati
415+
6 - Hindi
416+
7 - Kannada
417+
8 - Malayalam
418+
9 - Oriya
419+
10 - Punjabi
420+
11 - Tamil
421+
12 - Telugu
422+
13 - Urdu
423+
14+ - reserved -->
424+
425+
<!-- National language single shift tables to enable for SMS encoding.
426+
Decoding is always enabled. 3GPP TS 23.038 states that this feature
427+
should not be enabled until a formal request is issued by the relevant
428+
national regulatory body. Array elements are codes from the table above.
429+
Example 1: devices sold in Turkey must include table 1 to conform with
430+
By-Law Number 27230. (http://www.btk.gov.tr/eng/pdf/2009/BY-LAW_SMS.pdf)
431+
Example 2: devices sold in India should include tables 4 through 13
432+
to enable use of the new Release 9 tables for Indic languages. -->
433+
<integer-array name="config_sms_enabled_single_shift_tables"></integer-array>
434+
435+
<!-- National language locking shift tables to enable for SMS encoding.
436+
Decoding is always enabled. 3GPP TS 23.038 states that this feature
437+
should not be enabled until a formal request is issued by the relevant
438+
national regulatory body. Array elements are codes from the table above.
439+
Example 1: devices sold in Turkey must include table 1 after the
440+
Turkish Telecommunication Authority requires locking shift encoding
441+
to be enabled (est. July 2012). (http://www.btk.gov.tr/eng/pdf/2009/BY-LAW_SMS.pdf)
442+
See also: http://www.mobitech.com.tr/tr/ersanozturkblog_en/index.php?entry=entry090223-160014
443+
Example 2: devices sold in India should include tables 4 through 13
444+
to enable use of the new Release 9 tables for Indic languages. -->
445+
<integer-array name="config_sms_enabled_locking_shift_tables"></integer-array>
446+
407447
<!-- Set and Unsets WiMAX -->
408448
<bool name="config_wimaxEnabled">false</bool>
409449
<!-- Location of the wimax framwork jar location -->

services/java/com/android/server/location/GpsLocationProvider.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,25 @@
4747
import android.os.WorkSource;
4848
import android.provider.Settings;
4949
import android.provider.Telephony.Sms.Intents;
50+
import android.telephony.SmsMessage;
5051
import android.telephony.TelephonyManager;
5152
import android.telephony.gsm.GsmCellLocation;
52-
import android.telephony.SmsMessage;
5353
import android.util.Log;
5454
import android.util.SparseIntArray;
5555

5656
import com.android.internal.app.IBatteryStats;
57-
import com.android.internal.telephony.Phone;
5857
import com.android.internal.location.GpsNetInitiatedHandler;
5958
import com.android.internal.location.GpsNetInitiatedHandler.GpsNiNotification;
60-
import com.android.internal.telephony.GsmAlphabet;
61-
import com.android.internal.telephony.SmsHeader;
62-
import com.android.internal.util.HexDump;
59+
import com.android.internal.telephony.Phone;
6360

6461
import java.io.File;
6562
import java.io.FileInputStream;
6663
import java.io.IOException;
6764
import java.io.StringBufferInputStream;
68-
import java.net.InetAddress;
69-
import java.net.UnknownHostException;
7065
import java.util.ArrayList;
7166
import java.util.Date;
72-
import java.util.Properties;
7367
import java.util.Map.Entry;
68+
import java.util.Properties;
7469
import java.util.concurrent.CountDownLatch;
7570

7671
/**

telephony/java/android/telephony/SmsMessage.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ public static ArrayList<String> fragmentText(String text) {
314314
nextPos = pos + Math.min(limit, textLen - pos);
315315
} else {
316316
// For multi-segment messages, CDMA 7bit equals GSM 7bit encoding (EMS mode).
317-
nextPos = GsmAlphabet.findGsmSeptetLimitIndex(text, pos, limit);
317+
nextPos = GsmAlphabet.findGsmSeptetLimitIndex(text, pos, limit,
318+
ted.languageTable, ted.languageShiftTable);
318319
}
319320
} else { // Assume unicode.
320321
nextPos = pos + Math.min(limit / 2, textLen - pos);
@@ -370,7 +371,8 @@ public static int[] calculateLength(String messageBody, boolean use7bitOnly) {
370371
*/
371372

372373
/**
373-
* Get an SMS-SUBMIT PDU for a destination address and a message
374+
* Get an SMS-SUBMIT PDU for a destination address and a message.
375+
* This method will not attempt to use any GSM national language 7 bit encodings.
374376
*
375377
* @param scAddress Service Centre address. Null means use default.
376378
* @return a <code>SubmitPdu</code> containing the encoded SC
@@ -397,7 +399,8 @@ public static SubmitPdu getSubmitPdu(String scAddress,
397399
}
398400

399401
/**
400-
* Get an SMS-SUBMIT PDU for a destination address and a message
402+
* Get an SMS-SUBMIT PDU for a destination address and a message.
403+
* This method will not attempt to use any GSM national language 7 bit encodings.
401404
*
402405
* @param scAddress Service Centre address. Null means use default.
403406
* @return a <code>SubmitPdu</code> containing the encoded SC
@@ -421,7 +424,8 @@ public static SubmitPdu getSubmitPdu(String scAddress,
421424
}
422425

423426
/**
424-
* Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
427+
* Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port.
428+
* This method will not attempt to use any GSM national language 7 bit encodings.
425429
*
426430
* @param scAddress Service Centre address. null == use default
427431
* @param destinationAddress the address of the destination for the message

telephony/java/android/telephony/gsm/SmsMessage.java

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -297,37 +297,14 @@ public static int getTPLayerLengthForPDU(String pdu) {
297297
*/
298298
@Deprecated
299299
public static int[] calculateLength(CharSequence messageBody, boolean use7bitOnly) {
300+
SmsMessageBase.TextEncodingDetails ted =
301+
com.android.internal.telephony.gsm.SmsMessage
302+
.calculateLength(messageBody, use7bitOnly);
300303
int ret[] = new int[4];
301-
302-
try {
303-
// Try GSM alphabet
304-
int septets = GsmAlphabet.countGsmSeptets(messageBody, !use7bitOnly);
305-
ret[1] = septets;
306-
if (septets > MAX_USER_DATA_SEPTETS) {
307-
ret[0] = (septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) /
308-
MAX_USER_DATA_SEPTETS_WITH_HEADER;
309-
ret[2] = (ret[0] * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
310-
} else {
311-
ret[0] = 1;
312-
ret[2] = MAX_USER_DATA_SEPTETS - septets;
313-
}
314-
ret[3] = ENCODING_7BIT;
315-
} catch (EncodeException ex) {
316-
// fall back to UCS-2
317-
int octets = messageBody.length() * 2;
318-
ret[1] = messageBody.length();
319-
if (octets > MAX_USER_DATA_BYTES) {
320-
// 6 is the size of the user data header
321-
ret[0] = (octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) /
322-
MAX_USER_DATA_BYTES_WITH_HEADER;
323-
ret[2] = ((ret[0] * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
324-
} else {
325-
ret[0] = 1;
326-
ret[2] = (MAX_USER_DATA_BYTES - octets)/2;
327-
}
328-
ret[3] = ENCODING_16BIT;
329-
}
330-
304+
ret[0] = ted.msgCount;
305+
ret[1] = ted.codeUnitCount;
306+
ret[2] = ted.codeUnitsRemaining;
307+
ret[3] = ted.codeUnitSize;
331308
return ret;
332309
}
333310

0 commit comments

Comments
 (0)