Configuration

摘要

枚举

匿名枚举 24{
  ACONFIGURATION_ORIENTATION_ANY = 0x0000,
  ACONFIGURATION_ORIENTATION_PORT = 0x0001,
  ACONFIGURATION_ORIENTATION_LAND = 0x0002,
  ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
  ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000,
  ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001,
  ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002,
  ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003,
  ACONFIGURATION_DENSITY_DEFAULT = 0,
  ACONFIGURATION_DENSITY_LOW = 120,
  ACONFIGURATION_DENSITY_MEDIUM = 160,
  ACONFIGURATION_DENSITY_TV = 213,
  ACONFIGURATION_DENSITY_HIGH = 240,
  ACONFIGURATION_DENSITY_XHIGH = 320,
  ACONFIGURATION_DENSITY_XXHIGH = 480,
  ACONFIGURATION_DENSITY_XXXHIGH = 640,
  ACONFIGURATION_DENSITY_ANY = 0xfffe,
  ACONFIGURATION_DENSITY_NONE = 0xffff,
  ACONFIGURATION_KEYBOARD_ANY = 0x0000,
  ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001,
  ACONFIGURATION_KEYBOARD_QWERTY = 0x0002,
  ACONFIGURATION_KEYBOARD_12KEY = 0x0003,
  ACONFIGURATION_NAVIGATION_ANY = 0x0000,
  ACONFIGURATION_NAVIGATION_NONAV = 0x0001,
  ACONFIGURATION_NAVIGATION_DPAD = 0x0002,
  ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003,
  ACONFIGURATION_NAVIGATION_WHEEL = 0x0004,
  ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
  ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
  ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
  ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
  ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
  ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
  ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
  ACONFIGURATION_SCREENSIZE_ANY = 0x00,
  ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
  ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
  ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
  ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
  ACONFIGURATION_SCREENLONG_ANY = 0x00,
  ACONFIGURATION_SCREENLONG_NO = 0x1,
  ACONFIGURATION_SCREENLONG_YES = 0x2,
  ACONFIGURATION_SCREENROUND_ANY = 0x00,
  ACONFIGURATION_SCREENROUND_NO = 0x1,
  ACONFIGURATION_SCREENROUND_YES = 0x2,
  ACONFIGURATION_WIDE_COLOR_GAMUT_ANY = 0x00,
  ACONFIGURATION_WIDE_COLOR_GAMUT_NO = 0x1,
  ACONFIGURATION_WIDE_COLOR_GAMUT_YES = 0x2,
  ACONFIGURATION_HDR_ANY = 0x00,
  ACONFIGURATION_HDR_NO = 0x1,
  ACONFIGURATION_HDR_YES = 0x2,
  ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
  ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
  ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
  ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
  ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
  ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
  ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06,
  ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET = 0x07,
  ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
  ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
  ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
  ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
  ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
  ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
  ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
  ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
  ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
  ACONFIGURATION_MCC = 0x0001,
  ACONFIGURATION_MNC = 0x0002,
  ACONFIGURATION_LOCALE = 0x0004,
  ACONFIGURATION_TOUCHSCREEN = 0x0008,
  ACONFIGURATION_KEYBOARD = 0x0010,
  ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
  ACONFIGURATION_NAVIGATION = 0x0040,
  ACONFIGURATION_ORIENTATION = 0x0080,
  ACONFIGURATION_DENSITY = 0x0100,
  ACONFIGURATION_SCREEN_SIZE = 0x0200,
  ACONFIGURATION_VERSION = 0x0400,
  ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
  ACONFIGURATION_UI_MODE = 0x1000,
  ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
  ACONFIGURATION_LAYOUTDIR = 0x4000,
  ACONFIGURATION_SCREEN_ROUND = 0x8000,
  ACONFIGURATION_COLOR_MODE = 0x10000,
  ACONFIGURATION_GRAMMATICAL_GENDER = 0x20000,
  ACONFIGURATION_MNC_ZERO = 0xffff,
  ACONFIGURATION_GRAMMATICAL_GENDER_ANY = 0,
  ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER = 1,
  ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE = 2,
  ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE = 3
}
enum
定义各种子系统配置的标志和常量。

Typedefs

AConfiguration typedef
AConfiguration 是一个不透明类型,用于获取和设置各种子系统配置。

函数

AConfiguration_copy(AConfiguration *dest, AConfiguration *src)
void
将 'src' 的内容复制到 'dest'。
AConfiguration_delete(AConfiguration *config)
void
释放之前使用 AConfiguration_new() 创建的 AConfiguration。
AConfiguration_diff(AConfiguration *config1, AConfiguration *config2)
int32_t
对两个配置执行差异比较。
AConfiguration_fromAssetManager(AConfiguration *out, AAssetManager *am)
void
根据给定 AAssetManager 中正在使用的当前配置创建并返回新的 AConfiguration。
AConfiguration_getCountry(AConfiguration *config, char *outCountry)
void
返回配置中设置的当前国家/地区代码。
AConfiguration_getDensity(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_DENSITY_*。
AConfiguration_getGrammaticalGender(AConfiguration *config)
int32_t
返回配置的语法性别,如果未设置则返回 ACONFIGURATION_GRAMMATICAL_GENDER_ANY。
AConfiguration_getKeyboard(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_KEYBOARD_*。
AConfiguration_getKeysHidden(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_KEYSHIDDEN_*。
AConfiguration_getLanguage(AConfiguration *config, char *outLanguage)
void
返回配置中设置的当前语言代码。
AConfiguration_getLayoutDirection(AConfiguration *config)
int32_t
返回配置的布局方向,如果未设置则返回 ACONFIGURATION_LAYOUTDIR_ANY。
AConfiguration_getMcc(AConfiguration *config)
int32_t
返回配置中设置的当前 MCC。
AConfiguration_getMnc(AConfiguration *config)
int32_t
返回配置中设置的当前 MNC。
AConfiguration_getNavHidden(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_NAVHIDDEN_*。
AConfiguration_getNavigation(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_NAVIGATION_*。
AConfiguration_getOrientation(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_ORIENTATION_*。
AConfiguration_getScreenHeightDp(AConfiguration *config)
int32_t
返回配置中当前的屏幕高度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY。
AConfiguration_getScreenLong(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENLONG_*。
AConfiguration_getScreenRound(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENROUND_*。
AConfiguration_getScreenSize(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_SCREENSIZE_*。
AConfiguration_getScreenWidthDp(AConfiguration *config)
int32_t
返回配置中当前的屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_WIDTH_DP_ANY。
AConfiguration_getSdkVersion(AConfiguration *config)
int32_t
返回配置中设置的当前 SDK (API) 版本。
AConfiguration_getSmallestScreenWidthDp(AConfiguration *config)
int32_t
返回配置的最小屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY。
AConfiguration_getTouchscreen(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_TOUCHSCREEN_*。
AConfiguration_getUiModeNight(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_UI_MODE_NIGHT_*。
AConfiguration_getUiModeType(AConfiguration *config)
int32_t
返回配置中设置的当前 ACONFIGURATION_UI_MODE_TYPE_*。
AConfiguration_isBetterThan(AConfiguration *base, AConfiguration *test, AConfiguration *requested)
int32_t
确定 'test' 中的配置是否优于 'base' 中现有配置。
AConfiguration_match(AConfiguration *base, AConfiguration *requested)
int32_t
确定 'base' 是否是 'requested' 环境中使用的有效配置。
AConfiguration_new()
创建新的 AConfiguration,初始化时未设置任何值。
AConfiguration_setCountry(AConfiguration *config, const char *country)
void
根据字符串的前两个字符,设置配置中的当前国家/地区代码。
AConfiguration_setDensity(AConfiguration *config, int32_t density)
void
设置配置中的当前密度。
AConfiguration_setGrammaticalGender(AConfiguration *config, int32_t value)
void
将配置的语法性别设置为 ACONFIGURATION_GRAMMATICAL_GENDER_* 常量之一。
AConfiguration_setKeyboard(AConfiguration *config, int32_t keyboard)
void
设置配置中的当前键盘。
AConfiguration_setKeysHidden(AConfiguration *config, int32_t keysHidden)
void
设置配置中的当前隐藏键。
AConfiguration_setLanguage(AConfiguration *config, const char *language)
void
根据字符串的前两个字符,设置配置中的当前语言代码。
AConfiguration_setLayoutDirection(AConfiguration *config, int32_t value)
void
设置配置的布局方向。
AConfiguration_setMcc(AConfiguration *config, int32_t mcc)
void
设置配置中的当前 MCC。
AConfiguration_setMnc(AConfiguration *config, int32_t mnc)
void
设置配置中的当前 MNC。
AConfiguration_setNavHidden(AConfiguration *config, int32_t navHidden)
void
设置配置中的当前导航隐藏状态。
AConfiguration_setNavigation(AConfiguration *config, int32_t navigation)
void
设置配置中的当前导航类型。
AConfiguration_setOrientation(AConfiguration *config, int32_t orientation)
void
设置配置中的当前方向。
AConfiguration_setScreenHeightDp(AConfiguration *config, int32_t value)
void
设置配置中当前的屏幕高度(以 dp 为单位)。
AConfiguration_setScreenLong(AConfiguration *config, int32_t screenLong)
void
设置配置中的当前屏幕长宽比。
AConfiguration_setScreenRound(AConfiguration *config, int32_t screenRound)
void
设置配置中的当前圆角屏幕状态。
AConfiguration_setScreenSize(AConfiguration *config, int32_t screenSize)
void
设置配置中的当前屏幕尺寸。
AConfiguration_setScreenWidthDp(AConfiguration *config, int32_t value)
void
设置配置中当前的屏幕高度(以 dp 为单位)。
AConfiguration_setSdkVersion(AConfiguration *config, int32_t sdkVersion)
void
设置配置中的当前 SDK 版本。
AConfiguration_setSmallestScreenWidthDp(AConfiguration *config, int32_t value)
void
设置配置的最小屏幕宽度(以 dp 为单位)。
AConfiguration_setTouchscreen(AConfiguration *config, int32_t touchscreen)
void
设置配置中的当前触摸屏类型。
AConfiguration_setUiModeNight(AConfiguration *config, int32_t uiModeNight)
void
设置配置中的当前 UI 夜间模式。
AConfiguration_setUiModeType(AConfiguration *config, int32_t uiModeType)
void
设置配置中的当前 UI 模式类型。

枚举

匿名枚举 24

android/configuration.h 中声明
 Anonymous Enum 24

定义各种子系统配置的标志和常量。

属性
ACONFIGURATION_COLOR_MODE

用于宽色域HDR配置的位掩码。

ACONFIGURATION_DENSITY

用于密度配置的位掩码。

ACONFIGURATION_DENSITY_ANY

密度:任意密度。

ACONFIGURATION_DENSITY_DEFAULT

密度:默认密度。

ACONFIGURATION_DENSITY_HIGH

密度:对应于 hdpi 资源限定符的值。

ACONFIGURATION_DENSITY_LOW

密度:对应于 ldpi 资源限定符的值。

ACONFIGURATION_DENSITY_MEDIUM

密度:对应于 mdpi 资源限定符的值。

ACONFIGURATION_DENSITY_NONE

密度:未指定密度。

ACONFIGURATION_DENSITY_TV

密度:对应于 tvdpi 资源限定符的值。

ACONFIGURATION_DENSITY_XHIGH

密度:对应于 xhdpi 资源限定符的值。

ACONFIGURATION_DENSITY_XXHIGH

密度:对应于 xxhdpi 资源限定符的值。

ACONFIGURATION_DENSITY_XXXHIGH

密度:对应于 xxxhdpi 资源限定符的值。

ACONFIGURATION_GRAMMATICAL_GENDER

用于语法性别配置的位掩码。

ACONFIGURATION_GRAMMATICAL_GENDER_ANY

语法性别:未指定。

ACONFIGURATION_GRAMMATICAL_GENDER_FEMININE

语法性别:阴性。

ACONFIGURATION_GRAMMATICAL_GENDER_MASCULINE

语法性别:阳性。

ACONFIGURATION_GRAMMATICAL_GENDER_NEUTER

语法性别:中性。

ACONFIGURATION_HDR_ANY

HDR:未指定。

ACONFIGURATION_HDR_NO

HDR:对应于指定的 lowdr 资源限定符的值。

ACONFIGURATION_HDR_YES

HDR:对应于指定 highdr 资源限定符的值。

ACONFIGURATION_KEYBOARD

用于键盘配置的位掩码。

ACONFIGURATION_KEYBOARD_12KEY

键盘:对应于 12key 资源限定符的值。

ACONFIGURATION_KEYBOARD_ANY

键盘:未指定。

ACONFIGURATION_KEYBOARD_HIDDEN

用于 keyboardHidden 配置的位掩码。

ACONFIGURATION_KEYBOARD_NOKEYS

键盘:对应于 nokeys 资源限定符的值。

ACONFIGURATION_KEYBOARD_QWERTY

键盘:对应于 qwerty 资源限定符的值。

ACONFIGURATION_KEYSHIDDEN_ANY

键盘可用性:未指定。

ACONFIGURATION_KEYSHIDDEN_NO

键盘可用性:对应于 keysexposed 资源限定符的值。

ACONFIGURATION_KEYSHIDDEN_SOFT

键盘可用性:对应于 keyssoft 资源限定符的值。

ACONFIGURATION_KEYSHIDDEN_YES

键盘可用性:对应于 keyshidden 资源限定符的值。

ACONFIGURATION_LAYOUTDIR

用于布局方向配置的位掩码。

ACONFIGURATION_LAYOUTDIR_ANY

布局方向:未指定。

ACONFIGURATION_LAYOUTDIR_LTR

布局方向:对应于指定的 ldltr 资源限定符的值。

ACONFIGURATION_LAYOUTDIR_RTL

布局方向:对应于指定的 ldrtl 资源限定符的值。

ACONFIGURATION_LOCALE

用于区域设置配置的位掩码。

ACONFIGURATION_MCC

用于 mcc 配置的位掩码。

ACONFIGURATION_MNC

用于 mnc 配置的位掩码。

ACONFIGURATION_MNC_ZERO

用于表示 MNC (Mobile Network Code) 零的常量。

不能使用 0,因为它用于表示未定义的 MNC。

ACONFIGURATION_NAVHIDDEN_ANY

导航可用性:未指定。

ACONFIGURATION_NAVHIDDEN_NO

导航可用性:对应于 navexposed 资源限定符的值。

ACONFIGURATION_NAVHIDDEN_YES

导航可用性:对应于 navhidden 资源限定符的值。

ACONFIGURATION_NAVIGATION

用于导航配置的位掩码。

ACONFIGURATION_NAVIGATION_ANY

导航:未指定。

ACONFIGURATION_NAVIGATION_DPAD

导航:对应于 dpad 资源限定符的值。

ACONFIGURATION_NAVIGATION_NONAV

导航:对应于 nonav 资源限定符的值。

ACONFIGURATION_NAVIGATION_TRACKBALL

导航:对应于 trackball 资源限定符的值。

ACONFIGURATION_NAVIGATION_WHEEL

导航:对应于 wheel 资源限定符的值。

ACONFIGURATION_ORIENTATION

用于方向配置的位掩码。

ACONFIGURATION_ORIENTATION_ANY

方向:未指定。

ACONFIGURATION_ORIENTATION_LAND

方向:对应于 land 资源限定符的值。

ACONFIGURATION_ORIENTATION_PORT

方向:对应于 port 资源限定符的值。

ACONFIGURATION_ORIENTATION_SQUARE

已弃用。 当前不受支持或未使用。

ACONFIGURATION_SCREENLONG_ANY

屏幕布局:未指定。

ACONFIGURATION_SCREENLONG_NO

屏幕布局:对应于 notlong 资源限定符的值。

ACONFIGURATION_SCREENLONG_YES

屏幕布局:对应于 long 资源限定符的值。

ACONFIGURATION_SCREENROUND_ANY
ACONFIGURATION_SCREENROUND_NO
ACONFIGURATION_SCREENROUND_YES
ACONFIGURATION_SCREENSIZE_ANY

屏幕尺寸:未指定。

ACONFIGURATION_SCREENSIZE_LARGE

屏幕尺寸:表示屏幕至少约为 480x640 dp 单位的值,对应于 large 资源限定符。

ACONFIGURATION_SCREENSIZE_NORMAL

屏幕尺寸:表示屏幕至少约为 320x470 dp 单位的值,对应于 normal 资源限定符。

ACONFIGURATION_SCREENSIZE_SMALL

屏幕尺寸:表示屏幕至少约为 320x426 dp 单位的值,对应于 small 资源限定符。

ACONFIGURATION_SCREENSIZE_XLARGE

屏幕尺寸:表示屏幕至少约为 720x960 dp 单位的值,对应于 xlarge 资源限定符。

ACONFIGURATION_SCREEN_HEIGHT_DP_ANY

屏幕高度 dp:未指定。

ACONFIGURATION_SCREEN_LAYOUT

用于屏幕布局配置的位掩码。

ACONFIGURATION_SCREEN_ROUND
ACONFIGURATION_SCREEN_SIZE

用于屏幕尺寸配置的位掩码。

ACONFIGURATION_SCREEN_WIDTH_DP_ANY

屏幕宽度 dp:未指定。

ACONFIGURATION_SMALLEST_SCREEN_SIZE

用于最小屏幕宽度配置的位掩码。

ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY

最小屏幕宽度 dp:未指定。

ACONFIGURATION_TOUCHSCREEN

用于触摸屏配置的位掩码。

ACONFIGURATION_TOUCHSCREEN_ANY

触摸屏:未指定。

ACONFIGURATION_TOUCHSCREEN_FINGER

触摸屏:对应于 finger 资源限定符的值。

ACONFIGURATION_TOUCHSCREEN_NOTOUCH

触摸屏:对应于 notouch 资源限定符的值。

ACONFIGURATION_TOUCHSCREEN_STYLUS

已弃用。 当前不受支持或未使用。

ACONFIGURATION_UI_MODE

用于UI 模式配置的位掩码。

ACONFIGURATION_UI_MODE_NIGHT_ANY

UI 夜间模式:未指定。

ACONFIGURATION_UI_MODE_NIGHT_NO

UI 夜间模式:对应于指定的 notnight 资源限定符的值。

ACONFIGURATION_UI_MODE_NIGHT_YES

UI 夜间模式:对应于指定的 night 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_ANY

UI 模式:未指定。

ACONFIGURATION_UI_MODE_TYPE_APPLIANCE

UI 模式:对应于指定的 appliance 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_CAR

UI 模式:对应于指定的 car 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_DESK

UI 模式:对应于指定的 desk 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_NORMAL

UI 模式:对应于未指定 UI 模式类型资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_TELEVISION

UI 模式:对应于指定的 television 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET

UI 模式:对应于指定的 vr 资源限定符的值。

ACONFIGURATION_UI_MODE_TYPE_WATCH

UI 模式:对应于指定的 watch 资源限定符的值。

ACONFIGURATION_VERSION

用于平台版本配置的位掩码。

ACONFIGURATION_WIDE_COLOR_GAMUT_ANY

宽色域:未指定。

ACONFIGURATION_WIDE_COLOR_GAMUT_NO

宽色域:对应于指定的 no nowidecg 资源限定符的值。

ACONFIGURATION_WIDE_COLOR_GAMUT_YES

宽色域:对应于指定的 widecg 资源限定符的值。

Typedefs

AConfiguration

android/configuration.h 中声明
struct AConfiguration AConfiguration

AConfiguration 是一个不透明类型,用于获取和设置各种子系统配置。

可以使用以下函数获取 AConfiguration 指针:

函数

AConfiguration_copy

android/configuration.h 中声明
void AConfiguration_copy(
  AConfiguration *dest,
  AConfiguration *src
)

将 'src' 的内容复制到 'dest'。

AConfiguration_delete

android/configuration.h 中声明
void AConfiguration_delete(
  AConfiguration *config
)

释放之前使用 AConfiguration_new() 创建的 AConfiguration。

AConfiguration_diff

android/configuration.h 中声明
int32_t AConfiguration_diff(
  AConfiguration *config1,
  AConfiguration *config2
)

对两个配置执行差异比较。

返回 ACONFIGURATION_* 常量的位掩码,设置的每个位表示相应的配置元素在两个配置之间不同。

AConfiguration_fromAssetManager

android/configuration.h 中声明
void AConfiguration_fromAssetManager(
  AConfiguration *out,
  AAssetManager *am
)

根据给定 AAssetManager 中正在使用的当前配置创建并返回新的 AConfiguration。

AConfiguration_getCountry

android/configuration.h 中声明
void AConfiguration_getCountry(
  AConfiguration *config,
  char *outCountry
)

返回配置中设置的当前国家/地区代码。

输出将填充一个包含两个字符的数组。它们不是以 null 结尾的。如果未设置国家/地区,它们将为 0。

AConfiguration_getDensity

android/configuration.h 中声明
int32_t AConfiguration_getDensity(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_DENSITY_*。

AConfiguration_getGrammaticalGender

android/configuration.h 中声明
int32_t AConfiguration_getGrammaticalGender(
  AConfiguration *config
)

返回配置的语法性别,如果未设置则返回 ACONFIGURATION_GRAMMATICAL_GENDER_ANY。

自 API 级别 34 起可用。

AConfiguration_getKeyboard

android/configuration.h 中声明
int32_t AConfiguration_getKeyboard(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_KEYBOARD_*。

AConfiguration_getKeysHidden

android/configuration.h 中声明
int32_t AConfiguration_getKeysHidden(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_KEYSHIDDEN_*。

AConfiguration_getLanguage

android/configuration.h 中声明
void AConfiguration_getLanguage(
  AConfiguration *config,
  char *outLanguage
)

返回配置中设置的当前语言代码。

输出将填充一个包含两个字符的数组。它们不是以 null 结尾的。如果未设置语言,它们将为 0。

AConfiguration_getLayoutDirection

android/configuration.h 中声明
int32_t AConfiguration_getLayoutDirection(
  AConfiguration *config
)

返回配置的布局方向,如果未设置则返回 ACONFIGURATION_LAYOUTDIR_ANY。

自 API 级别 17 起可用。

AConfiguration_getMcc

android/configuration.h 中声明
int32_t AConfiguration_getMcc(
  AConfiguration *config
)

返回配置中设置的当前 MCC。

如果未设置,则为 0。

AConfiguration_getMnc

android/configuration.h 中声明
int32_t AConfiguration_getMnc(
  AConfiguration *config
)

返回配置中设置的当前 MNC。

如果未设置,则为 0。

AConfiguration_getNavHidden

android/configuration.h 中声明
int32_t AConfiguration_getNavHidden(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_NAVHIDDEN_*。

AConfiguration_getNavigation

android/configuration.h 中声明
int32_t AConfiguration_getNavigation(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_NAVIGATION_*。

AConfiguration_getOrientation

android/configuration.h 中声明
int32_t AConfiguration_getOrientation(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_ORIENTATION_*。

AConfiguration_getScreenHeightDp

android/configuration.h 中声明
int32_t AConfiguration_getScreenHeightDp(
  AConfiguration *config
)

返回配置中当前的屏幕高度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_HEIGHT_DP_ANY。

AConfiguration_getScreenLong

android/configuration.h 中声明
int32_t AConfiguration_getScreenLong(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_SCREENLONG_*。

AConfiguration_getScreenRound

android/configuration.h 中声明
int32_t AConfiguration_getScreenRound(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_SCREENROUND_*。

自 API 级别 30 起可用。

AConfiguration_getScreenSize

android/configuration.h 中声明
int32_t AConfiguration_getScreenSize(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_SCREENSIZE_*。

AConfiguration_getScreenWidthDp

android/configuration.h 中声明
int32_t AConfiguration_getScreenWidthDp(
  AConfiguration *config
)

返回配置中当前的屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SCREEN_WIDTH_DP_ANY。

AConfiguration_getSdkVersion

android/configuration.h 中声明
int32_t AConfiguration_getSdkVersion(
  AConfiguration *config
)

返回配置中设置的当前 SDK (API) 版本。

AConfiguration_getSmallestScreenWidthDp

android/configuration.h 中声明
int32_t AConfiguration_getSmallestScreenWidthDp(
  AConfiguration *config
)

返回配置的最小屏幕宽度(以 dp 为单位),如果未设置则返回 ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY。

AConfiguration_getTouchscreen

android/configuration.h 中声明
int32_t AConfiguration_getTouchscreen(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_TOUCHSCREEN_*。

AConfiguration_getUiModeNight

android/configuration.h 中声明
int32_t AConfiguration_getUiModeNight(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_UI_MODE_NIGHT_*。

AConfiguration_getUiModeType

android/configuration.h 中声明
int32_t AConfiguration_getUiModeType(
  AConfiguration *config
)

返回配置中设置的当前 ACONFIGURATION_UI_MODE_TYPE_*。

AConfiguration_isBetterThan

android/configuration.h 中声明
int32_t AConfiguration_isBetterThan(
  AConfiguration *base,
  AConfiguration *test,
  AConfiguration *requested
)

确定 'test' 中的配置是否优于 'base' 中现有配置。

如果 'requested' 非 NULL,则此决策基于其中给定的整体配置。如果为 NULL,则此决策仅基于哪个配置更具体。如果 'test' 优于 'base',则返回非 0。

这假设您已经使用 AConfiguration_match() 过滤了配置。

AConfiguration_match

android/configuration.h 中声明
int32_t AConfiguration_match(
  AConfiguration *base,
  AConfiguration *requested
)

确定 'base' 是否是 'requested' 环境中使用的有效配置。

如果 'base' 中有任何值与 'requested' 冲突,则返回 0。如果不冲突,则返回 1。

AConfiguration_new

android/configuration.h 中声明
AConfiguration * AConfiguration_new()

创建新的 AConfiguration,初始化时未设置任何值。

AConfiguration_setCountry

android/configuration.h 中声明
void AConfiguration_setCountry(
  AConfiguration *config,
  const char *country
)

根据字符串的前两个字符,设置配置中的当前国家/地区代码。

AConfiguration_setDensity

android/configuration.h 中声明
void AConfiguration_setDensity(
  AConfiguration *config,
  int32_t density
)

设置配置中的当前密度。

AConfiguration_setGrammaticalGender

android/configuration.h 中声明
void AConfiguration_setGrammaticalGender(
  AConfiguration *config,
  int32_t value
)

将配置的语法性别设置为 ACONFIGURATION_GRAMMATICAL_GENDER_* 常量之一。

自 API 级别 34 起可用。

AConfiguration_setKeyboard

android/configuration.h 中声明
void AConfiguration_setKeyboard(
  AConfiguration *config,
  int32_t keyboard
)

设置配置中的当前键盘。

AConfiguration_setKeysHidden

android/configuration.h 中声明
void AConfiguration_setKeysHidden(
  AConfiguration *config,
  int32_t keysHidden
)

设置配置中的当前隐藏键。

AConfiguration_setLanguage

android/configuration.h 中声明
void AConfiguration_setLanguage(
  AConfiguration *config,
  const char *language
)

根据字符串的前两个字符,设置配置中的当前语言代码。

AConfiguration_setLayoutDirection

android/configuration.h 中声明
void AConfiguration_setLayoutDirection(
  AConfiguration *config,
  int32_t value
)

设置配置的布局方向。

自 API 级别 17 起可用。

AConfiguration_setMcc

android/configuration.h 中声明
void AConfiguration_setMcc(
  AConfiguration *config,
  int32_t mcc
)

设置配置中的当前 MCC。

设置为 0 以清除。

AConfiguration_setMnc

android/configuration.h 中声明
void AConfiguration_setMnc(
  AConfiguration *config,
  int32_t mnc
)

设置配置中的当前 MNC。

设置为 0 以清除。

AConfiguration_setNavHidden

android/configuration.h 中声明
void AConfiguration_setNavHidden(
  AConfiguration *config,
  int32_t navHidden
)

设置配置中的当前导航隐藏状态。

AConfiguration_setNavigation

android/configuration.h 中声明
void AConfiguration_setNavigation(
  AConfiguration *config,
  int32_t navigation
)

设置配置中的当前导航类型。

AConfiguration_setOrientation

android/configuration.h 中声明
void AConfiguration_setOrientation(
  AConfiguration *config,
  int32_t orientation
)

设置配置中的当前方向。

AConfiguration_setScreenHeightDp

android/configuration.h 中声明
void AConfiguration_setScreenHeightDp(
  AConfiguration *config,
  int32_t value
)

设置配置中当前的屏幕高度(以 dp 为单位)。

AConfiguration_setScreenLong

android/configuration.h 中声明
void AConfiguration_setScreenLong(
  AConfiguration *config,
  int32_t screenLong
)

设置配置中的当前屏幕长宽比。

AConfiguration_setScreenRound

android/configuration.h 中声明
void AConfiguration_setScreenRound(
  AConfiguration *config,
  int32_t screenRound
)

设置配置中的当前圆角屏幕状态。

AConfiguration_setScreenSize

android/configuration.h 中声明
void AConfiguration_setScreenSize(
  AConfiguration *config,
  int32_t screenSize
)

设置配置中的当前屏幕尺寸。

AConfiguration_setScreenWidthDp

android/configuration.h 中声明
void AConfiguration_setScreenWidthDp(
  AConfiguration *config,
  int32_t value
)

设置配置中当前的屏幕高度(以 dp 为单位)。

AConfiguration_setSdkVersion

android/configuration.h 中声明
void AConfiguration_setSdkVersion(
  AConfiguration *config,
  int32_t sdkVersion
)

设置配置中的当前 SDK 版本。

AConfiguration_setSmallestScreenWidthDp

android/configuration.h 中声明
void AConfiguration_setSmallestScreenWidthDp(
  AConfiguration *config,
  int32_t value
)

设置配置的最小屏幕宽度(以 dp 为单位)。

AConfiguration_setTouchscreen

android/configuration.h 中声明
void AConfiguration_setTouchscreen(
  AConfiguration *config,
  int32_t touchscreen
)

设置配置中的当前触摸屏类型。

AConfiguration_setUiModeNight

android/configuration.h 中声明
void AConfiguration_setUiModeNight(
  AConfiguration *config,
  int32_t uiModeNight
)

设置配置中的当前 UI 夜间模式。

AConfiguration_setUiModeType

android/configuration.h 中声明
void AConfiguration_setUiModeType(
  AConfiguration *config,
  int32_t uiModeType
)

设置配置中的当前 UI 模式类型。