Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 239d7508 authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-14.0.0_r50' into staging/lineage-21.0_merge-android-14.0.0_r50

Android 14.0.0 Release 50 (AP2A.240605.024)

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCZmdzmgAKCRDorT+BmrEO
# eH6BAJ4lHyjAGMVjWnJenXtnUQ3eJVn8pgCdHI14jGLDS19WCK0/rQq/nwxu38M=
# =iRUk
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Jun 11 00:43:54 2024 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 2466 signatures in the past
#      2 years.  Encrypted 4 messages in the past 2 years.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Colin Cross (54) and others
# Via Automerger Merge Worker (704) and others
* tag 'android-14.0.0_r50': (355 commits)
  release-config: sync from goog/main
  Merge "Add secretkeeper-v1-java to platform APIs" into main am: f28b5697 am: 196729ff
  Create rule to generate the exportable api files when checkapi is disabled
  Revert "Additional cleanup prior to adding the runtime stubs"
  Revert "Generate runtime stubs in droidstubs"
  Support partial module variants with apex_contributions
  Fix non-determinism in prebuilt selection
  Use BaseModuleName for LOCAL_MODULE
  Disable source javalib dexpreopt when using prebuilt apex
  Allow clippy::disallowed_names since it can be used for debugging
  Add the build flags for apex contribution contents
  Add a source_module_name to android_app
  Revert "Fix non-determinism in prebuilt selection"
  Fix non-determinism in prebuilt selection
  Copy imported APKs to output filename
  disablePrebuilt: also clear sanitizer-dependent Srcs
  Define libc++ config macros to nothing
  Remove --multitree-build
  Some tweaks to the aconfig flag collection logic
  Use R.txt files from aar files directly
  ...

 Conflicts:
	android/allowlists/allowlists.go
	androidmk/androidmk/android.go
	apex/apex.go
	etc/prebuilt_etc.go
	java/android_manifest.go

Change-Id: I5294562126628c0a9917f145ed933b6b13c05b3d
parents 743a2195 8bf89894
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -13,3 +13,5 @@ mrziwang@google.com
spandandas@google.com
weiwli@google.com
yudiliu@google.com

per-file build/soong/ui/build/androidmk_denylist.go = joeo@google.com, weiwli@google.com
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -314,6 +314,9 @@ subpackages) can use this module.
* `["//visibility:override"]`: Discards any rules inherited from defaults or a
creating module. Can only be used at the beginning of a list of visibility
rules.
* `["//visibility:any_partition"]`: Any modules of type android_filesystem
or android_system_image can use this module. Intended for modules that no one
should link against, but should still be included in soong-built partitions.
* `["//some/package:__pkg__", "//other/package:__pkg__"]`: Only modules in
`some/package` and `other/package` (defined in `some/package/*.bp` and
`other/package/*.bp`) have access to this module. Note that sub-packages do not
@@ -603,7 +606,7 @@ ANDROID_BUILD_ENVIRONMENT_CONFIG_DIR=build/soong \
* [Build Performance](docs/perf.md)
* [Generating CLion Projects](docs/clion.md)
* [Generating YouCompleteMe/VSCode compile\_commands.json file](docs/compdb.md)
* Make-specific documentation: [build/make/README.md](https://android.googlesource.com/platform/build/+/master/README.md)
* Make-specific documentation: [build/make/README.md](https://android.googlesource.com/platform/build/+/main/README.md)

## Developing for Soong

+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ bootstrap_go_package {
        "aconfig_declarations_test.go",
        "aconfig_values_test.go",
        "aconfig_value_set_test.go",
        "all_aconfig_declarations_test.go",
    ],
    pluginFor: ["soong_build"],
}
+12 −74
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ type DeclarationsModule struct {

		// Container(system/vendor/apex) that this module belongs to
		Container string

		// The flags will only be repackaged if this prop is true.
		Exportable bool
	}

	intermediatePath android.WritablePath
@@ -112,33 +115,11 @@ func optionalVariable(prefix string, value string) string {
	return sb.String()
}

// Provider published by aconfig_value_set
type DeclarationsProviderData struct {
	Package                     string
	Container                   string
	IntermediateCacheOutputPath android.WritablePath
	IntermediateDumpOutputPath  android.WritablePath
}

var DeclarationsProviderKey = blueprint.NewProvider(DeclarationsProviderData{})

// This is used to collect the aconfig declarations info on the transitive closure,
// the data is keyed on the container.
type TransitiveDeclarationsInfo struct {
	AconfigFiles map[string]android.Paths
}

var TransitiveDeclarationsInfoProvider = blueprint.NewProvider(TransitiveDeclarationsInfo{})

func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
	valuesFiles := make([]android.Path, 0)
	ctx.VisitDirectDeps(func(dep android.Module) {
		if !ctx.OtherModuleHasProvider(dep, valueSetProviderKey) {
			// Other modules get injected as dependencies too, for example the license modules
			return
		}
		depData := ctx.OtherModuleProvider(dep, valueSetProviderKey).(valueSetProviderData)
		if depData, ok := android.OtherModuleProvider(ctx, dep, valueSetProviderKey); ok {
			paths, ok := depData.AvailablePackages[module.properties.Package]
			if ok {
				valuesFiles = append(valuesFiles, paths...)
@@ -146,6 +127,7 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
					module.properties.Values = append(module.properties.Values, path.String())
				}
			}
		}
	})

	// Intermediate format
@@ -177,56 +159,12 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module
		Description: "aconfig_text",
	})

	ctx.SetProvider(DeclarationsProviderKey, DeclarationsProviderData{
	android.SetProvider(ctx, android.AconfigDeclarationsProviderKey, android.AconfigDeclarationsProviderData{
		Package:                     module.properties.Package,
		Container:                   module.properties.Container,
		Exportable:                  module.properties.Exportable,
		IntermediateCacheOutputPath: intermediateCacheFilePath,
		IntermediateDumpOutputPath:  intermediateDumpFilePath,
	})

}
func CollectDependencyAconfigFiles(ctx android.ModuleContext, mergedAconfigFiles *map[string]android.Paths) {
	if *mergedAconfigFiles == nil {
		*mergedAconfigFiles = make(map[string]android.Paths)
	}
	ctx.VisitDirectDeps(func(module android.Module) {
		if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediateCacheOutputPath != nil {
			(*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
			return
		}
		if dep := ctx.OtherModuleProvider(module, TransitiveDeclarationsInfoProvider).(TransitiveDeclarationsInfo); len(dep.AconfigFiles) > 0 {
			for container, v := range dep.AconfigFiles {
				(*mergedAconfigFiles)[container] = append((*mergedAconfigFiles)[container], v...)
			}
		}
	})

	for container, aconfigFiles := range *mergedAconfigFiles {
		(*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, aconfigFiles)
	}

	ctx.SetProvider(TransitiveDeclarationsInfoProvider, TransitiveDeclarationsInfo{
		AconfigFiles: *mergedAconfigFiles,
	})
}

func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android.Paths {
	inputs = android.LastUniquePaths(inputs)
	if len(inputs) == 1 {
		return android.Paths{inputs[0]}
	}

	output := android.PathForModuleOut(ctx, "aconfig_merged.pb")

	ctx.Build(pctx, android.BuildParams{
		Rule:        mergeAconfigFilesRule,
		Description: "merge aconfig files",
		Inputs:      inputs,
		Output:      output,
		Args: map[string]string{
			"flags": android.JoinWithPrefix(inputs.Strings(), "--cache "),
		},
	})

	return android.Paths{output}
}
+22 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ func TestAconfigDeclarations(t *testing.T) {
			name: "module_name",
			package: "com.example.package",
			container: "com.android.foo",
			exportable: true,
			srcs: [
				"foo.aconfig",
				"bar.aconfig",
@@ -38,9 +39,10 @@ func TestAconfigDeclarations(t *testing.T) {
	module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)

	// Check that the provider has the right contents
	depData := result.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData)
	depData, _ := android.SingletonModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
	android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
	android.AssertStringEquals(t, "container", depData.Container, "com.android.foo")
	android.AssertBoolEquals(t, "exportable", depData.Exportable, true)
	if !strings.HasSuffix(depData.IntermediateCacheOutputPath.String(), "/intermediate.pb") {
		t.Errorf("Missing intermediates proto path in provider: %s", depData.IntermediateCacheOutputPath.String())
	}
@@ -48,3 +50,22 @@ func TestAconfigDeclarations(t *testing.T) {
		t.Errorf("Missing intermediates text path in provider: %s", depData.IntermediateDumpOutputPath.String())
	}
}

func TestAconfigDeclarationsWithExportableUnset(t *testing.T) {
	bp := `
		aconfig_declarations {
			name: "module_name",
			package: "com.example.package",
			container: "com.android.foo",
			srcs: [
				"foo.aconfig",
				"bar.aconfig",
			],
		}
	`
	result := runTest(t, android.FixtureExpectsNoErrors, bp)

	module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
	depData, _ := android.SingletonModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
	android.AssertBoolEquals(t, "exportable", depData.Exportable, false)
}
Loading