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