diff --git a/src/com/android/phone/CallController.java b/src/com/android/phone/CallController.java
index cf8abea..0b9482d 100644
--- a/src/com/android/phone/CallController.java
+++ b/src/com/android/phone/CallController.java
@@ -356,9 +356,9 @@
         // (This is just a sanity-check; this policy *should* really be
         // enforced in OutgoingCallBroadcaster.onCreate(), which is the
         // main entry point for the CALL and CALL_* intents.)
-        boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(number, mApp);
+        boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mApp, number);
         boolean isPotentialEmergencyNumber =
-                PhoneNumberUtils.isPotentialLocalEmergencyNumber(number, mApp);
+                PhoneNumberUtils.isPotentialLocalEmergencyNumber(mApp, number);
         boolean isEmergencyIntent = Intent.ACTION_CALL_EMERGENCY.equals(intent.getAction());
 
         if (isPotentialEmergencyNumber && !isEmergencyIntent) {
diff --git a/src/com/android/phone/CallLogger.java b/src/com/android/phone/CallLogger.java
index 9e76db4..8322101 100644
--- a/src/com/android/phone/CallLogger.java
+++ b/src/com/android/phone/CallLogger.java
@@ -109,8 +109,8 @@
      */
     public void logCall(CallerInfo ci, String number, int presentation, int callType, long start,
                         long duration) {
-        final boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(number,
-                mApplication);
+        final boolean isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(mApplication,
+                number);
 
         // On some devices, to avoid accidental redialing of
         // emergency numbers, we *never* log emergency calls to
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 61cf3e8..0b1cd0e 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -672,8 +672,8 @@
         // emergency callback mode (ECM) is active.
         boolean isEmergencyCall = false;
         if (connection != null) {
-            isEmergencyCall = PhoneNumberUtils.isLocalEmergencyNumber(connection.getAddress(),
-                    phone.getContext());
+            isEmergencyCall = PhoneNumberUtils.isLocalEmergencyNumber(phone.getContext(),
+                    connection.getAddress());
         }
         boolean isECM = PhoneUtils.isPhoneInEcm(phone);
         if (isEmergencyCall || isECM) {  // disable "Mute" item
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 986c366..f7f5028 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -737,8 +737,8 @@
 
         if (fgPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
             Connection c = fgPhone.getForegroundCall().getLatestConnection();
-            if ((c != null) && (PhoneNumberUtils.isLocalEmergencyNumber(c.getAddress(),
-                                                                        mApplication))) {
+            if ((c != null) && (PhoneNumberUtils.isLocalEmergencyNumber(mApplication,
+                                                                        c.getAddress()))) {
                 if (VDBG) log("onPhoneStateChanged: it is an emergency call.");
                 Call.State callState = fgPhone.getForegroundCall().getState();
                 if (mEmergencyTonePlayerVibrator == null) {
@@ -1039,7 +1039,7 @@
             final String number = c.getAddress();
             final Phone phone = c.getCall().getPhone();
             final boolean isEmergencyNumber =
-                    PhoneNumberUtils.isLocalEmergencyNumber(number, mApplication);
+                    PhoneNumberUtils.isLocalEmergencyNumber(mApplication, number);
 
             if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
                 if ((isEmergencyNumber)
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 26bfc73..db0bb17 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -533,7 +533,7 @@
      */
     private void placeCall() {
         mLastNumber = mDigits.getText().toString();
-        if (PhoneNumberUtils.isLocalEmergencyNumber(mLastNumber, this)) {
+        if (PhoneNumberUtils.isLocalEmergencyNumber(this, mLastNumber)) {
             if (DBG) Log.d(LOG_TAG, "placing call to " + mLastNumber);
 
             // place the call if it is a valid number
diff --git a/src/com/android/phone/OutgoingCallBroadcaster.java b/src/com/android/phone/OutgoingCallBroadcaster.java
index 200071c..636a259 100644
--- a/src/com/android/phone/OutgoingCallBroadcaster.java
+++ b/src/com/android/phone/OutgoingCallBroadcaster.java
@@ -240,7 +240,7 @@
                     && (app.phone.isOtaSpNumber(number))) {
                 if (DBG) Log.v(TAG, "Call is active, a 2nd OTA call cancelled -- returning.");
                 return false;
-            } else if (PhoneNumberUtils.isPotentialLocalEmergencyNumber(number, context)) {
+            } else if (PhoneNumberUtils.isPotentialLocalEmergencyNumber(context, number)) {
                 // Just like 3rd-party apps aren't allowed to place emergency
                 // calls via the ACTION_CALL intent, we also don't allow 3rd
                 // party apps to use the NEW_OUTGOING_CALL broadcast to rewrite
@@ -502,9 +502,9 @@
         // emergency number but might still result in an emergency call
         // with some networks.)
         final boolean isExactEmergencyNumber =
-                (number != null) && PhoneNumberUtils.isLocalEmergencyNumber(number, this);
+                (number != null) && PhoneNumberUtils.isLocalEmergencyNumber(this, number);
         final boolean isPotentialEmergencyNumber =
-                (number != null) && PhoneNumberUtils.isPotentialLocalEmergencyNumber(number, this);
+                (number != null) && PhoneNumberUtils.isPotentialLocalEmergencyNumber(this, number);
         if (VDBG) {
             Log.v(TAG, " - Checking restrictions for number '" + number + "':");
             Log.v(TAG, "     isExactEmergencyNumber     = " + isExactEmergencyNumber);
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index f79f057..291789d 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -2080,8 +2080,8 @@
 
     static boolean isInEmergencyCall(CallManager cm) {
         for (Connection cn : cm.getActiveFgCall().getConnections()) {
-            if (PhoneNumberUtils.isLocalEmergencyNumber(cn.getAddress(),
-                    PhoneGlobals.getInstance())) {
+            if (PhoneNumberUtils.isLocalEmergencyNumber(PhoneGlobals.getInstance(),
+                    cn.getAddress())) {
                 return true;
             }
         }
@@ -2227,8 +2227,8 @@
                      event.getRepeatCount() == 0) {
                 Connection c = phone.getForegroundCall().getLatestConnection();
                 // If it is NOT an emg #, toggle the mute state. Otherwise, ignore the hook.
-                if (c != null && !PhoneNumberUtils.isLocalEmergencyNumber(c.getAddress(),
-                                                                          PhoneGlobals.getInstance())) {
+                if (c != null && !PhoneNumberUtils.isLocalEmergencyNumber(
+                        PhoneGlobals.getInstance(), c.getAddress())) {
                     if (getMute()) {
                         if (DBG) log("handleHeadsetHook: UNmuting...");
                         setMute(false);
