Change 107 and 146 from partner repo.
These were combined to save testing time.
cpr107:
Enhance the MDN change during OTA
1. Remove the OTA MDN change code in RuimRecords.java and move
to CdmaServiceStateTracker.java
2. Reduce the frequent function GET-CDMASubscription. Move the
Get_CDMASubscription from pollstate() to EVENT_NV_READY handler.
The CDMA Subscriber MDN/MIN is only changed by OTA programming.
Only need fecth the subscriber information when power on and OTA
completed.
3. Add new variable for PRL version in cdma subscription
cpr146:
SMS-to-Email fix for extracting e-mail address
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index bdcf3f7..8e76cd2 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -116,6 +116,7 @@
protected static final int EVENT_POLL_STATE_CDMA_SUBSCRIPTION = 34;
protected static final int EVENT_NV_READY = 35;
protected static final int EVENT_ERI_FILE_LOADED = 36;
+ protected static final int EVENT_OTA_PROVISION_STATUS_CHANGE = 37;
//***** Time Zones
protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone";
diff --git a/telephony/java/com/android/internal/telephony/SmsMessageBase.java b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
index 3c7dd45..9c78b98 100644
--- a/telephony/java/com/android/internal/telephony/SmsMessageBase.java
+++ b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
@@ -352,60 +352,36 @@
}
/**
- * Try to parse this message as an email gateway message -> Neither
- * of the standard ways are currently supported: There are two ways
- * specified in TS 23.040 Section 3.8 (not supported via this mechanism) -
- * SMS message "may have its TP-PID set for internet electronic mail - MT
+ * Try to parse this message as an email gateway message
+ * There are two ways specified in TS 23.040 Section 3.8 :
+ * - SMS message "may have its TP-PID set for internet electronic mail - MT
* SMS format: [<from-address><space>]<message> - "Depending on the
* nature of the gateway, the destination/origination address is either
* derived from the content of the SMS TP-OA or TP-DA field, or the
* TP-OA/TP-DA field contains a generic gateway address and the to/from
- * address is added at the beginning as shown above." - multiple addreses
- * separated by commas, no spaces - subject field delimited by '()' or '##'
- * and '#' Section 9.2.3.24.11
+ * address is added at the beginning as shown above." (which is supported here)
+ * - Multiple addreses separated by commas, no spaces, Subject field delimited
+ * by '()' or '##' and '#' Section 9.2.3.24.11 (which are NOT supported here)
*/
protected void extractEmailAddressFromMessageBody() {
- /*
- * a little guesswork here. I haven't found doc for this.
- * the format could be either
+ /* Some carriers may use " /" delimiter as below
*
* 1. [x@y][ ]/[subject][ ]/[body]
* -or-
* 2. [x@y][ ]/[body]
*/
- int slash = 0, slash2 = 0, atSymbol = 0;
-
- try {
- slash = messageBody.indexOf(" /");
- if (slash == -1) {
- return;
- }
-
- atSymbol = messageBody.indexOf('@');
- if (atSymbol == -1 || atSymbol > slash) {
- return;
- }
-
- emailFrom = messageBody.substring(0, slash);
-
- slash2 = messageBody.indexOf(" /", slash + 2);
-
- if (slash2 == -1) {
- pseudoSubject = null;
- emailBody = messageBody.substring(slash + 2);
- } else {
- pseudoSubject = messageBody.substring(slash + 2, slash2);
- emailBody = messageBody.substring(slash2 + 2);
- }
-
- isEmail = true;
- } catch (Exception ex) {
- Log.w(LOG_TAG,
- "extractEmailAddressFromMessageBody: exception slash="
- + slash + ", atSymbol=" + atSymbol + ", slash2="
- + slash2, ex);
- }
+ String[] parts = messageBody.split("( /)|( )", 3);
+ if (parts.length < 2 || parts[0].indexOf('@') == -1) return;
+ emailFrom = parts[0];
+ if (parts.length == 3) {
+ pseudoSubject = parts[1];
+ emailBody = parts[2];
+ } else {
+ pseudoSubject = null;
+ emailBody = parts[1];
+ }
+ isEmail = true;
}
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index 9152211..91f855d 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -191,24 +191,4 @@
public static final String ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS
= "android.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS";
- /**
- * Broadcast Action: The MDN changed during the CDMA OTA Process
- * The intent will have the following extra values:</p>
- * <ul>
- * <li><em>mdn</em> - An Integer of the updated MDN number.</li>
- * </ul>
- *
- * <p class="note">
- */
- // TODO(Moto): Generally broadcast intents are for use to allow entities which
- // may not know about each other to "communicate". This seems quite specific
- // and maybe using the registrant style would be better.
-
- // Moto: Since this is used for apps not in the same process of phone, can the
- // registrant style be used? (Ling Li says: Maybe the "app" can request rather
- // than save the MDN each time and this intent would not be necessary?)
- // Moto response: Moto internal discussion is on-going.
- public static final String ACTION_CDMA_OTA_MDN_CHANGED
- = "android.intent.action.ACTION_MDN_STATE_CHANGED";
-
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 3362de8..42fa586 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -392,7 +392,7 @@
}
public String getCdmaPrlVersion(){
- return mRuimRecords.getPrlVersion();
+ return mSST.getPrlVersion();
}
public String getCdmaMIN() {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index b45a9b2..d9912ca 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -127,6 +127,7 @@
private int mHomeSystemId;
private int mHomeNetworkId;
private String mMin;
+ private String mPrlVersion;
private boolean isEriTextLoaded = false;
private boolean isSubscriptionFromRuim = false;
@@ -178,6 +179,7 @@
cm.registerForNVReady(this, EVENT_NV_READY, null);
phone.registerForEriFileLoaded(this, EVENT_ERI_FILE_LOADED, null);
+ cm.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);
// system setting property AIRPLANE_MODE_ON is set in Settings.
int airplaneMode = Settings.System.getInt(
@@ -201,6 +203,7 @@
cm.unregisterForNetworkStateChanged(this);
cm.unregisterForRUIMReady(this);
cm.unregisterForNVReady(this);
+ cm.unregisterForCdmaOtaProvision(this);
phone.unregisterForEriFileLoaded(this);
phone.mRuimRecords.unregisterForRecordsLoaded(this);
cm.unSetOnSignalStrengthUpdate(this);
@@ -302,6 +305,10 @@
case EVENT_NV_READY:
isSubscriptionFromRuim = false;
+ // For Non-RUIM phones, the subscription information is stored in
+ // Non Volatile. Here when Non-Volatile is ready, we can poll the CDMA
+ // subscription info.
+ cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
pollState();
// Signal strength polling stops when radio is off
queueNextSignalStrengthPoll();
@@ -379,11 +386,29 @@
case EVENT_POLL_STATE_REGISTRATION_CDMA:
case EVENT_POLL_STATE_OPERATOR_CDMA:
- case EVENT_POLL_STATE_CDMA_SUBSCRIPTION:
ar = (AsyncResult) msg.obj;
handlePollStateResult(msg.what, ar);
break;
+ case EVENT_POLL_STATE_CDMA_SUBSCRIPTION: // Handle RIL_CDMA_SUBSCRIPTION
+ ar = (AsyncResult) msg.obj;
+
+ if (ar.exception == null) {
+ String cdmaSubscription[] = (String[])ar.result;
+ if (cdmaSubscription != null && cdmaSubscription.length >= 5) {
+ mMdn = cdmaSubscription[0];
+ mHomeSystemId = Integer.parseInt(cdmaSubscription[1], 16);
+ mHomeNetworkId = Integer.parseInt(cdmaSubscription[2], 16);
+ mMin = cdmaSubscription[3];
+ mPrlVersion = cdmaSubscription[4];
+ Log.d(LOG_TAG,"GET_CDMA_SUBSCRIPTION MDN=" + mMdn);
+ } else {
+ Log.w(LOG_TAG,"error parsing cdmaSubscription params num="
+ + cdmaSubscription.length);
+ }
+ }
+ break;
+
case EVENT_POLL_SIGNAL_STRENGTH:
// Just poll signal strength...not part of pollState()
@@ -430,6 +455,19 @@
pollState();
break;
+ case EVENT_OTA_PROVISION_STATUS_CHANGE:
+ ar = (AsyncResult)msg.obj;
+ if (ar.exception == null) {
+ ints = (int[]) ar.result;
+ int otaStatus = ints[0];
+ if (otaStatus == phone.CDMA_OTA_PROVISION_STATUS_COMMITTED
+ || otaStatus == phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED) {
+ Log.d(LOG_TAG, "Received OTA_PROGRAMMING Complete,Reload MDN ");
+ cm.getCDMASubscription( obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
+ }
+ }
+ break;
+
default:
Log.e(LOG_TAG, "Unhandled message with number: " + msg.what);
break;
@@ -663,20 +701,6 @@
}
break;
- case EVENT_POLL_STATE_CDMA_SUBSCRIPTION: // Handle RIL_CDMA_SUBSCRIPTION
- String cdmaSubscription[] = (String[])ar.result;
-
- if (cdmaSubscription != null && cdmaSubscription.length >= 4) {
- mMdn = cdmaSubscription[0];
- mHomeSystemId = Integer.parseInt(cdmaSubscription[1], 16);
- mHomeNetworkId = Integer.parseInt(cdmaSubscription[2], 16);
- mMin = cdmaSubscription[3];
-
- } else {
- Log.w(LOG_TAG, "error parsing cdmaSubscription");
- }
- break;
-
default:
Log.e(LOG_TAG, "RIL response handle in wrong phone!"
+ " Expected CDMA RIL request and get GSM RIL request.");
@@ -793,11 +817,6 @@
// are allowed to arrive out-of-order
pollingContext[0]++;
- // RIL_REQUEST_CDMA_SUBSCRIPTION is necessary for CDMA
- cm.getCDMASubscription(
- obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION, pollingContext));
-
- pollingContext[0]++;
// RIL_REQUEST_OPERATOR is necessary for CDMA
cm.getOperator(
obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, pollingContext));
@@ -1467,4 +1486,9 @@
return mMin;
}
+ /** Returns null if NV is not yet ready */
+ public String getPrlVersion() {
+ return mPrlVersion;
+ }
+
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index 38a92cd..7e50cc5 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -37,10 +37,6 @@
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.PhoneProxy;
-import com.android.internal.telephony.TelephonyIntents;
-import android.app.ActivityManagerNative;
-import android.content.Intent;
-
/**
* {@hide}
@@ -67,7 +63,6 @@
private static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = 2;
private static final int EVENT_GET_DEVICE_IDENTITY_DONE = 4;
private static final int EVENT_GET_ICCID_DONE = 5;
- private static final int EVENT_NV_READY = 9;
private static final int EVENT_GET_CDMA_SUBSCRIPTION_DONE = 10;
private static final int EVENT_UPDATE_DONE = 14;
private static final int EVENT_GET_SST_DONE = 17;
@@ -78,7 +73,7 @@
private static final int EVENT_GET_SMS_DONE = 22;
private static final int EVENT_RUIM_REFRESH = 31;
- private static final int EVENT_OTA_PROVISION_STATUS_CHANGE = 32;
+
RuimRecords(CDMAPhone p) {
super(p);
@@ -92,14 +87,12 @@
p.mCM.registerForRUIMReady(this, EVENT_RUIM_READY, null);
- p.mCM.registerForNVReady(this, EVENT_NV_READY, null);
p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
// NOTE the EVENT_SMS_ON_RUIM is not registered
p.mCM.setOnIccRefresh(this, EVENT_RUIM_REFRESH, null);
// Start off by setting empty state
onRadioOffOrNotAvailable();
- p.mCM.registerForCdmaOtaProvision(this,EVENT_OTA_PROVISION_STATUS_CHANGE, null);
}
@@ -108,8 +101,6 @@
phone.mCM.unregisterForRUIMReady(this);
phone.mCM.unregisterForOffOrNotAvailable( this);
phone.mCM.unSetOnIccRefresh(this);
- phone.mCM.unregisterForNVReady(this);
- phone.mCM.unregisterForCdmaOtaProvision(this);
}
@Override
@@ -213,9 +204,7 @@
case EVENT_RUIM_READY:
onRuimReady();
break;
- case EVENT_NV_READY:
- onNvReady();
- break;
+
case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
onRadioOffOrNotAvailable();
break;
@@ -232,15 +221,7 @@
if (ar.exception != null) {
break;
}
- if (m_ota_commited) {
- if (mMyMobileNumber != localTemp[0]) {
- Intent intent = new Intent(TelephonyIntents.ACTION_CDMA_OTA_MDN_CHANGED);
- intent.putExtra("mdn", localTemp[0]);
- Log.d(LOG_TAG,"Broadcasting intent MDN Change in OTA ");
- ActivityManagerNative.broadcastStickyIntent(intent, null);
- }
- m_ota_commited = false;
- }
+
mMyMobileNumber = localTemp[0];
mSid = localTemp[1];
mNid = localTemp[2];
@@ -294,21 +275,6 @@
}
break;
- case EVENT_OTA_PROVISION_STATUS_CHANGE:
- m_ota_commited=false;
- ar = (AsyncResult)msg.obj;
- if (ar.exception == null) {
- int[] ints = (int[]) ar.result;
- int otaStatus = ints[0];
- if (otaStatus == phone.CDMA_OTA_PROVISION_STATUS_COMMITTED) {
- m_ota_commited=true;
- phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
- } else if (otaStatus == phone.CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED) {
- phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
- }
- }
- break;
-
}}catch (RuntimeException exc) {
// I don't want these exceptions to be fatal
Log.w(LOG_TAG, "Exception parsing RUIM record", exc);
@@ -360,10 +326,6 @@
}
- private void onNvReady() {
- phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
-
- }
private void fetchRuimRecords() {
recordsRequested = true;