blob: b469e7e213445722862603194d0a049b25f397d6 [file] [log] [blame]
Mathias Agopiane1c61d32012-03-23 14:19:36 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070017/**
18 * @addtogroup Configuration
19 * @{
20 */
21
22/**
23 * @file configuration.h
24 */
25
Mathias Agopiane1c61d32012-03-23 14:19:36 -070026#ifndef ANDROID_CONFIGURATION_H
27#define ANDROID_CONFIGURATION_H
28
Dan Albert494ed552016-09-23 15:57:45 -070029#include <sys/cdefs.h>
30
Mathias Agopiane1c61d32012-03-23 14:19:36 -070031#include <android/asset_manager.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37struct AConfiguration;
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070038/**
39 * {@link AConfiguration} is an opaque type used to get and set
40 * various subsystem configurations.
41 *
42 * A {@link AConfiguration} pointer can be obtained using:
43 * - AConfiguration_new()
44 * - AConfiguration_fromAssetManager()
45 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070046typedef struct AConfiguration AConfiguration;
47
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070048
49/**
50 * Define flags and constants for various subsystem configurations.
51 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070052enum {
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070053 /** Orientation: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070054 ACONFIGURATION_ORIENTATION_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070055 /**
56 * Orientation: value corresponding to the
57 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">port</a>
58 * resource qualifier.
59 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070060 ACONFIGURATION_ORIENTATION_PORT = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070061 /**
62 * Orientation: value corresponding to the
63 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">land</a>
64 * resource qualifier.
65 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070066 ACONFIGURATION_ORIENTATION_LAND = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070067 /** @deprecated Not currently supported or used. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070068 ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
69
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070070 /** Touchscreen: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070071 ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070072 /**
73 * Touchscreen: value corresponding to the
74 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">notouch</a>
75 * resource qualifier.
76 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070077 ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070078 /** @deprecated Not currently supported or used. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070079 ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070080 /**
81 * Touchscreen: value corresponding to the
82 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">finger</a>
83 * resource qualifier.
84 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070085 ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003,
86
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070087 /** Density: default density. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070088 ACONFIGURATION_DENSITY_DEFAULT = 0,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070089 /**
90 * Density: value corresponding to the
91 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">ldpi</a>
92 * resource qualifier.
93 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -070094 ACONFIGURATION_DENSITY_LOW = 120,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -070095 /**
96 * Density: value corresponding to the
97 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">mdpi</a>
98 * resource qualifier.
99 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700100 ACONFIGURATION_DENSITY_MEDIUM = 160,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700101 /**
102 * Density: value corresponding to the
103 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">tvdpi</a>
104 * resource qualifier.
105 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700106 ACONFIGURATION_DENSITY_TV = 213,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700107 /**
108 * Density: value corresponding to the
109 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">hdpi</a>
110 * resource qualifier.
111 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700112 ACONFIGURATION_DENSITY_HIGH = 240,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700113 /**
114 * Density: value corresponding to the
115 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xhdpi</a>
116 * resource qualifier.
117 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700118 ACONFIGURATION_DENSITY_XHIGH = 320,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700119 /**
120 * Density: value corresponding to the
121 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xxhdpi</a>
122 * resource qualifier.
123 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700124 ACONFIGURATION_DENSITY_XXHIGH = 480,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700125 /**
126 * Density: value corresponding to the
127 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xxxhdpi</a>
128 * resource qualifier.
129 */
Dianne Hackborn6303d062013-02-12 15:36:31 -0800130 ACONFIGURATION_DENSITY_XXXHIGH = 640,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700131 /** Density: any density. */
Adam Lesinski16d08a52014-08-22 22:23:08 -0700132 ACONFIGURATION_DENSITY_ANY = 0xfffe,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700133 /** Density: no density specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700134 ACONFIGURATION_DENSITY_NONE = 0xffff,
135
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700136 /** Keyboard: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700137 ACONFIGURATION_KEYBOARD_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700138 /**
139 * Keyboard: value corresponding to the
140 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">nokeys</a>
141 * resource qualifier.
142 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700143 ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700144 /**
145 * Keyboard: value corresponding to the
146 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">qwerty</a>
147 * resource qualifier.
148 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700149 ACONFIGURATION_KEYBOARD_QWERTY = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700150 /**
151 * Keyboard: value corresponding to the
152 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">12key</a>
153 * resource qualifier.
154 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700155 ACONFIGURATION_KEYBOARD_12KEY = 0x0003,
156
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700157 /** Navigation: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700158 ACONFIGURATION_NAVIGATION_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700159 /**
160 * Navigation: value corresponding to the
161 * <a href="@@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">nonav</a>
162 * resource qualifier.
163 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700164 ACONFIGURATION_NAVIGATION_NONAV = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700165 /**
166 * Navigation: value corresponding to the
167 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">dpad</a>
168 * resource qualifier.
169 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700170 ACONFIGURATION_NAVIGATION_DPAD = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700171 /**
172 * Navigation: value corresponding to the
173 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">trackball</a>
174 * resource qualifier.
175 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700176 ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700177 /**
178 * Navigation: value corresponding to the
179 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">wheel</a>
180 * resource qualifier.
181 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700182 ACONFIGURATION_NAVIGATION_WHEEL = 0x0004,
183
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700184 /** Keyboard availability: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700185 ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700186 /**
187 * Keyboard availability: value corresponding to the
188 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keysexposed</a>
189 * resource qualifier.
190 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700191 ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700192 /**
193 * Keyboard availability: value corresponding to the
194 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyshidden</a>
195 * resource qualifier.
196 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700197 ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700198 /**
199 * Keyboard availability: value corresponding to the
200 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyssoft</a>
201 * resource qualifier.
202 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700203 ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
204
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700205 /** Navigation availability: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700206 ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700207 /**
208 * Navigation availability: value corresponding to the
209 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavAvailQualifier">navexposed</a>
210 * resource qualifier.
211 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700212 ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700213 /**
214 * Navigation availability: value corresponding to the
215 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavAvailQualifier">navhidden</a>
216 * resource qualifier.
217 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700218 ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
219
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700220 /** Screen size: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700221 ACONFIGURATION_SCREENSIZE_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700222 /**
223 * Screen size: value indicating the screen is at least
224 * approximately 320x426 dp units, corresponding to the
225 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">small</a>
226 * resource qualifier.
227 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700228 ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700229 /**
230 * Screen size: value indicating the screen is at least
231 * approximately 320x470 dp units, corresponding to the
232 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">normal</a>
233 * resource qualifier.
234 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700235 ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700236 /**
237 * Screen size: value indicating the screen is at least
238 * approximately 480x640 dp units, corresponding to the
239 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">large</a>
240 * resource qualifier.
241 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700242 ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700243 /**
244 * Screen size: value indicating the screen is at least
245 * approximately 720x960 dp units, corresponding to the
246 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">xlarge</a>
247 * resource qualifier.
248 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700249 ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
250
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700251 /** Screen layout: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700252 ACONFIGURATION_SCREENLONG_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700253 /**
254 * Screen layout: value that corresponds to the
255 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">notlong</a>
256 * resource qualifier.
257 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700258 ACONFIGURATION_SCREENLONG_NO = 0x1,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700259 /**
260 * Screen layout: value that corresponds to the
261 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">long</a>
262 * resource qualifier.
263 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700264 ACONFIGURATION_SCREENLONG_YES = 0x2,
265
Adam Lesinski7eb14592015-05-14 14:28:32 -0700266 ACONFIGURATION_SCREENROUND_ANY = 0x00,
267 ACONFIGURATION_SCREENROUND_NO = 0x1,
268 ACONFIGURATION_SCREENROUND_YES = 0x2,
269
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700270 /** UI mode: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700271 ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700272 /**
273 * UI mode: value that corresponds to
274 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">no
275 * UI mode type</a> resource qualifier specified.
276 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700277 ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700278 /**
279 * UI mode: value that corresponds to
280 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">desk</a> resource qualifier specified.
281 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700282 ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700283 /**
284 * UI mode: value that corresponds to
285 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">car</a> resource qualifier specified.
286 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700287 ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700288 /**
289 * UI mode: value that corresponds to
290 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">television</a> resource qualifier specified.
291 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700292 ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700293 /**
294 * UI mode: value that corresponds to
295 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">appliance</a> resource qualifier specified.
296 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700297 ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700298 /**
299 * UI mode: value that corresponds to
300 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">watch</a> resource qualifier specified.
301 */
John Spurlockad98ad02014-04-03 16:39:17 -0400302 ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06,
Zak Cohena62fb162016-12-09 15:06:02 -0800303 /**
304 * UI mode: value that corresponds to
305 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">vr</a> resource qualifier specified.
306 */
307 ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET = 0x07,
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700308
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700309 /** UI night mode: not specified.*/
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700310 ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700311 /**
312 * UI night mode: value that corresponds to
313 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NightQualifier">notnight</a> resource qualifier specified.
314 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700315 ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700316 /**
317 * UI night mode: value that corresponds to
318 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NightQualifier">night</a> resource qualifier specified.
319 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700320 ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
321
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700322 /** Screen width DPI: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700323 ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
324
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700325 /** Screen height DPI: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700326 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
327
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700328 /** Smallest screen width DPI: not specified.*/
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700329 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
330
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700331 /** Layout direction: not specified. */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700332 ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700333 /**
334 * Layout direction: value that corresponds to
335 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldltr</a> resource qualifier specified.
336 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700337 ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700338 /**
339 * Layout direction: value that corresponds to
340 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldrtl</a> resource qualifier specified.
341 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700342 ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
343
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700344 /**
345 * Bit mask for
346 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mcc</a>
347 * configuration.
348 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700349 ACONFIGURATION_MCC = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700350 /**
351 * Bit mask for
352 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mnc</a>
353 * configuration.
354 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700355 ACONFIGURATION_MNC = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700356 /**
357 * Bit mask for
358 * <a href="{@docRoot}guide/topics/resources/providing-resources.html#LocaleQualifier">locale</a>
359 * configuration.
360 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700361 ACONFIGURATION_LOCALE = 0x0004,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700362 /**
363 * Bit mask for
364 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">touchscreen</a>
365 * configuration.
366 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700367 ACONFIGURATION_TOUCHSCREEN = 0x0008,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700368 /**
369 * Bit mask for
370 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">keyboard</a>
371 * configuration.
372 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700373 ACONFIGURATION_KEYBOARD = 0x0010,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700374 /**
375 * Bit mask for
376 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyboardHidden</a>
377 * configuration.
378 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700379 ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700380 /**
381 * Bit mask for
382 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">navigation</a>
383 * configuration.
384 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700385 ACONFIGURATION_NAVIGATION = 0x0040,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700386 /**
387 * Bit mask for
388 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">orientation</a>
389 * configuration.
390 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700391 ACONFIGURATION_ORIENTATION = 0x0080,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700392 /**
393 * Bit mask for
394 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">density</a>
395 * configuration.
396 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700397 ACONFIGURATION_DENSITY = 0x0100,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700398 /**
399 * Bit mask for
400 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">screen size</a>
401 * configuration.
402 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700403 ACONFIGURATION_SCREEN_SIZE = 0x0200,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700404 /**
405 * Bit mask for
406 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#VersionQualifier">platform version</a>
407 * configuration.
408 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700409 ACONFIGURATION_VERSION = 0x0400,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700410 /**
411 * Bit mask for screen layout configuration.
412 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700413 ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700414 /**
415 * Bit mask for
416 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">ui mode</a>
417 * configuration.
418 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700419 ACONFIGURATION_UI_MODE = 0x1000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700420 /**
421 * Bit mask for
422 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest screen width</a>
423 * configuration.
424 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700425 ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700426 /**
427 * Bit mask for
428 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">layout direction</a>
429 * configuration.
430 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700431 ACONFIGURATION_LAYOUTDIR = 0x4000,
Adam Lesinski7eb14592015-05-14 14:28:32 -0700432 ACONFIGURATION_SCREEN_ROUND = 0x8000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700433 /**
434 * Constant used to to represent MNC (Mobile Network Code) zero.
435 * 0 cannot be used, since it is used to represent an undefined MNC.
436 */
Johan Redestig8df483c2013-05-30 08:30:42 +0200437 ACONFIGURATION_MNC_ZERO = 0xffff,
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700438};
439
440/**
441 * Create a new AConfiguration, initialized with no values set.
442 */
443AConfiguration* AConfiguration_new();
444
445/**
446 * Free an AConfiguration that was previously created with
447 * AConfiguration_new().
448 */
449void AConfiguration_delete(AConfiguration* config);
450
451/**
452 * Create and return a new AConfiguration based on the current configuration in
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700453 * use in the given {@link AAssetManager}.
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700454 */
455void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
456
457/**
458 * Copy the contents of 'src' to 'dest'.
459 */
460void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
461
462/**
463 * Return the current MCC set in the configuration. 0 if not set.
464 */
465int32_t AConfiguration_getMcc(AConfiguration* config);
466
467/**
468 * Set the current MCC in the configuration. 0 to clear.
469 */
470void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
471
472/**
473 * Return the current MNC set in the configuration. 0 if not set.
474 */
475int32_t AConfiguration_getMnc(AConfiguration* config);
476
477/**
478 * Set the current MNC in the configuration. 0 to clear.
479 */
480void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
481
482/**
483 * Return the current language code set in the configuration. The output will
484 * be filled with an array of two characters. They are not 0-terminated. If
485 * a language is not set, they will be 0.
486 */
487void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
488
489/**
490 * Set the current language code in the configuration, from the first two
491 * characters in the string.
492 */
493void AConfiguration_setLanguage(AConfiguration* config, const char* language);
494
495/**
496 * Return the current country code set in the configuration. The output will
497 * be filled with an array of two characters. They are not 0-terminated. If
498 * a country is not set, they will be 0.
499 */
500void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
501
502/**
503 * Set the current country code in the configuration, from the first two
504 * characters in the string.
505 */
506void AConfiguration_setCountry(AConfiguration* config, const char* country);
507
508/**
509 * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
510 */
511int32_t AConfiguration_getOrientation(AConfiguration* config);
512
513/**
514 * Set the current orientation in the configuration.
515 */
516void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
517
518/**
519 * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
520 */
521int32_t AConfiguration_getTouchscreen(AConfiguration* config);
522
523/**
524 * Set the current touchscreen in the configuration.
525 */
526void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
527
528/**
529 * Return the current ACONFIGURATION_DENSITY_* set in the configuration.
530 */
531int32_t AConfiguration_getDensity(AConfiguration* config);
532
533/**
534 * Set the current density in the configuration.
535 */
536void AConfiguration_setDensity(AConfiguration* config, int32_t density);
537
538/**
539 * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
540 */
541int32_t AConfiguration_getKeyboard(AConfiguration* config);
542
543/**
544 * Set the current keyboard in the configuration.
545 */
546void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
547
548/**
549 * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
550 */
551int32_t AConfiguration_getNavigation(AConfiguration* config);
552
553/**
554 * Set the current navigation in the configuration.
555 */
556void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
557
558/**
559 * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
560 */
561int32_t AConfiguration_getKeysHidden(AConfiguration* config);
562
563/**
564 * Set the current keys hidden in the configuration.
565 */
566void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
567
568/**
569 * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
570 */
571int32_t AConfiguration_getNavHidden(AConfiguration* config);
572
573/**
574 * Set the current nav hidden in the configuration.
575 */
576void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
577
578/**
579 * Return the current SDK (API) version set in the configuration.
580 */
581int32_t AConfiguration_getSdkVersion(AConfiguration* config);
582
583/**
584 * Set the current SDK version in the configuration.
585 */
586void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
587
588/**
589 * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
590 */
591int32_t AConfiguration_getScreenSize(AConfiguration* config);
592
593/**
594 * Set the current screen size in the configuration.
595 */
596void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
597
598/**
599 * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
600 */
601int32_t AConfiguration_getScreenLong(AConfiguration* config);
602
603/**
604 * Set the current screen long in the configuration.
605 */
606void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
607
608/**
Adam Lesinski7eb14592015-05-14 14:28:32 -0700609 * Return the current ACONFIGURATION_SCREENROUND_* set in the configuration.
610 */
611int32_t AConfiguration_getScreenRound(AConfiguration* config);
612
613/**
614 * Set the current screen round in the configuration.
615 */
616void AConfiguration_setScreenRound(AConfiguration* config, int32_t screenRound);
617
618/**
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700619 * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
620 */
621int32_t AConfiguration_getUiModeType(AConfiguration* config);
622
623/**
624 * Set the current UI mode type in the configuration.
625 */
626void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
627
628/**
629 * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
630 */
631int32_t AConfiguration_getUiModeNight(AConfiguration* config);
632
633/**
634 * Set the current UI mode night in the configuration.
635 */
636void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
637
Dan Albert494ed552016-09-23 15:57:45 -0700638#if __ANDROID_API__ >= 13
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700639/**
640 * Return the current configuration screen width in dp units, or
641 * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
642 */
643int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
644
645/**
646 * Set the configuration's current screen width in dp units.
647 */
648void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
649
650/**
651 * Return the current configuration screen height in dp units, or
652 * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
653 */
654int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
655
656/**
657 * Set the configuration's current screen width in dp units.
658 */
659void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
660
661/**
662 * Return the configuration's smallest screen width in dp units, or
663 * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
664 */
665int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
666
667/**
668 * Set the configuration's smallest screen width in dp units.
669 */
670void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
Dan Albert494ed552016-09-23 15:57:45 -0700671#endif /* __ANDROID_API__ >= 13 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700672
Dan Albert494ed552016-09-23 15:57:45 -0700673#if __ANDROID_API__ >= 17
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700674/**
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700675 * Return the configuration's layout direction, or
676 * ACONFIGURATION_LAYOUTDIR_ANY if not set.
677 */
678int32_t AConfiguration_getLayoutDirection(AConfiguration* config);
679
680/**
681 * Set the configuration's layout direction.
682 */
683void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value);
Dan Albert494ed552016-09-23 15:57:45 -0700684#endif /* __ANDROID_API__ >= 17 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700685
686/**
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700687 * Perform a diff between two configurations. Returns a bit mask of
688 * ACONFIGURATION_* constants, each bit set meaning that configuration element
689 * is different between them.
690 */
691int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
692
693/**
694 * Determine whether 'base' is a valid configuration for use within the
695 * environment 'requested'. Returns 0 if there are any values in 'base'
696 * that conflict with 'requested'. Returns 1 if it does not conflict.
697 */
698int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
699
700/**
701 * Determine whether the configuration in 'test' is better than the existing
702 * configuration in 'base'. If 'requested' is non-NULL, this decision is based
703 * on the overall configuration given there. If it is NULL, this decision is
704 * simply based on which configuration is more specific. Returns non-0 if
705 * 'test' is better than 'base'.
706 *
707 * This assumes you have already filtered the configurations with
708 * AConfiguration_match().
709 */
710int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
711 AConfiguration* requested);
712
713#ifdef __cplusplus
714};
715#endif
716
717#endif // ANDROID_CONFIGURATION_H
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700718
719/** @} */