diff options
author | Nancy Chen <nancychen@google.com> | 2014-12-03 16:37:45 -0800 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-12-04 11:13:37 -0800 |
commit | 39c18f27ed2929fae220a9b4a101d8dc7c83e217 (patch) | |
tree | 2a41a65ea870b831418c498703dd909ce271a6f9 /src/com/android/dialer/dialpad | |
parent | 5dee1ce62f9349102d426e7b8285682e22a37152 (diff) |
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
Diffstat (limited to 'src/com/android/dialer/dialpad')
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 321207682..0f5a3331a 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -39,6 +39,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.Settings; import android.telecom.PhoneAccount; +import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; @@ -77,6 +78,7 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.NeededForReflection; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; +import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; @@ -87,6 +89,7 @@ import com.android.phone.common.dialpad.DialpadView; import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; +import java.util.List; /** * Fragment that displays a twelve-key phone dialpad. @@ -908,7 +911,16 @@ public class DialpadFragment extends Fragment // We'll try to initiate voicemail and thus we want to remove irrelevant string. removePreviousDigitIfPossible(); - if (isVoicemailAvailable()) { + List<PhoneAccountHandle> subscriptionAccountHandles = + PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity()); + boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( + getTelecomManager().getUserSelectedOutgoingPhoneAccount()); + boolean multiSim = subscriptionAccountHandles.size() > 1; + + if ((multiSim && !hasUserSelectedDefault) || isVoicemailAvailable()) { + // On a multi-SIM phone, if the user has not selected a default + // subscription, initiate a call to voicemail so they can select an account + // from the "Call with" dialog. callVoicemail(); } else if (getActivity() != null) { // Voicemail is unavailable maybe because Airplane mode is turned on. |