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

Commit b508c462 authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[ADI][12/N] fix multi-user verification policy on HSUM

On HSUM devices, both the main user and the system user are created at the very beginning of the boot, so they should be both assigned the default verification policy at that time. Otherwise, the main user won't have a policy and the user won't be able to change it either.

FLAG: android.content.pm.verification_service

BUG: 378377810
FIXES: 378377810
Test: create a gcar emulator and run CtsPackageManagerTestCases:android.content.pm.cts.VerifierServiceTest

Merged-In: I2f3f34fa4a6202e7bc3b6f0cbb31312f344ad9cd
Change-Id: I2f3f34fa4a6202e7bc3b6f0cbb31312f344ad9cd
parent 83c4b8fa
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import static android.content.pm.PackageManager.DELETE_ARCHIVE;
import static android.content.pm.PackageManager.INSTALL_UNARCHIVE_DRAFT;
import static android.os.Process.INVALID_UID;
import static android.os.Process.SYSTEM_UID;
import static android.os.UserHandle.USER_SYSTEM;

import static com.android.server.pm.PackageArchiver.isArchivingEnabled;
import static com.android.server.pm.PackageInstallerSession.isValidVerificationPolicy;
@@ -350,7 +349,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
        mVerifierController = VerifierController.getInstance(context, mInstallHandler,
                verifierPackageName);
        synchronized (mVerificationPolicyPerUser) {
            mVerificationPolicyPerUser.put(USER_SYSTEM, DEFAULT_VERIFICATION_POLICY);
            int[] users = mPm.mUserManager.getUserIds();
            for (int i = 0; i < users.length; i++) {
                // TODO(b/360129657): preserve the overridden policy across reboots.
                mVerificationPolicyPerUser.put(users[i], DEFAULT_VERIFICATION_POLICY);
            }
        }
        mInstallDependencyHelper = new InstallDependencyHelper(mContext,
                mPm.mInjector.getSharedLibrariesImpl(), this);