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

Commit f2a15524 authored by Zak Cohen's avatar Zak Cohen
Browse files

Address uses of USER_SYSTEM in AppWidgetService.

AppwidgetServiceImpl has some code that uses USER_SYSTEM as a proxy
for the main user of a device. In HSUM mode this breaks.

Change the backup and restore user to use getMainUser instead.

Bug: 378507338
Test: AppWidgetServiceImplTest
Flag: EXEMPT bug fix
Change-Id: I7b0f79c90af73aecc19ab07a689bd551b822a42b
parent c3696eff
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -607,7 +607,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                    // ... and see if these are hosts we've been awaiting.
                    // NOTE: We are backing up and restoring only the owner.
                    // TODO: http://b/22388012
                    if (newPackageAdded && userId == UserHandle.USER_SYSTEM) {
                    UserHandle mainUser = mUserManager.getMainUser();
                    if (newPackageAdded && mainUser != null && userId == mainUser.getIdentifier()) {
                        final int uid = getUidForPackage(pkgName, userId);
                        if (uid >= 0 ) {
                            resolveHostUidLocked(pkgName, uid);