Disable "Place on Home screen" in corp Contacts
Bug: 17363218
Change-Id: Icef9736986b95358cd74655f0d1a8f1d3ab40b7e
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index f70eb0d..280a384 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1975,6 +1975,14 @@
builder.createContactShortcutIntent(mContactData.getLookupUri());
}
+ private boolean isShortcutCreatable() {
+ final Intent createShortcutIntent = new Intent();
+ createShortcutIntent.setAction(ACTION_INSTALL_SHORTCUT);
+ final List<ResolveInfo> receivers = getPackageManager()
+ .queryBroadcastReceivers(createShortcutIntent, 0);
+ return receivers != null && receivers.size() > 0;
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final MenuInflater inflater = getMenuInflater();
@@ -2007,6 +2015,9 @@
final MenuItem shareMenuItem = menu.findItem(R.id.menu_share);
shareMenuItem.setVisible(isContactShareable());
+ final MenuItem shortcutMenuItem = menu.findItem(R.id.menu_create_contact_shortcut);
+ shortcutMenuItem.setVisible(isShortcutCreatable());
+
return true;
}
return false;