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

Commit fafd2494 authored by jsong.song's avatar jsong.song Committed by Ivan Chiang
Browse files

Fix to pass apex package names to ApexManager methods

getApksInApex and getApkInApexInstallError need apex package name as a
argument, but apex module name was passed in some code. This is a change
to fix the incorrect code.

Bug: 317926654
Test: atest FrameworksMockingServicesTests:ApexManagerTest
(cherry picked from https://partner-android-review.googlesource.com/q/commit:ee71b0ab06b1d4941efa873fa80c06aef485ea58)

Change-Id: I3b54cdb0c7d5f80f7425041476b8b11349c1a807
parent d0c02daa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -180,7 +180,9 @@ final class InitAppsHelper {
        // priority of system overlays.
        final ArrayMap<String, File> apkInApexPreInstalledPaths = new ArrayMap<>();
        for (ApexManager.ActiveApexInfo apexInfo : mApexManager.getActiveApexInfos()) {
            for (String packageName : mApexManager.getApksInApex(apexInfo.apexModuleName)) {
            final String apexPackageName = mApexManager.getActivePackageNameForApexModuleName(
                    apexInfo.apexModuleName);
            for (String packageName : mApexManager.getApksInApex(apexPackageName)) {
                apkInApexPreInstalledPaths.put(packageName, apexInfo.preInstalledApexPath);
            }
        }
+8 −4
Original line number Diff line number Diff line
@@ -343,10 +343,12 @@ public class ApexManagerTest {
        List<ApexManager.ScanResult> scanResults = scanApexInfos(apexInfo);
        mApexManager.notifyScanResult(scanResults);

        assertThat(mApexManager.getApkInApexInstallError(activeApex.apexModuleName)).isNull();
        final String apexPackageName = mApexManager.getActivePackageNameForApexModuleName(
                activeApex.apexModuleName);
        assertThat(mApexManager.getApkInApexInstallError(apexPackageName)).isNull();
        mApexManager.reportErrorWithApkInApex(activeApex.apexDirectory.getAbsolutePath(),
                "Some random error");
        assertThat(mApexManager.getApkInApexInstallError(activeApex.apexModuleName))
        assertThat(mApexManager.getApkInApexInstallError(apexPackageName))
                .isEqualTo("Some random error");
    }

@@ -370,9 +372,11 @@ public class ApexManagerTest {
        List<ApexManager.ScanResult> scanResults = scanApexInfos(apexInfo);
        mApexManager.notifyScanResult(scanResults);

        assertThat(mApexManager.getApksInApex(activeApex.apexModuleName)).isEmpty();
        final String apexPackageName = mApexManager.getActivePackageNameForApexModuleName(
                activeApex.apexModuleName);
        assertThat(mApexManager.getApksInApex(apexPackageName)).isEmpty();
        mApexManager.registerApkInApex(fakeApkInApex);
        assertThat(mApexManager.getApksInApex(activeApex.apexModuleName)).isEmpty();
        assertThat(mApexManager.getApksInApex(apexPackageName)).isEmpty();
    }

    @Test