diff options
| author | 2009-09-08 22:55:49 -0700 | |
|---|---|---|
| committer | 2009-09-08 22:55:49 -0700 | |
| commit | 997eddb0a0a069ea627e8b07d41d7ffdbc12c53d (patch) | |
| tree | 3814a28eb97da04b4e75842e9f2f7f1148f15f7c | |
| parent | 948ef29ebacde30bc2f1283b5e6d86f2413698c4 (diff) | |
| parent | 98a5ba78f99f6537b34b673521f7d4ab9893c80b (diff) | |
Merge change 24318 into eclair
* changes:
Avoid CDMA messages with IDs of zero.
| -rwxr-xr-x | telephony/java/com/android/internal/telephony/cdma/SmsMessage.java | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java index 2c20784b0f44..d17468ca1499 100755 --- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java @@ -598,21 +598,20 @@ public class SmsMessage extends SmsMessageBase { } /** - * Calculate the next message id, starting at 0 and iteratively - * incrementing within the range 0..65535 remembering the state + * Calculate the next message id, starting at 1 and iteratively + * incrementing within the range 1..65535 remembering the state * via a persistent system property. (See C.S0015-B, v2.0, - * 4.3.1.5) + * 4.3.1.5) Since this routine is expected to be accessed via via + * binder-call, and hence should be threadsafe, it has been + * synchronized. */ private synchronized static int getNextMessageId() { - // The only (meaningful) way this code can be called is via - // binder-call into the Phone process. All other calls will - // assumedly not be as with UID radio, and hence will be - // unable to modify the system property. Synchronization has - // thus been added to this function conservatively -- if it - // can be conclusively reasoned to be unnecessary, it should - // be removed. - int msgId = SystemProperties.getInt(TelephonyProperties.PROPERTY_CDMA_MSG_ID, 0); - String nextMsgId = Integer.toString((msgId + 1) & 0xFFFF); + // Testing and dialog with partners has indicated that + // msgId==0 is (sometimes?) treated specially by lower levels. + // Specifically, the ID is not preserved for delivery ACKs. + // Hence, avoid 0 -- constraining the range to 1..65535. + int msgId = SystemProperties.getInt(TelephonyProperties.PROPERTY_CDMA_MSG_ID, 1); + String nextMsgId = Integer.toString((msgId % 0xFFFF) + 1); SystemProperties.set(TelephonyProperties.PROPERTY_CDMA_MSG_ID, nextMsgId); if (DBG_SMS) { Log.d(LOG_TAG, "next " + TelephonyProperties.PROPERTY_CDMA_MSG_ID + " = " + nextMsgId); |