diff options
| author | 2020-01-16 03:15:45 +0000 | |
|---|---|---|
| committer | 2020-01-16 03:15:45 +0000 | |
| commit | 58cebe2cd72daa3481f9b31dc00f45c85983f35e (patch) | |
| tree | 4b8b1c133836473f983decc9aff45067650a3a7f | |
| parent | d19804ce39972274aca04232e7e1976ef6b997e0 (diff) | |
| parent | 178b21996317678c8ff5073419f5479143ad7f8c (diff) | |
Merge "Create a new API to decode Sms PDU" am: 7a837f162f am: 178b219963
Change-Id: I2ea418a6542d2f4cfdac235a1d9c2476c5b297f3
| -rwxr-xr-x | api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SmsMessage.java | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 4afb29b45a55..33946ea196e7 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -9135,6 +9135,7 @@ package android.telephony { } public class SmsMessage { + method @Nullable public static android.telephony.SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[], boolean); method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static byte[] getSubmitPduEncodedMessage(boolean, @NonNull String, @NonNull String, int, int, int, int, int, int); } diff --git a/telephony/java/android/telephony/SmsMessage.java b/telephony/java/android/telephony/SmsMessage.java index b708b3ffbdd4..30a61c31ab81 100644 --- a/telephony/java/android/telephony/SmsMessage.java +++ b/telephony/java/android/telephony/SmsMessage.java @@ -332,6 +332,34 @@ public class SmsMessage { } /** + * Create an SmsMessage from a native SMS-Submit PDU, specified by Bluetooth Message Access + * Profile Specification v1.4.2 5.8. + * This is used by Bluetooth MAP profile to decode message when sending non UTF-8 SMS messages. + * + * @param data Message data. + * @param isCdma Indicates weather the type of the SMS is CDMA. + * @return An SmsMessage representing the message. + * + * @hide + */ + @SystemApi + @Nullable + public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) { + SmsMessageBase wrappedMessage; + + if (isCdma) { + wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord( + 0, data); + } else { + // Bluetooth uses its own method to decode GSM PDU so this part is not called. + wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromEfRecord( + 0, data); + } + + return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null; + } + + /** * Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the * length in bytes (not hex chars) less the SMSC header * |