기본적으로 모든 기능 출시 플래그는 READ_WRITE이며 DISABLED로 설정됩니다.
기능을 테스트하려면 먼저 플래그의 플래그 값 파일을 만들어 빌드에 사용되는 기본값을 재정의해야 합니다. 플래그 값 파일에서 개별 플래그의 상태 (ENABLED 또는 DISABLED)와 권한(READ_WRITE 또는 READ_ONLY)을 설정합니다.
출시 구성은 특정 Android 빌드의 모든 플래그 값 파일 (특정 기능 사용 설정 및 사용 중지됨)이 포함된 디렉터리입니다.
AOSP는 trunk_staging와 같은 몇 가지 출시 구성과 함께 제공됩니다.
출시 구성 디렉터리는 WORKING_DIRECTORY/build/release/aconfig/에 있습니다.
lunch 명령어를 사용하여 타겟을 선택하면 타겟의 출시 구성도 설정됩니다.
예를 들어 다음은 trunk_staging 타겟입니다.
트렁크 스테이징은 Google에서 정식 출시 전에 기능을 테스트하는 데 사용하기 때문에 개발 출시 구성입니다. 이 구성은 주로 READ_WRITE 플래그를 사용하여 런타임에 기능을 사용 설정하거나 사용 중지하여 코드를 테스트할 수 있습니다.
정식 출시에서는 출시 출시 구성을 사용합니다. 출시 버전 구성은 대부분 READ_ONLY 플래그를 사용하며 해당 출시에 사용 설정된 모든 코드를 반영합니다.
trunk_staging 출시 구성에 플래그 추가
새 플래그를 테스트하려면 다음과 같이 trunk_staging 출시 구성에 추가합니다.
WORKING_DIRECTORY/build/release/aconfig/trunk_staging/까지 경로 안내
플래그와 동일한 패키지 이름(예: Java용 aconfig 플래그 선언에 표시된 com.example.android.aconfig.demo.flags)으로 디렉터리를 만듭니다.
새 디렉터리로 이동합니다.
디렉터리에서 플래그 선언(.aconfig) 파일에 사용된 이름(예: Java용 aconfig 플래그 선언에 표시된 my_static_flag)과 _flag_values.textproto을 결합한 플래그 값 파일을 만듭니다. 결과 파일 이름은 my_static_flag_flag_values.textproto입니다.
name은 Soong 빌드 모듈의 고유한 이름입니다. Google은 aconfig-values-platform_PATH_TO_RELEASE_CONFIG_DIR-CONFIG-NAME-package.name-all 규칙을 사용합니다.
PATH_TO_RELEASE_CONFIG_DIR은 build/release입니다.
package에는 선언에 사용된 것과 동일한 패키지 이름이 포함됩니다.
srcs는 모든 플래그 값 파일의 목록입니다.
파일을 저장하고 편집기를 종료합니다.
현재 디렉터리 위의 디렉터리 (cd ..)로 이동합니다.
Android.bp 파일을 수정합니다. 이 빌드 파일에는 각 플래그 값 파일과 연결된 이름(name) 목록이 포함되어 있습니다. 이전 빌드 파일 (8단계)에서 사용한 이름을 이 목록에 추가합니다.
Android를 빌드하고 새 코드를 실행하여 플래그 값 파일의 설정에 따라 사용 설정되었는지 확인합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Set feature launch flag values\n\nBy default, all feature launch flags are `READ_WRITE` and set to `DISABLED`.\nBefore you can test a feature, you must override the default value used in the\nbuild by creating a *flag values file* for the flag. In a flag values file,\nyou set a individual flag's state (`ENABLED` or `DISABLED`) and permission\n(`READ_WRITE` or `READ_ONLY`).\n\nA *release configuration* is a directory that contains all of the flag values\nfiles for a specific build of Android (with certain features enabled and\ndisabled).\n\nAOSP ships with a few release configurations, such as `trunk_staging`.\nRelease configuration directories are found under\n\u003cvar translate=\"no\"\u003eWORKING_DIRECTORY\u003c/var\u003e`/build/release/aconfig/`.\n| **Note:** This page shows you how to add a flag to an existing release configuration as a means of teaching how release configurations work. The release configurations included in AOSP are defined by Google. Google doesn't accept contributions to update or change a configuration's feature release flags. Instead, you can define your own custom release configurations including default flag values in your forks of AOSP. For more information on release configurations, see [Set feature launch flag values](/docs/setup/build/feature-flagging/set-values).\n\nWhen you use the `lunch` command to\n[choose a target](/docs/setup/build/building#choose-a-target), you're\nalso setting the release configuration for the target.\nFor example, the\nfollowing is a `trunk_staging` target: \n\n lunch aosp_cf_x86_64_only_phone-trunk_staging-userdebug\n\nTrunk staging is a *development release configuration* because\nGoogle uses it to test features before general release. This configuration\nuses\nmostly `READ_WRITE` flags that let you test your code with features enabled or\ndisabled at runtime.\n\nAt general release, use a *release release configuration* . A release\nrelease configuration mostly uses `READ_ONLY` flags and reflects all of the code\nenabled for that release.\n\nAdd a flag to the trunk_staging release configuration\n-----------------------------------------------------\n\nTo test a new flag, add it to the `trunk_staging` release configuration as\nfollows:\n\n1. Navigate to \u003cvar translate=\"no\"\u003eWORKING_DIRECTORY\u003c/var\u003e`/build/release/aconfig/trunk_staging/`\n2. Create a directory with the same package name as your flag, such as `com.example.android.aconfig.demo.flags` shown in [Declare an aconfig flag for Java](/docs/setup/build/feature-flagging/declare-flag).\n3. Navigate to the new directory.\n4. In the directory, create a flag values file that combines the name used in the flag declaration (`.aconfig`) file, such as `my_static_flag` shown in [Declare an aconfig flag for Java](/docs/setup/build/feature-flagging/declare-flag) with `_flag_values.textproto`. The resulting filename is `my_static_flag_flag_values.textproto`.\n5. Edit the file and add a `flag_value` similar to the following:\n\n flag_value {\n package: \"com.example.android.aconfig.demo.flags\"\n name: \"my_static_flag\"\n state: DISABLED\n Permission: READ_WRITE\n }\n\n Where:\n - `package` contains the same package name used in the declaration.\n - `name` contains the same name used in the declaration.\n - `state` is either `ENABLED` or `DISABLED`.\n - `permission` is either `READ_WRITE` or `READ_ONLY`. Generally, the `permission` is set to `READ_ONLY` for flag values files that are part of a release configuration.\n6. Save the file and exit your editor.\n\n7. In the same directory as the flag values file, create a build file called\n `Android.bp`. This file is used to include the flag values file in the build.\n\n8. In the `Android.bp` file, create a `aconfig_values` section similar to:\n\n aconfig_values {\n name: \"aconfig-values-platform_build_release-trunk-staging-com.android.aconfig.test-all\",\n package: \"com.android.aconfig.test\",\n srcs: [\n \"*_flag_values.textproto\",\n ]\n }\n\n Where:\n - `name` is the unique name for the Soong build module. Google uses the convention of `aconfig-values-platform_`\u003cvar translate=\"no\"\u003ePATH_TO_RELEASE_CONFIG_DIR\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003eCONFIG-NAME\u003c/var\u003e`-`\u003cvar translate=\"no\"\u003epackage.name\u003c/var\u003e`-all`. Note that \u003cvar translate=\"no\"\u003ePATH_TO_RELEASE_CONFIG_DIR\u003c/var\u003e is `build/release`.\n - `package` contains the same package name used in the declaration.\n - `srcs` is a list of all of your flag values files.\n9. Save the file and exit your editor.\n\n10. Navigate to the directory above the current directory (`cd ..`)\n\n11. Edit the `Android.bp` file. This build file contains a list of the names\n (`name`) associated with each flag values file. Add the name you used in the\n previous build file (step 8) to this list.\n\n12. Build Android, and run your new code to ensure that it's enabled per the\n setting in the flag values file."]]