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

Commit baf464e7 authored by Jooyung Han's avatar Jooyung Han
Browse files

Do not use /data/apex/active

With mount_before_data, installed apexes will be mounted from virtual
block devices (device-mapper devices to be precise). Hence the paths
would look like /dev/block/dm-7, not /data/apex/active/...

Hence, checking if the APEX path is not from the preinstalled location
(e.g. /vendor/apex) is fixed in this CL.

For the same reason, deleting those installed APEX files in cleanUp() is
fixed. In fact, these files don't need to be deleted because once the
preinstalled apexes are deleted, those dangling data apexes are deleted
by apexd after reboot.

Bug: 430161238
Flag: com.android.apex.flags.mount_before_data
Test: StagedRollbackTest, StagedInstallInternalTest
Change-Id: I7f0bdc4ffa6f9179d83f30846eef752ab2d163b4
parent 00d47d0a
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {

    @Before
    public void setUp() throws Exception {
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
                "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex");
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex");
        runPhase("expireRollbacks");
        mLogger.start(getDevice());
        getDevice().uninstallPackage("com.android.cts.install.lib.testapp.A");
@@ -94,11 +93,9 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
        mLogger.stop();
        runPhase("expireRollbacks");
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
                "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
                apexDataDirDeSys(APK_IN_APEX_TESTAPEX_NAME) + "*",
                apexDataDirCe(APK_IN_APEX_TESTAPEX_NAME, 0) + "*",
                "/system/apex/test.rebootless_apex_v*.apex",
                "/data/apex/active/test.apex.rebootless*.apex");
                "/system/apex/test.rebootless_apex_v*.apex");
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ public class StagedInstallInternalTest {
                    .isEqualTo(ApplicationInfo.FLAG_UPDATED_SYSTEM_APP);
            assertThat(apex.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED)
                    .isEqualTo(ApplicationInfo.FLAG_INSTALLED);
            assertThat(apex.applicationInfo.sourceDir).startsWith("/data/apex/active");
            assertThat(apex.applicationInfo.sourceDir.startsWith("/system/apex")).isFalse();
        }
        {
            PackageInfo apex = pm.getPackageInfo("test.apex.rebootless",
@@ -489,7 +489,7 @@ public class StagedInstallInternalTest {
                    .isEqualTo(ApplicationInfo.FLAG_UPDATED_SYSTEM_APP);
            assertThat(apex.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED)
                    .isEqualTo(ApplicationInfo.FLAG_INSTALLED);
            assertThat(apex.applicationInfo.sourceDir).startsWith("/data/apex/active");
            assertThat(apex.applicationInfo.sourceDir.startsWith("/system/apex")).isFalse();
        }
        {
            PackageInfo apex = pm.getPackageInfo("test.apex.rebootless",
@@ -609,7 +609,7 @@ public class StagedInstallInternalTest {
        assertThat(pi.getLongVersionCode()).isEqualTo(2);
        assertThat(pi.applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_VENDOR)
                .isEqualTo(ApplicationInfo.PRIVATE_FLAG_VENDOR);
        assertThat(pi.applicationInfo.sourceDir).startsWith("/data/apex");
        assertThat(pi.applicationInfo.sourceDir.startsWith("/vendor/apex")).isFalse();
    }

    private IPackageManagerNative getPackageManagerNative() {
+2 −3
Original line number Diff line number Diff line
@@ -93,12 +93,11 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test {
        } catch (AssertionError e) {
            Log.e(TAG, e);
        }
        // Delete test APEXes from the preinstalled partitions and test-only sysconfig.
        // Note that installed APEX files will be deleted by apexd after reboot.
        deleteFiles("/system/apex/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
                "/data/apex/active/" + APK_IN_APEX_TESTAPEX_NAME + "*.apex",
                "/data/apex/active/" + SHIM_APEX_PACKAGE_NAME + "*.apex",
                "/system/apex/test.rebootless_apex_v*.apex",
                "/vendor/apex/test.rebootless_apex_v*.apex",
                "/data/apex/active/test.apex.rebootless*.apex",
                "/system/app/TestApp/TestAppAv1.apk",
                TEST_VENDOR_APEX_ALLOW_LIST);
    }