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

Commit 8de3e3b0 authored by Songchun Fan's avatar Songchun Fan
Browse files

[SharedUserSetting] fix shared user migration

In ag/16740473 we missed the case when a package is migrating off from
shared user. Thanks topjohnwu@ for pointing it out!

BUG: 219376382
Test: atest android.uidmigration.cts.SharedUserMigrationTest
Change-Id: I11d117a1ea61e63f18891eb002a7c475f3abbe2b
parent 4b90dd41
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.content.pm.PackageManager.INSTALL_FAILED_UID_CHANGED;
import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
import static android.content.pm.PackageManager.UNINSTALL_REASON_UNKNOWN;
import static android.content.pm.PackageManager.UNINSTALL_REASON_USER_TYPE;
import static android.os.Process.INVALID_UID;
import static android.os.Process.PACKAGE_INFO_GID;
import static android.os.Process.SYSTEM_UID;

@@ -1117,6 +1118,9 @@ public final class Settings implements Watchable, Snappable {
                        "Updating application package " + pkgName + " failed");
            }
            pkgSetting.setSharedUserAppId(sharedUser.mAppId);
        } else {
            // migrating off shared user
            pkgSetting.setSharedUserAppId(INVALID_UID);
        }

        if (!pkgSetting.getPath().equals(codePath)) {