Merge "Simplify the construction of class loader contexts for system server jars." into rvc-dev
diff --git a/android/module.go b/android/module.go
index fd3fec3..665a30f 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1281,7 +1281,7 @@
func (b *baseModuleContext) OtherModuleName(m blueprint.Module) string { return b.bp.OtherModuleName(m) }
func (b *baseModuleContext) OtherModuleDir(m blueprint.Module) string { return b.bp.OtherModuleDir(m) }
func (b *baseModuleContext) OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{}) {
- b.bp.OtherModuleErrorf(m, fmt, args)
+ b.bp.OtherModuleErrorf(m, fmt, args...)
}
func (b *baseModuleContext) OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag {
return b.bp.OtherModuleDependencyTag(m)
diff --git a/cc/config/global.go b/cc/config/global.go
index d01dd84..29020ab 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -127,8 +127,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r377782b"
- ClangDefaultShortVersion = "10.0.4"
+ ClangDefaultVersion = "clang-r377782c"
+ ClangDefaultShortVersion = "10.0.5"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/java/droiddoc.go b/java/droiddoc.go
index fd4b90d..70d997a 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -1344,6 +1344,7 @@
cmd.FlagWithArg("--doc-stubs ", stubsDir.String())
} else {
cmd.FlagWithArg("--stubs ", stubsDir.String())
+ cmd.Flag("--exclude-documentation-from-stubs")
}
}
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index 8f34714..884a757 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -28,9 +28,10 @@
}, "outFlag", "stubAPIFlags")
type hiddenAPI struct {
- flagsCSVPath android.Path
- metadataCSVPath android.Path
bootDexJarPath android.Path
+ flagsCSVPath android.Path
+ indexCSVPath android.Path
+ metadataCSVPath android.Path
}
func (h *hiddenAPI) flagsCSV() android.Path {
@@ -45,17 +46,21 @@
return h.bootDexJarPath
}
+func (h *hiddenAPI) indexCSV() android.Path {
+ return h.indexCSVPath
+}
+
type hiddenAPIIntf interface {
- flagsCSV() android.Path
- metadataCSV() android.Path
bootDexJar() android.Path
+ flagsCSV() android.Path
+ indexCSV() android.Path
+ metadataCSV() android.Path
}
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
-func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath, implementationJar android.Path,
- uncompressDex bool) android.ModuleOutPath {
-
+func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath,
+ implementationJar android.Path, uncompressDex bool) android.ModuleOutPath {
if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
name := ctx.ModuleName()
@@ -77,9 +82,8 @@
// Derive the greylist from classes jar.
flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv")
- hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, implementationJar)
- h.flagsCSVPath = flagsCSV
- h.metadataCSVPath = metadataCSV
+ indexCSV := android.PathForModuleOut(ctx, "hiddenapi", "index.csv")
+ h.hiddenAPIGenerateCSV(ctx, flagsCSV, metadataCSV, indexCSV, implementationJar)
// If this module is actually on the boot jars list and not providing
// hiddenapi information for a module on the boot jars list then encode
@@ -96,9 +100,7 @@
return dexJar
}
-func hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, metadataCSV android.WritablePath,
- classesJar android.Path) {
-
+func (h *hiddenAPI) hiddenAPIGenerateCSV(ctx android.ModuleContext, flagsCSV, metadataCSV, indexCSV android.WritablePath, classesJar android.Path) {
stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags
ctx.Build(pctx, android.BuildParams{
@@ -112,6 +114,7 @@
"stubAPIFlags": stubFlagsCSV.String(),
},
})
+ h.flagsCSVPath = flagsCSV
ctx.Build(pctx, android.BuildParams{
Rule: hiddenAPIGenerateCSVRule,
@@ -124,18 +127,26 @@
"stubAPIFlags": stubFlagsCSV.String(),
},
})
+ h.metadataCSVPath = metadataCSV
+ rule := android.NewRuleBuilder()
+ rule.Command().
+ BuiltTool(ctx, "merge_csv").
+ FlagWithInput("--zip_input=", classesJar).
+ FlagWithOutput("--output=", indexCSV)
+ rule.Build(pctx, ctx, "merged-hiddenapi-index", "Merged Hidden API index")
+ h.indexCSVPath = indexCSV
}
var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", blueprint.RuleParams{
- Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output && ` +
- `unzip -o -q $in 'classes*.dex' -d $tmpDir/dex-input && ` +
- `for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do ` +
- ` echo "--input-dex=$${INPUT_DEX}"; ` +
- ` echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})"; ` +
- `done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags && ` +
- `${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" && ` +
- `${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" $out $tmpDir/dex.jar $in`,
+ Command: `rm -rf $tmpDir && mkdir -p $tmpDir && mkdir $tmpDir/dex-input && mkdir $tmpDir/dex-output &&
+ unzip -o -q $in 'classes*.dex' -d $tmpDir/dex-input &&
+ for INPUT_DEX in $$(find $tmpDir/dex-input -maxdepth 1 -name 'classes*.dex' | sort); do
+ echo "--input-dex=$${INPUT_DEX}";
+ echo "--output-dex=$tmpDir/dex-output/$$(basename $${INPUT_DEX})";
+ done | xargs ${config.HiddenAPI} encode --api-flags=$flagsCsv $hiddenapiFlags &&
+ ${config.SoongZipCmd} $soongZipFlags -o $tmpDir/dex.jar -C $tmpDir/dex-output -f "$tmpDir/dex-output/classes*.dex" &&
+ ${config.MergeZipsCmd} -D -zipToNotStrip $tmpDir/dex.jar -stripFile "classes*.dex" -stripFile "**/*.uau" $out $tmpDir/dex.jar $in`,
CommandDeps: []string{
"${config.HiddenAPI}",
"${config.SoongZipCmd}",
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 7850193..7e7e955 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -22,13 +22,15 @@
func init() {
android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
+ android.RegisterSingletonType("hiddenapi_index", hiddenAPIIndexSingletonFactory)
android.RegisterModuleType("hiddenapi_flags", hiddenAPIFlagsFactory)
}
type hiddenAPISingletonPathsStruct struct {
- stubFlags android.OutputPath
flags android.OutputPath
+ index android.OutputPath
metadata android.OutputPath
+ stubFlags android.OutputPath
}
var hiddenAPISingletonPathsKey = android.NewOnceKey("hiddenAPISingletonPathsKey")
@@ -39,9 +41,10 @@
func hiddenAPISingletonPaths(ctx android.PathContext) hiddenAPISingletonPathsStruct {
return ctx.Config().Once(hiddenAPISingletonPathsKey, func() interface{} {
return hiddenAPISingletonPathsStruct{
- stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"),
flags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-flags.csv"),
+ index: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-index.csv"),
metadata: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-greylist.csv"),
+ stubFlags: android.PathForOutput(ctx, "hiddenapi", "hiddenapi-stub-flags.txt"),
}
}).(hiddenAPISingletonPathsStruct)
}
@@ -364,3 +367,45 @@
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
return module
}
+
+func hiddenAPIIndexSingletonFactory() android.Singleton {
+ return &hiddenAPIIndexSingleton{}
+}
+
+type hiddenAPIIndexSingleton struct {
+ index android.Path
+}
+
+func (h *hiddenAPIIndexSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ // Don't run any hiddenapi rules if UNSAFE_DISABLE_HIDDENAPI_FLAGS=true
+ if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
+ return
+ }
+
+ indexes := android.Paths{}
+ ctx.VisitAllModules(func(module android.Module) {
+ if h, ok := module.(hiddenAPIIntf); ok {
+ if h.indexCSV() != nil {
+ indexes = append(indexes, h.indexCSV())
+ }
+ }
+ })
+
+ rule := android.NewRuleBuilder()
+ rule.Command().
+ BuiltTool(ctx, "merge_csv").
+ FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
+ FlagWithOutput("--output=", hiddenAPISingletonPaths(ctx).index).
+ Inputs(indexes)
+ rule.Build(pctx, ctx, "singleton-merged-hiddenapi-index", "Singleton merged Hidden API index")
+
+ h.index = hiddenAPISingletonPaths(ctx).index
+}
+
+func (h *hiddenAPIIndexSingleton) MakeVars(ctx android.MakeVarsContext) {
+ if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
+ return
+ }
+
+ ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_INDEX", h.index.String())
+}
diff --git a/java/java.go b/java/java.go
index 27e4d61..46adedc 100644
--- a/java/java.go
+++ b/java/java.go
@@ -794,7 +794,7 @@
return javaModule, true
case ver.kind == sdkModule:
return javaModule, false
- case name == "services-stubs":
+ case name == "android_system_server_stubs_current":
return javaSystemServer, true
case ver.kind == sdkSystemServer:
return javaSystemServer, false
diff --git a/java/sdk.go b/java/sdk.go
index 20a0772..4c9ba2b 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -396,7 +396,7 @@
return toModule([]string{"android_module_lib_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx))
case sdkSystemServer:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
- return toModule([]string{"android_module_lib_stubs_current", "services-stubs"}, "framework-res", sdkFrameworkAidlPath(ctx))
+ return toModule([]string{"android_system_server_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx))
default:
panic(fmt.Errorf("invalid sdk %q", sdkVersion.raw))
}
diff --git a/java/sdk_test.go b/java/sdk_test.go
index ea6733d..088db9e 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -222,9 +222,9 @@
{
name: "system_server_current",
properties: `sdk_version: "system_server_current",`,
- bootclasspath: []string{"android_module_lib_stubs_current", "services-stubs", "core-lambda-stubs"},
+ bootclasspath: []string{"android_system_server_stubs_current", "core-lambda-stubs"},
system: "core-current-stubs-system-modules",
- java9classpath: []string{"android_module_lib_stubs_current", "services-stubs"},
+ java9classpath: []string{"android_system_server_stubs_current"},
aidl: "-p" + buildDir + "/framework.aidl",
},
}
diff --git a/java/testing.go b/java/testing.go
index 5b6a39b..28c1a26 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -148,7 +148,7 @@
"android_system_stubs_current",
"android_test_stubs_current",
"android_module_lib_stubs_current",
- "services-stubs",
+ "android_system_server_stubs_current",
"core.current.stubs",
"core.platform.api.stubs",
"kotlin-stdlib",
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 36d4f04..95d049a 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -111,6 +111,9 @@
productOut("obj/PACKAGING"),
productOut("ramdisk"),
productOut("debug_ramdisk"),
+ productOut("vendor-ramdisk"),
+ productOut("vendor-ramdisk-debug.cpio.gz"),
+ productOut("vendor_debug_ramdisk"),
productOut("test_harness_ramdisk"),
productOut("recovery"),
productOut("root"),