summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java24
-rw-r--r--src/com/android/dialer/calllog/IntentProvider.java9
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java9
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);
}