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

Commit 6efca757 authored by Eric Biggers's avatar Eric Biggers
Browse files

PackageManagerService: remove unused support for onlyCore mode

Due to the removal of support for Full Disk Encryption,
the "core apps only" mode of system_server is no longer used, and
onlyCore is hard-coded to false.  For details, see http://ag/17685636.

Remove the corresponding obsolete code from PackageManagerService and
the related classes InitAppsHelper, UserDataPreparer, PackageParser2,
and ParsingPackageUtils.

Bug: 208476087
Change-Id: I48289d1f74414f831504b38ac5c1bde719b07fb2
parent 7e5733a5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -195,8 +195,7 @@ public class PackageParsingPerfTest {
            // For testing, just disable enforcement to avoid hooking up to compat framework
            ParseTypeImpl(ParseInput.Callback { _, _, _ -> false })
        }
        val parser = ParsingPackageUtils(false,
            null,
        val parser = ParsingPackageUtils(null,
            null,
            emptyList(),
            object :
+0 −1
Original line number Diff line number Diff line
@@ -614,7 +614,6 @@ interface IPackageManager {
    VerifierDeviceIdentity getVerifierDeviceIdentity();

    boolean isFirstBoot();
    boolean isOnlyCoreApps();
    boolean isDeviceUpgrading();

    /** Reflects current DeviceStorageMonitorService state */
+0 −7
Original line number Diff line number Diff line
@@ -845,13 +845,6 @@ public abstract class PackageManagerInternal {
     */
    public abstract int[] getPermissionGids(String permissionName, int userId);

    /**
     * Return if device is currently in a "core" boot environment, typically
     * used to support full-disk encryption. Only apps marked with
     * {@code coreApp} attribute are available.
     */
    public abstract boolean isOnlyCoreApps();

    /**
     * Make a best-effort attempt to provide the requested free disk space by
     * deleting cached files.
+0 −6
Original line number Diff line number Diff line
@@ -903,12 +903,6 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub {
        return snapshot().isInstantApp(packageName, userId);
    }

    @Override
    @Deprecated
    public final boolean isOnlyCoreApps() {
        return mService.isOnlyCoreApps();
    }

    @Override
    @Deprecated
    public final boolean isPackageAvailable(String packageName, int userId) {
+10 −19
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ final class InitAppsHelper {
    /* Track of the number of system apps */
    private int mSystemPackagesCount;
    private final boolean mIsDeviceUpgrading;
    private final boolean mIsOnlyCoreApps;
    private final List<ScanPartition> mSystemPartitions;

    /**
@@ -108,7 +107,6 @@ final class InitAppsHelper {
        mSystemPartitions = systemPartitions;
        mDirsToScanAsSystem = getSystemScanPartitions();
        mIsDeviceUpgrading = mPm.isDeviceUpgrading();
        mIsOnlyCoreApps = mPm.isOnlyCoreApps();
        // Set flag to monitor and not change apk file paths when scanning install directories.
        int scanFlags = SCAN_BOOTING | SCAN_INITIAL;
        if (mIsDeviceUpgrading || mPm.isFirstBoot()) {
@@ -229,12 +227,10 @@ final class InitAppsHelper {
                        pkg -> consumer.accept(pkg, pkg.isSystem(),
                                apkInApexPreInstalledPaths.get(pkg.getPackageName()))));

        if (!mIsOnlyCoreApps) {
        // do this first before mucking with mPackages for the "expecting better" case
        updateStubSystemAppsList(mStubSystemApps);
        mInstallPackageHelper.prepareSystemPackageCleanUp(packageSettings,
                mPossiblyDeletedUpdatedSystemApps, mExpectingBetter, userIds);
        }

        logSystemAppsScanningTime(startTime);
        return overlayConfig;
@@ -268,23 +264,18 @@ final class InitAppsHelper {
    @GuardedBy({"mPm.mInstallLock", "mPm.mLock"})
    public void initNonSystemApps(PackageParser2 packageParser, @NonNull int[] userIds,
            long startTime) {
        if (!mIsOnlyCoreApps) {
        EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
                SystemClock.uptimeMillis());
        scanDirTracedLI(mPm.getAppInstallDir(), /* frameworkSplits= */ null, 0,
                    mScanFlags | SCAN_REQUIRE_KNOWN,
                    packageParser, mExecutorService);
        }
                mScanFlags | SCAN_REQUIRE_KNOWN, packageParser, mExecutorService);

        List<Runnable> unfinishedTasks = mExecutorService.shutdownNow();
        if (!unfinishedTasks.isEmpty()) {
            throw new IllegalStateException("Not all tasks finished before calling close: "
                    + unfinishedTasks);
        }
        if (!mIsOnlyCoreApps) {
        fixSystemPackages(userIds);
        logNonSystemAppScanningTime(startTime);
        }
        mExpectingBetter.clear();
        mPm.mSettings.pruneRenamedPackagesLPw();
    }
Loading