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

Commit c320e826 authored by Jiyong Park's avatar Jiyong Park
Browse files

Key property is removed from prebuilt_apex

The property is not needed as key is embedded in the apex.

Bug: 128344735
Test: m
Change-Id: Iae671994fc271593dd9319f6262279736ea34ad1
parent 42cca6c9
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1317,18 +1317,9 @@ type PrebuiltProperties struct {
			Src *string
		}
	}

	// the name of the apex_key module that contains the matching public key to be installed.
	Key *string
}

func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
	if String(p.properties.Key) == "" {
		ctx.ModuleErrorf("key is missing")
		return
	}
	ctx.AddDependency(ctx.Module(), keyTag, *p.properties.Key)

	// 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.
@@ -1380,7 +1371,6 @@ func (p *Prebuilt) AndroidMk() android.AndroidMkData {
			func(w io.Writer, outputFile android.Path) {
				fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", p.installDir.RelPathString()))
				fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", p.BaseModuleName()+imageApexSuffix)
				fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", String(p.properties.Key))
			},
		},
	}
+0 −30
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
package apex

import (
	"bufio"
	"bytes"
	"io/ioutil"
	"os"
	"strings"
@@ -1248,14 +1246,6 @@ func TestPrebuilt(t *testing.T) {
					src: "myapex-arm.apex",
				},
			},
			key: "myapex.key"
		}

		apex_key {
			name: "myapex.key",
			public_key: "testkey.avbpubkey",
			private_key: "testkey.pem",
			product_specific: true,
		}
	`)

@@ -1265,24 +1255,4 @@ func TestPrebuilt(t *testing.T) {
	if prebuilt.inputApex.String() != expectedInput {
		t.Errorf("inputApex invalid. expected: %q, actual: %q", expectedInput, prebuilt.inputApex.String())
	}

	// Check if the key module is added as a required module.
	buf := &bytes.Buffer{}
	prebuilt.AndroidMk().Extra[0](buf, nil)
	found := false
	scanner := bufio.NewScanner(bytes.NewReader(buf.Bytes()))
	expected := "myapex.key"
	for scanner.Scan() {
		line := scanner.Text()
		tok := strings.Split(line, " := ")
		if tok[0] == "LOCAL_REQUIRED_MODULES" {
			found = true
			if tok[1] != "myapex.key" {
				t.Errorf("Unexpected LOCAL_REQUIRED_MODULES '%s', expected '%s'", tok[1], expected)
			}
		}
	}
	if !found {
		t.Errorf("Couldn't find a LOCAL_REQUIRED_MODULES entry")
	}
}