Merge "Cleanup enterprise feature in ContactUtil am: e2ccf8bff5 am: 50357f8877" into nyc-mr1-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2016-05-16 15:48:01 +00:00
committed by Android (Google) Code Review
@@ -519,25 +519,15 @@ public class ContactUtil {
* Returns if a given contact id belongs to managed profile. * Returns if a given contact id belongs to managed profile.
*/ */
public static boolean isEnterpriseContactId(final long contactId) { public static boolean isEnterpriseContactId(final long contactId) {
return isWorkProfileSupported() return OsUtil.isAtLeastL() && ContactsContract.Contacts.isEnterpriseContactId(contactId);
&& ContactsContract.Contacts.isEnterpriseContactId(contactId);
}
/**
* Returns if managed profile is supported.
*/
public static boolean isWorkProfileSupported() {
final PackageManager pm = Factory.get().getApplicationContext().getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS);
} }
/** /**
* Returns Email lookup uri that will query both primary and corp profile * Returns Email lookup uri that will query both primary and corp profile
*/ */
private static Uri getEmailContentLookupUri() { private static Uri getEmailContentLookupUri() {
if (isWorkProfileSupported() && OsUtil.isAtLeastM()) { if (OsUtil.isAtLeastM()) {
// TODO: use Email.ENTERPRISE_CONTENT_LOOKUP_URI, which will be available in M SDK API return Email.ENTERPRISE_CONTENT_LOOKUP_URI;
return Uri.parse("content://com.android.contacts/data/emails/lookup_enterprise");
} }
return Email.CONTENT_LOOKUP_URI; return Email.CONTENT_LOOKUP_URI;
} }
@@ -546,8 +536,7 @@ public class ContactUtil {
* Returns PhoneLookup URI. * Returns PhoneLookup URI.
*/ */
public static Uri getPhoneLookupUri() { public static Uri getPhoneLookupUri() {
// Apply it to M only if (OsUtil.isAtLeastM()) {
if (isWorkProfileSupported() && OsUtil.isAtLeastM()) {
return PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI; return PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI;
} }
return PhoneLookup.CONTENT_FILTER_URI; return PhoneLookup.CONTENT_FILTER_URI;