Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 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 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 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 |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 17 | // Android tree. |
Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 18 | |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 19 | syntax = "proto2"; |
Mårten Kongstad | 867a349 | 2023-04-25 15:06:30 +0200 | [diff] [blame] | 20 | |
| 21 | package android.aconfig; |
| 22 | |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 23 | // messages used in both aconfig input and output |
| 24 | |
Mårten Kongstad | c68c4ea | 2023-05-05 16:20:09 +0200 | [diff] [blame] | 25 | enum flag_state { |
| 26 | ENABLED = 1; |
| 27 | DISABLED = 2; |
| 28 | } |
| 29 | |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 30 | enum flag_permission { |
Mårten Kongstad | 416330b | 2023-05-05 11:10:01 +0200 | [diff] [blame] | 31 | READ_ONLY = 1; |
| 32 | READ_WRITE = 2; |
| 33 | } |
| 34 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 35 | // aconfig input messages: flag declarations and values |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 36 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 37 | message flag_declaration { |
Mårten Kongstad | a2e5ab8 | 2023-06-19 16:28:54 +0200 | [diff] [blame] | 38 | optional string name = 1; |
| 39 | optional string namespace = 2; |
| 40 | optional string description = 3; |
Mårten Kongstad | 1b8636b | 2023-06-22 10:12:24 +0200 | [diff] [blame] | 41 | repeated string bug = 4; |
Zhi Dou | 71f1b35 | 2023-08-21 22:49:46 +0000 | [diff] [blame] | 42 | optional bool is_fixed_read_only = 5; |
Oriol Prieto Gasco | 0b9d289 | 2023-11-20 16:23:51 +0000 | [diff] [blame] | 43 | optional bool is_exported = 6; |
Micha Schwab | 1a1a08a | 2023-11-28 16:14:30 -0500 | [diff] [blame^] | 44 | optional flag_metadata metadata = 7; |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 45 | }; |
| 46 | |
Micha Schwab | 1a1a08a | 2023-11-28 16:14:30 -0500 | [diff] [blame^] | 47 | // Optional metadata about the flag, such as its purpose and its intended form factors. |
| 48 | // Can influence the applied policies and testing strategy. |
| 49 | message flag_metadata { |
| 50 | enum flag_purpose { |
| 51 | PURPOSE_UNSPECIFIED = 0; |
| 52 | PURPOSE_FEATURE = 1; |
| 53 | PURPOSE_BUGFIX = 2; |
| 54 | } |
| 55 | |
| 56 | optional flag_purpose purpose = 1; |
| 57 | |
| 58 | // TODO(b/315025930): Add field to designate intended target device form factor(s), such as phone, watch or other. |
| 59 | } |
| 60 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 61 | message flag_declarations { |
Mårten Kongstad | a2e5ab8 | 2023-06-19 16:28:54 +0200 | [diff] [blame] | 62 | optional string package = 1; |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 63 | repeated flag_declaration flag = 2; |
Oriol Prieto Gasco | 7afc7e7 | 2023-11-22 13:26:02 +0000 | [diff] [blame] | 64 | optional string container = 3; |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 65 | }; |
| 66 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 67 | message flag_value { |
Mårten Kongstad | a2e5ab8 | 2023-06-19 16:28:54 +0200 | [diff] [blame] | 68 | optional string package = 1; |
| 69 | optional string name = 2; |
| 70 | optional flag_state state = 3; |
| 71 | optional flag_permission permission = 4; |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 72 | }; |
| 73 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 74 | message flag_values { |
| 75 | repeated flag_value flag_value = 1; |
Mårten Kongstad | bb52072 | 2023-04-26 13:16:41 +0200 | [diff] [blame] | 76 | }; |
Mårten Kongstad | a102909 | 2023-05-08 11:51:59 +0200 | [diff] [blame] | 77 | |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 78 | // aconfig output messages: parsed and verified flag declarations and values |
Mårten Kongstad | a102909 | 2023-05-08 11:51:59 +0200 | [diff] [blame] | 79 | |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 80 | message tracepoint { |
Mårten Kongstad | fa23d29 | 2023-05-11 14:47:02 +0200 | [diff] [blame] | 81 | // path to declaration or value file relative to $TOP |
Mårten Kongstad | a2e5ab8 | 2023-06-19 16:28:54 +0200 | [diff] [blame] | 82 | optional string source = 1; |
| 83 | optional flag_state state = 2; |
| 84 | optional flag_permission permission = 3; |
Mårten Kongstad | a102909 | 2023-05-08 11:51:59 +0200 | [diff] [blame] | 85 | } |
| 86 | |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 87 | message parsed_flag { |
Mårten Kongstad | a2e5ab8 | 2023-06-19 16:28:54 +0200 | [diff] [blame] | 88 | optional string package = 1; |
| 89 | optional string name = 2; |
| 90 | optional string namespace = 3; |
| 91 | optional string description = 4; |
Mårten Kongstad | 1b8636b | 2023-06-22 10:12:24 +0200 | [diff] [blame] | 92 | repeated string bug = 5; |
| 93 | optional flag_state state = 6; |
| 94 | optional flag_permission permission = 7; |
| 95 | repeated tracepoint trace = 8; |
Zhi Dou | 71f1b35 | 2023-08-21 22:49:46 +0000 | [diff] [blame] | 96 | optional bool is_fixed_read_only = 9; |
Oriol Prieto Gasco | 0b9d289 | 2023-11-20 16:23:51 +0000 | [diff] [blame] | 97 | optional bool is_exported = 10; |
Oriol Prieto Gasco | 7afc7e7 | 2023-11-22 13:26:02 +0000 | [diff] [blame] | 98 | optional string container = 11; |
Micha Schwab | 1a1a08a | 2023-11-28 16:14:30 -0500 | [diff] [blame^] | 99 | optional flag_metadata metadata = 12; |
Mårten Kongstad | 3095078 | 2023-05-09 13:31:29 +0200 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | message parsed_flags { |
| 103 | repeated parsed_flag parsed_flag = 1; |
Mårten Kongstad | a102909 | 2023-05-08 11:51:59 +0200 | [diff] [blame] | 104 | } |