feat(android): redesign family location into three native tabs

This commit is contained in:
Codex
2026-10-19 01:43:37 +08:00
parent 0a7c4d9b96
commit 5c09a2025a
23 changed files with 444 additions and 94 deletions
+30 -1
View File
@@ -50,7 +50,8 @@ class AndroidLocationContractTests(unittest.TestCase):
self.assertIn('phoneMode', boot)
ui = (ANDROID/'src/cn/ucvl/zhaodisplay/LocationActivity.java').read_text(encoding='utf-8')
self.assertNotIn('WebView', ui)
self.assertIn('共享我的位置', ui)
layout=(ANDROID/'src/cn/ucvl/zhaodisplay/PhoneLayout.java').read_text(encoding='utf-8')
self.assertIn('共享我的位置', layout)
self.assertIn('自定义采集间隔', ui)
self.assertIn('LocationCadence.customSample', ui)
self.assertIn('setSamplePeriod(result.optInt', ui)
@@ -75,6 +76,34 @@ class AndroidLocationContractTests(unittest.TestCase):
self.assertIn(text,source)
self.assertNotIn('addJavascriptInterface',source)
self.assertNotIn('getSharedPreferences',source)
def test_phone_three_tabs_use_native_cards_and_keep_sharing_explicit(self):
source=(ANDROID/'src/cn/ucvl/zhaodisplay/LocationActivity.java').read_text(encoding='utf-8')
layout=(ANDROID/'src/cn/ucvl/zhaodisplay/PhoneLayout.java').read_text(encoding='utf-8')
for value in ('"家人","喊话","我的"','scrolls[i].setVisibility(i==next?VISIBLE:GONE)','setContentDescription','共享我的位置'):
self.assertIn(value,layout)
for value in ('voice.finish(false);phone.select(tab)','if(content.getParent()==scroll)','开启共享后生效','consent.setChecked(false)','showDetail("允许谁查看"','setLayout(-1,-1)'):
self.assertIn(value,source)
self.assertNotIn('startService',layout)
self.assertNotIn('https://',layout)
def test_voice_page_uses_explicit_receiver_consent_and_cancels_on_navigation(self):
source=(ANDROID/'src/cn/ucvl/zhaodisplay/VoicePanel.java').read_text(encoding='utf-8')
surface=(ANDROID/'src/cn/ucvl/zhaodisplay/VoiceSurface.java').read_text(encoding='utf-8')
for value in ('view.receiver.setChecked(enabled)','else configure()','VoiceSurface page()','new VoiceCircle(color,night)','setContentDescription'):
self.assertIn(value,source+surface)
self.assertIn('!visible||!networkReady||recorder!=null',source)
self.assertIn('view.destination(selected,networkReady)',source)
def test_native_ui_fixture_cannot_access_real_data(self):
build=(ANDROID/'tests/build-phone-check.ps1').read_text(encoding='utf-8')
self.assertIn('cn.ucvl.zhaodisplay.phonecheck',build)
self.assertNotIn('<uses-permission',build)
production=(ANDROID/'build.ps1').read_text(encoding='utf-8')
self.assertNotIn('phone-preview',production)
transport=(ANDROID/'tests/phone-preview/DisplayApi.java').read_text(encoding='utf-8')
self.assertNotIn('https://',transport)
self.assertNotIn('HttpURLConnection',transport)
def test_background_permission_only_in_phone_and_separately_requested(self):
for name,expected in [('AndroidManifest.xml',True),('AndroidManifest-terminal.xml',False)]:
manifest=ET.parse(ANDROID/name).getroot()