Skip to content

Commit

Permalink
add minicap.apk
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Sep 16, 2021
1 parent 6c36d69 commit b759bb5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,20 @@ Repo to place STF binaries
```
npm outdated # show outdated package
npm update # update all deps
```
```

## Usage of minicap.apk
```bash
./take-screenshot-with-minicap-apk.sh
```

But the script is not working on my mobile phone.

Source can be found in <https://github.com/DeviceFarmer/minicap/blob/master/experimental>

Usage ref:

- <https://github.com/DeviceFarmer/stf/pull/262/files>
- <https://github.com/DeviceFarmer/minicap/blob/master/experimental/app/src/main/java/io/devicefarmer/minicap/Main.kt>


14 changes: 14 additions & 0 deletions take-screenshot-with-minicap-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -x
#
set -e

adb push node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk /data/local/tmp/

JSON=$(adb shell CLASSPATH=/data/local/tmp/minicap.apk app_process /system/bin io.devicefarmer.minicap.Main -i)

WIDTH=$(jq ".width" <<< $JSON)
HEIGHT=$(jq ".height" <<< $JSON)
ROTATION=$(jq ".rotation" <<< $JSON)

adb shell CLASSPATH=/data/local/tmp/minicap.apk app_process /system/bin io.devicefarmer.minicap.Main -P "${WIDTH}x@${HEIGHT}@${WIDTH}x${HEIGHT}/$ROTATION" -Q 80 -s > tmp.jpg
file tmp.jpg

0 comments on commit b759bb5

Please sign in to comment.