Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 517260ec authored by Pavel Grafov's avatar Pavel Grafov
Browse files

Acquire lock before calling getDeviceOwnerAdminLocked

Change-Id: I318c7cea8e9b7de2dc9fa05f786524848c9c76dd
Fixes: 79418618
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testKeyManagement
parent b69f7c9e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -5525,11 +5525,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        // If there is a profile owner, redirect to that; otherwise query the device owner.
        ComponentName aliasChooser = getProfileOwner(caller.getIdentifier());
        if (aliasChooser == null && caller.isSystem()) {
            ActiveAdmin deviceOwnerAdmin = getDeviceOwnerAdminLocked();
            synchronized (getLockObject()) {
                final ActiveAdmin deviceOwnerAdmin = getDeviceOwnerAdminLocked();
                if (deviceOwnerAdmin != null) {
                    aliasChooser = deviceOwnerAdmin.info.getComponent();
                }
            }
        }
        if (aliasChooser == null) {
            sendPrivateKeyAliasResponse(null, response);
            return;