From eb0c8951196c637e44daf3c0617b131b997d5d2c Mon Sep 17 00:00:00 2001 From: Lena Date: Thu, 1 Jan 2026 00:00:00 +0000 Subject: scrcpy-android: mirror an Android device over wireless ADB Native Java app for Android 12+ that mirrors another Android device over wireless ADB, forwarding video, audio, touch input, and clipboard. Bundles a pinned scrcpy-server.jar and the vendored libadb-android stack. Supports h264/h265/av1 video and raw/opus audio with in-app codec selection. No NDK, no Kotlin. Includes JVM unit tests and a Docker-based emulator e2e rig. --- test-rig/Pixhash.java | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test-rig/Pixhash.java (limited to 'test-rig/Pixhash.java') diff --git a/test-rig/Pixhash.java b/test-rig/Pixhash.java new file mode 100644 index 0000000..47ab8b8 --- /dev/null +++ b/test-rig/Pixhash.java @@ -0,0 +1,54 @@ +// Verify that a screencap PNG is non-uniform - i.e., MediaCodec +// actually painted something. Exits 0 if the image has at least +// `--min` percent of pixels that differ from pixel (0,0); 1 otherwise. +// +// java test-rig/Pixhash.java # default min=5% +// java test-rig/Pixhash.java --min 1 +// +// We avoid AWT's BufferedImage because some headless JDKs ship without +// it; ImageIO is in java.desktop which IS present in the openjdk-17-jdk +// package in our image, so it's fine. + +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; + +public final class Pixhash { + + public static void main(String[] args) throws IOException { + if (args.length < 1) { + System.err.println("usage: java Pixhash.java [--min N]"); + System.exit(2); + } + double minPercent = 5.0; + for (int i = 1; i < args.length; i++) { + if ("--min".equals(args[i]) && i + 1 < args.length) { + minPercent = Double.parseDouble(args[++i]); + } + } + + BufferedImage img = ImageIO.read(new File(args[0])); + if (img == null) { + System.err.println("pixhash: could not read " + args[0]); + System.exit(2); + } + + int w = img.getWidth(), h = img.getHeight(); + int ref = img.getRGB(0, 0); + long total = (long) w * h; + long diff = 0; + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + if (img.getRGB(x, y) != ref) diff++; + } + } + double pct = 100.0 * diff / total; + System.out.printf("pixhash: %d/%d differ from (0,0)=%08x => %.2f%%%n", + diff, total, ref, pct); + if (pct < minPercent) { + System.err.printf("pixhash: only %.2f%% differ, need %.2f%%%n", pct, minPercent); + System.exit(1); + } + } +} -- cgit v1.2.3