Project

General

Profile

Actions

Screenshots » History » Revision 12

« Previous | Revision 12/17 (diff) | Next »
dl lud, 01/24/2020 05:31 AM


Screenshots

On Android, it is usually possible to take a screenshot by pressing simultaneously the Volume Down and Power buttons. A shortcut can also be added to the menu that pops up when long-pressing the Power button. Unfortunately this doesn't work out-of-the-box in Replicant because libagl, the software renderer used for SurfaceFlinger (screen compositor), has an incomplete OpenGL ES implementation.

Taking screenshots in Replicant

It is possible to take screenshots from within Replicant by forcing SurfaceFlinger to use llvmpipe. Be aware that this will make your system extremely slow and bring in rendering issue to apps such as Gallery and Orbot.

Replicant 6.0 0003

On Replicant 6.0 0003 it is only possible to change the software renderer system-wide. Please follow the instructions at Graphics - Choosing the default software renderer.

Replicant 6.0 0004

As of Replicant 6.0 0004, llvmpipe is used as the default renderer. However, due to performance reasons, an exception is in place that forces SurfaceFlinger to use libagl instead. Follow these steps to remove the exception:

  1. Install ADB on your computer. Make sure that it can access the device's root shell and that the system partition is mounted as writable.
  2. Remove the file that makes SurfaceFlinger use libagl:
    adb shell rm /system/etc/libGLES_android/system/bin/surfaceflinger
    
  3. Reboot your device.
  4. To revert, recreate the file (it is just an empty file):
    adb shell touch /system/etc/libGLES_android/system/bin/surfaceflinger
    

Taking screenshots with a computer

Regardless of which graphics renderer is enabled, it is possible to take screenshots when the device is connected to a computer through an USB cable. The following steps explain the procedure.

  1. Make sure ADB is installed on your computer and that it can access the device's root shell
  2. Download this script: screencap.sh
  3. You need to have ffmpeg installed. If ffmpeg is not available on your GNU/Linux distribution but avconv is (e.g. as part of libav-tools), you will have to change the line
    FFMEG="ffmpeg" 
    

    to
    FFMEG="avconv" 
    

    at the beginning of the script.
  4. Run the script to take a screenshot:
    ./screencap.sh -f OUTPUT.PNG
    

    OUTPUT:PNG is the filename of the screenshot. The screenshot will be saved with this filename in the directory you are running the script in. The script only supports the PNG format for screenshots.

The display size in pixels is auto-detected. If you want the script to be faster, you can add the screen size as another option, e.g.:

./screencap.sh -s 720x1280 -f OUTPUT.PNG

In recovery mode

It is also possible to take screenshots in recovery mode with the script by running:

./screencap.sh -r -s SCREENSIZE -f OUTPUT.PNG

Screen size detection does not work in recovery mode. The screen size must be specified.

Updated by dl lud about 4 years ago · 12 revisions

Also available in: PDF HTML TXT