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

Commit ae838fdc authored by Rhed Jao's avatar Rhed Jao
Browse files

Move shared library info out of PackageManagerService (2/n)

- Adding tests for SharedLibrariesImpl
- Rename SharedLibraryHelper to SharedLibraryUtils

Bug: 200588896
Test: atest StaticSharedLibsHostTests
Test: atest SharedLibrariesImplTest
Change-Id: I7f03720f54ae14b68ba7531f4f407a99d361a680
parent b1866650
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4788,7 +4788,7 @@ public class ComputerEngine implements Computer {
    @Override
    public List<PackageStateInternal> findSharedNonSystemLibraries(
            @NonNull PackageStateInternal pkgSetting) {
        List<SharedLibraryInfo> deps = SharedLibraryHelper.findSharedLibraries(pkgSetting);
        List<SharedLibraryInfo> deps = SharedLibraryUtils.findSharedLibraries(pkgSetting);
        if (!deps.isEmpty()) {
            List<PackageStateInternal> retValue = new ArrayList<>();
            for (SharedLibraryInfo info : deps) {
+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ final class DexOptHelper {
        // at boot, or background job), the passed 'targetCompilerFilter' stays the same,
        // and the first package that uses the library will dexopt it. The
        // others will see that the compiled code for the library is up to date.
        Collection<SharedLibraryInfo> deps = SharedLibraryHelper.findSharedLibraries(pkgSetting);
        Collection<SharedLibraryInfo> deps = SharedLibraryUtils.findSharedLibraries(pkgSetting);
        final String[] instructionSets = getAppDexInstructionSets(
                AndroidPackageUtils.getPrimaryCpuAbi(p, pkgSetting),
                AndroidPackageUtils.getSecondaryCpuAbi(p, pkgSetting));
+3 −3
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ final class ReconcilePackageUtils {

            // in the first pass, we'll build up the set of incoming shared libraries
            final List<SharedLibraryInfo> allowedSharedLibInfos =
                    SharedLibraryHelper.getAllowedSharedLibInfos(scanResult,
                    SharedLibraryUtils.getAllowedSharedLibInfos(scanResult,
                            request.mSharedLibrarySource);
            if (allowedSharedLibInfos != null) {
                for (SharedLibraryInfo info : allowedSharedLibInfos) {
                    if (!SharedLibraryHelper.addSharedLibraryToPackageVersionMap(
                    if (!SharedLibraryUtils.addSharedLibraryToPackageVersionMap(
                            incomingSharedLibraries, info)) {
                        throw new ReconcileFailure("Shared Library " + info.getName()
                                + " is being installed twice in this set!");
@@ -264,7 +264,7 @@ final class ReconcilePackageUtils {
            }
            try {
                result.get(installPackageName).mCollectedSharedLibraryInfos =
                        SharedLibraryHelper.collectSharedLibraryInfos(
                        SharedLibraryUtils.collectSharedLibraryInfos(
                                scanResult.mRequest.mParsedPackage,
                                combinedPackages, request.mSharedLibrarySource,
                                incomingSharedLibraries, injector.getCompatibility());
+1 −1
Original line number Diff line number Diff line
@@ -494,7 +494,7 @@ public final class SharedLibrariesImpl implements SharedLibrariesRead, Watchable
            @NonNull Map<String, AndroidPackage> availablePackages)
            throws PackageManagerException {
        final ArrayList<SharedLibraryInfo> sharedLibraryInfos =
                SharedLibraryHelper.collectSharedLibraryInfos(
                SharedLibraryUtils.collectSharedLibraryInfos(
                        pkgSetting.getPkg(), availablePackages, mSharedLibraries,
                        null /* newLibraries */, mInjector.getCompatibility());
        executeSharedLibrariesUpdateLPw(pkg, pkgSetting, changingLib, changingLibSetting,
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;

final class SharedLibraryHelper {
final class SharedLibraryUtils {
    private static final boolean DEBUG_SHARED_LIBRARIES = false;

    /**
Loading