diff options
author | maxwelb <maxwelb@google.com> | 2017-07-26 10:41:12 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-26 12:11:16 -0700 |
commit | 63e6983c692a79badbb4053a04b4a7d37a092cd4 (patch) | |
tree | fa39aba812fee338965936768f2b55986af551c0 /java/com/android/dialer/app | |
parent | 0ccd38032b058a1897b3e85d20e918592c291ced (diff) |
Handle null number on row expand
As discovered in b/63711486 it's possible for the number to null when we
expand a call log row. Since the EnrichedCallManagerImpl checks that the
number isn't null when we check capabilities, this crashes when EC is
enabled.
This CL fixes the issue by checking for the null value and working
around it as needed. Since the DialerContact proto requires non-null
numbers, I had to protect it's call as well. There's no affect on
CallDetailsActivity and CallComposerActivity since the proto will return
the empty string if number is unset.
Bug: 63711486
Test: GoogleCallLogAdapterTest
PiperOrigin-RevId: 163225329
Change-Id: Id30ad5076523987f1cc93b803d52e85daa6c0e20
Diffstat (limited to 'java/com/android/dialer/app')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogAdapter.java | 7 | ||||
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index bd7cf7715..5fcf59b28 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -344,8 +344,11 @@ public class CallLogAdapter extends GroupingListAdapter // If enriched call capabilities were unknown on the initial load, // viewHolder.isCallComposerCapable may be unset. Check here if we have the capabilities // as a last attempt at getting them before showing the expanded view to the user - EnrichedCallCapabilities capabilities = - getEnrichedCallManager().getCapabilities(viewHolder.number); + EnrichedCallCapabilities capabilities = null; + + if (viewHolder.number != null) { + capabilities = getEnrichedCallManager().getCapabilities(viewHolder.number); + } if (capabilities == null) { capabilities = EnrichedCallCapabilities.NO_CAPABILITIES; diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 01abb47a2..23a00d745 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -164,7 +164,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder * The callable phone number for the current call log entry. Cached here as the call back intent * is set only when the actions ViewStub is inflated. */ - public String number; + @Nullable public String number; /** The post-dial numbers that are dialed following the phone number. */ public String postDialDigits; /** The formatted phone number to display. */ @@ -933,7 +933,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder contact.setNameOrNumber((String) nameOrNumber); } contact.setContactType(getContactType()); - contact.setNumber(number); + if (number != null) { + contact.setNumber(number); + } /* second line of contact view. */ if (!TextUtils.isEmpty(info.name)) { contact.setDisplayNumber(displayNumber); |