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

Commit c4919aaa authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

Merge "[pm] remove redundant boolean flags in PackageSetting" into main

parents 8943b729 2d275051
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import static android.content.ContentProvider.isAuthorityRedirectedForCloneProfi
import static android.content.Intent.ACTION_MAIN;
import static android.content.Intent.CATEGORY_DEFAULT;
import static android.content.Intent.CATEGORY_HOME;
import static android.content.pm.ApplicationInfo.PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE;
import static android.content.pm.PackageManager.CERT_INPUT_RAW_X509;
import static android.content.pm.PackageManager.CERT_INPUT_SHA256;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
@@ -1525,9 +1524,6 @@ public class ComputerEngine implements Computer {
            ai.secondaryCpuAbi = ps.getSecondaryCpuAbiLegacy();
            ai.volumeUuid = ps.getVolumeUuid();
            ai.storageUuid = StorageManager.convert(ai.volumeUuid);
            if (ps.isDefaultToDeviceProtectedStorage()) {
                ai.privateFlags |= PRIVATE_FLAG_DEFAULT_TO_DEVICE_PROTECTED_STORAGE;
            }
            ai.setVersionCode(ps.getVersionCode());
            ai.flags = ps.getFlags();
            ai.privateFlags = ps.getPrivateFlags();
+4 −3
Original line number Diff line number Diff line
@@ -1630,7 +1630,8 @@ final class InstallPackageHelper {
                synchronized (mPm.mLock) {
                    if (DEBUG_INSTALL) {
                        Slog.d(TAG,
                                "replacePackageLI: new=" + parsedPackage + ", old=" + oldPackage);
                                "replacePackageLI: new=" + parsedPackage
                                        + ", old=" + oldPackageState.getName());
                    }

                    ps = mPm.mSettings.getPackageLPr(pkgName11);
@@ -1789,7 +1790,7 @@ final class InstallPackageHelper {

                    if (DEBUG_INSTALL) {
                        Slog.d(TAG, "replaceSystemPackageLI: new=" + parsedPackage
                                + ", old=" + oldPackage);
                                + ", old=" + oldPackageState.getName());
                    }
                    request.setReturnCode(PackageManager.INSTALL_SUCCEEDED);
                    request.setApexModuleName(oldPackageState.getApexModuleName());
@@ -1799,7 +1800,7 @@ final class InstallPackageHelper {
                    if (DEBUG_INSTALL) {
                        Slog.d(TAG,
                                "replaceNonSystemPackageLI: new=" + parsedPackage + ", old="
                                        + oldPackage);
                                        + oldPackageState.getName());
                    }
                }
            } else { // new package install
+7 −22

File changed.

Preview size limit exceeded, changes collapsed.

+2 −4
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ final class ScanPackageUtils {
                    UserManagerService.getInstance(), usesSdkLibraries,
                    parsedPackage.getUsesSdkLibrariesVersionsMajor(), usesStaticLibraries,
                    parsedPackage.getUsesStaticLibrariesVersions(), parsedPackage.getMimeGroups(),
                    newDomainSetId, parsedPackage.isPersistent(),
                    newDomainSetId,
                    parsedPackage.getTargetSdkVersion(), parsedPackage.getRestrictUpdateHash());
        } else {
            // make a deep copy to avoid modifying any existing system state.
@@ -241,7 +241,7 @@ final class ScanPackageUtils {
                    UserManagerService.getInstance(),
                    usesSdkLibraries, parsedPackage.getUsesSdkLibrariesVersionsMajor(),
                    usesStaticLibraries, parsedPackage.getUsesStaticLibrariesVersions(),
                    parsedPackage.getMimeGroups(), newDomainSetId, parsedPackage.isPersistent(),
                    parsedPackage.getMimeGroups(), newDomainSetId,
                    parsedPackage.getTargetSdkVersion(), parsedPackage.getRestrictUpdateHash());
        }

@@ -464,8 +464,6 @@ final class ScanPackageUtils {
                            + " to " + volumeUuid);
            pkgSetting.setVolumeUuid(volumeUuid);
        }
        pkgSetting.setDefaultToDeviceProtectedStorage(
                parsedPackage.isDefaultToDeviceProtectedStorage());

        SharedLibraryInfo sdkLibraryInfo = null;
        if (!TextUtils.isEmpty(parsedPackage.getSdkLibraryName())) {
+2 −19
Original line number Diff line number Diff line
@@ -946,7 +946,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            ret.setMimeGroups(p.getMimeGroups());
            ret.setAppMetadataFilePath(p.getAppMetadataFilePath());
            ret.getPkgState().setUpdatedSystemApp(false);
            ret.setIsPersistent(p.isPersistent());
            ret.setTargetSdkVersion(p.getTargetSdkVersion());
            ret.setRestrictUpdateHash(p.getRestrictUpdateHash());
        }
@@ -1061,7 +1060,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            boolean virtualPreload, boolean isStoppedSystemApp, UserManagerService userManager,
            String[] usesSdkLibraries, long[] usesSdkLibrariesVersions,
            String[] usesStaticLibraries, long[] usesStaticLibrariesVersions,
            Set<String> mimeGroupNames, @NonNull UUID domainSetId, boolean isPersistent,
            Set<String> mimeGroupNames, @NonNull UUID domainSetId,
            int targetSdkVersion, byte[] restrictUpdatedHash) {
        final PackageSetting pkgSetting;
        if (originalPkg != null) {
@@ -1083,7 +1082,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    // Update new package state.
                    .setLastModifiedTime(codePath.lastModified())
                    .setDomainSetId(domainSetId)
                    .setIsPersistent(isPersistent)
                    .setTargetSdkVersion(targetSdkVersion)
                    .setRestrictUpdateHash(restrictUpdatedHash);
            pkgSetting.setFlags(pkgFlags)
@@ -1103,7 +1101,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    .setSecondaryCpuAbi(secondaryCpuAbi)
                    .setLongVersionCode(versionCode)
                    .setMimeGroups(createMimeGroups(mimeGroupNames))
                    .setIsPersistent(isPersistent)
                    .setTargetSdkVersion(targetSdkVersion)
                    .setRestrictUpdateHash(restrictUpdatedHash)
                    .setLastModifiedTime(codePath.lastModified());
@@ -1219,7 +1216,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            int pkgPrivateFlags, @NonNull UserManagerService userManager,
            @Nullable String[] usesSdkLibraries, @Nullable long[] usesSdkLibrariesVersions,
            @Nullable String[] usesStaticLibraries, @Nullable long[] usesStaticLibrariesVersions,
            @Nullable Set<String> mimeGroupNames, @NonNull UUID domainSetId, boolean isPersistent,
            @Nullable Set<String> mimeGroupNames, @NonNull UUID domainSetId,
            int targetSdkVersion, byte[] restrictUpdatedHash)
                    throws PackageManagerException {
        final String pkgName = pkgSetting.getPackageName();
@@ -1273,7 +1270,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                .setSecondaryCpuAbi(secondaryCpuAbi)
                .updateMimeGroups(mimeGroupNames)
                .setDomainSetId(domainSetId)
                .setIsPersistent(isPersistent)
                .setTargetSdkVersion(targetSdkVersion)
                .setRestrictUpdateHash(restrictUpdatedHash);
        // Update SDK library dependencies if needed.
@@ -3071,7 +3067,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        serializer.attributeLongHex(null, "ft", pkg.getLastModifiedTime());
        serializer.attributeLongHex(null, "ut", pkg.getLastUpdateTime());
        serializer.attributeLong(null, "version", pkg.getVersionCode());
        serializer.attributeBoolean(null, "isPersistent", pkg.isPersistent());
        serializer.attributeInt(null, "targetSdkVersion", pkg.getTargetSdkVersion());
        if (pkg.getRestrictUpdateHash() != null) {
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
@@ -3140,7 +3135,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        serializer.attributeLongHex(null, "ft", pkg.getLastModifiedTime());
        serializer.attributeLongHex(null, "ut", pkg.getLastUpdateTime());
        serializer.attributeLong(null, "version", pkg.getVersionCode());
        serializer.attributeBoolean(null, "isPersistent", pkg.isPersistent());
        serializer.attributeInt(null, "targetSdkVersion", pkg.getTargetSdkVersion());
        if (pkg.getRestrictUpdateHash() != null) {
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
@@ -3182,8 +3176,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        if (pkg.getVolumeUuid() != null) {
            serializer.attribute(null, "volumeUuid", pkg.getVolumeUuid());
        }
        serializer.attributeBoolean(null, "defaultToDeviceProtectedStorage",
                pkg.isDefaultToDeviceProtectedStorage());
        if (pkg.getCategoryOverride() != ApplicationInfo.CATEGORY_UNDEFINED) {
            serializer.attributeInt(null, "categoryHint", pkg.getCategoryOverride());
        }
@@ -3878,7 +3870,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        }

        long versionCode = parser.getAttributeLong(null, "version", 0);
        boolean isPersistent = parser.getAttributeBoolean(null, "isPersistent", false);
        int targetSdkVersion = parser.getAttributeInt(null, "targetSdkVersion", 0);
        byte[] restrictUpdateHash = parser.getAttributeBytesBase64(null, "restrictUpdateHash",
                null);
@@ -3901,7 +3892,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                .setSecondaryCpuAbi(secondaryCpuAbiStr)
                .setCpuAbiOverride(cpuAbiOverrideStr)
                .setLongVersionCode(versionCode)
                .setIsPersistent(isPersistent)
                .setTargetSdkVersion(targetSdkVersion)
                .setRestrictUpdateHash(restrictUpdateHash);
        long timeStamp = parser.getAttributeLongHex(null, "ft", 0);
@@ -3982,7 +3972,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        String installInitiatingPackageName = null;
        boolean installInitiatorUninstalled = false;
        String volumeUuid = null;
        boolean defaultToDeviceProtectedStorage = false;
        boolean updateAvailable = false;
        int categoryHint = ApplicationInfo.CATEGORY_UNDEFINED;
        int pkgFlags = 0;
@@ -3997,7 +3986,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        long loadingCompletedTime = 0;
        UUID domainSetId;
        String appMetadataFilePath = null;
        boolean isPersistent = false;
        int targetSdkVersion = 0;
        byte[] restrictUpdateHash = null;
        try {
@@ -4023,7 +4011,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            }

            versionCode = parser.getAttributeLong(null, "version", 0);
            isPersistent = parser.getAttributeBoolean(null, "isPersistent", false);
            targetSdkVersion = parser.getAttributeInt(null, "targetSdkVersion", 0);
            restrictUpdateHash = parser.getAttributeBytesBase64(null, "restrictUpdateHash", null);
            installerPackageName = parser.getAttributeValue(null, "installer");
@@ -4038,8 +4025,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            installInitiatorUninstalled = parser.getAttributeBoolean(null,
                    "installInitiatorUninstalled", false);
            volumeUuid = parser.getAttributeValue(null, "volumeUuid");
            defaultToDeviceProtectedStorage = parser.getAttributeBoolean(
                    null, "defaultToDeviceProtectedStorage", false);
            categoryHint = parser.getAttributeInt(null, "categoryHint",
                    ApplicationInfo.CATEGORY_UNDEFINED);
            appMetadataFilePath = parser.getAttributeValue(null, "appMetadataFilePath");
@@ -4179,7 +4164,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    installInitiatorUninstalled);
            packageSetting.setInstallSource(installSource)
                    .setVolumeUuid(volumeUuid)
                    .setDefaultToDeviceProtectedStorage(defaultToDeviceProtectedStorage)
                    .setCategoryOverride(categoryHint)
                    .setLegacyNativeLibraryPath(legacyNativeLibraryPathStr)
                    .setPrimaryCpuAbi(primaryCpuAbiString)
@@ -4189,7 +4173,6 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    .setLoadingProgress(loadingProgress)
                    .setLoadingCompletedTime(loadingCompletedTime)
                    .setAppMetadataFilePath(appMetadataFilePath)
                    .setIsPersistent(isPersistent)
                    .setTargetSdkVersion(targetSdkVersion)
                    .setRestrictUpdateHash(restrictUpdateHash);
            // Handle legacy string here for single-user mode
Loading