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