Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
diff --git a/apex/builder.go b/apex/builder.go
index c5680ad..a3c4d5c 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -21,7 +21,6 @@
"path/filepath"
"runtime"
"sort"
- "strconv"
"strings"
"android/soong/android"
@@ -214,7 +213,8 @@
},
})
- if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
+ minSdkVersion := a.minSdkVersion(ctx)
+ if minSdkVersion.EqualTo(android.SdkVersion_Android10) {
// b/143654022 Q apexd can't understand newly added keys in apex_manifest.json
// prepare stripped-down version so that APEX modules built from R+ can be installed to Q
a.manifestJsonOut = android.PathForModuleOut(ctx, "apex_manifest.json")
@@ -426,7 +426,8 @@
var emitCommands []string
imageContentFile := android.PathForModuleOut(ctx, "content.txt")
emitCommands = append(emitCommands, "echo ./apex_manifest.pb >> "+imageContentFile.String())
- if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
+ minSdkVersion := a.minSdkVersion(ctx)
+ if minSdkVersion.EqualTo(android.SdkVersion_Android10) {
emitCommands = append(emitCommands, "echo ./apex_manifest.json >> "+imageContentFile.String())
}
for _, fi := range a.filesInfo {
@@ -536,8 +537,9 @@
// TODO(b/157078772): propagate min_sdk_version to apexer.
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
- if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
- minSdkVersion = strconv.Itoa(a.minSdkVersion(ctx))
+ moduleMinSdkVersion := a.minSdkVersion(ctx)
+ if moduleMinSdkVersion.EqualTo(android.SdkVersion_Android10) {
+ minSdkVersion = moduleMinSdkVersion.String()
}
if java.UseApiFingerprint(ctx) {
@@ -566,7 +568,7 @@
ctx.PropertyErrorf("test_only_no_hashtree", "not available")
return
}
- if a.minSdkVersion(ctx) > android.SdkVersion_Android10 || a.testOnlyShouldSkipHashtreeGeneration() {
+ if moduleMinSdkVersion.GreaterThan(android.SdkVersion_Android10) || a.testOnlyShouldSkipHashtreeGeneration() {
// Apexes which are supposed to be installed in builtin dirs(/system, etc)
// don't need hashtree for activation. Therefore, by removing hashtree from
// apex bundle (filesystem image in it, to be specific), we can save storage.
@@ -583,7 +585,7 @@
optFlags = append(optFlags, "--do_not_check_keyname")
}
- if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
+ if moduleMinSdkVersion == android.SdkVersion_Android10 {
implicitInputs = append(implicitInputs, a.manifestJsonOut)
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
}