Loading core/java/android/provider/Telephony.java 100644 → 100755 +2 −2 Original line number Original line Diff line number Diff line Loading @@ -114,8 +114,8 @@ public final class Telephony { public static final int STATUS_NONE = -1; public static final int STATUS_NONE = -1; public static final int STATUS_COMPLETE = 0; public static final int STATUS_COMPLETE = 0; public static final int STATUS_PENDING = 64; public static final int STATUS_PENDING = 32; public static final int STATUS_FAILED = 128; public static final int STATUS_FAILED = 64; /** /** * The subject of the message, if present * The subject of the message, if present Loading telephony/java/com/android/internal/telephony/SMSDispatcher.java 100644 → 100755 +22 −2 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,7 @@ import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE; public abstract class SMSDispatcher extends Handler { public abstract class SMSDispatcher extends Handler { private static final String TAG = "SMS"; private static final String TAG = "SMS"; private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg"; /** Default checking period for SMS sent without user permit */ /** Default checking period for SMS sent without user permit */ private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000; private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000; Loading Loading @@ -153,6 +154,8 @@ public abstract class SMSDispatcher extends Handler { protected boolean mStorageAvailable = true; protected boolean mStorageAvailable = true; protected boolean mReportMemoryStatusPending = false; protected boolean mReportMemoryStatusPending = false; protected static int mRemainingMessages = -1; protected static int getNextConcatenatedRef() { protected static int getNextConcatenatedRef() { sConcatenatedRef += 1; sConcatenatedRef += 1; return sConcatenatedRef; return sConcatenatedRef; Loading Loading @@ -463,7 +466,17 @@ public abstract class SMSDispatcher extends Handler { if (sentIntent != null) { if (sentIntent != null) { try { try { if (mRemainingMessages > -1) { mRemainingMessages--; } if (mRemainingMessages == 0) { Intent sendNext = new Intent(); sendNext.putExtra(SEND_NEXT_MSG_EXTRA, true); sentIntent.send(mContext, Activity.RESULT_OK, sendNext); } else { sentIntent.send(Activity.RESULT_OK); sentIntent.send(Activity.RESULT_OK); } } catch (CanceledException ex) {} } catch (CanceledException ex) {} } } } else { } else { Loading Loading @@ -502,8 +515,15 @@ public abstract class SMSDispatcher extends Handler { if (ar.result != null) { if (ar.result != null) { fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode); fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode); } } tracker.mSentIntent.send(mContext, error, fillIn); if (mRemainingMessages > -1) { mRemainingMessages--; } if (mRemainingMessages == 0) { fillIn.putExtra(SEND_NEXT_MSG_EXTRA, true); } tracker.mSentIntent.send(mContext, error, fillIn); } catch (CanceledException ex) {} } catch (CanceledException ex) {} } } } } Loading telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java 100644 → 100755 +10 −1 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.PendingIntent.CanceledException; import android.content.Intent; import android.content.Intent; import android.os.AsyncResult; import android.os.AsyncResult; import android.os.Message; import android.os.Message; import android.provider.Telephony.Sms; import android.provider.Telephony.Sms.Intents; import android.provider.Telephony.Sms.Intents; import android.telephony.ServiceState; import android.telephony.ServiceState; import android.util.Config; import android.util.Config; Loading Loading @@ -60,13 +61,17 @@ final class GsmSMSDispatcher extends SMSDispatcher { String pduString = (String) ar.result; String pduString = (String) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pduString); SmsMessage sms = SmsMessage.newFromCDS(pduString); int tpStatus = sms.getStatus(); if (sms != null) { if (sms != null) { int messageRef = sms.messageRef; int messageRef = sms.messageRef; for (int i = 0, count = deliveryPendingList.size(); i < count; i++) { for (int i = 0, count = deliveryPendingList.size(); i < count; i++) { SmsTracker tracker = deliveryPendingList.get(i); SmsTracker tracker = deliveryPendingList.get(i); if (tracker.mMessageRef == messageRef) { if (tracker.mMessageRef == messageRef) { // Found it. Remove from list and broadcast. // Found it. Remove from list and broadcast. if(tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING ) { deliveryPendingList.remove(i); deliveryPendingList.remove(i); } PendingIntent intent = tracker.mDeliveryIntent; PendingIntent intent = tracker.mDeliveryIntent; Intent fillIn = new Intent(); Intent fillIn = new Intent(); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); Loading Loading @@ -175,6 +180,8 @@ final class GsmSMSDispatcher extends SMSDispatcher { int msgCount = parts.size(); int msgCount = parts.size(); int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; mRemainingMessages = msgCount; for (int i = 0; i < msgCount; i++) { for (int i = 0; i < msgCount; i++) { TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); if (encoding != details.codeUnitSize if (encoding != details.codeUnitSize Loading Loading @@ -264,6 +271,8 @@ final class GsmSMSDispatcher extends SMSDispatcher { int msgCount = parts.size(); int msgCount = parts.size(); int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; mRemainingMessages = msgCount; for (int i = 0; i < msgCount; i++) { for (int i = 0; i < msgCount; i++) { TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); if (encoding != details.codeUnitSize if (encoding != details.codeUnitSize Loading telephony/java/com/android/internal/telephony/gsm/SIMRecords.java 100644 → 100755 +41 −0 Original line number Original line Diff line number Diff line Loading @@ -144,6 +144,25 @@ public final class SIMRecords extends IccRecords { private static final int EVENT_GET_CFIS_DONE = 32; private static final int EVENT_GET_CFIS_DONE = 32; private static final int EVENT_GET_CSP_CPHS_DONE = 33; private static final int EVENT_GET_CSP_CPHS_DONE = 33; // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length. private static final String[] MCCMNC_CODES_HAVING_3DIGITS_MNC = { "405025", "405026", "405027", "405028", "405029", "405030", "405031", "405032", "405033", "405034", "405035", "405036", "405037", "405038", "405039", "405040", "405041", "405042", "405043", "405044", "405045", "405046", "405047", "405750", "405751", "405752", "405753", "405754", "405755", "405756", "405799", "405800", "405801", "405802", "405803", "405804", "405805", "405806", "405807", "405808", "405809", "405810", "405811", "405812", "405813", "405814", "405815", "405816", "405817", "405818", "405819", "405820", "405821", "405822", "405823", "405824", "405825", "405826", "405827", "405828", "405829", "405830", "405831", "405832", "405833", "405834", "405835", "405836", "405837", "405838", "405839", "405840", "405841", "405842", "405843", "405844", "405845", "405846", "405847", "405848", "405849", "405850", "405851", "405852", "405853", "405875", "405876", "405877", "405878", "405879", "405880", "405881", "405882", "405883", "405884", "405885", "405886", "405908", "405909", "405910", "405911", "405925", "405926", "405927", "405928", "405929", "405932" }; // ***** Constructor // ***** Constructor SIMRecords(GSMPhone p) { SIMRecords(GSMPhone p) { Loading Loading @@ -501,6 +520,17 @@ public final class SIMRecords extends IccRecords { Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx"); Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx"); if (((mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) { String mccmncCode = imsi.substring(0, 6); for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { if (mccmnc.equals(mccmncCode)) { mncLength = 3; break; } } } if (mncLength == UNKNOWN) { if (mncLength == UNKNOWN) { // the SIM has told us all it knows, but it didn't know the mnc length. // the SIM has told us all it knows, but it didn't know the mnc length. // guess using the mcc // guess using the mcc Loading Loading @@ -752,6 +782,17 @@ public final class SIMRecords extends IccRecords { mncLength = UNKNOWN; mncLength = UNKNOWN; } } } finally { } finally { if (((mncLength == UNINITIALIZED) || (mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) { String mccmncCode = imsi.substring(0, 6); for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { if (mccmnc.equals(mccmncCode)) { mncLength = 3; break; } } } if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) { if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) { if (imsi != null) { if (imsi != null) { try { try { Loading Loading
core/java/android/provider/Telephony.java 100644 → 100755 +2 −2 Original line number Original line Diff line number Diff line Loading @@ -114,8 +114,8 @@ public final class Telephony { public static final int STATUS_NONE = -1; public static final int STATUS_NONE = -1; public static final int STATUS_COMPLETE = 0; public static final int STATUS_COMPLETE = 0; public static final int STATUS_PENDING = 64; public static final int STATUS_PENDING = 32; public static final int STATUS_FAILED = 128; public static final int STATUS_FAILED = 64; /** /** * The subject of the message, if present * The subject of the message, if present Loading
telephony/java/com/android/internal/telephony/SMSDispatcher.java 100644 → 100755 +22 −2 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,7 @@ import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE; public abstract class SMSDispatcher extends Handler { public abstract class SMSDispatcher extends Handler { private static final String TAG = "SMS"; private static final String TAG = "SMS"; private static final String SEND_NEXT_MSG_EXTRA = "SendNextMsg"; /** Default checking period for SMS sent without user permit */ /** Default checking period for SMS sent without user permit */ private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000; private static final int DEFAULT_SMS_CHECK_PERIOD = 3600000; Loading Loading @@ -153,6 +154,8 @@ public abstract class SMSDispatcher extends Handler { protected boolean mStorageAvailable = true; protected boolean mStorageAvailable = true; protected boolean mReportMemoryStatusPending = false; protected boolean mReportMemoryStatusPending = false; protected static int mRemainingMessages = -1; protected static int getNextConcatenatedRef() { protected static int getNextConcatenatedRef() { sConcatenatedRef += 1; sConcatenatedRef += 1; return sConcatenatedRef; return sConcatenatedRef; Loading Loading @@ -463,7 +466,17 @@ public abstract class SMSDispatcher extends Handler { if (sentIntent != null) { if (sentIntent != null) { try { try { if (mRemainingMessages > -1) { mRemainingMessages--; } if (mRemainingMessages == 0) { Intent sendNext = new Intent(); sendNext.putExtra(SEND_NEXT_MSG_EXTRA, true); sentIntent.send(mContext, Activity.RESULT_OK, sendNext); } else { sentIntent.send(Activity.RESULT_OK); sentIntent.send(Activity.RESULT_OK); } } catch (CanceledException ex) {} } catch (CanceledException ex) {} } } } else { } else { Loading Loading @@ -502,8 +515,15 @@ public abstract class SMSDispatcher extends Handler { if (ar.result != null) { if (ar.result != null) { fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode); fillIn.putExtra("errorCode", ((SmsResponse)ar.result).errorCode); } } tracker.mSentIntent.send(mContext, error, fillIn); if (mRemainingMessages > -1) { mRemainingMessages--; } if (mRemainingMessages == 0) { fillIn.putExtra(SEND_NEXT_MSG_EXTRA, true); } tracker.mSentIntent.send(mContext, error, fillIn); } catch (CanceledException ex) {} } catch (CanceledException ex) {} } } } } Loading
telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java 100644 → 100755 +10 −1 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.PendingIntent.CanceledException; import android.content.Intent; import android.content.Intent; import android.os.AsyncResult; import android.os.AsyncResult; import android.os.Message; import android.os.Message; import android.provider.Telephony.Sms; import android.provider.Telephony.Sms.Intents; import android.provider.Telephony.Sms.Intents; import android.telephony.ServiceState; import android.telephony.ServiceState; import android.util.Config; import android.util.Config; Loading Loading @@ -60,13 +61,17 @@ final class GsmSMSDispatcher extends SMSDispatcher { String pduString = (String) ar.result; String pduString = (String) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pduString); SmsMessage sms = SmsMessage.newFromCDS(pduString); int tpStatus = sms.getStatus(); if (sms != null) { if (sms != null) { int messageRef = sms.messageRef; int messageRef = sms.messageRef; for (int i = 0, count = deliveryPendingList.size(); i < count; i++) { for (int i = 0, count = deliveryPendingList.size(); i < count; i++) { SmsTracker tracker = deliveryPendingList.get(i); SmsTracker tracker = deliveryPendingList.get(i); if (tracker.mMessageRef == messageRef) { if (tracker.mMessageRef == messageRef) { // Found it. Remove from list and broadcast. // Found it. Remove from list and broadcast. if(tpStatus >= Sms.STATUS_FAILED || tpStatus < Sms.STATUS_PENDING ) { deliveryPendingList.remove(i); deliveryPendingList.remove(i); } PendingIntent intent = tracker.mDeliveryIntent; PendingIntent intent = tracker.mDeliveryIntent; Intent fillIn = new Intent(); Intent fillIn = new Intent(); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); Loading Loading @@ -175,6 +180,8 @@ final class GsmSMSDispatcher extends SMSDispatcher { int msgCount = parts.size(); int msgCount = parts.size(); int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; mRemainingMessages = msgCount; for (int i = 0; i < msgCount; i++) { for (int i = 0; i < msgCount; i++) { TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); if (encoding != details.codeUnitSize if (encoding != details.codeUnitSize Loading Loading @@ -264,6 +271,8 @@ final class GsmSMSDispatcher extends SMSDispatcher { int msgCount = parts.size(); int msgCount = parts.size(); int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; int encoding = android.telephony.SmsMessage.ENCODING_UNKNOWN; mRemainingMessages = msgCount; for (int i = 0; i < msgCount; i++) { for (int i = 0; i < msgCount; i++) { TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); TextEncodingDetails details = SmsMessage.calculateLength(parts.get(i), false); if (encoding != details.codeUnitSize if (encoding != details.codeUnitSize Loading
telephony/java/com/android/internal/telephony/gsm/SIMRecords.java 100644 → 100755 +41 −0 Original line number Original line Diff line number Diff line Loading @@ -144,6 +144,25 @@ public final class SIMRecords extends IccRecords { private static final int EVENT_GET_CFIS_DONE = 32; private static final int EVENT_GET_CFIS_DONE = 32; private static final int EVENT_GET_CSP_CPHS_DONE = 33; private static final int EVENT_GET_CSP_CPHS_DONE = 33; // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length. private static final String[] MCCMNC_CODES_HAVING_3DIGITS_MNC = { "405025", "405026", "405027", "405028", "405029", "405030", "405031", "405032", "405033", "405034", "405035", "405036", "405037", "405038", "405039", "405040", "405041", "405042", "405043", "405044", "405045", "405046", "405047", "405750", "405751", "405752", "405753", "405754", "405755", "405756", "405799", "405800", "405801", "405802", "405803", "405804", "405805", "405806", "405807", "405808", "405809", "405810", "405811", "405812", "405813", "405814", "405815", "405816", "405817", "405818", "405819", "405820", "405821", "405822", "405823", "405824", "405825", "405826", "405827", "405828", "405829", "405830", "405831", "405832", "405833", "405834", "405835", "405836", "405837", "405838", "405839", "405840", "405841", "405842", "405843", "405844", "405845", "405846", "405847", "405848", "405849", "405850", "405851", "405852", "405853", "405875", "405876", "405877", "405878", "405879", "405880", "405881", "405882", "405883", "405884", "405885", "405886", "405908", "405909", "405910", "405911", "405925", "405926", "405927", "405928", "405929", "405932" }; // ***** Constructor // ***** Constructor SIMRecords(GSMPhone p) { SIMRecords(GSMPhone p) { Loading Loading @@ -501,6 +520,17 @@ public final class SIMRecords extends IccRecords { Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx"); Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx"); if (((mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) { String mccmncCode = imsi.substring(0, 6); for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { if (mccmnc.equals(mccmncCode)) { mncLength = 3; break; } } } if (mncLength == UNKNOWN) { if (mncLength == UNKNOWN) { // the SIM has told us all it knows, but it didn't know the mnc length. // the SIM has told us all it knows, but it didn't know the mnc length. // guess using the mcc // guess using the mcc Loading Loading @@ -752,6 +782,17 @@ public final class SIMRecords extends IccRecords { mncLength = UNKNOWN; mncLength = UNKNOWN; } } } finally { } finally { if (((mncLength == UNINITIALIZED) || (mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) { String mccmncCode = imsi.substring(0, 6); for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { if (mccmnc.equals(mccmncCode)) { mncLength = 3; break; } } } if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) { if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) { if (imsi != null) { if (imsi != null) { try { try { Loading