diff options
author | qqzhou <qqzhou@codeaurora.org> | 2014-09-17 17:31:29 +0800 |
---|---|---|
committer | Matt Garnes <matt@cyngn.com> | 2014-11-13 17:47:21 -0800 |
commit | 8ff28c89c1e8dac0be47f5ee68735e79a8babd7c (patch) | |
tree | 064399180b16ca24c6b0e73e0ebe62f67133026b /src | |
parent | 3ccc6013f51b4eb26ff898620df768aecffec8e2 (diff) | |
download | android_packages_apps_Dialer-8ff28c89c1e8dac0be47f5ee68735e79a8babd7c.tar.gz android_packages_apps_Dialer-8ff28c89c1e8dac0be47f5ee68735e79a8babd7c.tar.bz2 android_packages_apps_Dialer-8ff28c89c1e8dac0be47f5ee68735e79a8babd7c.zip |
Dialer: fix still popup account select when select IP call
The codes transfer slot id not sub id into phone account, this
account is invalid, so will still popup account select dialog.
We change to transfer sub id not slot id to match phone app.
CRs-Fixed: 722959
Change-Id: Ib8e69ca7635b5ff4c3716eadeac84ab80daaddfd
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 47 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 29 |
2 files changed, 49 insertions, 27 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 9491bb8be..1ce88994c 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -32,6 +32,7 @@ import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.VoicemailContract.Voicemails; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; @@ -731,14 +732,21 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe public void onMenuIpCallBySlot1(MenuItem menuItem) { String prefix = MoreContactUtils.getIPCallPrefix(this, PhoneConstants.SUB1); if (!TextUtils.isEmpty(prefix)) { - ComponentName serviceName = - new ComponentName("com.android.phone", - "com.android.services.telephony.TelephonyConnectionService"); - PhoneAccountHandle account = new PhoneAccountHandle(serviceName, - String.valueOf(PhoneConstants.SUB1)); - Intent callIntent = new Intent(CallUtil.getCallIntent( - prefix + "" + mNumber, account)); - startActivity(callIntent); + long[] subId = SubscriptionManager.getSubId(PhoneConstants.SUB1); + if (subId != null && subId.length >= 1) { + ComponentName serviceName = + new ComponentName("com.android.phone", + "com.android.services.telephony.TelephonyConnectionService"); + PhoneAccountHandle account = new PhoneAccountHandle(serviceName, + String.valueOf(subId[0])); + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + mNumber, account)); + startActivity(callIntent); + } else { + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + mNumber)); + startActivity(callIntent); + } } else { MoreContactUtils.showNoIPNumberDialog(this, PhoneConstants.SUB1); } @@ -747,14 +755,21 @@ public class CallDetailActivity extends AnalyticsActivity implements ProximitySe public void onMenuIpCallBySlot2(MenuItem menuItem) { String prefix = MoreContactUtils.getIPCallPrefix(this, PhoneConstants.SUB2); if (!TextUtils.isEmpty(prefix)) { - ComponentName serviceName = - new ComponentName("com.android.phone", - "com.android.services.telephony.TelephonyConnectionService"); - PhoneAccountHandle account = new PhoneAccountHandle(serviceName, - String.valueOf(PhoneConstants.SUB2)); - Intent callIntent = new Intent(CallUtil.getCallIntent( - prefix + "" + mNumber, account)); - startActivity(callIntent); + long[] subId = SubscriptionManager.getSubId(PhoneConstants.SUB2); + if (subId != null && subId.length >= 1) { + ComponentName serviceName = + new ComponentName("com.android.phone", + "com.android.services.telephony.TelephonyConnectionService"); + PhoneAccountHandle account = new PhoneAccountHandle(serviceName, + String.valueOf(subId[0])); + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + mNumber, account)); + startActivity(callIntent); + } else { + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + mNumber)); + startActivity(callIntent); + } } else { MoreContactUtils.showNoIPNumberDialog(this, PhoneConstants.SUB2); } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index d3ffad4a1..61856f127 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -1134,19 +1134,26 @@ public class DialpadFragment extends AnalyticsFragment mContext = activity; } - private void ipCallBySlot(int subscription) { - String prefix = MoreContactUtils.getIPCallPrefix(mContext, subscription); + private void ipCallBySlot(int slotId) { + String prefix = MoreContactUtils.getIPCallPrefix(mContext, slotId); if (!TextUtils.isEmpty(prefix)) { - ComponentName serviceName = - new ComponentName("com.android.phone", - "com.android.services.telephony.TelephonyConnectionService"); - PhoneAccountHandle account = new PhoneAccountHandle(serviceName, - String.valueOf(subscription)); - Intent callIntent = new Intent(CallUtil.getCallIntent( - prefix + "" + getValidDialNumber(), account)); - startActivity(callIntent); + long[] subId = SubscriptionManager.getSubId(slotId); + if (subId != null && subId.length >= 1) { + ComponentName serviceName = + new ComponentName("com.android.phone", + "com.android.services.telephony.TelephonyConnectionService"); + PhoneAccountHandle account = new PhoneAccountHandle(serviceName, + String.valueOf(subId[0])); + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + getValidDialNumber(), account)); + startActivity(callIntent); + } else { + Intent callIntent = new Intent(CallUtil.getCallIntent( + prefix + getValidDialNumber())); + startActivity(callIntent); + } } else { - MoreContactUtils.showNoIPNumberDialog(mContext, subscription); + MoreContactUtils.showNoIPNumberDialog(mContext, slotId); } } |