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

Commit 909c8050 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fixed DPMS.setDeviceOwner() permission check." into sc-v2-dev am: ae8b4690

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15908974

Change-Id: I123078134420ba54ea086bee79d150d774ae3a6c
parents 641db014 ae8b4690
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -8414,17 +8414,19 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            mDeviceAdminServiceController.startServiceForOwner(
                    admin.getPackageName(), userId, "set-device-owner");
            Slogf.i(LOG_TAG, "Device owner set: " + admin + " on user " + userId);
            Slogf.i(LOG_TAG, "Device owner set: %s on user %d", admin.flattenToShortString(),
                    userId);
            if (mInjector.userManagerIsHeadlessSystemUserMode()) {
                int currentForegroundUser = getCurrentForegroundUserId();
                Slogf.i(LOG_TAG, "setDeviceOwner(): setting " + admin
                        + " as profile owner on user " + currentForegroundUser);
                Slogf.i(LOG_TAG, "setDeviceOwner(): setting %s as profile owner on user %d",
                        admin.flattenToShortString(), currentForegroundUser);
                // Sets profile owner on current foreground user since
                // the human user will complete the DO setup workflow from there.
                manageUserUnchecked(/* deviceOwner= */ admin, /* profileOwner= */ admin,
                mInjector.binderWithCleanCallingIdentity(() -> manageUserUnchecked(
                        /* deviceOwner= */ admin, /* profileOwner= */ admin,
                        /* managedUser= */ currentForegroundUser, /* adminExtras= */ null,
                        /* showDisclaimer= */ false);
                        /* showDisclaimer= */ false));
            }
            return true;
        }