1 /*
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 
17 /**
18  * @addtogroup Configuration
19  * @{
20  */
21 
22 /**
23  * @file configuration.h
24  */
25 
26 #ifndef ANDROID_CONFIGURATION_H
27 #define ANDROID_CONFIGURATION_H
28 
29 #include <android/asset_manager.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 struct AConfiguration;
36 /**
37  * {@link AConfiguration} is an opaque type used to get and set
38  * various subsystem configurations.
39  *
40  * A {@link AConfiguration} pointer can be obtained using:
41  * - AConfiguration_new()
42  * - AConfiguration_fromAssetManager()
43  */
44 typedef struct AConfiguration AConfiguration;
45 
46 
47 /**
48  * Define flags and constants for various subsystem configurations.
49  */
50 enum {
51     /** Orientation: not specified. */
52     ACONFIGURATION_ORIENTATION_ANY  = 0x0000,
53     /**
54      * Orientation: value corresponding to the
55      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">port</a>
56      * resource qualifier.
57      */
58     ACONFIGURATION_ORIENTATION_PORT = 0x0001,
59     /**
60      * Orientation: value corresponding to the
61      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">land</a>
62      * resource qualifier.
63      */
64     ACONFIGURATION_ORIENTATION_LAND = 0x0002,
65     /** @deprecated Not currently supported or used. */
66     ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
67 
68     /** Touchscreen: not specified. */
69     ACONFIGURATION_TOUCHSCREEN_ANY  = 0x0000,
70     /**
71      * Touchscreen: value corresponding to the
72      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">notouch</a>
73      * resource qualifier.
74      */
75     ACONFIGURATION_TOUCHSCREEN_NOTOUCH  = 0x0001,
76     /** @deprecated Not currently supported or used. */
77     ACONFIGURATION_TOUCHSCREEN_STYLUS  = 0x0002,
78     /**
79      * Touchscreen: value corresponding to the
80      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">finger</a>
81      * resource qualifier.
82      */
83     ACONFIGURATION_TOUCHSCREEN_FINGER  = 0x0003,
84 
85     /** Density: default density. */
86     ACONFIGURATION_DENSITY_DEFAULT = 0,
87     /**
88      * Density: value corresponding to the
89      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">ldpi</a>
90      * resource qualifier.
91      */
92     ACONFIGURATION_DENSITY_LOW = 120,
93     /**
94      * Density: value corresponding to the
95      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">mdpi</a>
96      * resource qualifier.
97      */
98     ACONFIGURATION_DENSITY_MEDIUM = 160,
99     /**
100      * Density: value corresponding to the
101      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">tvdpi</a>
102      * resource qualifier.
103      */
104     ACONFIGURATION_DENSITY_TV = 213,
105     /**
106      * Density: value corresponding to the
107      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">hdpi</a>
108      * resource qualifier.
109      */
110     ACONFIGURATION_DENSITY_HIGH = 240,
111     /**
112      * Density: value corresponding to the
113      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xhdpi</a>
114      * resource qualifier.
115      */
116     ACONFIGURATION_DENSITY_XHIGH = 320,
117     /**
118      * Density: value corresponding to the
119      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xxhdpi</a>
120      * resource qualifier.
121      */
122     ACONFIGURATION_DENSITY_XXHIGH = 480,
123     /**
124      * Density: value corresponding to the
125      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">xxxhdpi</a>
126      * resource qualifier.
127      */
128     ACONFIGURATION_DENSITY_XXXHIGH = 640,
129     /** Density: any density. */
130     ACONFIGURATION_DENSITY_ANY = 0xfffe,
131     /** Density: no density specified. */
132     ACONFIGURATION_DENSITY_NONE = 0xffff,
133 
134     /** Keyboard: not specified. */
135     ACONFIGURATION_KEYBOARD_ANY  = 0x0000,
136     /**
137      * Keyboard: value corresponding to the
138      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">nokeys</a>
139      * resource qualifier.
140      */
141     ACONFIGURATION_KEYBOARD_NOKEYS  = 0x0001,
142     /**
143      * Keyboard: value corresponding to the
144      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">qwerty</a>
145      * resource qualifier.
146      */
147     ACONFIGURATION_KEYBOARD_QWERTY  = 0x0002,
148     /**
149      * Keyboard: value corresponding to the
150      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">12key</a>
151      * resource qualifier.
152      */
153     ACONFIGURATION_KEYBOARD_12KEY  = 0x0003,
154 
155     /** Navigation: not specified. */
156     ACONFIGURATION_NAVIGATION_ANY  = 0x0000,
157     /**
158      * Navigation: value corresponding to the
159      * <a href="@@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">nonav</a>
160      * resource qualifier.
161      */
162     ACONFIGURATION_NAVIGATION_NONAV  = 0x0001,
163     /**
164      * Navigation: value corresponding to the
165      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">dpad</a>
166      * resource qualifier.
167      */
168     ACONFIGURATION_NAVIGATION_DPAD  = 0x0002,
169     /**
170      * Navigation: value corresponding to the
171      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">trackball</a>
172      * resource qualifier.
173      */
174     ACONFIGURATION_NAVIGATION_TRACKBALL  = 0x0003,
175     /**
176      * Navigation: value corresponding to the
177      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">wheel</a>
178      * resource qualifier.
179      */
180     ACONFIGURATION_NAVIGATION_WHEEL  = 0x0004,
181 
182     /** Keyboard availability: not specified. */
183     ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
184     /**
185      * Keyboard availability: value corresponding to the
186      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keysexposed</a>
187      * resource qualifier.
188      */
189     ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
190     /**
191      * Keyboard availability: value corresponding to the
192      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyshidden</a>
193      * resource qualifier.
194      */
195     ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
196     /**
197      * Keyboard availability: value corresponding to the
198      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyssoft</a>
199      * resource qualifier.
200      */
201     ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
202 
203     /** Navigation availability: not specified. */
204     ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
205     /**
206      * Navigation availability: value corresponding to the
207      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavAvailQualifier">navexposed</a>
208      * resource qualifier.
209      */
210     ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
211     /**
212      * Navigation availability: value corresponding to the
213      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavAvailQualifier">navhidden</a>
214      * resource qualifier.
215      */
216     ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
217 
218     /** Screen size: not specified. */
219     ACONFIGURATION_SCREENSIZE_ANY  = 0x00,
220     /**
221      * Screen size: value indicating the screen is at least
222      * approximately 320x426 dp units, corresponding to the
223      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">small</a>
224      * resource qualifier.
225      */
226     ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
227     /**
228      * Screen size: value indicating the screen is at least
229      * approximately 320x470 dp units, corresponding to the
230      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">normal</a>
231      * resource qualifier.
232      */
233     ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
234     /**
235      * Screen size: value indicating the screen is at least
236      * approximately 480x640 dp units, corresponding to the
237      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">large</a>
238      * resource qualifier.
239      */
240     ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
241     /**
242      * Screen size: value indicating the screen is at least
243      * approximately 720x960 dp units, corresponding to the
244      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">xlarge</a>
245      * resource qualifier.
246      */
247     ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
248 
249     /** Screen layout: not specified. */
250     ACONFIGURATION_SCREENLONG_ANY = 0x00,
251     /**
252      * Screen layout: value that corresponds to the
253      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">notlong</a>
254      * resource qualifier.
255      */
256     ACONFIGURATION_SCREENLONG_NO = 0x1,
257     /**
258      * Screen layout: value that corresponds to the
259      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenAspectQualifier">long</a>
260      * resource qualifier.
261      */
262     ACONFIGURATION_SCREENLONG_YES = 0x2,
263 
264     ACONFIGURATION_SCREENROUND_ANY = 0x00,
265     ACONFIGURATION_SCREENROUND_NO = 0x1,
266     ACONFIGURATION_SCREENROUND_YES = 0x2,
267 
268     /** UI mode: not specified. */
269     ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
270     /**
271      * UI mode: value that corresponds to
272      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">no
273      * UI mode type</a> resource qualifier specified.
274      */
275     ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
276     /**
277      * UI mode: value that corresponds to
278      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">desk</a> resource qualifier specified.
279      */
280     ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
281     /**
282      * UI mode: value that corresponds to
283      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">car</a> resource qualifier specified.
284      */
285     ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
286     /**
287      * UI mode: value that corresponds to
288      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">television</a> resource qualifier specified.
289      */
290     ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
291     /**
292      * UI mode: value that corresponds to
293      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">appliance</a> resource qualifier specified.
294      */
295     ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
296     /**
297      * UI mode: value that corresponds to
298      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">watch</a> resource qualifier specified.
299      */
300     ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06,
301 
302     /** UI night mode: not specified.*/
303     ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
304     /**
305      * UI night mode: value that corresponds to
306      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NightQualifier">notnight</a> resource qualifier specified.
307      */
308     ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
309     /**
310      * UI night mode: value that corresponds to
311      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NightQualifier">night</a> resource qualifier specified.
312      */
313     ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
314 
315     /** Screen width DPI: not specified. */
316     ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
317 
318     /** Screen height DPI: not specified. */
319     ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
320 
321     /** Smallest screen width DPI: not specified.*/
322     ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
323 
324     /** Layout direction: not specified. */
325     ACONFIGURATION_LAYOUTDIR_ANY  = 0x00,
326     /**
327      * Layout direction: value that corresponds to
328      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldltr</a> resource qualifier specified.
329      */
330     ACONFIGURATION_LAYOUTDIR_LTR  = 0x01,
331     /**
332      * Layout direction: value that corresponds to
333      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">ldrtl</a> resource qualifier specified.
334      */
335     ACONFIGURATION_LAYOUTDIR_RTL  = 0x02,
336 
337     /**
338      * Bit mask for
339      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mcc</a>
340      * configuration.
341      */
342     ACONFIGURATION_MCC = 0x0001,
343     /**
344      * Bit mask for
345      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#MccQualifier">mnc</a>
346      * configuration.
347      */
348     ACONFIGURATION_MNC = 0x0002,
349     /**
350      * Bit mask for
351      * <a href="{@docRoot}guide/topics/resources/providing-resources.html#LocaleQualifier">locale</a>
352      * configuration.
353      */
354     ACONFIGURATION_LOCALE = 0x0004,
355     /**
356      * Bit mask for
357      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#TouchscreenQualifier">touchscreen</a>
358      * configuration.
359      */
360     ACONFIGURATION_TOUCHSCREEN = 0x0008,
361     /**
362      * Bit mask for
363      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ImeQualifier">keyboard</a>
364      * configuration.
365      */
366     ACONFIGURATION_KEYBOARD = 0x0010,
367     /**
368      * Bit mask for
369      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#KeyboardAvailQualifier">keyboardHidden</a>
370      * configuration.
371      */
372     ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
373     /**
374      * Bit mask for
375      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#NavigationQualifier">navigation</a>
376      * configuration.
377      */
378     ACONFIGURATION_NAVIGATION = 0x0040,
379     /**
380      * Bit mask for
381      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#OrientationQualifier">orientation</a>
382      * configuration.
383      */
384     ACONFIGURATION_ORIENTATION = 0x0080,
385     /**
386      * Bit mask for
387      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#DensityQualifier">density</a>
388      * configuration.
389      */
390     ACONFIGURATION_DENSITY = 0x0100,
391     /**
392      * Bit mask for
393      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#ScreenSizeQualifier">screen size</a>
394      * configuration.
395      */
396     ACONFIGURATION_SCREEN_SIZE = 0x0200,
397     /**
398      * Bit mask for
399      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#VersionQualifier">platform version</a>
400      * configuration.
401      */
402     ACONFIGURATION_VERSION = 0x0400,
403     /**
404      * Bit mask for screen layout configuration.
405      */
406     ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
407     /**
408      * Bit mask for
409      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#UiModeQualifier">ui mode</a>
410      * configuration.
411      */
412     ACONFIGURATION_UI_MODE = 0x1000,
413     /**
414      * Bit mask for
415      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">smallest screen width</a>
416      * configuration.
417      */
418     ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
419     /**
420      * Bit mask for
421      * <a href="@dacRoot/guide/topics/resources/providing-resources.html#LayoutDirectionQualifier">layout direction</a>
422      * configuration.
423      */
424     ACONFIGURATION_LAYOUTDIR = 0x4000,
425     ACONFIGURATION_SCREEN_ROUND = 0x8000,
426     /**
427      * Constant used to to represent MNC (Mobile Network Code) zero.
428      * 0 cannot be used, since it is used to represent an undefined MNC.
429      */
430     ACONFIGURATION_MNC_ZERO = 0xffff,
431 };
432 
433 /**
434  * Create a new AConfiguration, initialized with no values set.
435  */
436 AConfiguration* AConfiguration_new();
437 
438 /**
439  * Free an AConfiguration that was previously created with
440  * AConfiguration_new().
441  */
442 void AConfiguration_delete(AConfiguration* config);
443 
444 /**
445  * Create and return a new AConfiguration based on the current configuration in
446  * use in the given {@link AAssetManager}.
447  */
448 void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
449 
450 /**
451  * Copy the contents of 'src' to 'dest'.
452  */
453 void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
454 
455 /**
456  * Return the current MCC set in the configuration.  0 if not set.
457  */
458 int32_t AConfiguration_getMcc(AConfiguration* config);
459 
460 /**
461  * Set the current MCC in the configuration.  0 to clear.
462  */
463 void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
464 
465 /**
466  * Return the current MNC set in the configuration.  0 if not set.
467  */
468 int32_t AConfiguration_getMnc(AConfiguration* config);
469 
470 /**
471  * Set the current MNC in the configuration.  0 to clear.
472  */
473 void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
474 
475 /**
476  * Return the current language code set in the configuration.  The output will
477  * be filled with an array of two characters.  They are not 0-terminated.  If
478  * a language is not set, they will be 0.
479  */
480 void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
481 
482 /**
483  * Set the current language code in the configuration, from the first two
484  * characters in the string.
485  */
486 void AConfiguration_setLanguage(AConfiguration* config, const char* language);
487 
488 /**
489  * Return the current country code set in the configuration.  The output will
490  * be filled with an array of two characters.  They are not 0-terminated.  If
491  * a country is not set, they will be 0.
492  */
493 void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
494 
495 /**
496  * Set the current country code in the configuration, from the first two
497  * characters in the string.
498  */
499 void AConfiguration_setCountry(AConfiguration* config, const char* country);
500 
501 /**
502  * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
503  */
504 int32_t AConfiguration_getOrientation(AConfiguration* config);
505 
506 /**
507  * Set the current orientation in the configuration.
508  */
509 void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
510 
511 /**
512  * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
513  */
514 int32_t AConfiguration_getTouchscreen(AConfiguration* config);
515 
516 /**
517  * Set the current touchscreen in the configuration.
518  */
519 void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
520 
521 /**
522  * Return the current ACONFIGURATION_DENSITY_* set in the configuration.
523  */
524 int32_t AConfiguration_getDensity(AConfiguration* config);
525 
526 /**
527  * Set the current density in the configuration.
528  */
529 void AConfiguration_setDensity(AConfiguration* config, int32_t density);
530 
531 /**
532  * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
533  */
534 int32_t AConfiguration_getKeyboard(AConfiguration* config);
535 
536 /**
537  * Set the current keyboard in the configuration.
538  */
539 void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
540 
541 /**
542  * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
543  */
544 int32_t AConfiguration_getNavigation(AConfiguration* config);
545 
546 /**
547  * Set the current navigation in the configuration.
548  */
549 void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
550 
551 /**
552  * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
553  */
554 int32_t AConfiguration_getKeysHidden(AConfiguration* config);
555 
556 /**
557  * Set the current keys hidden in the configuration.
558  */
559 void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
560 
561 /**
562  * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
563  */
564 int32_t AConfiguration_getNavHidden(AConfiguration* config);
565 
566 /**
567  * Set the current nav hidden in the configuration.
568  */
569 void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
570 
571 /**
572  * Return the current SDK (API) version set in the configuration.
573  */
574 int32_t AConfiguration_getSdkVersion(AConfiguration* config);
575 
576 /**
577  * Set the current SDK version in the configuration.
578  */
579 void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
580 
581 /**
582  * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
583  */
584 int32_t AConfiguration_getScreenSize(AConfiguration* config);
585 
586 /**
587  * Set the current screen size in the configuration.
588  */
589 void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
590 
591 /**
592  * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
593  */
594 int32_t AConfiguration_getScreenLong(AConfiguration* config);
595 
596 /**
597  * Set the current screen long in the configuration.
598  */
599 void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
600 
601 /**
602  * Return the current ACONFIGURATION_SCREENROUND_* set in the configuration.
603  */
604 int32_t AConfiguration_getScreenRound(AConfiguration* config);
605 
606 /**
607  * Set the current screen round in the configuration.
608  */
609 void AConfiguration_setScreenRound(AConfiguration* config, int32_t screenRound);
610 
611 /**
612  * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
613  */
614 int32_t AConfiguration_getUiModeType(AConfiguration* config);
615 
616 /**
617  * Set the current UI mode type in the configuration.
618  */
619 void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
620 
621 /**
622  * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
623  */
624 int32_t AConfiguration_getUiModeNight(AConfiguration* config);
625 
626 /**
627  * Set the current UI mode night in the configuration.
628  */
629 void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
630 
631 /**
632  * Return the current configuration screen width in dp units, or
633  * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
634  */
635 int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
636 
637 /**
638  * Set the configuration's current screen width in dp units.
639  */
640 void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
641 
642 /**
643  * Return the current configuration screen height in dp units, or
644  * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
645  */
646 int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
647 
648 /**
649  * Set the configuration's current screen width in dp units.
650  */
651 void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
652 
653 /**
654  * Return the configuration's smallest screen width in dp units, or
655  * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
656  */
657 int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
658 
659 /**
660  * Set the configuration's smallest screen width in dp units.
661  */
662 void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
663 
664 /**
665  * Return the configuration's layout direction, or
666  * ACONFIGURATION_LAYOUTDIR_ANY if not set.
667  */
668 int32_t AConfiguration_getLayoutDirection(AConfiguration* config);
669 
670 /**
671  * Set the configuration's layout direction.
672  */
673 void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value);
674 
675 /**
676  * Perform a diff between two configurations.  Returns a bit mask of
677  * ACONFIGURATION_* constants, each bit set meaning that configuration element
678  * is different between them.
679  */
680 int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
681 
682 /**
683  * Determine whether 'base' is a valid configuration for use within the
684  * environment 'requested'.  Returns 0 if there are any values in 'base'
685  * that conflict with 'requested'.  Returns 1 if it does not conflict.
686  */
687 int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
688 
689 /**
690  * Determine whether the configuration in 'test' is better than the existing
691  * configuration in 'base'.  If 'requested' is non-NULL, this decision is based
692  * on the overall configuration given there.  If it is NULL, this decision is
693  * simply based on which configuration is more specific.  Returns non-0 if
694  * 'test' is better than 'base'.
695  *
696  * This assumes you have already filtered the configurations with
697  * AConfiguration_match().
698  */
699 int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
700         AConfiguration* requested);
701 
702 #ifdef __cplusplus
703 };
704 #endif
705 
706 #endif // ANDROID_CONFIGURATION_H
707 
708 /** @} */
709