"""Local-only VR manifest, raw ZIP and independent signature checks.""" import sandbox # noqa: F401 (first: keeps tests off real data and services) import io import os from pathlib import Path import struct import subprocess import sys import tempfile import unittest from unittest.mock import patch import zipfile sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'ui')) import frame_apk import frame_apk_vr as vr import frame_apk_sign as signing import frame_android from apk_fixtures import pool DEFAULT = 'android.intent.category.DEFAULT' def manifest(utf8=False, launcher=False, category=None, samsung=False, split=False, alias=False, splash=False): strings = ['manifest', 'package', 'org.test.vr', 'application', 'activity', 'intent-filter', 'action', 'category', 'name', vr.MAIN, category or next(iter(sorted(vr.VR))), vr.LAUNCHER, 'http://schemas.android.com/apk/res/android', 'meta-data', 'value', 'com.samsung.android.vr.application.mode', 'vr_only', 'activity-alias', DEFAULT, next(iter(sorted(vr.VR))), 'targetActivity', '.Splash', '.Game'] def start(tag, attrs=()): body = struct.pack('