airtest.core.android.cap_methods.minicap module

retry_when_socket_error(func)[source]
class Minicap(adb, projection=None, rotation_watcher=None, display_id=None, ori_function=None)[source]

Bases: BaseCap

super fast android screenshot method from stf minicap.

reference https://github.com/openstf/minicap

VERSION = 5
RECVTIMEOUT = 3
CMD = 'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap'
install_or_upgrade()[source]

Install or upgrade minicap

Returns:

None

uninstall()[source]

Uninstall minicap

Returns:

None

install()[source]

Install minicap

Reference: https://github.com/openstf/minicap/blob/master/run.sh

Returns:

None

get_frame(projection=None)[source]
Get the single frame from minicap -s, this method slower than get_frames

1. shell cmd 1. remove log info 1.

->

Args:

projection: screenshot projection, default is None which means using self.projection

Returns:

jpg data

get_stream(lazy=True)[source]

Get stream, it uses `adb forward`and socket communication. Use minicap ``lazy``mode (provided by gzmaruijie) for long connections - returns one latest frame from the server

Parameters:

lazy – True or False

Returns:

get_frame_from_stream()[source]

Get one frame from minicap stream

Returns:

frame

snapshot(ensure_orientation=True, projection=None)[source]
Parameters:
  • ensure_orientation – True or False whether to keep the orientation same as display

  • projection – the size of the desired projection, (width, height)

Returns:

update_rotation(rotation)[source]

Update rotation and reset the backend stream generator

Parameters:

rotation – rotation input

Returns:

None

teardown_stream()[source]

End the stream

Returns:

None