feat: add neutral avatar video call MVP in Android 0.6.0
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Production Kotlin with local deterministic media/transport doubles, no real capture.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p logs/avatar-060
|
||||
python3 scripts/check-reply-regressions.py > logs/avatar-060/client-tests.txt 2>&1
|
||||
./scripts/check-expression-rules.sh > logs/avatar-060/expression-tests.txt 2>&1
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import hashlib,json
|
||||
root=Path.cwd()
|
||||
paths=list((root/'app/src/main/java').rglob('*.kt'))+list((root/'tests').rglob('*.kt'))
|
||||
paths += [root/'scripts/check-reply-regressions.py',root/'scripts/check-expression-rules.sh',root/'scripts/check-avatar-regressions.sh']
|
||||
result={'status':'passed','jvm_entry_points':9,'real_device':'pending',
|
||||
'hashes':{str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(paths)}}
|
||||
(root/'logs/avatar-060/client-tests.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
print('PASS: nine JVM entry points, including avatar/native-head activity and call lifecycle; no real phone capture')
|
||||
PY
|
||||
@@ -23,8 +23,9 @@ compiler = ':'.join([jar('org.jetbrains.kotlin','kotlin-compiler-embeddable','2.
|
||||
cp = ':'.join([stdlib, jar('com.squareup.okhttp3','okhttp','4.12.0'), jar('com.squareup.okio','okio-jvm','3.6.0')])
|
||||
source = ROOT/'app/src/main/java/com/gorios/lanvoice'
|
||||
suites = [
|
||||
('session','ConnectionCheckKt', [source/'audio/VoiceSession.kt', source/'dialogue/ReplyEmotion.kt', source/'net/DialogueClient.kt', source/'expression/FaceCueRules.kt', source/'expression/ExpressionRules.kt', source/'expression/FaceDiagnostics.kt']),
|
||||
('playback','PlaybackCheckKt', [source/'audio/AudioPlayback.kt']),
|
||||
('session','ConnectionCheckKt', [source/'audio/PlaybackActivity.kt', source/'audio/VoiceSession.kt', source/'dialogue/ReplyEmotion.kt', source/'net/DialogueClient.kt', source/'expression/FaceCueRules.kt', source/'expression/ExpressionRules.kt', source/'expression/FaceDiagnostics.kt']),
|
||||
('playback','PlaybackCheckKt', [source/'audio/AudioPlayback.kt', source/'audio/PlaybackActivity.kt']),
|
||||
('avatar','AvatarCheckKt', [source/'avatar/AvatarController.kt', source/'avatar/CallIntent.kt', source/'avatar/AvatarVideoView.kt', source/'audio/PlaybackActivity.kt', source/'dialogue/ReplyEmotion.kt']),
|
||||
('capture','CaptureCheckKt', [source/'audio/AudioCapture.kt']),
|
||||
('protocol','ProtocolCheckKt', [source/'net/DialogueProtocol.kt', source/'dialogue/ReplyEmotion.kt', source/'expression/FaceCueRules.kt', source/'expression/ExpressionRules.kt']),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Import the pinned, authorized local candidate pack; never generate or modify originals."""
|
||||
from pathlib import Path, PurePosixPath
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import shutil
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
BASE_SHA = 'ca817f1e538a5933beac4f3f4cda6367bf87a2d428b3307622c98842ae8679d1'
|
||||
CALL_SHA = '3b6918cdc955f6d51e8910cf7a0067f4dedb19d28accbb5525f15876e6ad4d8c'
|
||||
|
||||
def digest(data):
|
||||
return hashlib.sha256(data).hexdigest()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('source', type=Path)
|
||||
args = parser.parse_args()
|
||||
source = args.source.resolve(strict=True)
|
||||
base = (source/'manifest.json').read_bytes()
|
||||
call = (source/'call-avatar-manifest.json').read_bytes()
|
||||
assert digest(base) == BASE_SHA and digest(call) == CALL_SHA, 'Manifest hash mismatch'
|
||||
manifest, supplement = json.loads(base), json.loads(call)
|
||||
assert manifest['schemaVersion'] == 1 and manifest['identityId'] == supplement['identityId'] == 'a01'
|
||||
assert manifest['rightsStatus'] == 'unverified' and manifest['deviceTestStatus'] == 'pending'
|
||||
assert {a['mode'] for a in manifest['assets']} == {'idle','talk'}
|
||||
rows = manifest['assets'] + [manifest['staticFallback'], supplement['waiting']]
|
||||
verified = {'manifest.json': base, 'call-avatar-manifest.json': call}
|
||||
for row in rows:
|
||||
path = PurePosixPath(row['path'])
|
||||
assert len(path.parts) == 2 and path.parts[0] in ('videos','frames') and '..' not in path.parts
|
||||
src = (source/str(path)).resolve(strict=True)
|
||||
assert src.is_relative_to(source) and src.is_file()
|
||||
data = src.read_bytes()
|
||||
assert len(data) <= 8_000_000 and digest(data) == row['sha256'], str(path)
|
||||
if row.get('mode') in ('idle','talk'):
|
||||
assert row['emotion'] == 'neutral' and row['intensity'] == 0 and row['loop'] and not row['hasAudio']
|
||||
verified[str(path)] = data
|
||||
target = ROOT/'app/src/main/assets/avatar/a01-v1'
|
||||
# Refuse overwriting an unknown imported file; safe idempotent reimport is supported.
|
||||
for name, data in verified.items():
|
||||
dest = target/name
|
||||
assert not dest.exists() or digest(dest.read_bytes()) == digest(data), f'Unknown existing asset: {dest}'
|
||||
target.mkdir(parents=True, exist_ok=True, mode=0o700)
|
||||
for name, data in verified.items():
|
||||
dest = target/name
|
||||
dest.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
|
||||
dest.write_bytes(data); dest.chmod(0o600)
|
||||
print(json.dumps({'pack':'a01-v1','files':{name:digest(data) for name,data in verified.items()},
|
||||
'rightsStatus':'unverified','deviceTestStatus':'pending'}, indent=2))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,26 @@
|
||||
# Run with an existing authorized Windows USB adb. Does not configure ADB/network or start app.
|
||||
param(
|
||||
[string]$Adb = 'adb',
|
||||
[string]$Serial = '',
|
||||
[Parameter(Mandatory = $true)][string]$Sha256,
|
||||
[string]$Url = 'http://192.168.31.124:8080/lan-voice-v060-arm64-debug.apk'
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($Sha256 -notmatch '^[0-9a-fA-F]{64}$') { throw 'Supply the release SHA256 from the handoff.' }
|
||||
$artifact = Join-Path $PSScriptRoot '..\artifacts\lan-voice-v060-arm64-debug.apk'
|
||||
New-Item -ItemType Directory -Force (Split-Path $artifact) | Out-Null
|
||||
if (!(Test-Path $artifact)) { Invoke-WebRequest -Uri $Url -OutFile $artifact -UseBasicParsing }
|
||||
if ((Get-FileHash -Algorithm SHA256 $artifact).Hash -ne $Sha256) { throw 'APK hash mismatch; existing file preserved.' }
|
||||
$devices = @(& $Adb devices | Select-String '^([^\s]+)\s+device$' | ForEach-Object { $_.Matches[0].Groups[1].Value })
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Existing adb unavailable.' }
|
||||
if (!$Serial) {
|
||||
if ($devices.Count -ne 1) { throw 'Select an already authorized USB device using -Serial.' }
|
||||
$Serial = $devices[0]
|
||||
}
|
||||
if ($Serial -notin $devices) { throw 'Device is not already authorized.' }
|
||||
& $Adb -s $Serial install -r $artifact
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Installation failed; no uninstall or data clearing performed.' }
|
||||
$version = & $Adb -s $Serial shell dumpsys package com.gorios.lanvoice | Select-String 'versionCode=|versionName='
|
||||
if ($LASTEXITCODE -ne 0 -or !($version -match 'versionCode=11') -or !($version -match 'versionName=0.6.0')) { throw 'Installed version did not verify.' }
|
||||
$version
|
||||
Write-Output 'Installed 0.6.0/code11. Open manually; recording and camera require explicit user actions.'
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
# Pinned offline pack + tested code, retained certificate, new artifact only, HTTP bytes.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import hashlib,json
|
||||
root=Path.cwd()
|
||||
assert not (root/'artifacts/lan-voice-v060-arm64-debug.apk').exists(), 'Refuse overwriting release'
|
||||
assert (root/'artifacts/lan-voice-v052-arm64-debug.apk').is_file()
|
||||
tests=json.loads((root/'logs/avatar-060/client-tests.json').read_text())
|
||||
assert tests['status']=='passed' and tests['jvm_entry_points']==9
|
||||
for path,digest in tests['hashes'].items(): assert hashlib.sha256((root/path).read_bytes()).hexdigest()==digest,path
|
||||
for name in ('a01-v1.manifest.json','a01-v1.call-avatar-manifest.json'):
|
||||
original=(root/'docs/avatar'/name).read_bytes()
|
||||
target='manifest.json' if name=='a01-v1.manifest.json' else 'call-avatar-manifest.json'
|
||||
assert original==(root/'app/src/main/assets/avatar/a01-v1'/target).read_bytes()
|
||||
base=json.loads((root/'docs/avatar/a01-v1.manifest.json').read_text())
|
||||
call=json.loads((root/'docs/avatar/a01-v1.call-avatar-manifest.json').read_text())
|
||||
for row in base['assets']+[base['staticFallback'],call['waiting']]:
|
||||
assert hashlib.sha256((root/'app/src/main/assets/avatar/a01-v1'/row['path']).read_bytes()).hexdigest()==row['sha256']
|
||||
print('Verified tested source and all offline candidate hashes')
|
||||
PY
|
||||
./scripts/build.sh
|
||||
source /home/ubuntu/android-build/env.sh
|
||||
TOOLS=/home/ubuntu/android-build/sdk/build-tools/34.0.0
|
||||
APK=app/build/outputs/apk/debug/app-debug.apk
|
||||
"$TOOLS/aapt" dump badging "$APK" > logs/avatar-060/badging.txt
|
||||
"$TOOLS/apksigner" verify --verbose --print-certs "$APK" > logs/avatar-060/signature.txt
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import hashlib,json,re,shutil,subprocess,urllib.request,zipfile
|
||||
root=Path.cwd();logs=root/'logs/avatar-060'
|
||||
badge=(logs/'badging.txt').read_text()
|
||||
for value in ("name='com.gorios.lanvoice'","versionCode='11'","versionName='0.6.0'","sdkVersion:'26'","targetSdkVersion:'34'"):assert value in badge,value
|
||||
assert re.search(r'^native-code: (.+)$',badge,re.M)[1].strip()=="'arm64-v8a'"
|
||||
sig=(logs/'signature.txt').read_text();pattern=r'Signer #1 certificate SHA-256 digest: (\w+)'
|
||||
for version in ('051','052'):
|
||||
old=root/f'artifacts/lan-voice-v{version}-arm64-debug.apk'
|
||||
output=subprocess.check_output(['/home/ubuntu/android-build/sdk/build-tools/34.0.0/apksigner','verify','--print-certs',str(old)],text=True)
|
||||
assert re.search(pattern,output)[1]==re.search(pattern,sig)[1], 'Signing certificate mismatch'
|
||||
source=root/'app/build/outputs/apk/debug/app-debug.apk'
|
||||
with zipfile.ZipFile(source) as archive:
|
||||
for file in (root/'app/src/main/assets/avatar/a01-v1').rglob('*'):
|
||||
if file.is_file():
|
||||
name='assets/'+str(file.relative_to(root/'app/src/main/assets'))
|
||||
assert archive.read(name)==file.read_bytes(),name
|
||||
if file.suffix=='.mp4':assert archive.getinfo(name).compress_type==zipfile.ZIP_STORED
|
||||
artifact=root/'artifacts/lan-voice-v060-arm64-debug.apk'
|
||||
assert not artifact.exists()
|
||||
shutil.copy2(source,artifact)
|
||||
digest=hashlib.sha256(artifact.read_bytes()).hexdigest()
|
||||
sidecar=artifact.with_suffix('.apk.sha256');sidecar.write_text(f'{digest} {artifact.name}\n')
|
||||
base='http://192.168.31.124:8080/'
|
||||
opener=urllib.request.build_opener(urllib.request.ProxyHandler({}))
|
||||
url=None
|
||||
for prefix in ('','artifacts/'):
|
||||
try:
|
||||
candidate=base+prefix+artifact.name
|
||||
with opener.open(candidate,timeout=15) as response:
|
||||
assert response.status==200;data=response.read()
|
||||
assert len(data)==artifact.stat().st_size and hashlib.sha256(data).hexdigest()==digest
|
||||
with opener.open(candidate+'.sha256',timeout=15) as response:
|
||||
assert response.status==200 and response.read()==sidecar.read_bytes()
|
||||
url=candidate;break
|
||||
except Exception:pass
|
||||
assert url, 'New APK exists; matching HTTP delivery unavailable. Preserve artifact and inspect before continuing.'
|
||||
result={'version':'0.6.0','versionCode':11,'apk':str(artifact.relative_to(root)),
|
||||
'bytes':artifact.stat().st_size,'sha256':digest,'url':url,'httpBytesVerified':True,
|
||||
'signature':'apksigner_verified','sameCertificateAs':['0.5.1','0.5.2'],'deviceTestStatus':'pending'}
|
||||
(logs/'release.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
print(json.dumps(result,indent=2))
|
||||
PY
|
||||
Reference in New Issue
Block a user