aboutsummaryrefslogtreecommitdiff
path: root/tools/aconfig/aconfig_protos/protos/aconfig.proto
blob: 9d1b8cbfbf0522738fa426e20a1a3fad64b44635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License

// This is the schema definition for aconfig files. Modifications need to be
// either backwards compatible, or include updates to all aconfig files in the
// Android tree.

syntax = "proto2";

package android.aconfig;

// This protobuf file defines messages used to represent and manage flags in the "aconfig" system
// The following format requirements apply across various message fields:
//
// # name: name of the flag
//
//    format: a lowercase string in snake_case format, no consecutive underscores, and no leading
//      digit. For example adjust_rate is a valid name, while AdjustRate, adjust__rate, and
//      adjust_rate are invalid
//
// # namespace: namespace the flag belongs to
//
//    format: a lowercase string in snake_case format, no consecutive underscores, and no leading
//      digit. For example android_bar_system
//
// # package: package to which the flag belongs
//
//    format: lowercase strings in snake_case format, delimited by dots, no consecutive underscores
//      and no leading digit in each string. For example com.android.mypackage is a valid name
//      while com.android.myPackage, com.android.1mypackage are invalid
//
// # container: container as software built in its entirety using the same build environment and
//    always installed as a single unit
//
//    For example the following are all separate containers:
//        * the system partition
//        * the vendor partition
//        * apexes: each APEX is its own container
//        * APKs: for APKs which are released independently via Play, each APK is its own container.
//            If an APK is released as part of a Mainline module, or as part of the system partition
//            via OTA, then they are part of the apex or the system partition container
//
//    format: lowercase strings in snake_case format, delimited by dots if multiple, no consecutive
//      underscores or leading digits in each string. The recommended container values are the
//      partition names or the module names

// messages used in both aconfig input and output

enum flag_state {
  ENABLED = 1;
  DISABLED = 2;
}

enum flag_permission {
  READ_ONLY = 1;
  READ_WRITE = 2;
}

// aconfig input messages: flag declarations and values

message flag_declaration {
  // Name of the flag (required)
  // See # name for format detail
  optional string name = 1;

  // Namespace the flag belongs to (required)
  // See # namespace for format detail
  optional string namespace = 2;

  // Textual description of the flag's purpose (required)
  optional string description = 3;

  // Single bug id related to the flag (required)
  repeated string bug = 4;

  // Indicates if the flag is permanently read-only and cannot be changed
  // via release configs (optional)
  // Default value false
  optional bool is_fixed_read_only = 5;

  // Indicates if the flag is exported and accessible beyond its originating container (optional)
  // Default value false
  optional bool is_exported = 6;

  // Additional information about the flag, including its purpose and form factors (optional)
  optional flag_metadata metadata = 7;
};

// Optional metadata about the flag, such as its purpose and its intended form factors.
// Can influence the applied policies and testing strategy.
message flag_metadata {
  enum flag_purpose {
    PURPOSE_UNSPECIFIED = 0;
    PURPOSE_FEATURE = 1;
    PURPOSE_BUGFIX = 2;
  }

  optional flag_purpose purpose = 1;

  // TODO(b/315025930): Add field to designate intended target device form factor(s), such as phone, watch or other.
}

message flag_declarations {
  // Package to which the flag belongs (required)
  // See # package for format detail
  optional string package = 1;

  // List of flag_declaration objects (required)
  repeated flag_declaration flag = 2;

  // Container the flag belongs to (optional)
  // See # container for format detail
  optional string container = 3;
};

message flag_value {
  // Package to which the flag belongs (required)
  // See # package for format detail
  optional string package = 1;

  // Name of the flag (required)
  // See # name for format detail
  optional string name = 2;

  optional flag_state state = 3;
  optional flag_permission permission = 4;
};

message flag_values {
  repeated flag_value flag_value = 1;
};

// aconfig output messages: parsed and verified flag declarations and values

message tracepoint {
  // path to declaration or value file relative to $TOP
  optional string source = 1;
  optional flag_state state = 2;
  optional flag_permission permission = 3;
}

message parsed_flag {
  // Package to which the flag belongs (required)
  // See # package for format detail
  optional string package = 1;

  // Name of the flag (required)
  // See # name for format detail
  optional string name = 2;

  // Namespace the flag belongs to (required)
  // See # namespace for format detail
  optional string namespace = 3;

  // Textual description of the flag's purpose (required)
  optional string description = 4;

  // Single bug id related to the flag (required)
  repeated string bug = 5;

  optional flag_state state = 6;
  optional flag_permission permission = 7;
  repeated tracepoint trace = 8;

  // Indicates if the flag is permanently read-only and cannot be changed
  // via release configs (optional)
  // Default value false
  optional bool is_fixed_read_only = 9;

  // Indicates if the flag is exported and accessible beyond its originating container (optional)
  // Default value false
  optional bool is_exported = 10;

  // Container the flag belongs to (optional)
  // See # container for format detail
  optional string container = 11;

  // Additional information about the flag, including its purpose and form factors (optional)
  optional flag_metadata metadata = 12;
}

message parsed_flags {
  repeated parsed_flag parsed_flag = 1;
}