Fix crash when QuickContactActivity opened from dialer
DynamicShortcuts did not do a null check on the lookup key for usage
reporting.
Test
Manual: verify app doesn't crash when opening a non-contact number from dialer
Bug 32512382
Change-Id: Idff54205b336a4976914f29d352d26b80c3ff21d
diff --git a/src/com/android/contacts/DynamicShortcuts.java b/src/com/android/contacts/DynamicShortcuts.java
index f5363f6..fce2f8b 100644
--- a/src/com/android/contacts/DynamicShortcuts.java
+++ b/src/com/android/contacts/DynamicShortcuts.java
@@ -476,7 +476,7 @@
}
public static void reportShortcutUsed(Context context, String lookupKey) {
- if (!CompatUtils.isLauncherShortcutCompatible()) return;
+ if (!CompatUtils.isLauncherShortcutCompatible() || lookupKey == null) return;
final ShortcutManager shortcutManager = (ShortcutManager) context
.getSystemService(Context.SHORTCUT_SERVICE);
shortcutManager.reportShortcutUsed(lookupKey);
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 3597607..52c66d5 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -2275,7 +2275,7 @@
return;
}
- if (!mIsRecreatedInstance && !mShortcutUsageReported) {
+ if (!mIsRecreatedInstance && !mShortcutUsageReported && data != null) {
mShortcutUsageReported = true;
DynamicShortcuts.reportShortcutUsed(QuickContactActivity.this,
data.getLookupKey());