am 1cef2289: Disable data call in emergency call

Merge commit '1cef22890d10417977397a5dccf34956858d0803' into eclair-plus-aosp

* commit '1cef22890d10417977397a5dccf34956858d0803':
  Disable data call in emergency call
This commit is contained in:
Guo-Bin Zhang
2009-08-22 07:45:05 -07:00
committed by Android Git Automerger
2 changed files with 32 additions and 0 deletions

View File

@@ -749,6 +749,9 @@ public class CDMAPhone extends PhoneBase {
Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS); Intent intent = new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS);
ActivityManagerNative.broadcastStickyIntent(intent, null); ActivityManagerNative.broadcastStickyIntent(intent, null);
return false; return false;
} else if ((mCT.state == Phone.State.OFFHOOK) && mCT.isInEmergencyCall()) {
// Do not allow data call to be enabled when emergency call is going on
return false;
} else { } else {
return mDataConnection.setDataEnabled(true); return mDataConnection.setDataEnabled(true);
} }

View File

@@ -73,6 +73,7 @@ public final class CdmaCallTracker extends CallTracker {
CdmaConnection pendingMO; CdmaConnection pendingMO;
boolean hangupPendingMO; boolean hangupPendingMO;
boolean pendingCallInEcm=false; boolean pendingCallInEcm=false;
boolean mIsInEmergencyCall = false;
CDMAPhone phone; CDMAPhone phone;
boolean desiredMute = false; // false = mute off boolean desiredMute = false; // false = mute off
@@ -219,6 +220,9 @@ public final class CdmaCallTracker extends CallTracker {
// Always unmute when initiating a new call // Always unmute when initiating a new call
setMute(false); setMute(false);
// Check data call
disableDataCallInEmergencyCall(dialString);
// In Ecm mode, if another emergency call is dialed, Ecm mode will not exit. // In Ecm mode, if another emergency call is dialed, Ecm mode will not exit.
if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) { if(!isPhoneInEcmMode || (isPhoneInEcmMode && isEmergencyCall)) {
cm.dial(pendingMO.address, clirMode, obtainCompleteMessage()); cm.dial(pendingMO.address, clirMode, obtainCompleteMessage());
@@ -245,6 +249,9 @@ public final class CdmaCallTracker extends CallTracker {
private Connection private Connection
dialThreeWay (String dialString) { dialThreeWay (String dialString) {
if (!foregroundCall.isIdle()) { if (!foregroundCall.isIdle()) {
// Check data call
disableDataCallInEmergencyCall(dialString);
// Attach the new connection to foregroundCall // Attach the new connection to foregroundCall
pendingMO = new CdmaConnection(phone.getContext(), pendingMO = new CdmaConnection(phone.getContext(),
dialString, this, foregroundCall); dialString, this, foregroundCall);
@@ -556,6 +563,8 @@ public final class CdmaCallTracker extends CallTracker {
// Re-start Ecm timer when the connected emergency call ends // Re-start Ecm timer when the connected emergency call ends
if (mIsEcmTimerCanceled) { if (mIsEcmTimerCanceled) {
handleEcmTimer(phone.RESTART_ECM_TIMER); handleEcmTimer(phone.RESTART_ECM_TIMER);
} else {
mIsInEmergencyCall = false;
} }
// Dropped connections are removed from the CallTracker // Dropped connections are removed from the CallTracker
@@ -1010,6 +1019,26 @@ public final class CdmaCallTracker extends CallTracker {
} }
} }
/**
* Disable data call when emergency call is connected
*/
private void disableDataCallInEmergencyCall(String dialString) {
if (PhoneNumberUtils.isEmergencyNumber(dialString)) {
phone.disableDataConnectivity();
mIsInEmergencyCall = true;
}
}
/**
* Check if current call is in emergency call
*
* @return true if it is in emergency call
* false if it is not in emergency call
*/
boolean isInEmergencyCall() {
return mIsInEmergencyCall;
}
protected void log(String msg) { protected void log(String msg) {
Log.d(LOG_TAG, "[CdmaCallTracker] " + msg); Log.d(LOG_TAG, "[CdmaCallTracker] " + msg);
} }