diff options
author | wangqi <wangqi@google.com> | 2017-07-14 14:50:36 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-07-24 20:39:07 +0000 |
commit | 4c03fbdae402b836f2612658b3cede368eeb1dc1 (patch) | |
tree | 6c8cb95f38ce355a45fa9751c397511cd32fc276 /java/com/android | |
parent | 4047ed1519e2c61e17a72f3289fcbc2133bfc3f1 (diff) |
Fix NPE when user click on call log.
This is caused by null tag of videoCallButtonView when expanding action view.
Bug: 63710739
Test: none
PiperOrigin-RevId: 162011496
Change-Id: If592be8cd9b05c369e2ff8b51610d93af48834f1
Diffstat (limited to 'java/com/android')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogAdapter.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 41c9d6003..86590ace6 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -368,20 +368,30 @@ public class CallLogAdapter extends GroupingListAdapter } expandViewHolderActions(viewHolder); - if (viewHolder.videoCallButtonView != null - && viewHolder.videoCallButtonView.getVisibility() == View.VISIBLE - && LightbringerComponent.get(mActivity).getLightbringer().getPackageName() != null - && LightbringerComponent.get(mActivity) - .getLightbringer() - .getPackageName() - .equals( - ((IntentProvider) viewHolder.videoCallButtonView.getTag()) - .getIntent(mActivity) - .getPackage())) { + if (isLightbringerCallButtonVisible(viewHolder.videoCallButtonView)) { CallIntentBuilder.increaseLightbringerCallButtonAppearInExpandedCallLogItemCount(); } } } + + private boolean isLightbringerCallButtonVisible(View videoCallButtonView) { + if (videoCallButtonView == null) { + return false; + } + if (videoCallButtonView.getVisibility() != View.VISIBLE) { + return false; + } + IntentProvider intentProvider = (IntentProvider) videoCallButtonView.getTag(); + if (intentProvider == null) { + return false; + } + String packageName = + LightbringerComponent.get(mActivity).getLightbringer().getPackageName(); + if (packageName == null) { + return false; + } + return packageName.equals(intentProvider.getIntent(mActivity).getPackage()); + } }; private void checkMarkCallLogEntry(CallLogListItemViewHolder viewHolder) { |