summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/contacts/ContactsProvider2.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/providers/contacts/ContactsProvider2.java')
-rw-r--r--src/com/android/providers/contacts/ContactsProvider2.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java
index 47dbf2e..afbec70 100644
--- a/src/com/android/providers/contacts/ContactsProvider2.java
+++ b/src/com/android/providers/contacts/ContactsProvider2.java
@@ -6388,7 +6388,10 @@ public class ContactsProvider2 extends AbstractContactsProvider
break;
}
case RAW_CONTACT_ENTITIES_CORP: {
- final int corpUserId = UserUtils.getCorpUserId(getContext());
+ // As it's protected by android.permission.INTERACT_ACROSS_USERS
+ // already and it is used by Bluetooth application, we do not
+ // check caller-id policy
+ final int corpUserId = UserUtils.getCorpUserId(getContext(), false);
if (corpUserId < 0) {
// No Corp user or policy not allowed, return empty cursor
final String[] outputProjection = (projection != null) ? projection
@@ -6564,8 +6567,10 @@ public class ContactsProvider2 extends AbstractContactsProvider
final Cursor primaryCursor = queryLocal(localUri, projection, selection, selectionArgs,
sortOrder, directoryId, null);
try {
- // TODO: Maybe we want to have a DPM policy for it
- final int corpUserId = UserUtils.getCorpUserId(getContext());
+ // As it's protected by android.permission.INTERACT_ACROSS_USERS
+ // already and it is used by Bluetooth application, we do not
+ // check caller-id policy
+ final int corpUserId = UserUtils.getCorpUserId(getContext(), false);
if (corpUserId < 0) {
// No Corp user or policy not allowed
return primaryCursor;
@@ -6595,7 +6600,7 @@ public class ContactsProvider2 extends AbstractContactsProvider
private Cursor queryEnterpriseIfNecessary(Uri localUri, String[] projection, String selection,
String[] selectionArgs, String sortOrder, String contactIdColumnName) {
- final int corpUserId = UserUtils.getCorpUserId(getContext());
+ final int corpUserId = UserUtils.getCorpUserId(getContext(), true);
// Step 1. Look at the database on the current profile.
if (VERBOSE_LOGGING) {
@@ -6712,6 +6717,14 @@ public class ContactsProvider2 extends AbstractContactsProvider
case Data.CUSTOM_RINGTONE:
builder.add(null);
break;
+ case Contacts.LOOKUP_KEY:
+ final String lookupKey = original.getString(originalColumnIndex);
+ if (TextUtils.isEmpty(lookupKey)) {
+ builder.add(null);
+ } else {
+ builder.add(Contacts.ENTERPRISE_CONTACT_LOOKUP_PREFIX + lookupKey);
+ }
+ break;
default:
if (outputColumnName.equals(contactIdColumnName)) {
// This will be _id if it's PhoneLookup, contacts_id
@@ -8159,7 +8172,7 @@ public class ContactsProvider2 extends AbstractContactsProvider
throw new IllegalArgumentException(
"Photos retrieved by contact ID can only be read.");
}
- final int corpUserId = UserUtils.getCorpUserId(getContext());
+ final int corpUserId = UserUtils.getCorpUserId(getContext(), true);
if (corpUserId < 0) {
// No corp profile or the currrent profile is not the personal.
throw new FileNotFoundException(uri.toString());