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

Commit 7b0b2cb3 authored by Chun-Wei Wang's avatar Chun-Wei Wang Committed by Android (Google) Code Review
Browse files

Merge "Add PackageState#isApkInUpdatedApex (1/n)"

parents 17eff920 75752697
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -119,16 +119,18 @@ public abstract class ApexManager {
        @Nullable public final String apexModuleName;
        public final File apexDirectory;
        public final File preInstalledApexPath;
        public final boolean isFactory;

        private ActiveApexInfo(File apexDirectory, File preInstalledApexPath) {
            this(null, apexDirectory, preInstalledApexPath);
            this(null, apexDirectory, preInstalledApexPath, true);
        }

        private ActiveApexInfo(@Nullable String apexModuleName, File apexDirectory,
                File preInstalledApexPath) {
                File preInstalledApexPath, boolean isFactory) {
            this.apexModuleName = apexModuleName;
            this.apexDirectory = apexDirectory;
            this.preInstalledApexPath = preInstalledApexPath;
            this.isFactory = isFactory;
        }

        private ActiveApexInfo(ApexInfo apexInfo) {
@@ -136,7 +138,8 @@ public abstract class ApexManager {
                    apexInfo.moduleName,
                    new File(Environment.getApexDirectory() + File.separator
                            + apexInfo.moduleName),
                    new File(apexInfo.preinstalledModulePath));
                    new File(apexInfo.preinstalledModulePath),
                    apexInfo.isFactory);
        }
    }

+6 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
import static com.android.internal.util.FrameworkStatsLog.BOOT_TIME_EVENT_DURATION__EVENT__OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME;
import static com.android.internal.util.FrameworkStatsLog.BOOT_TIME_EVENT_DURATION__EVENT__OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME;
import static com.android.server.pm.PackageManagerService.SCAN_AS_APK_IN_APEX;
import static com.android.server.pm.PackageManagerService.SCAN_AS_FACTORY;
import static com.android.server.pm.PackageManagerService.SCAN_AS_PRIVILEGED;
import static com.android.server.pm.PackageManagerService.SCAN_AS_SYSTEM;
import static com.android.server.pm.PackageManagerService.SCAN_BOOTING;
@@ -145,7 +146,11 @@ final class InitAndSystemPackageHelper {
                    sp.getFolder().getAbsolutePath())
                    || apexInfo.preInstalledApexPath.getAbsolutePath().startsWith(
                        sp.getFolder().getAbsolutePath() + File.separator)) {
                return new ScanPartition(apexInfo.apexDirectory, sp, SCAN_AS_APK_IN_APEX);
                int additionalScanFlag = SCAN_AS_APK_IN_APEX;
                if (apexInfo.isFactory) {
                    additionalScanFlag |= SCAN_AS_FACTORY;
                }
                return new ScanPartition(apexInfo.apexDirectory, sp, additionalScanFlag);
            }
        }
        return null;
+7 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME;
import static com.android.server.pm.PackageManagerService.POST_INSTALL;
import static com.android.server.pm.PackageManagerService.PRECOMPILE_LAYOUTS;
import static com.android.server.pm.PackageManagerService.SCAN_AS_APK_IN_APEX;
import static com.android.server.pm.PackageManagerService.SCAN_AS_FACTORY;
import static com.android.server.pm.PackageManagerService.SCAN_AS_FULL_APP;
import static com.android.server.pm.PackageManagerService.SCAN_AS_INSTANT_APP;
import static com.android.server.pm.PackageManagerService.SCAN_AS_ODM;
@@ -308,6 +309,12 @@ final class InstallPackageHelper {
            pkgSetting.setInstallSource(installSource);
        }

        if ((scanFlags & SCAN_AS_APK_IN_APEX) != 0) {
            boolean isFactory = (scanFlags & SCAN_AS_FACTORY) != 0;
            pkgSetting.getPkgState().setApkInApex(true);
            pkgSetting.getPkgState().setApkInUpdatedApex(!isFactory);
        }

        // TODO(toddke): Consider a method specifically for modifying the Package object
        // post scan; or, moving this stuff out of the Package object since it has nothing
        // to do with the package on disk.
+1 −0
Original line number Diff line number Diff line
@@ -396,6 +396,7 @@ public class PackageManagerService extends IPackageManager.Stub
    static final int SCAN_AS_SYSTEM_EXT = 1 << 21;
    static final int SCAN_AS_ODM = 1 << 22;
    static final int SCAN_AS_APK_IN_APEX = 1 << 23;
    static final int SCAN_AS_FACTORY = 1 << 24;

    @IntDef(flag = true, prefix = { "SCAN_" }, value = {
            SCAN_NO_DEX,
+5 −0
Original line number Diff line number Diff line
@@ -1226,6 +1226,11 @@ public class PackageSetting extends SettingBase implements PackageStateInternal
        return pkgState.isUpdatedSystemApp();
    }

    @Override
    public boolean isApkInUpdatedApex() {
        return pkgState.isApkInUpdatedApex();
    }

    public PackageSetting setDomainSetId(@NonNull UUID domainSetId) {
        mDomainSetId = domainSetId;
        onChanged();
Loading