"""Reject APKs that silently lose the optional native Discord integration.""" import struct import tempfile import unittest import zipfile from pathlib import Path import check_backend_apk as checker class DiscordApkAuditTest(unittest.TestCase): def setUp(self): directory = tempfile.TemporaryDirectory() self.addCleanup(directory.cleanup) self.apk = Path(directory.name) / "release.apk" self.entries = { "assets/discord-sdk-notices.txt": b"SDK license notices", "classes.dex": b"\0".join(checker.DISCORD_CLASSES), } for abi, (elf_class, machine) in checker.ABI_LAYOUT.items(): header = bytearray(20) header[:6] = b"\x7fELF" + bytes([elf_class, 1]) struct.pack_into("