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

Commit 4b4558e8 authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Inject more dependencies into PackageManagerService

This change gets all dependencies required to execute the constructor of
PackageManagerService in a "nominal" scenario and adds a simple unit
test for that scenario.

Test: atest PackageManagerServiceBootTest
Bug: 169360984
Change-Id: If436fa3f1c7bda2498930d6a89211e368af410c4
parent 0262136e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ public interface PackageAbiHelper {
     * If {@code extractLibs} is true, native libraries are extracted from the app if required.
     * If {@code extractLibs} is true, native libraries are extracted from the app if required.
     */
     */
    Pair<Abis, NativeLibraryPaths> derivePackageAbi(AndroidPackage pkg, boolean isUpdatedSystemApp,
    Pair<Abis, NativeLibraryPaths> derivePackageAbi(AndroidPackage pkg, boolean isUpdatedSystemApp,
            String cpuAbiOverride) throws PackageManagerException;
            String cpuAbiOverride, File appLib32InstallDir) throws PackageManagerException;


    /**
    /**
     * Calculates adjusted ABIs for a set of packages belonging to a shared user so that they all
     * Calculates adjusted ABIs for a set of packages belonging to a shared user so that they all
+3 −3
Original line number Original line Diff line number Diff line
@@ -296,7 +296,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {


    @Override
    @Override
    public Pair<Abis, NativeLibraryPaths> derivePackageAbi(AndroidPackage pkg,
    public Pair<Abis, NativeLibraryPaths> derivePackageAbi(AndroidPackage pkg,
            boolean isUpdatedSystemApp, String cpuAbiOverride)
            boolean isUpdatedSystemApp, String cpuAbiOverride, File appLib32InstallDir)
            throws PackageManagerException {
            throws PackageManagerException {
        // Give ourselves some initial paths; we'll come back for another
        // Give ourselves some initial paths; we'll come back for another
        // pass once we've determined ABI below.
        // pass once we've determined ABI below.
@@ -304,7 +304,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {
        String pkgRawSecondaryCpuAbi = AndroidPackageUtils.getRawSecondaryCpuAbi(pkg);
        String pkgRawSecondaryCpuAbi = AndroidPackageUtils.getRawSecondaryCpuAbi(pkg);
        final NativeLibraryPaths initialLibraryPaths = deriveNativeLibraryPaths(
        final NativeLibraryPaths initialLibraryPaths = deriveNativeLibraryPaths(
                new Abis(pkgRawPrimaryCpuAbi, pkgRawSecondaryCpuAbi),
                new Abis(pkgRawPrimaryCpuAbi, pkgRawSecondaryCpuAbi),
                PackageManagerService.sAppLib32InstallDir, pkg.getPath(),
                appLib32InstallDir, pkg.getPath(),
                pkg.getBaseApkPath(), pkg.isSystem(),
                pkg.getBaseApkPath(), pkg.isSystem(),
                isUpdatedSystemApp);
                isUpdatedSystemApp);


@@ -452,7 +452,7 @@ final class PackageAbiHelperImpl implements PackageAbiHelper {


        final Abis abis = new Abis(primaryCpuAbi, secondaryCpuAbi);
        final Abis abis = new Abis(primaryCpuAbi, secondaryCpuAbi);
        return new Pair<>(abis,
        return new Pair<>(abis,
                deriveNativeLibraryPaths(abis, PackageManagerService.sAppLib32InstallDir,
                deriveNativeLibraryPaths(abis, appLib32InstallDir,
                        pkg.getPath(), pkg.getBaseApkPath(), pkg.isSystem(),
                        pkg.getPath(), pkg.getBaseApkPath(), pkg.isSystem(),
                        isUpdatedSystemApp));
                        isUpdatedSystemApp));
    }
    }
+368 −304

File changed.

Preview size limit exceeded, changes collapsed.

+10 −1
Original line number Original line Diff line number Diff line
@@ -475,6 +475,14 @@ public final class Settings {
        return mPackages.get(pkgName);
        return mPackages.get(pkgName);
    }
    }


    ArrayMap<String, PackageSetting> getPackagesLocked() {
        return mPackages;
    }

    KeySetManagerService getKeySetManagerService() {
        return mKeySetManagerService;
    }

    String getRenamedPackageLPr(String pkgName) {
    String getRenamedPackageLPr(String pkgName) {
        return mRenamedPackages.get(pkgName);
        return mRenamedPackages.get(pkgName);
    }
    }
@@ -5554,7 +5562,8 @@ public final class Settings {
        return mPreferredActivities.get(userId);
        return mPreferredActivities.get(userId);
    }
    }


    CrossProfileIntentResolver getCrossProfileIntentResolvers(int userId) {
    @Nullable
    CrossProfileIntentResolver getCrossProfileIntentResolver(int userId) {
        return mCrossProfileIntentResolvers.get(userId);
        return mCrossProfileIntentResolvers.get(userId);
    }
    }


+8 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,14 @@
        }
        }
      ]
      ]
    },
    },
    {
      "name": "FrameworksMockingServicesTests",
      "options": [
        {
          "include-filter": "com.android.server.pm."
        }
      ]
    },
    {
    {
      "name": "CtsContentTestCases",
      "name": "CtsContentTestCases",
      "options": [
      "options": [
Loading