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

Commit de558b91 authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

Remove the `instructionSets` parameter from `cleanUpResources`.

It has been unused since ART Service was introduced.

Bug: 258223472
Bug: 6527146
Test: Presubmit
Flag: EXEMPT cleanup
Change-Id: I15ad14ed0520d0f35219042405fb570cc9848612
parent efaa2162
Loading
Loading
Loading
Loading
+4 −14
Original line number Diff line number Diff line
@@ -23,20 +23,15 @@ import java.io.File;
final class CleanUpArgs {
    @NonNull
    private final String mPackageName;
    @NonNull
    private final File mCodeFile;
    @NonNull
    private final String[] mInstructionSets;
    @NonNull private final File mCodeFile;

    /**
     * Create args that describe an existing installed package. Typically used
     * when cleaning up old installs.
     * Create args that describe an existing installed package. Typically used when cleaning up old
     * installs.
     */
    CleanUpArgs(@NonNull String packageName, @NonNull String codePath,
                @NonNull String[] instructionSets) {
    CleanUpArgs(@NonNull String packageName, @NonNull String codePath) {
        mPackageName = packageName;
        mCodeFile = new File(codePath);
        mInstructionSets = instructionSets;
    }

    @NonNull
@@ -54,9 +49,4 @@ final class CleanUpArgs {
    String getCodePath() {
        return mCodeFile.getAbsolutePath();
    }

    @NonNull
    String[] getInstructionSets() {
        return mInstructionSets;
    }
}
+3 −6
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.content.pm.PackageManager.MATCH_KNOWN_PACKAGES;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.UserHandle.USER_ALL;

import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.PackageManagerService.DEBUG_COMPRESSION;
import static com.android.server.pm.PackageManagerService.DEBUG_REMOVE;
import static com.android.server.pm.PackageManagerService.EMPTY_INT_ARRAY;
@@ -285,8 +284,8 @@ final class DeletePackageHelper {
        // other processes clean up before deleting resources.
        try (PackageManagerTracedLock installLock = mPm.mInstallLock.acquireLock()) {
            if (info.mArgs != null) {
                mRemovePackageHelper.cleanUpResources(info.mArgs.getPackageName(),
                        info.mArgs.getCodeFile(), info.mArgs.getInstructionSets());
                mRemovePackageHelper.cleanUpResources(
                        info.mArgs.getPackageName(), info.mArgs.getCodeFile());
            }

            boolean reEnableStub = false;
@@ -580,9 +579,7 @@ final class DeletePackageHelper {

        // Delete application code and resources only for parent packages
        if (deleteCodeAndResources) {
            outInfo.mArgs = new CleanUpArgs(ps.getName(),
                    ps.getPathString(), getAppDexInstructionSets(
                            ps.getPrimaryCpuAbiLegacy(), ps.getSecondaryCpuAbiLegacy()));
            outInfo.mArgs = new CleanUpArgs(ps.getName(), ps.getPathString());
            if (DEBUG_SD_INSTALL) Slog.i(TAG, "args=" + outInfo.mArgs);
        }
    }
+8 −19
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import static android.os.storage.StorageManager.FLAG_STORAGE_DE;
import static android.os.storage.StorageManager.FLAG_STORAGE_EXTERNAL;

import static com.android.server.pm.InitAppsHelper.ScanParams;
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.PackageManagerException.INTERNAL_ERROR_ARCHIVE_NO_INSTALLER_TITLE;
import static com.android.server.pm.PackageManagerService.APP_METADATA_FILE_NAME;
import static com.android.server.pm.PackageManagerService.DEBUG_COMPRESSION;
@@ -2468,12 +2467,8 @@ final class InstallPackageHelper {
                        // We didn't need to disable the .apk as a current system package,
                        // which means we are replacing another update that is already
                        // installed.  We need to make sure to delete the older one's .apk.
                        installRequest.getRemovedInfo().mArgs = new CleanUpArgs(
                                packageName,
                                oldPackage.getPath(),
                                getAppDexInstructionSets(
                                        deletedPkgSetting.getPrimaryCpuAbi(),
                                        deletedPkgSetting.getSecondaryCpuAbi()));
                        installRequest.getRemovedInfo().mArgs =
                                new CleanUpArgs(packageName, oldPackage.getPath());
                    } else {
                        installRequest.getRemovedInfo().mArgs = null;
                    }
@@ -3088,8 +3083,7 @@ final class InstallPackageHelper {
            request.setReturnMessage("Package was removed before install could complete.");

            // Remove the update failed package's older resources safely now
            mRemovePackageHelper.cleanUpResources(packageName, request.getOldCodeFile(),
                    request.getOldInstructionSet());
            mRemovePackageHelper.cleanUpResources(packageName, request.getOldCodeFile());
            mPm.notifyInstallObserver(request);
            return;
        }
@@ -3178,8 +3172,7 @@ final class InstallPackageHelper {
                                packageName, pkgSetting.getPath(), pkgSetting.getOldPaths());
                    }
                } else {
                    mRemovePackageHelper.cleanUpResources(packageName, args.getCodeFile(),
                            args.getInstructionSets());
                    mRemovePackageHelper.cleanUpResources(packageName, args.getCodeFile());
                }
            } else {
                // Force a gc to clear up things. Ask for a background one, it's fine to go on
@@ -4422,10 +4415,8 @@ final class InstallPackageHelper {
                            + "; " + pkgSetting.getPathString()
                            + " --> " + parsedPackage.getPath());

            mRemovePackageHelper.cleanUpResources(pkgSetting.getPackageName(),
                    new File(pkgSetting.getPathString()),
                    getAppDexInstructionSets(pkgSetting.getPrimaryCpuAbiLegacy(),
                            pkgSetting.getSecondaryCpuAbiLegacy()));
            mRemovePackageHelper.cleanUpResources(
                    pkgSetting.getPackageName(), new File(pkgSetting.getPathString()));
            synchronized (mPm.mLock) {
                mPm.mSettings.enableSystemPackageLPw(pkgSetting.getPackageName());
            }
@@ -4528,10 +4519,8 @@ final class InstallPackageHelper {
                                + parsedPackage.getLongVersionCode()
                                + "; " + pkgSetting.getPathString() + " --> "
                                + parsedPackage.getPath());
                mRemovePackageHelper.cleanUpResources(pkgSetting.getPackageName(),
                        new File(pkgSetting.getPathString()),
                        getAppDexInstructionSets(
                                pkgSetting.getPrimaryCpuAbiLegacy(), pkgSetting.getSecondaryCpuAbiLegacy()));
                mRemovePackageHelper.cleanUpResources(
                        pkgSetting.getPackageName(), new File(pkgSetting.getPathString()));
            } else {
                // The application on /system is older than the application on /data. Hide
                // the application on /system and the version on /data will be scanned later
+0 −6
Original line number Diff line number Diff line
@@ -336,12 +336,6 @@ final class InstallRequest {
                ? mRemovedInfo.mArgs.getCodeFile() : null;
    }

    @Nullable
    public String[] getOldInstructionSet() {
        return (mRemovedInfo != null && mRemovedInfo.mArgs != null)
                ? mRemovedInfo.mArgs.getInstructionSets() : null;
    }

    public UserHandle getUser() {
        return new UserHandle(mUserId);
    }
+0 −15
Original line number Diff line number Diff line
@@ -35,21 +35,6 @@ public class InstructionSets {
    private static final String PREFERRED_INSTRUCTION_SET =
            VMRuntime.getInstructionSet(Build.SUPPORTED_ABIS[0]);

    public static String[] getAppDexInstructionSets(String primaryCpuAbi, String secondaryCpuAbi) {
        if (primaryCpuAbi != null) {
            if (secondaryCpuAbi != null) {
                return new String[] {
                        VMRuntime.getInstructionSet(primaryCpuAbi),
                        VMRuntime.getInstructionSet(secondaryCpuAbi) };
            } else {
                return new String[] {
                        VMRuntime.getInstructionSet(primaryCpuAbi) };
            }
        }

        return new String[] { getPreferredInstructionSet() };
    }

    public static String getPreferredInstructionSet() {
        return PREFERRED_INSTRUCTION_SET;
    }
Loading