Get desktop application:
View/edit binary Protocol Buffers messages
An EmulatorController service lets you control the emulator. Note that this is currently an experimental feature, and that the service definition might change without notice. Use at your own risk! We use the following rough conventions: streamXXX --> streams values XXX (usually for emulator lifetime). Values are updated as soon as they become available. getXXX --> gets a single value XXX setXXX --> sets a single value XXX, does not returning state, these usually have an observable lasting side effect. sendXXX --> send a single event XXX, possibly returning state information. android usually responds to these events.
set/get/stream the sensor data
set/get/stream the physical model, this is likely the one you are looking for when you wish to modify the device state.
Atomically set/get the current primary clipboard data.
Streams the current data on the clipboard. This will immediately produce a result with the current state of the clipboard after which the stream will block and wait until a new clip event is available from the guest. Calling the setClipboard method above will not result in generating a clip event. It is possible to lose clipboard events if the clipboard updates very rapidly.
Set/get the battery to the given state.
Set the state of the gps, gps support will only work properly if: - no location ui is active. That is the emulator is launched in headless mode (-no-window) or the location ui is disabled (-no-location-ui). - the passiveUpdate is set to false. Setting this to false will disable/break the LocationUI. Keep in mind that android usually only samples the gps at 1 hz.
Gets the latest gps state as delivered by the setGps call, or location ui if active. Note: this is not necessarily the actual gps coordinate visible at the time, due to gps sample frequency (usually 1hz).
Simulate a touch event on the finger print sensor.
True when the fingprint is touched.
The identifier of the registered fingerprint.
Send a keyboard event. Translating the event.
KeyboardEvent objects describe a user interaction with the keyboard; each event describes a single interaction between the user and a key (or combination of a key with modifier keys) on the keyboard. This follows the pattern as set by (javascript)[https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent] Note: that only keyCode, key, or text can be set and that the semantics will slightly vary.
Type of keycode contained in the keyCode field.
The type of keyboard event that should be sent to the emulator
This property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). In other words, this property is a value which isn't altered by keyboard layout or the state of the modifier keys. This value will be interpreted by the emulator depending on the KeyCodeType. The incoming key code will be translated to an evdev code type and send to the emulator. The values in key and text will be ignored.
The value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout. This follows the w3c standard used in browsers. You can find an accurate description of valid values [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) Note that some keys can result in multiple evdev events that are delivered to the emulator. for example the Key "A" will result in a sequence: ["Shift", "a"] -> [0x2a, 0x1e] whereas "a" results in ["a"] -> [0x1e]. Not all documented keys are understood by android, and only printable ASCII [32-127) characters are properly translated. Keep in mind that there are a set of key values that result in android specific behavior [see](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Phone_keys): - "AppSwitch": Behaves as the "Overview" button in android. - "GoBack": The Back button. - "GoHome": The Home button, which takes the user to the phone's main screen (usually an application launcher). - "Power": The Power button.
Series of utf8 encoded characters to send to the emulator. An attempt will be made to translate every character will an EvDev event type and send to the emulator as a keypress event. The values in keyCode, eventType, codeType and key will be ignored. Note that most printable ASCII characters (range [32-127) can be send individually with the "key" param. Do not expect arbitrary UTF symbols to arrive in the emulator (most will be ignored).
Send touch/mouse events. Note that mouse events can be simulated by touch events.
A TouchEvent contains a list of Touch objects that are in contact with the touch surface. Touch events are delivered in sequence as specified in the touchList. TouchEvents are delivered to the emulated devices using ["Protocol B"](https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt)
The list of Touch objects, note that these do not need to be unique
The display device where the touch event occurred. Omitting or using the value 0 indicates the main display. Touch events cannot be send to devices other than 0, due to https://issuetracker.google.com/issues/150699691
The MouseEvent interface represents events that occur due to the user interacting with a pointing device (such as a mouse).
The horizontal coordinate. This is the physical location on the screen For example 0 indicates the leftmost coordinate.
The vertical coordinate. This is the physical location on the screen For example 0 indicates the top left coordinate.
Indicates which buttons are pressed. 0: No button was pressed 1: Primary button (left) 2: Secondary button (right)
The display device where the mouse event occurred. Omitting or using the value 0 indicates the main display.
Make a phone call.
Sends an sms message to the emulator.
The source address where this message came from. The address should be a valid GSM-formatted address as specified by 3GPP 23.040 Sec 9.1.2.5. For example: +3106225412 or (650) 555-1221
A utf8 encoded text message that should be delivered.
Retrieve the status of the emulator. This will contain general hardware information, and whether the device has booted or not.
The emulator version string.
The time the emulator has been active in .ms
True if the device has completed booting. For P and later this information will accurate, for older images we rely on adb.
The current vm configuration
The hardware configuration of the running emulator as key valure pairs.
Gets an individual screenshot in the desired format. The image will be scaled to the desired ImageFormat, while maintaining the aspect ratio. The returned image will never exceed the provided width and height. Not setting the width or height (i.e. they are 0) will result in using the device width and height. The resulting image will be properly oriented and can be displayed directly without post processing. For example, if the device has a 1080x1920 screen and is in landscape mode and called with no width or height parameter, it will return an 1920x1080 image. This method will return an empty image if the display is not visible.
Streams a series of screenshots in the desired format. A new frame will be delivered whenever the device produces a new frame. (Beware that this can produce a significant amount of data, and that certain translations are (png transform) can be costly). If the requested display is not visible it will send a single empty image and wait start producing images once the display becomes active, again producing a single empty image when the display becomes inactive.
Streams a series of audio packets in the desired format. A new frame will be delivered whenever the emulated device produces a new audio frame.
Unix epoch in us when this frame was captured.
Contains a sample in the given audio format.
Returns the last 128Kb of logcat output from the emulator Note that parsed logcat messages are only available after L (Api >23). it is possible that the logcat buffer gets overwritten, or falls behind.
Streams the logcat output from the emulator. The first call can retrieve up to 128Kb. This call will not return. Note that parsed logcat messages are only available after L (Api >23) it is possible that the logcat buffer gets overwritten, or falls behind.
Transition the virtual machine to the desired state. Note that some states are only observable. For example you cannot transition to the error state.
Gets the state of the virtual machine.
Used as request type in: EmulatorController.streamAudio
Used as field type in:
Sampling rate to use, defaulting to 44100 if this is not set. Note, that android devices typically will not use a sampling rate higher than 48kHz. See https://developer.android.com/ndk/guides/audio.
Used in:
Used in:
Unsigned 8 bit
Signed 16 bit (little endian)
Used as request type in: EmulatorController.setBattery
Used as response type in: EmulatorController.getBattery
Used in:
Used in:
Used in:
Representation of a clipped data object on the clipboard.
Used as request type in: EmulatorController.setClipboard
Used as response type in: EmulatorController.getClipboard, EmulatorController.streamClipboard
UTF-8 Encoded text.
Used in:
Used in:
Used as request type in: EmulatorController.setGps
Used as response type in: EmulatorController.getGps
Setting this to false will disable auto updating from the LocationUI, otherwise the location UI will override the location at a frequency of 1hz. - This is unused if the emulator is launched with -no-window, or when he location ui is disabled. - This will BREAK the location ui experience if it is set to false. For example routing will no longer function.
The latitude, in degrees.
The longitude, in degrees.
The speed if it is available, in meters/second over ground
gets the horizontal direction of travel of this device, and is not related to the device orientation. It is guaranteed to be in the range [0.0, 360.0] if the device has a bearing. 0=North, 90=East, 180=South, etc..
The altitude if available, in meters above the WGS 84 reference ellipsoid.
The number of satellites used to derive the fix
Used as response type in: EmulatorController.getScreenshot, EmulatorController.streamScreenshot
width is contained in format.
height is contained in format.
The organization of the pixels in the image buffer is from left to right and bottom up. This will be empty if an alternative image transport is requested in the image format. In that case the side channel should be used to obtain the image data.
[Output Only] Monotonically increasing sequence number in a stream of screenshots. The first screenshot will have a sequence of 0. A single screenshot will always have a sequence number of 0. The sequence is not necessarily contiguous, and can be used to detect how many frames were dropped. An example sequence could be: [0, 3, 5, 7, 9, 11].
Used as request type in: EmulatorController.getScreenshot, EmulatorController.streamScreenshot
Used as field type in:
The (desired) format of the resulting bytes.
[Output Only] The rotation of the image. The image will be rotated based upon the coarse grained orientation of the device.
The (desired) width of the image. When passed as input the image will be scaled to match the given width, while maintaining the aspect ratio of the device. The returned image will never exceed the given width, but can be less. Omitting this value (or passing in 0) will result in no scaling, and the width of the actual device will be used.
The (desired) height of the image. When passed as input the image will be scaled to match the given height, while maintaining the aspect ratio of the device. The returned image will never exceed the given height, but can be less. Omitting this value (or passing in 0) will result in no scaling, and the height of the actual device will be used.
The (desired) display id of the device. Setting this to 0 (or omitting) indicates the main display.
Set this if you wish to use a different transport channel to deliver image frames.
Used in:
Portable Network Graphics format (https://en.wikipedia.org/wiki/Portable_Network_Graphics)
Three-channel RGB color model supplemented with a fourth alpha channel. https://en.wikipedia.org/wiki/RGBA_color_model Each pixel consists of 4 bytes.
Three-channel RGB color model, each pixel consists of 3 bytes
An ImageTransport allows for specifying a side channel for delivering image frames versus using the standard bytes array that is returned with the gRPC request.
Used in:
The desired transport channel used for delivering image frames. Only relevant when streaming screenshots.
Handle used for writing image frames if transport is mmap. The client sets and owns this handle. It can be either a shm region, or a mmap. A mmap should be a url that starts with `file:///` Note: the mmap can result in tearing.
Used in:
Return full frames over the gRPC transport
Write images to the a file/shared memory handle.
Code types that the emulator can receive. Note that the emulator will do its best to translate the code to an evdev value that will be send to the emulator. This translation is based on the chromium translation tables. See (this)[https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-grpc/android/emulation/control/keyboard/keycode_converter_data.inc] for details on the translation.
Used in:
Used in:
Indicates that this keyevent should be send to the emulator as a key down event. Meaning that the key event will be translated to an EvDev event type and bit 11 (0x400) will be set before it is sent to the emulator.
Indicates that the keyevent should be send to the emulator as a key up event. Meaning that the key event will be translated to an EvDev event type and sent to the emulator.
Indicates that the keyevent will be send to the emulator as e key down event and immediately followed by a keyup event.
Used as request type in: EmulatorController.getLogcat, EmulatorController.streamLogcat
Used as response type in: EmulatorController.getLogcat, EmulatorController.streamLogcat
[Output Only] The contents of the log output.
The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer, older output will be overwritten by newer content and the start values will be mismatched.
[Output Only] The position of the next byte of content from the serial console output. Use this value in the next request as the start parameter.
Set the sort of response you are interested it in. It the type is "Parsed" the entries field will contain the parsed results. otherwise the contents field will be set.
[Output Only] The parsed logcat entries so far. Only set if sort is set to Parsed
Used in:
A parsed logcat entry.
Used in:
A Unix timestamps in milliseconds (The number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds)
Process id.
Thread id.
The possible log levels.
Used in:
Used in:
,Used in:
Used as response type in: EmulatorController.sendPhone, EmulatorController.sendSms
Used in:
Enum out of range
Mal-formed telephone number
E.g., disconnect when no call is in progress
Internal error
Radio power off
Used as request type in: EmulatorController.getPhysicalModel, EmulatorController.setPhysicalModel, EmulatorController.streamPhysicalModel
Used as response type in: EmulatorController.getPhysicalModel, EmulatorController.streamPhysicalModel
[Output Only]
Value interpretation depends on sensor, will contain at most 3 values.
Details on the sensors documentation can be found here: https://developer.android.com/reference/android/hardware/Sensor.html#TYPE_
Used in:
All values are angles in degrees. values = [x,y,z]
Temperature in °C
Proximity sensor distance measured in centimeters
Ambient light level in SI lux units
Atmospheric pressure in hPa (millibar)
Relative ambient air humidity in percent
Used in:
qemud service is not available/initiated.
Sensor is disabled.
Unknown sensor (should not happen)
Used in:
Can be inferred from z-axis as well.
Specifies the angle of rotation, in degrees [-180, 180]
Used in:
0 degrees
90 degrees
-180 degrees
-90 degrees
A single sensor value.
Used as request type in: EmulatorController.getSensor, EmulatorController.setSensor, EmulatorController.streamSensor
Used as response type in: EmulatorController.getSensor, EmulatorController.streamSensor
Type of sensor
[Output Only]
Value interpretation depends on sensor enum, will contain at most 3 values.
These are the various sensors that can be available in an emulated devices.
Used in:
Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity.
Measures a device's rate of rotation in rad/s around each of the three physical axes (x, y, and z).
Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT.
Measures degrees of rotation that a device makes around all three physical axes (x, y, z)
Measures the temperature of the device in degrees Celsius (°C).
Measures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a person's ear.
Measures the ambient light level (illumination) in lx.
Measures the ambient air pressure in hPa or mbar.
Measures the relative ambient humidity in percent (%).
Used in:
qemud service is not available/initiated.
Sensor is disabled.
Unknown sensor (should not happen)
The Touch interface represents a single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad.
Used in:
The horizontal coordinate. This is the physical location on the screen For example 0 indicates the leftmost coordinate.
The vertical coordinate. This is the physical location on the screen For example 0 indicates the top left coordinate.
The identifier is an arbitrary non-negative integer that is used to identify and track each tool independently when multiple tools are active. For example, when multiple fingers are touching the device, each finger should be assigned a distinct tracking id that is used as long as the finger remains in contact. Tracking ids may be reused when their associated tools move out of range. The emulator currently supports up to 10 concurrent touch events. The identifier should be a value from the set [0, 10]
Reports the physical pressure applied to the tip of the tool or the signal strength of the touch contact. The values reported must be non-zero when the tool is touching the device and zero otherwise to indicate that the touch event is completed. Make sure to deliver a pressure of 0 for the given identifier when the touch event is completed, otherwise the touch identifier will not be unregistered!
Optionally reports the cross-sectional area of the touch contact, or the length of the longer dimension of the touch contact.
Optionally reports the length of the shorter dimension of the touch contact. This axis will be ignored if touch_major is reporting an area measurement greater than 0.
Information about the hypervisor that is currently in use.
Used in:
Used in:
An unknown hypervisor
No hypervisor is in use. This usually means that the guest is running on a different CPU than the host, or you are using a platform where no hypervisor is available.
The Kernel based Virtual Machine (https://www.linux-kvm.org/page/Main_Page)
Intel® Hardware Accelerated Execution Manager (Intel® HAXM) https://github.com/intel/haxm
Hypervisor Framework. https://developer.apple.com/documentation/hypervisor
Window Hypervisor Platform https://docs.microsoft.com/en-us/virtualization/api/
A Run State that describes the state of the Virtual Machine.
Used as request type in: EmulatorController.setVmState
Used as response type in: EmulatorController.getVmState
Used in:
The emulator is in an unknown state. You cannot transition to this state.
Guest is actively running. You can transition to this state from the paused state.
Guest is paused to load a snapshot. You cannot transition to this state.
Guest has been paused. Transitioning to this state will pause the emulator the guest will not be consuming any cpu cycles.
Guest is paused to take or export a snapshot. You cannot transition to this state.
System shutdown, note that it is similar to power off. It tries to set the system status and notify guest. The system is likely going to disappear soon and do proper cleanup of resources, possibly taking a snapshot. This is the same behavior as closing the emulator by clicking the X (close) in the user interface.
Immediately terminate the emulator. No resource cleanup will take place. There is a good change to corrupt the system.
Will cause the emulator to reset. This is not a state you can observe.
Guest experienced some error state, you cannot transition to this state.