Merge "H14n (holographication) of Contacts"
diff --git a/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java b/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
index b288a29..9ed6ad9 100644
--- a/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
+++ b/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
@@ -69,7 +69,7 @@
if (adapter.getHasPhoneNumber(position)) {
final Context context = mContactListFragment.getContext();
- boolean hasPhoneApp = PhoneCapabilityTester.isPhoneCallIntentRegistered(context);
+ boolean hasPhoneApp = PhoneCapabilityTester.isPhone(context);
boolean hasSmsApp = PhoneCapabilityTester.isSmsIntentRegistered(context);
// Calling contact
if (hasPhoneApp) menu.add(0, MENU_ITEM_CALL, 0, R.string.menu_call);
diff --git a/src/com/android/contacts/util/PhoneCapabilityTester.java b/src/com/android/contacts/util/PhoneCapabilityTester.java
index 4b6c17e..8383617 100644
--- a/src/com/android/contacts/util/PhoneCapabilityTester.java
+++ b/src/com/android/contacts/util/PhoneCapabilityTester.java
@@ -37,11 +37,17 @@
}
/**
- * Returns true if this device has a Phone application installed.
+ * Returns true if this device can be used to make phone calls
*/
- public static boolean isPhoneCallIntentRegistered(Context context) {
- final Intent intent = new Intent(
- Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts(Constants.SCHEME_TEL, "", null));
+ public static boolean isPhone(Context context) {
+ // Is the device physically capabable of making phone calls?
+ if (!context.getResources().getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+ return false;
+ }
+
+ // Is there an app registered that accepts the call intent?
+ final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
+ Uri.fromParts(Constants.SCHEME_TEL, "", null));
return isIntentRegistered(context, intent);
}
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index d61b346..6ac36a8 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -242,7 +242,7 @@
* Build up the entries to display on the screen.
*/
private final void buildEntries() {
- mHasPhone = PhoneCapabilityTester.isPhoneCallIntentRegistered(mContext);
+ mHasPhone = PhoneCapabilityTester.isPhone(mContext);
mHasSms = PhoneCapabilityTester.isSmsIntentRegistered(mContext);
// Clear out the old entries
@@ -799,7 +799,7 @@
// Options only shows telephony-related settings (ringtone, send to voicemail).
// ==> Hide if we don't have a telephone
final MenuItem optionsMenu = menu.findItem(R.id.menu_options);
- final boolean deviceHasPhone = PhoneCapabilityTester.isPhoneCallIntentRegistered(mContext);
+ final boolean deviceHasPhone = PhoneCapabilityTester.isPhone(mContext);
optionsMenu.setVisible(deviceHasPhone);
}
@@ -807,7 +807,7 @@
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_edit: {
- mListener.onEditRequested(mLookupUri);
+ if (mListener != null) mListener.onEditRequested(mLookupUri);
break;
}
case R.id.menu_delete: {
@@ -991,7 +991,7 @@
if (data == ContactLoader.Result.NOT_FOUND) {
// Item has been deleted
Log.i(TAG, "No contact found. Closing activity");
- mListener.onContactNotFound();
+ if (mListener != null) mListener.onContactNotFound();
return;
}
mContactData = data;