summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard MacGregor <rmacgregor@cyngn.com>2016-03-08 09:04:26 -0800
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-08 10:42:51 -0700
commit4a4918041f753438719652320158fff80a4d3482 (patch)
treefc6a3a8399c0e2103a60e5d57680734b1c5088b4
parentf8e338ee9809ef121c156e6c1fa5241acdbf9e2f (diff)
downloadandroid_packages_apps_PhoneCommon-4a4918041f753438719652320158fff80a4d3482.tar.gz
android_packages_apps_PhoneCommon-4a4918041f753438719652320158fff80a4d3482.tar.bz2
android_packages_apps_PhoneCommon-4a4918041f753438719652320158fff80a4d3482.zip
[1/2] MultiSIM: Call using specified SIM
Call using specified SIM from: - T9 Dialpad phone number entry - T9 Dialpad speed dial - T9 Dialpad search quick action (non-contact - 'Call <phone number>') - Contact search results (T9 and regular) Ticket CD-426 Change-Id: I7495da58df8787a5a9c8caebac51842ee6747498
-rw-r--r--src-ambient/incall/CallMethodInfo.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src-ambient/incall/CallMethodInfo.java b/src-ambient/incall/CallMethodInfo.java
index 5751f8a..29352c6 100644
--- a/src-ambient/incall/CallMethodInfo.java
+++ b/src-ambient/incall/CallMethodInfo.java
@@ -23,7 +23,10 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.provider.ContactsContract;
+import android.telecom.PhoneAccountHandle;
+import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
+import android.text.TextUtils;
import android.util.Log;
import com.android.phone.common.ambient.AmbientConnection;
import com.android.phone.common.R;
@@ -211,8 +214,7 @@ public class CallMethodInfo {
/**
* return empty mock call method that represents emergency call only mode
*/
- public static CallMethodInfo getEmergencyCallMethod(Context context) {
- Context ctx = context.getApplicationContext();
+ public static CallMethodInfo getEmergencyCallMethod(Context ctx) {
if (sEmergencyCallMethod == null) {
sEmergencyCallMethod = new CallMethodInfo();
sEmergencyCallMethod.mName =
@@ -227,6 +229,25 @@ public class CallMethodInfo {
return sEmergencyCallMethod;
}
+ public static PhoneAccountHandle getPhoneAccountHandleFromCallMethodInfo(Context ctx,
+ CallMethodInfo callMethodInfo, String number) {
+ CallMethodInfo emergencyCallMethod = getEmergencyCallMethod(ctx);
+ // If no sim is selected, or emergency callmethod selected, or number is
+ // an emergency number, phone account handle should be null, and will use the
+ // default account.
+ // Else, create PhoneAccountHandle from selected callmethod components and
+ // initial call using that account.
+ PhoneAccountHandle handle = null;
+ if (callMethodInfo != null && !callMethodInfo.mIsInCallProvider &&
+ !callMethodInfo.equals(emergencyCallMethod) &&
+ (number == null || !PhoneNumberUtils.isEmergencyNumber(number))) {
+ handle = new PhoneAccountHandle(callMethodInfo.mComponent,
+ callMethodInfo.mId,
+ callMethodInfo.mUserHandle);
+ }
+ return handle;
+ }
+
public void placeCall(String origin, String number, Context c) {
placeCall(origin, number, c, false);
}