Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release thay vì aosp-main để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Kiểm tra trạng thái mã bằng cách cố gắng thực thi mã trên thiết bị hoặc chạy lại lệnh aflags list:
adbshellaflagslist|greppackage.flagname
Nếu mã của bạn đã được bật, thì mã đó sẽ bị tắt. Ngược lại, nếu mã của bạn bị tắt, bạn phải bật mã đó.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Change a flag's value at runtime\n\nAfter building Android, ensure that you can change the aconfig flag's value.\n| **Note:** Only the value for an aconfig read-write flag can be changed at runtime.\n\nTo change an aconfig flag value at runtime:\n\n1. Ensure your device is running and connected to your development machine.\n2. Check to see the flag's current setting:\n\n adb shell aflags list | grep package.flagname\n\n3. If the flag is enabled and your code is executing, continue with step 4 to\n disable the flag. If the flag is disabled, skip to step 6 to enable your code.\n\n4. Disable your code. From the command line, run:\n\n adb shell aflags disable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, to disable the `append_injected_content` flag, run: \n\n adb shell aflags disable com.example.android.aconfig.demo.flags.append_injected_content\n\n5. Skip to step 7.\n\n6. Enable your code. From the command line, run:\n\n adb shell aflags enable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, enable the `append_injected_content` flag, run: \n\n adb shell aflags enable com.example.android.aconfig.demo.flags.append_injected_content\n\n7. Reboot the device:\n\n adb reboot\n\n8. Check the status your code either by attempting to execute it on the device\n or by rerunning the `aflags list` command again:\n\n adb shell aflags list | grep package.flagname\n\n If your code was enabled, it should be disabled. Conversely, if your code was\n disabled, it should be enabled."]]