From e736e13a8ddc079653575883dd2ecadb45f62f3a Mon Sep 17 00:00:00 2001 From: Ulya Trafimovich Date: Fri, 9 Apr 2021 17:41:24 +0100 Subject: [PATCH] Handle boot jars on /system_ext correctly. When Soong looks for boot jars among all modules, it applies certain constraints to each module that looks like a boot jar (e.g. that it comes from the right apex or platform). Previously these constraints did not handle boot jars on /system_ext correctly (they were handled like apex jars, while they should be handled like platform jars). Bug: 154976937 Test: m nothing (the modified Soong test would fail previously) Change-Id: I0746a2fd276ab5ef0400340c5b61cf26c2570e5a --- java/dexpreopt_bootjars.go | 2 +- java/dexpreopt_bootjars_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 7137f33ba..e57c3e98d 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -484,7 +484,7 @@ func getBootJar(ctx android.SingletonContext, bootjars android.ConfiguredJarList // Now match the apex part of the boot image configuration. requiredApex := bootjars.Apex(index) - if requiredApex == "platform" { + if requiredApex == "platform" || requiredApex == "system_ext" { if len(apexInfo.InApexes) != 0 { // A platform variant is required but this is for an apex so ignore it. return -1, nil, nil diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index d78651d90..73f21d12e 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -35,6 +35,7 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu name: "bar", srcs: ["b.java"], installable: true, + system_ext_specific: true, } dex_import { @@ -47,7 +48,7 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu prepareForJavaTest, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("foo"), - dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar", "platform:baz"), + dexpreopt.FixtureSetBootJars("platform:foo", "system_ext:bar", "platform:baz"), ).RunTestWithBp(t, bp) dexpreoptBootJars := result.SingletonForTests("dex_bootjars")