기능 출시 플래그는 Google에서 안정적인 코드 브랜치를 보장하기 위한 접근 방식으로 사용합니다. 이러한 플래그는 AOSP에 특정 유형의 기여를 할 때도 필요합니다. 기능 출시 플래그를 구현하기 전에 변경사항에 플래그가 필요한지 확인합니다. 플래그가 필요한 경우 사용할 플래그 유형을 결정해야 합니다.
플래그 사용량 확인
기능 출시 플래그를 사용할 시기를 결정하려면 다음 가이드라인을 따르세요.
새 기능을 추가하거나 특히 복잡한 버그를 수정하는 등 AOSP 코드베이스가 불안정해질 수 있는 변경사항을 적용하는 경우 기능 출시 플래그를 사용하세요.
반대로 코드베이스의 불안정성을 유발하지 않는 코드 변경사항(예: 주석 수정)을 적용하는 경우 기능 출시 플래그를 사용할 필요가 없습니다.
플래그 유형 결정
플래그에는 aconfig 플래그와 빌드 플래그의 두 가지 유형이 있습니다.
Aconfig 플래그
Aconfig 플래그는 테스트 및 출시 프로세스 중에 출시되지 않은 코드의 실행을 출시된 코드와 구분하는 데 사용됩니다. Aconfig 플래그는 읽기-쓰기 또는 읽기 전용일 수 있습니다.
읽기-쓰기 aconfig 플래그는 런타임에 사용 설정 (true로 설정)하거나 사용 중지 (false로 설정)할 수 있는 불리언 변수입니다. 읽기-쓰기 플래그를 사용하여 기본 브랜치의 안정성에 영향을 주지 않고 변경사항을 테스트하고 출시합니다.
읽기 전용 aconfig 플래그는 런타임에 변경할 수 없는 불리언 상수입니다. 안정적이고 출시 준비가 완료된 코드의 경우 읽기 쓰기 aconfig 플래그를 읽기 전용 aconfig 플래그로 변환할 수 있습니다.
또한 사용하는 컴파일러에 따라 읽기 전용 플래그를 사용하면 실행되지 않는 코드가 빌드에서 제외될 수 있습니다. 따라서 읽기 전용 플래그를 사용하여 출시에 포함할 준비가 되지 않은 코드를 숨길 수 있습니다.
빌드 플래그
빌드 플래그는 빌드 시간 상수 (문자열)이며 런타임 중에 변경할 수 없습니다. 다음과 같이 aconfig 플래그를 사용할 수 없는 경우에 이 플래그를 사용하세요.
빌드에 포함할 사전 컴파일된 코드 또는 사전 빌드된 코드가 있습니다.
빌드 시스템 자체를 변경하려고 합니다.
코드 크기를 관리하기 위해 종속 항목에 플래그를 지정하려 합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 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,["# Determine flag usage and type\n\nFeature launch flags are used by Google as an approach to ensuring stable\ncode branches. These flags are also required for certain types of contributions\nto AOSP. Before implementing feature launch flagging, determine if\na flag is necessary for your change. And, if a flag is necessary, you should\ndetermine the type of flag to use.\n\nDetermine flag usage\n--------------------\n\nTo determine when to use a feature launch flag, follow these guidelines:\n\n- If you are making a change that could cause the AOSP codebase to be unstable,\n such as adding a new feature or fixing a particularly complex bug, use a feature\n launch flag.\n\n- Conversely, if you are making a code change that isn't apt to cause the\n codebase to be unstable, such as modifying comments, you don't need to use a\n feature launch flag.\n\nDetermine flag type\n-------------------\n\nThere are two types of flags: *aconfig flags* and *build flags*.\n\n### Aconfig flags\n\nAconfig flags are used to separate the execution of unreleased code from\nreleased code during the testing and release process. Aconfig flags can be\nread-write or read-only:\n\n- *Read-write aconfig flags* are boolean variables that you can enable (set to\n `true`) or disable (set to `false`) at runtime. Use a read-write flag to test\n and release changes without affecting the stability of a main branch.\n\n- *Read-only aconfig flags* are boolean constants that you can't change at\n runtime. You can convert read-write aconfig flags to read-only aconfig flags\n for code that is stable and ready to release.\n\n Additionally, depending on the compiler you're using, when a read-only flag\n is used, the code that isn't executed might be excluded\n from the build. Therefore, you can use read-only flags to hide any code that\n isn't ready to be part of a release.\n\n### Build flags\n\nBuild flags are build-time constants (strings) and you can't change them during\nruntime. Use these flags in circumstances where you can't use aconfig flags,\nsuch as:\n\n- You have a precompiled or prebuilt piece of code that you want to include in the build.\n- You want to make changes to build system itself.\n- You want to put flags around dependencies to manage code size.\n\n| **Note:** Build flags have special encodings for boolean values (`false: {empty string}, true: \"true\"`)."]]