Cleanup: remove ro.apex.updatable usage
"flattened" apexes are no longer supported and ro.apex.updatable should
be always true.
Bug: 297460439
Test: atest CtsApexTestCases
Test: atest CtsInstallTestCases
Test: atest CtsRollbackManagerHostTestCases
Test: atest CtsStagedInstallHostTestCases
Test: atest CtsContentTestCases:PackageManagerTest
Merged-In: I758ee62d1d8e5862d19dc1f922ce264fd8e82695
Change-Id: I758ee62d1d8e5862d19dc1f922ce264fd8e82695
(cherry picked from commit 40f55e51eda947c381aa2df9ea455810ce2ea2f0)
diff --git a/hostsidetests/apex/src/android/apex/cts/ApexTest.java b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
index 3db27f9..19198ba 100644
--- a/hostsidetests/apex/src/android/apex/cts/ApexTest.java
+++ b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
@@ -16,8 +16,6 @@
package android.apex.cts;
-import static com.android.cts.shim.lib.ShimPackage.SHIM_APEX_PACKAGE_NAME;
-
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import com.android.tradefed.util.CommandResult;
@@ -30,46 +28,17 @@
@RunWith(DeviceJUnit4ClassRunner.class)
public class ApexTest extends BaseHostJUnit4Test {
- private boolean isApexUpdatable() throws Exception {
- return Boolean.parseBoolean(getDevice().getProperty("ro.apex.updatable"));
- }
-
- private boolean isGSI() throws Exception {
- String systemProduct = getDevice().getProperty("ro.product.system_ext.name");
- return (null != systemProduct)
- && (systemProduct.equals("gsi_arm")
- || systemProduct.equals("gsi_arm64")
- || systemProduct.equals("gsi_x86")
- || systemProduct.equals("gsi_x86_64")
- || systemProduct.equals("aosp_arm")
- || systemProduct.equals("aosp_arm64")
- || systemProduct.equals("aosp_x86")
- || systemProduct.equals("aosp_x86_64")
- || systemProduct.equals("aosp_tv_arm64")
- || systemProduct.equals("aosp_car_arm")
- || systemProduct.equals("aosp_car_arm64")
- || systemProduct.equals("aosp_car_x86")
- || systemProduct.equals("aosp_car_x86_64"));
- }
/**
- * Ensures that the built-in APEXes are all with flattened APEXes
- * or non-flattend APEXes. Mixture of them is not supported and thus
- * not allowed.
- *
- * GSI is exempt from this test since it exceptionally includes both types os APEXes.
+ * Ensures that the built-in APEXes are all non-flattend APEXes.
*/
@Test
public void testApexType() throws Exception {
- if (isGSI()) {
- return;
- }
-
String[] builtinDirs = {
- "/system/apex",
- "/system_ext/apex",
- "/product/apex",
- "/vendor/apex"
+ "/system/apex",
+ "/system_ext/apex",
+ "/product/apex",
+ "/vendor/apex"
};
int numFlattenedApexes = 0;
@@ -81,50 +50,41 @@
Assert.assertTrue(
"No APEX found",
- (numFlattenedApexes + numNonFlattenedApexes) != 0);
+ numNonFlattenedApexes != 0);
- if (isApexUpdatable()) {
- Assert.assertTrue(numFlattenedApexes +
- " flattened APEX(es) found on a device supporting updatable APEX",
- numFlattenedApexes == 0);
- } else {
- Assert.assertTrue(numNonFlattenedApexes +
- " non-flattened APEX(es) found on a device not supporting updatable APEX",
- numNonFlattenedApexes == 0);
- }
+ Assert.assertTrue(
+ "APEX should be updatable",
+ Boolean.parseBoolean(getDevice().getProperty("ro.apex.updatable")));
+
+ Assert.assertTrue(numFlattenedApexes
+ + " flattened APEX(es) found on a device supporting updatable APEX",
+ numFlattenedApexes == 0);
}
- // CTS shim APEX can be non-flattened - even when ro.apex.updatable=false.
- // Don't count it.
private int countFlattenedApexes(String dir) throws Exception {
CommandResult result = getDevice().executeShellV2Command(
- "find " + dir + " -type f -name \"apex_manifest.pb\" ! -path \"*" +
- SHIM_APEX_PACKAGE_NAME + "*\" | wc -l");
+ "find " + dir + " -type f -name \"apex_manifest.pb\" | wc -l");
return result.getExitCode() == 0 ? Integer.parseInt(result.getStdout().trim()) : 0;
}
private int countNonFlattenedApexes(String dir) throws Exception {
CommandResult result = getDevice().executeShellV2Command(
- "find " + dir + " -type f -name \"*.apex\" ! -name \"" +
- SHIM_APEX_PACKAGE_NAME + ".apex\" | wc -l");
+ "find " + dir + " -type f -name \"*.apex\" | wc -l");
return result.getExitCode() == 0 ? Integer.parseInt(result.getStdout().trim()) : 0;
}
/**
- * Ensures that pre-apexd processes (e.g. vold) and post-apexd processes (e.g. init) are using
+ * Ensures that pre-apexd processes (e.g. vold) and post-apexd processes (e.g.
+ * init) are using
* different mount namespaces (in case of ro.apexd.updatable is true), or not.
*/
@Test
public void testMountNamespaces() throws Exception {
final int rootMountIdOfInit = getMountEntry("1", "/").mountId;
final int rootMountIdOfVold = getMountEntry("$(pidof vold)", "/").mountId;
- if (isApexUpdatable()) {
- Assert.assertNotEquals("device supports updatable APEX, but is not using multiple mount namespaces",
- rootMountIdOfInit, rootMountIdOfVold);
- } else {
- Assert.assertEquals("device supports updatable APEX, but is using multiple mount namespaces",
- rootMountIdOfInit, rootMountIdOfVold);
- }
+
+ Assert.assertNotEquals("device supports updatable APEX, but is not using multiple mount namespaces",
+ rootMountIdOfInit, rootMountIdOfVold);
}
private static class MountEntry {
diff --git a/hostsidetests/install/src/android/cts/install/host/DowngradeTest.java b/hostsidetests/install/src/android/cts/install/host/DowngradeTest.java
index fc6be6f..bab9500 100644
--- a/hostsidetests/install/src/android/cts/install/host/DowngradeTest.java
+++ b/hostsidetests/install/src/android/cts/install/host/DowngradeTest.java
@@ -17,7 +17,6 @@
package android.cts.install.host;
import static com.google.common.truth.Truth.assertThat;
-
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
@@ -87,14 +86,6 @@
}
@Before
- public void assumeApexSupported() throws DeviceNotAvailableException {
- if (mInstallType.containsApex()) {
- assumeTrue("Device does not support updating APEX",
- mShimApexRule.isUpdatingApexSupported());
- }
- }
-
- @Before
public void assumeNotNativeBridgeWithApex() throws Exception {
if (!CpuFeatures.isNativeAbi(getDevice(), getAbi().getName())) {
assumeFalse("APEX packages do not work with native bridge",
diff --git a/hostsidetests/install/src/android/cts/install/host/InstallTest.java b/hostsidetests/install/src/android/cts/install/host/InstallTest.java
index d03bfab..59712c7 100644
--- a/hostsidetests/install/src/android/cts/install/host/InstallTest.java
+++ b/hostsidetests/install/src/android/cts/install/host/InstallTest.java
@@ -17,9 +17,7 @@
package android.cts.install.host;
import static com.google.common.truth.Truth.assertThat;
-
import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
import android.cts.install.INSTALL_TYPE;
import android.platform.test.annotations.LargeTest;
@@ -91,14 +89,6 @@
}
@Before
- public void assumeApexSupported() throws DeviceNotAvailableException {
- if (mInstallType.containsApex()) {
- assumeTrue("Device does not support updating APEX",
- mShimApexRule.isUpdatingApexSupported());
- }
- }
-
- @Before
public void assumeNotNativeBridgeWithApex() throws Exception {
if (!CpuFeatures.isNativeAbi(getDevice(), getAbi().getName())) {
assumeFalse("APEX packages do not work with native bridge",
diff --git a/hostsidetests/install/src/android/cts/install/host/SamegradeTest.java b/hostsidetests/install/src/android/cts/install/host/SamegradeTest.java
index 70bb3a1..9306e9e 100644
--- a/hostsidetests/install/src/android/cts/install/host/SamegradeTest.java
+++ b/hostsidetests/install/src/android/cts/install/host/SamegradeTest.java
@@ -30,7 +30,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameter;
@@ -57,9 +56,6 @@
private static final String ASSERT_PHASE = "assert_phase";
private static final String CLEAN_UP_PHASE = "cleanUp_phase";
- @Rule
- public ShimApexRule mShimApexRule = new ShimApexRule(this);
-
@Parameter(0)
public INSTALL_TYPE mInstallType;
@@ -85,14 +81,6 @@
}
@Before
- public void assumeApexSupported() throws DeviceNotAvailableException {
- if (mInstallType.containsApex()) {
- assumeTrue("Device does not support updating APEX",
- mShimApexRule.isUpdatingApexSupported());
- }
- }
-
- @Before
public void assumeNotNativeBridgeWithApex() throws Exception {
if (!CpuFeatures.isNativeAbi(getDevice(), getAbi().getName())) {
assumeFalse("APEX packages do not work with native bridge",
diff --git a/hostsidetests/install/src/android/cts/install/host/ShimApexRule.java b/hostsidetests/install/src/android/cts/install/host/ShimApexRule.java
index 4641aaa..6db4d3d 100644
--- a/hostsidetests/install/src/android/cts/install/host/ShimApexRule.java
+++ b/hostsidetests/install/src/android/cts/install/host/ShimApexRule.java
@@ -62,10 +62,6 @@
* unnecessary reboots.
*/
private void uninstallShimApexIfNecessary() throws DeviceNotAvailableException {
- if (!isUpdatingApexSupported()) {
- // Device doesn't support updating apex. Nothing to uninstall.
- return;
- }
if (getShimApex().sourceDir.startsWith("/system")) {
// System version is active, nothing to uninstall.
return;
@@ -85,11 +81,6 @@
assertThat(shim.sourceDir).startsWith("/system");
}
- boolean isUpdatingApexSupported() throws DeviceNotAvailableException {
- final String updatable = mHostTest.getDevice().getProperty("ro.apex.updatable");
- return updatable != null && updatable.equals("true");
- }
-
private ITestDevice.ApexInfo getShimApex() throws DeviceNotAvailableException {
return mHostTest.getDevice().getActiveApexes().stream().filter(
apex -> apex.name.equals(SHIM_APEX_PACKAGE_NAME)).findAny().orElseThrow(
diff --git a/hostsidetests/install/src/android/cts/install/host/UpgradeTest.java b/hostsidetests/install/src/android/cts/install/host/UpgradeTest.java
index 21067b5..eb6537d 100644
--- a/hostsidetests/install/src/android/cts/install/host/UpgradeTest.java
+++ b/hostsidetests/install/src/android/cts/install/host/UpgradeTest.java
@@ -30,7 +30,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameter;
@@ -54,9 +53,6 @@
private static final String ASSERT_POST_REBOOT_PHASE = "assert_postReboot_phase";
private static final String CLEAN_UP_PHASE = "cleanUp_phase";
- @Rule
- public ShimApexRule mShimApexRule = new ShimApexRule(this);
-
@Parameter(0)
public INSTALL_TYPE mInstallType;
@@ -89,14 +85,6 @@
}
}
- @Before
- public void assumeApexSupported() throws DeviceNotAvailableException {
- if (mInstallType.containsApex()) {
- assumeTrue("Device does not support updating APEX",
- mShimApexRule.isUpdatingApexSupported());
- }
- }
-
@Test
public void testNonStagedUpgrade() throws Exception {
// Apex should not be committed in non-staged install, such logic covered in InstallTest.
diff --git a/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java b/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
index 88e926a..a303e7a 100644
--- a/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
+++ b/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
@@ -133,8 +133,6 @@
*/
@Test
public void testApexOnlyStagedRollback() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
run("testApexOnlyStagedRollback_Phase1_InstallFirst");
getDevice().reboot();
run("testApexOnlyStagedRollback_Phase2_InstallSecond");
@@ -149,8 +147,6 @@
*/
@Test
public void testApexOnlySystemVersionStagedRollback() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
run("testApexOnlySystemVersionStagedRollback_Phase1_Install");
getDevice().reboot();
run("testApexOnlySystemVersionStagedRollback_Phase2_RollBack");
@@ -164,7 +160,6 @@
@Test
public void testApexAndApkStagedRollback() throws Exception {
assumeSystemUser();
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
run("testApexAndApkStagedRollback_Phase1_InstallFirst");
getDevice().reboot();
@@ -186,8 +181,6 @@
*/
@Test
public void testApexRollbackExpiration() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
run("testApexRollbackExpiration_Phase1_InstallFirst");
getDevice().reboot();
run("testApexRollbackExpiration_Phase2_InstallSecond");
@@ -200,8 +193,6 @@
*/
@Test
public void testApexKeyRotationStagedRollback() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
run("testApexKeyRotationStagedRollback_Phase1_Install");
getDevice().reboot();
run("testApexKeyRotationStagedRollback_Phase2_RollBack");
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
index e98f1d7..ed60a99 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
@@ -712,13 +712,6 @@
}
@Test
- public void testInstallApex_DeviceDoesNotSupportApex_Fails() throws Exception {
- InstallUtils.commitExpectingFailure(IllegalArgumentException.class,
- "This device doesn't support the installation of APEX files",
- Install.single(TestApp.Apex2).setStaged());
- }
-
- @Test
public void testFailsInvalidApexInstall_Commit() throws Exception {
assertThat(getInstalledVersion(SHIM_APEX_PACKAGE_NAME)).isEqualTo(1);
int sessionId = stageSingleApk(ApexWrongSha2).assertFailure()
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
index 7a18cf8..a625cff 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
@@ -23,9 +23,6 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
-import static org.junit.Assume.assumeTrue;
-
-import android.cts.install.lib.host.InstallUtilsHost;
import android.platform.test.annotations.LargeTest;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
@@ -67,8 +64,6 @@
@RunWith(DeviceJUnit4ClassRunner.class)
public class ApexShimValidationTest extends BaseHostJUnit4Test {
- private final InstallUtilsHost mHostUtils = new InstallUtilsHost(this);
-
private static final String SHIM_APK_CODE_PATH_PREFIX = "/apex/" + SHIM_APEX_PACKAGE_NAME + "/";
private static final String STAGED_INSTALL_TEST_FILE_NAME = "StagedInstallTest.apk";
private static final String APEX_FILE_SUFFIX = ".apex";
@@ -110,7 +105,6 @@
@Before
public void setUp() throws Exception {
- assumeTrue("Device doesn't support updating APEX", mHostUtils.isApexUpdateSupported());
cleanUp();
mDeapexerZip = getTestInformation().getDependencyFile(DEAPEXER_ZIP_FILE_NAME, false);
mAllApexesZip = getTestInformation().getDependencyFile(STAGED_INSTALL_TEST_FILE_NAME,
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
index 73ceea1..7456f92 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
@@ -145,19 +145,16 @@
@Test
public void testStageAnotherSessionImmediatelyAfterAbandon() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
runPhase("testStageAnotherSessionImmediatelyAfterAbandon");
}
@Test
public void testStageAnotherSessionImmediatelyAfterAbandonMultiPackage() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
runPhase("testStageAnotherSessionImmediatelyAfterAbandonMultiPackage");
}
@Test
public void testNoSessionUpdatedBroadcastSentForStagedSessionAbandon() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
runPhase("testNoSessionUpdatedBroadcastSentForStagedSessionAbandon");
}
@@ -233,8 +230,6 @@
@Test
public void testShimApexShouldPreInstalledIfUpdatingApexIsSupported() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
final ITestDevice.ApexInfo shimApex = mHostUtils.getShimApex().orElseThrow(
() -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME)
);
@@ -244,8 +239,6 @@
@Test
@LargeTest
public void testInstallStagedApex() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
setDefaultLauncher(BROADCAST_RECEIVER_COMPONENT);
runPhase("testInstallStagedApex_Commit");
getDevice().reboot();
@@ -256,7 +249,6 @@
// Don't mark as @LargeTest since we want at least one test to install apex during pre-submit.
public void testInstallStagedApexAndApk() throws Exception {
assumeSystemUser();
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
setDefaultLauncher(BROADCAST_RECEIVER_COMPONENT);
runPhase("testInstallStagedApexAndApk_Commit");
@@ -266,30 +258,22 @@
@Test
public void testsFailsNonStagedApexInstall() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testsFailsNonStagedApexInstall");
}
@Test
public void testInstallStagedNonPreInstalledApex_Fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testInstallStagedNonPreInstalledApex_Fails");
}
@Test
public void testInstallStagedDifferentPackageNameWithInstalledApex_Fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testInstallStagedDifferentPackageNameWithInstalledApex_Fails");
}
@Test
@LargeTest
public void testStageApkWithSameNameAsApexShouldFail() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testStageApkWithSameNameAsApexShouldFail_Commit");
getDevice().reboot();
runPhase("testStageApkWithSameNameAsApexShouldFail_VerifyPostReboot");
@@ -297,15 +281,12 @@
@Test
public void testNonStagedInstallApkWithSameNameAsApexShouldFail() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
runPhase("testNonStagedInstallApkWithSameNameAsApexShouldFail");
}
@Test
@LargeTest
public void testStagedInstallDowngradeApex_DowngradeNotRequested_Fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV3Apex();
runPhase("testStagedInstallDowngradeApex_DowngradeNotRequested_Fails_Commit");
getDevice().reboot();
@@ -316,7 +297,6 @@
@LargeTest
public void testStagedInstallDowngradeApex_DowngradeRequested_DebugBuild() throws Exception {
assumeThat(getDevice().getBuildFlavor(), not(endsWith("-user")));
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
installV3Apex();
runPhase("testStagedInstallDowngradeApex_DowngradeRequested_DebugBuild_Commit");
@@ -330,7 +310,6 @@
throws Exception {
assumeThat(getDevice().getBuildFlavor(), endsWith("-user"));
assumeFalse("Device is debuggable", isDebuggable());
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
installV3Apex();
runPhase("testStagedInstallDowngradeApex_DowngradeRequested_UserBuild_Fails_Commit");
@@ -343,7 +322,6 @@
@LargeTest
public void testStagedInstallDowngradeApexToSystemVersion_DebugBuild() throws Exception {
assumeThat(getDevice().getBuildFlavor(), not(endsWith("-user")));
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
installV2Apex();
runPhase("testStagedInstallDowngradeApexToSystemVersion_DebugBuild_Commit");
@@ -354,7 +332,6 @@
@Test
@LargeTest
public void testInstallStagedApex_SameGrade() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
installV3Apex();
ApexInfo shim1 =
readApexInfoList().stream()
@@ -382,8 +359,6 @@
@Test
@LargeTest
public void testInstallStagedApex_SameGrade_NewOneWins() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2Apex();
runPhase("testInstallStagedApex_SameGrade_NewOneWins_Commit");
@@ -391,13 +366,6 @@
runPhase("testInstallStagedApex_SameGrade_NewOneWins_VerifyPostReboot");
}
- @Test
- public void testInstallApex_DeviceDoesNotSupportApex_Fails() throws Exception {
- assumeFalse("Device supports updating APEX", mHostUtils.isApexUpdateSupported());
-
- runPhase("testInstallApex_DeviceDoesNotSupportApex_Fails");
- }
-
private void installV2Apex()throws Exception {
runPhase("testInstallV2Apex_Commit");
getDevice().reboot();
@@ -418,7 +386,6 @@
@Test
public void testFailsInvalidApexInstall() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
runPhase("testFailsInvalidApexInstall_Commit");
runPhase("testFailsInvalidApexInstall_AbandonSessionIsNoop");
}
@@ -431,8 +398,6 @@
@Test
@LargeTest
public void testInstallStagedApexWithoutApexSuffix() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testInstallStagedApexWithoutApexSuffix_Commit");
getDevice().reboot();
runPhase("testInstallStagedApexWithoutApexSuffix_VerifyPostReboot");
@@ -440,8 +405,6 @@
@Test
public void testRejectsApexDifferentCertificate() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRejectsApexDifferentCertificate");
}
@@ -460,8 +423,6 @@
// Should not be able to update with a key that has not been rotated.
@Test
public void testUpdateWithDifferentKeyButNoRotation() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testUpdateWithDifferentKeyButNoRotation");
}
@@ -469,8 +430,6 @@
@Test
@LargeTest
public void testUpdateWithDifferentKey() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testUpdateWithDifferentKey_Commit");
getDevice().reboot();
runPhase("testUpdateWithDifferentKey_VerifyPostReboot");
@@ -481,8 +440,6 @@
@Test
@LargeTest
public void testUntrustedOldKeyIsRejected() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2SignedBobApex();
runPhase("testUntrustedOldKeyIsRejected");
}
@@ -491,8 +448,6 @@
@Test
@LargeTest
public void testTrustedOldKeyIsAccepted() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testTrustedOldKeyIsAccepted_Commit");
getDevice().reboot();
runPhase("testTrustedOldKeyIsAccepted_CommitPostReboot");
@@ -504,8 +459,6 @@
@Test
@LargeTest
public void testAfterRotationNewKeyCanUpdateFurther() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2SignedBobApex();
runPhase("testAfterRotationNewKeyCanUpdateFurther_CommitPostReboot");
getDevice().reboot();
@@ -515,8 +468,6 @@
@Test
@LargeTest
public void testAfterRotationNewKeyCanUpdateFurtherWithoutLineage() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2SignedBobApex();
runPhase("testAfterRotationNewKeyCanUpdateFurtherWithoutLineage");
}
@@ -610,8 +561,6 @@
@Test
@LargeTest
public void testSamegradeSystemApex() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testSamegradeSystemApex_Commit");
getDevice().reboot();
runPhase("testSamegradeSystemApex_VerifyPostReboot");
@@ -633,8 +582,6 @@
@Test
@LargeTest
public void testInstallStagedNoHashtreeApex() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testInstallStagedNoHashtreeApex_Commit");
getDevice().reboot();
runPhase("testInstallStagedNoHashtreeApex_VerifyPostReboot");
@@ -645,8 +592,6 @@
*/
@Test
public void testApexTargetingOldDevSdkFailsVerification() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexTargetingOldDevSdkFailsVerification");
}
@@ -656,8 +601,6 @@
@Test
@LargeTest
public void testApexFailsToInstallIfApkInApexFailsToScan() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexFailsToInstallIfApkInApexFailsToScan_Commit");
getDevice().reboot();
runPhase("testApexFailsToInstallIfApkInApexFailsToScan_VerifyPostReboot");
@@ -665,8 +608,6 @@
@Test
public void testCorruptedApexFailsVerification_b146895998() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testCorruptedApexFailsVerification_b146895998");
}
@@ -675,8 +616,6 @@
*/
@Test
public void testApexWithUnsignedApkFailsVerification() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexWithUnsignedApkFailsVerification");
}
@@ -685,8 +624,6 @@
*/
@Test
public void testApexSignPayloadWithDifferentKeyFailsVerification() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexSignPayloadWithDifferentKeyFailsVerification");
}
@@ -695,16 +632,12 @@
*/
@Test
public void testApexWithUnsignedPayloadFailsVerification() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexWithUnsignedPayloadFailsVerification");
}
@Test
@LargeTest
public void testApexSetsUpdatedSystemAppFlag() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testApexSetsUpdatedSystemAppFlag_preUpdate");
installV2Apex();
runPhase("testApexSetsUpdatedSystemAppFlag_postUpdate");
@@ -721,8 +654,6 @@
@Test
@LargeTest
public void testUpdatedApexFromDataApexActiveCanBePulled() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2Apex();
final ITestDevice.ApexInfo shimApex = mHostUtils.getShimApex().orElseThrow(
@@ -735,8 +666,6 @@
@Test
public void testApexInfoList() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
// Check that content of /apex/apex-info-list.xml matches output of
// `adb shell pm list packages --apex-only --show-versioncode -f`.
List<ApexInfo> apexInfoList =
@@ -765,8 +694,6 @@
@Test
@LargeTest
public void testApexInfoListAfterUpdate() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
ApexInfo shimBeforeUpdate = getShimApexInfo();
installV2Apex();
@@ -816,8 +743,6 @@
@Test
@LargeTest
public void testRebootlessUpdate() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate");
ApexInfo activeShimApexInfo = getActiveShimApexInfo();
assertThat(activeShimApexInfo.getModuleName()).isEqualTo(SHIM_APEX_PACKAGE_NAME);
@@ -829,8 +754,6 @@
@Test
@LargeTest
public void testRebootlessUpdate_fromV2ToV3_sameBoot() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate");
runPhase("testRebootlessUpdate_installV3");
ApexInfo activeShimApexInfo = getActiveShimApexInfo();
@@ -843,8 +766,6 @@
@Test
@LargeTest
public void testRebootlessUpdate_fromV2ToV3_rebootInBetween() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate");
getDevice().reboot();
runPhase("testRebootlessUpdate_installV3");
@@ -858,59 +779,43 @@
@Test
@LargeTest
public void testRebootlessUpdate_downgrage_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_installV3");
runPhase("testRebootlessUpdate_downgradeToV2_fails");
}
@Test
public void testRebootlessUpdate_noPermission_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_noPermission_fails");
}
@Test
public void testRebootlessUpdate_noPreInstalledApex_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_noPreInstalledApex_fails");
}
@Test
public void testRebootlessUpdate_unsignedPayload_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_unsignedPayload_fails");
}
@Test
public void testRebootlessUpdate_payloadSignedWithDifferentKey_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_payloadSignedWithDifferentKey_fails");
}
@Test
public void testRebootlessUpdate_outerContainerSignedWithDifferentCert_fails()
throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_outerContainerSignedWithDifferentCert_fails");
}
@Test
public void testRebootlessUpdate_outerContainerUnsigned_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_outerContainerUnsigned_fails");
}
@Test
public void testRebootlessUpdate_targetsOlderSdk_fails() throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
runPhase("testRebootlessUpdate_targetsOlderSdk_fails");
}
@@ -918,8 +823,6 @@
@LargeTest
public void testGetInactiveApexFactoryPackagesAfterApexInstall_containsNoDuplicates()
throws Exception {
- assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
-
installV2Apex();
runPhase("testGetInactiveApexFactoryPackagesAfterApexInstall_containsNoDuplicates");
}
diff --git a/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java b/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java
index 2a37038..5cab05a 100644
--- a/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java
+++ b/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java
@@ -92,10 +92,6 @@
* unnecessary reboots.
*/
public void uninstallShimApexIfNecessary() throws Exception {
- if (!isApexUpdateSupported()) {
- // Device doesn't support updating apex. Nothing to uninstall.
- return;
- }
final ITestDevice.ApexInfo shimApex = getShimApex().orElseThrow(
() -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME));
if (shimApex.sourceDir.startsWith("/system")) {
diff --git a/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java b/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
index 89d6aed..97c9237 100644
--- a/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
@@ -56,7 +56,6 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import static org.testng.Assert.assertThrows;
@@ -107,7 +106,6 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.UserHandle;
import android.platform.test.annotations.AppModeFull;
import android.provider.Settings;
@@ -1582,8 +1580,6 @@
@Test
public void testGetPackageInfo_ApexSupported_ApexPackage_MatchesApex() throws Exception {
- assumeTrue("Device doesn't support updating APEX", isUpdatingApexSupported());
-
final int flags = PackageManager.MATCH_APEX
| PackageManager.MATCH_FACTORY_ONLY
| PackageManager.GET_SIGNING_CERTIFICATES
@@ -1595,32 +1591,6 @@
@Test
public void testGetPackageInfo_ApexSupported_ApexPackage_DoesNotMatchApex() {
- assumeTrue("Device doesn't support updating APEX", isUpdatingApexSupported());
-
- try {
- mPackageManager.getPackageInfo(SHIM_APEX_PACKAGE_NAME,
- PackageManager.PackageInfoFlags.of(0));
- fail("NameNotFoundException expected");
- } catch (NameNotFoundException expected) {
- }
- }
-
- @Test
- public void testGetPackageInfo_ApexNotSupported_ApexPackage_MatchesApex() {
- assumeFalse("Device supports updating APEX", isUpdatingApexSupported());
-
- try {
- mPackageManager.getPackageInfo(SHIM_APEX_PACKAGE_NAME,
- PackageManager.PackageInfoFlags.of(PackageManager.MATCH_APEX));
- fail("NameNotFoundException expected");
- } catch (NameNotFoundException expected) {
- }
- }
-
- @Test
- public void testGetPackageInfo_ApexNotSupported_ApexPackage_DoesNotMatchApex() {
- assumeFalse("Device supports updating APEX", isUpdatingApexSupported());
-
try {
mPackageManager.getPackageInfo(SHIM_APEX_PACKAGE_NAME,
PackageManager.PackageInfoFlags.of(0));
@@ -1631,8 +1601,6 @@
@Test
public void testGetInstalledPackages_ApexSupported_MatchesApex() {
- assumeTrue("Device doesn't support updating APEX", isUpdatingApexSupported());
-
final int flags = PackageManager.MATCH_APEX
| PackageManager.MATCH_FACTORY_ONLY
| PackageManager.GET_SIGNING_CERTIFICATES
@@ -1648,32 +1616,6 @@
@Test
public void testGetInstalledPackages_ApexSupported_DoesNotMatchApex() {
- assumeTrue("Device doesn't support updating APEX", isUpdatingApexSupported());
-
- List<PackageInfo> installedPackages = mPackageManager.getInstalledPackages(
- PackageManager.PackageInfoFlags.of(0));
- List<PackageInfo> shimApex = installedPackages.stream().filter(
- packageInfo -> packageInfo.packageName.equals(SHIM_APEX_PACKAGE_NAME)).collect(
- Collectors.toList());
- assertWithMessage("Shim apex wasn't supposed to be found").that(shimApex).isEmpty();
- }
-
- @Test
- public void testGetInstalledPackages_ApexNotSupported_MatchesApex() {
- assumeFalse("Device supports updating APEX", isUpdatingApexSupported());
-
- List<PackageInfo> installedPackages = mPackageManager.getInstalledPackages(
- PackageManager.PackageInfoFlags.of(PackageManager.MATCH_APEX));
- List<PackageInfo> shimApex = installedPackages.stream().filter(
- packageInfo -> packageInfo.packageName.equals(SHIM_APEX_PACKAGE_NAME)).collect(
- Collectors.toList());
- assertWithMessage("Shim apex wasn't supposed to be found").that(shimApex).isEmpty();
- }
-
- @Test
- public void testGetInstalledPackages_ApexNotSupported_DoesNotMatchApex() {
- assumeFalse("Device supports updating APEX", isUpdatingApexSupported());
-
List<PackageInfo> installedPackages = mPackageManager.getInstalledPackages(
PackageManager.PackageInfoFlags.of(0));
List<PackageInfo> shimApex = installedPackages.stream().filter(
@@ -1886,8 +1828,6 @@
@Test
public void testGetApplicationInfo_ApexSupported_MatchesApex() throws Exception {
- assumeTrue("Device doesn't support updating APEX", isUpdatingApexSupported());
-
ApplicationInfo ai = mPackageManager.getApplicationInfo(
SHIM_APEX_PACKAGE_NAME,
PackageManager.ApplicationInfoFlags.of(PackageManager.MATCH_APEX));
@@ -1908,10 +1848,6 @@
assertThat(info.icon).isEqualTo((useRoundIcon ? info.roundIconRes : info.iconRes));
}
- private boolean isUpdatingApexSupported() {
- return SystemProperties.getBoolean("ro.apex.updatable", false);
- }
-
private static void assertShimApexInfoIsCorrect(PackageInfo packageInfo) {
assertThat(packageInfo.packageName).isEqualTo(SHIM_APEX_PACKAGE_NAME);
assertThat(packageInfo.getLongVersionCode()).isEqualTo(1);