android-env 1.2.1__py3-none-any.whl → 1.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. android_env/__init__.py +1 -1
  2. android_env/components/__init__.py +1 -1
  3. android_env/components/a11y/__init__.py +15 -0
  4. android_env/components/a11y/a11y_events.py +118 -0
  5. android_env/components/a11y/a11y_events_test.py +173 -0
  6. android_env/components/a11y/a11y_forests.py +128 -0
  7. android_env/components/a11y/a11y_forests_test.py +237 -0
  8. android_env/components/a11y/a11y_servicer.py +199 -0
  9. android_env/components/a11y/a11y_servicer_test.py +224 -0
  10. android_env/components/action_fns.py +132 -0
  11. android_env/components/action_fns_test.py +227 -0
  12. android_env/components/action_type.py +26 -3
  13. android_env/components/adb_call_parser.py +239 -196
  14. android_env/components/adb_call_parser_test.py +179 -209
  15. android_env/components/adb_controller.py +90 -52
  16. android_env/components/adb_controller_test.py +187 -16
  17. android_env/components/adb_log_stream.py +17 -5
  18. android_env/components/adb_log_stream_test.py +17 -3
  19. android_env/components/app_screen_checker.py +17 -15
  20. android_env/components/app_screen_checker_test.py +7 -8
  21. android_env/components/config_classes.py +203 -0
  22. android_env/components/coordinator.py +102 -338
  23. android_env/components/coordinator_test.py +59 -199
  24. android_env/components/device_settings.py +174 -0
  25. android_env/components/device_settings_test.py +228 -0
  26. android_env/components/dumpsys_thread.py +3 -4
  27. android_env/components/dumpsys_thread_test.py +1 -1
  28. android_env/components/errors.py +52 -10
  29. android_env/components/errors_test.py +110 -0
  30. android_env/components/log_stream.py +7 -5
  31. android_env/components/log_stream_test.py +1 -1
  32. android_env/components/logcat_thread.py +9 -8
  33. android_env/components/logcat_thread_test.py +3 -4
  34. android_env/components/{utils.py → pixel_fns.py} +20 -20
  35. android_env/components/{utils_test.py → pixel_fns_test.py} +20 -15
  36. android_env/components/setup_step_interpreter.py +47 -39
  37. android_env/components/setup_step_interpreter_test.py +4 -4
  38. android_env/components/simulators/__init__.py +1 -1
  39. android_env/components/simulators/base_simulator.py +116 -44
  40. android_env/components/simulators/base_simulator_test.py +131 -9
  41. android_env/components/simulators/emulator/__init__.py +1 -1
  42. android_env/components/simulators/emulator/emulator_launcher.py +67 -77
  43. android_env/components/simulators/emulator/emulator_launcher_test.py +153 -49
  44. android_env/components/simulators/emulator/emulator_simulator.py +276 -95
  45. android_env/components/simulators/emulator/emulator_simulator_test.py +314 -89
  46. android_env/components/simulators/fake/__init__.py +1 -1
  47. android_env/components/simulators/fake/fake_simulator.py +17 -25
  48. android_env/components/simulators/fake/fake_simulator_test.py +29 -12
  49. android_env/components/specs.py +18 -28
  50. android_env/components/specs_test.py +1 -44
  51. android_env/components/task_manager.py +48 -48
  52. android_env/components/task_manager_test.py +71 -60
  53. android_env/env_interface.py +37 -23
  54. android_env/environment.py +83 -51
  55. android_env/environment_test.py +68 -29
  56. android_env/loader.py +57 -43
  57. android_env/loader_test.py +115 -35
  58. android_env/proto/__init__.py +1 -1
  59. android_env/proto/a11y/__init__.py +15 -0
  60. android_env/proto/a11y/a11y.proto +75 -0
  61. android_env/proto/a11y/a11y_pb2.py +54 -0
  62. android_env/proto/a11y/a11y_pb2.pyi +49 -0
  63. android_env/proto/a11y/a11y_pb2_grpc.py +202 -0
  64. android_env/proto/a11y/android_accessibility_action.proto +32 -0
  65. android_env/proto/a11y/android_accessibility_action_pb2.py +37 -0
  66. android_env/proto/a11y/android_accessibility_action_pb2.pyi +13 -0
  67. android_env/proto/a11y/android_accessibility_action_pb2_grpc.py +24 -0
  68. android_env/proto/a11y/android_accessibility_forest.proto +29 -0
  69. android_env/proto/a11y/android_accessibility_forest_pb2.py +38 -0
  70. android_env/proto/a11y/android_accessibility_forest_pb2.pyi +13 -0
  71. android_env/proto/a11y/android_accessibility_forest_pb2_grpc.py +24 -0
  72. android_env/proto/a11y/android_accessibility_node_info.proto +122 -0
  73. android_env/proto/a11y/android_accessibility_node_info_clickable_span.proto +49 -0
  74. android_env/proto/a11y/android_accessibility_node_info_clickable_span_pb2.py +39 -0
  75. android_env/proto/a11y/android_accessibility_node_info_clickable_span_pb2.pyi +28 -0
  76. android_env/proto/a11y/android_accessibility_node_info_clickable_span_pb2_grpc.py +24 -0
  77. android_env/proto/a11y/android_accessibility_node_info_pb2.py +42 -0
  78. android_env/proto/a11y/android_accessibility_node_info_pb2.pyi +75 -0
  79. android_env/proto/a11y/android_accessibility_node_info_pb2_grpc.py +24 -0
  80. android_env/proto/a11y/android_accessibility_tree.proto +29 -0
  81. android_env/proto/a11y/android_accessibility_tree_pb2.py +38 -0
  82. android_env/proto/a11y/android_accessibility_tree_pb2.pyi +13 -0
  83. android_env/proto/a11y/android_accessibility_tree_pb2_grpc.py +24 -0
  84. android_env/proto/a11y/android_accessibility_window_info.proto +84 -0
  85. android_env/proto/a11y/android_accessibility_window_info_pb2.py +41 -0
  86. android_env/proto/a11y/android_accessibility_window_info_pb2.pyi +48 -0
  87. android_env/proto/a11y/android_accessibility_window_info_pb2_grpc.py +24 -0
  88. android_env/proto/a11y/rect.proto +30 -0
  89. android_env/proto/a11y/rect_pb2.py +37 -0
  90. android_env/proto/a11y/rect_pb2.pyi +17 -0
  91. android_env/proto/a11y/rect_pb2_grpc.py +24 -0
  92. android_env/proto/adb.proto +17 -6
  93. android_env/proto/adb_pb2.py +120 -107
  94. android_env/proto/adb_pb2.pyi +396 -0
  95. android_env/proto/adb_pb2_grpc.py +20 -0
  96. android_env/proto/emulator_controller.proto +68 -63
  97. android_env/proto/emulator_controller_pb2.py +142 -131
  98. android_env/proto/emulator_controller_pb2.pyi +672 -0
  99. android_env/proto/emulator_controller_pb2_grpc.py +505 -142
  100. android_env/proto/snapshot.proto +169 -0
  101. android_env/proto/snapshot_pb2.py +47 -0
  102. android_env/proto/snapshot_pb2.pyi +117 -0
  103. android_env/proto/snapshot_pb2_grpc.py +24 -0
  104. android_env/proto/snapshot_service.proto +289 -0
  105. android_env/proto/snapshot_service_pb2.py +54 -0
  106. android_env/proto/snapshot_service_pb2.pyi +86 -0
  107. android_env/proto/snapshot_service_pb2_grpc.py +487 -0
  108. android_env/proto/state.proto +63 -0
  109. android_env/proto/state_pb2.py +63 -0
  110. android_env/proto/state_pb2.pyi +85 -0
  111. android_env/proto/state_pb2_grpc.py +24 -0
  112. android_env/proto/task.proto +5 -1
  113. android_env/proto/task_pb2.py +42 -31
  114. android_env/proto/task_pb2.pyi +160 -0
  115. android_env/proto/task_pb2_grpc.py +20 -0
  116. android_env/wrappers/__init__.py +1 -1
  117. android_env/wrappers/a11y_grpc_wrapper.py +500 -0
  118. android_env/wrappers/a11y_grpc_wrapper_test.py +849 -0
  119. android_env/wrappers/base_wrapper.py +34 -13
  120. android_env/wrappers/base_wrapper_test.py +22 -16
  121. android_env/wrappers/discrete_action_wrapper.py +18 -17
  122. android_env/wrappers/discrete_action_wrapper_test.py +4 -4
  123. android_env/wrappers/flat_interface_wrapper.py +5 -5
  124. android_env/wrappers/flat_interface_wrapper_test.py +7 -11
  125. android_env/wrappers/float_pixels_wrapper.py +9 -10
  126. android_env/wrappers/float_pixels_wrapper_test.py +3 -3
  127. android_env/wrappers/gym_wrapper.py +19 -13
  128. android_env/wrappers/gym_wrapper_test.py +3 -5
  129. android_env/wrappers/image_rescale_wrapper.py +18 -21
  130. android_env/wrappers/image_rescale_wrapper_test.py +25 -37
  131. android_env/wrappers/last_action_wrapper.py +16 -13
  132. android_env/wrappers/last_action_wrapper_test.py +44 -51
  133. android_env/wrappers/rate_limit_wrapper.py +6 -3
  134. android_env/wrappers/rate_limit_wrapper_test.py +22 -1
  135. android_env/wrappers/tap_action_wrapper.py +16 -17
  136. android_env/wrappers/tap_action_wrapper_test.py +51 -16
  137. {android_env-1.2.1.dist-info → android_env-1.2.3.dist-info}/METADATA +14 -18
  138. android_env-1.2.3.dist-info/RECORD +141 -0
  139. {android_env-1.2.1.dist-info → android_env-1.2.3.dist-info}/WHEEL +1 -1
  140. android_env/proto/raw_observation.proto +0 -39
  141. android_env/proto/raw_observation_pb2.py +0 -27
  142. android_env/proto/raw_observation_pb2_grpc.py +0 -4
  143. android_env-1.2.1.dist-info/RECORD +0 -81
  144. {android_env-1.2.1.dist-info → android_env-1.2.3.dist-info/licenses}/LICENSE +0 -0
  145. {android_env-1.2.1.dist-info → android_env-1.2.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,169 @@
1
+ // Copyright 2024 DeepMind Technologies Limited.
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
+
15
+ // Copyright (C) 2018 The Android Open Source Project
16
+ //
17
+ // Licensed under the Apache License, Version 2.0 (the "License");
18
+ // you may not use this file except in compliance with the License.
19
+ // You may obtain a copy of the License at
20
+ //
21
+ // http://www.apache.org/licenses/LICENSE-2.0
22
+ //
23
+ // Unless required by applicable law or agreed to in writing, software
24
+ // distributed under the License is distributed on an "AS IS" BASIS,
25
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ // See the License for the specific language governing permissions and
27
+ // limitations under the License.
28
+
29
+ syntax = "proto2";
30
+
31
+ // This file must be synchronized between
32
+ // Emulator (branch aosp/emu-master-dev):
33
+ // external/qemu/android/android-emu/android/snapshot/proto/snapshot.proto
34
+ //
35
+ // Android Studio (branch goog/studio-master-dev):
36
+ // tools/adt/idea/android/src/com/android/emulator/snapshot.proto
37
+ //
38
+ // If you modify one, please modify the other.
39
+
40
+ package emulator_snapshot;
41
+
42
+ option java_package = "com.android.emulator.snapshot";
43
+
44
+ message Image {
45
+ enum Type {
46
+ IMAGE_TYPE_UNKNOWN = 0;
47
+ IMAGE_TYPE_KERNEL = 1;
48
+ IMAGE_TYPE_KERNEL_RANCHU = 2;
49
+ IMAGE_TYPE_SYSTEM = 3;
50
+ IMAGE_TYPE_SYSTEM_COPY = 4;
51
+ IMAGE_TYPE_DATA = 5;
52
+ IMAGE_TYPE_DATA_COPY = 6;
53
+ IMAGE_TYPE_RAMDISK = 7;
54
+ IMAGE_TYPE_SDCARD = 8;
55
+ IMAGE_TYPE_CACHE = 9;
56
+ IMAGE_TYPE_VENDOR = 10;
57
+ IMAGE_TYPE_ENCRYPTION_KEY = 11;
58
+ }
59
+
60
+ optional Type type = 1;
61
+ optional string path = 2;
62
+ optional bool present = 3;
63
+ optional int64 size = 4;
64
+ optional int64 modification_time = 5;
65
+ }
66
+
67
+ message Host {
68
+ optional string gpu_driver = 4;
69
+ optional int32 hypervisor = 5;
70
+ }
71
+
72
+ message Config {
73
+ // Features are int32, not enums here to make sure we don't have to update
74
+ // one more protobuf definition with every single new feature flag, even
75
+ // when the code doesn't really care about the actual meaning for them,
76
+ // only for the values.
77
+ repeated int32 enabled_features = 1;
78
+
79
+ // This holds the renderer; int32 for the same reason as |enabled_features|.
80
+ optional int32 selected_renderer = 2;
81
+
82
+ optional int32 cpu_core_count = 3;
83
+ optional int64 ram_size_bytes = 4;
84
+ }
85
+
86
+ message SaveStats {
87
+ // Type of save
88
+ // 0: non-incremental
89
+ // 1: incremental
90
+ optional uint32 incremental = 1;
91
+ // Time taken to save.
92
+ optional uint64 duration = 2;
93
+ // How many changed bytes in RAM.
94
+ optional uint64 ram_changed_bytes = 3;
95
+ }
96
+
97
+ message Snapshot {
98
+ // Update every time when introducing some breaking changes that make the
99
+ // previous loading code break when trying to load the new snapshot.
100
+ // NOTE: if the old code is fine with just skipping the new fields or not
101
+ // getting the meaning of new values, |version| should remain
102
+ // unchanged.
103
+ optional int32 version = 1;
104
+
105
+ // Purely informative: when this snapshot was created, Unix timestamp.
106
+ optional int64 creation_time = 2;
107
+
108
+ // list of mounted disk images used during the snapshot creation.
109
+ repeated Image images = 3;
110
+
111
+ // Description of the host machine properties needed to load this snapshot.
112
+ optional Host host = 4;
113
+
114
+ // Description of the emulator configuration needed for this snapshot.
115
+ // NOTE: try not to duplicate the configuration that's already in
116
+ // hardware-qemu.ini; only add what's either not there or what
117
+ // could've been overridden during process initialization.
118
+ optional Config config = 5;
119
+
120
+ // Set if the snapshot failed to load during the last attempt.
121
+ // Code is up to the application to define, with 0 meaning 'not failed' just
122
+ // in case.
123
+ optional int64 failed_to_load_reason_code = 7;
124
+
125
+ // Set if data image is mounted.
126
+ // User build and userdebug build mount data partition at different time.
127
+ // But it should be done before boot finished, so this field is very likely
128
+ // to be true.
129
+ // We snapshot it here just in case someday we support snapshot during
130
+ // booting.
131
+ optional bool guest_data_partition_mounted = 8;
132
+
133
+ // Emulator rotation angle, in right angles (e.g. 1 is 90 degrees, 2 is 180
134
+ // etc).
135
+ optional int32 rotation = 9;
136
+
137
+ // Number of invalid loads / crashes that happened under this snapshot.
138
+ optional int32 invalid_loads = 10;
139
+
140
+ // Number of successful loads.
141
+ optional int32 successful_loads = 11;
142
+
143
+ // The name given to the snapshot by the user. Independent of the
144
+ // file name.
145
+ optional string logical_name = 12;
146
+
147
+ // The file name of this snapshot's parent. The parent is the
148
+ // snapshot that was loaded into the AVD prior to this snapshot
149
+ // being taken
150
+ optional string parent = 13;
151
+
152
+ // Arbitrary description added by the user
153
+ optional string description = 14;
154
+
155
+ // Record of save stats.
156
+ repeated SaveStats save_stats = 15;
157
+
158
+ // Folded state.
159
+ optional bool folded = 16;
160
+
161
+ // Emulator boot parameters
162
+ repeated string launch_parameters = 17;
163
+
164
+ // Emulator build ID
165
+ optional string emulator_build_id = 18;
166
+
167
+ // System image build ID
168
+ optional string system_image_build_id = 19;
169
+ }
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: android_env/proto/snapshot.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 5,
15
+ 29,
16
+ 0,
17
+ '',
18
+ 'android_env/proto/snapshot.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n android_env/proto/snapshot.proto\x12\x11\x65mulator_snapshot\"\xaf\x03\n\x05Image\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.emulator_snapshot.Image.Type\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\x0f\n\x07present\x18\x03 \x01(\x08\x12\x0c\n\x04size\x18\x04 \x01(\x03\x12\x19\n\x11modification_time\x18\x05 \x01(\x03\"\xb0\x02\n\x04Type\x12\x16\n\x12IMAGE_TYPE_UNKNOWN\x10\x00\x12\x15\n\x11IMAGE_TYPE_KERNEL\x10\x01\x12\x1c\n\x18IMAGE_TYPE_KERNEL_RANCHU\x10\x02\x12\x15\n\x11IMAGE_TYPE_SYSTEM\x10\x03\x12\x1a\n\x16IMAGE_TYPE_SYSTEM_COPY\x10\x04\x12\x13\n\x0fIMAGE_TYPE_DATA\x10\x05\x12\x18\n\x14IMAGE_TYPE_DATA_COPY\x10\x06\x12\x16\n\x12IMAGE_TYPE_RAMDISK\x10\x07\x12\x15\n\x11IMAGE_TYPE_SDCARD\x10\x08\x12\x14\n\x10IMAGE_TYPE_CACHE\x10\t\x12\x15\n\x11IMAGE_TYPE_VENDOR\x10\n\x12\x1d\n\x19IMAGE_TYPE_ENCRYPTION_KEY\x10\x0b\".\n\x04Host\x12\x12\n\ngpu_driver\x18\x04 \x01(\t\x12\x12\n\nhypervisor\x18\x05 \x01(\x05\"m\n\x06\x43onfig\x12\x18\n\x10\x65nabled_features\x18\x01 \x03(\x05\x12\x19\n\x11selected_renderer\x18\x02 \x01(\x05\x12\x16\n\x0e\x63pu_core_count\x18\x03 \x01(\x05\x12\x16\n\x0eram_size_bytes\x18\x04 \x01(\x03\"M\n\tSaveStats\x12\x13\n\x0bincremental\x18\x01 \x01(\r\x12\x10\n\x08\x64uration\x18\x02 \x01(\x04\x12\x19\n\x11ram_changed_bytes\x18\x03 \x01(\x04\"\x8d\x04\n\x08Snapshot\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x15\n\rcreation_time\x18\x02 \x01(\x03\x12(\n\x06images\x18\x03 \x03(\x0b\x32\x18.emulator_snapshot.Image\x12%\n\x04host\x18\x04 \x01(\x0b\x32\x17.emulator_snapshot.Host\x12)\n\x06\x63onfig\x18\x05 \x01(\x0b\x32\x19.emulator_snapshot.Config\x12\"\n\x1a\x66\x61iled_to_load_reason_code\x18\x07 \x01(\x03\x12$\n\x1cguest_data_partition_mounted\x18\x08 \x01(\x08\x12\x10\n\x08rotation\x18\t \x01(\x05\x12\x15\n\rinvalid_loads\x18\n \x01(\x05\x12\x18\n\x10successful_loads\x18\x0b \x01(\x05\x12\x14\n\x0clogical_name\x18\x0c \x01(\t\x12\x0e\n\x06parent\x18\r \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x0e \x01(\t\x12\x30\n\nsave_stats\x18\x0f \x03(\x0b\x32\x1c.emulator_snapshot.SaveStats\x12\x0e\n\x06\x66olded\x18\x10 \x01(\x08\x12\x19\n\x11launch_parameters\x18\x11 \x03(\t\x12\x19\n\x11\x65mulator_build_id\x18\x12 \x01(\t\x12\x1d\n\x15system_image_build_id\x18\x13 \x01(\tB\x1f\n\x1d\x63om.android.emulator.snapshot')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'android_env.proto.snapshot_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'\n\035com.android.emulator.snapshot'
35
+ _globals['_IMAGE']._serialized_start=56
36
+ _globals['_IMAGE']._serialized_end=487
37
+ _globals['_IMAGE_TYPE']._serialized_start=183
38
+ _globals['_IMAGE_TYPE']._serialized_end=487
39
+ _globals['_HOST']._serialized_start=489
40
+ _globals['_HOST']._serialized_end=535
41
+ _globals['_CONFIG']._serialized_start=537
42
+ _globals['_CONFIG']._serialized_end=646
43
+ _globals['_SAVESTATS']._serialized_start=648
44
+ _globals['_SAVESTATS']._serialized_end=725
45
+ _globals['_SNAPSHOT']._serialized_start=728
46
+ _globals['_SNAPSHOT']._serialized_end=1253
47
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,117 @@
1
+ from google.protobuf.internal import containers as _containers
2
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
3
+ from google.protobuf import descriptor as _descriptor
4
+ from google.protobuf import message as _message
5
+ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
6
+
7
+ DESCRIPTOR: _descriptor.FileDescriptor
8
+
9
+ class Image(_message.Message):
10
+ __slots__ = ("type", "path", "present", "size", "modification_time")
11
+ class Type(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
12
+ __slots__ = ()
13
+ IMAGE_TYPE_UNKNOWN: _ClassVar[Image.Type]
14
+ IMAGE_TYPE_KERNEL: _ClassVar[Image.Type]
15
+ IMAGE_TYPE_KERNEL_RANCHU: _ClassVar[Image.Type]
16
+ IMAGE_TYPE_SYSTEM: _ClassVar[Image.Type]
17
+ IMAGE_TYPE_SYSTEM_COPY: _ClassVar[Image.Type]
18
+ IMAGE_TYPE_DATA: _ClassVar[Image.Type]
19
+ IMAGE_TYPE_DATA_COPY: _ClassVar[Image.Type]
20
+ IMAGE_TYPE_RAMDISK: _ClassVar[Image.Type]
21
+ IMAGE_TYPE_SDCARD: _ClassVar[Image.Type]
22
+ IMAGE_TYPE_CACHE: _ClassVar[Image.Type]
23
+ IMAGE_TYPE_VENDOR: _ClassVar[Image.Type]
24
+ IMAGE_TYPE_ENCRYPTION_KEY: _ClassVar[Image.Type]
25
+ IMAGE_TYPE_UNKNOWN: Image.Type
26
+ IMAGE_TYPE_KERNEL: Image.Type
27
+ IMAGE_TYPE_KERNEL_RANCHU: Image.Type
28
+ IMAGE_TYPE_SYSTEM: Image.Type
29
+ IMAGE_TYPE_SYSTEM_COPY: Image.Type
30
+ IMAGE_TYPE_DATA: Image.Type
31
+ IMAGE_TYPE_DATA_COPY: Image.Type
32
+ IMAGE_TYPE_RAMDISK: Image.Type
33
+ IMAGE_TYPE_SDCARD: Image.Type
34
+ IMAGE_TYPE_CACHE: Image.Type
35
+ IMAGE_TYPE_VENDOR: Image.Type
36
+ IMAGE_TYPE_ENCRYPTION_KEY: Image.Type
37
+ TYPE_FIELD_NUMBER: _ClassVar[int]
38
+ PATH_FIELD_NUMBER: _ClassVar[int]
39
+ PRESENT_FIELD_NUMBER: _ClassVar[int]
40
+ SIZE_FIELD_NUMBER: _ClassVar[int]
41
+ MODIFICATION_TIME_FIELD_NUMBER: _ClassVar[int]
42
+ type: Image.Type
43
+ path: str
44
+ present: bool
45
+ size: int
46
+ modification_time: int
47
+ def __init__(self, type: _Optional[_Union[Image.Type, str]] = ..., path: _Optional[str] = ..., present: bool = ..., size: _Optional[int] = ..., modification_time: _Optional[int] = ...) -> None: ...
48
+
49
+ class Host(_message.Message):
50
+ __slots__ = ("gpu_driver", "hypervisor")
51
+ GPU_DRIVER_FIELD_NUMBER: _ClassVar[int]
52
+ HYPERVISOR_FIELD_NUMBER: _ClassVar[int]
53
+ gpu_driver: str
54
+ hypervisor: int
55
+ def __init__(self, gpu_driver: _Optional[str] = ..., hypervisor: _Optional[int] = ...) -> None: ...
56
+
57
+ class Config(_message.Message):
58
+ __slots__ = ("enabled_features", "selected_renderer", "cpu_core_count", "ram_size_bytes")
59
+ ENABLED_FEATURES_FIELD_NUMBER: _ClassVar[int]
60
+ SELECTED_RENDERER_FIELD_NUMBER: _ClassVar[int]
61
+ CPU_CORE_COUNT_FIELD_NUMBER: _ClassVar[int]
62
+ RAM_SIZE_BYTES_FIELD_NUMBER: _ClassVar[int]
63
+ enabled_features: _containers.RepeatedScalarFieldContainer[int]
64
+ selected_renderer: int
65
+ cpu_core_count: int
66
+ ram_size_bytes: int
67
+ def __init__(self, enabled_features: _Optional[_Iterable[int]] = ..., selected_renderer: _Optional[int] = ..., cpu_core_count: _Optional[int] = ..., ram_size_bytes: _Optional[int] = ...) -> None: ...
68
+
69
+ class SaveStats(_message.Message):
70
+ __slots__ = ("incremental", "duration", "ram_changed_bytes")
71
+ INCREMENTAL_FIELD_NUMBER: _ClassVar[int]
72
+ DURATION_FIELD_NUMBER: _ClassVar[int]
73
+ RAM_CHANGED_BYTES_FIELD_NUMBER: _ClassVar[int]
74
+ incremental: int
75
+ duration: int
76
+ ram_changed_bytes: int
77
+ def __init__(self, incremental: _Optional[int] = ..., duration: _Optional[int] = ..., ram_changed_bytes: _Optional[int] = ...) -> None: ...
78
+
79
+ class Snapshot(_message.Message):
80
+ __slots__ = ("version", "creation_time", "images", "host", "config", "failed_to_load_reason_code", "guest_data_partition_mounted", "rotation", "invalid_loads", "successful_loads", "logical_name", "parent", "description", "save_stats", "folded", "launch_parameters", "emulator_build_id", "system_image_build_id")
81
+ VERSION_FIELD_NUMBER: _ClassVar[int]
82
+ CREATION_TIME_FIELD_NUMBER: _ClassVar[int]
83
+ IMAGES_FIELD_NUMBER: _ClassVar[int]
84
+ HOST_FIELD_NUMBER: _ClassVar[int]
85
+ CONFIG_FIELD_NUMBER: _ClassVar[int]
86
+ FAILED_TO_LOAD_REASON_CODE_FIELD_NUMBER: _ClassVar[int]
87
+ GUEST_DATA_PARTITION_MOUNTED_FIELD_NUMBER: _ClassVar[int]
88
+ ROTATION_FIELD_NUMBER: _ClassVar[int]
89
+ INVALID_LOADS_FIELD_NUMBER: _ClassVar[int]
90
+ SUCCESSFUL_LOADS_FIELD_NUMBER: _ClassVar[int]
91
+ LOGICAL_NAME_FIELD_NUMBER: _ClassVar[int]
92
+ PARENT_FIELD_NUMBER: _ClassVar[int]
93
+ DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
94
+ SAVE_STATS_FIELD_NUMBER: _ClassVar[int]
95
+ FOLDED_FIELD_NUMBER: _ClassVar[int]
96
+ LAUNCH_PARAMETERS_FIELD_NUMBER: _ClassVar[int]
97
+ EMULATOR_BUILD_ID_FIELD_NUMBER: _ClassVar[int]
98
+ SYSTEM_IMAGE_BUILD_ID_FIELD_NUMBER: _ClassVar[int]
99
+ version: int
100
+ creation_time: int
101
+ images: _containers.RepeatedCompositeFieldContainer[Image]
102
+ host: Host
103
+ config: Config
104
+ failed_to_load_reason_code: int
105
+ guest_data_partition_mounted: bool
106
+ rotation: int
107
+ invalid_loads: int
108
+ successful_loads: int
109
+ logical_name: str
110
+ parent: str
111
+ description: str
112
+ save_stats: _containers.RepeatedCompositeFieldContainer[SaveStats]
113
+ folded: bool
114
+ launch_parameters: _containers.RepeatedScalarFieldContainer[str]
115
+ emulator_build_id: str
116
+ system_image_build_id: str
117
+ def __init__(self, version: _Optional[int] = ..., creation_time: _Optional[int] = ..., images: _Optional[_Iterable[_Union[Image, _Mapping]]] = ..., host: _Optional[_Union[Host, _Mapping]] = ..., config: _Optional[_Union[Config, _Mapping]] = ..., failed_to_load_reason_code: _Optional[int] = ..., guest_data_partition_mounted: bool = ..., rotation: _Optional[int] = ..., invalid_loads: _Optional[int] = ..., successful_loads: _Optional[int] = ..., logical_name: _Optional[str] = ..., parent: _Optional[str] = ..., description: _Optional[str] = ..., save_stats: _Optional[_Iterable[_Union[SaveStats, _Mapping]]] = ..., folded: bool = ..., launch_parameters: _Optional[_Iterable[str]] = ..., emulator_build_id: _Optional[str] = ..., system_image_build_id: _Optional[str] = ...) -> None: ...
@@ -0,0 +1,24 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+
7
+ GRPC_GENERATED_VERSION = '1.71.0'
8
+ GRPC_VERSION = grpc.__version__
9
+ _version_not_supported = False
10
+
11
+ try:
12
+ from grpc._utilities import first_version_is_lower
13
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
14
+ except ImportError:
15
+ _version_not_supported = True
16
+
17
+ if _version_not_supported:
18
+ raise RuntimeError(
19
+ f'The grpc package installed is at version {GRPC_VERSION},'
20
+ + f' but the generated code in android_env/proto/snapshot_pb2_grpc.py depends on'
21
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
22
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
23
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
24
+ )
@@ -0,0 +1,289 @@
1
+ // Copyright 2024 DeepMind Technologies Limited.
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
+
15
+ // Copyright (C) 2018 The Android Open Source Project
16
+ //
17
+ // Licensed under the Apache License, Version 2.0 (the "License");
18
+ // you may not use this file except in compliance with the License.
19
+ // You may obtain a copy of the License at
20
+ //
21
+ // http://www.apache.org/licenses/LICENSE-2.0
22
+ //
23
+ // Unless required by applicable law or agreed to in writing, software
24
+ // distributed under the License is distributed on an "AS IS" BASIS,
25
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ // See the License for the specific language governing permissions and
27
+ // limitations under the License.
28
+
29
+ // Note that if you add/remove methods in this file you must update
30
+ // the metrics sql as well by running ./android/scripts/gen-grpc-sql.py
31
+ //
32
+ // Please group deleted methods in a block including the date (MM/DD/YY)
33
+ // it was removed. This enables us to easily keep metrics around after removal
34
+ //
35
+ // list of deleted methods
36
+ // rpc iWasDeleted (03/12/12)
37
+ // ...
38
+ syntax = "proto3";
39
+
40
+ package android.emulation.control;
41
+
42
+ import "android_env/proto/snapshot.proto";
43
+
44
+ option java_multiple_files = true;
45
+ option java_package = "com.android.emulator.control";
46
+ option objc_class_prefix = "AEC";
47
+
48
+ // The SnapshotService enables you to list, insert, store, and retrieve
49
+ // snapshots.
50
+ //
51
+ // Currently there are two types of snapshots:
52
+ //
53
+ // - Local (default): These are snapshots that are created locally. They are
54
+ // stored internally inside qcow2 files and are very efficient. These are
55
+ // the snapshots usually created by interacting with the UI.
56
+ //
57
+ // - Remote: These are snapshots that have been exported at a certain point.
58
+ // an exported snapshot is normalized (completely self contained) and
59
+ // can be imported into an emulator with a similar hardware configuration.
60
+ //
61
+ // Currently the emulator has limited support for importing snapshots:
62
+ // - Once an imported snapshot has been loaded into an emulator it is no longer
63
+ // possible to create new snapshots.
64
+ // - The hardware configuration of the emulator your are pushing a snapshot to
65
+ // must match (or be very similar) to the one you pulled the snapshot from.
66
+ //
67
+ // For example do not expect to be able to restore a snapshot on created on an
68
+ // Intel cpu on an AMD cpu.
69
+ service SnapshotService {
70
+ // Lists all the snapshots, filtered by the given query, that are stored
71
+ // locally for the currently running avd. This includes all the snapshots that
72
+ // were imported (pushed) into this emulator.
73
+ //
74
+ // Returns a list of snapshot_id's and associated details that describes
75
+ // the hardware configuration, logical name, etc of the snapshot.
76
+ rpc ListSnapshots(SnapshotFilter) returns (SnapshotList) {}
77
+
78
+ // Pulls down the snapshot stored inside the AVD as a tar.gz/tar stream
79
+ // This will normalize the snapshot, all relevant data to push a snapshot
80
+ // into a similar emulator will be placed inside the tar file.
81
+ //
82
+ // Pulling down a snapshot will pause the emulator until the snapshots
83
+ // are rebased and ready for exporting. Once the snapshot is rebased
84
+ // the emulator will continue and downloading should commence.
85
+ //
86
+ // Note that pulling .gz stream is slow.
87
+ //
88
+ // You must provide the snapshot_id and (desired) format.
89
+ //
90
+ // If SnapshotPackage.path is set, the gRPC service will directly write the
91
+ // exported snapshot to SnapshotPackage.path without streaming, which is
92
+ // usually significantly faster. It would require emulator to have direct
93
+ // access to SnapshotPackage.path, which usually means it can only be used
94
+ // when pulling from a local emulator.
95
+ rpc PullSnapshot(SnapshotPackage) returns (stream SnapshotPackage) {}
96
+
97
+ // Push a tar.gz stream contain the snapshot. The tar file should
98
+ // be a snapshot that was exported through the PullSnapshot in the past.
99
+ // The emulator will try to import the snapshot. The hardware configuration
100
+ // of the current emulator should match the one used for pulling.
101
+ //
102
+ // A detailed description of the snapshot (emulator_snapshot.Snapshot)
103
+ // is stored in the snapshot.pb file inside the tar.
104
+ //
105
+ // You must provide the snapshot_id and format in the first message.
106
+ // Will return success and a possible error message when a failure occurs.
107
+ //
108
+ // If SnapshotPackage.path is set, the gRPC service will directly unzip the
109
+ // exported snapshot from SnapshotPackage.path without streaming, which is
110
+ // usually significantly faster. It would require emulator to have direct
111
+ // access to SnapshotPackage.path, which usually means it can only be used
112
+ // when pushing to a local emulator.
113
+ rpc PushSnapshot(stream SnapshotPackage) returns (SnapshotPackage) {}
114
+
115
+ // Loads the given snapshot inside the emulator and activates it.
116
+ // The device will be in the state as it was when the snapshot was created.
117
+ //
118
+ // You will no longer be able to call Save if this was an imported
119
+ // snapshot that was pushed into this emulator.
120
+ //
121
+ // You must provide the snapshot_id to indicate which snapshot to load
122
+ // Will return success and a possible error message when a failure occurs.
123
+ rpc LoadSnapshot(SnapshotPackage) returns (SnapshotPackage) {}
124
+
125
+ // Creates as a snapshot of the current state of the emulator.
126
+ // You can only save a snapshot if you never activated (Load) an imported
127
+ // snapshot (Push).
128
+ //
129
+ // For example:
130
+ // - PushSnapshot("some_snap.tar.gz");
131
+ // - LoadSnapshot("some_snap");
132
+ // - SaveSnapshot("same_newer_snap"); // <--- Will currently fail.
133
+ //
134
+ // You can provide the snapshot_id to indicate the name used for storing.
135
+ // Will return success and a possible error message when a failure occurs.
136
+ rpc SaveSnapshot(SnapshotPackage) returns (SnapshotPackage) {}
137
+
138
+ // Deletes the snapshot with the given snapshot_id from the avd.
139
+ //
140
+ // You must provide the snapshot_id to indicate which snapshot to delete.
141
+ // Will return success and a possible error message when a failure occurs.
142
+ rpc DeleteSnapshot(SnapshotPackage) returns (SnapshotPackage) {}
143
+
144
+ // Tracks the given process for automated snapshot creation in case of
145
+ // assert failures.
146
+ //
147
+ // Will return success and a possible error message when a failure occurs.
148
+ // The snapshot_id field will contain the name of the snapshot that
149
+ // will be created. The pid field will contain the process id that is
150
+ // being tracked.
151
+ rpc TrackProcess(IceboxTarget) returns (IceboxTarget) {}
152
+ }
153
+
154
+ // Sets options for SnapshotService. Used for both request and response
155
+ // messages.
156
+ message SnapshotPackage {
157
+ enum Format {
158
+ TARGZ = 0;
159
+ TAR = 1;
160
+ DIRECTORY = 2;
161
+ }
162
+ // The identifier to the snapshot, only required for request messages. For
163
+ // streaming service, only used in the first stream message of a gRPC call
164
+ // (would be ignored in consequent stream messages of the same call).
165
+ string snapshot_id = 1;
166
+
167
+ // A stream of bytes. Encoded as a tar (possibly gzipped) file pendinf on the
168
+ // value of format.
169
+ bytes payload = 2;
170
+
171
+ // [response only] status fields, usually indicates end of transmission.
172
+ bool success = 3;
173
+ bytes err = 4;
174
+
175
+ // [request only] Format of the payload. Only used in request messages. For
176
+ // streaming service, only used in the first stream message of a gRPC call
177
+ // (would be ignored in consequent stream messages of the same call).
178
+ Format format = 5;
179
+
180
+ // [request only] Path to the snapshot package file. Only used in request
181
+ // messages.
182
+ //
183
+ // When set in a request, the PullSnapshot/PushSnapshot operation will
184
+ // directly write/read the exported snapshot in path without streaming, which
185
+ // is usually significantly faster. It would require emulator to have direct
186
+ // access to path, which usually means it can only be used with a local
187
+ // emulator.
188
+ string path = 6;
189
+ }
190
+
191
+ // A snapshot filter can be used to filter the results produced by ListSnapshots
192
+ message SnapshotFilter {
193
+ enum LoadStatus {
194
+ // Only return compatible snapshots
195
+ CompatibleOnly = 0;
196
+
197
+ // Return all snapshots.
198
+ All = 1;
199
+ }
200
+
201
+ // Filter snapshots by load status.
202
+ LoadStatus statusFilter = 1;
203
+ }
204
+
205
+ // Provides detailed information regarding the snapshot.
206
+ message SnapshotDetails {
207
+ enum LoadStatus {
208
+ // The emulator believes that the snapshot is compatible with the emulator
209
+ // that provided this information. The emulator will attempt to load this
210
+ // snapshot when requested.
211
+ //
212
+ // A snapshot is usually compatible when the following statements are true:
213
+ // - The snapshot was taken by the current emulator version. i.e.
214
+ // emulator_build_id in the details field matches the build_id of the
215
+ // emulator that provided this information.
216
+ //
217
+ // - The snapshot was taken on the current running machine, and no hardware
218
+ // changes have taken place between taking and loading the snapshot.
219
+ //
220
+ // - The avd configuration has not changed between when this snapshot was
221
+ // taken and when the snapshot was loaded.
222
+ //
223
+ // - The system images on which the avd is based have not changed.
224
+ Compatible = 0;
225
+
226
+ // The emulator will not allow loading of the snapshot, as it deems the
227
+ // snapshot to be incompatible. Loading of snapshots can be forced by
228
+ // launching the emulator with the feature "AllowSnapshotMigration" enabled.
229
+ Incompatible = 1;
230
+
231
+ // This snapshot was successfully loaded in the emulator, and was used at
232
+ // the starting point of the current running emulator. The following holds:
233
+ //
234
+ // A loaded snapshot is a compatible snapshot
235
+ // There is at most one snapshot_id that is in the "Loaded" state
236
+ Loaded = 2;
237
+ }
238
+
239
+ // The id of this snapshot. Use this id to load/delete/pull the
240
+ // snapshot.
241
+ string snapshot_id = 1;
242
+
243
+ // Detailed information about this snapshot. This contains a detailed
244
+ // hardware description of the snapshot. These details are the same
245
+ // as the "snapshot.pb" file found in an exported snapshot.
246
+ // Look at the import file for a detailed description of the available
247
+ // fields.
248
+ emulator_snapshot.Snapshot details = 2;
249
+
250
+ // Provides information about the ability to restore this snapshot.
251
+ LoadStatus status = 3;
252
+
253
+ // The size of the folder that stores required information to load a snapshot.
254
+ uint64 size = 4;
255
+ }
256
+
257
+ // A list of on snapshot details.
258
+ message SnapshotList {
259
+ repeated SnapshotDetails snapshots = 1;
260
+ }
261
+
262
+ message IceboxTarget {
263
+ // This is the process id to attach to, if this value is not set (0)
264
+ // The process name will be used instead.
265
+ int64 pid = 1;
266
+
267
+ // The process name to attach to if any, if this is not set the pid will
268
+ // be used. This is usually the application name of your application under
269
+ // test, that is passed in to the am instrument command. It is likely
270
+ // what you will find in your AndroidManifest.xml
271
+ string package_name = 2;
272
+
273
+ // The name of the snapshot that icebox will create if a snapshot is
274
+ // generated.
275
+ string snapshot_id = 3;
276
+
277
+ // [Output Only] True if icebox failed to track the given target.
278
+ bool failed = 4;
279
+
280
+ // [Output Only] Detailed error message that might provide more information.
281
+ string err = 5;
282
+
283
+ // Maximum number of snapshots the emulator can take during one Icebox run.
284
+ // Set to -1 for unlimited number of snapshots.
285
+ int32 max_snapshot_number = 6;
286
+ }
287
+
288
+ // list of deleted methods:
289
+ //