| Kweku Adams | 89b3202 | 2018-03-05 18:06:02 -0800 | [diff] [blame] | 1 | Conventions for the protos in this directory: |
| 2 | |
| 3 | 1. As in the rest of Android, use 4 spaces to indent instead of 2. |
| 4 | |
| 5 | 1. For protos based on Java files, use the same package as the Java file. For |
| 6 | example, `com.android.server.thing` instead of `com.android.server.thing.proto`. |
| 7 | |
| 8 | 1. If the proto describes the top level output of dumpsys, it should contain |
| 9 | `Dump`. This makes it easy to understand that the proto is the dumpsys output |
| 10 | of a certain service, not the data structure of that service, e.g. |
| Kweku Adams | b4e5453 | 2018-03-23 18:03:43 -0700 | [diff] [blame] | 11 | `WindowManagerServiceDumpProto` vs `WindowManagerServiceProto`. |
| Kweku Adams | 89b3202 | 2018-03-05 18:06:02 -0800 | [diff] [blame] | 12 | |
| 13 | * Inner messages whose containing messages have the `Proto` suffix do not |
| 14 | need to have a `Proto` suffix. E.g: |
| 15 | |
| 16 | ``` |
| 17 | message FooProto { |
| 18 | message Bar { |
| 19 | ... |
| 20 | } |
| 21 | } |
| 22 | ``` |
| 23 | |
| 24 | vs |
| 25 | |
| 26 | ``` |
| 27 | message FooProto { |
| 28 | message BarProto { |
| 29 | ... |
| 30 | } |
| 31 | } |
| 32 | ``` |
| 33 | |
| 34 | 1. If the proto represents the structure of an object, it should have `Proto` as |
| 35 | its suffix. Please also include the full package path of the original object |
| 36 | as a comment to the proto message. |
| 37 | |
| 38 | 1. Include units in the field names. For example, `screen_time_ms` vs |
| 39 | `screen_time`, or `file_size_bytes` or `file_size_mebibytes` vs `file_size`. |
| 40 | |
| 41 | 1. Leave field numbers 50,000 - 100,000 reserved for OEMs. |