diff options
author | Tony Mak <tonymak@google.com> | 2016-05-11 18:32:25 +0100 |
---|---|---|
committer | Victor Chang <vichang@google.com> | 2016-05-16 16:34:58 +0100 |
commit | e2ccf8bff59da2b54fb037557ad93fc4c317c506 (patch) | |
tree | 3327df450d69ffdc76837c09b1d76ec8d16e058b | |
parent | 904516077182cce4ce71a51b27a3ab418ed0f225 (diff) | |
download | android_packages_apps_Messaging-e2ccf8bff59da2b54fb037557ad93fc4c317c506.tar.gz android_packages_apps_Messaging-e2ccf8bff59da2b54fb037557ad93fc4c317c506.tar.bz2 android_packages_apps_Messaging-e2ccf8bff59da2b54fb037557ad93fc4c317c506.zip |
Cleanup enterprise feature in ContactUtil
1. Remove isWorkProfileSupported checking, api level checking is enough.
2. Replace the hardcoded uri with the corresponding api.
BUG=26797244
BUG=28016344
(cherry picked from commit 0d7a1cce157e4ffb26d5fefb9908bbeffcb1d03c)
Change-Id: I76edad19dc6a19aa77b523cb960f716fca08944d
-rw-r--r-- | src/com/android/messaging/util/ContactUtil.java | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/com/android/messaging/util/ContactUtil.java b/src/com/android/messaging/util/ContactUtil.java index 41a1704..94af3ba 100644 --- a/src/com/android/messaging/util/ContactUtil.java +++ b/src/com/android/messaging/util/ContactUtil.java @@ -519,25 +519,15 @@ public class ContactUtil { * Returns if a given contact id belongs to managed profile. */ public static boolean isEnterpriseContactId(final long contactId) { - return isWorkProfileSupported() - && 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); + return OsUtil.isAtLeastL() && ContactsContract.Contacts.isEnterpriseContactId(contactId); } /** * Returns Email lookup uri that will query both primary and corp profile */ private static Uri getEmailContentLookupUri() { - if (isWorkProfileSupported() && OsUtil.isAtLeastM()) { - // TODO: use Email.ENTERPRISE_CONTENT_LOOKUP_URI, which will be available in M SDK API - return Uri.parse("content://com.android.contacts/data/emails/lookup_enterprise"); + if (OsUtil.isAtLeastM()) { + return Email.ENTERPRISE_CONTENT_LOOKUP_URI; } return Email.CONTENT_LOOKUP_URI; } @@ -546,8 +536,7 @@ public class ContactUtil { * Returns PhoneLookup URI. */ public static Uri getPhoneLookupUri() { - // Apply it to M only - if (isWorkProfileSupported() && OsUtil.isAtLeastM()) { + if (OsUtil.isAtLeastM()) { return PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI; } return PhoneLookup.CONTENT_FILTER_URI; |