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

Commit d990f2ca authored by Brandon Liu's avatar Brandon Liu
Browse files

Replace onUserSwithing() with onUserStarting() to handle

updateOverlayForUser()

Bug: b/260206944
Test: Verified affected atests pass. For this CL no more tests added for to test OMS since multi user OMS testing is totally a missing thing and I created another feature request to take care.

Change-Id: I4790f330fd513ca333ecccb5b53a10f7cdf33a22
parent 080f35d7
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -301,7 +301,7 @@ public final class OverlayManagerService extends SystemService {
                    && shellPkgName.equals(overlayInfo.packageName));
                    && shellPkgName.equals(overlayInfo.packageName));


            initIfNeeded();
            initIfNeeded();
            onSwitchUser(UserHandle.USER_SYSTEM);
            onStartUser(UserHandle.USER_SYSTEM);


            publishBinderService(Context.OVERLAY_SERVICE, mService);
            publishBinderService(Context.OVERLAY_SERVICE, mService);
            publishLocalService(OverlayManagerService.class, this);
            publishLocalService(OverlayManagerService.class, this);
@@ -324,7 +324,7 @@ public final class OverlayManagerService extends SystemService {
                final UserInfo userInfo = users.get(i);
                final UserInfo userInfo = users.get(i);
                if (!userInfo.supportsSwitchTo() && userInfo.id != UserHandle.USER_SYSTEM) {
                if (!userInfo.supportsSwitchTo() && userInfo.id != UserHandle.USER_SYSTEM) {
                    // Initialize any users that can't be switched to, as their state would
                    // Initialize any users that can't be switched to, as their state would
                    // never be setup in onSwitchUser(). We will switch to the system user right
                    // never be setup in onStartUser(). We will switch to the system user right
                    // after this, and its state will be setup there.
                    // after this, and its state will be setup there.
                    updatePackageManagerLocked(mImpl.updateOverlaysForUser(users.get(i).id));
                    updatePackageManagerLocked(mImpl.updateOverlaysForUser(users.get(i).id));
                }
                }
@@ -333,13 +333,13 @@ public final class OverlayManagerService extends SystemService {
    }
    }


    @Override
    @Override
    public void onUserSwitching(@Nullable TargetUser from, @NonNull TargetUser to) {
    public void onUserStarting(TargetUser user) {
        onSwitchUser(to.getUserIdentifier());
        onStartUser(user.getUserIdentifier());
    }
    }


    private void onSwitchUser(@UserIdInt int newUserId) {
    private void onStartUser(@UserIdInt int newUserId) {
        try {
        try {
            traceBegin(TRACE_TAG_RRO, "OMS#onSwitchUser " + newUserId);
            traceBegin(TRACE_TAG_RRO, "OMS#onStartUser " + newUserId);
            // ensure overlays in the settings are up-to-date, and propagate
            // ensure overlays in the settings are up-to-date, and propagate
            // any asset changes to the rest of the system
            // any asset changes to the rest of the system
            synchronized (mLock) {
            synchronized (mLock) {