fix(camera): verify system preview parameters in isolated code5 probe
This commit is contained in:
@@ -32,8 +32,8 @@ def digest(path):
|
||||
|
||||
def verify(apk):
|
||||
badge = subprocess.check_output([str(TOOLS/'aapt'), 'dump', 'badging', str(apk)], text=True)
|
||||
for value in ("name='com.gorios.lanvoice.cameraprobe'", "versionCode='4'",
|
||||
"versionName='camera-probe-0.1.3'", "sdkVersion:'26'", "targetSdkVersion:'34'"):
|
||||
for value in ("name='com.gorios.lanvoice.cameraprobe'", "versionCode='5'",
|
||||
"versionName='camera-probe-0.1.4'", "sdkVersion:'26'", "targetSdkVersion:'34'"):
|
||||
require(value in badge, 'APK metadata: '+value)
|
||||
permissions = set(re.findall(r"^uses-permission: name='([^']+)'", badge, re.M))
|
||||
require(permissions == {'android.permission.CAMERA', 'android.permission.INTERNET',
|
||||
@@ -56,6 +56,8 @@ def verify(apk):
|
||||
'lib/arm64-v8a/libimage_processing_util_jni.so',
|
||||
'lib/arm64-v8a/libsurface_util_jni.so'}, 'unexpected native dependency')
|
||||
dex = b''.join(archive.read(n) for n in paths if re.fullmatch(r'classes\d*\.dex', n))
|
||||
for mode in ('CAMERA1_SYSTEM_1080_PREVIEW','CAMERA1_SYSTEM_1080_CALLBACK'):
|
||||
require(mode.encode() in dex, 'system-parameter mode missing: '+mode)
|
||||
for klass in ('MainActivity', 'VoiceSession', 'ExpressionCameraManager',
|
||||
'ContinuousBodyRenderer', 'EmotionActionAvatarView'):
|
||||
require(('Lcom/gorios/lanvoice/'+klass+';').encode() not in dex and
|
||||
@@ -82,13 +84,13 @@ def verify(apk):
|
||||
trust = ROOT/'camera-probe/build/generated/cameraTrust/res/raw/gateway_cert.pem'
|
||||
require(trust.read_bytes() == (ROOT/'app/src/main/res/raw/gateway_cert.pem').read_bytes(), 'gateway trust drift')
|
||||
camera_sources = {str(p.relative_to(ROOT)): digest(p) for p in sorted((ROOT/'camera-probe/src').rglob('*')) if p.is_file()}
|
||||
return {'package': 'com.gorios.lanvoice.cameraprobe', 'version_name': 'camera-probe-0.1.3',
|
||||
'version_code': 4, 'min_sdk': 26, 'target_sdk': 34, 'certificate_sha256': CERT,
|
||||
return {'package': 'com.gorios.lanvoice.cameraprobe', 'version_name': 'camera-probe-0.1.4',
|
||||
'version_code': 5, 'min_sdk': 26, 'target_sdk': 34, 'certificate_sha256': CERT,
|
||||
'abi': 'arm64-v8a', 'assets': 0, 'microphone_permission': False,
|
||||
'shared_production_sources': sources, 'camera_application_sources': camera_sources,
|
||||
'camera_tests': 7, 'process_isolated': True,
|
||||
'run_limit_ms': 5000, 'close_limit_ms': 2000, 'process_exit_limit_ms': 4000, 'availability_limit_ms': 5000, 'surface_resize_handshake': True,
|
||||
'availability_is_streaming_proof': False, 'default_preview_last': True, 'device': 'not_run'}
|
||||
'camera_tests': 2, 'planned_modes': ['camera1_system_1080_preview','camera1_system_1080_callback'], 'requested_preview': {'width':1920,'height':1080,'format':'nv21','fps_min_milli':30000,'fps_max_milli':30000}, 'process_isolated': True,
|
||||
'run_limit_ms': 5000, 'close_limit_ms': 2000, 'process_exit_limit_ms': 4000, 'availability_limit_ms': 15000, 'surface_resize_handshake': True,
|
||||
'availability_is_streaming_proof': False, 'system_three_streams_reproduced': False, 'universal_third_party_restriction_confirmed': False, 'device': 'not_run'}
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
@@ -101,7 +103,7 @@ def main():
|
||||
subprocess.run([str(ROOT/'scripts/build.sh'), ':camera-probe:assembleDebug'], cwd=ROOT, check=True)
|
||||
built = ROOT/'camera-probe/build/outputs/apk/debug/camera-probe-debug.apk'
|
||||
report = verify(built)
|
||||
artifact = ROOT/'artifacts/lan-voice-camera-probe-v013-code4-debug.apk'
|
||||
artifact = ROOT/'artifacts/lan-voice-camera-probe-v014-code5-debug.apk'
|
||||
require(not artifact.exists() and not artifact.with_suffix('.apk.sha256').exists(), 'published camera version occupied')
|
||||
with artifact.open('xb') as target, built.open('rb') as source:
|
||||
shutil.copyfileobj(source, target)
|
||||
|
||||
Reference in New Issue
Block a user