From ddec2a7b399e51e68f76c9b0d37c349820e52461 Mon Sep 17 00:00:00 2001 From: James Babcock Date: Tue, 14 Jul 2026 15:58:12 -0700 Subject: [PATCH] Add scripts for pulling/pushing configs, frame timings; update ackrc --- .ackrc | 1 + scripts/pull-frame-timings.sh | 3 +++ scripts/pull_config.sh | 11 +++++++++++ scripts/push_config.sh | 31 +++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 .ackrc create mode 100755 scripts/pull-frame-timings.sh create mode 100755 scripts/pull_config.sh create mode 100755 scripts/push_config.sh diff --git a/.ackrc b/.ackrc new file mode 100644 index 00000000..005c600d --- /dev/null +++ b/.ackrc @@ -0,0 +1 @@ +--ignore-file=match:.mjs diff --git a/scripts/pull-frame-timings.sh b/scripts/pull-frame-timings.sh new file mode 100755 index 00000000..87ffbf66 --- /dev/null +++ b/scripts/pull-frame-timings.sh @@ -0,0 +1,3 @@ +#!/bin/bash +adb pull /sdcard/Android/data/com.faceclaw.app/files/frame-timings.txt + diff --git a/scripts/pull_config.sh b/scripts/pull_config.sh new file mode 100755 index 00000000..61e6fdcc --- /dev/null +++ b/scripts/pull_config.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Pull faceclaw's shared preferences off the attached device. +# Usage: pull_config.sh [output-file] (default: faceclaw_settings.xml) +set -euo pipefail + +PACKAGE=com.faceclaw.app +PREFS=shared_prefs/faceclaw_settings.xml +OUT="${1:-faceclaw_settings.xml}" + +adb exec-out run-as "$PACKAGE" cat "$PREFS" > "$OUT" +echo "Pulled $PREFS to $OUT" diff --git a/scripts/push_config.sh b/scripts/push_config.sh new file mode 100755 index 00000000..f5bbf526 --- /dev/null +++ b/scripts/push_config.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Push a shared-preferences file to faceclaw on the attached device. +# Usage: push_config.sh [input-file] (default: faceclaw_settings.xml) +# Validates the XML, force-stops the app (so a running instance doesn't +# overwrite the pushed file from its in-memory prefs), then installs it. +set -euo pipefail + +PACKAGE=com.faceclaw.app +PREFS=shared_prefs/faceclaw_settings.xml +IN="${1:-faceclaw_settings.xml}" +STAGE=/data/local/tmp/faceclaw_settings_push.xml + +if [ ! -f "$IN" ]; then + echo "Error: $IN not found" >&2 + exit 1 +fi + +if command -v xmllint >/dev/null 2>&1; then + xmllint --noout "$IN" +elif command -v python3 >/dev/null 2>&1; then + python3 -c 'import sys, xml.etree.ElementTree as ET; ET.parse(sys.argv[1])' "$IN" +else + echo "Error: need xmllint or python3 to validate XML" >&2 + exit 1 +fi + +adb shell am force-stop "$PACKAGE" +adb push "$IN" "$STAGE" +adb shell run-as "$PACKAGE" cp "$STAGE" "$PREFS" +adb shell rm "$STAGE" +echo "Pushed $IN to $PREFS (app was force-stopped; relaunch it to pick up the new settings)"