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

Commit 591fd3bf authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Nishith Khanna
Browse files

soong: Use our keys for otacerts if it exists

Change-Id: I7a19294237964d1aaa74afa6665c10f1350832c9
parent 06034005
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -112,8 +112,17 @@ func (m *otacertsZipModule) outputFileName() string {
}

func (m *otacertsZipModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	// Check if user-keys/releasekey.x509.pem exists
	const userKeyPath = "user-keys/releasekey"

	var pem android.SourcePath
	if android.ExistentPathForSource(ctx, userKeyPath + ".x509.pem").Valid() &&
		android.ExistentPathForSource(ctx,userKeyPath + ".pk8").Valid() {
		pem, _ = android.PathForSource(ctx, userKeyPath + ".x509.pem"), android.PathForSource(ctx, userKeyPath + ".pk8")
	} else {
		// Read .x509.pem file defined in PRODUCT_DEFAULT_DEV_CERTIFICATE or the default test key.
	pem, _ := ctx.Config().DefaultAppCertificate(ctx)
		pem, _ = ctx.Config().DefaultAppCertificate(ctx)
	}
	// Read .x509.pem files listed  in PRODUCT_EXTRA_OTA_KEYS or PRODUCT_EXTRA_RECOVERY_KEYS.
	extras := ctx.Config().ExtraOtaKeys(ctx, m.InRecovery())
	srcPaths := append([]android.SourcePath{pem}, extras...)