1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License 14 15// This is the schema definition for aconfig files. Modifications need to be 16// either backwards compatible, or include updates to all aconfig files in the 17// Android tree. 18 19syntax = "proto2"; 20 21package android.aconfig; 22 23// This protobuf file defines messages used to represent and manage flags in the "aconfig" system 24// The following format requirements apply across various message fields: 25// 26// # name: name of the flag 27// 28// format: a lowercase string in snake_case format, no consecutive underscores, and no leading 29// digit. For example adjust_rate is a valid name, while AdjustRate, adjust__rate, and 30// adjust_rate are invalid 31// 32// # namespace: namespace the flag belongs to 33// 34// format: a lowercase string in snake_case format, no consecutive underscores, and no leading 35// digit. For example android_bar_system 36// 37// # package: package to which the flag belongs 38// 39// format: lowercase strings in snake_case format, delimited by dots, no consecutive underscores 40// and no leading digit in each string. For example com.android.mypackage is a valid name 41// while com.android.myPackage, com.android.1mypackage are invalid 42// 43// # container: container as software built in its entirety using the same build environment and 44// always installed as a single unit 45// 46// For example the following are all separate containers: 47// * the system partition 48// * the vendor partition 49// * apexes: each APEX is its own container 50// * APKs: for APKs which are released independently via Play, each APK is its own container. 51// If an APK is released as part of a Mainline module, or as part of the system partition 52// via OTA, then they are part of the apex or the system partition container 53// 54// format: lowercase strings in snake_case format, delimited by dots if multiple, no consecutive 55// underscores or leading digits in each string. The recommended container values are the 56// partition names or the module names 57 58// messages used in both aconfig input and output 59 60enum flag_state { 61 ENABLED = 1; 62 DISABLED = 2; 63} 64 65enum flag_permission { 66 READ_ONLY = 1; 67 READ_WRITE = 2; 68} 69 70// aconfig input messages: flag declarations and values 71 72message flag_declaration { 73 // Name of the flag (required) 74 // See # name for format detail 75 optional string name = 1; 76 77 // Namespace the flag belongs to (required) 78 // See # namespace for format detail 79 optional string namespace = 2; 80 81 // Textual description of the flag's purpose (required) 82 optional string description = 3; 83 84 // Single bug id related to the flag (required) 85 repeated string bug = 4; 86 87 // Indicates if the flag is permanently read-only and cannot be changed 88 // via release configs (optional) 89 // Default value false 90 optional bool is_fixed_read_only = 5; 91 92 // Indicates if the flag is exported and accessible beyond its originating container (optional) 93 // Default value false 94 optional bool is_exported = 6; 95 96 // Additional information about the flag, including its purpose and form factors (optional) 97 optional flag_metadata metadata = 7; 98}; 99 100// Optional metadata about the flag, such as its purpose and its intended form factors. 101// Can influence the applied policies and testing strategy. 102message flag_metadata { 103 enum flag_purpose { 104 PURPOSE_UNSPECIFIED = 0; 105 PURPOSE_FEATURE = 1; 106 PURPOSE_BUGFIX = 2; 107 } 108 109 optional flag_purpose purpose = 1; 110 111 // TODO(b/315025930): Add field to designate intended target device form factor(s), such as phone, watch or other. 112} 113 114message flag_declarations { 115 // Package to which the flag belongs (required) 116 // See # package for format detail 117 optional string package = 1; 118 119 // List of flag_declaration objects (required) 120 repeated flag_declaration flag = 2; 121 122 // Container the flag belongs to (optional) 123 // See # container for format detail 124 optional string container = 3; 125}; 126 127message flag_value { 128 // Package to which the flag belongs (required) 129 // See # package for format detail 130 optional string package = 1; 131 132 // Name of the flag (required) 133 // See # name for format detail 134 optional string name = 2; 135 136 optional flag_state state = 3; 137 optional flag_permission permission = 4; 138}; 139 140message flag_values { 141 repeated flag_value flag_value = 1; 142}; 143 144// aconfig output messages: parsed and verified flag declarations and values 145 146message tracepoint { 147 // path to declaration or value file relative to $TOP 148 optional string source = 1; 149 optional flag_state state = 2; 150 optional flag_permission permission = 3; 151} 152 153message parsed_flag { 154 // Package to which the flag belongs (required) 155 // See # package for format detail 156 optional string package = 1; 157 158 // Name of the flag (required) 159 // See # name for format detail 160 optional string name = 2; 161 162 // Namespace the flag belongs to (required) 163 // See # namespace for format detail 164 optional string namespace = 3; 165 166 // Textual description of the flag's purpose (required) 167 optional string description = 4; 168 169 // Single bug id related to the flag (required) 170 repeated string bug = 5; 171 172 optional flag_state state = 6; 173 optional flag_permission permission = 7; 174 repeated tracepoint trace = 8; 175 176 // Indicates if the flag is permanently read-only and cannot be changed 177 // via release configs (optional) 178 // Default value false 179 optional bool is_fixed_read_only = 9; 180 181 // Indicates if the flag is exported and accessible beyond its originating container (optional) 182 // Default value false 183 optional bool is_exported = 10; 184 185 // Container the flag belongs to (optional) 186 // See # container for format detail 187 optional string container = 11; 188 189 // Additional information about the flag, including its purpose and form factors (optional) 190 optional flag_metadata metadata = 12; 191} 192 193message parsed_flags { 194 repeated parsed_flag parsed_flag = 1; 195} 196