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