Bypass Dialpad code and allow InCallUI check voicemail number for MSIM.
Since user needs to select a subscription before Dialer can check whether a
voicemail number is set up for a certain subscription, go directly to
calling voicemail when the user dials '1' on a MSIM phone where 'Ask
first' is set.
Bug:18233678
Change-Id: I10dd56c14bfb98e4f8410e2de400da44e328682f
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index 2e35019..f466c41 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -205,16 +205,16 @@
final TelecomManager telecomManager =
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
- List<PhoneAccountHandle> phoneAccountHandles =
+ List<PhoneAccountHandle> subscriptionAccountHandles =
PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
- boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount(
- telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles);
+ boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
+ telecomManager.getUserSelectedOutgoingPhoneAccount());
- if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) {
+ if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) {
Uri uri = telecomManager.getAdnUriForPhoneAccount(null);
handleAdnQuery(handler, sc, uri);
- } else if (phoneAccountHandles.size() > 1){
+ } else if (subscriptionAccountHandles.size() > 1){
SelectPhoneAccountListener listener = new SelectPhoneAccountListener() {
@Override
public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle,
@@ -229,7 +229,7 @@
};
SelectPhoneAccountDialogFragment.showAccountDialog(
- ((Activity) context).getFragmentManager(), phoneAccountHandles,
+ ((Activity) context).getFragmentManager(), subscriptionAccountHandles,
listener);
} else {
return false;
@@ -268,16 +268,16 @@
if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) {
final TelecomManager telecomManager =
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
- List<PhoneAccountHandle> phoneAccountHandles =
+ List<PhoneAccountHandle> subscriptionAccountHandles =
PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
- boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount(
- telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles);
+ boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
+ telecomManager.getUserSelectedOutgoingPhoneAccount());
- if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) {
+ if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) {
// Don't bring up the dialog for single-SIM or if the default outgoing account is
// a subscription account.
return telecomManager.handleMmi(input);
- } else if (phoneAccountHandles.size() > 1){
+ } else if (subscriptionAccountHandles.size() > 1){
SelectPhoneAccountListener listener = new SelectPhoneAccountListener() {
@Override
public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle,
@@ -290,7 +290,7 @@
};
SelectPhoneAccountDialogFragment.showAccountDialog(
- ((Activity) context).getFragmentManager(), phoneAccountHandles,
+ ((Activity) context).getFragmentManager(), subscriptionAccountHandles,
listener);
}
return true;
@@ -298,20 +298,6 @@
return false;
}
- /**
- * Check if the default outgoing phone account set is a subscription phone account.
- */
- static private boolean hasDefaultSubscriptionAccount(PhoneAccountHandle defaultOutgoingAccount,
- List<PhoneAccountHandle> phoneAccountHandles) {
- for (PhoneAccountHandle accountHandle : phoneAccountHandles) {
- if (accountHandle.equals(defaultOutgoingAccount)) {
- return true;
- }
- }
- return false;
- }
-
-
// TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a
// hard-coded string.
static boolean handleDeviceIdDisplay(Context context, String input) {