Loading telephony/java/com/android/internal/telephony/BaseCommands.java +3 −0 Original line number Diff line number Diff line Loading @@ -715,4 +715,7 @@ public abstract class BaseCommands implements CommandsInterface { "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'"); return retVal; } @Override public void testingEmergencyCall() {} } telephony/java/com/android/internal/telephony/CallTracker.java +44 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading telephony/java/com/android/internal/telephony/CommandsInterface.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); } telephony/java/com/android/internal/telephony/RIL.java +36 −1 Original line number Diff line number Diff line Loading @@ -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} Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; } Loading Loading @@ -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); } } telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java +3 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading Loading
telephony/java/com/android/internal/telephony/BaseCommands.java +3 −0 Original line number Diff line number Diff line Loading @@ -715,4 +715,7 @@ public abstract class BaseCommands implements CommandsInterface { "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'"); return retVal; } @Override public void testingEmergencyCall() {} }
telephony/java/com/android/internal/telephony/CallTracker.java +44 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading
telephony/java/com/android/internal/telephony/CommandsInterface.java +5 −0 Original line number Diff line number Diff line Loading @@ -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(); }
telephony/java/com/android/internal/telephony/RIL.java +36 −1 Original line number Diff line number Diff line Loading @@ -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} Loading Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; } Loading Loading @@ -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); } }
telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java +3 −2 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; Loading