From 7c711fa89ab258e946b2440d94215de8ec18cb36 Mon Sep 17 00:00:00 2001 From: zachh Date: Wed, 20 Dec 2017 13:32:01 -0800 Subject: Fixed crash in PinnedShortcuts. It was expecting only shortcuts for contacts but we also have the "NUI Launcher" shortcut now, so ignore it when attempting to update. Test: unit PiperOrigin-RevId: 179726507 Change-Id: I45e1594250ed70fcd1d18bfead5a9b4e9e46a58b --- java/com/android/dialer/shortcuts/PinnedShortcuts.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/java/com/android/dialer/shortcuts/PinnedShortcuts.java b/java/com/android/dialer/shortcuts/PinnedShortcuts.java index bfcc3df81..6e23a5c21 100644 --- a/java/com/android/dialer/shortcuts/PinnedShortcuts.java +++ b/java/com/android/dialer/shortcuts/PinnedShortcuts.java @@ -46,7 +46,6 @@ import java.util.Map; *

When refreshing pinned shortcuts, we check to make sure that pinned contact information is * still up to date (e.g. photo and name). We also check to see if the contact has been deleted from * the user's contacts, and if so, we disable the pinned shortcut. - * */ @TargetApi(VERSION_CODES.N_MR1) // Shortcuts introduced in N MR1 final class PinnedShortcuts { @@ -107,6 +106,14 @@ final class PinnedShortcuts { // setRank is nonsensical for pinned shortcuts and therefore could not be calculated. continue; } + // Exclude shortcuts like the "Phone NUI" shortcut. + String action = null; + if (shortcutInfo.getIntent() != null) { + action = shortcutInfo.getIntent().getAction(); + } + if (action == null || !action.equals("com.android.dialer.shortcuts.CALL_CONTACT")) { + continue; + } String lookupKey = DialerShortcut.getLookupKeyFromShortcutInfo(shortcutInfo); Uri lookupUri = DialerShortcut.getLookupUriFromShortcutInfo(shortcutInfo); -- cgit v1.2.3