Revert "Revert "Use the platform SDK version from the config.""

This reverts commit 74b8b55bb28629eb2a2d275f744688b34c2efa5e.

Test: OUT_DIR=ndk-out DIST_DIR=ndk-dist \
          build/soong/scripts/build-ndk-prebuilts.sh
Bug: None

Change-Id: Ia320609ec6fb382b13ff9007a6496b73198ff871
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 48fbf4d..94be17c 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -139,16 +139,7 @@
 }
 
 func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorator) {
-	// TODO(danalbert): Use PlatformSdkVersion when possible.
-	// This is an interesting case because for the moment we actually need 24
-	// even though the latest released version in aosp is 23. prebuilts/ndk/r11
-	// has android-24 versions of libraries, and as platform libraries get
-	// migrated the libraries in prebuilts will need to depend on them.
-	//
-	// Once everything is all moved over to the new stuff (when there isn't a
-	// prebuilts/ndk any more) then this should be fixable, but for now I think
-	// it needs to remain as-is.
-	maxVersion := 24
+	maxVersion := mctx.AConfig().PlatformSdkVersionInt()
 
 	firstVersion, err := normalizeNdkApiLevel(c.properties.First_version,
 		mctx.Arch())