aboutsummaryrefslogtreecommitdiff
path: root/dexpreopt
diff options
context:
space:
mode:
authorliulvping <liulvping@xiaomi.com>2022-05-07 14:40:13 +0800
committerhuyuxin <huyuxin@xiaomi.com>2022-09-16 20:36:42 +0800
commit76d56ee9f8b02ae39fac19ecd67d05270bd4b69a (patch)
tree6986f2609eb0f75c8d2c9d85363010bc1280259a /dexpreopt
parent274c5875e54c7b29d8b807b6641f266805ab4bad (diff)
support system server jars install in system_ext
Bug: 245383870 Bug: 155630745 Test:m nothing Test:- 1.Add a jar installed in the system_ext partition toSYSTEMSERVERJARS (e.g.b/245383870 PRODUCT_SYSTEM_SERVER_JARS_EXTRA += system_ext:oem-services) 2.Build a ROM 3.See the odex and vdex files generated in $ANDROID_PRODUCT_OUT/system_ext/framework/oat/ 4.Flash the ROM to a device 5.Check the maps information of the system_server , the newly added odex has the r-xp flags 6.Run `adb shell am restart;adb root;adb shell setprop dalvik.vm.extra-opts -verbose:deopt,heap,jit,oat,image,dex,verifier;` 7.Check ClassLoaderContext classpath size matching information 8.Run `atest art_standalone_odrefresh_tests` `atest art_standalone_dexpreopt_tests` `atest CtsSdkExtensionsTestCases` Change-Id: Ib1083ee130b5fef9c23d56523868fa1e29be879a Signed-off-by: liulvping <liulvping@xiaomi.com>
Diffstat (limited to 'dexpreopt')
-rw-r--r--dexpreopt/dexpreopt.go5
-rw-r--r--dexpreopt/dexpreopt_test.go32
2 files changed, 37 insertions, 0 deletions
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index d8011d69f..fdfd22e1b 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -201,6 +201,11 @@ func GetSystemServerDexLocation(ctx android.PathContext, global *GlobalConfig, l
if apex := global.AllApexSystemServerJars(ctx).ApexOfJar(lib); apex != "" {
return fmt.Sprintf("/apex/%s/javalib/%s.jar", apex, lib)
}
+
+ if apex := global.AllPlatformSystemServerJars(ctx).ApexOfJar(lib); apex == "system_ext" {
+ return fmt.Sprintf("/system_ext/framework/%s.jar", lib)
+ }
+
return fmt.Sprintf("/system/framework/%s.jar", lib)
}
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 07e4fad01..429b5ff1e 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -59,6 +59,15 @@ func testPlatformSystemServerModuleConfig(ctx android.PathContext, name string)
android.PathForOutput(ctx, fmt.Sprintf("%s/enforce_uses_libraries.status", name)))
}
+func testSystemExtSystemServerModuleConfig(ctx android.PathContext, name string) *ModuleConfig {
+ return createTestModuleConfig(
+ name,
+ fmt.Sprintf("/system_ext/framework/%s.jar", name),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/dexpreopt/%s.jar", name, name)),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/aligned/%s.jar", name, name)),
+ android.PathForOutput(ctx, fmt.Sprintf("%s/enforce_uses_libraries.status", name)))
+}
+
func createTestModuleConfig(name, dexLocation string, buildPath, dexPath, enforceUsesLibrariesStatusFile android.OutputPath) *ModuleConfig {
return &ModuleConfig{
Name: name,
@@ -213,6 +222,29 @@ func TestDexPreoptStandaloneSystemServerJars(t *testing.T) {
android.AssertStringEquals(t, "installs", wantInstalls.String(), rule.Installs().String())
}
+func TestDexPreoptSystemExtSystemServerJars(t *testing.T) {
+ config := android.TestConfig("out", nil, "", nil)
+ ctx := android.BuilderContextForTesting(config)
+ globalSoong := globalSoongConfigForTests()
+ global := GlobalConfigForTests(ctx)
+ module := testSystemExtSystemServerModuleConfig(ctx, "service-A")
+
+ global.StandaloneSystemServerJars = android.CreateTestConfiguredJarList(
+ []string{"system_ext:service-A"})
+
+ rule, err := GenerateDexpreoptRule(ctx, globalSoong, global, module)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ wantInstalls := android.RuleBuilderInstalls{
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.odex"), "/system_ext/framework/oat/arm/service-A.odex"},
+ {android.PathForOutput(ctx, "service-A/dexpreopt/oat/arm/javalib.vdex"), "/system_ext/framework/oat/arm/service-A.vdex"},
+ }
+
+ android.AssertStringEquals(t, "installs", wantInstalls.String(), rule.Installs().String())
+}
+
func TestDexPreoptApexStandaloneSystemServerJars(t *testing.T) {
config := android.TestConfig("out", nil, "", nil)
ctx := android.BuilderContextForTesting(config)