aboutsummaryrefslogtreecommitdiffstats
path: root/tools/releasetools/ota_metadata.proto
blob: 689ce807b945bf45f5ecfb41f73e29bf083e6b3d (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
/*
 * Copyright (C) 2020 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.
 */

// If you change this file,
// Please update ota_metadata_pb2.py by executing
// protoc ota_metadata.proto --python_out
// $ANDROID_BUILD_TOP/build/tools/releasetools

syntax = "proto3";

package build.tools.releasetools;
option optimize_for = LITE_RUNTIME;
option java_package = "android.ota";
option java_outer_classname = "OtaPackageMetadata";

// The build information of a particular partition on the device.
message PartitionState {
  string partition_name = 1;
  repeated string device = 2;
  repeated string build = 3;
  // The version string of the partition. It's usually timestamp if present.
  // One known exception is the boot image, who uses the kmi version, e.g.
  // 5.4.42-android12-0
  string version = 4;

  // TODO(xunchang), revisit other necessary fields, e.g. security_patch_level.
}

// The build information on the device. The bytes of the running images are thus
// inferred from the device state. For more information of the meaning of each
// subfield, check
// https://source.android.com/compatibility/android-cdd#3_2_2_build_parameters
message DeviceState {
  // device name. i.e. ro.product.device; if the field has multiple values, it
  // means the ota package supports multiple devices. This usually happens when
  // we use the same image to support multiple skus.
  repeated string device = 1;
  // device fingerprint. Up to R build, the value reads from
  // ro.build.fingerprint.
  repeated string build = 2;
  // A value that specify a version of the android build.
  string build_incremental = 3;
  // The timestamp when the build is generated.
  int64 timestamp = 4;
  // The version of the currently-executing Android system.
  string sdk_level = 5;
  // A value indicating the security patch level of a build.
  string security_patch_level = 6;

  // The detailed state of each partition. For partial updates or devices with
  // mixed build of partitions, some of the above fields may left empty. And the
  // client will rely on the information of specific partitions to target the
  // update.
  repeated PartitionState partition_state = 7;
}

message ApexInfo {
  string package_name = 1;
  int64 version = 2;
  bool is_compressed = 3;
  int64 decompressed_size = 4;
  // Used in OTA
  int64 source_version = 5;
}

// Just a container to hold repeated apex_info, so that we can easily serialize
// a list of apex_info to string.
message ApexMetadata {
  repeated ApexInfo apex_info = 1;
}

// The metadata of an OTA package. It contains the information of the package
// and prerequisite to install the update correctly.
message OtaMetadata {
  enum OtaType {
    UNKNOWN = 0;
    AB = 1;
    BLOCK = 2;
    BRICK = 3;
  };
  OtaType type = 1;
  // True if we need to wipe after the update.
  bool wipe = 2;
  // True if the timestamp of the post build is older than the pre build.
  bool downgrade = 3;
  // A map of name:content of property files, e.g. ota-property-files.
  map<string, string> property_files = 4;

  // The required device state in order to install the package.
  DeviceState precondition = 5;
  // The expected device state after the update.
  DeviceState postcondition = 6;

  // True if the ota that updates a device to support dynamic partitions, where
  // the source build doesn't support it.
  bool retrofit_dynamic_partitions = 7;
  // The required size of the cache partition, only valid for non-A/B update.
  int64 required_cache = 8;

  // True iff security patch level downgrade is permitted on this OTA.
  bool spl_downgrade = 9;
}