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

Commit d22f0f95 authored by Zak Cohen's avatar Zak Cohen Committed by Android (Google) Code Review
Browse files

Merge "Address uses of USER_SYSTEM in AppWidgetService." into main

parents 1572437c 99d5cb1b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ 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) {
                    if (newPackageAdded && userId == mUserManager.getMainUser().getIdentifier()) {
                        final int uid = getUidForPackage(pkgName, userId);
                        if (uid >= 0 ) {
                            resolveHostUidLocked(pkgName, uid);
@@ -4436,7 +4436,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            Host host = lookupHostLocked(oldHostId);
            if (host != null) {
                final int uid = getUidForPackage(NEW_KEYGUARD_HOST_PACKAGE,
                        UserHandle.USER_SYSTEM);
                        UserHandle.USER_SYSTEM); // Keyguard explicitly runs as the system user
                if (uid >= 0) {
                    host.id = new HostId(uid, KEYGUARD_HOST_ID, NEW_KEYGUARD_HOST_PACKAGE);
                }
@@ -4457,6 +4457,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
    private static AtomicFile getSavedStateFile(int userId) {
        File dir = Environment.getUserSystemDirectory(userId);
        File settingsFile = getStateFile(userId);
        // USER_SYSTEM is explicit here, the old file only ever existed for user 0.
        if (!settingsFile.exists() && userId == UserHandle.USER_SYSTEM) {
            if (!dir.exists()) {
                dir.mkdirs();