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