Merge "support system server jars install in system_ext"

This commit is contained in:
Treehugger Robot
2022-09-16 17:51:26 +00:00
committed by Gerrit Code Review
2 changed files with 37 additions and 0 deletions

View File

@@ -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)
}

View File

@@ -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)