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

Commit a237e62d authored by Jiyong Park's avatar Jiyong Park Committed by android-build-merger
Browse files

Don't use prebuilt_apex when TARGET_FLATTEN_APEX is set to true

am: 0a573d79

Change-Id: I67d532961fc4584bc0d7bf3616edb3236fb1acc9
parents f1b7b2fa 0a573d79
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -183,3 +183,7 @@ func (p *Prebuilt) usePrebuilt(ctx TopDownMutatorContext, source Module) bool {

	return source == nil || !source.Enabled()
}

func (p *Prebuilt) SourceExists() bool {
	return p.properties.SourceExists
}
+14 −1
Original line number Diff line number Diff line
@@ -1406,6 +1406,7 @@ type Prebuilt struct {
type PrebuiltProperties struct {
	// the path to the prebuilt .apex file to import.
	Source       string `blueprint:"mutated"`
	ForceDisable bool   `blueprint:"mutated"`

	Src  *string
	Arch struct {
@@ -1434,6 +1435,14 @@ func (p *Prebuilt) installable() bool {
}

func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
	if ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild() && p.prebuilt.SourceExists() {
		// If the device is configured to use flattened APEX, don't set
		// p.properties.Source so that the prebuilt module (which is
		// a non-flattened APEX) is not used.
		p.properties.ForceDisable = true
		return
	}

	// This is called before prebuilt_select and prebuilt_postdeps mutators
	// The mutators requires that src to be set correctly for each arch so that
	// arch variants are disabled when src is not provided for the arch.
@@ -1475,6 +1484,10 @@ func (p *Prebuilt) InstallFilename() string {
}

func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	if p.properties.ForceDisable {
		return
	}

	// TODO(jungjw): Check the key validity.
	p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
	p.installDir = android.PathForModuleInstall(ctx, "apex")