1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// If you change this file,
18// Please update ota_metadata_pb2.py by executing
19// protoc ota_metadata.proto --python_out
20// $ANDROID_BUILD_TOP/build/tools/releasetools
21
22syntax = "proto3";
23
24package build.tools.releasetools;
25option optimize_for = LITE_RUNTIME;
26option java_package = "android.ota";
27option java_outer_classname = "OtaPackageMetadata";
28
29// The build information of a particular partition on the device.
30message PartitionState {
31  string partition_name = 1;
32  repeated string device = 2;
33  repeated string build = 3;
34  // The version string of the partition. It's usually timestamp if present.
35  // One known exception is the boot image, who uses the kmi version, e.g.
36  // 5.4.42-android12-0
37  string version = 4;
38
39  // TODO(xunchang), revisit other necessary fields, e.g. security_patch_level.
40}
41
42// The build information on the device. The bytes of the running images are thus
43// inferred from the device state. For more information of the meaning of each
44// subfield, check
45// https://source.android.com/compatibility/android-cdd#3_2_2_build_parameters
46message DeviceState {
47  // device name. i.e. ro.product.device; if the field has multiple values, it
48  // means the ota package supports multiple devices. This usually happens when
49  // we use the same image to support multiple skus.
50  repeated string device = 1;
51  // device fingerprint. Up to R build, the value reads from
52  // ro.build.fingerprint.
53  repeated string build = 2;
54  // A value that specify a version of the android build.
55  string build_incremental = 3;
56  // The timestamp when the build is generated.
57  int64 timestamp = 4;
58  // The version of the currently-executing Android system.
59  string sdk_level = 5;
60  // A value indicating the security patch level of a build.
61  string security_patch_level = 6;
62
63  // The detailed state of each partition. For partial updates or devices with
64  // mixed build of partitions, some of the above fields may left empty. And the
65  // client will rely on the information of specific partitions to target the
66  // update.
67  repeated PartitionState partition_state = 7;
68}
69
70message ApexInfo {
71  string package_name = 1;
72  int64 version = 2;
73  bool is_compressed = 3;
74  int64 decompressed_size = 4;
75}
76
77// Just a container to hold repeated apex_info, so that we can easily serialize
78// a list of apex_info to string.
79message ApexMetadata {
80  repeated ApexInfo apex_info = 1;
81}
82
83// The metadata of an OTA package. It contains the information of the package
84// and prerequisite to install the update correctly.
85message OtaMetadata {
86  enum OtaType {
87    UNKNOWN = 0;
88    AB = 1;
89    BLOCK = 2;
90    BRICK = 3;
91  };
92  OtaType type = 1;
93  // True if we need to wipe after the update.
94  bool wipe = 2;
95  // True if the timestamp of the post build is older than the pre build.
96  bool downgrade = 3;
97  // A map of name:content of property files, e.g. ota-property-files.
98  map<string, string> property_files = 4;
99
100  // The required device state in order to install the package.
101  DeviceState precondition = 5;
102  // The expected device state after the update.
103  DeviceState postcondition = 6;
104
105  // True if the ota that updates a device to support dynamic partitions, where
106  // the source build doesn't support it.
107  bool retrofit_dynamic_partitions = 7;
108  // The required size of the cache partition, only valid for non-A/B update.
109  int64 required_cache = 8;
110
111  // True iff security patch level downgrade is permitted on this OTA.
112  bool spl_downgrade = 9;
113}
114