summaryrefslogtreecommitdiff
path: root/android/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/config.go')
-rw-r--r--android/config.go33
1 files changed, 22 insertions, 11 deletions
diff --git a/android/config.go b/android/config.go
index 5ee28e735..5d90fd21d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -157,7 +157,6 @@ type config struct {
runningAsBp2Build bool
bp2buildPackageConfig Bp2BuildConfig
- bp2buildModuleTypeConfig map[string]bool
Bp2buildSoongConfigDefinitions soongconfig.Bp2BuildSoongConfigDefinitions
// If testAllowNonExistentPaths is true then PathForSource and PathForModuleSrc won't error
@@ -324,7 +323,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
DeviceName: stringPtr("test_device"),
Platform_sdk_version: intPtr(30),
Platform_sdk_codename: stringPtr("S"),
- Platform_version_active_codenames: []string{"S"},
+ Platform_version_active_codenames: []string{"S", "Tiramisu"},
DeviceSystemSdkVersions: []string{"14", "15"},
Platform_systemsdk_versions: []string{"29", "30"},
AAPTConfig: []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"},
@@ -353,8 +352,6 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
config.mockFileSystem(bp, fs)
- config.bp2buildModuleTypeConfig = map[string]bool{}
-
determineBuildOS(config)
return Config{config}
@@ -522,7 +519,6 @@ func NewConfig(moduleListFile string, runGoTests bool, outDir, soongOutDir strin
config.BazelContext, err = NewBazelContext(config)
config.bp2buildPackageConfig = bp2buildDefaultConfig
- config.bp2buildModuleTypeConfig = make(map[string]bool)
return Config{config}, err
}
@@ -765,6 +761,16 @@ func (c *config) PreviewApiLevels() []ApiLevel {
return levels
}
+func (c *config) LatestPreviewApiLevel() ApiLevel {
+ level := NoneApiLevel
+ for _, l := range c.PreviewApiLevels() {
+ if l.GreaterThan(level) {
+ level = l
+ }
+ }
+ return level
+}
+
func (c *config) AllSupportedApiLevels() []ApiLevel {
var levels []ApiLevel
levels = append(levels, c.FinalApiLevels()...)
@@ -856,7 +862,7 @@ func (c *config) UnbundledBuild() bool {
// Returns true if building apps that aren't bundled with the platform.
// UnbundledBuild() is always true when this is true.
func (c *config) UnbundledBuildApps() bool {
- return Bool(c.productVariables.Unbundled_build_apps)
+ return len(c.productVariables.Unbundled_build_apps) > 0
}
// Returns true if building image that aren't bundled with the platform.
@@ -882,8 +888,13 @@ func (c *config) Eng() bool {
return Bool(c.productVariables.Eng)
}
+// DevicePrimaryArchType returns the ArchType for the first configured device architecture, or
+// Common if there are no device architectures.
func (c *config) DevicePrimaryArchType() ArchType {
- return c.Targets[Android][0].Arch.ArchType
+ if androidTargets := c.Targets[Android]; len(androidTargets) > 0 {
+ return androidTargets[0].Arch.ArchType
+ }
+ return Common
}
func (c *config) SanitizeHost() []string {
@@ -1184,10 +1195,6 @@ func (c *deviceConfig) DeviceKernelHeaderDirs() []string {
return c.config.productVariables.DeviceKernelHeaders
}
-func (c *deviceConfig) SamplingPGO() bool {
- return Bool(c.config.productVariables.SamplingPGO)
-}
-
// JavaCoverageEnabledForPath returns whether Java code coverage is enabled for
// path. Coverage is enabled by default when the product variable
// JavaCoveragePaths is empty. If JavaCoveragePaths is not empty, coverage is
@@ -1470,6 +1477,10 @@ func (c *deviceConfig) BoardSepolicyVers() string {
return c.PlatformSepolicyVersion()
}
+func (c *deviceConfig) BoardPlatVendorPolicy() []string {
+ return c.config.productVariables.BoardPlatVendorPolicy
+}
+
func (c *deviceConfig) BoardReqdMaskPolicy() []string {
return c.config.productVariables.BoardReqdMaskPolicy
}