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

Commit de9543ce authored by Joanne Chung's avatar Joanne Chung
Browse files

Remove old flag replace with a new one

Modifying the type of an existing flag is not supported. We cannot
change a regular flag to a fixed read-only flag, or vice versa.

Bug: 306059534
Test: build and boot pass
Test: atest PackageManagerShellCommandInstallTest
Change-Id: I2e34b73cf7f7553365ab13cc6d0196b980853ff1
parent 167941f3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@ flag {
}

flag {
    name: "prevent_sdk_lib_app"
    name: "disallow_sdk_libs_to_be_apps"
    namespace: "package_manager_service"
    description: "Feature flag to enable the prevent sdk-library be an application."
    description: "Feature flag to disallow a <sdk-library> to be an <application>."
    bug: "295843617"
    is_fixed_read_only: true
}
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.server.pm;

import static android.content.pm.Flags.preventSdkLibApp;
import static android.content.pm.Flags.disallowSdkLibsToBeApps;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
@@ -996,7 +996,7 @@ final class InstallPackageHelper {
                    }
                    final boolean isApex = (request.getScanFlags() & SCAN_AS_APEX) != 0;
                    final boolean isSdkLibrary = packageToScan.isSdkLibrary();
                    if (isApex || (isSdkLibrary && preventSdkLibApp())) {
                    if (isApex || (isSdkLibrary && disallowSdkLibsToBeApps())) {
                        request.getScannedPackageSetting().setAppId(Process.INVALID_UID);
                    } else {
                        createdAppId.put(packageName, optimisticallyRegisterAppId(request));
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.server.pm.pkg.parsing;

import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.pm.Flags.preventSdkLibApp;
import static android.content.pm.Flags.disallowSdkLibsToBeApps;
import static android.content.pm.PackageManager.INSTALL_FAILED_INVALID_APK;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
@@ -404,7 +404,7 @@ public class ParsingPackageUtils {

        try {
            final File baseApk = new File(lite.getBaseApkPath());
            boolean shouldSkipComponents = lite.isIsSdkLibrary() && preventSdkLibApp();
            boolean shouldSkipComponents = lite.isIsSdkLibrary() && disallowSdkLibsToBeApps();
            final ParseResult<ParsingPackage> result = parseBaseApk(input, baseApk,
                    lite.getPath(), assetLoader, flags, shouldSkipComponents);
            if (result.isError()) {
@@ -458,7 +458,7 @@ public class ParsingPackageUtils {
        final PackageLite lite = liteResult.getResult();
        final SplitAssetLoader assetLoader = new DefaultSplitAssetLoader(lite, flags);
        try {
            boolean shouldSkipComponents =  lite.isIsSdkLibrary() && preventSdkLibApp();
            boolean shouldSkipComponents =  lite.isIsSdkLibrary() && disallowSdkLibsToBeApps();
            final ParseResult<ParsingPackage> result = parseBaseApk(input,
                    apkFile,
                    apkFile.getCanonicalPath(),