diff options
author | Nancy Chen <nancychen@google.com> | 2014-10-14 13:58:06 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-10-17 14:10:33 -0700 |
commit | f663fa083983a9b417f642e246d0873e0c424bb9 (patch) | |
tree | d83d19a9d4a1a8198ddd0406b764474b88276aac /src | |
parent | f507886d96f74bd7e54c8f430f5c4e5b23a73b79 (diff) |
Make a general call to voicemail when calling back from call log.
A voicemail call log entry is saved with the number of the voicemail
that was called. In the multi-sim case, however, we don't want to call
back to the voicemail number of the original call because it might be
the number of a different phone account.
Bug: 17925501
Change-Id: I528c4039cc227608e040ae71b6b10488376fb357
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 24 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/IntentProvider.java | 9 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 9 |
3 files changed, 29 insertions, 13 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 792d27ab1..bd20d2209 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -669,7 +669,6 @@ public class CallLogAdapter extends GroupingListAdapter views.number = number; views.numberPresentation = numberPresentation; views.callType = callType; - // NOTE: This is currently not being used, but can be used in future versions. views.accountHandle = accountHandle; views.voicemailUri = c.getString(CallLogQuery.VOICEMAIL_URI); // Stash away the Ids of the calls so that we can support deleting a row in the call log. @@ -688,7 +687,13 @@ public class CallLogAdapter extends GroupingListAdapter // Set return call intent, otherwise null. if (PhoneNumberUtilsWrapper.canPlaceCallsTo(number, numberPresentation)) { // Sets the primary action to call the number. - views.primaryActionView.setTag(IntentProvider.getReturnCallIntentProvider(number)); + if (isVoicemailNumber) { + views.primaryActionView.setTag( + IntentProvider.getReturnVoicemailCallIntentProvider()); + } else { + views.primaryActionView.setTag( + IntentProvider.getReturnCallIntentProvider(number)); + } } else { // Number is not callable, so hide button. views.primaryActionView.setTag(null); @@ -985,9 +990,18 @@ public class CallLogAdapter extends GroupingListAdapter PhoneNumberUtilsWrapper.canPlaceCallsTo(views.number, views.numberPresentation); // Set return call intent, otherwise null. if (canPlaceCallToNumber) { - // Sets the primary action to call the number. - views.callBackButtonView.setTag( - IntentProvider.getReturnCallIntentProvider(views.number)); + boolean isVoicemailNumber = + mPhoneNumberUtilsWrapper.isVoicemailNumber(views.accountHandle, views.number); + if (isVoicemailNumber) { + // Make a general call to voicemail to ensure that if there are multiple accounts + // it does not call the voicemail number of a specific phone account. + views.callBackButtonView.setTag( + IntentProvider.getReturnVoicemailCallIntentProvider()); + } else { + // Sets the primary action to call the number. + views.callBackButtonView.setTag( + IntentProvider.getReturnCallIntentProvider(views.number)); + } views.callBackButtonView.setVisibility(View.VISIBLE); views.callBackButtonView.setOnClickListener(mActionListener); } else { diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java index 874d4ca6b..3084e2424 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -65,6 +65,15 @@ public abstract class IntentProvider { }; } + public static IntentProvider getReturnVoicemailCallIntentProvider() { + return new IntentProvider() { + @Override + public Intent getIntent(Context context) { + return CallUtil.getVoicemailIntent(); + } + }; + } + public static IntentProvider getPlayVoicemailIntentProvider(final long rowId, final String voicemailUri) { return new IntentProvider() { diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 7faed07ad..c83a16c08 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -255,13 +255,6 @@ public class DialpadFragment extends AnalyticsFragment private static final String PREF_DIGITS_FILLED_BY_INTENT = "pref_digits_filled_by_intent"; - /** - * Return an Intent for launching voicemail screen. - */ - private static Intent getVoicemailIntent() { - return CallUtil.getCallIntent(Uri.fromParts(PhoneAccount.SCHEME_VOICEMAIL, "", null)); - } - private TelephonyManager getTelephonyManager() { return (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); } @@ -974,7 +967,7 @@ public class DialpadFragment extends AnalyticsFragment } public void callVoicemail() { - DialerUtils.startActivityWithErrorToast(getActivity(), getVoicemailIntent()); + DialerUtils.startActivityWithErrorToast(getActivity(), CallUtil.getVoicemailIntent()); hideAndClearDialpad(false); } |