diff options
author | calderwoodra <calderwoodra@google.com> | 2017-07-12 11:15:24 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-13 13:59:20 -0700 |
commit | 905b5862383011727756ab9e2926a0dda12d9ca9 (patch) | |
tree | ab60c0acb48f582c5a1763f2b0debfdf8a120771 | |
parent | bae68675ed347b934fbbfbcd8238a229d57ef14f (diff) |
Resolve NPE in post call send message prompt.
This issue occurs when users are shown a post call snackbar and their shared
prefs are updated before pressing "send message". This change resolves the
issue by getting the phone number when the prompt is created rather than when
the button is pressed.
Bug: 62294499
Test: PostCallTest#postCall_UpdatedQuickly_PostCallStartedSuccessfully.
PiperOrigin-RevId: 161689241
Change-Id: Ie2c857f6743aa556f993bc3f8e92c8b2b7357c08
-rw-r--r-- | java/com/android/dialer/postcall/PostCall.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index b17a9b66d..6d9ad01a8 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -26,6 +26,7 @@ import android.support.design.widget.Snackbar; import android.telephony.TelephonyManager; import android.view.View; import android.view.View.OnClickListener; +import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProvider; import com.android.dialer.configprovider.ConfigProviderBindings; @@ -84,12 +85,12 @@ public class PostCall { ? activity.getString(R.string.post_call_add_message) : activity.getString(R.string.post_call_send_message); + String number = Assert.isNotNull(getPhoneNumber(activity)); OnClickListener onClickListener = v -> { Logger.get(activity) .logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE_CLICKED); - activity.startActivity( - PostCallActivity.newIntent(activity, getPhoneNumber(activity), isRcsPostCall)); + activity.startActivity(PostCallActivity.newIntent(activity, number, isRcsPostCall)); }; int durationMs = @@ -113,12 +114,13 @@ public class PostCall { "returned from sending a post call message, message sent."); String message = activity.getString(R.string.post_call_message_sent); String addMessage = activity.getString(R.string.view); + String number = Assert.isNotNull(getPhoneNumber(activity)); OnClickListener onClickListener = v -> { Logger.get(activity) .logImpression( DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE_CLICKED); - Intent intent = IntentUtil.getSendSmsIntent(getPhoneNumber(activity)); + Intent intent = IntentUtil.getSendSmsIntent(number); DialerUtils.startActivityWithErrorToast(activity, intent); }; |