configuration.h 24 KB

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