Do not set profile owner on guest users on headless system user.

The guest user cannot have extra apps, hence the DPC app is not
installed. We could try to bypass that restriction, but it could
cause other issues down the road; besides, on phones the guest
user is not managed neither and DPM doesn't provide an API to
created managed guests.

Test: manual verification using TestDpc
Fixes: 202327386

Change-Id: I02f963bc84325dd73a18abb7103fc34d4960005d
This commit is contained in:
Felipe Leme
2021-10-06 16:43:55 -07:00
parent ef4d26ab45
commit ec902a9694

View File

@@ -10685,7 +10685,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
}
}
if (!mOwners.hasDeviceOwner() || !user.isFull() || user.isManagedProfile()) return;
if (!mOwners.hasDeviceOwner() || !user.isFull() || user.isManagedProfile()
|| user.isGuest()) {
return;
}
if (mInjector.userManagerIsHeadlessSystemUserMode()) {
ComponentName admin = mOwners.getDeviceOwnerComponent();