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

Commit 255c22c9 authored by Joanne Chung's avatar Joanne Chung
Browse files

Allow app be installed if the sdk-library dependency doesn't exist

Bug: 295827951
Test: manual
Test: atest PackageManagerShellCommandInstallTest

Change-Id: I3c58b3afe3eb2ea7094ef2a4fd62c71addf4d9a4
parent 167941f3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.pm;

import static android.content.pm.Flags.sdkLibIndependence;
import static android.content.pm.PackageManager.INSTALL_FAILED_MISSING_SHARED_LIBRARY;
import static android.content.pm.PackageManager.INSTALL_FAILED_SHARED_LIBRARY_BAD_CERTIFICATE_DIGEST;

@@ -951,10 +952,12 @@ public final class SharedLibrariesImpl implements SharedLibrariesRead, Watchable
            }
        }
        if (!pkg.getUsesSdkLibraries().isEmpty()) {
            // Allow installation even if sdk-library dependency doesn't exist
            boolean required = !sdkLibIndependence();
            usesLibraryInfos = collectSharedLibraryInfos(pkg.getUsesSdkLibraries(),
                    pkg.getUsesSdkLibrariesVersionsMajor(), pkg.getUsesSdkLibrariesCertDigests(),
                    pkg.getPackageName(), "sdk", true, pkg.getTargetSdkVersion(), usesLibraryInfos,
                    availablePackages, newLibraries);
                    pkg.getPackageName(), "sdk", required, pkg.getTargetSdkVersion(),
                    usesLibraryInfos, availablePackages, newLibraries);
        }
        return usesLibraryInfos;
    }