Propagate classpath info for staged apex to PackageManager
Bug: 187444679 Test: atest ApexTestCases Test: atest StagedInstallInternalTest Change-Id: I8e84fe72a213519cf658b769b794336eace9ab39
This commit is contained in:
@@ -1255,6 +1255,9 @@ public class StagingManager {
|
||||
info.diskImagePath = ai.modulePath;
|
||||
info.versionCode = ai.versionCode;
|
||||
info.versionName = ai.versionName;
|
||||
info.hasBootClassPathJars = ai.hasBootClassPathJars;
|
||||
info.hasDex2OatBootClassPathJars = ai.hasDex2OatBootClassPathJars;
|
||||
info.hasSystemServerClassPathJars = ai.hasSystemServerClassPathJars;
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ android_test_helper_app {
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
java_resources: [
|
||||
":apex.apexd_test_classpath",
|
||||
":com.android.apex.apkrollback.test_v2",
|
||||
":StagedInstallTestApexV2",
|
||||
":StagedInstallTestApexV2_WrongSha",
|
||||
@@ -54,6 +55,7 @@ java_test_host {
|
||||
"cts-install-lib-host",
|
||||
],
|
||||
data: [
|
||||
":apex.apexd_test",
|
||||
":com.android.apex.apkrollback.test_v1",
|
||||
":StagedInstallTestApexV2",
|
||||
":StagedInstallTestApexV2_WrongSha",
|
||||
|
||||
@@ -74,6 +74,11 @@ public class StagedInstallInternalTest {
|
||||
"ApexV2", SHIM_APEX_PACKAGE_NAME, 2, /* isApex= */ true,
|
||||
"com.android.apex.cts.shim.v2.apex");
|
||||
|
||||
private static final String TEST_APEX_PACKAGE_NAME = "com.android.apex.test_package";
|
||||
private static final TestApp TEST_APEX_CLASSPATH = new TestApp("TestApex",
|
||||
TEST_APEX_PACKAGE_NAME, 1, /*isApex=*/true,
|
||||
"apex.apexd_test_classpath.apex");
|
||||
|
||||
private File mTestStateFile = new File(
|
||||
InstrumentationRegistry.getInstrumentation().getContext().getFilesDir(),
|
||||
"stagedinstall_state");
|
||||
@@ -439,11 +444,13 @@ public class StagedInstallInternalTest {
|
||||
StagedApexInfo result = getPackageManagerNative().getStagedApexInfo("not found");
|
||||
assertThat(result).isNull();
|
||||
// Stage an apex
|
||||
int sessionId = Install.single(APEX_V2).setStaged().commit();
|
||||
int sessionId = Install.single(TEST_APEX_CLASSPATH).setStaged().commit();
|
||||
waitForSessionReady(sessionId);
|
||||
// Query proper module name
|
||||
result = getPackageManagerNative().getStagedApexInfo(SHIM_APEX_PACKAGE_NAME);
|
||||
assertThat(result.moduleName).isEqualTo(SHIM_APEX_PACKAGE_NAME);
|
||||
result = getPackageManagerNative().getStagedApexInfo(TEST_APEX_PACKAGE_NAME);
|
||||
assertThat(result.moduleName).isEqualTo(TEST_APEX_PACKAGE_NAME);
|
||||
assertThat(result.hasBootClassPathJars).isTrue();
|
||||
assertThat(result.hasSystemServerClassPathJars).isTrue();
|
||||
InstallUtils.openPackageInstallerSession(sessionId).abandon();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test {
|
||||
private static final String APEX_WRONG_SHA = "com.android.apex.cts.shim.v2_wrong_sha.apex";
|
||||
private static final String APK_A = "TestAppAv1.apk";
|
||||
private static final String APK_IN_APEX_TESTAPEX_NAME = "com.android.apex.apkrollback.test";
|
||||
private static final String APEXD_TEST_APEX = "apex.apexd_test.apex";
|
||||
|
||||
private static final String TEST_VENDOR_APEX_ALLOW_LIST =
|
||||
"/vendor/etc/sysconfig/test-vendor-apex-allow-list.xml";
|
||||
@@ -480,16 +481,29 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test {
|
||||
|
||||
@Test
|
||||
public void testGetStagedModuleNames() throws Exception {
|
||||
assumeTrue("Device does not support updating APEX",
|
||||
mHostUtils.isApexUpdateSupported());
|
||||
|
||||
runPhase("testGetStagedModuleNames");
|
||||
}
|
||||
|
||||
@Test
|
||||
@LargeTest
|
||||
public void testGetStagedApexInfo() throws Exception {
|
||||
assumeTrue("Device does not support updating APEX",
|
||||
mHostUtils.isApexUpdateSupported());
|
||||
|
||||
pushTestApex(APEXD_TEST_APEX);
|
||||
getDevice().reboot();
|
||||
|
||||
runPhase("testGetStagedApexInfo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStagedApexObserver() throws Exception {
|
||||
assumeTrue("Device does not support updating APEX",
|
||||
mHostUtils.isApexUpdateSupported());
|
||||
|
||||
runPhase("testStagedApexObserver");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user