blob: ebce9000dd0bfec32ee4696ccc87aaac6aea5c12 [file] [log] [blame]
David 'Digit' Turner23d24392010-12-06 12:05:11 +01001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
Elliott Hughes4aa2e6a2014-05-07 12:37:44 -070028
Elliott Hughesce934e32018-09-06 13:26:08 -070029#pragma once
30
31/**
32 * @file android/api-level.h
33 * @brief Functions and constants for dealing with multiple API levels.
34 */
David 'Digit' Turner23d24392010-12-06 12:05:11 +010035
Elliott Hughes203e13d2016-07-22 14:56:18 -070036#include <sys/cdefs.h>
37
Dan Albert495ec922016-09-21 01:08:44 -070038#ifndef __ANDROID_API_FUTURE__
Elliott Hughesce934e32018-09-06 13:26:08 -070039/**
40 * Magic version number for an Android OS build which has
41 * not yet turned into an official release,
42 * for comparisons against __ANDROID_API__.
43 */
Dan Albert495ec922016-09-21 01:08:44 -070044#define __ANDROID_API_FUTURE__ 10000
45#endif
46
Josh Gao99739d42016-04-13 17:16:47 -070047#ifndef __ANDROID_API__
Elliott Hughesce934e32018-09-06 13:26:08 -070048/**
49 * `__ANDROID_API__` is the API level being targeted. For the OS,
50 * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the
51 * compiler/build system based on the API level you claimed to target.
52 */
Dan Albert495ec922016-09-21 01:08:44 -070053#define __ANDROID_API__ __ANDROID_API_FUTURE__
Dan Albertf66fa492017-07-26 14:27:43 -070054#else
Elliott Hughesce934e32018-09-06 13:26:08 -070055/**
56 * `__ANDROID_NDK__` is defined for code that's built by the NDK
57 * rather than as part of the OS.
58 */
Dan Albertf66fa492017-07-26 14:27:43 -070059#define __ANDROID_NDK__ 1
Josh Gao99739d42016-04-13 17:16:47 -070060#endif
David 'Digit' Turner23d24392010-12-06 12:05:11 +010061
Elliott Hughesce934e32018-09-06 13:26:08 -070062/** Names the Gingerbread API level (9), for comparisons against __ANDROID_API__. */
Elliott Hughes5bc78c82016-11-16 11:35:43 -080063#define __ANDROID_API_G__ 9
Elliott Hughes5bc78c82016-11-16 11:35:43 -080064
Elliott Hughesce934e32018-09-06 13:26:08 -070065/** Names the Ice-Cream Sandwich API level (14), for comparisons against __ANDROID_API__. */
66#define __ANDROID_API_I__ 14
67
68/** Names the Jellybean API level (16), for comparisons against __ANDROID_API__. */
69#define __ANDROID_API_J__ 16
70
71/** Names the Jellybean MR1 API level (17), for comparisons against __ANDROID_API__. */
72#define __ANDROID_API_J_MR1__ 17
73
74/** Names the Jellybean MR2 API level (18), for comparisons against __ANDROID_API__. */
75#define __ANDROID_API_J_MR2__ 18
76
77/** Names the KitKat API level (19), for comparisons against __ANDROID_API__. */
78#define __ANDROID_API_K__ 19
79
80/** Names the Lollipop API level (21), for comparisons against __ANDROID_API__. */
81#define __ANDROID_API_L__ 21
82
83/** Names the Lollipop MR1 API level (22), for comparisons against __ANDROID_API__. */
84#define __ANDROID_API_L_MR1__ 22
85
86/** Names the Marshmallow API level (23), for comparisons against __ANDROID_API__. */
87#define __ANDROID_API_M__ 23
88
89/** Names the Nougat API level (24), for comparisons against __ANDROID_API__. */
90#define __ANDROID_API_N__ 24
91
92/** Names the Nougat MR1 API level (25), for comparisons against __ANDROID_API__. */
93#define __ANDROID_API_N_MR1__ 25
94
95/** Names the Oreo API level (26), for comparisons against __ANDROID_API__. */
96#define __ANDROID_API_O__ 26
97
98/** Names the Oreo MR1 API level (27), for comparisons against __ANDROID_API__. */
99#define __ANDROID_API_O_MR1__ 27
100
101/** Names the Pie API level (28), for comparisons against __ANDROID_API__. */
102#define __ANDROID_API_P__ 28
103
104/** Names the "Q" API level (29), for comparisons against __ANDROID_API__. */
105#define __ANDROID_API_Q__ 29