Files
LihonT/tests/test_manifest_activity.py
cheb0chik 9de69113b5 LihonT 2 Serena
LihonT Store: a separate app with a catalog of avatar frames and chat bubbles made by members (browse, add with "+", author
profiles, publishing), signed in through the TikTok that carries the mod (an exported no-window activity that answers only the
store, checked by package name and signing key). The mod gets frames made from any picture (a photo is cut into a ring), the
library of the store in the frame picker and for bubbles, other members' published bubbles and one picture per chat for both
people. The members service gets the catalog, the account library, uploads that are re-made with Pillow, an AI first pass
(Groq) and the owner's Telegram bot with accept and reject buttons. The build tools pass long file lists through an argument
file. Nothing a member sends is shown to others before it is approved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 15:56:00 +03:00

56 lines
2.3 KiB
Python

from pathlib import Path
import unittest
from lihont.axml import Axml
from lihont.manifest import ManifestError, add_activity, has_activity
class ManifestActivityTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.apk = Path('OriginalAPKtiktok/com.zhiliaoapp.musically_47.1.3-2024701030_minAPI23(arm64-v8a)(nodpi)_apkmirror.com.apk')
if not cls.apk.exists():
raise unittest.SkipTest('clean TikTok base APK is not available')
def _manifest(self):
from lihont.apkzip import Apk
apk = Apk(str(self.apk))
try:
return Axml.parse(apk.read('AndroidManifest.xml'))
finally:
apk.close()
def test_private_settings_activity_is_non_exported(self):
xml = self._manifest()
name = 'lihont.two.settings.LihonTSettingsActivity'
add_activity(xml, name, 'LihonT', 0x7F120364)
self.assertTrue(has_activity(xml, name))
node = next(n for n in xml.elements('activity') if xml.attr_string(n, 'name') == name)
exported = xml.attr(node, 'exported')
self.assertIsNotNone(exported)
self.assertEqual(0, exported.data)
self.assertEqual(0x7F120364, xml.attr(node, 'theme').data)
# A second parse verifies the binary XML remains valid after appending
# framework attributes and a private activity subtree.
reparsed = Axml.parse(xml.build())
self.assertTrue(has_activity(reparsed, name))
def test_the_store_login_activity_is_exported_without_a_window(self):
xml = self._manifest()
name = 'lihont.two.store.LoginActivity'
add_activity(xml, name, 'LihonT Store', 0x01030055, exported=True)
reparsed = Axml.parse(xml.build())
node = next(n for n in reparsed.elements('activity') if reparsed.attr_string(n, 'name') == name)
self.assertNotEqual(0, reparsed.attr(node, 'exported').data)
self.assertEqual(0x01030055, reparsed.attr(node, 'theme').data)
def test_launcher_activity_must_explicitly_be_exported(self):
xml = self._manifest()
with self.assertRaises(ManifestError):
add_activity(xml, 'lihont.two.TestLauncher', 'LihonT', 0x7F120364,
affinity='lihont.test', launcher=True)
if __name__ == '__main__':
unittest.main()