Collapse mode and layer onto one picker row; fix renderer diagnosis
Only one layer is ever active, so neither mode nor layer needs a scrolling row. Two pickers side by side cost one 44px row instead of two. The panel needed that space: .pads uses minmax(34px,1fr) rows and sat exactly at the 34px floor, so the SP-404 illustration clipped at the bottom. Measured on device: strip 96px -> 44px panel 433px -> 485px pads 142px -> 194px, rows 34px -> 44.75px unit overflow 1px -> 0 The layer list is read out of the reference's own chips at render time, so its set, ordering and counts cannot drift from renderExplore(). Also corrects the renderer-denial root cause. It is not screen state: a denial was observed with Reason[screen_on & caller care]. Every failure followed 'adb install -r' and an immediate relaunch has always succeeded, so device.sh now retries the force-stop/start cycle instead of blaming the lockscreen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,25 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Device helpers for driving the app over adb.
|
||||
#
|
||||
# TCL's AppBootManagerService refuses to let the app bind the WebView's renderer
|
||||
# process while the display is dozing:
|
||||
# TCL's AppBootManagerService sometimes refuses to let the app bind the
|
||||
# WebView's renderer process:
|
||||
#
|
||||
# W/AppBootManager: Result[false]; Target[...SandboxedProcessService0];
|
||||
# Caller[dev.ncode.sp404layers]; Reason[screen_off & caller care]
|
||||
# Caller[dev.ncode.sp404layers]; Reason[screen_on & caller care]
|
||||
# E/cr_ChildProcessConn: Failed to establish the service connection.
|
||||
#
|
||||
# With no renderer the page never parses: no crash, no JS error, an empty
|
||||
# document.title, and DevTools Runtime.evaluate hangs. It is sticky for the life
|
||||
# of the process, so reopening from Recents keeps the blank window.
|
||||
#
|
||||
# So: always ensure the screen is awake before launching, and say so plainly
|
||||
# when it is not, rather than leaving a blank window to puzzle over.
|
||||
# Observed trigger is the window just after `adb install -r` replaces the
|
||||
# package - every failure followed an install, and an immediate relaunch with no
|
||||
# install has always succeeded. The Reason string reports the current screen
|
||||
# state ("screen_on" and "screen_off" have both been seen denying), so screen
|
||||
# state is not the cause. Hence: launch retries the whole cycle.
|
||||
set -euo pipefail
|
||||
|
||||
ADB="${ADB:-$HOME/Android/Sdk/platform-tools/adb}"
|
||||
PKG=dev.ncode.sp404layers
|
||||
ACT="$PKG/.MainActivity"
|
||||
PORT=9333
|
||||
ATTEMPTS=3
|
||||
|
||||
# Not the cause of the denial, but a locked phone cannot be checked visually
|
||||
# and input keyevents will not reach the app.
|
||||
ensure_awake() {
|
||||
"$ADB" shell input keyevent KEYCODE_WAKEUP >/dev/null 2>&1 || true
|
||||
"$ADB" shell input keyevent 82 >/dev/null 2>&1 || true
|
||||
@@ -30,14 +37,11 @@ ensure_awake() {
|
||||
|
||||
if [ "$wake" != "Awake" ] || [ "$lock" = "true" ]; then
|
||||
echo "" >&2
|
||||
echo " ####################################################################" >&2
|
||||
echo " # UNLOCK THE PHONE #" >&2
|
||||
echo " # #" >&2
|
||||
echo " #############################################################" >&2
|
||||
echo " # UNLOCK THE PHONE #" >&2
|
||||
echo " # wakefulness=$wake lockscreen=$lock" >&2
|
||||
echo " # #" >&2
|
||||
echo " # While the screen is off, TCL denies the WebView renderer and #" >&2
|
||||
echo " # the app shows a blank window with no error anywhere. #" >&2
|
||||
echo " ####################################################################" >&2
|
||||
echo " # Nothing on screen can be verified while it is locked. #" >&2
|
||||
echo " #############################################################" >&2
|
||||
echo "" >&2
|
||||
return 1
|
||||
fi
|
||||
@@ -54,18 +58,16 @@ sleep_normal() {
|
||||
echo "stay-awake: reverted to system default"
|
||||
}
|
||||
|
||||
# Force-stop, start, and wait until the page is actually parsed - not merely
|
||||
# until the activity is up, which happens even when the renderer was denied.
|
||||
launch() {
|
||||
ensure_awake || return 1
|
||||
"$ADB" shell am force-stop "$PKG"
|
||||
"$ADB" shell am start -W -n "$ACT" >/dev/null
|
||||
|
||||
# Wait until the page is actually parsed, not merely until the activity is up:
|
||||
# the activity starts fine even when the renderer was denied.
|
||||
page_loaded() {
|
||||
local pid sock i
|
||||
# Read the pid AFTER starting: an `adb install -r` kills the old process, and
|
||||
# a stale pid makes the devtools socket lookup fail while the app is fine.
|
||||
# Read the pid AFTER starting. `adb install -r` kills the old process, so a pid
|
||||
# captured earlier points at a dead one and the socket lookup fails while the
|
||||
# app itself is healthy - that produced one false "page never loaded".
|
||||
pid=$("$ADB" shell pidof "$PKG" | tr -d '\r')
|
||||
for i in $(seq 1 60); do
|
||||
[ -n "$pid" ] || return 1
|
||||
for i in $(seq 1 40); do
|
||||
sock=$("$ADB" shell cat /proc/net/unix | grep -o "webview_devtools_remote_$pid" | head -1)
|
||||
if [ -n "$sock" ]; then
|
||||
"$ADB" forward "tcp:$PORT" "localabstract:$sock" >/dev/null 2>&1 || true
|
||||
@@ -75,9 +77,23 @@ launch() {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "ERROR: activity started but the page never loaded." >&2
|
||||
echo "Renderer denials in the log:" >&2
|
||||
launch() {
|
||||
ensure_awake || return 1
|
||||
local attempt
|
||||
for attempt in $(seq 1 $ATTEMPTS); do
|
||||
"$ADB" shell am force-stop "$PKG"
|
||||
"$ADB" shell am start -W -n "$ACT" >/dev/null
|
||||
if page_loaded; then
|
||||
[ "$attempt" -gt 1 ] && echo "(took $attempt attempts - post-install renderer denial)"
|
||||
return 0
|
||||
fi
|
||||
echo "attempt $attempt: renderer denied, retrying" >&2
|
||||
done
|
||||
|
||||
echo "ERROR: page never loaded after $ATTEMPTS attempts." >&2
|
||||
"$ADB" logcat -d | grep -E 'AppBootManager.*Result\[false\]|ChildProcessConn: Failed' | tail -4 >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user