Kaleido/scripts/verify_navigation_sounds.py
Elijah 5199bb0928
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m8s
Release Kaleido 0.1.8 with cast browsing and refreshed title pages
2026-10-25 21:49:24 -07:00

48 lines
2.6 KiB
Python

"""Check navigation sound persistence; audio() also compares native mixer activity.
The optional mixer check needs system sound effects enabled and otherwise silent
audio output on the authorized onn. It never changes the TV's global sound setting.
"""
import json,time
from verify_ui import launch,key,focused,text
from device import adb,OUT,screenshot
def setting():
launch();key(22,4);focused('Settings');key(23);focused('Sign in with Plex')
key(21);focused('Connection');key(20,2);focused('Interface');key(22);focused('Navigation sounds')
def persistence():
setting();focused('Navigation sounds');text('On');key(23);focused('Navigation sounds');text('Off')
screenshot('navigation-sounds-off')
setting();focused('Navigation sounds');text('Off')
print('PASS disabling navigation sounds persists across process restart',flush=True)
key(23);focused('Navigation sounds');text('On')
setting();focused('Navigation sounds');text('On')
print('PASS enabling navigation sounds persists across process restart',flush=True)
screenshot('navigation-sounds-on');key(4);focused('Home');text('Continue Watching')
def audio():
assert adb('shell','settings','get','system','sound_effects_enabled').decode().strip()=='1','System sound effects must already be enabled for this optional check'
def probe(label):
time.sleep(.4)
adb('shell','atrace','--async_start','-b','16384','audio')
try:
for _ in range(3):
adb('shell','input','keyevent','21');time.sleep(.3)
adb('shell','input','keyevent','22');time.sleep(.3)
time.sleep(.4)
finally:raw=adb('shell','atrace','--async_stop','audio').decode(errors='replace')
(OUT/f'navigation-audio-{label}-atrace.txt').write_text(raw)
focused('Navigation sounds');text(label.capitalize())
return sum('tracing_mark_write: B|' in line and line.endswith('|write') for line in raw.splitlines())
setting();focused('Navigation sounds');text('On');key(23);focused('Navigation sounds');text('Off')
muted=probe('off')
key(23);focused('Navigation sounds');text('On');enabled=probe('on')
result={'mutedMixerWrites':muted,'enabledMixerWrites':enabled}
(OUT/'navigation-audio-results.json').write_text(json.dumps(result,indent=2)+'\n')
print('Native audio activity:',result,flush=True)
assert muted==0 and enabled>0,'Expected silence while muted and native audio output while enabled'
print('PASS navigation taps produce native mixer output only while enabled',flush=True)
key(4);focused('Home')
if __name__=='__main__':persistence()