Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
diff --git a/java/sdk.go b/java/sdk.go
index 56fa12b..5f8cb24 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -133,6 +133,10 @@
return "(no version)"
}
+func (v sdkVersion) ApiLevel(ctx android.EarlyModuleContext) android.ApiLevel {
+ return android.ApiLevelOrPanic(ctx, v.String())
+}
+
// asNumberString directly converts the numeric value of this sdk version as a string.
// When isNumbered() is true, this method is the same as String(). However, for sdkVersionCurrent
// and sdkVersionNone, this returns 10000 and 0 while String() returns "current" and "(no version"),