diff options
author | Wink Saville <wink@google.com> | 2012-02-08 09:19:19 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-08 09:19:19 -0800 |
commit | 1b6512127b11256b615c3f8e9049494fb0ad4f1b (patch) | |
tree | 7f7a801149cb1e0f5f44da8b5a95eb1ece7fcf40 /telephony | |
parent | a5a6580d17acbad9407a92e7372598aeed3d0a70 (diff) | |
parent | 7c20c4607c4402589ce4800a0c49127876dbc6bd (diff) | |
download | frameworks_base-1b6512127b11256b615c3f8e9049494fb0ad4f1b.zip frameworks_base-1b6512127b11256b615c3f8e9049494fb0ad4f1b.tar.gz frameworks_base-1b6512127b11256b615c3f8e9049494fb0ad4f1b.tar.bz2 |
Merge "Add ril.test.emergency system property."
Diffstat (limited to 'telephony')
6 files changed, 93 insertions, 4 deletions
diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index 893d7a8..35cdf9b 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -715,4 +715,7 @@ public abstract class BaseCommands implements CommandsInterface { "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'"); return retVal; } + + @Override + public void testingEmergencyCall() {} } diff --git a/telephony/java/com/android/internal/telephony/CallTracker.java b/telephony/java/com/android/internal/telephony/CallTracker.java index 31f9e18..958481c 100644 --- a/telephony/java/com/android/internal/telephony/CallTracker.java +++ b/telephony/java/com/android/internal/telephony/CallTracker.java @@ -19,6 +19,8 @@ package com.android.internal.telephony; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; +import android.os.SystemProperties; +import android.text.TextUtils; import android.util.Log; import com.android.internal.telephony.CommandException; @@ -116,6 +118,48 @@ public abstract class CallTracker extends Handler { return pendingOperations == 0; } + /** + * Routine called from dial to check if the number is a test Emergency number + * and if so remap the number. This allows a short emergency number to be remapped + * to a regular number for testing how the frameworks handles emergency numbers + * without actually calling an emergency number. + * + * This is not a full test and is not a substitute for testing real emergency + * numbers but can be useful. + * + * To use this feature set a system property ril.test.emergencynumber to a pair of + * numbers separated by a colon. If the first number matches the number parameter + * this routine returns the second number. Example: + * + * ril.test.emergencynumber=112:1-123-123-45678 + * + * To test Dial 112 take call then hang up on MO device to enter ECM + * see RIL#processSolicited RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND + * + * @param number to test if it should be remapped + * @return the same number or the remapped number. + */ + protected String checkForTestEmergencyNumber(String dialString) { + String testEn = SystemProperties.get("ril.test.emergencynumber"); + if (DBG_POLL) { + log("checkForTestEmergencyNumber: dialString=" + dialString + + " testEn=" + testEn); + } + if (!TextUtils.isEmpty(testEn)) { + String values[] = testEn.split(":"); + log("checkForTestEmergencyNumber: values.length=" + values.length); + if (values.length == 2) { + if (values[0].equals( + android.telephony.PhoneNumberUtils.stripSeparators(dialString))) { + cm.testingEmergencyCall(); + log("checkForTestEmergencyNumber: remap " + + dialString + " to " + values[1]); + dialString = values[1]; + } + } + } + return dialString; + } //***** Overridden from Handler public abstract void handleMessage (Message msg); diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index a0efab2..f7757b3 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -1571,4 +1571,9 @@ public interface CommandsInterface { * @param response a callback message with the String response in the obj field */ public void requestIsimAuthentication(String nonce, Message response); + + /** + * Notifiy that we are testing an emergency call + */ + public void testingEmergencyCall(); } diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index f587fe1..5afc1f3 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -60,6 +60,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; +import java.util.concurrent.atomic.AtomicBoolean; /** * {@hide} @@ -232,6 +233,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { Object mLastNITZTimeInfo; + // When we are testing emergency calls + AtomicBoolean mTestingEmergencyCall = new AtomicBoolean(false); + //***** Events static final int EVENT_SEND = 1; @@ -2213,7 +2217,16 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_GET_IMSI: ret = responseString(p); break; case RIL_REQUEST_HANGUP: ret = responseVoid(p); break; case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break; - case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: ret = responseVoid(p); break; + case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: { + if (mTestingEmergencyCall.getAndSet(false)) { + if (mEmergencyCallbackModeRegistrant != null) { + riljLog("testing emergency call, notify ECM Registrants"); + mEmergencyCallbackModeRegistrant.notifyRegistrant(); + } + } + ret = responseVoid(p); + break; + } case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_UDUB: ret = responseVoid(p); break; @@ -3014,6 +3027,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { num = p.readInt(); response = new ArrayList<DriverCall>(num); + if (RILJ_LOGV) { + riljLog("responseCallList: num=" + num + + " mEmergencyCallbackModeRegistrant=" + mEmergencyCallbackModeRegistrant + + " mTestingEmergencyCall=" + mTestingEmergencyCall.get()); + } for (int i = 0 ; i < num ; i++) { dc = new DriverCall(); @@ -3065,6 +3083,14 @@ public final class RIL extends BaseCommands implements CommandsInterface { Collections.sort(response); + if ((num == 0) && mTestingEmergencyCall.getAndSet(false)) { + if (mEmergencyCallbackModeRegistrant != null) { + riljLog("responseCallList: call ended, testing emergency call," + + " notify ECM Registrants"); + mEmergencyCallbackModeRegistrant.notifyRegistrant(); + } + } + return response; } @@ -3791,4 +3817,13 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } + + /* (non-Javadoc) + * @see com.android.internal.telephony.BaseCommands#testingEmergencyCall() + */ + @Override + public void testingEmergencyCall() { + if (RILJ_LOGD) riljLog("testingEmergencyCall"); + mTestingEmergencyCall.set(true); + } } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java index 83efc51..f918dce 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java @@ -210,7 +210,8 @@ public final class CdmaCallTracker extends CallTracker { return dialThreeWay(dialString); } - pendingMO = new CdmaConnection(phone.getContext(), dialString, this, foregroundCall); + pendingMO = new CdmaConnection(phone.getContext(), checkForTestEmergencyNumber(dialString), + this, foregroundCall); hangupPendingMO = false; if (pendingMO.address == null || pendingMO.address.length() == 0 @@ -259,7 +260,7 @@ public final class CdmaCallTracker extends CallTracker { // Attach the new connection to foregroundCall pendingMO = new CdmaConnection(phone.getContext(), - dialString, this, foregroundCall); + checkForTestEmergencyNumber(dialString), this, foregroundCall); cm.sendCDMAFeatureCode(pendingMO.address, obtainMessage(EVENT_THREE_WAY_DIAL_L2_RESULT_CDMA)); return pendingMO; diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java index 06f310c..425afe6 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmCallTracker.java @@ -198,7 +198,8 @@ public final class GsmCallTracker extends CallTracker { throw new CallStateException("cannot dial in current state"); } - pendingMO = new GsmConnection(phone.getContext(), dialString, this, foregroundCall); + pendingMO = new GsmConnection(phone.getContext(), checkForTestEmergencyNumber(dialString), + this, foregroundCall); hangupPendingMO = false; if (pendingMO.address == null || pendingMO.address.length() == 0 |