Add and use constants for the Android API levels.

Test: bionic tests still pass
Change-Id: If1b619cfc9db1d3f5d91f14f2ace71058dca0c4a
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index df118e3..40bd32e 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -62,7 +62,7 @@
 void __FD_SET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
 int __FD_ISSET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
 
-#if defined(__BIONIC_FORTIFY) && __ANDROID_API__ >= 21
+#if defined(__BIONIC_FORTIFY) && __ANDROID_API__ >= __ANDROID_API_L__
 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 03dc849..8e05cf1 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -114,7 +114,7 @@
    ? (struct cmsghdr*) (msg)->msg_control : (struct cmsghdr*) NULL)
 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char*)(cmsg) - (char*)(mhdr)->msg_control)))
 
-#if __ANDROID_API__ >= 21
+#if __ANDROID_API__ >= __ANDROID_API_L__
 struct cmsghdr* __cmsg_nxthdr(struct msghdr*, struct cmsghdr*) __INTRODUCED_IN(21);
 #else
 /* TODO(danalbert): Move this into libandroid_support. */
@@ -129,7 +129,7 @@
   }
   return ptr;
 }
-#endif /* __ANDROID_API__ >= 21 */
+#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
 
 #define SCM_RIGHTS 0x01
 #define SCM_CREDENTIALS 0x02
@@ -315,7 +315,7 @@
 
 #if defined(__BIONIC_FORTIFY)
 
-#if __ANDROID_API__ >= 24
+#if __ANDROID_API__ >= __ANDROID_API_N__
 __BIONIC_FORTIFY_INLINE
 ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len) {
   size_t bos = __bos0(buf);
@@ -336,7 +336,7 @@
 
   return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len);
 }
-#endif /* __ANDROID_API__ >= 24 */
+#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
 
 __BIONIC_FORTIFY_INLINE
 ssize_t recv(int socket, void* buf, size_t len, int flags) {
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index cc9dd91..f961cf8 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -169,7 +169,7 @@
 
 #if defined(__BIONIC_FORTIFY)
 
-#if __ANDROID_API__ >= 18
+#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
 __BIONIC_FORTIFY_INLINE
 mode_t umask(mode_t mode) {
 #if !defined(__clang__)
@@ -182,11 +182,11 @@
 #endif
   return __umask_chk(mode);
 }
-#endif /* __ANDROID_API__ >= 18 */
+#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
 
 #endif /* defined(__BIONIC_FORTIFY) */
 
-#if __ANDROID_API__ >= 21
+#if __ANDROID_API__ >= __ANDROID_API_L__
 int mkfifo(const char*, mode_t) __INTRODUCED_IN(21);
 #else
 // Implemented as a static inline before 21.
diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h
index f3972fc..0247b2b 100644
--- a/libc/include/sys/wait.h
+++ b/libc/include/sys/wait.h
@@ -51,7 +51,7 @@
 
 pid_t wait(int*);
 pid_t waitpid(pid_t, int*, int);
-#if __ANDROID_API__ >= 18
+#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
 pid_t wait4(pid_t, int*, int, struct rusage*) __INTRODUCED_IN(18);
 #else
 // Implemented as a static inline before 18.