Skip to content

Instantly share code, notes, and snippets.

@xc-racer99
Created October 5, 2015 19:48
Show Gist options
  • Save xc-racer99/1caa2a1f756fa5aed98e to your computer and use it in GitHub Desktop.
Save xc-racer99/1caa2a1f756fa5aed98e to your computer and use it in GitHub Desktop.
[2/2] Samsung CDMA SMS patch for Fascinatemtd
From 88a58fd41b73748cdc9519c1ce31588fd4048380 Mon Sep 17 00:00:00 2001
From: jt1134 <[email protected]>
Date: Thu, 22 Nov 2012 23:57:38 -0600
Subject: [PATCH] fix for Samsung CDMA incoming SMS bug
ported from CM7/9/10/11
Change-Id: I6189dd0c6aeffb0b8b530bab7994a07bb390c32c
---
.../internal/telephony/cdma/sms/BearerData.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/java/com/android/internal/telephony/cdma/sms/BearerData.java b/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
index 05800b5..0c59255 100644
--- a/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/src/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -982,10 +982,21 @@ public final class BearerData {
paramBits -= EXPECTED_PARAM_SIZE;
decodeSuccess = true;
bData.messageType = inStream.read(4);
- bData.messageId = inStream.read(8) << 8;
- bData.messageId |= inStream.read(8);
- bData.hasUserDataHeader = (inStream.read(1) == 1);
- inStream.skip(3);
+ // Some Samsung CDMAphones parses messageId differently than other devices
+ // fix it here so that incoming sms works correctly
+ boolean hasSamsungCDMAAlternateMessageIDEncoding = Resources.getSystem()
+ .getBoolean(com.android.internal.R.bool.config_smsSamsungCdmaAlternateMessageIDEncoding);
+ if (hasSamsungCDMAAlternateMessageIDEncoding) {
+ inStream.skip(4);
+ bData.messageId = inStream.read(8) << 8;
+ bData.messageId |= inStream.read(8);
+ bData.hasUserDataHeader = (inStream.read(8) == 1);
+ } else {
+ bData.messageId = inStream.read(8) << 8;
+ bData.messageId |= inStream.read(8);
+ bData.hasUserDataHeader = (inStream.read(1) == 1);
+ inStream.skip(3);
+ }
}
if ((! decodeSuccess) || (paramBits > 0)) {
Rlog.d(LOG_TAG, "MESSAGE_IDENTIFIER decode " +
--
2.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment