From dda5391d5079537e275c9f4ed2637a1484d0e4e8 Mon Sep 17 00:00:00 2001
From: Wink Saville
registerForServiceStateChanged to be informed of
@@ -273,7 +292,12 @@ public interface Phone {
String getActiveApn();
/**
- * Get current signal strength.
+ * Get current signal strength. No change notification available on this
+ * interface. Use PhoneStateNotifier or an equivalent.
+ * An ASU is 0-31 or -1 if unknown (for GSM, dBm = -113 - 2 * asu).
+ * The following special values are defined:
+ * getSimCard().registerForReady() for change notification.
@@ -760,9 +752,18 @@ public interface Phone {
void stopDtmf();
/**
- * Play a Burst of DTMF tone on the active call. Ignored if there is no active call.
+ * send burst DTMF tone, it can send the string as single character or multiple character
+ * ignore if there is no active call or not valid digits string.
+ * Valid digit means only includes characters ISO-LATIN characters 0-9, *, #
+ * The difference between sendDtmf and sendBurstDtmf is sendDtmf only sends one character,
+ * this api can send single character and multiple character, also, this api has response
+ * back to caller.
+ *
+ * @param dtmfString is string representing the dialing digit(s) in the active call
+ * @param onCompelte is the callback message when the action is processed by BP
+ *
*/
- void sendBurstDtmf(String dtmfString);
+ void sendBurstDtmf(String dtmfString, Message onComplete);
/**
* Sets the radio power on/off state (off is sometimes
@@ -826,6 +827,12 @@ public interface Phone {
*/
String getVoiceMailNumber();
+ /**
+ * Returns unread voicemail count. This count is shown when the voicemail
+ * notification is expanded.
+ */
+ int getCountVoiceMessages();
+
/**
* Returns the alpha tag associated with the voice mail number.
* If there is no alpha tag associated or the record is not yet available,
@@ -859,7 +866,7 @@ public interface Phone {
*
* @param commandInterfaceCFReason is one of the valid call forwarding
* CF_REASONS, as defined in
- * Broadcast Action: The emergency callback mode is entered.
- *
+ * Broadcast Action: The emergency callback mode is changed.
+ *
* You can not receive this through components declared
* in manifests, only by explicitly registering for it with
@@ -65,8 +67,8 @@ public class TelephonyIntents {
*
* Requires no permission.
*/
- public static final String ACTION_EMERGENCY_CALLBACK_MODE_ENTERED
- = "android.intent.action.EMERGENCY_CALLBACK_MODE";
+ public static final String ACTION_EMERGENCY_CALLBACK_MODE_CHANGED
+ = "android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED";
/**
* Broadcast Action: The phone's signal strength has changed. The intent will have the
* following extra values: Broadcast Action: It indicates the Emergency callback mode blocks datacall/sms
+ * .
+ */
+ // TODO(Moto): What is the use case, who is interested in this?
+ 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:
+ */
+ // 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.
+ 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/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
index 453185f89bd97..4e8950fe1effa 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
@@ -98,4 +98,7 @@ public interface TelephonyProperties
*/
static String PROPERTY_DATA_NETWORK_TYPE = "gsm.network.type";
+ /** Indicate if phone is in emergency callback mode */
+ static final String PROPERTY_INECM_MODE = "ril.cdma.inecmmode";
+
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 03f7f986da057..c0bfe5e6fd343 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -35,6 +35,7 @@ import android.text.TextUtils;
import android.util.Log;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_BASEBAND_VERSION;
+import static com.android.internal.telephony.TelephonyProperties.PROPERTY_INECM_MODE;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.CommandsInterface;
@@ -54,9 +55,9 @@ import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
-import java.util.ArrayList;
import java.util.List;
-
+import java.util.Timer;
+import java.util.TimerTask;
/**
* {@hide}
*/
@@ -83,8 +84,21 @@ public class CDMAPhone extends PhoneBase {
// mEriFileLoadedRegistrants are informed after the ERI text has been loaded
private RegistrantList mEriFileLoadedRegistrants = new RegistrantList();
+
+ // mECMExitRespRegistrant is informed after the phone has been exited
+ //the emergency callback mode
+ //keep track of if phone is in emergency callback mode
+ private boolean mIsPhoneInECMState;
+ private Registrant mECMExitRespRegistrant;
private String mEsn;
private String mMeid;
+
+ // A runnable which is used to automatically exit from ECM after a period of time.
+ private Runnable mExitEcmRunnable = new Runnable() {
+ public void run() {
+ exitEmergencyCallbackMode();
+ }
+ };
Registrant mPostDialHandler;
@@ -122,13 +136,16 @@ public class CDMAPhone extends PhoneBase {
mCM.setOnCallRing(h, EVENT_CALL_RING, null);
mSST.registerForNetworkAttach(h, EVENT_REGISTERED_TO_NETWORK, null);
mCM.registerForNVReady(h, EVENT_NV_READY, null);
- mCM.registerForCdmaCallWaiting(h,EVENT_CDMA_CALL_WAITING,null);
- mCM.setEmergencyCallbackMode(h, EVENT_EMERGENCY_CALLBACK_MODE, null);
+ mCM.setEmergencyCallbackMode(h, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
//Change the system setting
SystemProperties.set(TelephonyProperties.CURRENT_ACTIVE_PHONE,
new Integer(RILConstants.CDMA_PHONE).toString());
+
+ // TODO(Moto): Is this needed to handle phone crashes and/or power cycling?
+ String inEcm=SystemProperties.get(PROPERTY_INECM_MODE, "false");
+ mIsPhoneInECMState = inEcm.equals("true");
}
public void dispose() {
@@ -143,7 +160,7 @@ public class CDMAPhone extends PhoneBase {
mSST.unregisterForNetworkAttach(h); //EVENT_REGISTERED_TO_NETWORK
mCM.unSetOnSuppServiceNotification(h);
mCM.unSetOnCallRing(h);
- mCM.unregisterForCdmaCallWaiting(h);
+
//Force all referenced classes to unregister their former registered events
mCT.dispose();
@@ -370,8 +387,8 @@ public class CDMAPhone extends PhoneBase {
return mRuimRecords.getMdnNumber();
}
- public String getMin() {
- return mRuimRecords.getMin();
+ public String getCdmaMIN() {
+ return mRuimRecords.getCdmaMin();
}
public void getCallWaiting(Message onComplete) {
@@ -434,7 +451,7 @@ public class CDMAPhone extends PhoneBase {
}
public void setOnPostDialCharacter(Handler h, int what, Object obj) {
- Log.e(LOG_TAG, "setOnPostDialCharacter: not possible in CDMA");
+ mPostDialHandler = new Registrant(h, what, obj);
}
public boolean handlePinMmi(String dialString) {
@@ -478,6 +495,30 @@ public class CDMAPhone extends PhoneBase {
mDataConnection.setDataOnRoamingEnabled(enable);
}
+ public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
+ mCM.registerForCdmaOtaProvision(h, what, obj);
+ }
+
+ public void unregisterForCdmaOtaStatusChange(Handler h) {
+ mCM.unregisterForCdmaOtaProvision(h);
+ }
+
+ public void setOnEcbModeExitResponse(Handler h, int what, Object obj) {
+ mECMExitRespRegistrant = new Registrant (h, what, obj);
+ }
+
+ public void unsetOnEcbModeExitResponse(Handler h) {
+ mECMExitRespRegistrant.clear();
+ }
+
+ public void registerForCallWaiting(Handler h, int what, Object obj) {
+ Log.e(LOG_TAG, "method registerForCallWaiting is NOT yet supported in CDMA");
+ }
+
+ public void unregisterForCallWaiting(Handler h) {
+ Log.e(LOG_TAG, "method unregisterForCallWaiting is NOT yet supported in CDMA");
+ }
+
public String getIpAddress(String apnType) {
return mDataConnection.getIpAddress();
}
@@ -565,7 +606,7 @@ public class CDMAPhone extends PhoneBase {
mCM.stopDtmf(null);
}
- public void sendBurstDtmf(String dtmfString) {
+ public void sendBurstDtmf(String dtmfString, Message onComplete) {
boolean check = true;
for (int itr = 0;itr < dtmfString.length(); itr++) {
if (!PhoneNumberUtils.is12Key(dtmfString.charAt(itr))) {
@@ -576,7 +617,7 @@ public class CDMAPhone extends PhoneBase {
}
}
if ((mCT.state == Phone.State.OFFHOOK)&&(check)) {
- mCM.sendBurstDtmf(dtmfString, null);
+ mCM.sendBurstDtmf(dtmfString, onComplete);
}
}
@@ -593,7 +634,7 @@ public class CDMAPhone extends PhoneBase {
}
public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) {
- Log.e(LOG_TAG, "getAvailableNetworks: not possible in CDMA");
+ Log.e(LOG_TAG, "setOutgoingCallerIdDisplay: not possible in CDMA");
}
public void enableLocationUpdates() {
@@ -630,7 +671,14 @@ public class CDMAPhone extends PhoneBase {
//TODO: Where can we get this value has to be clarified with QC
//return mSIMRecords.getVoiceMailNumber();
// throw new RuntimeException();
- return "12345";
+ return "*86";
+ }
+
+ /* Returns Number of Voicemails
+ * @hide
+ */
+ public int getCountVoiceMessages() {
+ return mRuimRecords.getCountVoiceMessages();
}
public String getVoiceMailAlphaTag() {
@@ -648,7 +696,15 @@ public class CDMAPhone extends PhoneBase {
}
public boolean enableDataConnectivity() {
- return mDataConnection.setDataEnabled(true);
+
+ // block data activities when phone is in emergency callback mode
+ if (mIsPhoneInECMState) {
+ Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS);
+ ActivityManagerNative.broadcastStickyIntent(intent, null);
+ return false;
+ } else {
+ return mDataConnection.setDataEnabled(true);
+ }
}
public void disableLocationUpdates() {
@@ -691,7 +747,7 @@ public class CDMAPhone extends PhoneBase {
return null;
}
- /**
+ /**
* Notify any interested party of a Phone state change.
*/
/*package*/ void notifyPhoneStateChanged() {
@@ -736,6 +792,13 @@ public class CDMAPhone extends PhoneBase {
mUnknownConnectionRegistrants.notifyResult(this);
}
+ void sendEmergencyCallbackModeChange(){
+ //Send an Intent
+ Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
+ intent.putExtra(PHONE_IN_ECM_STATE, mIsPhoneInECMState);
+ ActivityManagerNative.broadcastStickyIntent(intent,null);
+ }
+
/*package*/ void
updateMessageWaitingIndicator(boolean mwi) {
// this also calls notifyMessageWaitingIndicator()
@@ -761,6 +824,51 @@ public class CDMAPhone extends PhoneBase {
mMmiCompleteRegistrants.notifyRegistrants(new AsyncResult(null, fc, null));
}
+
+ @Override
+ public void exitEmergencyCallbackMode() {
+ // Send a message which will invoke handleExitEmergencyCallbackMode
+ mCM.exitEmergencyCallbackMode(h.obtainMessage(EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE));
+ }
+
+ private void handleEnterEmergencyCallbackMode(Message msg) {
+ Log.d(LOG_TAG, "Event EVENT_EMERGENCY_CALLBACK_MODE Received");
+ // if phone is not in ECM mode, and it's changed to ECM mode
+ if (mIsPhoneInECMState == false) {
+ mIsPhoneInECMState = true;
+ // notify change
+ sendEmergencyCallbackModeChange();
+ setSystemProperty(PROPERTY_INECM_MODE, "true");
+
+ // Post this runnable so we will automatically exit
+ // if no one invokes exitEmergencyCallbackMode() directly.
+ // TODO(Moto): Get the delay a property so it can be adjusted
+ long delayInMillis = 300000; // 30,000 millis == 5 minutes
+ h.postDelayed(mExitEcmRunnable, delayInMillis);
+ }
+ }
+
+ private void handleExitEmergencyCallbackMode(Message msg) {
+ Log.d(LOG_TAG, "Event EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE Received");
+ AsyncResult ar = (AsyncResult)msg.obj;
+
+ // Remove pending exit ECM runnable, if any
+ h.removeCallbacks(mExitEcmRunnable);
+
+ if (mECMExitRespRegistrant != null) {
+ mECMExitRespRegistrant.notifyRegistrant(ar);
+ }
+ // if exiting ecm success
+ if (ar.exception == null) {
+ if (mIsPhoneInECMState) {
+ mIsPhoneInECMState = false;
+ setSystemProperty(PROPERTY_INECM_MODE, "false");
+ }
+ // send an Intent
+ sendEmergencyCallbackModeChange();
+ }
+ }
+
//***** Inner Classes
class MyHandler extends Handler {
MyHandler() {
@@ -770,6 +878,7 @@ public class CDMAPhone extends PhoneBase {
super(l);
}
+ @Override
public void handleMessage(Message msg) {
AsyncResult ar;
Message onComplete;
@@ -806,12 +915,16 @@ public class CDMAPhone extends PhoneBase {
}
break;
- case EVENT_EMERGENCY_CALLBACK_MODE: {
- Log.d(LOG_TAG, "Event EVENT_EMERGENCY_CALLBACK_MODE Received");
- Intent intent =
- new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_ENTERED);
- ActivityManagerNative.broadcastStickyIntent(intent, null);
+ case EVENT_EMERGENCY_CALLBACK_MODE_ENTER:{
+ handleEnterEmergencyCallbackMode(msg);
}
+ break;
+
+ case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{
+ handleExitEmergencyCallbackMode(msg);
+ }
+ break;
+
case EVENT_RUIM_RECORDS_LOADED:{
Log.d(LOG_TAG, "Event EVENT_RUIM_RECORDS_LOADED Received");
}
@@ -852,11 +965,7 @@ public class CDMAPhone extends PhoneBase {
Log.d(LOG_TAG, "ERI read, notify registrants");
mEriFileLoadedRegistrants.notifyRegistrants();
}
- }
- break;
-
- case EVENT_CDMA_CALL_WAITING:{
- Log.d(LOG_TAG, "Event EVENT_CDMA_CALL_WAITING Received");
+ setSystemProperty(PROPERTY_INECM_MODE,"false");
}
break;
@@ -867,26 +976,26 @@ public class CDMAPhone extends PhoneBase {
}
}
- /**
- * Retrieves the PhoneSubInfo of the CDMAPhone
- */
- public PhoneSubInfo getPhoneSubInfo(){
+ /**
+ * Retrieves the PhoneSubInfo of the CDMAPhone
+ */
+ public PhoneSubInfo getPhoneSubInfo() {
return mSubInfo;
- }
+ }
- /**
- * Retrieves the IccSmsInterfaceManager of the CDMAPhone
- */
- public IccSmsInterfaceManager getIccSmsInterfaceManager(){
- return mRuimSmsInterfaceManager;
- }
+ /**
+ * Retrieves the IccSmsInterfaceManager of the CDMAPhone
+ */
+ public IccSmsInterfaceManager getIccSmsInterfaceManager() {
+ return mRuimSmsInterfaceManager;
+ }
- /**
- * Retrieves the IccPhoneBookInterfaceManager of the CDMAPhone
- */
- public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
- return mRuimPhoneBookInterfaceManager;
- }
+ /**
+ * Retrieves the IccPhoneBookInterfaceManager of the CDMAPhone
+ */
+ public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager() {
+ return mRuimPhoneBookInterfaceManager;
+ }
public void registerForNvLoaded(Handler h, int what, Object obj) {
Registrant r = new Registrant (h, what, obj);
@@ -906,97 +1015,146 @@ public class CDMAPhone extends PhoneBase {
mEriFileLoadedRegistrants.remove(h);
}
- // override for allowing access from other classes of this package
- /**
- * {@inheritDoc}
- */
- public final void setSystemProperty(String property, String value) {
- super.setSystemProperty(property, value);
- }
-
- /**
- * {@inheritDoc}
- */
- public Handler getHandler(){
- return h;
- }
-
- /**
- * {@inheritDoc}
- */
- public IccFileHandler getIccFileHandler(){
- return this.mIccFileHandler;
- }
-
- /**
- * Set the TTY mode of the CDMAPhone
- */
- public void setTTYMode(int ttyMode, Message onComplete) {
- this.mCM.setTTYMode(ttyMode, onComplete);
-}
-
- /**
- * Queries the TTY mode of the CDMAPhone
- */
- public void queryTTYMode(Message onComplete) {
- this.mCM.queryTTYMode(onComplete);
- }
-
- /**
- * Sends Exit EmergencyCallbackMode Exit request on CDMAPhone
- */
- public void exitEmergencyCallbackMode(Message onComplete) {
- this.mCM.exitEmergencyCallbackMode(onComplete);
- }
-
- /**
- * Activate or deactivate cell broadcast SMS.
- *
- * @param activate
- * 0 = activate, 1 = deactivate
- * @param response
- * Callback message is empty on completion
- */
- public void activateCellBroadcastSms(int activate, Message response) {
- mSMS.activateCellBroadcastSms(activate, response);
- }
-
- /**
- * Query the current configuration of cdma cell broadcast SMS.
- *
- * @param response
- * Callback message is empty on completion
- */
- public void getCellBroadcastSmsConfig(Message response){
- mSMS.getCellBroadcastSmsConfig(response);
- }
-
- /**
- * Configure cdma cell broadcast SMS.
- *
- * @param response
- * Callback message is empty on completion
- */
- public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response){
- mSMS.setCellBroadcastConfig(configValuesArray, response);
- }
-
- public void registerForOtaSessionStatus(Handler h, int what, Object obj){
- mCM.registerForOtaSessionStatus(h, what, obj);
- }
-
- public void unregisterForOtaSessionStatus(Handler h){
- mCM.unregisterForOtaSessionStatus(h);
- }
-
-/**
- * TODO(Teleca): The code in getCdmaEriIconIndex, getCdmaEriIconMode & getCdmaEriText share a
- * lot of logic, refactor.
- */
+ // override for allowing access from other classes of this package
/**
- * Returns the CDMA ERI icon index to display,
- * it returns 1, EriInfo.ROAMING_INDICATOR_OFF, in case there is no icon to display
+ * {@inheritDoc}
*/
+ public final void setSystemProperty(String property, String value) {
+ super.setSystemProperty(property, value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Handler getHandler() {
+ return h;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IccFileHandler getIccFileHandler() {
+ return this.mIccFileHandler;
+ }
+
+ /**
+ * Set the TTY mode of the CDMAPhone
+ */
+ public void setTTYMode(int ttyMode, Message onComplete) {
+ this.mCM.setTTYMode(ttyMode, onComplete);
+ }
+
+ /**
+ * Queries the TTY mode of the CDMAPhone
+ */
+ public void queryTTYMode(Message onComplete) {
+ this.mCM.queryTTYMode(onComplete);
+ }
+
+ /**
+ * Activate or deactivate cell broadcast SMS.
+ *
+ * @param activate 0 = activate, 1 = deactivate
+ * @param response Callback message is empty on completion
+ */
+ public void activateCellBroadcastSms(int activate, Message response) {
+ mSMS.activateCellBroadcastSms(activate, response);
+ }
+
+ /**
+ * Query the current configuration of cdma cell broadcast SMS.
+ *
+ * @param response Callback message is empty on completion
+ */
+ public void getCellBroadcastSmsConfig(Message response) {
+ mSMS.getCellBroadcastSmsConfig(response);
+ }
+
+ /**
+ * Configure cdma cell broadcast SMS.
+ *
+ * @param response Callback message is empty on completion
+ */
+ public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
+ mSMS.setCellBroadcastConfig(configValuesArray, response);
+ }
+
+ public static final String IS683A_FEATURE_CODE = "*228" ;
+ public static final int IS683A_FEATURE_CODE_NUM_DIGITS = 4 ;
+ public static final int IS683A_SYS_SEL_CODE_NUM_DIGITS = 2 ;
+ public static final int IS683A_SYS_SEL_CODE_OFFSET = 4;
+
+ private static final int IS683_CONST_800MHZ_A_BAND = 0;
+ private static final int IS683_CONST_800MHZ_B_BAND = 1;
+ private static final int IS683_CONST_1900MHZ_A_BLOCK = 2;
+ private static final int IS683_CONST_1900MHZ_B_BLOCK = 3;
+ private static final int IS683_CONST_1900MHZ_C_BLOCK = 4;
+ private static final int IS683_CONST_1900MHZ_D_BLOCK = 5;
+ private static final int IS683_CONST_1900MHZ_E_BLOCK = 6;
+ private static final int IS683_CONST_1900MHZ_F_BLOCK = 7;
+
+ private boolean isIs683OtaSpDialStr(String dialStr) {
+ int sysSelCodeInt;
+ boolean isOtaspDialString = false;
+ int dialStrLen = dialStr.length();
+
+ if (dialStrLen == IS683A_FEATURE_CODE_NUM_DIGITS) {
+ if (dialStr.equals(IS683A_FEATURE_CODE)) {
+ isOtaspDialString = true;
+ }
+ } else if ((dialStr.regionMatches(0, IS683A_FEATURE_CODE, 0,
+ IS683A_FEATURE_CODE_NUM_DIGITS) == true)
+ && (dialStrLen >=
+ (IS683A_FEATURE_CODE_NUM_DIGITS + IS683A_SYS_SEL_CODE_NUM_DIGITS))) {
+ StringBuilder sb = new StringBuilder(dialStr);
+ // Separate the System Selection Code into its own string
+ char[] sysSel = new char[2];
+ sb.delete(0, IS683A_SYS_SEL_CODE_OFFSET);
+ sb.getChars(0, IS683A_SYS_SEL_CODE_NUM_DIGITS, sysSel, 0);
+
+ if ((PhoneNumberUtils.isISODigit(sysSel[0]))
+ && (PhoneNumberUtils.isISODigit(sysSel[1]))) {
+ String sysSelCode = new String(sysSel);
+ sysSelCodeInt = Integer.parseInt((String)sysSelCode);
+ switch (sysSelCodeInt) {
+ case IS683_CONST_800MHZ_A_BAND:
+ case IS683_CONST_800MHZ_B_BAND:
+ case IS683_CONST_1900MHZ_A_BLOCK:
+ case IS683_CONST_1900MHZ_B_BLOCK:
+ case IS683_CONST_1900MHZ_C_BLOCK:
+ case IS683_CONST_1900MHZ_D_BLOCK:
+ case IS683_CONST_1900MHZ_E_BLOCK:
+ case IS683_CONST_1900MHZ_F_BLOCK:
+ isOtaspDialString = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ return isOtaspDialString;
+ }
+
+ /**
+ * isOTASPNumber: checks a given number against the IS-683A OTASP dial string and carrier
+ * OTASP dial string.
+ *
+ * @param dialStr the number to look up.
+ * @return true if the number is in IS-683A OTASP dial string or carrier OTASP dial string
+ */
+ @Override
+ public boolean isOtaSpNumber(String dialStr){
+ boolean isOtaSpNum = false;
+ if(dialStr != null){
+ isOtaSpNum=isIs683OtaSpDialStr(dialStr);
+ if(isOtaSpNum == false){
+ //TO DO:Add carrier specific OTASP number detection here.
+ }
+ }
+ return isOtaSpNum;
+ }
+
@Override
public int getCdmaEriIconIndex() {
int roamInd = getServiceState().getCdmaRoamingIndicator();
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
index a1d362fb600f5..c02fcd4a3a8e2 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java
@@ -24,6 +24,7 @@ import android.os.RegistrantList;
import android.telephony.PhoneNumberUtils;
import android.telephony.ServiceState;
import android.util.Log;
+import android.os.SystemProperties;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.CallTracker;
@@ -31,11 +32,12 @@ import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.DriverCall;
import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneProxy;
+import com.android.internal.telephony.TelephonyProperties;
import java.util.ArrayList;
import java.util.List;
+
/**
* {@hide}
*/
@@ -69,11 +71,12 @@ public final class CdmaCallTracker extends CallTracker {
CdmaConnection pendingMO;
boolean hangupPendingMO;
-
+ boolean pendingCallInECM=false;
CDMAPhone phone;
boolean desiredMute = false; // false = mute off
+ int pendingCallClirMode;
Phone.State state = Phone.State.IDLE;
@@ -115,6 +118,7 @@ public final class CdmaCallTracker extends CallTracker {
}
+ @Override
protected void finalize() {
Log.d(LOG_TAG, "CdmaCallTracker finalized");
}
@@ -204,7 +208,15 @@ public final class CdmaCallTracker extends CallTracker {
// Always unmute when initiating a new call
setMute(false);
- cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
+ String inEcm=SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE, "false");
+ if(inEcm.equals("false")) {
+ cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
+ } else {
+ phone.exitEmergencyCallbackMode();
+ phone.setOnEcbModeExitResponse(this,EVENT_EXIT_ECM_RESPONSE_CDMA, null);
+ pendingCallClirMode=clirMode;
+ pendingCallInECM=true;
+ }
}
updatePhoneState();
@@ -536,6 +548,9 @@ public final class CdmaCallTracker extends CallTracker {
droppedDuringPoll.add(pendingMO);
pendingMO = null;
hangupPendingMO = false;
+ if( pendingCallInECM) {
+ pendingCallInECM = false;
+ }
}
if (newRinging != null) {
@@ -847,8 +862,17 @@ public final class CdmaCallTracker extends CallTracker {
handleRadioNotAvailable();
break;
+ case EVENT_EXIT_ECM_RESPONSE_CDMA:
+ //no matter the result, we still do the same here
+ if (pendingCallInECM) {
+ cm.dial(pendingMO.address, pendingCallClirMode, obtainCompleteMessage());
+ pendingCallInECM = false;
+ }
+ phone.unsetOnEcbModeExitResponse(this);
+ break;
+
default:{
- throw new RuntimeException("unexpected event not handled");
+ throw new RuntimeException("unexpected event not handled");
}
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java
deleted file mode 100644
index 64841d7ed0328..0000000000000
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaiting.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony.cdma;
-
-import com.android.internal.telephony.CdmaInformationRecord;
-
-public class CdmaCallWaiting {
- public String number;
- public int numberPresentation;
- public String name;
-
- public CdmaInformationRecord.CdmaSignalInfoRec signalInfoRecord =
- new CdmaInformationRecord.CdmaSignalInfoRec();
-
- @Override
- public String toString() {
- return "CdmaCallWaiting: {" + " number: " + number + " numberPresentation: "
- + numberPresentation + " name: " + name + " signalInfoRecord: "
- + signalInfoRecord + " }";
- }
-}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
new file mode 100644
index 0000000000000..54dec48e84354
--- /dev/null
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.telephony.cdma;
+
+/**
+ * Represents a Supplementary Service Notification received from the network.
+ *
+ * {@hide}
+ */
+public class CdmaCallWaitingNotification {
+ public String number =null;
+ public int numberPresentation = 0;
+ public String name = null;
+ public int namePresentation = 0;
+ public int isPresent = 0;
+ public int signalType = 0;
+ public int alertPitch = 0;
+ public int signal = 0;
+
+
+ public String toString()
+ {
+ return super.toString() + "Call Waiting Notification "
+ + " number: " + number
+ + " numberPresentation: " + numberPresentation
+ + " name: " + name
+ + " namePresentation: " + namePresentation
+ + " isPresent: " + isPresent
+ + " signalType: " + signalType
+ + " alertPitch: " + alertPitch
+ + " signal: " + signal ;
+ }
+
+}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
index 0a237c6fb942c..32442f60a0b30 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaConnection.java
@@ -48,7 +48,7 @@ public class CdmaConnection extends Connection {
String postDialString; // outgoing calls only
boolean isIncoming;
boolean disconnected;
-
+ String cnapName;
int index; // index in CdmaCallTracker.connections[], -1 if unassigned
/*
@@ -74,6 +74,8 @@ public class CdmaConnection extends Connection {
DisconnectCause cause = DisconnectCause.NOT_DISCONNECTED;
PostDialState postDialState = PostDialState.NOT_STARTED;
int numberPresentation = Connection.PRESENTATION_ALLOWED;
+ int cnapNamePresentation = Connection.PRESENTATION_ALLOWED;
+
Handler h;
@@ -86,10 +88,19 @@ public class CdmaConnection extends Connection {
static final int EVENT_WAKE_LOCK_TIMEOUT = 4;
//***** Constants
- static final int PAUSE_DELAY_FIRST_MILLIS = 100;
- static final int PAUSE_DELAY_MILLIS = 3 * 1000;
static final int WAKE_LOCK_TIMEOUT_MILLIS = 60*1000;
-
+ static final int PAUSE_DELAY_MILLIS = 2 * 1000;
+
+ // TODO(Moto): These should be come from a resourse file
+ // at a minimum as different carriers may want to use
+ // different characters and our general default is "," & ";".
+ // Furthermore Android supports contacts that have phone
+ // numbers entered as strings so '1-800-164flowers' would not
+ // be handled as expected. Both issues need to be resolved.
+ static final char CUSTOMERIZED_WAIT_CHAR_UPPER ='W';
+ static final char CUSTOMERIZED_WAIT_CHAR_LOWER ='w';
+ static final char CUSTOMERIZED_PAUSE_CHAR_UPPER ='P';
+ static final char CUSTOMERIZED_PAUSE_CHAR_LOWER ='p';
//***** Inner Classes
class MyHandler extends Handler {
@@ -126,6 +137,8 @@ public class CdmaConnection extends Connection {
isIncoming = dc.isMT;
createTime = System.currentTimeMillis();
+ cnapName = dc.name;
+ cnapNamePresentation = dc.namePresentation;
numberPresentation = dc.numberPresentation;
this.index = index;
@@ -134,6 +147,16 @@ public class CdmaConnection extends Connection {
parent.attach(this, dc);
}
+ CdmaConnection () {
+ owner = null;
+ h = null;
+ address = null;
+ index = -1;
+ parent = null;
+ isIncoming = true;
+ createTime = System.currentTimeMillis();
+ }
+
/** This is an MO call, created when dialing */
/*package*/
CdmaConnection (Context context, String dialString, CdmaCallTracker ct, CdmaCall parent) {
@@ -144,6 +167,9 @@ public class CdmaConnection extends Connection {
h = new MyHandler(owner.getLooper());
this.dialString = dialString;
+ Log.d(LOG_TAG, "[CDMAConn] CdmaConnection: dialString=" + dialString);
+ dialString = formatDialString(dialString);
+ Log.d(LOG_TAG, "[CDMAConn] CdmaConnection:formated dialString=" + dialString);
this.address = PhoneNumberUtils.extractNetworkPortion(dialString);
this.postDialString = PhoneNumberUtils.extractPostDialPortion(dialString);
@@ -151,10 +177,15 @@ public class CdmaConnection extends Connection {
index = -1;
isIncoming = false;
+ cnapName = null;
+ cnapNamePresentation = 0;
+ numberPresentation = 0;
createTime = System.currentTimeMillis();
- this.parent = parent;
- parent.attachFake(this, CdmaCall.State.DIALING);
+ if (parent != null) {
+ this.parent = parent;
+ parent.attachFake(this, CdmaCall.State.DIALING);
+ }
}
public void dispose() {
@@ -186,10 +217,22 @@ public class CdmaConnection extends Connection {
return (isIncoming ? "incoming" : "outgoing");
}
+ public String getOrigDialString(){
+ return dialString;
+ }
+
public String getAddress() {
return address;
}
+ public String getCnapName() {
+ return cnapName;
+ }
+
+ public int getCnapNamePresentation() {
+ return cnapNamePresentation;
+ }
+
public CdmaCall getCall() {
return parent;
}
@@ -320,6 +363,16 @@ public class CdmaConnection extends Connection {
}
}
+ /**
+ * Used for 3way call only
+ */
+ void update (CdmaConnection c) {
+ address = c.address;
+ cnapName = c.cnapName;
+ cnapNamePresentation = c.cnapNamePresentation;
+ numberPresentation = c.numberPresentation;
+ }
+
public void cancelPostDial() {
setPostDialState(PostDialState.CANCELLED);
}
@@ -355,7 +408,7 @@ public class CdmaConnection extends Connection {
case CallFailCause.CDMA_LOCKED_UNTIL_POWER_CYCLE:
return DisconnectCause.CDMA_LOCKED_UNTIL_POWER_CYCLE;
case CallFailCause.CDMA_DROP:
- return DisconnectCause.CDMA_DROP;
+ return DisconnectCause.LOST_SIGNAL; // TODO(Moto): wink/dave changed from CDMA_DROP;
case CallFailCause.CDMA_INTERCEPT:
return DisconnectCause.CDMA_INTERCEPT;
case CallFailCause.CDMA_REORDER:
@@ -434,6 +487,20 @@ public class CdmaConnection extends Connection {
changed = true;
}
+ // A null cnapName should be the same as ""
+ if (null != dc.name) {
+ if (cnapName != dc.name) {
+ cnapName = dc.name;
+ changed = true;
+ }
+ } else {
+ cnapName = "";
+ // TODO(Moto): Should changed = true if cnapName wasn't previously ""
+ }
+ log("--dssds----"+cnapName);
+ cnapNamePresentation = dc.namePresentation;
+ numberPresentation = dc.numberPresentation;
+
if (newParent != parent) {
if (parent != null) {
parent.detach(this);
@@ -533,25 +600,13 @@ public class CdmaConnection extends Connection {
if (PhoneNumberUtils.is12Key(c)) {
owner.cm.sendDtmf(c, h.obtainMessage(EVENT_DTMF_DONE));
} else if (c == PhoneNumberUtils.PAUSE) {
- // From TS 22.101:
+ setPostDialState(PostDialState.PAUSE);
- // "The first occurrence of the "DTMF Control Digits Separator"
- // shall be used by the ME to distinguish between the addressing
- // digits (i.e. the phone number) and the DTMF digits...."
-
- if (nextPostDialChar == 1) {
- // The first occurrence.
- // We don't need to pause here, but wait for just a bit anyway
- h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE),
- PAUSE_DELAY_FIRST_MILLIS);
- } else {
- // It continues...
- // "Upon subsequent occurrences of the separator, the UE shall
- // pause again for 3 seconds (\u00B1 20 %) before sending any
- // further DTMF digits."
- h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE),
+ // Upon occurrences of the separator, the UE shall
+ // pause again for 2 seconds before sending any
+ // further DTMF digits.
+ h.sendMessageDelayed(h.obtainMessage(EVENT_PAUSE_DONE),
PAUSE_DELAY_MILLIS);
- }
} else if (c == PhoneNumberUtils.WAIT) {
setPostDialState(PostDialState.WAIT);
} else if (c == PhoneNumberUtils.WILD) {
@@ -563,17 +618,40 @@ public class CdmaConnection extends Connection {
return true;
}
- public String
- getRemainingPostDialString() {
+ public String getRemainingPostDialString() {
if (postDialState == PostDialState.CANCELLED
- || postDialState == PostDialState.COMPLETE
- || postDialString == null
- || postDialString.length() <= nextPostDialChar
- ) {
+ || postDialState == PostDialState.COMPLETE
+ || postDialString == null
+ || postDialString.length() <= nextPostDialChar) {
return "";
}
- return postDialString.substring(nextPostDialChar);
+ String subStr = postDialString.substring(nextPostDialChar);
+ if (subStr != null) {
+ int wIndex = subStr.indexOf(PhoneNumberUtils.WAIT);
+ int pIndex = subStr.indexOf(PhoneNumberUtils.PAUSE);
+
+ // TODO(Moto): Courtesy of jsh; is this simpler expression equivalent?
+ //
+ // if (wIndex > 0 && (wIndex < pIndex || pIndex <= 0)) {
+ // subStr = subStr.substring(0, wIndex);
+ // } else if (pIndex > 0) {
+ // subStr = subStr.substring(0, pIndex);
+ // }
+
+ if (wIndex > 0 && pIndex > 0) {
+ if (wIndex > pIndex) {
+ subStr = subStr.substring(0, pIndex);
+ } else {
+ subStr = subStr.substring(0, wIndex);
+ }
+ } else if (wIndex > 0) {
+ subStr = subStr.substring(0, wIndex);
+ } else if (pIndex > 0) {
+ subStr = subStr.substring(0, pIndex);
+ }
+ }
+ return subStr;
}
@Override
@@ -591,8 +669,7 @@ public class CdmaConnection extends Connection {
releaseWakeLock();
}
- private void
- processNextPostDialChar() {
+ void processNextPostDialChar() {
char c = 0;
Registrant postDialHandler;
@@ -698,21 +775,18 @@ public class CdmaConnection extends Connection {
postDialState = s;
}
- private void
- createWakeLock(Context context) {
- PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ private void createWakeLock(Context context) {
+ PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG);
}
- private void
- acquireWakeLock() {
+ private void acquireWakeLock() {
log("acquireWakeLock");
mPartialWakeLock.acquire();
}
- private void
- releaseWakeLock() {
- synchronized(mPartialWakeLock) {
+ private void releaseWakeLock() {
+ synchronized (mPartialWakeLock) {
if (mPartialWakeLock.isHeld()) {
log("releaseWakeLock");
mPartialWakeLock.release();
@@ -720,6 +794,119 @@ public class CdmaConnection extends Connection {
}
}
+ private static boolean isPause(char c) {
+ if (c == CUSTOMERIZED_PAUSE_CHAR_UPPER || c == CUSTOMERIZED_PAUSE_CHAR_LOWER
+ || c == PhoneNumberUtils.PAUSE) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static boolean isWait(char c) {
+ if (c == CUSTOMERIZED_WAIT_CHAR_LOWER || c == CUSTOMERIZED_WAIT_CHAR_UPPER
+ || c == PhoneNumberUtils.WAIT) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * format string
+ * convert "+" to "011"
+ * handle corner cases for PAUSE/WAIT
+ * If PAUSE/WAIT sequence at the end,ignore them
+ * If PAUSE/WAIT sequence in the middle, then if there is any WAIT
+ * in PAUSE/WAIT sequence, treat them like WAIT
+ * If PAUSE followed by WAIT or WAIT followed by PAUSE in the middle,
+ * treat them like just PAUSE or WAIT
+ */
+ private static String formatDialString(String phoneNumber) {
+ if (phoneNumber == null) {
+ return null;
+ }
+ int length = phoneNumber.length();
+ StringBuilder ret = new StringBuilder();
+
+ // TODO(Moto): Modifying the for loop index is confusing, a
+ // while loop is probably better and overall this code is
+ // hard to follow. If this was routine was refactored and
+ // used several private methods with good names to make it
+ // easier to follow.
+ for (int i = 0; i < length; i++) {
+ char c = phoneNumber.charAt(i);
+
+ if (PhoneNumberUtils.isDialable(c)) {
+ if (c == '+') {
+ // TODO(Moto): Is this valid for "all" countries????
+ // should probably be pulled from a resource based
+ // on current contry code (MCC).
+ ret.append("011");
+ } else {
+ ret.append(c);
+ }
+ } else if (isPause(c) || isWait(c)) {
+ if (i < length - 1) { // if PAUSE/WAIT not at the end
+ int index = 0;
+ boolean wMatched = false;
+ for (index = i + 1; index < length; index++) {
+ char cNext = phoneNumber.charAt(index);
+ // if there is any W inside P/W sequence,mark it
+ if (isWait(cNext)) {
+ wMatched = true;
+ }
+ // if any characters other than P/W chars after P/W sequence
+ // we break out the loop and append the correct
+ if (!isWait(cNext) && !isPause(cNext)) {
+ break;
+ }
+ }
+ if (index == length) {
+ // it means there is no dialable character after PAUSE/WAIT
+ i = length - 1;
+ break;
+ } else {// means index com.android.internal.telephony.CommandsInterface./code>
+ * com.android.internal.telephony.CommandsInterface.
* @param onComplete a callback message when the action is completed.
* @see com.android.internal.telephony.CallForwardInfo for details.
*/
@@ -872,10 +879,10 @@ public interface Phone {
*
* @param commandInterfaceCFReason is one of the valid call forwarding
* CF_REASONS, as defined in
- * com.android.internal.telephony.CommandsInterface./code>
+ * com.android.internal.telephony.CommandsInterface.
* @param commandInterfaceCFAction is one of the valid call forwarding
* CF_ACTIONS, as defined in
- * com.android.internal.telephony.CommandsInterface./code>
+ * com.android.internal.telephony.CommandsInterface.
* @param dialingNumber is the target phone number to forward calls to
* @param timerSeconds is used by CFNRy to indicate the timeout before
* forwarding is attempted.
@@ -1335,10 +1342,16 @@ public interface Phone {
//***** CDMA support methods
+ /*
+ * TODO(Moto) TODO(Teleca): can getCdmaMin, getEsn, getMeid use more generic calls
+ * already defined getXxxx above?
+ */
+
/**
* Retrieves the MIN for CDMA phones.
*/
- String getMin();
+
+ String getCdmaMin();
/**
* Retrieves the ESN for CDMA phones.
@@ -1383,14 +1396,6 @@ public interface Phone {
*/
void queryTTYMode(Message onComplete);
- /**
- * exitEmergencyCallbackMode
- * exits the emergency callback mode
- *
- * @param onComplete a callback message when the action is completed.
- */
- void exitEmergencyCallbackMode(Message onComplete);
-
/**
* Activate or deactivate cell broadcast SMS.
*
@@ -1438,4 +1443,93 @@ public interface Phone {
*/
public String getCdmaEriText();
+ /**
+ * request to exit emergency call back mode
+ * the caller should use setOnECMModeExitResponse
+ * to receive the emergency callback mode exit response
+ */
+ void exitEmergencyCallbackMode();
+
+ /**
+ * this decides if the dial number is OTA(Over the air provision) number or not
+ * @param dialStr is string representing the dialing digit(s)
+ * @return true means the dialStr is OTA number, and false means the dialStr is not OTA number
+ */
+ boolean isOtaSpNumber(String dialStr);
+
+ /**
+ * Register for notifications when CDMA call waiting comes
+ *
+ * @param h Handler that receives the notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+ // TODO(Moto) TODO: Remove when generic implemented
+ void registerForCallWaiting(Handler h, int what, Object obj);
+
+ /**
+ * Unegister for notifications when CDMA Call waiting comes
+ * @param h Handler to be removed from the registrant list.
+ */
+ // TODO(Moto): Remove when generic implemented
+ void unregisterForCallWaiting(Handler h);
+
+
+ /**
+ * Register for signal information notifications from the network.
+ * Message.obj will contain an AsyncResult.
+ * AsyncResult.result will be a SuppServiceNotification instance.
+ *
+ * @param h Handler that receives the notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+
+ void registerForSignalInfo(Handler h, int what, Object obj) ;
+ /**
+ * Unregisters for signal information notifications.
+ * Extraneous calls are tolerated silently
+ *
+ * @param h Handler to be removed from the registrant list.
+ */
+ void unregisterForSignalInfo(Handler h);
+
+ /**
+ * Register for display information notifications from the network.
+ * Message.obj will contain an AsyncResult.
+ * AsyncResult.result will be a SuppServiceNotification instance.
+ *
+ * @param h Handler that receives the notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+ void registerForDisplayInfo(Handler h, int what, Object obj);
+
+ /**
+ * Unregisters for display information notifications.
+ * Extraneous calls are tolerated silently
+ *
+ * @param h Handler to be removed from the registrant list.
+ */
+ void unregisterForDisplayInfo(Handler h) ;
+
+
+ /**
+ * registers for exit emergency call back mode request response
+ *
+ * @param h Handler that receives the notification message.
+ * @param what User-defined message code.
+ * @param obj User object.
+ */
+
+ void setOnEcbModeExitResponse(Handler h, int what, Object obj);
+
+ /**
+ * Unregisters for exit emergency call back mode request response
+ *
+ * @param h Handler to be removed from the registrant list.
+ */
+ void unsetOnEcbModeExitResponse(Handler h);
+
+
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 7234aa39283c1..d856279d89c33 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -100,8 +100,8 @@ public abstract class PhoneBase implements Phone {
protected static final int EVENT_RUIM_RECORDS_LOADED = 21;
protected static final int EVENT_NV_READY = 22;
protected static final int EVENT_SET_ENHANCED_VP = 23;
- protected static final int EVENT_CDMA_CALL_WAITING = 24;
- protected static final int EVENT_EMERGENCY_CALLBACK_MODE = 25;
+ protected static final int EVENT_EMERGENCY_CALLBACK_MODE_ENTER = 24;
+ protected static final int EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE = 25;
// Key used to read/write current CLIR setting
public static final String CLIR_KEY = "clir_key";
@@ -294,36 +294,6 @@ public abstract class PhoneBase implements Phone {
mCM.unregisterForInCallVoicePrivacyOff(h);
}
- // Inherited documentation suffices.
- public void registerForOtaStatusChange(Handler h, int what, Object obj){
- mCM.registerForOtaSessionStatus(h,what,obj);
- }
-
- // Inherited documentation suffices.
- public void unregisterForOtaStatusChange(Handler h){
- mCM.unregisterForOtaSessionStatus(h);
- }
-
- // Inherited documentation suffices.
- public void registerCdmaInformationRecord(Handler h, int what, Object obj){
- mCM.registerCdmaInformationRecord(h,what,obj);
- }
-
- // Inherited documentation suffices.
- public void unregisterCdmaInformationRecord(Handler h){
- mCM.unregisterCdmaInformationRecord(h);
- }
-
- // Inherited documentation suffices.
- public void registerForCdmaCallWaiting(Handler h, int what, Object obj){
- mCM.registerForCdmaCallWaiting(h,what,obj);
- }
-
- // Inherited documentation suffices.
- public void unregisterForCdmaCallWaiting(Handler h){
- mCM.unregisterForCdmaCallWaiting(h);
- }
-
/**
* Notifiy registrants of a new ringing Connection.
* Subclasses of Phone probably want to replace this with a
@@ -630,14 +600,6 @@ public abstract class PhoneBase implements Phone {
Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone.");
}
- /**
- * Send the exit emergency callback mode message
- */
- public void exitEmergencyCallbackMode(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.");
- }
-
/**
* This should only be called in GSM mode.
* Only here for some backward compatibility
@@ -684,6 +646,11 @@ public abstract class PhoneBase implements Phone {
public abstract String getPhoneName();
+ /** @hide */
+ public int getCountVoiceMessages(){
+ return 0;
+ }
+
/**
* Returns the CDMA ERI icon index to display
*/
@@ -710,4 +677,71 @@ public abstract class PhoneBase implements Phone {
return "GSM nw, no ERI";
}
+ public String getCdmaMin() {
+ // 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.");
+ return null;
+ }
+
+ public void sendBurstDtmf(String dtmfString, 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.");
+ }
+
+ public void exitEmergencyCallbackMode() {
+ // 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.");
+ }
+
+ public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
+ // 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.");
+ }
+
+ public void unregisterForCdmaOtaStatusChange(Handler h) {
+ // 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.");
+ }
+
+ public boolean isOtaSpNumber(String dialStr) {
+ // 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.");
+ return false;
+ }
+
+ public void registerForCallWaiting(Handler h, int what, Object obj){
+ // 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.");
+ }
+
+ public void unregisterForCallWaiting(Handler h){
+ // 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.");
+ }
+
+ public void registerForSignalInfo(Handler h, int what, Object obj) {
+ mCM.registerForSignalInfo(h, what, obj);
+ }
+
+ public void unregisterForSignalInfo(Handler h) {
+ mCM.unregisterForSignalInfo(h);
+ }
+
+ public void registerForDisplayInfo(Handler h, int what, Object obj) {
+ mCM.registerForDisplayInfo(h, what, obj);
+ }
+
+ public void unregisterForDisplayInfo(Handler h) {
+ mCM.unregisterForDisplayInfo(h);
+ }
+
+ public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
+ // 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.");
+ }
+
+ public void unsetOnEcbModeExitResponse(Handler h){
+ // 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.");
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index a329cbbaac2c1..7d968f97e5e06 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -306,28 +306,12 @@ public class PhoneProxy extends Handler implements Phone {
mActivePhone.unregisterForInCallVoicePrivacyOff(h);
}
- public void registerCdmaInformationRecord(Handler h, int what, Object obj) {
- mActivePhone.registerCdmaInformationRecord(h,what,obj);
+ public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
+ mActivePhone.registerForCdmaOtaStatusChange(h,what,obj);
}
- public void unregisterCdmaInformationRecord(Handler h) {
- mActivePhone.unregisterCdmaInformationRecord(h);
- }
-
- public void registerForOtaStatusChange(Handler h, int what, Object obj){
- mActivePhone.registerForOtaStatusChange(h,what,obj);
- }
-
- public void unregisterForOtaStatusChange(Handler h){
- mActivePhone.unregisterForOtaStatusChange(h);
- }
-
- public void registerForCdmaCallWaiting(Handler h, int what, Object obj){
- mActivePhone.registerForCdmaCallWaiting(h,what,obj);
- }
-
- public void unregisterForCdmaCallWaiting(Handler h){
- mActivePhone.unregisterForCdmaCallWaiting(h);
+ public void unregisterForCdmaOtaStatusChange(Handler h) {
+ mActivePhone.unregisterForCdmaOtaStatusChange(h);
}
public boolean getIccRecordsLoaded() {
@@ -414,10 +398,6 @@ public class PhoneProxy extends Handler implements Phone {
mActivePhone.stopDtmf();
}
- public void sendBurstDtmf(String dtmfString) {
- mActivePhone.sendBurstDtmf(dtmfString);
- }
-
public void setRadioPower(boolean power) {
mActivePhone.setRadioPower(power);
}
@@ -434,6 +414,10 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getLine1Number();
}
+ public String getCdmaMin() {
+ return mActivePhone.getCdmaMin();
+ }
+
public String getLine1AlphaTag() {
return mActivePhone.getLine1AlphaTag();
}
@@ -446,6 +430,11 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getVoiceMailNumber();
}
+ /** @hide */
+ public int getCountVoiceMessages(){
+ return mActivePhone.getCountVoiceMessages();
+ }
+
public String getVoiceMailAlphaTag() {
return mActivePhone.getVoiceMailAlphaTag();
}
@@ -656,10 +645,6 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getIccSerialNumber();
}
- public String getMin() {
- return mActivePhone.getMin();
- }
-
public String getEsn() {
return mActivePhone.getEsn();
}
@@ -688,10 +673,6 @@ public class PhoneProxy extends Handler implements Phone {
mActivePhone.queryTTYMode(onComplete);
}
- public void exitEmergencyCallbackMode(Message onComplete) {
- mActivePhone.exitEmergencyCallbackMode(onComplete);
- }
-
public void activateCellBroadcastSms(int activate, Message response) {
mActivePhone.activateCellBroadcastSms(activate, response);
}
@@ -720,12 +701,55 @@ public class PhoneProxy extends Handler implements Phone {
return mActivePhone.getCdmaEriIconIndex();
}
+ public String getCdmaEriText() {
+ return mActivePhone.getCdmaEriText();
+ }
+
public int getCdmaEriIconMode() {
return mActivePhone.getCdmaEriIconMode();
}
- public String getCdmaEriText() {
- return mActivePhone.getCdmaEriText();
+ public void sendBurstDtmf(String dtmfString, Message onComplete){
+ mActivePhone.sendBurstDtmf(dtmfString,onComplete);
+ }
+
+ public void exitEmergencyCallbackMode(){
+ mActivePhone.exitEmergencyCallbackMode();
+ }
+
+ public boolean isOtaSpNumber(String dialStr){
+ return mActivePhone.isOtaSpNumber(dialStr);
+ }
+
+ public void registerForCallWaiting(Handler h, int what, Object obj){
+ mActivePhone.registerForCallWaiting(h,what,obj);
+ }
+
+ public void unregisterForCallWaiting(Handler h){
+ mActivePhone.unregisterForCallWaiting(h);
+ }
+
+ public void registerForSignalInfo(Handler h, int what, Object obj) {
+ mActivePhone.registerForSignalInfo(h,what,obj);
+ }
+
+ public void unregisterForSignalInfo(Handler h) {
+ mActivePhone.unregisterForSignalInfo(h);
+ }
+
+ public void registerForDisplayInfo(Handler h, int what, Object obj) {
+ mActivePhone.registerForDisplayInfo(h,what,obj);
+ }
+
+ public void unregisterForDisplayInfo(Handler h) {
+ mActivePhone.unregisterForDisplayInfo(h);
+ }
+
+ public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
+ mActivePhone.setOnEcbModeExitResponse(h,what,obj);
+ }
+
+ public void unsetOnEcbModeExitResponse(Handler h){
+ mActivePhone.unsetOnEcbModeExitResponse(h);
}
}
-
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index 070d233bbdb66..792e67fda7b5e 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -38,11 +38,18 @@ import android.telephony.SmsMessage;
import android.util.Config;
import android.util.Log;
-import com.android.internal.telephony.CdmaInformationRecord;
-import com.android.internal.telephony.cdma.CdmaCallWaiting;
+import com.android.internal.telephony.CallForwardInfo;
+import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.DataCallState;
import com.android.internal.telephony.gsm.NetworkInfo;
import com.android.internal.telephony.gsm.SuppServiceNotification;
+import com.android.internal.telephony.IccCardApplication;
+import com.android.internal.telephony.IccCardStatus;
+import com.android.internal.telephony.IccUtils;
+import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.SmsResponse;
+import com.android.internal.telephony.cdma.CdmaCallWaitingNotification;
+import com.android.internal.telephony.cdma.CdmaInformationRecords;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -1063,10 +1070,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
sendBurstDtmf(String dtmfString, Message result) {
RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BURST_DTMF, result);
- if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
-
rr.mp.writeString(dtmfString);
+ if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
+ + " : " + dtmfString);
+
send(rr);
}
@@ -1992,7 +2000,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break;
case RIL_REQUEST_UDUB: ret = responseVoid(p); break;
case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break;
- case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseInts(p); break;
+ case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
case RIL_REQUEST_REGISTRATION_STATE: ret = responseStrings(p); break;
case RIL_REQUEST_GPRS_REGISTRATION_STATE: ret = responseStrings(p); break;
case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break;
@@ -2187,7 +2195,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: ret = responseInts(p); break;
case RIL_UNSOL_ON_USSD: ret = responseStrings(p); break;
case RIL_UNSOL_NITZ_TIME_RECEIVED: ret = responseString(p); break;
- case RIL_UNSOL_SIGNAL_STRENGTH: ret = responseInts(p); break;
+ case RIL_UNSOL_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break;
case RIL_UNSOL_DATA_CALL_LIST_CHANGED: ret = responseDataCallList(p);break;
case RIL_UNSOL_SUPP_SVC_NOTIFICATION: ret = responseSuppServiceNotification(p); break;
case RIL_UNSOL_STK_SESSION_END: ret = responseVoid(p); break;
@@ -2205,7 +2213,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
case RIL_UNSOL_CDMA_CALL_WAITING: ret = responseCdmaCallWaiting(p); break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: ret = responseInts(p); break;
- case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break;
+ case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInfoRec(p); break;
case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break;
default:
@@ -2391,10 +2399,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
break;
case RIL_UNSOL_CALL_RING:
- if (RILJ_LOGD) unsljLog(response);
+ if (RILJ_LOGD) unsljLogRet(response, ret);
if (mRingRegistrant != null) {
- mRingRegistrant.notifyRegistrant();
+ mRingRegistrant.notifyRegistrant(
+ new AsyncResult (null, ret, null));
}
break;
@@ -2434,13 +2443,6 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
break;
- case RIL_UNSOL_OEM_HOOK_RAW:
- if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret));
- if (mUnsolOemHookRawRegistrant != null) {
- mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null));
- }
- break;
-
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
if (RILJ_LOGD) unsljLog(response);
@@ -2452,25 +2454,46 @@ public final class RIL extends BaseCommands implements CommandsInterface {
case RIL_UNSOL_CDMA_CALL_WAITING:
if (RILJ_LOGD) unsljLog(response);
- if(mCallWaitingRegistrants != null) {
- mCallWaitingRegistrants.notifyRegistrants(new AsyncResult (null, ret, null));
+ if (mCallWaitingInfoRegistrants != null) {
+ mCallWaitingInfoRegistrants.notifyRegistrants(
+ new AsyncResult (null, ret, null));
}
break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
- if (RILJ_LOGD) unsljLog(response);
+ if (RILJ_LOGD) unsljLogRet(response, ret);
- if (mOtaSessionRegistrants != null) {
- mOtaSessionRegistrants.notifyRegistrants(new AsyncResult(null, ret, null));
+ if (mOtaProvisionRegistrants != null) {
+ mOtaProvisionRegistrants.notifyRegistrants(
+ new AsyncResult (null, ret, null));
}
break;
case RIL_UNSOL_CDMA_INFO_REC:
- if (RILJ_LOGD)
- unsljLog(response);
- if (mInformationRecordsRegistrants != null) {
- mInformationRecordsRegistrants.notifyRegistrants(new AsyncResult(null, ret,
- null));
+ if (RILJ_LOGD) unsljLog(response);
+
+ CdmaInformationRecords infoRec = (CdmaInformationRecords) ret;
+ if (infoRec.isDispInfo) {
+ if (mDisplayInfoRegistrants != null) {
+ if (RILJ_LOGD) unsljLogRet(response, infoRec.cdmaDisplayInfoRecord);
+
+ mDisplayInfoRegistrants.notifyRegistrants(
+ new AsyncResult (null, infoRec.cdmaDisplayInfoRecord, null));
+ }
+ }
+ if (infoRec.isSignInfo) {
+ if (mSignalInfoRegistrants != null) {
+ if (RILJ_LOGD) unsljLogRet(response, infoRec.cdmaSignalInfoRecord);
+ mSignalInfoRegistrants.notifyRegistrants(
+ new AsyncResult (null, infoRec.cdmaSignalInfoRecord, null));
+ }
+ }
+ break;
+
+ case RIL_UNSOL_OEM_HOOK_RAW:
+ if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret));
+ if (mUnsolOemHookRawRegistrant != null) {
+ mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null));
}
break;
}
@@ -2721,11 +2744,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
dc.als = p.readInt();
voiceSettings = p.readInt();
dc.isVoice = (0 == voiceSettings) ? false : true;
-
- //dc.isVoicePrivacy = (0 != p.readInt());
int voicePrivacy = p.readInt();
dc.isVoicePrivacy = (0 != voicePrivacy);
-
dc.number = p.readString();
int np = p.readInt();
dc.numberPresentation = DriverCall.presentationFromCLIP(np);
@@ -2834,15 +2854,48 @@ public final class RIL extends BaseCommands implements CommandsInterface {
private Object
responseCDMA_BR_CNF(Parcel p) {
- int numInts;
+ int numServiceCategories;
int response[];
- numInts = p.readInt();
+ numServiceCategories = p.readInt();
+ if (numServiceCategories == 0) {
+ int numInts;
+ numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1;
+ response = new int[numInts];
+
+ // Indicate that a zero length table was received
+ response[0] = 0; // TODO(Moto): This is very strange, please explain why.
+
+ // Loop over CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES set 'english' as
+ // default language and selection status to false
+ for (int i = 1; i < numInts; i += CDMA_BSI_NO_OF_INTS_STRUCT ) {
+ response[i + 0] = i / CDMA_BSI_NO_OF_INTS_STRUCT;
+ response[i + 1] = 1;
+ response[i + 2] = 0;
+ }
+ } else {
+ int numInts;
+ numInts = (numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT) + 1;
+ response = new int[numInts];
+
+ response[0] = numServiceCategories;
+ for (int i = 1 ; i < numInts; i++) {
+ response[i] = p.readInt();
+ }
+ }
+
+ return response;
+ }
+
+ private Object
+ responseSignalStrength(Parcel p) {
+ int numInts = 7;
+ int response[];
+
+ /* TODO: Add SignalStrength class to match RIL_SignalStrength */
response = new int[numInts];
-
- response[0] = numInts;
- for (int i = 1 ; i < numInts; i++) {
+ for (int i = 0 ; i < numInts ; i++) {
response[i] = p.readInt();
}
@@ -2850,105 +2903,81 @@ public final class RIL extends BaseCommands implements CommandsInterface {
}
private Object
- responseCdmaInformationRecord(Parcel p){
+ responseCdmaInfoRec(Parcel p) {
+ int infoRecordName;
+ CdmaInformationRecords records = new CdmaInformationRecords();
- int num;
- ArrayList
+ *
*
+ *
+ *
+ *