Merge "Merge tm-dev-plus-aosp-without-vendor@8763363" into stage-aosp-master
This commit is contained in:
@@ -419,7 +419,15 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
||||
},
|
||||
},
|
||||
}}
|
||||
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
||||
func(w io.Writer, name, prefix, moduleDir string) {
|
||||
if app.javaApiUsedByOutputFile.String() != "" {
|
||||
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s/$(notdir %s))\n",
|
||||
app.installApkName, app.javaApiUsedByOutputFile.String(), "java_apis_used_by_apex", app.javaApiUsedByOutputFile.String())
|
||||
}
|
||||
},
|
||||
}},
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AndroidApp) getOverriddenPackages() []string {
|
||||
|
13
java/app.go
13
java/app.go
@@ -117,6 +117,9 @@ type overridableAppProperties struct {
|
||||
// Name of the signing certificate lineage file or filegroup module.
|
||||
Lineage *string `android:"path"`
|
||||
|
||||
// For overriding the --rotation-min-sdk-version property of apksig
|
||||
RotationMinSdkVersion *string
|
||||
|
||||
// the package name of this app. The package name in the manifest file is used if one was not given.
|
||||
Package_name *string
|
||||
|
||||
@@ -165,6 +168,8 @@ type AndroidApp struct {
|
||||
overriddenManifestPackageName string
|
||||
|
||||
android.ApexBundleDepsInfo
|
||||
|
||||
javaApiUsedByOutputFile android.ModuleOutPath
|
||||
}
|
||||
|
||||
func (a *AndroidApp) IsInstallable() bool {
|
||||
@@ -273,6 +278,7 @@ func (a *AndroidTestHelperApp) GenerateAndroidBuildActions(ctx android.ModuleCon
|
||||
func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
a.checkAppSdkVersions(ctx)
|
||||
a.generateAndroidBuildActions(ctx)
|
||||
a.generateJavaUsedByApex(ctx)
|
||||
}
|
||||
|
||||
func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
|
||||
@@ -658,7 +664,10 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
if lineage := String(a.overridableAppProperties.Lineage); lineage != "" {
|
||||
lineageFile = android.PathForModuleSrc(ctx, lineage)
|
||||
}
|
||||
CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, v4SignatureFile, lineageFile)
|
||||
|
||||
rotationMinSdkVersion := String(a.overridableAppProperties.RotationMinSdkVersion)
|
||||
|
||||
CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, v4SignatureFile, lineageFile, rotationMinSdkVersion)
|
||||
a.outputFile = packageFile
|
||||
if v4SigningRequested {
|
||||
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
|
||||
@@ -687,7 +696,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
if v4SigningRequested {
|
||||
v4SignatureFile = android.PathForModuleOut(ctx, a.installApkName+"_"+split.suffix+".apk.idsig")
|
||||
}
|
||||
CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, v4SignatureFile, lineageFile)
|
||||
CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, v4SignatureFile, lineageFile, rotationMinSdkVersion)
|
||||
a.extraOutputFiles = append(a.extraOutputFiles, packageFile)
|
||||
if v4SigningRequested {
|
||||
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
|
||||
|
@@ -52,7 +52,7 @@ var combineApk = pctx.AndroidStaticRule("combineApk",
|
||||
})
|
||||
|
||||
func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||
packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path) {
|
||||
packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) {
|
||||
|
||||
unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
|
||||
unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
|
||||
@@ -73,10 +73,10 @@ func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.Writa
|
||||
Implicits: deps,
|
||||
})
|
||||
|
||||
SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile)
|
||||
SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile, rotationMinSdkVersion)
|
||||
}
|
||||
|
||||
func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath, lineageFile android.Path) {
|
||||
func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) {
|
||||
|
||||
var certificateArgs []string
|
||||
var deps android.Paths
|
||||
@@ -97,6 +97,10 @@ func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, u
|
||||
deps = append(deps, lineageFile)
|
||||
}
|
||||
|
||||
if rotationMinSdkVersion != "" {
|
||||
flags = append(flags, "--rotation-min-sdk-version", rotationMinSdkVersion)
|
||||
}
|
||||
|
||||
rule := Signapk
|
||||
args := map[string]string{
|
||||
"certificates": strings.Join(certificateArgs, " "),
|
||||
@@ -254,6 +258,18 @@ func TransformJniLibsToJar(ctx android.ModuleContext, outputFile android.Writabl
|
||||
})
|
||||
}
|
||||
|
||||
func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
|
||||
javaApiUsedByOutputFile := android.PathForModuleOut(ctx, a.installApkName+"_using.xml")
|
||||
javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
|
||||
javaUsedByRule.Command().
|
||||
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
|
||||
BuiltTool("dexdeps").
|
||||
Output(javaApiUsedByOutputFile).
|
||||
Input(a.Library.Module.outputFile)
|
||||
javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
|
||||
a.javaApiUsedByOutputFile = javaApiUsedByOutputFile
|
||||
}
|
||||
|
||||
func targetToJniDir(target android.Target) string {
|
||||
return filepath.Join("lib", target.Arch.Abi[0])
|
||||
}
|
||||
|
@@ -80,6 +80,9 @@ type AndroidAppImportProperties struct {
|
||||
// Name of the signing certificate lineage file or filegroup module.
|
||||
Lineage *string `android:"path"`
|
||||
|
||||
// For overriding the --rotation-min-sdk-version property of apksig
|
||||
RotationMinSdkVersion *string
|
||||
|
||||
// Sign with the default system dev certificate. Must be used judiciously. Most imported apps
|
||||
// need to either specify a specific certificate or be presigned.
|
||||
Default_dev_cert *bool
|
||||
@@ -333,7 +336,10 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
|
||||
if lineage := String(a.properties.Lineage); lineage != "" {
|
||||
lineageFile = android.PathForModuleSrc(ctx, lineage)
|
||||
}
|
||||
SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile)
|
||||
|
||||
rotationMinSdkVersion := String(a.properties.RotationMinSdkVersion)
|
||||
|
||||
SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile, rotationMinSdkVersion)
|
||||
a.outputFile = signed
|
||||
} else {
|
||||
alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename)
|
||||
|
@@ -129,6 +129,7 @@ func TestAndroidAppImport_SigningLineage(t *testing.T) {
|
||||
certificate: "platform",
|
||||
additional_certificates: [":additional_certificate"],
|
||||
lineage: "lineage.bin",
|
||||
rotationMinSdkVersion: "32",
|
||||
}
|
||||
|
||||
android_app_certificate {
|
||||
@@ -148,11 +149,12 @@ func TestAndroidAppImport_SigningLineage(t *testing.T) {
|
||||
if expected != certificatesFlag {
|
||||
t.Errorf("Incorrect certificates flags, expected: %q, got: %q", expected, certificatesFlag)
|
||||
}
|
||||
// Check cert signing lineage flag.
|
||||
signingFlag := signedApk.Args["flags"]
|
||||
expected = "--lineage lineage.bin"
|
||||
if expected != signingFlag {
|
||||
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
|
||||
|
||||
// Check cert signing flags.
|
||||
actualCertSigningFlags := signedApk.Args["flags"]
|
||||
expectedCertSigningFlags := "--lineage lineage.bin --rotation-min-sdk-version 32"
|
||||
if expectedCertSigningFlags != actualCertSigningFlags {
|
||||
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expectedCertSigningFlags, actualCertSigningFlags)
|
||||
}
|
||||
|
||||
rule := variant.Rule("genProvenanceMetaData")
|
||||
|
205
java/app_test.go
205
java/app_test.go
@@ -1488,11 +1488,11 @@ func TestJNISDK(t *testing.T) {
|
||||
|
||||
func TestCertificates(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
bp string
|
||||
certificateOverride string
|
||||
expectedLineage string
|
||||
expectedCertificate string
|
||||
name string
|
||||
bp string
|
||||
certificateOverride string
|
||||
expectedCertSigningFlags string
|
||||
expectedCertificate string
|
||||
}{
|
||||
{
|
||||
name: "default",
|
||||
@@ -1503,9 +1503,9 @@ func TestCertificates(t *testing.T) {
|
||||
sdk_version: "current",
|
||||
}
|
||||
`,
|
||||
certificateOverride: "",
|
||||
expectedLineage: "",
|
||||
expectedCertificate: "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
|
||||
certificateOverride: "",
|
||||
expectedCertSigningFlags: "",
|
||||
expectedCertificate: "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
|
||||
},
|
||||
{
|
||||
name: "module certificate property",
|
||||
@@ -1522,9 +1522,9 @@ func TestCertificates(t *testing.T) {
|
||||
certificate: "cert/new_cert",
|
||||
}
|
||||
`,
|
||||
certificateOverride: "",
|
||||
expectedLineage: "",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
certificateOverride: "",
|
||||
expectedCertSigningFlags: "",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
},
|
||||
{
|
||||
name: "path certificate property",
|
||||
@@ -1536,9 +1536,9 @@ func TestCertificates(t *testing.T) {
|
||||
sdk_version: "current",
|
||||
}
|
||||
`,
|
||||
certificateOverride: "",
|
||||
expectedLineage: "",
|
||||
expectedCertificate: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certificateOverride: "",
|
||||
expectedCertSigningFlags: "",
|
||||
expectedCertificate: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
},
|
||||
{
|
||||
name: "certificate overrides",
|
||||
@@ -1555,18 +1555,19 @@ func TestCertificates(t *testing.T) {
|
||||
certificate: "cert/new_cert",
|
||||
}
|
||||
`,
|
||||
certificateOverride: "foo:new_certificate",
|
||||
expectedLineage: "",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
certificateOverride: "foo:new_certificate",
|
||||
expectedCertSigningFlags: "",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
},
|
||||
{
|
||||
name: "certificate lineage",
|
||||
name: "certificate signing flags",
|
||||
bp: `
|
||||
android_app {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
certificate: ":new_certificate",
|
||||
lineage: "lineage.bin",
|
||||
rotationMinSdkVersion: "32",
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
@@ -1575,18 +1576,19 @@ func TestCertificates(t *testing.T) {
|
||||
certificate: "cert/new_cert",
|
||||
}
|
||||
`,
|
||||
certificateOverride: "",
|
||||
expectedLineage: "--lineage lineage.bin",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
certificateOverride: "",
|
||||
expectedCertSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
},
|
||||
{
|
||||
name: "lineage from filegroup",
|
||||
name: "cert signing flags from filegroup",
|
||||
bp: `
|
||||
android_app {
|
||||
name: "foo",
|
||||
srcs: ["a.java"],
|
||||
certificate: ":new_certificate",
|
||||
lineage: ":lineage_bin",
|
||||
rotationMinSdkVersion: "32",
|
||||
sdk_version: "current",
|
||||
}
|
||||
|
||||
@@ -1600,9 +1602,9 @@ func TestCertificates(t *testing.T) {
|
||||
srcs: ["lineage.bin"],
|
||||
}
|
||||
`,
|
||||
certificateOverride: "",
|
||||
expectedLineage: "--lineage lineage.bin",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
certificateOverride: "",
|
||||
expectedCertSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
|
||||
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1623,8 +1625,8 @@ func TestCertificates(t *testing.T) {
|
||||
signCertificateFlags := signapk.Args["certificates"]
|
||||
android.AssertStringEquals(t, "certificates flags", test.expectedCertificate, signCertificateFlags)
|
||||
|
||||
signFlags := signapk.Args["flags"]
|
||||
android.AssertStringEquals(t, "signing flags", test.expectedLineage, signFlags)
|
||||
certSigningFlags := signapk.Args["flags"]
|
||||
android.AssertStringEquals(t, "cert signing flags", test.expectedCertSigningFlags, certSigningFlags)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1819,6 +1821,7 @@ func TestOverrideAndroidApp(t *testing.T) {
|
||||
base: "foo",
|
||||
certificate: ":new_certificate",
|
||||
lineage: "lineage.bin",
|
||||
rotationMinSdkVersion: "32",
|
||||
logging_parent: "bah",
|
||||
}
|
||||
|
||||
@@ -1864,89 +1867,89 @@ func TestOverrideAndroidApp(t *testing.T) {
|
||||
`)
|
||||
|
||||
expectedVariants := []struct {
|
||||
name string
|
||||
moduleName string
|
||||
variantName string
|
||||
apkName string
|
||||
apkPath string
|
||||
certFlag string
|
||||
lineageFlag string
|
||||
overrides []string
|
||||
packageFlag string
|
||||
renameResources bool
|
||||
logging_parent string
|
||||
name string
|
||||
moduleName string
|
||||
variantName string
|
||||
apkName string
|
||||
apkPath string
|
||||
certFlag string
|
||||
certSigningFlags string
|
||||
overrides []string
|
||||
packageFlag string
|
||||
renameResources bool
|
||||
logging_parent string
|
||||
}{
|
||||
{
|
||||
name: "foo",
|
||||
moduleName: "foo",
|
||||
variantName: "android_common",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/foo/foo.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux"},
|
||||
packageFlag: "",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
name: "foo",
|
||||
moduleName: "foo",
|
||||
variantName: "android_common",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/foo/foo.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certSigningFlags: "",
|
||||
overrides: []string{"qux"},
|
||||
packageFlag: "",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
},
|
||||
{
|
||||
name: "foo",
|
||||
moduleName: "bar",
|
||||
variantName: "android_common_bar",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/bar/bar.apk",
|
||||
certFlag: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
lineageFlag: "--lineage lineage.bin",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "",
|
||||
renameResources: false,
|
||||
logging_parent: "bah",
|
||||
name: "foo",
|
||||
moduleName: "bar",
|
||||
variantName: "android_common_bar",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/bar/bar.apk",
|
||||
certFlag: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
certSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "",
|
||||
renameResources: false,
|
||||
logging_parent: "bah",
|
||||
},
|
||||
{
|
||||
name: "foo",
|
||||
moduleName: "baz",
|
||||
variantName: "android_common_baz",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz/baz.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: true,
|
||||
logging_parent: "",
|
||||
name: "foo",
|
||||
moduleName: "baz",
|
||||
variantName: "android_common_baz",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz/baz.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certSigningFlags: "",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: true,
|
||||
logging_parent: "",
|
||||
},
|
||||
{
|
||||
name: "foo",
|
||||
moduleName: "baz_no_rename_resources",
|
||||
variantName: "android_common_baz_no_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_no_rename_resources/baz_no_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
name: "foo",
|
||||
moduleName: "baz_no_rename_resources",
|
||||
variantName: "android_common_baz_no_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_no_rename_resources/baz_no_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certSigningFlags: "",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
},
|
||||
{
|
||||
name: "foo_no_rename_resources",
|
||||
moduleName: "baz_base_no_rename_resources",
|
||||
variantName: "android_common_baz_base_no_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_base_no_rename_resources/baz_base_no_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux", "foo_no_rename_resources"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
name: "foo_no_rename_resources",
|
||||
moduleName: "baz_base_no_rename_resources",
|
||||
variantName: "android_common_baz_base_no_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_base_no_rename_resources/baz_base_no_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certSigningFlags: "",
|
||||
overrides: []string{"qux", "foo_no_rename_resources"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: false,
|
||||
logging_parent: "",
|
||||
},
|
||||
{
|
||||
name: "foo_no_rename_resources",
|
||||
moduleName: "baz_override_base_rename_resources",
|
||||
variantName: "android_common_baz_override_base_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_override_base_rename_resources/baz_override_base_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux", "foo_no_rename_resources"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: true,
|
||||
logging_parent: "",
|
||||
name: "foo_no_rename_resources",
|
||||
moduleName: "baz_override_base_rename_resources",
|
||||
variantName: "android_common_baz_override_base_rename_resources",
|
||||
apkPath: "out/soong/target/product/test_device/system/app/baz_override_base_rename_resources/baz_override_base_rename_resources.apk",
|
||||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
certSigningFlags: "",
|
||||
overrides: []string{"qux", "foo_no_rename_resources"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
renameResources: true,
|
||||
logging_parent: "",
|
||||
},
|
||||
}
|
||||
for _, expected := range expectedVariants {
|
||||
@@ -1960,9 +1963,9 @@ func TestOverrideAndroidApp(t *testing.T) {
|
||||
certFlag := signapk.Args["certificates"]
|
||||
android.AssertStringEquals(t, "certificates flags", expected.certFlag, certFlag)
|
||||
|
||||
// Check the lineage flags
|
||||
lineageFlag := signapk.Args["flags"]
|
||||
android.AssertStringEquals(t, "signing flags", expected.lineageFlag, lineageFlag)
|
||||
// Check the cert signing flags
|
||||
certSigningFlags := signapk.Args["flags"]
|
||||
android.AssertStringEquals(t, "cert signing flags", expected.certSigningFlags, certSigningFlags)
|
||||
|
||||
// Check if the overrides field values are correctly aggregated.
|
||||
mod := variant.Module().(*AndroidApp)
|
||||
|
@@ -719,6 +719,10 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext)
|
||||
} else if global.ApexBootJars.Len() != 0 && !android.IsModuleInVersionedSdk(ctx.Module()) {
|
||||
unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents)
|
||||
_, unknown = android.RemoveFromList("core-icu4j", unknown)
|
||||
// This module only exists in car products.
|
||||
// So ignore it even if it is not in PRODUCT_APEX_BOOT_JARS.
|
||||
// TODO(b/202896428): Add better way to handle this.
|
||||
_, unknown = android.RemoveFromList("android.car-module", unknown)
|
||||
if len(unknown) > 0 {
|
||||
ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_BOOT_JARS", unknown)
|
||||
}
|
||||
|
@@ -131,14 +131,14 @@ func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars
|
||||
// TODO(208456999): instead of mapping "current" to latest, min_sdk_version should never be set to "current"
|
||||
if s.minSdkVersion.Specified() {
|
||||
if s.minSdkVersion.ApiLevel.IsCurrent() {
|
||||
jar.minSdkVersion = ctx.Config().LatestPreviewApiLevel().String()
|
||||
jar.minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
|
||||
} else {
|
||||
jar.minSdkVersion = s.minSdkVersion.ApiLevel.String()
|
||||
}
|
||||
}
|
||||
if s.maxSdkVersion.Specified() {
|
||||
if s.maxSdkVersion.ApiLevel.IsCurrent() {
|
||||
jar.maxSdkVersion = ctx.Config().LatestPreviewApiLevel().String()
|
||||
jar.maxSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
|
||||
} else {
|
||||
jar.maxSdkVersion = s.maxSdkVersion.ApiLevel.String()
|
||||
}
|
||||
|
@@ -51,6 +51,9 @@ type RuntimeResourceOverlayProperties struct {
|
||||
// Name of the signing certificate lineage file.
|
||||
Lineage *string
|
||||
|
||||
// For overriding the --rotation-min-sdk-version property of apksig
|
||||
RotationMinSdkVersion *string
|
||||
|
||||
// optional theme name. If specified, the overlay package will be applied
|
||||
// only when the ro.boot.vendor.overlay.theme system property is set to the same value.
|
||||
Theme *string
|
||||
@@ -149,7 +152,10 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
|
||||
if lineage := String(r.properties.Lineage); lineage != "" {
|
||||
lineageFile = android.PathForModuleSrc(ctx, lineage)
|
||||
}
|
||||
SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile)
|
||||
|
||||
rotationMinSdkVersion := String(r.properties.RotationMinSdkVersion)
|
||||
|
||||
SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile, rotationMinSdkVersion)
|
||||
r.certificate = certificates[0]
|
||||
|
||||
r.outputFile = signed
|
||||
|
@@ -33,6 +33,7 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||
name: "foo",
|
||||
certificate: "platform",
|
||||
lineage: "lineage.bin",
|
||||
rotationMinSdkVersion: "32",
|
||||
product_specific: true,
|
||||
static_libs: ["bar"],
|
||||
resource_libs: ["baz"],
|
||||
@@ -89,13 +90,14 @@ func TestRuntimeResourceOverlay(t *testing.T) {
|
||||
t.Errorf("Resource lib flag %q missing in aapt2 link flags: %q", resourceLibFlag, aapt2Flags)
|
||||
}
|
||||
|
||||
// Check cert signing flag.
|
||||
// Check cert signing flags.
|
||||
signedApk := m.Output("signed/foo.apk")
|
||||
lineageFlag := signedApk.Args["flags"]
|
||||
expectedLineageFlag := "--lineage lineage.bin"
|
||||
if expectedLineageFlag != lineageFlag {
|
||||
t.Errorf("Incorrect signing lineage flags, expected: %q, got: %q", expectedLineageFlag, lineageFlag)
|
||||
actualCertSigningFlags := signedApk.Args["flags"]
|
||||
expectedCertSigningFlags := "--lineage lineage.bin --rotation-min-sdk-version 32"
|
||||
if expectedCertSigningFlags != actualCertSigningFlags {
|
||||
t.Errorf("Incorrect cert signing flags, expected: %q, got: %q", expectedCertSigningFlags, actualCertSigningFlags)
|
||||
}
|
||||
|
||||
signingFlag := signedApk.Args["certificates"]
|
||||
expected := "build/make/target/product/security/platform.x509.pem build/make/target/product/security/platform.pk8"
|
||||
if expected != signingFlag {
|
||||
|
@@ -2700,7 +2700,10 @@ func formattedOptionalSdkLevelAttribute(ctx android.ModuleContext, attrName stri
|
||||
`"current" is not an allowed value for this attribute`)
|
||||
return ""
|
||||
}
|
||||
return formattedOptionalAttribute(attrName, value)
|
||||
// "safeValue" is safe because it translates finalized codenames to a string
|
||||
// with their SDK int.
|
||||
safeValue := apiLevel.String()
|
||||
return formattedOptionalAttribute(attrName, &safeValue)
|
||||
}
|
||||
|
||||
// formats an attribute for the xml permissions file if the value is not null
|
||||
|
@@ -54,6 +54,8 @@ var PrepareForTestWithJavaBuildComponents = android.GroupFixturePreparers(
|
||||
"build/soong/java/lint_defaults.txt": nil,
|
||||
// Needed for apps that do not provide their own.
|
||||
"build/make/target/product/security": nil,
|
||||
// Required to generate Java used-by API coverage
|
||||
"build/soong/scripts/gen_java_usedby_apex.sh": nil,
|
||||
}.AddToFixture(),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user