diff options
Diffstat (limited to 'java/com/android/dialer/app')
6 files changed, 38 insertions, 25 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index fa73bb251..1c106a720 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -547,7 +547,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder case CallbackAction.VOICE: if (mCallLogCache.isVoicemailNumber(accountHandle, number)) { // Call to generic voicemail number, in case there are multiple accounts - primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider()); + primaryActionButtonView.setTag(IntentProvider.getReturnVoicemailCallIntentProvider(null)); } else if (canSupportAssistedDialing()) { primaryActionButtonView.setTag( IntentProvider.getAssistedDialIntentProvider( diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java index c812bf83b..36e62c379 100644 --- a/java/com/android/dialer/app/calllog/IntentProvider.java +++ b/java/com/android/dialer/app/calllog/IntentProvider.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.ContactsContract; +import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; import com.android.contacts.common.model.Contact; @@ -32,7 +33,6 @@ import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.duo.DuoComponent; -import com.android.dialer.util.CallUtil; import com.android.dialer.util.IntentUtil; import java.util.ArrayList; @@ -100,11 +100,12 @@ public abstract class IntentProvider { }; } - public static IntentProvider getReturnVoicemailCallIntentProvider() { + public static IntentProvider getReturnVoicemailCallIntentProvider( + @Nullable PhoneAccountHandle phoneAccountHandle) { return new IntentProvider() { @Override public Intent getIntent(Context context) { - return new CallIntentBuilder(CallUtil.getVoicemailUri(), CallInitiationType.Type.CALL_LOG) + return CallIntentBuilder.forVoicemail(phoneAccountHandle, CallInitiationType.Type.CALL_LOG) .build(); } }; diff --git a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java index 9c8b1469e..4786ca665 100644 --- a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java @@ -66,7 +66,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_activating_title), context.getString(R.string.voicemail_error_activating_message), - VoicemailErrorMessage.createCallVoicemailAction(context)); + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle())); } if (Status.NOTIFICATION_CHANNEL_STATE_NO_CONNECTION == status.notificationChannelState) { @@ -77,7 +77,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_activation_failed_title), context.getString(R.string.voicemail_error_activation_failed_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -85,7 +85,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_no_data_title), context.getString(R.string.voicemail_error_no_data_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -93,7 +93,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_no_data_title), context.getString(R.string.voicemail_error_no_data_cellular_required_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -101,7 +101,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_bad_config_title), context.getString(R.string.voicemail_error_bad_config_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -109,7 +109,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_communication_title), context.getString(R.string.voicemail_error_communication_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -117,7 +117,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_server_title), context.getString(R.string.voicemail_error_server_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } @@ -125,7 +125,7 @@ public class OmtpVoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.voicemail_error_server_connection_title), context.getString(R.string.voicemail_error_server_connection_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), VoicemailErrorMessage.createRetryAction(context, status)); } diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java index ab269f693..7cc6cda45 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java @@ -25,11 +25,12 @@ import android.support.annotation.Nullable; import android.telecom.PhoneAccountHandle; import android.view.View; import android.view.View.OnClickListener; +import com.android.dialer.callintent.CallInitiationType; +import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.Assert; import com.android.dialer.common.PerAccountSharedPreferences; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; -import com.android.dialer.util.CallUtil; import com.android.dialer.voicemail.settings.VoicemailChangePinActivity; import com.android.voicemail.VoicemailClient; import com.android.voicemail.VoicemailComponent; @@ -156,15 +157,18 @@ public class VoicemailErrorMessage { } @NonNull - public static Action createCallVoicemailAction(final Context context) { + public static Action createCallVoicemailAction( + final Context context, final PhoneAccountHandle phoneAccountHandle) { return new Action( context.getString(R.string.voicemail_action_call_voicemail), new OnClickListener() { @Override public void onClick(View v) { Logger.get(context).logImpression(DialerImpression.Type.VVM_CALL_VOICEMAIL_CLICKED); - Intent intent = new Intent(Intent.ACTION_CALL, CallUtil.getVoicemailUri()); - context.startActivity(intent); + context.startActivity( + CallIntentBuilder.forVoicemail( + phoneAccountHandle, CallInitiationType.Type.VOICEMAIL_ERROR_MESSAGE) + .build()); } }); } diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailStatus.java b/java/com/android/dialer/app/voicemail/error/VoicemailStatus.java index 1cfbe86d0..a832b5dfb 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailStatus.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailStatus.java @@ -30,6 +30,7 @@ import android.support.v4.os.BuildCompat; import android.telecom.PhoneAccountHandle; import android.telephony.ServiceState; import android.telephony.TelephonyManager; +import android.text.TextUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.database.VoicemailStatusQuery; @@ -293,8 +294,15 @@ public class VoicemailStatus { return cursor.getString(index); } + @Nullable public PhoneAccountHandle getPhoneAccountHandle() { - return new PhoneAccountHandle( - ComponentName.unflattenFromString(phoneAccountComponentName), phoneAccountId); + if (TextUtils.isEmpty(phoneAccountComponentName) || TextUtils.isEmpty(phoneAccountId)) { + return null; + } + ComponentName componentName = ComponentName.unflattenFromString(phoneAccountComponentName); + if (componentName == null) { + return null; + } + return new PhoneAccountHandle(componentName, phoneAccountId); } } diff --git a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java index 748b8142a..d10c7daf8 100644 --- a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java @@ -167,7 +167,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_unknown_user_title), getCustomerSupportString(context, R.string.vvm3_error_unknown_user_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -175,7 +175,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_unknown_device_title), getCustomerSupportString(context, R.string.vvm3_error_unknown_device_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -183,7 +183,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_invalid_password_title), getCustomerSupportString(context, R.string.vvm3_error_invalid_password_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -219,7 +219,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_subscriber_unknown_title), getCustomerSupportString(context, R.string.vvm3_error_subscriber_unknown_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -227,7 +227,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_imap_getquota_error_title), getCustomerSupportString(context, R.string.vvm3_error_imap_getquota_error_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -235,7 +235,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_imap_select_error_title), getCustomerSupportString(context, R.string.vvm3_error_imap_select_error_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } @@ -243,7 +243,7 @@ public class Vvm3VoicemailMessageCreator { return new VoicemailErrorMessage( context.getString(R.string.vvm3_error_imap_error_title), getCustomerSupportString(context, R.string.vvm3_error_imap_error_message), - VoicemailErrorMessage.createCallVoicemailAction(context), + VoicemailErrorMessage.createCallVoicemailAction(context, status.getPhoneAccountHandle()), createCallCustomerSupportAction(context)); } |