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

Commit e1aa484c authored by Sumedh Sen's avatar Sumedh Sen
Browse files

Add a boolean flag for sys app scanned as stopped

This boolean flag in PackageSetting will be set to true if a system app
was initially scanned in the stopped state.

Bug: 297360102
Bug: 295084647
Bug: 297788394
Bug: 294330522
Bug: 296180087
Test: presubmit
Test: manual
Change-Id: Id6a3d7332e9562407b1fb4c645c682013d71b505
parent 7ce1881a
Loading
Loading
Loading
Loading
+16 −3

File changed.

Preview size limit exceeded, changes collapsed.

+17 −2
Original line number Original line Diff line number Diff line
@@ -948,6 +948,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            ret.getPkgState().setUpdatedSystemApp(false);
            ret.getPkgState().setUpdatedSystemApp(false);
            ret.setTargetSdkVersion(p.getTargetSdkVersion());
            ret.setTargetSdkVersion(p.getTargetSdkVersion());
            ret.setRestrictUpdateHash(p.getRestrictUpdateHash());
            ret.setRestrictUpdateHash(p.getRestrictUpdateHash());
            ret.setScannedAsStoppedSystemApp(p.isScannedAsStoppedSystemApp());
        }
        }
        mDisabledSysPackages.remove(name);
        mDisabledSysPackages.remove(name);
        return ret;
        return ret;
@@ -1162,6 +1163,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    Slog.i(PackageManagerService.TAG, "Stopping system package " + pkgName, e);
                    Slog.i(PackageManagerService.TAG, "Stopping system package " + pkgName, e);
                }
                }
                pkgSetting.setStopped(true, installUserId);
                pkgSetting.setStopped(true, installUserId);
                pkgSetting.setScannedAsStoppedSystemApp(true);
            }
            }
            if (sharedUser != null) {
            if (sharedUser != null) {
                pkgSetting.setAppId(sharedUser.mAppId);
                pkgSetting.setAppId(sharedUser.mAppId);
@@ -3072,6 +3074,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
                    pkg.getRestrictUpdateHash());
                    pkg.getRestrictUpdateHash());
        }
        }
        serializer.attributeBoolean(null, "scannedAsStoppedSystemApp",
            pkg.isScannedAsStoppedSystemApp());
        if (pkg.getLegacyNativeLibraryPath() != null) {
        if (pkg.getLegacyNativeLibraryPath() != null) {
            serializer.attribute(null, "nativeLibraryPath", pkg.getLegacyNativeLibraryPath());
            serializer.attribute(null, "nativeLibraryPath", pkg.getLegacyNativeLibraryPath());
        }
        }
@@ -3140,6 +3144,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
            serializer.attributeBytesBase64(null, "restrictUpdateHash",
                    pkg.getRestrictUpdateHash());
                    pkg.getRestrictUpdateHash());
        }
        }
        serializer.attributeBoolean(null, "scannedAsStoppedSystemApp",
            pkg.isScannedAsStoppedSystemApp());
        if (!pkg.hasSharedUser()) {
        if (!pkg.hasSharedUser()) {
            serializer.attributeInt(null, "userId", pkg.getAppId());
            serializer.attributeInt(null, "userId", pkg.getAppId());
        } else {
        } else {
@@ -3873,6 +3879,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        int targetSdkVersion = parser.getAttributeInt(null, "targetSdkVersion", 0);
        int targetSdkVersion = parser.getAttributeInt(null, "targetSdkVersion", 0);
        byte[] restrictUpdateHash = parser.getAttributeBytesBase64(null, "restrictUpdateHash",
        byte[] restrictUpdateHash = parser.getAttributeBytesBase64(null, "restrictUpdateHash",
                null);
                null);
        boolean isScannedAsStoppedSystemApp =  parser.getAttributeBoolean(null,
            "scannedAsStoppedSystemApp", false);


        int pkgFlags = 0;
        int pkgFlags = 0;
        int pkgPrivateFlags = 0;
        int pkgPrivateFlags = 0;
@@ -3893,7 +3901,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                .setCpuAbiOverride(cpuAbiOverrideStr)
                .setCpuAbiOverride(cpuAbiOverrideStr)
                .setLongVersionCode(versionCode)
                .setLongVersionCode(versionCode)
                .setTargetSdkVersion(targetSdkVersion)
                .setTargetSdkVersion(targetSdkVersion)
                .setRestrictUpdateHash(restrictUpdateHash);
                .setRestrictUpdateHash(restrictUpdateHash)
                .setScannedAsStoppedSystemApp(isScannedAsStoppedSystemApp);
        long timeStamp = parser.getAttributeLongHex(null, "ft", 0);
        long timeStamp = parser.getAttributeLongHex(null, "ft", 0);
        if (timeStamp == 0) {
        if (timeStamp == 0) {
            timeStamp = parser.getAttributeLong(null, "ts", 0);
            timeStamp = parser.getAttributeLong(null, "ts", 0);
@@ -3988,6 +3997,7 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
        String appMetadataFilePath = null;
        String appMetadataFilePath = null;
        int targetSdkVersion = 0;
        int targetSdkVersion = 0;
        byte[] restrictUpdateHash = null;
        byte[] restrictUpdateHash = null;
        boolean isScannedAsStoppedSystemApp = false;
        try {
        try {
            name = parser.getAttributeValue(null, ATTR_NAME);
            name = parser.getAttributeValue(null, ATTR_NAME);
            realName = parser.getAttributeValue(null, "realName");
            realName = parser.getAttributeValue(null, "realName");
@@ -4028,6 +4038,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
            categoryHint = parser.getAttributeInt(null, "categoryHint",
            categoryHint = parser.getAttributeInt(null, "categoryHint",
                    ApplicationInfo.CATEGORY_UNDEFINED);
                    ApplicationInfo.CATEGORY_UNDEFINED);
            appMetadataFilePath = parser.getAttributeValue(null, "appMetadataFilePath");
            appMetadataFilePath = parser.getAttributeValue(null, "appMetadataFilePath");
            isScannedAsStoppedSystemApp = parser.getAttributeBoolean(null,
                "scannedAsStoppedSystemApp", false);


            String domainSetIdString = parser.getAttributeValue(null, "domainSetId");
            String domainSetIdString = parser.getAttributeValue(null, "domainSetId");


@@ -4174,7 +4186,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                    .setLoadingCompletedTime(loadingCompletedTime)
                    .setLoadingCompletedTime(loadingCompletedTime)
                    .setAppMetadataFilePath(appMetadataFilePath)
                    .setAppMetadataFilePath(appMetadataFilePath)
                    .setTargetSdkVersion(targetSdkVersion)
                    .setTargetSdkVersion(targetSdkVersion)
                    .setRestrictUpdateHash(restrictUpdateHash);
                    .setRestrictUpdateHash(restrictUpdateHash)
                    .setScannedAsStoppedSystemApp(isScannedAsStoppedSystemApp);
            // Handle legacy string here for single-user mode
            // Handle legacy string here for single-user mode
            final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
            final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
            if (enabledStr != null) {
            if (enabledStr != null) {
@@ -4988,6 +5001,8 @@ public final class Settings implements Watchable, Snappable, ResilientAtomicFile
                pw.append(prefix).append("  queriesIntents=")
                pw.append(prefix).append("  queriesIntents=")
                        .println(ps.getPkg().getQueriesIntents());
                        .println(ps.getPkg().getQueriesIntents());
            }
            }
            pw.print(prefix); pw.print("  scannedAsStoppedSystemApp=");
            pw.println(ps.isScannedAsStoppedSystemApp());
            pw.print(prefix); pw.print("  supportsScreens=[");
            pw.print(prefix); pw.print("  supportsScreens=[");
            boolean first = true;
            boolean first = true;
            if (pkg.isSmallScreensSupported()) {
            if (pkg.isSmallScreensSupported()) {
+8 −0
Original line number Original line Diff line number Diff line
@@ -456,4 +456,12 @@ public interface PackageState {
    @Immutable.Ignore
    @Immutable.Ignore
    @Nullable
    @Nullable
    byte[] getRestrictUpdateHash();
    byte[] getRestrictUpdateHash();

    /**
     * whether the package has been scanned as a stopped system app. A package will be
     * scanned in the stopped state if it is a system app that has a launcher entry and is
     * <b>not</b> exempted by {@code <initial-package-state>} tag, and is not an APEX
     * @hide
     */
    boolean isScannedAsStoppedSystemApp();
}
}