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

Commit 6bbbf704 authored by Yan Zhu's avatar Yan Zhu
Browse files

Fix lock held error when setting DO for AAOS

Fixes: 221460888
Fixes: 219871175
Test: manual verification with logcat
Change-Id: I7beef692f01e32e0724273d2f9773e051c81c331
Merged-In: I7beef692f01e32e0724273d2f9773e051c81c331
(cherry picked from commit 335db53f)
parent cb8114be
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -8465,10 +8465,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                    admin.getPackageName(), userId, "set-device-owner");
            Slogf.i(LOG_TAG, "Device owner set: " + admin + " on user " + userId);
        }
        if (setProfileOwnerOnCurrentUserIfNecessary
                && mInjector.userManagerIsHeadlessSystemUserMode()) {
                int currentForegroundUser = getCurrentForegroundUserId();
            int currentForegroundUser;
            synchronized (getLockObject()) {
                currentForegroundUser = getCurrentForegroundUserId();
            }
            Slogf.i(LOG_TAG, "setDeviceOwner(): setting " + admin
                    + " as profile owner on user " + currentForegroundUser);
            // Sets profile owner on current foreground user since
@@ -8479,7 +8483,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        return true;
    }
    }
    @Override
    public boolean hasDeviceOwner() {