Consolidate sdk version handling

Share the logic that converts LOCAL_SDK_VERSION, LOCAL_MIN_SDK_VERSION
and the global config values into minSdkVersion, targetSdkVersion,
and compileSdkVersion.

Test: m checkbuild
Change-Id: Id038673662b23cffc9e57978ac55a3f35ef8237a
diff --git a/core/force_aapt2.mk b/core/force_aapt2.mk
index ede6fd4..db2e60f 100644
--- a/core/force_aapt2.mk
+++ b/core/force_aapt2.mk
@@ -48,15 +48,7 @@
       ifeq (,$(wildcard $(LOCAL_PATH)/AndroidManifest.xml))
         # work around missing manifests by creating a default one
         LOCAL_FULL_MANIFEST_FILE := $(call local-intermediates-dir,COMMON)/DefaultManifest.xml
-        ifdef LOCAL_MIN_SDK_VERSION
-          my_manifest_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
-        else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
-          my_manifest_min_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
-        else
-          my_manifest_min_sdk_version := $(DEFAULT_APP_TARGET_SDK)
-        endif
-        $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(my_manifest_min_sdk_version))
-        my_manifest_min_sdk_version :=
+        $(call create-default-manifest-file,$(LOCAL_FULL_MANIFEST_FILE),$(call module-min-sdk-version))
       endif
     endif
   endif