Loading core/java/android/app/admin/DevicePolicyManager.java +13 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.ContactsContract.Directory; import android.security.Credentials; import android.service.restrictions.RestrictionsReceiver; import android.util.Log; Loading Loading @@ -3379,17 +3380,27 @@ public class DevicePolicyManager { * @hide */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { long directoryId, Intent originalIntent) { if (mService != null) { try { mService.startManagedQuickContact( actualLookupKey, actualContactId, originalIntent); actualLookupKey, actualContactId, directoryId, originalIntent); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Start Quick Contact on the managed profile for the current user, if the policy allows. * @hide */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { startManagedQuickContact(actualLookupKey, actualContactId, Directory.DEFAULT, originalIntent); } /** * Called by a profile owner of a managed profile to set whether bluetooth * devices can access enterprise contacts. Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,7 @@ interface IDevicePolicyManager { void setCrossProfileCallerIdDisabled(in ComponentName who, boolean disabled); boolean getCrossProfileCallerIdDisabled(in ComponentName who); boolean getCrossProfileCallerIdDisabledForUser(int userId); void startManagedQuickContact(String lookupKey, long contactId, in Intent originalIntent); void startManagedQuickContact(String lookupKey, long contactId, long directoryId, in Intent originalIntent); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); boolean getBluetoothContactSharingDisabled(in ComponentName who); Loading core/java/android/provider/ContactsContract.java +7 −2 Original line number Diff line number Diff line Loading @@ -8360,10 +8360,15 @@ public final class ContactsContract { * @hide */ public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, Intent originalIntent) { long directoryId, Intent originalIntent) { final Intent intent = new Intent(ACTION_QUICK_CONTACT); // Rebuild the URI from a lookup key and a contact ID. intent.setData(Contacts.getLookupUri(contactId, lookupKey)); Uri uri = Contacts.getLookupUri(contactId, lookupKey); if (uri != null && directoryId != Directory.DEFAULT) { uri = uri.buildUpon().appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); } intent.setData(uri); // Copy flags and always set NEW_TASK because it won't have a parent activity. intent.setFlags(originalIntent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); Loading core/java/android/provider/ContactsInternal.java +15 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,10 @@ public class ContactsInternal { final List<String> pathSegments = uri.getPathSegments(); final long contactId = ContentUris.parseId(uri); final String lookupKey = pathSegments.get(2); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final long directoryId = (directoryIdStr == null) ? ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE : Long.parseLong(directoryIdStr); // See if it has a corp lookupkey. if (TextUtils.isEmpty(lookupKey) Loading @@ -99,14 +103,24 @@ public class ContactsInternal { return false; // It's not a corp lookup key. } if (!ContactsContract.Contacts.isEnterpriseContactId(contactId)) { throw new IllegalArgumentException("Invalid enterprise contact id: " + contactId); } if (!ContactsContract.Directory.isEnterpriseDirectoryId(directoryId)) { throw new IllegalArgumentException("Invalid enterprise directory id: " + directoryId); } // Launch Quick Contact on the managed profile, if the policy allows. final DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class); final String actualLookupKey = lookupKey.substring( ContactsContract.Contacts.ENTERPRISE_CONTACT_LOOKUP_PREFIX.length()); final long actualContactId = (contactId - ContactsContract.Contacts.ENTERPRISE_CONTACT_ID_BASE); final long actualDirectoryId = (directoryId - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); dpm.startManagedQuickContact(actualLookupKey, actualContactId, originalIntent); dpm.startManagedQuickContact(actualLookupKey, actualContactId, actualDirectoryId, originalIntent); return true; } } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -6076,9 +6076,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { long actualDirectoryId, Intent originalIntent) { final Intent intent = QuickContact.rebuildManagedQuickContactsIntent( actualLookupKey, actualContactId, originalIntent); actualLookupKey, actualContactId, actualDirectoryId, originalIntent); final int callingUserId = UserHandle.getCallingUserId(); final long ident = mInjector.binderClearCallingIdentity(); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +13 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.ContactsContract.Directory; import android.security.Credentials; import android.service.restrictions.RestrictionsReceiver; import android.util.Log; Loading Loading @@ -3379,17 +3380,27 @@ public class DevicePolicyManager { * @hide */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { long directoryId, Intent originalIntent) { if (mService != null) { try { mService.startManagedQuickContact( actualLookupKey, actualContactId, originalIntent); actualLookupKey, actualContactId, directoryId, originalIntent); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Start Quick Contact on the managed profile for the current user, if the policy allows. * @hide */ public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { startManagedQuickContact(actualLookupKey, actualContactId, Directory.DEFAULT, originalIntent); } /** * Called by a profile owner of a managed profile to set whether bluetooth * devices can access enterprise contacts. Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,7 @@ interface IDevicePolicyManager { void setCrossProfileCallerIdDisabled(in ComponentName who, boolean disabled); boolean getCrossProfileCallerIdDisabled(in ComponentName who); boolean getCrossProfileCallerIdDisabledForUser(int userId); void startManagedQuickContact(String lookupKey, long contactId, in Intent originalIntent); void startManagedQuickContact(String lookupKey, long contactId, long directoryId, in Intent originalIntent); void setBluetoothContactSharingDisabled(in ComponentName who, boolean disabled); boolean getBluetoothContactSharingDisabled(in ComponentName who); Loading
core/java/android/provider/ContactsContract.java +7 −2 Original line number Diff line number Diff line Loading @@ -8360,10 +8360,15 @@ public final class ContactsContract { * @hide */ public static Intent rebuildManagedQuickContactsIntent(String lookupKey, long contactId, Intent originalIntent) { long directoryId, Intent originalIntent) { final Intent intent = new Intent(ACTION_QUICK_CONTACT); // Rebuild the URI from a lookup key and a contact ID. intent.setData(Contacts.getLookupUri(contactId, lookupKey)); Uri uri = Contacts.getLookupUri(contactId, lookupKey); if (uri != null && directoryId != Directory.DEFAULT) { uri = uri.buildUpon().appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(directoryId)).build(); } intent.setData(uri); // Copy flags and always set NEW_TASK because it won't have a parent activity. intent.setFlags(originalIntent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); Loading
core/java/android/provider/ContactsInternal.java +15 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,10 @@ public class ContactsInternal { final List<String> pathSegments = uri.getPathSegments(); final long contactId = ContentUris.parseId(uri); final String lookupKey = pathSegments.get(2); final String directoryIdStr = uri.getQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY); final long directoryId = (directoryIdStr == null) ? ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE : Long.parseLong(directoryIdStr); // See if it has a corp lookupkey. if (TextUtils.isEmpty(lookupKey) Loading @@ -99,14 +103,24 @@ public class ContactsInternal { return false; // It's not a corp lookup key. } if (!ContactsContract.Contacts.isEnterpriseContactId(contactId)) { throw new IllegalArgumentException("Invalid enterprise contact id: " + contactId); } if (!ContactsContract.Directory.isEnterpriseDirectoryId(directoryId)) { throw new IllegalArgumentException("Invalid enterprise directory id: " + directoryId); } // Launch Quick Contact on the managed profile, if the policy allows. final DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class); final String actualLookupKey = lookupKey.substring( ContactsContract.Contacts.ENTERPRISE_CONTACT_LOOKUP_PREFIX.length()); final long actualContactId = (contactId - ContactsContract.Contacts.ENTERPRISE_CONTACT_ID_BASE); final long actualDirectoryId = (directoryId - ContactsContract.Directory.ENTERPRISE_DIRECTORY_ID_BASE); dpm.startManagedQuickContact(actualLookupKey, actualContactId, originalIntent); dpm.startManagedQuickContact(actualLookupKey, actualContactId, actualDirectoryId, originalIntent); return true; } }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -6076,9 +6076,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public void startManagedQuickContact(String actualLookupKey, long actualContactId, Intent originalIntent) { long actualDirectoryId, Intent originalIntent) { final Intent intent = QuickContact.rebuildManagedQuickContactsIntent( actualLookupKey, actualContactId, originalIntent); actualLookupKey, actualContactId, actualDirectoryId, originalIntent); final int callingUserId = UserHandle.getCallingUserId(); final long ident = mInjector.binderClearCallingIdentity(); Loading