Allow DeviceOwner to be set on "mainless" user on HSUM devices.
Currently on HSUM devices, the DeviceOwner can only be provisioned in single-user mode in the main user, as that mode "emulates" a non-HSUM device. But the concept of main user is being deprecated, so instead it should be set in the "first human user" of the device. Unfortunately, there's no API to define which user is that, but since provisioning is triggered by the Setup Wizard, it can be inferred from the following characteristics: - User is the current user - User is admin - There are only 2 users in the device (the other one is system's) In other words, the end result is the same - single-user mode DO can only be set in the "first human user" - what changes is how that user is identified. Test: atest FrameworksMockingServicesTests --test-filter '.*UserManagerServiceMockedTest#testGetUserRemovabilityLocked.*' Test: btest -it -s s GtsDevicePolicyTestCases:android.devicepolicy.gts.ManagedProvisioningRequiredAppsTest Test: manual verification Bug: 435271558 Bug: 435247804 Flag: android.app.admin.flags.device_owner_for_all Change-Id: I72e23911f62291a9a72f45f729ff1873493a9242
Loading
Please register or sign in to comment