Merge change 6814

* changes:
  Change 107 and 146 from partner repo.
This commit is contained in:
Android (Google) Code Review
2009-07-10 14:19:58 -07:00
6 changed files with 67 additions and 124 deletions

View File

@@ -116,6 +116,7 @@ public abstract class ServiceStateTracker extends Handler {
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";

View File

@@ -352,60 +352,36 @@ public abstract class SmsMessageBase {
}
/**
* 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;
}
}

View File

@@ -191,24 +191,4 @@ public class TelephonyIntents {
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";
}

View File

@@ -392,7 +392,7 @@ public class CDMAPhone extends PhoneBase {
}
public String getCdmaPrlVersion(){
return mRuimRecords.getPrlVersion();
return mSST.getPrlVersion();
}
public String getCdmaMIN() {

View File

@@ -127,6 +127,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
private int mHomeSystemId;
private int mHomeNetworkId;
private String mMin;
private String mPrlVersion;
private boolean isEriTextLoaded = false;
private boolean isSubscriptionFromRuim = false;
@@ -178,6 +179,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
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 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
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 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
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 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
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 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
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 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
}
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.");
@@ -792,11 +816,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
// then count down the responses, which
// 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(
@@ -1467,4 +1486,9 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
return mMin;
}
/** Returns null if NV is not yet ready */
public String getPrlVersion() {
return mPrlVersion;
}
}

View File

@@ -37,10 +37,6 @@ import com.android.internal.telephony.IccRecords;
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
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 @@ public final class RuimRecords extends IccRecords {
}
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 @@ public final class RuimRecords extends IccRecords {
}
private void onNvReady() {
phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
}
private void fetchRuimRecords() {
recordsRequested = true;