Release Kaleido 0.1.10 with native Original playback and PCM compatibility
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m45s

This commit is contained in:
Elijah 2026-10-26 16:42:19 -07:00
parent 784921dba9
commit 2a83fe0db5
23 changed files with 721 additions and 43 deletions

View file

@ -0,0 +1,76 @@
"""Exercise the actual release UI, measure startup/rebuffering, restore resume time."""
import argparse,json,os,pathlib,re,shlex,time,urllib.parse,urllib.request
if pathlib.Path('/etc/ssl/cert.pem').exists():os.environ.setdefault('SSL_CERT_FILE','/etc/ssl/cert.pem')
from device import adb,OUT,DEVICE
from verify_ui import launch,key,focused,wait,labels,focus,snapshot
from inspect_server import get,base,token
def session():
raw=adb('shell','dumpsys','media_session').decode(errors='replace')
m=re.search(r'package=tv\.kaleido\.app.*?PlaybackState \{state=(\w+)\(\d+\), position=(\d+).*?speed=([\d.]+), updated=(\d+)',raw,re.S)
return {'state':m[1],'position':int(m[2]),'speed':float(m[3]),'updated':int(m[4])} if m else {}
def main():
p=argparse.ArgumentParser();p.add_argument('label');p.add_argument('id');p.add_argument('--seconds',type=int,default=60);args=p.parse_args()
folder=OUT/'release-comparison';folder.mkdir(exist_ok=True)
pkg=adb('shell','dumpsys','package','tv.kaleido.app').decode()
assert 'DEBUGGABLE' not in re.search(r'pkgFlags=\[(.*?)\]',pkg)[1]
assert 'status=speed-profile' in pkg
before=get('/library/metadata/'+args.id)['Metadata'][0];title=before['title']
(folder/(args.label+'-before.json')).write_text(json.dumps(before,indent=2))
# A previous ADB tap can leave Android in touch mode across app restarts.
adb('shell','input','keyevent','19')
launch()
for target in ['Movies','TV Shows','Search']:key(22);focused(target)
key(23);wait(lambda r:'Movies, shows, episodes' in labels(r),'Search field')
adb('shell','input','text',shlex.quote(title.replace(' ','%s')))
wait(lambda r:title in labels(r),'Matching search result')
ime=adb('shell','dumpsys','input_method').decode(errors='replace')
if re.search(r'mInputShown=true|isInputViewShown=true',ime):key(4)
# EditText has the same text as the result; Tab exits editing without entering
# Android touch mode, and the focused poster is verified before activation.
key(61)
wait(lambda r:any(n.get('focused')=='true' and n.get('class')!='android.widget.EditText' and title in labels(n) for n in r.iter('node')),'Movie result focus')
key(23)
root=wait(lambda r:any(s=='Play' or s.startswith('Resume') for s in labels(r)),'Movie actions')
wait(lambda r:focus(r)=='Play' or focus(r).startswith('Resume'),'Playback action focus')
if 'Start over' in labels(root):key(22);focused('Start over')
print('PLAYBACK_START',args.label,flush=True)
adb('logcat','-c');start=time.monotonic();key(23)
ready=None;samples=[];ready_logs=''
while time.monotonic()-start<70:
s=session();s['elapsed']=round(time.monotonic()-start,3);samples.append(s)
ready_logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
if s.get('state')=='PLAYING' and 'READY item='+args.id in ready_logs:ready=s['elapsed'];break
time.sleep(.7)
assert ready is not None,'Release playback did not become ready'
print('PLAYBACK_READY',args.label,ready,flush=True)
steady_start=time.monotonic();last='PLAYING';rebuffers=0
while time.monotonic()-steady_start<args.seconds:
s=session();s['elapsed']=round(time.monotonic()-start,3);samples.append(s)
if s.get('state')=='BUFFERING' and last!='BUFFERING':rebuffers+=1
last=s.get('state');time.sleep(1)
(folder/(args.label+'-measurement.json')).write_text(json.dumps({'readySeconds':ready,'rebufferTransitions':rebuffers,'samples':samples},indent=2))
(folder/(args.label+'-surface.txt')).write_bytes(adb('shell','dumpsys','SurfaceFlinger'))
adb('shell','input','keyevent','127');time.sleep(1)
(folder/(args.label+'-player.png')).write_bytes(adb('exec-out','screencap','-p'))
for _ in range(2):key(4)
wait(lambda r:any(s in labels(r) for s in ['Continue Watching','Mark watched','Mark unwatched']),'Return to the originating page after playback')
logs=adb('logcat','-d','-s','KaleidoPlayback:I','AndroidRuntime:E','*:S').decode(errors='replace')
(folder/(args.label+'-playback.log')).write_text(logs)
# Release builds use normal Plex progress reporting. Restore the prior resume time.
time.sleep(1)
query=urllib.parse.urlencode({'key':args.id,'time':int(before.get('viewOffset') or 0),'state':'stopped','identifier':'com.plexapp.plugins.library'})
req=urllib.request.Request(base.rstrip('/')+'/:/progress?'+query,headers={'X-Plex-Token':token})
with urllib.request.urlopen(req,timeout=30) as r:r.read()
after=get('/library/metadata/'+args.id)['Metadata'][0]
result={'device':DEVICE,'version':re.search(r'versionName=(\S+)',pkg)[1],'id':args.id,'readySeconds':ready,
'rebufferTransitions':rebuffers,'readyEvents':logs.count('READY item='+args.id+' '),'samples':samples,
'resumeRestored':int(after.get('viewOffset') or 0)==int(before.get('viewOffset') or 0),
'viewCountUnchanged':after.get('viewCount')==before.get('viewCount')}
(folder/(args.label+'-playback.json')).write_text(json.dumps(result,indent=2))
print(json.dumps({k:v for k,v in result.items() if k!='samples'}),flush=True)
assert 'FATAL EXCEPTION' not in logs and 'ERROR code=' not in logs,'Playback error in release'
assert result['resumeRestored'] and result['viewCountUnchanged'],'Plex progress restoration needs attention'
launch()
if __name__=='__main__':main()