xref: /aosp_15_r20/system/sepolicy/flagging/flagging_macros (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1####################################
2# is_flag_enabled(flag, rules)
3# SELinux rules which apply only if given feature is turned on
4define(`is_flag_enabled', `ifelse(target_flag_$1, `true', `$2')')
5
6####################################
7# is_flag_disabled(flag, rules)
8# SELinux rules which apply only if given feature is turned off
9define(`is_flag_disabled', `ifelse(target_flag_$1, `true', , `$2')')
10
11####################################
12# starting_at_board_api(api_level, rules_if_api_level)
13#
14# This macro conditionally exposes SELinux rules ensuring they are available
15# only when the board API level is at or above the specified 'api_level'.
16define(`starting_at_board_api', `ifelse(eval(target_board_api_level >= $1), 1, `$2')')
17
18####################################
19# until_board_api(api_level, rules_if_lower_api_level)
20#
21# This macro conditionally exposes SELinux rules ensuring they are available
22# only when the board API level is below the specified 'api_level'.
23define(`until_board_api', `ifelse(eval(target_board_api_level < $1), 1, `$2')')
24