Android-ElectricSheep-Automator

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

- **`device-object`** should be
an already existing [Android::ElectricSheep::Automator::DeviceProperties](https://metacpan.org/pod/Android%3A%3AElectricSheep%3A%3AAutomator%3A%3ADeviceProperties)
object.

It returns `0` on success, `1` on failure.

## **`dump_current_screen_ui($params)`**

It dumps the current screen as XML and returns that as
a string, optionally saving it to the specified file.

`$params` is a HASH\_REF which may or should contain:

- **`filename`**

    optionally save the returned XML string to the specified file.

It returns `undef` on failure or the UI XML dump, as a string, on success.

## **`dump_current_screen_shot($params)`**

It dumps the current screen as a PNG image and returns that as
a [Image::PNG](https://metacpan.org/pod/Image%3A%3APNG) object, optionally saving it to the specified file.

`$params` is a HASH\_REF which may or should contain:

- **`filename`**

    optionally save the returned XML string to the specified file.

It returns `undef` on failure or a [Image::PNG](https://metacpan.org/pod/Image%3A%3APNG) image, on success.

## **`dump_current_screen_video($params)`**

It dumps the current screen as MP4 video and saves that
in specified file.

`$params` is a HASH\_REF which may or should contain:

- **`filename`**

    save the recorded video to the specified file in MP4 format. This
    is required.

- **`time-limit`**

    optionally specify the duration of the recorded video, in seconds. Default is 10 seconds.

- **`bit-rate`**

    optionally specify the bit rate of the recorded video in bits per second. Default is 20Mbps.

- **`size`**

    optionally specify the size (geometry) of the recorded video as a
    HASH\_REF with keys `width` and `height`, in pixels. Default is "_the
    device's main display resolution_".

- **`bugreport`**

    optionally set this flag to 1 to have Android overlay debug information
    on the recorded video, e.g. timestamp.

- **`display-id`**

    for a device set up with multiple physical displays, optionally
    specify which one to record -- if not the main display -- by providing the
    display id. You can find display ids with ["list\_physical\_displays()"](#list_physical_displays)
    or, from the CLI, by `adb shell dumpsys SurfaceFlinger --display-id`

`adb shell screenrecord --help` contains some more documentation.

## **`list_physical_displays()`**

It lists the IDs of all the physical displays connected to the
device, including the main one and returns these back as a HASH\_REF
keyed on display ID. It needs that connect\_device() to have been called prior to this call

It returns `undef` on failure or the results as a HASH\_REF keyed on display ID.

## **`list_running_processes($params)`**

It finds the running processes on device (using a \`ps\`),
optionally can save the (parsed) \`ps\`
results as JSON to the specified 'filename'.
It returns `undef` on failure or the results as a hash of hashes on success.

`$params` is a HASH\_REF which may or should contain:

- **`extra-fields`**

    optionally add more fields (columns) to the report by `ps`, as an ARRAY\_REF.
    For example, `['TTY','TIME']`.

It needs that connect\_device() to have been called prior to this call

It returns `undef` on failure or a hash with these keys on success:

- **`raw`** : contains the raw \`ps\` output as a string.
- **`perl`** : contains the parsed raw output as a Perl hash with
each item corresponding to one process, keyed on process command and arguments
(as reported by `ps`, verbatim), as a hash keyed on each field (column)
of the `ps` output.
- **`json`** : the above data converted into a JSON string.

## **`pidof($params)`**

It returns the PID of the specified command name.
The specified command name must match the app or command
name exactly. **Use L/pgrep()** if you want to match command
names with a regular expression>.

`$params` is a HASH\_REF which should contain:

- **`name`**

    the name of the process. It can be a command name,
    e.g. `audioserver` or an app name e.g. `android.hardware.vibrator-service.example`.

It returns `undef` on failure or the PID of the matched command on success.



( run in 0.684 second using v1.01-cache-2.11-cpan-39bf76dae61 )