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

Commit eb9c1487 authored by Cole Faust's avatar Cole Faust
Browse files

Make the certificate property Configurable

By user request.

Fixes: 379649314
Test: m nothing --no-skip-soong-tests
Change-Id: I2e8c6c1c3556d4178eca2044d200c109669c6e93
parent 385f75bf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ type appProperties struct {
type overridableAppProperties struct {
	// The name of a certificate in the default certificate directory, blank to use the default product certificate,
	// or an android_app_certificate module name in the form ":module".
	Certificate *string
	Certificate proptools.Configurable[string] `android:"replace_instead_of_append"`

	// Name of the signing certificate lineage file or filegroup module.
	Lineage *string `android:"path"`
@@ -1252,7 +1252,7 @@ func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string {
	if overridden {
		return ":" + certificate
	}
	return String(a.overridableAppProperties.Certificate)
	return a.overridableAppProperties.Certificate.GetOrDefault(ctx, "")
}

func (a *AndroidApp) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
+4 −4
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ type AndroidAppImportProperties struct {

	// The name of a certificate in the default certificate directory or an android_app_certificate
	// module name in the form ":module". Should be empty if presigned or default_dev_cert is set.
	Certificate *string
	Certificate proptools.Configurable[string] `android:"replace_instead_of_append"`

	// Names of extra android_app_certificate modules to sign the apk with in the form ":module".
	Additional_certificates []string
@@ -240,7 +240,7 @@ func disablePrebuiltsWithoutApkMutator(ctx android.BottomUpMutatorContext) {
}

func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) {
	cert := android.SrcIsModule(String(a.properties.Certificate))
	cert := android.SrcIsModule(a.properties.Certificate.GetOrDefault(ctx, ""))
	if cert != "" {
		ctx.AddDependency(ctx.Module(), certificateTag, cert)
	}
@@ -323,7 +323,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
	}

	numCertPropsSet := 0
	if String(a.properties.Certificate) != "" {
	if a.properties.Certificate.GetOrDefault(ctx, "") != "" {
		numCertPropsSet++
	}
	if Bool(a.properties.Presigned) {
@@ -406,7 +406,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
		// If the certificate property is empty at this point, default_dev_cert must be set to true.
		// Which makes processMainCert's behavior for the empty cert string WAI.
		_, _, certificates := collectAppDeps(ctx, a, false, false)
		a.certificate, certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx)
		a.certificate, certificates = processMainCert(a.ModuleBase, a.properties.Certificate.GetOrDefault(ctx, ""), certificates, ctx)
		signed := android.PathForModuleOut(ctx, "signed", apkFilename)
		var lineageFile android.Path
		if lineage := String(a.properties.Lineage); lineage != "" {
+3 −3
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ type RuntimeResourceOverlay struct {
type RuntimeResourceOverlayProperties struct {
	// the name of a certificate in the default certificate directory or an android_app_certificate
	// module name in the form ":module".
	Certificate *string
	Certificate proptools.Configurable[string] `android:"replace_instead_of_append"`

	// Name of the signing certificate lineage file.
	Lineage *string
@@ -119,7 +119,7 @@ func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext)
		r.aapt.deps(ctx, sdkDep)
	}

	cert := android.SrcIsModule(String(r.properties.Certificate))
	cert := android.SrcIsModule(r.properties.Certificate.GetOrDefault(ctx, ""))
	if cert != "" {
		ctx.AddDependency(ctx.Module(), certificateTag, cert)
	}
@@ -166,7 +166,7 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC

	// Sign the built package
	_, _, certificates := collectAppDeps(ctx, r, false, false)
	r.certificate, certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx)
	r.certificate, certificates = processMainCert(r.ModuleBase, r.properties.Certificate.GetOrDefault(ctx, ""), certificates, ctx)
	signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk")
	var lineageFile android.Path
	if lineage := String(r.properties.Lineage); lineage != "" {