Emergency Number Implementation for SS & DS
Emergency Number Implementation for Single standby
and Dual Standby
Change-Id: I52ff5ddc962be246902ea07158700bdb46c0c5d7
CRs-Fixed: 1015298, 973763
diff --git a/Android.mk b/Android.mk
index 99c0c64..89bfeff 100755
--- a/Android.mk
+++ b/Android.mk
@@ -36,6 +36,8 @@
$(support_library_root_dir)/v7/appcompat/res \
$(support_library_root_dir)/design/res
+LOCAL_JAVA_LIBRARIES := telephony-common telephony-ext
+
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages android.support.v7.appcompat \
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index 594387e..0afd0b7 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -841,7 +841,9 @@
* repeated calls to isEmergencyNumber.
*/
private void updateEmergencyCallState() {
- mIsEmergencyCall = TelecomCallUtil.isEmergencyCall(mTelecomCall);
+ Uri handle = mTelecomCall.getDetails().getHandle();
+ mIsEmergencyCall = QtiCallUtils.isEmergencyNumber
+ (handle == null ? "" : handle.getSchemeSpecificPart());
}
/**
diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
index f133b62..fa4d671 100644
--- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
@@ -408,7 +408,7 @@
cw.number = info.phoneNumber;
// check to see if these are recognized numbers, and use shortcuts if we can.
- if (PhoneNumberUtils.isLocalEmergencyNumber(context, info.phoneNumber)) {
+ if (QtiCallUtils.isLocalEmergencyNumber(info.phoneNumber)){
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (info.isVoiceMailNumber()) {
cw.event = EVENT_VOICEMAIL_NUMBER;
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index ec36fac..c53ede0 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -29,7 +29,8 @@
package com.android.incallui;
-
+import android.os.IBinder;
+import android.os.RemoteException;
import android.telecom.VideoProfile;
import android.telecom.Connection.VideoProvider;
import android.widget.Toast;
@@ -40,8 +41,11 @@
import android.content.DialogInterface;
import android.telecom.InCallService.VideoCall;
+import java.lang.reflect.*;
import java.util.ArrayList;
+import org.codeaurora.internal.IExtTelephony;
+
/**
* This class contains Qti specific utiltity functions.
*/
@@ -253,4 +257,64 @@
return currentVideoState == VideoProfile.STATE_AUDIO_ONLY &&
isEnabled(VideoProfile.STATE_BIDIRECTIONAL, modifyToVideoState);
}
+
+
+ /**
+ * Returns IExtTelephony handle
+ */
+ public static IExtTelephony getIExtTelephony() {
+ IExtTelephony mExtTelephony = null;
+ try {
+ Class c = Class.forName("android.os.ServiceManager");
+ Method m = c.getMethod("getService",new Class[]{String.class});
+
+ mExtTelephony =
+ IExtTelephony.Stub.asInterface((IBinder)m.invoke(null, "extphone"));
+ } catch (ClassNotFoundException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ } catch (IllegalArgumentException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ } catch (IllegalAccessException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ } catch (InvocationTargetException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ } catch (SecurityException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ } catch (NoSuchMethodException e) {
+ Log.e(LOG_TAG, " ex: " + e);
+ }
+ return mExtTelephony;
+ }
+
+ /**
+ * returns true if it is emrgency number else false
+ */
+ public static boolean isEmergencyNumber(String number) {
+ boolean isEmergencyNumber = false;
+
+ try {
+ isEmergencyNumber = getIExtTelephony().isEmergencyNumber(number);
+ } catch (RemoteException ex) {
+ Log.e(LOG_TAG, "Exception : " + ex);
+ } catch (NullPointerException ex) {
+ Log.e(LOG_TAG, "Exception : " + ex);
+ }
+ return isEmergencyNumber;
+ }
+
+ /**
+ * returns true if it is local emrgency number else false
+ */
+ public static boolean isLocalEmergencyNumber(String number) {
+ boolean isEmergencyNumber = false;
+
+ try {
+ isEmergencyNumber = getIExtTelephony().isLocalEmergencyNumber(number);
+ } catch (RemoteException ex) {
+ Log.e(LOG_TAG, "Exception : " + ex);
+ } catch (NullPointerException ex) {
+ Log.e(LOG_TAG, "Exception : " + ex);
+ }
+ return isEmergencyNumber;
+ }
}