diff options
author | Stephen Bird <sbird@cyngn.com> | 2016-02-09 16:35:26 -0800 |
---|---|---|
committer | Richard MacGregor <rmacgregor@cyngn.com> | 2016-04-08 10:42:50 -0700 |
commit | 846ec7858c3935676e306a5674474b6e4ae52174 (patch) | |
tree | cc34386f907c982520858e1ba0d7ef2e90e544b0 | |
parent | 553153391872df5c4f3b7357be9c4611321103be (diff) | |
download | android_packages_apps_PhoneCommon-846ec7858c3935676e306a5674474b6e4ae52174.tar.gz android_packages_apps_PhoneCommon-846ec7858c3935676e306a5674474b6e4ae52174.tar.bz2 android_packages_apps_PhoneCommon-846ec7858c3935676e306a5674474b6e4ae52174.zip |
Helper methods for our t9 searches
Change-Id: Ia9edf198bda37efdf6f5ca16c8387a737b99be8b
-rw-r--r-- | src-ambient/incall/CallMethodHelper.java | 9 | ||||
-rw-r--r-- | src-ambient/incall/CallMethodInfo.java | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src-ambient/incall/CallMethodHelper.java b/src-ambient/incall/CallMethodHelper.java index 0474ad9..c1461b8 100644 --- a/src-ambient/incall/CallMethodHelper.java +++ b/src-ambient/incall/CallMethodHelper.java @@ -155,6 +155,15 @@ public class CallMethodHelper { return cmi; } + public static CallMethodInfo getMethodForMimeType(String mimeType) { + for (CallMethodInfo entry : getAllCallMethods().values()) { + if (entry.mMimeType.equals(mimeType)) { + return entry; + } + } + return null; + } + /*** * Registers the client, on register returns boolean if * callMethodInfo data is already collected and the initial broadcast has been sent. diff --git a/src-ambient/incall/CallMethodInfo.java b/src-ambient/incall/CallMethodInfo.java index b68e74d..32125f2 100644 --- a/src-ambient/incall/CallMethodInfo.java +++ b/src-ambient/incall/CallMethodInfo.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.UserHandle; +import android.provider.ContactsContract; import android.telephony.PhoneNumberUtils; import android.telephony.SubscriptionManager; import android.util.Log; @@ -146,11 +147,16 @@ public class CallMethodInfo { } public void placeCall(String origin, String number, Context c, boolean isVideoCall) { - placeCall(origin, number, c, isVideoCall, false); + placeCall(origin, number, c, isVideoCall, false, null); + } + + public void placeCall(String origin, String number, Context c, boolean isVideoCall, boolean + forcePSTN) { + placeCall(origin, number, c, isVideoCall, forcePSTN, null); } public void placeCall(String origin, String number, Context c, boolean isVideoCall, - boolean forcePSTN) { + boolean forcePSTN, String numberMimeType) { StartInCallCallReceiver svcrr = CallMethodHelper.getVoIPResultReceiver(this, origin); StartCallRequest request = new StartCallRequest(number, origin, 0, svcrr); @@ -158,7 +164,8 @@ public class CallMethodInfo { InCallServices.getInstance().startVideoCall( AmbientConnection.CLIENT.get(c), this.mComponent, request); } else { - if (PhoneNumberUtils.isGlobalPhoneNumber(number) || forcePSTN) { + if (forcePSTN || (numberMimeType != null && numberMimeType.equals(ContactsContract + .CommonDataKinds.Phone.CONTENT_ITEM_TYPE))) { InCallServices.getInstance().startOutCall( AmbientConnection.CLIENT.get(c), this.mComponent, request); } else { |