diff options
author | Ricky Wai <rickywai@google.com> | 2015-03-19 12:01:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-19 12:01:23 +0000 |
commit | 3638597dbb90113a326bb5e9b0d3af47d1fd8d4c (patch) | |
tree | 0072e91b3eb1ef941474e713d8433fca0ffd78ba /src | |
parent | 360dcb9df1b1119719fb1cdb98cab08161ba9033 (diff) | |
parent | 30ec266bb7d0648c05606acc60a5be20a7a87686 (diff) | |
download | packages_providers_ContactsProvider-3638597dbb90113a326bb5e9b0d3af47d1fd8d4c.zip packages_providers_ContactsProvider-3638597dbb90113a326bb5e9b0d3af47d1fd8d4c.tar.gz packages_providers_ContactsProvider-3638597dbb90113a326bb5e9b0d3af47d1fd8d4c.tar.bz2 |
Merge "Add RawContactsEntity.CORP_CONTENT_URI"
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider2.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index ec6da0c..58d55bf 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -368,6 +368,7 @@ public class ContactsProvider2 extends AbstractContactsProvider private static final int SEARCH_SHORTCUT = 12002; private static final int RAW_CONTACT_ENTITIES = 15001; + private static final int RAW_CONTACT_ENTITIES_CORP = 15002; private static final int PROVIDER_STATUS = 16001; @@ -1201,6 +1202,7 @@ public class ContactsProvider2 extends AbstractContactsProvider RAW_CONTACTS_ID_STREAM_ITEMS_ID); matcher.addURI(ContactsContract.AUTHORITY, "raw_contact_entities", RAW_CONTACT_ENTITIES); + matcher.addURI(ContactsContract.AUTHORITY, "raw_contact_entities_corp", RAW_CONTACT_ENTITIES_CORP); matcher.addURI(ContactsContract.AUTHORITY, "data", DATA); matcher.addURI(ContactsContract.AUTHORITY, "data/#", DATA_ID); @@ -6378,6 +6380,18 @@ public class ContactsProvider2 extends AbstractContactsProvider setTablesAndProjectionMapForRawEntities(qb, uri); break; } + case RAW_CONTACT_ENTITIES_CORP: { + final int corpUserId = UserUtils.getCorpUserId(getContext()); + if (corpUserId < 0) { + // No Corp user or policy not allowed, return empty cursor + final String[] outputProjection = (projection != null) ? projection + : sRawEntityProjectionMap.getColumnNames(); + return new MatrixCursor(outputProjection); + } + final Uri remoteUri = maybeAddUserId(RawContactsEntity.CONTENT_URI, corpUserId); + return getContext().getContentResolver().query(remoteUri, projection, selection, + selectionArgs, sortOrder); + } case RAW_CONTACT_ID_ENTITY: { long rawContactId = Long.parseLong(uri.getPathSegments().get(1)); |