xref: /aosp_15_r20/prebuilts/android-emulator/linux-x86_64/lib/snapshot.proto (revision d870e0501505f2fc9999364ffe386a6b6151adc1)
1// Copyright (C) 2018 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
15syntax = "proto2";
16
17// This file must be synchronized between
18//    Emulator (branch aosp/emu-master-dev):
19//        external/qemu/android/android-emu/android/snapshot/proto/snapshot.proto
20//
21//    Android Studio (branch goog/studio-master-dev):
22//        tools/adt/idea/android/src/com/android/emulator/snapshot.proto
23//
24// If you modify one, please modify the other.
25
26package emulator_snapshot;
27
28option java_package = "com.android.emulator.snapshot";
29
30message Image {
31    enum Type {
32        IMAGE_TYPE_UNKNOWN = 0;
33        IMAGE_TYPE_KERNEL = 1;
34        IMAGE_TYPE_KERNEL_RANCHU = 2;
35        IMAGE_TYPE_SYSTEM = 3;
36        IMAGE_TYPE_SYSTEM_COPY = 4;
37        IMAGE_TYPE_DATA = 5;
38        IMAGE_TYPE_DATA_COPY = 6;
39        IMAGE_TYPE_RAMDISK = 7;
40        IMAGE_TYPE_SDCARD = 8;
41        IMAGE_TYPE_CACHE = 9;
42        IMAGE_TYPE_VENDOR = 10;
43        IMAGE_TYPE_ENCRYPTION_KEY = 11;
44    }
45
46    optional Type type = 1;
47    optional string path = 2;
48    optional bool present = 3;
49    optional int64 size = 4;
50    optional int64 modification_time = 5;
51}
52
53message Host {
54    optional string gpu_driver = 4;
55    optional int32 hypervisor = 5;
56}
57
58message Config {
59    // Features are int32, not enums here to make sure we don't have to update
60    // one more protobuf definition with every single new feature flag, even
61    // when the code doesn't really care about the actual meaning for them,
62    // only for the values.
63    repeated int32 enabled_features = 1;
64
65    // This holds the renderer; int32 for the same reason as |enabled_features|.
66    optional int32 selected_renderer = 2;
67
68    optional int32 cpu_core_count = 3;
69    optional int64 ram_size_bytes = 4;
70}
71
72message SaveStats {
73    // Type of save
74    // 0: non-incremental
75    // 1: incremental
76    optional uint32 incremental = 1;
77    // Time taken to save.
78    optional uint64 duration = 2;
79    // How many changed bytes in RAM.
80    optional uint64 ram_changed_bytes = 3;
81}
82
83message Snapshot {
84    // Update every time when introducing some breaking changes that make the
85    // previous loading code break when trying to load the new snapshot.
86    // NOTE: if the old code is fine with just skipping the new fields or not
87    //       getting the meaning of new values, |version| should remain
88    //       unchanged.
89    optional int32 version = 1;
90
91    // Purely informative: when this snapshot was created, Unix timestamp.
92    optional int64 creation_time = 2;
93
94    // List of mounted disk images used during the snapshot creation.
95    repeated Image images = 3;
96
97    // Description of the host machine properties needed to load this snapshot.
98    optional Host host = 4;
99
100    // Description of the emulator configuration needed for this snapshot.
101    // NOTE: try not to duplicate the configuration that's already in
102    //       hardware-qemu.ini; only add what's either not there or what
103    //       could've been overridden during process initialization.
104    optional Config config = 5;
105
106    // Set if the snapshot failed to load during the last attempt.
107    // Code is up to the application to define, with 0 meaning 'not failed' just
108    // in case.
109    optional int64 failed_to_load_reason_code = 7;
110
111    // Set if data image is mounted.
112    // User build and userdebug build mount data partition at different time.
113    // But it should be done before boot finished, so this field is very likely
114    // to be true.
115    // We snapshot it here just in case someday we support snapshot during
116    // booting.
117    optional bool guest_data_partition_mounted = 8;
118
119    // Emulator rotation angle, in right angles (e.g. 1 is 90 degrees, 2 is 180
120    // etc).
121    optional int32 rotation = 9;
122
123    // Number of invalid loads / crashes that happened under this snapshot.
124    optional int32 invalid_loads = 10;
125
126    // Number of successful loads.
127    optional int32 successful_loads = 11;
128
129    // The name given to the snapshot by the user. Independent of the
130    // file name.
131    optional string logical_name = 12;
132
133    // The file name of this snapshot's parent. The parent is the
134    // snapshot that was loaded into the AVD prior to this snapshot
135    // being taken
136    optional string parent = 13;
137
138    // Arbitrary description added by the user
139    optional string description = 14;
140
141    // Record of save stats.
142    repeated SaveStats save_stats = 15;
143
144    // Folded state.
145    optional bool folded = 16;
146
147    // Emulator boot parameters
148    repeated string launch_parameters = 17;
149
150    // Emulator build ID
151    optional string emulator_build_id = 18;
152
153    // System image build ID
154    optional string system_image_build_id = 19;
155
156    // True if emulator was built with gfxstream backend
157    optional bool gfxstream = 20;
158
159    // resizable config
160    optional int32 resizable_display = 21;
161}
162