From f749d4c34047d67bb2832ee8d9a4d355bc5fade5 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Wed, 23 Sep 2026 01:08:18 -0400 Subject: [PATCH] [trace_replay] (P7): pin the signed APK path used by a preinstalled device run --- tools/trace_replay/run_android_retrace_local.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/trace_replay/run_android_retrace_local.py b/tools/trace_replay/run_android_retrace_local.py index 0938ca6a..7d0b7635 100644 --- a/tools/trace_replay/run_android_retrace_local.py +++ b/tools/trace_replay/run_android_retrace_local.py @@ -78,6 +78,15 @@ def is_lfs_pointer(path): def find_trace_apk(): + # A preinstalled APK need not be the newest Gradle output in this tree. + # Let the caller pin the exact signed file used for the session so run.json + # does not present an unrelated local build's SHA as device provenance. + override = __import__("os").environ.get("MOBILEGL_TRACE_APK", "").strip() + if override: + path = Path(override).expanduser().resolve() + if not path.is_file(): + raise FileNotFoundError(f"MOBILEGL_TRACE_APK does not exist: {path}") + return path candidates = [ path for directory in TRACE_APK_DIRS