Fixed bug when shortcut to contact has no display name

This happens when there is no displayed name for a contact (e.g., when the
contact only has a physical address but no phone number or email).  This
caused a null pointer exception to be thrown when Launcher2 receives the
broadcasted intent to create a shortcut with a null display name.

If the display name is found to be empty (i.e., null or zero-length),
the string "(No name)" (from R.string.missing_name) is considered to be
the display name, which is consistent with what the People app shows as
the display name.

Bug:6346747
Change-Id: I82c9782cf88d630bd232be323b961809214da8d2
diff --git a/src/com/android/contacts/list/ShortcutIntentBuilder.java b/src/com/android/contacts/list/ShortcutIntentBuilder.java
index 6c593b0..074d7ec 100644
--- a/src/com/android/contacts/list/ShortcutIntentBuilder.java
+++ b/src/com/android/contacts/list/ShortcutIntentBuilder.java
@@ -266,7 +266,12 @@
         Intent intent = new Intent();
         intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
         intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
-        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, displayName);
+        if (TextUtils.isEmpty(displayName)) {
+            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, mContext.getResources().getString(
+                    R.string.missing_name));
+        } else {
+            intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, displayName);
+        }
 
         mListener.onShortcutIntentCreated(contactUri, intent);
     }