xref: /aosp_15_r20/prebuilts/android-emulator/linux-x86_64/lib/emulator_controller.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
15// Note that if you add/remove methods in this file you must update
16// the metrics sql as well ./android/scripts/gen-grpc-sql.py
17//
18// Please group deleted methods in a block including the date (MM/DD/YY)
19// it was removed. This enables us to easily keep metrics around after removal
20//
21// List of deleted methods
22// rpc iWasDeleted (03/12/12)
23// ...
24syntax = "proto3";
25
26option java_multiple_files = true;
27option java_package = "com.android.emulator.control";
28option objc_class_prefix = "AEC";
29
30package android.emulation.control;
31import "google/protobuf/empty.proto";
32
33// An EmulatorController service lets you control the emulator.
34// Note that this is currently an experimental feature, and that the
35// service definition might change without notice. Use at your own risk!
36//
37// We use the following rough conventions:
38//
39// streamXXX --> streams values XXX (usually for emulator lifetime). Values
40//               are updated as soon as they become available.
41// getXXX    --> gets a single value XXX
42// setXXX    --> sets a single value XXX, does not returning state, these
43//               usually have an observable lasting side effect.
44// sendXXX   --> send a single event XXX, possibly returning state information.
45//               android usually responds to these events.
46service EmulatorController {
47    // set/get/stream the sensor data
48    rpc streamSensor(SensorValue) returns (stream SensorValue) {}
49    rpc getSensor(SensorValue) returns (SensorValue) {}
50    rpc setSensor(SensorValue) returns (google.protobuf.Empty) {}
51
52    // set/get/stream the physical model, this is likely the one you are
53    // looking for when you wish to modify the device state.
54    rpc setPhysicalModel(PhysicalModelValue) returns (google.protobuf.Empty) {}
55    rpc getPhysicalModel(PhysicalModelValue) returns (PhysicalModelValue) {}
56    rpc streamPhysicalModel(PhysicalModelValue)
57            returns (stream PhysicalModelValue) {}
58
59    // Atomically set/get the current primary clipboard data.
60    // Note that a call to setClipboard will result in an immediate
61    // event for those who made a call to streamClipboard and are
62    // on a different channel than the one used to set the clipboard.
63    rpc setClipboard(ClipData) returns (google.protobuf.Empty) {}
64    rpc getClipboard(google.protobuf.Empty) returns (ClipData) {}
65
66    // Streams the current data on the clipboard. This will immediately produce
67    // a result with the current state of the clipboard after which the stream
68    // will block and wait until a new clip event is available from the guest.
69    // Calling the setClipboard method above will not result in generating a
70    // clip event. It is possible to lose clipboard events if the clipboard
71    // updates very rapidly.
72    rpc streamClipboard(google.protobuf.Empty) returns (stream ClipData) {}
73
74    // Set/get the battery to the given state.
75    rpc setBattery(BatteryState) returns (google.protobuf.Empty) {}
76    rpc getBattery(google.protobuf.Empty) returns (BatteryState) {}
77
78    // Set the state of the gps.
79    // Note: Setting the gps position will not be reflected in the user
80    // interface. Keep in mind that android usually only samples the gps at 1
81    // hz.
82    rpc setGps(GpsState) returns (google.protobuf.Empty) {}
83
84    // Gets the latest gps state as delivered by the setGps call, or location ui
85    // if active.
86    //
87    // Note: this is not necessarily the actual gps coordinate visible at the
88    // time, due to gps sample frequency (usually 1hz).
89    rpc getGps(google.protobuf.Empty) returns (GpsState) {}
90
91    // Simulate a touch event on the finger print sensor.
92    rpc sendFingerprint(Fingerprint) returns (google.protobuf.Empty) {}
93
94    // Send a keyboard event. Translating the event.
95    rpc sendKey(KeyboardEvent) returns (google.protobuf.Empty) {}
96    // Send touch/mouse events. Note that mouse events can be simulated
97    // by touch events.
98    rpc sendTouch(TouchEvent) returns (google.protobuf.Empty) {}
99    rpc sendMouse(MouseEvent) returns (google.protobuf.Empty) {}
100    rpc injectWheel(stream WheelEvent) returns (google.protobuf.Empty) {}
101
102    // Stream a series of input events to the emulator, the events will
103    // arrive in order.
104    rpc streamInputEvent(stream InputEvent) returns (google.protobuf.Empty) {}
105
106    // Make a phone call.
107    rpc sendPhone(PhoneCall) returns (PhoneResponse) {}
108
109    // Sends an sms message to the emulator.
110    rpc sendSms(SmsMessage) returns (PhoneResponse) {}
111
112    // Sends an sms message to the emulator.
113    rpc setPhoneNumber(PhoneNumber) returns (PhoneResponse) {}
114
115    // Retrieve the status of the emulator. This will contain general
116    // hardware information, and whether the device has booted or not.
117    rpc getStatus(google.protobuf.Empty) returns (EmulatorStatus) {}
118
119    // Gets an individual screenshot in the desired format.
120    //
121    // The image will be scaled to the desired ImageFormat, while maintaining
122    // the aspect ratio. The returned image will never exceed resolution of the
123    // device display. Not setting the width or height (i.e. they are 0) will
124    // result in using the display width and height.
125    //
126    // The resulting image will be properly oriented and can be displayed
127    // directly without post processing. For example, if the device has a
128    // 1080x1920 screen and is in landscape mode and called with no width or
129    // height parameter, it will return a 1920x1080 image.
130    //
131    // The dimensions of the returned image will never exceed the corresponding
132    // display dimensions. For example, this method will return a 1920x1080
133    // screenshot, if the display resolution is 1080x1920 and a screenshot of
134    // 2048x2048 is requested when the device is in landscape mode.
135    //
136    // This method will return an empty image if the display is not visible.
137    rpc getScreenshot(ImageFormat) returns (Image) {}
138
139    // Streams a series of screenshots in the desired format.
140    //
141    // A new frame will be delivered whenever the device produces a new frame.
142    // Beware that this can produce a significant amount of data and that
143    // certain translations can be very costly. For example, streaming a series
144    // of png images is very cpu intensive.
145    //
146    // Images are produced according to the getScreenshot API described above.
147    //
148    // If the display is inactive, or becomes inactive, an empty image will be
149    // delivered. Images will be delived again if the display becomes active and
150    // new frames are produced.
151    rpc streamScreenshot(ImageFormat) returns (stream Image) {}
152
153    // Streams a series of audio packets in the desired format.
154    // A new frame will be delivered whenever the emulated device
155    // produces a new audio frame. You can expect packets to be
156    // delivered in intervals of 20-30ms.
157    //
158    // Be aware that this can block when the emulator does not
159    // produce any audio whatsoever!
160    rpc streamAudio(AudioFormat) returns (stream AudioPacket) {}
161
162    // Injects a series of audio packets to the android microphone.
163    // A new frame will be delivered whenever the emulated device
164    // requests a new audio frame. Audio is usually delivered at a rate
165    // that the emulator is requesting frames. Audio will be stored in a
166    // temporary buffer that can hold 300ms of audio.
167    //
168    // Notes:
169    //  - Only the first audio format packet that is delivered will be
170    // honored. There is no need to send the audio format multiple times.
171    //  - Real time audio currently immediately overrides the buffer. This
172    // means you must provide a constant rate of audio packets. The real
173    // time mode is experimental. Timestamps of audio packets might be
174    // used in the future to improve synchronization.
175    //
176    // -  INVALID_ARGUMENT (code 3) The sampling rate was too high/low
177    // -  INVALID_ARGUMENT (code 3) The audio packet was too large to handle.
178    // -  FAILED_PRECONDITION (code 9) If there was a microphone registered
179    // already.
180    rpc injectAudio(stream AudioPacket) returns (google.protobuf.Empty) {}
181
182    // Deprecated, please use the streamLogcat method instead.
183    rpc getLogcat(LogMessage) returns (LogMessage) {
184        option deprecated = true;
185    }
186
187    // Streams the logcat output from the emulator.
188    // Note that parsed logcat messages are only available after L (Api >23)
189    rpc streamLogcat(LogMessage) returns (stream LogMessage) {}
190
191    // Transition the virtual machine to the desired state. Note that
192    // some states are only observable. For example you cannot transition
193    // to the error state.
194    rpc setVmState(VmRunState) returns (google.protobuf.Empty) {}
195
196    // Gets the state of the virtual machine.
197    rpc getVmState(google.protobuf.Empty) returns (VmRunState) {}
198
199    // Atomically changes the current multi-display configuration.
200    // After this call the given display configurations will be activated. You
201    // can only update secondary displays. Displays with id 0 will be ignored.
202    //
203    // This call can result in the removal or addition of secondary displays,
204    // the final display state can be observed by the returned configuration.
205    //
206    // The following gRPC error codes can be returned:
207    // -  FAILED_PRECONDITION (code 9) if the AVD does not support a
208    // configurable
209    //    secondary display.
210    // -  INVALID_ARGUMENT (code 3) if:
211    //     - The same display id is defined multiple times.
212    //     - The display configurations are outside valid ranges.
213    //       See DisplayConfiguration for details on valid ranges.
214    // -  INTERNAL (code 13) if there was an internal emulator failure.
215    rpc setDisplayConfigurations(DisplayConfigurations)
216            returns (DisplayConfigurations) {}
217
218    // Returns all currently valid logical displays.
219    //
220    // The gRPC error code FAILED_PRECONDITION (code 9) is returned if the AVD
221    // does not support a configurable secondary display.
222    rpc getDisplayConfigurations(google.protobuf.Empty)
223            returns (DisplayConfigurations) {}
224
225    // Notifies client of the following changes:
226    //
227    // - Virtual scene camera status change.
228    // - Display configuration changes from extended ui. This will only be fired
229    //   if the user makes modifications the extended displays through the
230    //   extended control tab.
231    //
232    // Note that this method will send the initial virtual scene state
233    // immediately.
234    rpc streamNotification(google.protobuf.Empty)
235            returns (stream Notification) {}
236
237    // Rotation angles are relative to the camera's current orientation.
238    // The coordinate system is right-handed and is defined as follows:
239    //   x axis is pointing right
240    //   y axis is pointing up
241    //   z axis is pointing towards the viewer
242    // The z component of rotation is not used when calling this method.
243    rpc rotateVirtualSceneCamera(RotationRadian)
244            returns (google.protobuf.Empty) {}
245    // Velocity is absolute and is measured in meters per second.
246    // The coordinate system is right-handed and is defined as follows:
247    //   x axis is pointing right
248    //   y axis is pointing up
249    //   z axis is pointing towards the viewer
250    rpc setVirtualSceneCameraVelocity(Velocity)
251            returns (google.protobuf.Empty) {}
252    // Set foldable posture
253    rpc setPosture(Posture) returns (google.protobuf.Empty) {}
254
255    // Get the backlight brightness.
256    // The following gRPC error codes can be returned:
257    // -  FAILED_PRECONDITION (code 9) if the AVD does not support hw-control.
258    rpc getBrightness(BrightnessValue) returns (BrightnessValue) {}
259
260    // Set the backlight brightness.
261    // The following gRPC error codes can be returned:
262    // -  FAILED_PRECONDITION (code 9) if the AVD does not support hw-control.
263    // -  INVALID_ARGUMENT (code 3) The brightness exceeds the valid range.
264    rpc setBrightness(BrightnessValue) returns (google.protobuf.Empty) {}
265
266    // Returns the current mode of the primary display of a resizable AVD.
267    // The following gRPC error codes can be returned:
268    // -  FAILED_PRECONDITION (code 9) if the AVD is not resizable.
269    rpc getDisplayMode(google.protobuf.Empty) returns (DisplayMode) {}
270
271    // Sets the size of the primary display of a resizable AVD. Fails if the AVD
272    // is not resizable. The following gRPC error codes can be returned:
273    // -  FAILED_PRECONDITION (code 9) if the AVD is not resizable.
274    rpc setDisplayMode(DisplayMode) returns (google.protobuf.Empty) {}
275}
276
277// A Run State that describes the state of the Virtual Machine.
278message VmRunState {
279    enum RunState {
280        // The emulator is in an unknown state. You cannot transition to this
281        // state.
282        UNKNOWN = 0;
283        // Guest is actively running. You can transition to this state from the
284        // paused state.
285        RUNNING = 1;
286        // Guest is paused to load a snapshot. You cannot transition to this
287        // state.
288        RESTORE_VM = 2;
289        // Guest has been paused. Transitioning to this state will pause the
290        // emulator the guest will not be consuming any cpu cycles.
291        PAUSED = 3;
292        // Guest is paused to take or export a snapshot. You cannot
293        // transition to this state.
294        SAVE_VM = 4;
295        // System shutdown, note that it is similar to power off. It tries to
296        // set the system status and notify guest. The system is likely going to
297        // disappear soon and do proper cleanup of resources, possibly taking
298        // a snapshot. This is the same behavior as closing the emulator by
299        // clicking the X (close) in the user interface.
300        SHUTDOWN = 5;
301        // Immediately terminate the emulator. No resource cleanup will take
302        // place. There is a good change to corrupt the system.
303        TERMINATE = 7;
304        // Will cause the emulator to reset. This is not a state you can
305        // observe.
306        RESET = 9;
307        // Guest experienced some error state, you cannot transition to this
308        // state.
309        INTERNAL_ERROR = 10;
310        // Completely restart the emulator.
311        RESTART = 11;
312        // Resume a stopped emulator
313        START = 12;
314        // Stop (pause) a running emulator
315        STOP = 13;
316    }
317
318    RunState state = 1;
319}
320
321message ParameterValue {
322    repeated float data = 1 [packed = true];
323}
324
325message PhysicalModelValue {
326    enum State {
327        OK = 0;
328        NO_SERVICE = -3;  // qemud service is not available/initiated.
329        DISABLED = -2;    // Sensor is disabled.
330        UNKNOWN = -1;     // Unknown sensor (should not happen)
331    }
332
333    // Details on the sensors documentation can be found here:
334    // https://developer.android.com/reference/android/hardware/Sensor.html#TYPE_
335    // The types must follow the order defined in
336    // "external/qemu/android/hw-sensors.h"
337    enum PhysicalType {
338        POSITION = 0;
339
340        // All values are angles in degrees.
341        // values = [x,y,z]
342        ROTATION = 1;
343
344        MAGNETIC_FIELD = 2;
345
346        // Temperature in °C
347        TEMPERATURE = 3;
348
349        // Proximity sensor distance measured in centimeters
350        PROXIMITY = 4;
351
352        // Ambient light level in SI lux units
353        LIGHT = 5;
354
355        // Atmospheric pressure in hPa (millibar)
356        PRESSURE = 6;
357
358        // Relative ambient air humidity in percent
359        HUMIDITY = 7;
360
361        VELOCITY = 8;
362        AMBIENT_MOTION = 9;
363
364        // Describing a hinge angle sensor in degrees.
365        HINGE_ANGLE0 = 10;
366        HINGE_ANGLE1 = 11;
367        HINGE_ANGLE2 = 12;
368
369        ROLLABLE0 = 13;
370        ROLLABLE1 = 14;
371        ROLLABLE2 = 15;
372
373        // Describing the device posture; the value should be an enum defined
374        // in Posture::PostureValue.
375        POSTURE = 16;
376
377        // Heart rate in bpm
378        HEART_RATE = 17;
379
380        // Ambient RGBC light intensity. Values are in order (Red, Green, Blue,
381        // Clear).
382        RGBC_LIGHT = 18;
383
384        // Wrist tilt gesture (1 = gaze, 0 = ungaze)
385        WRIST_TILT = 19;
386    }
387    PhysicalType target = 1;
388
389    // [Output Only]
390    State status = 2;
391
392    // Value interpretation depends on sensor.
393    ParameterValue value = 3;
394}
395
396// A single sensor value.
397message SensorValue {
398    enum State {
399        OK = 0;
400        NO_SERVICE = -3;  // qemud service is not available/initiated.
401        DISABLED = -2;    // Sensor is disabled.
402        UNKNOWN = -1;     // Unknown sensor (should not happen)
403    }
404
405    // These are the various sensors that can be available in an emulated
406    // devices.
407    enum SensorType {
408        // Measures the acceleration force in m/s2 that is applied to a device
409        // on all three physical axes (x, y, and z), including the force of
410        // gravity.
411        ACCELERATION = 0;
412        // Measures a device's rate of rotation in rad/s around each of the
413        // three physical axes (x, y, and z).
414        GYROSCOPE = 1;
415        // Measures the ambient geomagnetic field for all three physical axes
416        // (x, y, z) in μT.
417        MAGNETIC_FIELD = 2;
418        // Measures degrees of rotation that a device makes around all three
419        // physical axes (x, y, z)
420        ORIENTATION = 3;
421        // Measures the temperature of the device in degrees Celsius (°C).
422        TEMPERATURE = 4;
423        // Measures the proximity of an object in cm relative to the view screen
424        // of a device. This sensor is typically used to determine whether a
425        // handset is being held up to a person's ear.
426        PROXIMITY = 5;
427        // Measures the ambient light level (illumination) in lx.
428        LIGHT = 6;
429        // Measures the ambient air pressure in hPa or mbar.
430        PRESSURE = 7;
431        // Measures the relative ambient humidity in percent (%).
432        HUMIDITY = 8;
433        MAGNETIC_FIELD_UNCALIBRATED = 9;
434        GYROSCOPE_UNCALIBRATED = 10;
435
436        // HINGE_ANGLE0 (11), HINGE_ANGLE1 (12), HINGE_ANGLE2 (13) are
437        // skipped; clients should use get/setPhysicalModel() instead for these
438        // "sensors".
439
440        // Measures the heart rate in bpm.
441        HEART_RATE = 14;
442        // Measures the ambient RGBC light intensity.
443        // Values are in order (Red, Green, Blue, Clear).
444        RGBC_LIGHT = 15;
445        // WIRST_TILT (16) is skipped; clients should use get/setPhysicalModel()
446        // instead.
447        // Measures acceleration force and provides bias data.
448        ACCELERATION_UNCALIBRATED = 17;
449    }
450
451    // Type of sensor
452    SensorType target = 1;
453
454    // [Output Only]
455    State status = 2;
456
457    // Value interpretation depends on sensor enum.
458    ParameterValue value = 3;
459}
460
461// A single backlight brightness value.
462message BrightnessValue {
463    enum LightType {
464        // Display backlight. This will affect all displays.
465        LCD = 0;
466        KEYBOARD = 1;
467        BUTTON = 2;
468    }
469
470    // Type of light
471    LightType target = 1;
472
473    // Light intensity, ranges from 0-255.
474    uint32 value = 2;
475}
476
477// in line with android/emulation/resizable_display_config.h
478enum DisplayModeValue {
479    PHONE = 0;
480    FOLDABLE = 1;
481    TABLET = 2;
482    DESKTOP = 3;
483}
484
485message DisplayMode {
486    DisplayModeValue value = 1;
487}
488
489message LogMessage {
490    // [Output Only] The contents of the log output.
491    string contents = 1;
492    // The starting byte position of the output that was returned. This
493    // should match the start parameter sent with the request. If the serial
494    // console output exceeds the size of the buffer, older output will be
495    // overwritten by newer content and the start values will be mismatched.
496    int64 start = 2 [deprecated = true];
497    //[Output Only] The position of the next byte of content from the serial
498    // console output. Use this value in the next request as the start
499    // parameter.
500    int64 next = 3 [deprecated = true];
501
502    // Set the sort of response you are interested it in.
503    // It the type is "Parsed" the entries field will contain the parsed
504    // results. otherwise the contents field will be set.
505    LogType sort = 4;
506
507    // [Output Only] The parsed logcat entries so far. Only set if sort is
508    // set to Parsed
509    repeated LogcatEntry entries = 5;
510
511    enum LogType {
512        Text = 0;
513        Parsed = 1;
514    }
515}
516
517// A parsed logcat entry.
518message LogcatEntry {
519    // The possible log levels.
520    enum LogLevel {
521        UNKNOWN = 0;
522        DEFAULT = 1;
523        VERBOSE = 2;
524        DEBUG = 3;
525        INFO = 4;
526        WARN = 5;
527        ERR = 6;
528        FATAL = 7;
529        SILENT = 8;
530    }
531
532    // A Unix timestamps in  milliseconds (The number of milliseconds that
533    // have elapsed since January 1, 1970 (midnight UTC/GMT), not counting
534    // leap seconds)
535    uint64 timestamp = 1;
536
537    // Process id.
538    uint32 pid = 2;
539
540    // Thread id.
541    uint32 tid = 3;
542    LogLevel level = 4;
543    string tag = 5;
544    string msg = 6;
545}
546
547// Information about the hypervisor that is currently in use.
548message VmConfiguration {
549    enum VmHypervisorType {
550        // An unknown hypervisor
551        UNKNOWN = 0;
552
553        // No hypervisor is in use. This usually means that the guest is
554        // running on a different CPU than the host, or you are using a
555        // platform where no hypervisor is available.
556        NONE = 1;
557
558        // The Kernel based Virtual Machine
559        // (https://www.linux-kvm.org/page/Main_Page)
560        KVM = 2;
561
562        // Intel® Hardware Accelerated Execution Manager (Intel® HAXM)
563        // https://github.com/intel/haxm
564        HAXM = 3;
565
566        // Hypervisor Framework.
567        // https://developer.apple.com/documentation/hypervisor
568        HVF = 4;
569
570        // Window Hypervisor Platform
571        // https://docs.microsoft.com/en-us/virtualization/api/
572        WHPX = 5;
573
574        AEHD = 6;
575    }
576
577    VmHypervisorType hypervisorType = 1;
578    int32 numberOfCpuCores = 2;
579    int64 ramSizeBytes = 3;
580}
581
582// Representation of a clipped data object on the clipboard.
583message ClipData {
584    // UTF-8 Encoded text.
585    string text = 1;
586}
587
588// The Touch interface represents a single contact point on a
589// touch-sensitive device. The contact point is commonly a finger or stylus
590// and the device may be a touchscreen or trackpad.
591message Touch {
592    // The horizontal coordinate. This is the physical location on the
593    // screen For example 0 indicates the leftmost coordinate.
594    int32 x = 1;
595
596    // The vertical coordinate. This is the physical location on the screen
597    // For example 0 indicates the top left coordinate.
598    int32 y = 2;
599
600    // The identifier is an arbitrary non-negative integer that is used to
601    // identify and track each tool independently when multiple tools are
602    // active. For example, when multiple fingers are touching the device,
603    // each finger should be assigned a distinct tracking id that is used as
604    // long as the finger remains in contact. Tracking ids may be reused
605    // when their associated tools move out of range.
606    //
607    // The emulator currently supports up to 10 concurrent touch events. The
608    // identifier can be any uninque value and will be mapped to the next
609    // available internal identifier.
610    int32 identifier = 3;
611
612    // Reports the physical pressure applied to the tip of the tool or the
613    // signal strength of the touch contact.
614    //
615    // The values reported must be non-zero when the tool is touching the
616    // device and zero otherwise to indicate that the touch event is
617    // completed.
618    //
619    // Make sure to deliver a pressure of 0 for the given identifier when
620    // the touch event is completed, otherwise the touch identifier will not
621    // be unregistered!
622    int32 pressure = 4;
623
624    // Optionally reports the cross-sectional area of the touch contact, or
625    // the length of the longer dimension of the touch contact.
626    int32 touch_major = 5;
627
628    // Optionally reports the length of the shorter dimension of the touch
629    // contact. This axis will be ignored if touch_major is reporting an
630    // area measurement greater than 0.
631    int32 touch_minor = 6;
632
633    enum EventExpiration {
634        // The system will use the default time of 120s to track
635        // the touch event with the given identifier. If no update happens
636        // within this timeframe the identifier is considered expired
637        // and can be made available for re-use. This means that a touch event
638        // with pressure 0 for this identifier will be send to the emulator.
639        EVENT_EXPIRATION_UNSPECIFIED = 0;
640
641        // Never expire the given slot. You must *ALWAYS* close the identifier
642        // by sending a touch event with 0 pressure.
643        NEVER_EXPIRE = 1;
644    }
645
646    EventExpiration expiration = 7;
647
648    // The orientation of the contact, if any.
649    int32 orientation = 8;
650}
651
652// A Pen is similar to a touch, with the addition
653// of button and rubber information.
654message Pen {
655    Touch location = 1;
656
657    // True if the button is pressed or not
658    bool button_pressed = 2;
659
660    // True if it is a rubber pointer.
661    bool rubber_pointer = 3;
662}
663
664// A TouchEvent contains a list of Touch objects that are in contact with
665// the touch surface.
666//
667// Touch events are delivered in sequence as specified in the touchList.
668//
669// TouchEvents are delivered to the emulated devices using ["Protocol
670// B"](https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt)
671message TouchEvent {
672    // The list of Touch objects, note that these do not need to be unique
673    repeated Touch touches = 1;
674
675    // The display device where the touch event occurred.
676    // Omitting or using the value 0 indicates the main display.
677    int32 display = 2;
678}
679
680message PenEvent {
681    // The list of Pen objects, note that these do not need to be unique
682    repeated Pen events = 1;
683
684    // The display device where the pen event occurred.
685    // Omitting or using the value 0 indicates the main display.
686    int32 display = 2;
687}
688
689// The MouseEvent interface represents events that occur due to the user
690// interacting with a pointing device (such as a mouse).
691message MouseEvent {
692    // The horizontal coordinate. This is the physical location on the
693    // screen For example 0 indicates the leftmost coordinate.
694    int32 x = 1;
695
696    // The vertical coordinate. This is the physical location on the screen
697    // For example 0 indicates the top left coordinate.
698    int32 y = 2;
699
700    // Indicates which buttons are pressed.
701    // 0: No button was pressed
702    // 1: Primary button (left)
703    // 2: Secondary button (right)
704    int32 buttons = 3;
705
706    // The display device where the mouse event occurred.
707    // Omitting or using the value 0 indicates the main display.
708    int32 display = 4;
709}
710
711message WheelEvent {
712    // The value indicating how much the mouse wheel is rotated. Scaled so that
713    // 120 equals to 1 wheel click. (120 is chosen as a multiplier often used to
714    // represent wheel movements less than 1 wheel click. e.g.
715    // https://doc.qt.io/qt-5/qwheelevent.html#angleDelta) Positive delta value
716    // is assigned to dx when the top of wheel is moved to left. Similarly
717    // positive delta value is assigned to dy when the top of wheel is moved
718    // away from the user.
719    int32 dx = 1;
720    int32 dy = 2;
721
722    // The display device where the mouse event occurred.
723    // Omitting or using the value 0 indicates the main display.
724    int32 display = 3;
725}
726
727// KeyboardEvent objects describe a user interaction with the keyboard; each
728// event describes a single interaction between the user and a key (or
729// combination of a key with modifier keys) on the keyboard.
730// This follows the pattern as set by
731// (javascript)[https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent]
732//
733// Note: that only keyCode, key, or text can be set and that the semantics
734// will slightly vary.
735message KeyboardEvent {
736    // Code types that the emulator can receive. Note that the emulator
737    // will do its best to translate the code to an evdev value that
738    // will be send to the emulator. This translation is based on
739    // the chromium translation tables. See
740    // (this)[https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-grpc/android/emulation/control/keyboard/keycode_converter_data.inc]
741    // for details on the translation.
742    enum KeyCodeType {
743        Usb = 0;
744        Evdev = 1;
745        XKB = 2;
746        Win = 3;
747        Mac = 4;
748    }
749
750    enum KeyEventType {
751        // Indicates that this keyevent should be send to the emulator
752        // as a key down event. Meaning that the key event will be
753        // translated to an EvDev event type and bit 11 (0x400) will be
754        // set before it is sent to the emulator.
755        keydown = 0;
756
757        // Indicates that the keyevent should be send to the emulator
758        // as a key up event. Meaning that the key event will be
759        // translated to an EvDev event type and
760        // sent to the emulator.
761        keyup = 1;
762
763        // Indicates that the keyevent will be send to the emulator
764        // as e key down event and immediately followed by a keyup event.
765        keypress = 2;
766    }
767
768    // Type of keycode contained in the keyCode field.
769    KeyCodeType codeType = 1;
770
771    // The type of keyboard event that should be sent to the emulator
772    KeyEventType eventType = 2;
773
774    // This property represents a physical key on the keyboard (as opposed
775    // to the character generated by pressing the key). In other words, this
776    // property is a value which isn't altered by keyboard layout or the
777    // state of the modifier keys. This value will be interpreted by the
778    // emulator depending on the KeyCodeType. The incoming key code will be
779    // translated to an evdev code type and send to the emulator.
780    // The values in key and text will be ignored.
781    int32 keyCode = 3;
782
783    // The value of the key pressed by the user, taking into consideration
784    // the state of modifier keys such as Shift as well as the keyboard
785    // locale and layout. This follows the w3c standard used in browsers.
786    // You can find an accurate description of valid values
787    // [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
788    //
789    // Note that some keys can result in multiple evdev events that are
790    // delivered to the emulator. for example the Key "A" will result in a
791    // sequence:
792    // ["Shift", "a"] -> [0x2a, 0x1e] whereas "a" results in ["a"] -> [0x1e].
793    //
794    // Not all documented keys are understood by android, and only printable
795    // ASCII [32-127) characters are properly translated.
796    //
797    // Keep in mind that there are a set of key values that result in android
798    // specific behavior
799    // [see](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Phone_keys):
800    //
801    // - "AppSwitch": Behaves as the "Overview" button in android.
802    // - "GoBack": The Back button.
803    // - "GoHome": The Home button, which takes the user to the phone's main
804    //             screen (usually an application launcher).
805    // - "Power":  The Power button.
806    string key = 4;
807
808    // Series of utf8 encoded characters to send to the emulator. An attempt
809    // will be made to translate every character will an EvDev event type and
810    // send to the emulator as a keypress event. The values in keyCode,
811    // eventType, codeType and key will be ignored.
812    //
813    // Note that most printable ASCII characters (range [32-127) can be send
814    // individually with the "key" param. Do not expect arbitrary UTF symbols to
815    // arrive in the emulator (most will be ignored).
816    //
817    // Note that it is possible to overrun the keyboard buffer by slamming this
818    // endpoint with large quantities of text (>1kb). The clipboard api is
819    // better suited for transferring large quantities of text.
820    string text = 5;
821}
822
823// An input event that can be delivered to the emulator.
824message InputEvent {
825    oneof type {
826        KeyboardEvent key_event = 1;
827        TouchEvent touch_event = 2;
828        MouseEvent mouse_event = 3;
829        AndroidEvent android_event = 4;
830        PenEvent pen_event = 5;
831        WheelEvent wheel_event = 6;
832    }
833};
834
835// The android input event system is a framework for handling input from a
836// variety of devices by generating events that describe changes in the
837// state of the devices and forwarding them to user space applications.
838//
839// An AndroidEvents will be delivered directly to the kernel as is.
840message AndroidEvent {
841    // The type of the event. The types of the event are specified
842    // by the android kernel. Some examples are:
843    // EV_SYN, EV_KEY, EV_SW, etc..
844    // The exact definitions can be found in the input.h header file.
845    int32 type = 1;
846
847    // The actual code to be send to the kernel. The actual meaning
848    // of the code depends on the type definition.
849    int32 code = 2;
850
851    // The actual value of the event.
852    int32 value = 3;
853
854    // The display id associated with this input event.
855    int32 display = 4;
856};
857
858message Fingerprint {
859    // True when the fingprint is touched.
860    bool isTouching = 1;
861
862    // The identifier of the registered fingerprint.
863    int32 touchId = 2;
864}
865
866message GpsState {
867    // Setting this to false will disable auto updating  from the LocationUI,
868    // otherwise the location UI will override the location at a frequency of
869    // 1hz.
870    //
871    // - This is unused if the emulator is launched with -no-window, or when he
872    //   location ui is disabled.
873    // - This will BREAK the location ui experience if it is set to false. For
874    //    example routing will no longer function.
875    bool passiveUpdate = 1;
876
877    // The latitude, in degrees.
878    double latitude = 2;
879
880    // The longitude, in degrees.
881    double longitude = 3;
882
883    // The speed if it is available, in meters/second over ground
884    double speed = 4;
885
886    // gets the horizontal direction of travel of this device, and is not
887    // related to the device orientation. It is guaranteed to be in the
888    // range [0.0, 360.0] if the device has a bearing. 0=North, 90=East,
889    // 180=South, etc..
890    double bearing = 5;
891
892    // The altitude if available, in meters above the WGS 84 reference
893    // ellipsoid.
894    double altitude = 6;
895
896    // The number of satellites used to derive the fix
897    int32 satellites = 7;
898}
899
900message BatteryState {
901    enum BatteryStatus {
902        UNKNOWN = 0;
903        CHARGING = 1;
904        DISCHARGING = 2;
905        NOT_CHARGING = 3;
906        FULL = 4;
907    }
908
909    enum BatteryCharger {
910        NONE = 0;
911        AC = 1;
912        USB = 2;
913        WIRELESS = 3;
914    }
915
916    enum BatteryHealth {
917        GOOD = 0;
918        FAILED = 1;
919        DEAD = 2;
920        OVERVOLTAGE = 3;
921        OVERHEATED = 4;
922    }
923
924    bool hasBattery = 1;
925    bool isPresent = 2;
926    BatteryCharger charger = 3;
927    int32 chargeLevel = 4;
928    BatteryHealth health = 5;
929    BatteryStatus status = 6;
930}
931
932// An ImageTransport allows for specifying a side channel for
933// delivering image frames versus using the standard bytes array that is
934// returned with the gRPC request.
935message ImageTransport {
936    enum TransportChannel {
937        // Return full frames over the gRPC transport
938        TRANSPORT_CHANNEL_UNSPECIFIED = 0;
939
940        // Write images to the a file/shared memory handle.
941        MMAP = 1;
942    }
943
944    // The desired transport channel used for delivering image frames. Only
945    // relevant when streaming screenshots.
946    TransportChannel channel = 1;
947
948    // Handle used for writing image frames if transport is mmap. The client
949    // sets and owns this handle. It can be either a shm region, or a mmap. A
950    // mmap should be a url that starts with `file:///` Note: the mmap can
951    // result in tearing.
952    string handle = 2;
953}
954
955// The aspect ratio (width/height) will be different from the one
956// where the device is unfolded.
957message FoldedDisplay {
958    uint32 width = 1;
959    uint32 height = 2;
960    // It is possible for the screen to be folded in different ways depending
961    // on which surface is shown to the user. So xOffset and yOffset indicate
962    // the top left corner of the folded screen within the original unfolded
963    // screen.
964    uint32 xOffset = 3;
965    uint32 yOffset = 4;
966}
967
968message ImageFormat {
969    enum ImgFormat {
970        // Portable Network Graphics format
971        // (https://en.wikipedia.org/wiki/Portable_Network_Graphics)
972        PNG = 0;
973
974        // Three-channel RGB color model supplemented with a fourth alpha
975        // channel. https://en.wikipedia.org/wiki/RGBA_color_model
976        // Each pixel consists of 4 bytes.
977        RGBA8888 = 1;
978
979        // Three-channel RGB color model, each pixel consists of 3 bytes
980        RGB888 = 2;
981    }
982
983    // The (desired) format of the resulting bytes.
984    ImgFormat format = 1;
985
986    // [Output Only] The rotation of the image. The image will be rotated
987    // based upon the coarse grained orientation of the device.
988    Rotation rotation = 2;
989
990    // The (desired) width of the image. When passed as input
991    // the image will be scaled to match the given
992    // width, while maintaining the aspect ratio of the device.
993    // The returned image will never exceed the given width, but can be less.
994    // Omitting this value (or passing in 0) will result in no scaling,
995    // and the width of the actual device will be used.
996    uint32 width = 3;
997
998    // The (desired) height of the image.  When passed as input
999    // the image will be scaled to match the given
1000    // height, while maintaining the aspect ratio of the device.
1001    // The returned image will never exceed the given height, but can be less.
1002    // Omitting this value (or passing in 0) will result in no scaling,
1003    // and the height of the actual device will be used.
1004    uint32 height = 4;
1005
1006    // The (desired) display id of the device. Setting this to 0 (or omitting)
1007    // indicates the main display.
1008    uint32 display = 5;
1009
1010    // Set this if you wish to use a different transport channel to deliver
1011    // image frames.
1012    ImageTransport transport = 6;
1013
1014    // [Output Only] Display configuration when screen is folded. The value is
1015    // the original configuration before scaling.
1016    FoldedDisplay foldedDisplay = 7;
1017
1018    // [Output Only] Display mode when AVD is resizable.
1019    DisplayModeValue displayMode = 8;
1020}
1021
1022message Image {
1023    ImageFormat format = 1;
1024
1025    uint32 width = 2 [deprecated = true];   // width is contained in format.
1026    uint32 height = 3 [deprecated = true];  // height is contained in format.
1027
1028    // The organization of the pixels in the image buffer is from left to
1029    // right and bottom up. This will be empty if an alternative image transport
1030    // is requested in the image format. In that case the side channel should
1031    // be used to obtain the image data.
1032    bytes image = 4;
1033
1034    // [Output Only] Monotonically increasing sequence number in a stream of
1035    // screenshots. The first screenshot will have a sequence of 0. A single
1036    // screenshot will always have a sequence number of 0. The sequence is not
1037    // necessarily contiguous, and can be used to detect how many frames were
1038    // dropped. An example sequence could be: [0, 3, 5, 7, 9, 11].
1039    uint32 seq = 5;
1040
1041    // [Output Only] Unix timestamp in microseconds when the emulator estimates
1042    // the frame was generated. The timestamp is before the actual frame is
1043    // copied and transformed. This can be used to calculate variance between
1044    // frame production time, and frame depiction time.
1045    uint64 timestampUs = 6;
1046}
1047
1048message Rotation {
1049    enum SkinRotation {
1050        PORTRAIT = 0;           // 0 degrees
1051        LANDSCAPE = 1;          // 90 degrees
1052        REVERSE_PORTRAIT = 2;   // -180 degrees
1053        REVERSE_LANDSCAPE = 3;  // -90 degrees
1054    }
1055
1056    // The rotation of the device, derived from the sensor state
1057    // of the emulator. The derivation reflects how android observes
1058    // the rotation state.
1059    SkinRotation rotation = 1;
1060
1061    // Specifies the angle of rotation, in degrees [-180, 180]
1062    double xAxis = 2;
1063    double yAxis = 3;
1064    double zAxis = 4;
1065}
1066
1067message PhoneCall {
1068    enum Operation {
1069        InitCall = 0;
1070        AcceptCall = 1;
1071        RejectCallExplicit = 2;
1072        RejectCallBusy = 3;
1073        DisconnectCall = 4;
1074        PlaceCallOnHold = 5;
1075        TakeCallOffHold = 6;
1076    }
1077    Operation operation = 1;
1078    string number = 2;
1079}
1080
1081message PhoneResponse {
1082    enum Response {
1083        OK = 0;
1084        BadOperation = 1;   // Enum out of range
1085        BadNumber = 2;      // Mal-formed telephone number
1086        InvalidAction = 3;  // E.g., disconnect when no call is in progress
1087        ActionFailed = 4;   // Internal error
1088        RadioOff = 5;       // Radio power off
1089    }
1090    Response response = 1;
1091}
1092
1093message Entry {
1094    string key = 1;
1095    string value = 2;
1096}
1097
1098message EntryList {
1099    repeated Entry entry = 1;
1100}
1101
1102message EmulatorStatus {
1103    // The emulator version string.
1104    string version = 1;
1105
1106    // The time the emulator has been active in .ms
1107    uint64 uptime = 2;
1108
1109    // True if the device has completed booting.
1110    // For P and later this information will accurate,
1111    // for older images we rely on adb.
1112    bool booted = 3;
1113
1114    // The current vm configuration
1115    VmConfiguration vmConfig = 4;
1116
1117    // The hardware configuration of the running emulator as
1118    // key valure pairs.
1119    EntryList hardwareConfig = 5;
1120
1121    // Some guests will produce a heart beat, that can be used to
1122    // detect if the guest is active.
1123    // This is a monotonically increasing number that gets incremented
1124    // around once a second.
1125    uint64 heartbeat = 6;
1126
1127    // The configuration of services in the guest, this map
1128    // contains key value pairs that are specific to the image
1129    // used by the guest.
1130    map<string, string> guestConfig = 7;
1131}
1132
1133message AudioFormat {
1134    enum SampleFormat {
1135        AUD_FMT_U8 = 0;   // Unsigned 8 bit
1136        AUD_FMT_S16 = 1;  // Signed 16 bit (little endian)
1137    }
1138
1139    enum Channels {
1140        Mono = 0;
1141        Stereo = 1;
1142    }
1143
1144    enum DeliveryMode {
1145        // The audio queue will block and wait until the emulator requests
1146        // packets. The client does not have to throttle and can push packets at
1147        // will. This can result in the client falling behind.
1148        MODE_UNSPECIFIED = 0;
1149        // Audio packets will be delivered in real time (when possible). The
1150        // audio queue will be overwritten with incoming data if data is made
1151        // available. This means the client needs to control timing properly, or
1152        // packets will get overwritten.
1153        MODE_REAL_TIME = 1;  //
1154    }
1155    // Sampling rate to use, defaulting to 44100 if this is not set.
1156    // Note, that android devices typically will not use a sampling
1157    // rate higher than 48kHz. See
1158    // https://developer.android.com/ndk/guides/audio.
1159    uint64 samplingRate = 1;
1160    Channels channels = 2;
1161    SampleFormat format = 3;
1162
1163    // [Input Only]
1164    // The mode used when delivering audio packets.
1165    DeliveryMode mode = 4;
1166}
1167
1168message AudioPacket {
1169    AudioFormat format = 1;
1170
1171    // Unix epoch in us when this frame was captured.
1172    uint64 timestamp = 2;
1173
1174    // Contains a sample in the given audio format.
1175    bytes audio = 3;
1176}
1177
1178message SmsMessage {
1179    // The source address where this message came from.
1180    //
1181    // The address should be a valid GSM-formatted address as specified by
1182    // 3GPP 23.040 Sec 9.1.2.5.
1183    //
1184    // For example: +3106225412 or (650) 555-1221
1185    string srcAddress = 1;
1186
1187    // A utf8 encoded text message that should be delivered.
1188    string text = 2;
1189}
1190
1191// A DisplayConfiguration describes a primary or secondary
1192// display available to the emulator. The screen aspect ratio
1193// cannot be longer (or wider) than 21:9 (or 9:21). Screen sizes
1194// larger than 4k will be rejected.
1195//
1196// Common configurations (w x h) are:
1197// - 480p  (480x720)   142 dpi
1198// - 720p  (720x1280)  213 dpi
1199// - 1080p (1080x1920) 320 dpi
1200// - 4K  (2160x3840) 320 dpi
1201// - 4K  (2160x3840) 640 dpi (upscaled)
1202//
1203// The behavior of the virtual display depends on the flags that are provided to
1204// this method. By default, virtual displays are created to be private,
1205// non-presentation and unsecure.
1206message DisplayConfiguration {
1207    // These are the set of known android flags and their respective values.
1208    // you can combine the int values to (de)construct the flags field below.
1209    enum DisplayFlags {
1210        DISPLAYFLAGS_UNSPECIFIED = 0;
1211
1212        // When this flag is set, the virtual display is public.
1213        // A public virtual display behaves just like most any other display
1214        // that is connected to the system such as an external or wireless
1215        // display. Applications can open windows on the display and the system
1216        // may mirror the contents of other displays onto it. see:
1217        // https://developer.android.com/reference/android/hardware/display/DisplayManager#VIRTUAL_DISPLAY_FLAG_PUBLIC
1218        VIRTUAL_DISPLAY_FLAG_PUBLIC = 1;
1219
1220        // When this flag is set, the virtual display is registered as a
1221        // presentation display in the presentation display category.
1222        // Applications may automatically project their content to presentation
1223        // displays to provide richer second screen experiences.
1224        // https://developer.android.com/reference/android/hardware/display/DisplayManager#VIRTUAL_DISPLAY_FLAG_PRESENTATION
1225        VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2;
1226
1227        // When this flag is set, the virtual display is considered secure as
1228        // defined by the Display#FLAG_SECURE display flag. The caller promises
1229        // to take reasonable measures, such as over-the-air encryption, to
1230        // prevent the contents of the display from being intercepted or
1231        // recorded on a persistent medium.
1232        // see:
1233        // https://developer.android.com/reference/android/hardware/display/DisplayManager#VIRTUAL_DISPLAY_FLAG_SECURE
1234        VIRTUAL_DISPLAY_FLAG_SECURE = 4;
1235
1236        // This flag is used in conjunction with VIRTUAL_DISPLAY_FLAG_PUBLIC.
1237        // Ordinarily public virtual displays will automatically mirror the
1238        // content of the default display if they have no windows of their own.
1239        // When this flag is specified, the virtual display will only ever show
1240        // its own content and will be blanked instead if it has no windows. See
1241        // https://developer.android.com/reference/android/hardware/display/DisplayManager#VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY
1242        VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8;
1243
1244        // Allows content to be mirrored on private displays when no content is
1245        // being shown.
1246        // This flag is mutually exclusive with
1247        // VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY. If both flags are specified
1248        // then the own-content only behavior will be applied.
1249        // see:
1250        // https://developer.android.com/reference/android/hardware/display/DisplayManager#VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR)
1251        VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16;
1252    }
1253
1254    // The width of the display, restricted to:
1255    // 320 * (dpi / 160) <= width
1256    uint32 width = 1;
1257
1258    // The heigh of the display, restricted to:
1259    // * 320 * (dpi / 160) <= height
1260    uint32 height = 2;
1261
1262    // The pixel density (dpi).
1263    // See https://developer.android.com/training/multiscreen/screendensities
1264    // for details. This value should be in the range [120, ..., 640]
1265    uint32 dpi = 3;
1266
1267    // A combination of virtual display flags. These flags can be constructed
1268    // by combining the DisplayFlags enum described above.
1269    //
1270    // The behavior of the virtual display depends on the flags. By default
1271    // virtual displays are created to be private, non-presentation and
1272    // unsecure.
1273    uint32 flags = 4;
1274
1275    // The id of the display.
1276    // The primary (default) display has the display ID of 0.
1277    // A secondary display has a display ID not 0.
1278    //
1279    // A display with the id in the range [1, userConfigurable]
1280    // can be modified. See DisplayConfigurations below for details.
1281    //
1282    // The id can be used to get or stream a screenshot.
1283    uint32 display = 5;
1284}
1285// Provides information about all the displays that can be attached
1286// to the emulator. The emulator will always have at least one display.
1287//
1288// The emulator usually has the following display configurations:
1289// 0:      The default display.
1290// 1 - 3:  User configurable displays. These can be added/removed.
1291//         For example the standalone emulator allows you to modify these
1292//         in the extended controls.
1293// 6 - 11: Fixed external displays. For example Android Auto uses fixed
1294//         displays in this range.
1295message DisplayConfigurations {
1296    repeated DisplayConfiguration displays = 1;
1297
1298    // Display configurations with id [1, userConfigurable] are
1299    // user configurable, that is they can be added, removed or
1300    // updated.
1301    uint32 userConfigurable = 2;
1302
1303    // The maximum number of attached displays this emulator supports.
1304    // This is the total number of displays that can be attached to
1305    // the emulator.
1306    //
1307    // Note: A display with an id that is larger than userConfigurable cannot
1308    // be modified.
1309    uint32 maxDisplays = 3;
1310}
1311
1312message Notification {
1313    enum EventType {
1314        VIRTUAL_SCENE_CAMERA_INACTIVE = 0;
1315        VIRTUAL_SCENE_CAMERA_ACTIVE = 1;
1316
1317        // Fired when an update to a display event has been fired through
1318        // the extended ui. This does not fire events when the display
1319        // is changed through the console or gRPC endpoint.
1320        DISPLAY_CONFIGURATIONS_CHANGED_UI = 2;
1321
1322        // Don't add new event types here, add them to "oneof type" below.
1323    }
1324
1325    // Deprecated, use the type below to get detailed information
1326    // regarding the event.
1327    EventType event = 1 [deprecated = true];
1328
1329    // Detailed notification information.
1330    oneof type {
1331        CameraNotification cameraNotification = 2;
1332        DisplayConfigurationsChangedNotification
1333                displayConfigurationsChangedNotification = 3;
1334        Posture posture = 4;
1335        BootCompletedNotification booted = 5;
1336        BrightnessValue brightness = 6;
1337    }
1338}
1339
1340message BootCompletedNotification {
1341    // The time in milliseconds it took for the boot to complete.
1342    // Note that this value can be 0 when you are loading from a snapshot.
1343    int32 time = 1;
1344}
1345
1346// Fired when the virtual scene camera is activated or deactivated and also in
1347// response to the streamNotification call.
1348message CameraNotification {
1349    // Indicates whether the camera app was activated or deactivated.
1350    bool active = 1;
1351    // The display the camera app is associated with.
1352    int32 display = 2;
1353}
1354
1355// Fired when an update to a display event has been fired through the extended
1356// ui. This does not fire events when the display is changed through the console
1357// or the gRPC endpoint.
1358message DisplayConfigurationsChangedNotification {
1359    DisplayConfigurations displayConfigurations = 1;
1360}
1361
1362// Rotation angles are relative to the current orientation.
1363message RotationRadian {
1364    float x = 1;  // Angle of rotation around the x axis in right-handed direction.
1365    float y = 2;  // Angle of rotation around the y axis in right-handed direction.
1366    float z = 3;  // Angle of rotation around the z axis in right-handed direction.
1367}
1368
1369// Velocity is measured in meters per second.
1370message Velocity {
1371    float x = 1;
1372    float y = 2;
1373    float z = 3;
1374}
1375
1376// Must follow the definition in "external/qemu/android/hw-sensors.h"
1377message Posture {
1378    enum PostureValue {
1379        POSTURE_UNKNOWN = 0;
1380        POSTURE_CLOSED = 1;
1381        POSTURE_HALF_OPENED = 2;
1382        POSTURE_OPENED = 3;
1383        POSTURE_FLIPPED = 4;
1384        POSTURE_TENT = 5;
1385        POSTURE_MAX = 6;
1386    }
1387    PostureValue value = 3;
1388}
1389
1390message PhoneNumber {
1391    //
1392    // The phone number should be a valid GSM-formatted number as specified by
1393    // 3GPP 23.040 Sec 9.1.2.5.
1394    //
1395    // For example: +3106225412 or (650) 555-1221
1396    string number = 1;
1397}
1398