blob: 8e10f67662bfdb8e109643fe449cd3b49ec9e5e6 [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,
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700303
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700304 /** UI night mode: not specified.*/
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700305 ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700306 /**
307 * UI night mode: value that corresponds to
308 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NightQualifier">notnight</a> resource qualifier specified.
309 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700310 ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
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">night</a> resource qualifier specified.
314 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700315 ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
316
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700317 /** Screen width DPI: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700318 ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
319
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700320 /** Screen height DPI: not specified. */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700321 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
322
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700323 /** Smallest screen width DPI: not specified.*/
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700324 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
325
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700326 /** Layout direction: not specified. */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700327 ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700328 /**
329 * Layout direction: value that corresponds to
330 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldltr</a> resource qualifier specified.
331 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700332 ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
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">ldrtl</a> resource qualifier specified.
336 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700337 ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
338
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700339 /**
340 * Bit mask for
341 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mcc</a>
342 * configuration.
343 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700344 ACONFIGURATION_MCC = 0x0001,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700345 /**
346 * Bit mask for
347 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mnc</a>
348 * configuration.
349 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700350 ACONFIGURATION_MNC = 0x0002,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700351 /**
352 * Bit mask for
353 * <a href="{@docRoot}guide/topics/resources/providing-resources.html#LocaleQualifier">locale</a>
354 * configuration.
355 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700356 ACONFIGURATION_LOCALE = 0x0004,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700357 /**
358 * Bit mask for
359 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">touchscreen</a>
360 * configuration.
361 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700362 ACONFIGURATION_TOUCHSCREEN = 0x0008,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700363 /**
364 * Bit mask for
365 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">keyboard</a>
366 * configuration.
367 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700368 ACONFIGURATION_KEYBOARD = 0x0010,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700369 /**
370 * Bit mask for
371 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyboardHidden</a>
372 * configuration.
373 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700374 ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700375 /**
376 * Bit mask for
377 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">navigation</a>
378 * configuration.
379 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700380 ACONFIGURATION_NAVIGATION = 0x0040,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700381 /**
382 * Bit mask for
383 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">orientation</a>
384 * configuration.
385 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700386 ACONFIGURATION_ORIENTATION = 0x0080,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700387 /**
388 * Bit mask for
389 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">density</a>
390 * configuration.
391 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700392 ACONFIGURATION_DENSITY = 0x0100,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700393 /**
394 * Bit mask for
395 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">screen size</a>
396 * configuration.
397 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700398 ACONFIGURATION_SCREEN_SIZE = 0x0200,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700399 /**
400 * Bit mask for
401 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#VersionQualifier">platform version</a>
402 * configuration.
403 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700404 ACONFIGURATION_VERSION = 0x0400,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700405 /**
406 * Bit mask for screen layout configuration.
407 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700408 ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700409 /**
410 * Bit mask for
411 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">ui mode</a>
412 * configuration.
413 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700414 ACONFIGURATION_UI_MODE = 0x1000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700415 /**
416 * Bit mask for
417 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest screen width</a>
418 * configuration.
419 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700420 ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700421 /**
422 * Bit mask for
423 * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">layout direction</a>
424 * configuration.
425 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700426 ACONFIGURATION_LAYOUTDIR = 0x4000,
Adam Lesinski7eb14592015-05-14 14:28:32 -0700427 ACONFIGURATION_SCREEN_ROUND = 0x8000,
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700428 /**
429 * Constant used to to represent MNC (Mobile Network Code) zero.
430 * 0 cannot be used, since it is used to represent an undefined MNC.
431 */
Johan Redestig8df483c2013-05-30 08:30:42 +0200432 ACONFIGURATION_MNC_ZERO = 0xffff,
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700433};
434
435/**
436 * Create a new AConfiguration, initialized with no values set.
437 */
438AConfiguration* AConfiguration_new();
439
440/**
441 * Free an AConfiguration that was previously created with
442 * AConfiguration_new().
443 */
444void AConfiguration_delete(AConfiguration* config);
445
446/**
447 * Create and return a new AConfiguration based on the current configuration in
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700448 * use in the given {@link AAssetManager}.
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700449 */
450void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
451
452/**
453 * Copy the contents of 'src' to 'dest'.
454 */
455void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
456
457/**
458 * Return the current MCC set in the configuration. 0 if not set.
459 */
460int32_t AConfiguration_getMcc(AConfiguration* config);
461
462/**
463 * Set the current MCC in the configuration. 0 to clear.
464 */
465void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
466
467/**
468 * Return the current MNC set in the configuration. 0 if not set.
469 */
470int32_t AConfiguration_getMnc(AConfiguration* config);
471
472/**
473 * Set the current MNC in the configuration. 0 to clear.
474 */
475void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
476
477/**
478 * Return the current language code set in the configuration. The output will
479 * be filled with an array of two characters. They are not 0-terminated. If
480 * a language is not set, they will be 0.
481 */
482void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
483
484/**
485 * Set the current language code in the configuration, from the first two
486 * characters in the string.
487 */
488void AConfiguration_setLanguage(AConfiguration* config, const char* language);
489
490/**
491 * Return the current country code set in the configuration. The output will
492 * be filled with an array of two characters. They are not 0-terminated. If
493 * a country is not set, they will be 0.
494 */
495void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
496
497/**
498 * Set the current country code in the configuration, from the first two
499 * characters in the string.
500 */
501void AConfiguration_setCountry(AConfiguration* config, const char* country);
502
503/**
504 * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
505 */
506int32_t AConfiguration_getOrientation(AConfiguration* config);
507
508/**
509 * Set the current orientation in the configuration.
510 */
511void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
512
513/**
514 * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
515 */
516int32_t AConfiguration_getTouchscreen(AConfiguration* config);
517
518/**
519 * Set the current touchscreen in the configuration.
520 */
521void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
522
523/**
524 * Return the current ACONFIGURATION_DENSITY_* set in the configuration.
525 */
526int32_t AConfiguration_getDensity(AConfiguration* config);
527
528/**
529 * Set the current density in the configuration.
530 */
531void AConfiguration_setDensity(AConfiguration* config, int32_t density);
532
533/**
534 * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
535 */
536int32_t AConfiguration_getKeyboard(AConfiguration* config);
537
538/**
539 * Set the current keyboard in the configuration.
540 */
541void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
542
543/**
544 * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
545 */
546int32_t AConfiguration_getNavigation(AConfiguration* config);
547
548/**
549 * Set the current navigation in the configuration.
550 */
551void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
552
553/**
554 * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
555 */
556int32_t AConfiguration_getKeysHidden(AConfiguration* config);
557
558/**
559 * Set the current keys hidden in the configuration.
560 */
561void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
562
563/**
564 * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
565 */
566int32_t AConfiguration_getNavHidden(AConfiguration* config);
567
568/**
569 * Set the current nav hidden in the configuration.
570 */
571void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
572
573/**
574 * Return the current SDK (API) version set in the configuration.
575 */
576int32_t AConfiguration_getSdkVersion(AConfiguration* config);
577
578/**
579 * Set the current SDK version in the configuration.
580 */
581void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
582
583/**
584 * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
585 */
586int32_t AConfiguration_getScreenSize(AConfiguration* config);
587
588/**
589 * Set the current screen size in the configuration.
590 */
591void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
592
593/**
594 * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
595 */
596int32_t AConfiguration_getScreenLong(AConfiguration* config);
597
598/**
599 * Set the current screen long in the configuration.
600 */
601void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
602
603/**
Adam Lesinski7eb14592015-05-14 14:28:32 -0700604 * Return the current ACONFIGURATION_SCREENROUND_* set in the configuration.
605 */
606int32_t AConfiguration_getScreenRound(AConfiguration* config);
607
608/**
609 * Set the current screen round in the configuration.
610 */
611void AConfiguration_setScreenRound(AConfiguration* config, int32_t screenRound);
612
613/**
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700614 * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
615 */
616int32_t AConfiguration_getUiModeType(AConfiguration* config);
617
618/**
619 * Set the current UI mode type in the configuration.
620 */
621void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
622
623/**
624 * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
625 */
626int32_t AConfiguration_getUiModeNight(AConfiguration* config);
627
628/**
629 * Set the current UI mode night in the configuration.
630 */
631void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
632
Dan Albert494ed552016-09-23 15:57:45 -0700633#if __ANDROID_API__ >= 13
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700634/**
635 * Return the current configuration screen width in dp units, or
636 * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
637 */
638int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
639
640/**
641 * Set the configuration's current screen width in dp units.
642 */
643void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
644
645/**
646 * Return the current configuration screen height in dp units, or
647 * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
648 */
649int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
650
651/**
652 * Set the configuration's current screen width in dp units.
653 */
654void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
655
656/**
657 * Return the configuration's smallest screen width in dp units, or
658 * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
659 */
660int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
661
662/**
663 * Set the configuration's smallest screen width in dp units.
664 */
665void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
Dan Albert494ed552016-09-23 15:57:45 -0700666#endif /* __ANDROID_API__ >= 13 */
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700667
Dan Albert494ed552016-09-23 15:57:45 -0700668#if __ANDROID_API__ >= 17
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700669/**
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700670 * Return the configuration's layout direction, or
671 * ACONFIGURATION_LAYOUTDIR_ANY if not set.
672 */
673int32_t AConfiguration_getLayoutDirection(AConfiguration* config);
674
675/**
676 * Set the configuration's layout direction.
677 */
678void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value);
Dan Albert494ed552016-09-23 15:57:45 -0700679#endif /* __ANDROID_API__ >= 17 */
Fabrice Di Meglio8855e6f2012-06-20 15:47:21 -0700680
681/**
Mathias Agopiane1c61d32012-03-23 14:19:36 -0700682 * Perform a diff between two configurations. Returns a bit mask of
683 * ACONFIGURATION_* constants, each bit set meaning that configuration element
684 * is different between them.
685 */
686int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
687
688/**
689 * Determine whether 'base' is a valid configuration for use within the
690 * environment 'requested'. Returns 0 if there are any values in 'base'
691 * that conflict with 'requested'. Returns 1 if it does not conflict.
692 */
693int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
694
695/**
696 * Determine whether the configuration in 'test' is better than the existing
697 * configuration in 'base'. If 'requested' is non-NULL, this decision is based
698 * on the overall configuration given there. If it is NULL, this decision is
699 * simply based on which configuration is more specific. Returns non-0 if
700 * 'test' is better than 'base'.
701 *
702 * This assumes you have already filtered the configurations with
703 * AConfiguration_match().
704 */
705int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
706 AConfiguration* requested);
707
708#ifdef __cplusplus
709};
710#endif
711
712#endif // ANDROID_CONFIGURATION_H
Johan Euphrosinebf6d5e02015-03-27 17:15:43 -0700713
714/** @} */