Stop using the __ANDROID_API_x__ constants.

Historically we've made a few mistakes where they haven't matched the
right number. And most non-Googlers are much more familiar with the
numbers, so it seems to make sense to rely more on them. Especially in
header files, which we actually expect real people to have to read from
time to time.

Test: treehugger
Change-Id: I0d4a97454ee108de1d32f21df285315c5488d886
diff --git a/linker/linker.cpp b/linker/linker.cpp
index fb22a1d..54e0703 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -209,7 +209,7 @@
   };
 
   // If you're targeting N, you don't get the greylist.
-  if (g_greylist_disabled || get_application_target_sdk_version() >= __ANDROID_API_N__) {
+  if (g_greylist_disabled || get_application_target_sdk_version() >= 24) {
     return false;
   }
 
@@ -252,7 +252,7 @@
   // New mapping for new apex should be added below
 
   // Nothing to do if target sdk version is Q or above
-  if (get_application_target_sdk_version() >= __ANDROID_API_Q__) {
+  if (get_application_target_sdk_version() >= 29) {
     return false;
   }
 
@@ -943,8 +943,7 @@
     // Do not skip RTLD_LOCAL libraries in dlsym(RTLD_DEFAULT, ...)
     // if the library is opened by application with target api level < M.
     // See http://b/21565766
-    if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 &&
-        si->get_target_sdk_version() >= __ANDROID_API_M__) {
+    if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 && si->get_target_sdk_version() >= 23) {
       continue;
     }
 
@@ -1232,10 +1231,10 @@
 #if !defined(__LP64__)
   // Work around incorrect DT_NEEDED entries for old apps: http://b/21364029
   int app_target_api_level = get_application_target_sdk_version();
-  if (app_target_api_level < __ANDROID_API_M__) {
+  if (app_target_api_level < 23) {
     const char* bname = basename(dt_needed);
     if (bname != dt_needed) {
-      DL_WARN_documented_change(__ANDROID_API_M__,
+      DL_WARN_documented_change(23,
                                 "invalid-dt_needed-entries-enforced-for-api-level-23",
                                 "library \"%s\" has invalid DT_NEEDED entry \"%s\"",
                                 sopath, dt_needed, app_target_api_level);
@@ -1384,7 +1383,7 @@
         const soinfo* needed_or_dlopened_by = task->get_needed_by();
         const char* sopath = needed_or_dlopened_by == nullptr ? "(unknown)" :
                                                       needed_or_dlopened_by->get_realpath();
-        DL_WARN_documented_change(__ANDROID_API_N__,
+        DL_WARN_documented_change(24,
                                   "private-api-enforced-for-api-level-24",
                                   "library \"%s\" (\"%s\") needed or dlopened by \"%s\" "
                                   "is not accessible by namespace \"%s\"",
@@ -3832,9 +3831,9 @@
   if (soname_ == nullptr &&
       this != solist_get_somain() &&
       (flags_ & FLAG_LINKER) == 0 &&
-      get_application_target_sdk_version() < __ANDROID_API_M__) {
+      get_application_target_sdk_version() < 23) {
     soname_ = basename(realpath_.c_str());
-    DL_WARN_documented_change(__ANDROID_API_M__,
+    DL_WARN_documented_change(23,
                               "missing-soname-enforced-for-api-level-23",
                               "\"%s\" has no DT_SONAME (will use %s instead)",
                               get_realpath(), soname_);
@@ -3875,7 +3874,7 @@
   if (has_text_relocations) {
     // Fail if app is targeting M or above.
     int app_target_api_level = get_application_target_sdk_version();
-    if (app_target_api_level >= __ANDROID_API_M__) {
+    if (app_target_api_level >= 23) {
       DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
                      "bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
                      "Enforced-for-API-level-23)", get_realpath());
@@ -3883,7 +3882,7 @@
     }
     // Make segments writable to allow text relocations to work properly. We will later call
     // phdr_table_protect_segments() after all of them are applied.
-    DL_WARN_documented_change(__ANDROID_API_M__,
+    DL_WARN_documented_change(23,
                               "Text-Relocations-Enforced-for-API-level-23",
                               "\"%s\" has text relocations",
                               get_realpath());