donut snapshot

This commit is contained in:
Jean-Baptiste Queru
2009-07-29 14:25:07 -07:00
parent cf4550c319
commit a8675f67e3
326 changed files with 18109 additions and 5040 deletions

View File

@@ -880,7 +880,7 @@ public interface CommandsInterface {
* ar.userObject contains the orignal value of result.obj
* ar.result is null on success and failure
*/
void sendBurstDtmf(String dtmfString, Message result);
void sendBurstDtmf(String dtmfString, int on, int off, Message result);
/**
* smscPDU is smsc address in PDU form GSM BCD format prefixed

View File

@@ -760,10 +760,12 @@ public interface Phone {
* back to caller.
*
* @param dtmfString is string representing the dialing digit(s) in the active call
* @param on the DTMF ON length in milliseconds, or 0 for default
* @param off the DTMF OFF length in milliseconds, or 0 for default
* @param onCompelte is the callback message when the action is processed by BP
*
*/
void sendBurstDtmf(String dtmfString, Message onComplete);
void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete);
/**
* Sets the radio power on/off state (off is sometimes

View File

@@ -685,7 +685,7 @@ public abstract class PhoneBase implements Phone {
return null;
}
public void sendBurstDtmf(String dtmfString, Message onComplete) {
public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete) {
// This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone.
Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone.");
}

View File

@@ -713,8 +713,8 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getCdmaEriIconMode();
}
public void sendBurstDtmf(String dtmfString, Message onComplete){
mActivePhone.sendBurstDtmf(dtmfString,onComplete);
public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete){
mActivePhone.sendBurstDtmf(dtmfString, on, off, onComplete);
}
public void exitEmergencyCallbackMode(){

View File

@@ -1068,10 +1068,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
public void
sendBurstDtmf(String dtmfString, Message result) {
sendBurstDtmf(String dtmfString, int on, int off, Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BURST_DTMF, result);
rr.mp.writeInt(3);
rr.mp.writeString(dtmfString);
rr.mp.writeString(Integer.toString(on));
rr.mp.writeString(Integer.toString(off));
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ " : " + dtmfString);

View File

@@ -118,6 +118,12 @@ cat include/telephony/ril.h | \
*/
int RIL_RESTRICTED_STATE_PS_ALL = 0x10;
/** Data profile for RIL_REQUEST_SETUP_DATA_CALL */
static final int DATA_PROFILE_DEFAULT = 0;
static final int DATA_PROFILE_TETHERED = 1;
static final int DATA_PROFILE_OEM_BASE = 1000;
int RIL_REQUEST_GET_SIM_STATUS = 1;
int RIL_REQUEST_ENTER_SIM_PIN = 2;
int RIL_REQUEST_ENTER_SIM_PUK = 3;

View File

@@ -32,6 +32,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_SERVICE_STATE_CHANGED = "android.intent.action.SERVICE_STATE";
@@ -50,6 +53,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires no permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_RADIO_TECHNOLOGY_CHANGED
= "android.intent.action.RADIO_TECHNOLOGY";
@@ -66,6 +72,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires no permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_EMERGENCY_CALLBACK_MODE_CHANGED
= "android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED";
@@ -89,6 +98,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR";
@@ -110,6 +122,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_ANY_DATA_CONNECTION_STATE_CHANGED
= "android.intent.action.ANY_DATA_STATE";
@@ -127,6 +142,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_DATA_CONNECTION_FAILED
= "android.intent.action.DATA_CONNECTION_FAILED";
@@ -148,6 +166,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_SIM_STATE_CHANGED
= "android.intent.action.SIM_STATE_CHANGED";
@@ -163,6 +184,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_NETWORK_SET_TIME = "android.intent.action.NETWORK_SET_TIME";
@@ -178,6 +202,9 @@ public class TelephonyIntents {
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_NETWORK_SET_TIMEZONE
= "android.intent.action.NETWORK_SET_TIMEZONE";
@@ -187,6 +214,9 @@ public class TelephonyIntents {
* <p class="note">.
* This is to pop up a notice to show user that the phone is in emergency callback mode
* and atacalls and outgoing sms are blocked.
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*/
public static final String ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS
= "android.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS";
@@ -197,6 +227,9 @@ public class TelephonyIntents {
* <ul>
* <li><em>mdn</em> - An Integer of the updated MDN number.</li>
* </ul>
*
* <p class="note">This is a protected intent that can only be sent
* by the system.
*
* <p class="note">
*/

View File

@@ -40,14 +40,16 @@ public interface TelephonyProperties
//****** Current Network
/** Alpha name of current registered operator.
* Availability: when registered to a network
/** Alpha name of current registered operator.<p>
* Availability: when registered to a network. Result may be unreliable on
* CDMA networks.
*/
static final String PROPERTY_OPERATOR_ALPHA = "gsm.operator.alpha";
//TODO: most of these proprieties are generic, substitute gsm. with phone. bug 1856959
/** Numeric name (MCC+MNC) of current registered operator.
* Availability: when registered to a network
/** Numeric name (MCC+MNC) of current registered operator.<p>
* Availability: when registered to a network. Result may be unreliable on
* CDMA networks.
*/
static final String PROPERTY_OPERATOR_NUMERIC = "gsm.operator.numeric";
@@ -64,8 +66,9 @@ public interface TelephonyProperties
static final String PROPERTY_OPERATOR_ISROAMING = "gsm.operator.isroaming";
/** The ISO country code equivalent of the current registered operator's
* MCC (Mobile Country Code)
* Availability: when registered to a network
* MCC (Mobile Country Code)<p>
* Availability: when registered to a network. Result may be unreliable on
* CDMA networks.
*/
static final String PROPERTY_OPERATOR_ISO_COUNTRY = "gsm.operator.iso-country";

View File

@@ -187,22 +187,30 @@ public class WspTypeDecoder {
}
/**
* Decode the "Extension-media" type for WSP pdu
*
* @param startIndex The starting position of the "Extension-media" in this pdu
*
* @return false when error(not a Extension-media) occur
* return value can be retrieved by getValueString() method
* length of data in pdu can be retrieved by getValue32() method
*/
* Decode the "Extension-media" type for WSP PDU.
*
* @param startIndex The starting position of the "Extension-media" in this PDU.
*
* @return false on error, such as if there is no Extension-media at startIndex.
* Side-effects: updates stringValue (available with getValueString()), which will be
* null on error. The length of the data in the PDU is available with getValue32(), 0
* on error.
*/
public boolean decodeExtensionMedia(int startIndex) {
int index = startIndex;
while (wspData[index] != 0) {
dataLength = 0;
stringValue = null;
int length = wspData.length;
boolean rtrn = index < length;
while (index < length && wspData[index] != 0) {
index++;
}
dataLength = index - startIndex + 1;
stringValue = new String(wspData, startIndex, dataLength - 1);
return true;
return rtrn;
}
/**

View File

@@ -18,17 +18,23 @@ package com.android.internal.telephony.cdma;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.ContentValues;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.SharedPreferences;
import android.database.SQLException;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Telephony;
import android.telephony.CellLocation;
import android.telephony.PhoneNumberUtils;
import android.telephony.ServiceState;
@@ -41,6 +47,10 @@ import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.DataConnection;
// TODO(Moto): need to move MccTable from telephony.gsm to telephony
// since there is no difference between CDMA and GSM for MccTable and
// CDMA uses gsm's MccTable is not good.
import com.android.internal.telephony.gsm.MccTable;
import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccException;
import com.android.internal.telephony.IccFileHandler;
@@ -56,6 +66,10 @@ import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
@@ -154,6 +168,23 @@ public class CDMAPhone extends PhoneBase {
String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
mIsPhoneInECMState = inEcm.equals("true");
// Sets operator alpha property by retrieving from build-time system property
String operatorAlpha = SystemProperties.get("ro.cdma.home.operator.alpha");
setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, operatorAlpha);
// Sets operator numeric property by retrieving from build-time system property
String operatorNumeric = SystemProperties.get("ro.cdma.home.operator.numeric");
setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operatorNumeric);
// Sets iso country property by retrieving from build-time system property
setIsoCountryProperty(operatorNumeric);
// Sets current entry in the telephony carrier table
updateCurrentCarrierInProvider(operatorNumeric);
// Updates MCC MNC device configuration information
updateMccMncConfiguration(operatorNumeric);
// Notify voicemails.
notifier.notifyMessageWaitingChanged(this);
}
@@ -427,13 +458,7 @@ public class CDMAPhone extends PhoneBase {
}
public String getSubscriberId() {
// Subscriber ID is the combination of MCC+MNC+MIN as CDMA IMSI
// TODO(Moto): Replace with call to mRuimRecords.getIMSI_M() when implemented.
if ((getServiceState().getOperatorNumeric() != null) && (getCdmaMIN() != null)) {
return (getServiceState().getOperatorNumeric() + getCdmaMIN());
} else {
return null;
}
return mSST.getImsi();
}
public boolean canConference() {
@@ -630,7 +655,7 @@ public class CDMAPhone extends PhoneBase {
mCM.stopDtmf(null);
}
public void sendBurstDtmf(String dtmfString, Message onComplete) {
public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete) {
boolean check = true;
for (int itr = 0;itr < dtmfString.length(); itr++) {
if (!PhoneNumberUtils.is12Key(dtmfString.charAt(itr))) {
@@ -641,7 +666,7 @@ public class CDMAPhone extends PhoneBase {
}
}
if ((mCT.state == Phone.State.OFFHOOK)&&(check)) {
mCM.sendBurstDtmf(dtmfString, onComplete);
mCM.sendBurstDtmf(dtmfString, on, off, onComplete);
}
}
@@ -1244,4 +1269,66 @@ public class CDMAPhone extends PhoneBase {
editor.commit();
}
/**
* Sets PROPERTY_ICC_OPERATOR_ISO_COUNTRY property
*
*/
private void setIsoCountryProperty(String operatorNumeric) {
if (TextUtils.isEmpty(operatorNumeric)) {
setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, "");
} else {
String iso = "";
try {
iso = MccTable.countryCodeForMcc(Integer.parseInt(
operatorNumeric.substring(0,3)));
} catch (NumberFormatException ex) {
Log.w(LOG_TAG, "countryCodeForMcc error" + ex);
} catch (StringIndexOutOfBoundsException ex) {
Log.w(LOG_TAG, "countryCodeForMcc error" + ex);
}
setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, iso);
}
}
/**
* Sets the "current" field in the telephony provider according to the build-time
* operator numeric property
*
* @return true for success; false otherwise.
*/
// TODO(Moto): move this method into PhoneBase, since it looks identical to
// the one in GsmPhone
private boolean updateCurrentCarrierInProvider(String operatorNumeric) {
if (!TextUtils.isEmpty(operatorNumeric)) {
try {
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
ContentValues map = new ContentValues();
map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
getContext().getContentResolver().insert(uri, map);
return true;
} catch (SQLException e) {
Log.e(LOG_TAG, "Can't store current operator", e);
}
}
return false;
}
/**
* Updates MCC and MNC device configuration information for application retrieving
* correct version of resources
*
*/
private void updateMccMncConfiguration(String operatorNumeric) {
if (operatorNumeric.length() >= 5) {
Configuration config = new Configuration();
config.mcc = Integer.parseInt(operatorNumeric.substring(0,3));
config.mnc = Integer.parseInt(operatorNumeric.substring(3));
try {
ActivityManagerNative.getDefault().updateConfiguration(config);
} catch (RemoteException e) {
Log.e(LOG_TAG, "Can't update configuration", e);
}
}
}
}

View File

@@ -21,6 +21,7 @@ import android.util.EventLog;
import android.util.Log;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.DataLink;
import com.android.internal.telephony.RILConstants;
@@ -142,7 +143,8 @@ public class CdmaDataConnection extends DataConnection {
lastFailTime = -1;
lastFailCause = FailCause.NONE;
receivedDisconnectReq = false;
phone.mCM.setupDataCall(Integer.toString(RILConstants.CDMA_PHONE), null, null, null,
phone.mCM.setupDataCall(Integer.toString(RILConstants.CDMA_PHONE),
Integer.toString(RILConstants.DATA_PROFILE_DEFAULT), null, null,
null, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
}

View File

@@ -19,11 +19,8 @@ package com.android.internal.telephony.cdma;
import android.app.AlarmManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContentValues;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.SQLException;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -35,7 +32,6 @@ import android.os.SystemProperties;
import android.provider.Checkin;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.provider.Telephony;
import android.provider.Telephony.Intents;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
@@ -64,6 +60,7 @@ import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERAT
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISROAMING;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_NUMERIC;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
import java.util.Arrays;
import java.util.Date;
@@ -571,7 +568,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
try {
registrationState = Integer.parseInt(states[0]);
radioTechnology = Integer.parseInt(states[3]);
baseStationId = Integer.parseInt(states[4], 16);
baseStationId = Integer.parseInt(states[4]);
baseStationLatitude = Integer.parseInt(states[5], 16);
baseStationLongitude = Integer.parseInt(states[6], 16);
cssIndicator = Integer.parseInt(states[7]);
@@ -608,7 +605,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
// values are -1 if not available
newCellLoc.setCellLocationData(baseStationId, baseStationLatitude,
baseStationLongitude);
baseStationLongitude, systemId, networkId);
if (reasonForDenial == 0) {
mRegistrationDeniedReason = ServiceStateTracker.REGISTRATION_DENIED_GEN;
@@ -634,27 +631,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
} else {
newSS.setOperatorName(opNames[0], opNames[1], opNames[2]);
}
if (!(opNames[2].equals(currentCarrier))) {
// TODO(Moto): jsh asks, "This uses the MCC+MNC of the current registered
// network to set the "current" entry in the APN table. But the correct
// entry should be the MCC+MNC that matches the subscribed operator
// (eg, phone issuer). These can be different when roaming."
try {
// Set the current field of the telephony provider according to
// the CDMA's operator
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
ContentValues map = new ContentValues();
map.put(Telephony.Carriers.NUMERIC, opNames[2]);
cr.insert(uri, map);
// save current carrier for the next time check
currentCarrier = opNames[2];
} catch (SQLException e) {
Log.e(LOG_TAG, "Can't store current operator", e);
}
} else {
Log.i(LOG_TAG, "current carrier is not changed");
}
} else {
Log.w(LOG_TAG, "error parsing opNames");
}
@@ -665,8 +641,15 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
if (cdmaSubscription != null && cdmaSubscription.length >= 4) {
mMdn = cdmaSubscription[0];
mHomeSystemId = Integer.parseInt(cdmaSubscription[1], 16);
mHomeNetworkId = Integer.parseInt(cdmaSubscription[2], 16);
// TODO: Only grabbing the first SID/NID for now.
if (cdmaSubscription[1] != null) {
String[] sid = cdmaSubscription[1].split(",");
mHomeSystemId = sid.length > 0 ? Integer.parseInt(sid[0]) : 0;
}
if (cdmaSubscription[2] != null) {
String[] nid = cdmaSubscription[2].split(",");
mHomeNetworkId = nid.length > 0 ? Integer.parseInt(nid[0]) : 0;
}
mMin = cdmaSubscription[3];
} else {
@@ -1437,4 +1420,19 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
return mMin;
}
/**
* Returns IMSI as MCC + MNC + MIN
*/
/*package*/ String getImsi() {
// TODO(Moto): When RUIM is enabled, IMSI will come from RUIM
// not build-time props. Moto will provide implementation
// for RUIM-ready case later.
String operatorNumeric = SystemProperties.get(PROPERTY_ICC_OPERATOR_NUMERIC, "");
if (!TextUtils.isEmpty(operatorNumeric) && getCdmaMin() != null) {
return (operatorNumeric + getCdmaMin());
} else {
return null;
}
}
}

View File

@@ -55,8 +55,6 @@ public final class RuimRecords extends IccRecords {
private String mImsi;
private String mMyMobileNumber;
private String mSid;
private String mNid;
private String mMin2Min1;
private String mPrlVersion;
@@ -125,21 +123,12 @@ public final class RuimRecords extends IccRecords {
adnCache.reset();
phone.setSystemProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, null);
phone.setSystemProperty(TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
// recordsRequested is set to false indicating that the SIM
// read requests made so far are not valid. This is set to
// true only when fresh set of read requests are made.
recordsRequested = false;
}
/** Returns null if RUIM is not yet ready */
public String getIMSI_M() {
// TODO(Moto): mImsi is not initialized, fix.
return mImsi;
}
public String getMdnNumber() {
return mMyMobileNumber;
}
@@ -242,8 +231,6 @@ public final class RuimRecords extends IccRecords {
m_ota_commited = false;
}
mMyMobileNumber = localTemp[0];
mSid = localTemp[1];
mNid = localTemp[2];
mMin2Min1 = localTemp[3];
mPrlVersion = localTemp[4];

View File

@@ -22,6 +22,7 @@ import android.util.EventLog;
import android.util.Log;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.DataLink;
import com.android.internal.telephony.Phone;
@@ -83,7 +84,8 @@ public class PdpConnection extends DataConnection {
lastFailCause = FailCause.NONE;
receivedDisconnectReq = false;
phone.mCM.setupDataCall(Integer.toString(RILConstants.GSM_PHONE), null, apn.apn, apn.user,
phone.mCM.setupDataCall(Integer.toString(RILConstants.GSM_PHONE),
Integer.toString(RILConstants.DATA_PROFILE_DEFAULT), apn.apn, apn.user,
apn.password, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
}

View File

@@ -937,7 +937,7 @@ public final class SimulatedCommands extends BaseCommands
* ar.userObject contains the orignal value of result.obj
* ar.result is null on success and failure
*/
public void sendBurstDtmf(String dtmfString, Message result) {
public void sendBurstDtmf(String dtmfString, int on, int off, Message result) {
resultSuccess(result, null);
}