summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/apex.go7
-rw-r--r--android/build_prop.go2
-rw-r--r--android/config.go4
-rw-r--r--android/container.go4
-rw-r--r--android/container_violations.go4
-rw-r--r--android/module.go50
-rw-r--r--android/neverallow.go53
-rw-r--r--android/variable.go1
8 files changed, 82 insertions, 43 deletions
diff --git a/android/apex.go b/android/apex.go
index 028be57ec..79ee0a8f8 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -475,13 +475,6 @@ const (
AvailableToAnyApex = "//apex_available:anyapex"
)
-var (
- AvailableToRecognziedWildcards = []string{
- AvailableToPlatform,
- AvailableToAnyApex,
- }
-)
-
// CheckAvailableForApex provides the default algorithm for checking the apex availability. When the
// availability is empty, it defaults to ["//apex_available:platform"] which means "available to the
// platform but not available to any APEX". When the list is not empty, `what` is matched against
diff --git a/android/build_prop.go b/android/build_prop.go
index 13d59f9f5..ede93ed20 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -63,6 +63,8 @@ func (p *buildPropModule) propFiles(ctx ModuleContext) Paths {
return ctx.Config().SystemExtPropFiles(ctx)
} else if partition == "product" {
return ctx.Config().ProductPropFiles(ctx)
+ } else if partition == "odm" {
+ return ctx.Config().OdmPropFiles(ctx)
}
return nil
}
diff --git a/android/config.go b/android/config.go
index 2f6ade794..bbb08dde7 100644
--- a/android/config.go
+++ b/android/config.go
@@ -2057,6 +2057,10 @@ func (c *config) ProductPropFiles(ctx PathContext) Paths {
return PathsForSource(ctx, c.productVariables.ProductPropFiles)
}
+func (c *config) OdmPropFiles(ctx PathContext) Paths {
+ return PathsForSource(ctx, c.productVariables.OdmPropFiles)
+}
+
func (c *config) EnableUffdGc() string {
return String(c.productVariables.EnableUffdGc)
}
diff --git a/android/container.go b/android/container.go
index f01c07606..f150ff31a 100644
--- a/android/container.go
+++ b/android/container.go
@@ -93,6 +93,10 @@ var globallyAllowlistedDependencies = []string{
// This module is implicitly added as a dependency for java modules even when the
// dependency specifies sdk_version.
"framework-res",
+
+ // jacocoagent is implicitly added as a dependency in coverage builds, and is not installed
+ // on the device.
+ "jacocoagent",
}
// Returns true when the dependency is globally allowlisted for inter-container dependency
diff --git a/android/container_violations.go b/android/container_violations.go
index 14cd61b1f..e67533dbe 100644
--- a/android/container_violations.go
+++ b/android/container_violations.go
@@ -870,6 +870,10 @@ var ContainerDependencyViolationAllowlist = map[string][]string{
"net-utils-device-common-struct-base", // apex [com.android.tethering] -> system
},
+ "NfcNciApex": {
+ "android.permission.flags-aconfig-java", // apex [com.android.nfcservices] -> apex [com.android.permission, test_com.android.permission]
+ },
+
"okhttp-norepackage": {
"okhttp-android-util-log", // apex [com.android.adservices, com.android.devicelock, com.android.extservices] -> system
},
diff --git a/android/module.go b/android/module.go
index 35513d69d..9f73729fb 100644
--- a/android/module.go
+++ b/android/module.go
@@ -111,10 +111,6 @@ type Module interface {
TargetRequiredModuleNames() []string
VintfFragmentModuleNames(ctx ConfigAndErrorContext) []string
- // TransitivePackagingSpecs returns the PackagingSpecs for this module and any transitive
- // dependencies with dependency tags for which IsInstallDepNeeded() returns true.
- TransitivePackagingSpecs() []PackagingSpec
-
ConfigurableEvaluator(ctx ConfigAndErrorContext) proptools.ConfigurableEvaluator
}
@@ -830,8 +826,7 @@ type ModuleBase struct {
// The primary licenses property, may be nil, records license metadata for the module.
primaryLicensesProperty applicableLicensesProperty
- noAddressSanitizer bool
- packagingSpecsDepSet *DepSet[PackagingSpec]
+ noAddressSanitizer bool
hooks hooks
@@ -1437,10 +1432,6 @@ func isInstallDepNeeded(dep Module, tag blueprint.DependencyTag) bool {
return IsInstallDepNeededTag(tag)
}
-func (m *ModuleBase) TransitivePackagingSpecs() []PackagingSpec {
- return m.packagingSpecsDepSet.ToList()
-}
-
func (m *ModuleBase) NoAddressSanitizer() bool {
return m.noAddressSanitizer
}
@@ -1929,6 +1920,13 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
if ctx.Failed() {
return
}
+
+ if x, ok := m.module.(IDEInfo); ok {
+ var result IdeInfo
+ x.IDEInfo(ctx, &result)
+ result.BaseModuleName = x.BaseModuleName()
+ SetProvider(ctx, IdeInfoProviderKey, result)
+ }
}
if incrementalEnabled && cacheKey != nil {
@@ -1968,8 +1966,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles)
installFiles.TransitiveInstallFiles = ctx.TransitiveInstallFiles
- m.packagingSpecsDepSet = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs)
- installFiles.TransitivePackagingSpecs = m.packagingSpecsDepSet
+ installFiles.TransitivePackagingSpecs = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs)
SetProvider(ctx, InstallFilesProvider, installFiles)
buildLicenseMetadata(ctx, ctx.licenseMetadataFile)
@@ -2710,7 +2707,7 @@ func (c *buildTargetSingleton) GenerateBuildActions(ctx SingletonContext) {
// Collect information for opening IDE project files in java/jdeps.go.
type IDEInfo interface {
- IDEInfo(ideInfo *IdeInfo)
+ IDEInfo(ctx BaseModuleContext, ideInfo *IdeInfo)
BaseModuleName() string
}
@@ -2722,7 +2719,9 @@ type IDECustomizedModuleName interface {
IDECustomizedModuleName() string
}
+// Collect information for opening IDE project files in java/jdeps.go.
type IdeInfo struct {
+ BaseModuleName string `json:"-"`
Deps []string `json:"dependencies,omitempty"`
Srcs []string `json:"srcs,omitempty"`
Aidl_include_dirs []string `json:"aidl_include_dirs,omitempty"`
@@ -2736,6 +2735,31 @@ type IdeInfo struct {
Libs []string `json:"libs,omitempty"`
}
+// Merge merges two IdeInfos and produces a new one, leaving the origional unchanged
+func (i IdeInfo) Merge(other IdeInfo) IdeInfo {
+ return IdeInfo{
+ Deps: mergeStringLists(i.Deps, other.Deps),
+ Srcs: mergeStringLists(i.Srcs, other.Srcs),
+ Aidl_include_dirs: mergeStringLists(i.Aidl_include_dirs, other.Aidl_include_dirs),
+ Jarjar_rules: mergeStringLists(i.Jarjar_rules, other.Jarjar_rules),
+ Jars: mergeStringLists(i.Jars, other.Jars),
+ Classes: mergeStringLists(i.Classes, other.Classes),
+ Installed_paths: mergeStringLists(i.Installed_paths, other.Installed_paths),
+ SrcJars: mergeStringLists(i.SrcJars, other.SrcJars),
+ Paths: mergeStringLists(i.Paths, other.Paths),
+ Static_libs: mergeStringLists(i.Static_libs, other.Static_libs),
+ Libs: mergeStringLists(i.Libs, other.Libs),
+ }
+}
+
+// mergeStringLists appends the two string lists together and returns a new string list,
+// leaving the originals unchanged. Duplicate strings will be deduplicated.
+func mergeStringLists(a, b []string) []string {
+ return FirstUniqueStrings(Concat(a, b))
+}
+
+var IdeInfoProviderKey = blueprint.NewProvider[IdeInfo]()
+
func CheckBlueprintSyntax(ctx BaseModuleContext, filename string, contents string) []error {
bpctx := ctx.blueprintBaseModuleContext()
return blueprint.CheckBlueprintSyntax(bpctx.ModuleFactories(), filename, contents)
diff --git a/android/neverallow.go b/android/neverallow.go
index 0f363e78f..a68f5ea79 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -287,7 +287,7 @@ func neverallowMutator(ctx BottomUpMutatorContext) {
continue
}
- if !n.appliesToProperties(properties) {
+ if !n.appliesToProperties(ctx, properties) {
continue
}
@@ -604,9 +604,9 @@ func (r *rule) appliesToModuleType(moduleType string) bool {
return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unlessModuleTypes)
}
-func (r *rule) appliesToProperties(properties []interface{}) bool {
- includeProps := hasAllProperties(properties, r.props)
- excludeProps := hasAnyProperty(properties, r.unlessProps)
+func (r *rule) appliesToProperties(ctx BottomUpMutatorContext, properties []interface{}) bool {
+ includeProps := hasAllProperties(ctx, properties, r.props)
+ excludeProps := hasAnyProperty(ctx, properties, r.unlessProps)
return includeProps && !excludeProps
}
@@ -644,25 +644,25 @@ func fieldNamesForProperties(propertyNames string) []string {
return names
}
-func hasAnyProperty(properties []interface{}, props []ruleProperty) bool {
+func hasAnyProperty(ctx BottomUpMutatorContext, properties []interface{}, props []ruleProperty) bool {
for _, v := range props {
- if hasProperty(properties, v) {
+ if hasProperty(ctx, properties, v) {
return true
}
}
return false
}
-func hasAllProperties(properties []interface{}, props []ruleProperty) bool {
+func hasAllProperties(ctx BottomUpMutatorContext, properties []interface{}, props []ruleProperty) bool {
for _, v := range props {
- if !hasProperty(properties, v) {
+ if !hasProperty(ctx, properties, v) {
return false
}
}
return true
}
-func hasProperty(properties []interface{}, prop ruleProperty) bool {
+func hasProperty(ctx BottomUpMutatorContext, properties []interface{}, prop ruleProperty) bool {
for _, propertyStruct := range properties {
propertiesValue := reflect.ValueOf(propertyStruct).Elem()
for _, v := range prop.fields {
@@ -679,14 +679,14 @@ func hasProperty(properties []interface{}, prop ruleProperty) bool {
return prop.matcher.Test(value)
}
- if matchValue(propertiesValue, check) {
+ if matchValue(ctx, propertiesValue, check) {
return true
}
}
return false
}
-func matchValue(value reflect.Value, check func(string) bool) bool {
+func matchValue(ctx BottomUpMutatorContext, value reflect.Value, check func(string) bool) bool {
if !value.IsValid() {
return false
}
@@ -698,19 +698,26 @@ func matchValue(value reflect.Value, check func(string) bool) bool {
value = value.Elem()
}
- switch value.Kind() {
- case reflect.String:
- return check(value.String())
- case reflect.Bool:
- return check(strconv.FormatBool(value.Bool()))
- case reflect.Int:
- return check(strconv.FormatInt(value.Int(), 10))
- case reflect.Slice:
- slice, ok := value.Interface().([]string)
- if !ok {
- panic("Can only handle slice of string")
+ switch v := value.Interface().(type) {
+ case string:
+ return check(v)
+ case bool:
+ return check(strconv.FormatBool(v))
+ case int:
+ return check(strconv.FormatInt((int64)(v), 10))
+ case []string:
+ for _, v := range v {
+ if check(v) {
+ return true
+ }
}
- for _, v := range slice {
+ return false
+ case proptools.Configurable[string]:
+ return check(v.GetOrDefault(ctx, ""))
+ case proptools.Configurable[bool]:
+ return check(strconv.FormatBool(v.GetOrDefault(ctx, false)))
+ case proptools.Configurable[[]string]:
+ for _, v := range v.GetOrDefault(ctx, nil) {
if check(v) {
return true
}
diff --git a/android/variable.go b/android/variable.go
index 10205e388..14f1756bf 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -512,6 +512,7 @@ type ProductVariables struct {
SystemPropFiles []string `json:",omitempty"`
SystemExtPropFiles []string `json:",omitempty"`
ProductPropFiles []string `json:",omitempty"`
+ OdmPropFiles []string `json:",omitempty"`
EnableUffdGc *string `json:",omitempty"`
}