On OTA, MainUser is given to an Admin user

Followup to Ib36f3b372f9bf33cbb097c4af63eb43515ac835b. For consistency, we give MainUser designation specifically to an Admin user. That way, for now, all MainUsers are indeed Admin users. We may not make this a permanent assumption going forward, but for now, it'd keep things consistent. And, after all, the "Main" user of the device probably is an Admin for the devices using HSUM so far.

Bug: 256624031
Change-Id: I46a26d3a8a93dc52cfe48963215a03aa8636f90c
Test: atest UserManagerTest
This commit is contained in:
Adam Bookatz
2022-11-15 19:17:29 +00:00
parent a701c77b90
commit 62a837a73e

View File

@@ -3799,7 +3799,7 @@ public class UserManagerService extends IUserManager.Stub {
long earliestCreationTime = earliestUser.creationTime;
for (int i = 0; i < users.size(); i++) {
final UserInfo info = users.get(i);
if (info.isFull() && info.creationTime > 0
if (info.isFull() && info.isAdmin() && info.creationTime > 0
&& info.creationTime < earliestCreationTime) {
earliestCreationTime = info.creationTime;
earliestUser = info;