Loading core/java/android/app/admin/DevicePolicyManager.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -3792,14 +3792,15 @@ public class DevicePolicyManager { /** /** * Start Quick Contact on the managed profile for the user, if the policy allows. * Start Quick Contact on the managed profile for the user, if the policy allows. * * @hide * @hide */ */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, long directoryId, Intent originalIntent) { boolean isContactIdIgnored, long directoryId, Intent originalIntent) { if (mService != null) { if (mService != null) { try { try { mService.startManagedQuickContact( mService.startManagedQuickContact(actualLookupKey, actualContactId, actualLookupKey, actualContactId, directoryId, originalIntent); isContactIdIgnored, directoryId, originalIntent); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); } } Loading @@ -3812,7 +3813,7 @@ public class DevicePolicyManager { */ */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { Intent originalIntent) { startManagedQuickContact(actualLookupKey, actualContactId, Directory.DEFAULT, startManagedQuickContact(actualLookupKey, actualContactId, false, Directory.DEFAULT, originalIntent); originalIntent); } } Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -211,7 +211,7 @@ interface IDevicePolicyManager { void setCrossProfileContactsSearchDisabled(in ComponentName who, boolean disabled); void setCrossProfileContactsSearchDisabled(in ComponentName who, boolean disabled); boolean getCrossProfileContactsSearchDisabled(in ComponentName who); boolean getCrossProfileContactsSearchDisabled(in ComponentName who); boolean getCrossProfileContactsSearchDisabledForUser(int userId); boolean getCrossProfileContactsSearchDisabledForUser(int userId); void startManagedQuickContact(String lookupKey, long contactId, long directoryId, in Intent originalIntent); void startManagedQuickContact(String lookupKey, long contactId, boolean isContactIdIgnored, long directoryId, in Intent originalIntent); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); boolean getBluetoothContactSharingDisabled(in ComponentName who); boolean getBluetoothContactSharingDisabled(in ComponentName who); Loading core/java/android/provider/ContactsContract.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -8401,10 +8401,15 @@ public final class ContactsContract { * @hide * @hide */ */ public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, long directoryId, Intent originalIntent) { boolean isContactIdIgnored, long directoryId, Intent originalIntent) { final Intent intent = new Intent(ACTION_QUICK_CONTACT); final Intent intent = new Intent(ACTION_QUICK_CONTACT); // Rebuild the URI from a lookup key and a contact ID. // Rebuild the URI from a lookup key and a contact ID. Uri uri = Contacts.getLookupUri(contactId, lookupKey); Uri uri = null; if (!TextUtils.isEmpty(lookupKey)) { uri = isContactIdIgnored ? Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey) : Contacts.getLookupUri(contactId, lookupKey); } if (uri != null && directoryId != Directory.DEFAULT) { if (uri != null && directoryId != Directory.DEFAULT) { uri = uri.buildUpon().appendQueryParameter( uri = uri.buildUpon().appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); Loading core/java/android/provider/ContactsInternal.java +9 −3 Original line number Original line Diff line number Diff line Loading @@ -42,10 +42,12 @@ public class ContactsInternal { private static final UriMatcher sContactsUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final UriMatcher sContactsUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final int CONTACTS_URI_LOOKUP_ID = 1000; private static final int CONTACTS_URI_LOOKUP_ID = 1000; private static final int CONTACTS_URI_LOOKUP = 1001; static { static { // Contacts URI matching table // Contacts URI matching table final UriMatcher matcher = sContactsUriMatcher; final UriMatcher matcher = sContactsUriMatcher; matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*", CONTACTS_URI_LOOKUP); matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#", CONTACTS_URI_LOOKUP_ID); matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#", CONTACTS_URI_LOOKUP_ID); } } Loading @@ -57,6 +59,7 @@ public class ContactsInternal { final int match = sContactsUriMatcher.match(uri); final int match = sContactsUriMatcher.match(uri); switch (match) { switch (match) { case CONTACTS_URI_LOOKUP: case CONTACTS_URI_LOOKUP_ID: { case CONTACTS_URI_LOOKUP_ID: { if (maybeStartManagedQuickContact(context, intent)) { if (maybeStartManagedQuickContact(context, intent)) { return; // Request handled by DPM. Just return here. return; // Request handled by DPM. Just return here. Loading Loading @@ -89,7 +92,10 @@ public class ContactsInternal { // Decompose into an ID and a lookup key. // Decompose into an ID and a lookup key. final List<String> pathSegments = uri.getPathSegments(); final List<String> pathSegments = uri.getPathSegments(); final long contactId = ContentUris.parseId(uri); final boolean isContactIdIgnored = pathSegments.size() < 4; final long contactId = isContactIdIgnored ? ContactsContract.Contacts.ENTERPRISE_CONTACT_ID_BASE //contact id will be ignored : ContentUris.parseId(uri); final String lookupKey = pathSegments.get(2); final String lookupKey = pathSegments.get(2); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final long directoryId = (directoryIdStr == null) final long directoryId = (directoryIdStr == null) Loading Loading @@ -119,8 +125,8 @@ public class ContactsInternal { final long actualDirectoryId = (directoryId final long actualDirectoryId = (directoryId - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); dpm.startManagedQuickContact(actualLookupKey, actualContactId, actualDirectoryId, dpm.startManagedQuickContact(actualLookupKey, actualContactId, isContactIdIgnored, originalIntent); actualDirectoryId, originalIntent); return true; return true; } } } } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -7041,9 +7041,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override @Override public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, long actualDirectoryId, Intent originalIntent) { boolean isContactIdIgnored, long actualDirectoryId, Intent originalIntent) { final Intent intent = QuickContact.rebuildManagedQuickContactsIntent( final Intent intent = QuickContact.rebuildManagedQuickContactsIntent(actualLookupKey, actualLookupKey, actualContactId, actualDirectoryId, originalIntent); actualContactId, isContactIdIgnored, actualDirectoryId, originalIntent); final int callingUserId = UserHandle.getCallingUserId(); final int callingUserId = UserHandle.getCallingUserId(); final long ident = mInjector.binderClearCallingIdentity(); final long ident = mInjector.binderClearCallingIdentity(); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -3792,14 +3792,15 @@ public class DevicePolicyManager { /** /** * Start Quick Contact on the managed profile for the user, if the policy allows. * Start Quick Contact on the managed profile for the user, if the policy allows. * * @hide * @hide */ */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, long directoryId, Intent originalIntent) { boolean isContactIdIgnored, long directoryId, Intent originalIntent) { if (mService != null) { if (mService != null) { try { try { mService.startManagedQuickContact( mService.startManagedQuickContact(actualLookupKey, actualContactId, actualLookupKey, actualContactId, directoryId, originalIntent); isContactIdIgnored, directoryId, originalIntent); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); } } Loading @@ -3812,7 +3813,7 @@ public class DevicePolicyManager { */ */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { Intent originalIntent) { startManagedQuickContact(actualLookupKey, actualContactId, Directory.DEFAULT, startManagedQuickContact(actualLookupKey, actualContactId, false, Directory.DEFAULT, originalIntent); originalIntent); } } Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -211,7 +211,7 @@ interface IDevicePolicyManager { void setCrossProfileContactsSearchDisabled(in ComponentName who, boolean disabled); void setCrossProfileContactsSearchDisabled(in ComponentName who, boolean disabled); boolean getCrossProfileContactsSearchDisabled(in ComponentName who); boolean getCrossProfileContactsSearchDisabled(in ComponentName who); boolean getCrossProfileContactsSearchDisabledForUser(int userId); boolean getCrossProfileContactsSearchDisabledForUser(int userId); void startManagedQuickContact(String lookupKey, long contactId, long directoryId, in Intent originalIntent); void startManagedQuickContact(String lookupKey, long contactId, boolean isContactIdIgnored, long directoryId, in Intent originalIntent); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); boolean getBluetoothContactSharingDisabled(in ComponentName who); boolean getBluetoothContactSharingDisabled(in ComponentName who); Loading
core/java/android/provider/ContactsContract.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -8401,10 +8401,15 @@ public final class ContactsContract { * @hide * @hide */ */ public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, long directoryId, Intent originalIntent) { boolean isContactIdIgnored, long directoryId, Intent originalIntent) { final Intent intent = new Intent(ACTION_QUICK_CONTACT); final Intent intent = new Intent(ACTION_QUICK_CONTACT); // Rebuild the URI from a lookup key and a contact ID. // Rebuild the URI from a lookup key and a contact ID. Uri uri = Contacts.getLookupUri(contactId, lookupKey); Uri uri = null; if (!TextUtils.isEmpty(lookupKey)) { uri = isContactIdIgnored ? Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey) : Contacts.getLookupUri(contactId, lookupKey); } if (uri != null && directoryId != Directory.DEFAULT) { if (uri != null && directoryId != Directory.DEFAULT) { uri = uri.buildUpon().appendQueryParameter( uri = uri.buildUpon().appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); Loading
core/java/android/provider/ContactsInternal.java +9 −3 Original line number Original line Diff line number Diff line Loading @@ -42,10 +42,12 @@ public class ContactsInternal { private static final UriMatcher sContactsUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final UriMatcher sContactsUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); private static final int CONTACTS_URI_LOOKUP_ID = 1000; private static final int CONTACTS_URI_LOOKUP_ID = 1000; private static final int CONTACTS_URI_LOOKUP = 1001; static { static { // Contacts URI matching table // Contacts URI matching table final UriMatcher matcher = sContactsUriMatcher; final UriMatcher matcher = sContactsUriMatcher; matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*", CONTACTS_URI_LOOKUP); matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#", CONTACTS_URI_LOOKUP_ID); matcher.addURI(ContactsContract.AUTHORITY, "contacts/lookup/*/#", CONTACTS_URI_LOOKUP_ID); } } Loading @@ -57,6 +59,7 @@ public class ContactsInternal { final int match = sContactsUriMatcher.match(uri); final int match = sContactsUriMatcher.match(uri); switch (match) { switch (match) { case CONTACTS_URI_LOOKUP: case CONTACTS_URI_LOOKUP_ID: { case CONTACTS_URI_LOOKUP_ID: { if (maybeStartManagedQuickContact(context, intent)) { if (maybeStartManagedQuickContact(context, intent)) { return; // Request handled by DPM. Just return here. return; // Request handled by DPM. Just return here. Loading Loading @@ -89,7 +92,10 @@ public class ContactsInternal { // Decompose into an ID and a lookup key. // Decompose into an ID and a lookup key. final List<String> pathSegments = uri.getPathSegments(); final List<String> pathSegments = uri.getPathSegments(); final long contactId = ContentUris.parseId(uri); final boolean isContactIdIgnored = pathSegments.size() < 4; final long contactId = isContactIdIgnored ? ContactsContract.Contacts.ENTERPRISE_CONTACT_ID_BASE //contact id will be ignored : ContentUris.parseId(uri); final String lookupKey = pathSegments.get(2); final String lookupKey = pathSegments.get(2); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final long directoryId = (directoryIdStr == null) final long directoryId = (directoryIdStr == null) Loading Loading @@ -119,8 +125,8 @@ public class ContactsInternal { final long actualDirectoryId = (directoryId final long actualDirectoryId = (directoryId - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); dpm.startManagedQuickContact(actualLookupKey, actualContactId, actualDirectoryId, dpm.startManagedQuickContact(actualLookupKey, actualContactId, isContactIdIgnored, originalIntent); actualDirectoryId, originalIntent); return true; return true; } } } }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -7041,9 +7041,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override @Override public void startManagedQuickContact(String actualLookupKey, long actualContactId, public void startManagedQuickContact(String actualLookupKey, long actualContactId, long actualDirectoryId, Intent originalIntent) { boolean isContactIdIgnored, long actualDirectoryId, Intent originalIntent) { final Intent intent = QuickContact.rebuildManagedQuickContactsIntent( final Intent intent = QuickContact.rebuildManagedQuickContactsIntent(actualLookupKey, actualLookupKey, actualContactId, actualDirectoryId, originalIntent); actualContactId, isContactIdIgnored, actualDirectoryId, originalIntent); final int callingUserId = UserHandle.getCallingUserId(); final int callingUserId = UserHandle.getCallingUserId(); final long ident = mInjector.binderClearCallingIdentity(); final long ident = mInjector.binderClearCallingIdentity(); Loading