diff options
author | Robin Lee <rgl@google.com> | 2015-06-22 23:51:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-22 23:51:02 +0000 |
commit | 58e706d754adaeb59ccea9b8d496d54240c37caf (patch) | |
tree | e14a72f2a2b681ff8dd50ba177e16d7e4633abbc /services/devicepolicy/java/com/android/server | |
parent | 3ab6f9e691fac6eeea1af8fb35bd4c41cdd692ca (diff) | |
parent | deee7735d81107380e8af5e35d4339e85530ee98 (diff) | |
download | frameworks_base-58e706d754adaeb59ccea9b8d496d54240c37caf.zip frameworks_base-58e706d754adaeb59ccea9b8d496d54240c37caf.tar.gz frameworks_base-58e706d754adaeb59ccea9b8d496d54240c37caf.tar.bz2 |
Merge "Let device owners handle onChoosePrivateKey" into mnc-dev
Diffstat (limited to 'services/devicepolicy/java/com/android/server')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 3b62b61..416ea73 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3231,15 +3231,21 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } final UserHandle caller = Binder.getCallingUserHandle(); - final ComponentName profileOwner = getProfileOwner(caller.getIdentifier()); - - if (profileOwner == null) { + // If there is a profile owner, redirect to that; otherwise query the device owner. + ComponentName aliasChooser = getProfileOwner(caller.getIdentifier()); + if (aliasChooser == null && caller.isOwner()) { + ActiveAdmin deviceOwnerAdmin = getDeviceOwnerAdmin(); + if (deviceOwnerAdmin != null) { + aliasChooser = deviceOwnerAdmin.info.getComponent(); + } + } + if (aliasChooser == null) { sendPrivateKeyAliasResponse(null, response); return; } Intent intent = new Intent(DeviceAdminReceiver.ACTION_CHOOSE_PRIVATE_KEY_ALIAS); - intent.setComponent(profileOwner); + intent.setComponent(aliasChooser); intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_SENDER_UID, uid); intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_URI, uri); intent.putExtra(DeviceAdminReceiver.EXTRA_CHOOSE_PRIVATE_KEY_ALIAS, alias); |