fix display pairing and add scoped family voice announcements

This commit is contained in:
Codex
2026-10-18 22:03:51 +08:00
parent fdb239b3ed
commit d0b3db7f82
32 changed files with 776 additions and 124 deletions
+20 -1
View File
@@ -9,6 +9,25 @@ NS = '{http://schemas.android.com/apk/res/android}'
class AndroidLocationContractTests(unittest.TestCase):
def test_terminal_is_ordinary_app_without_home_or_boot_receiver(self):
manifest=ET.parse(ANDROID/'AndroidManifest-terminal.xml').getroot()
self.assertEqual(manifest.findall('application/receiver'),[])
categories=[c.get(NS+'name') for c in manifest.findall('.//category')]
self.assertNotIn('android.intent.category.HOME',categories)
self.assertEqual(categories.count('android.intent.category.LAUNCHER'),1)
self.assertEqual(manifest.get(NS+'versionName'),(ROOT/'VERSION').read_text().strip())
def test_voice_is_foreground_press_to_record_and_cleans_temp_media(self):
source=(ANDROID/'src/cn/ucvl/zhaodisplay/VoicePanel.java').read_text(encoding='utf-8')
for text in ('ACTION_CANCEL:finish(false)','Manifest.permission.RECORD_AUDIO','AAC_ADTS','file.delete()','stopPlayer("rejected")','getCacheDir()','AudioFocusRequest','current(e,t)'):
self.assertIn(text,source)
self.assertNotIn('setStreamVolume',source)
ui=(ANDROID/'src/cn/ucvl/zhaodisplay/LocationActivity.java').read_text(encoding='utf-8')
self.assertIn('homeContent.setVisibility(paired?View.VISIBLE:View.GONE)',ui)
self.assertIn('voice.active(false)',ui)
main=(ANDROID/'src/cn/ucvl/zhaodisplay/MainActivity.java').read_text(encoding='utf-8')
self.assertIn('client=android&load=',main)
def test_phone_launcher_is_location_only(self):
manifest = ET.parse(ANDROID/'AndroidManifest.xml').getroot()
entries = manifest.findall('application/activity')
@@ -19,7 +38,7 @@ class AndroidLocationContractTests(unittest.TestCase):
self.assertEqual(launchers, ['.LocationActivity'])
self.assertEqual(television, ['.MainActivity'])
self.assertEqual(manifest.get(NS+'versionName'), (ROOT/'VERSION').read_text().strip())
self.assertEqual(manifest.get(NS+'versionCode'), '3')
self.assertEqual(manifest.get(NS+'versionCode'), '4')
def test_collection_is_visible_foreground_and_never_boot_started(self):
manifest = ET.parse(ANDROID/'AndroidManifest.xml').getroot()