From 1076c4946c230612c8eb56dbcdf2e3ca22a624e3 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Wed, 18 Mar 2015 16:36:27 -0700 Subject: Enterprise quick contact 2/2 Now openQuickContact goes thorough DPM. When a lookup URI is build with a lookup key returned by the enterprise lookup APIs for a corp contact, the lookup key will have a special prefix. DPM checks it and launches QC on the work profile, if the policy allows it. Design doc: go/cp2-mnc-enterprise-dd Bug 19546108 Change-Id: Iccba8254269180281af0154f4b9c20cbfff5c27d --- src/com/android/providers/contacts/ContactsProvider2.java | 8 ++++++++ .../src/com/android/providers/contacts/ContactsProvider2Test.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index 47dbf2e..d177651 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -6712,6 +6712,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 diff --git a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java index 6a175ed..0e3c68b 100644 --- a/tests/src/com/android/providers/contacts/ContactsProvider2Test.java +++ b/tests/src/com/android/providers/contacts/ContactsProvider2Test.java @@ -2024,7 +2024,7 @@ public class ContactsProvider2Test extends BaseContactsProvider2Test { rewritten.moveToNext(); column = 0; assertEquals(1000000010L, rewritten.getLong(column++)); // With offset. - assertEquals("key", rewritten.getString(column++)); + assertEquals("c-key", rewritten.getString(column++)); assertEquals("name", rewritten.getString(column++)); assertEquals(123, rewritten.getInt(column++)); assertEquals(456, rewritten.getInt(column++)); -- cgit v1.1