@davoodmehraban89 / LifeMate / commits / 3e36dfd
Fork 0

LifeMate — Personal, Family & Learning Companion

test(android): distinguish private and public notification titles

Quinn White committed Oct 20, 2026 at 19:06 UTC 3e36dfd4f01d51e11816c0f97d1abda4266f1945
2 files changed +17 -2
apps/lifemate/tool/test_standalone_android.py
+5 -2
@@ -146,7 +146,10 @@ def check_notification_record(dump, key):
146 record = matches[0]
147 titles = re.findall(r"android\.title=String \(([^\n]*)\)", record)
148 bodies = re.findall(r"android\.text=String \(([^\n]*)\)", record)
149 - require(bool(titles) and all(t == COMPANION for t in titles), "fixture_notification_title_mismatch")
149 + # Android dumps the private notification first and then its publicVersion.
150 + # The latter deliberately uses the product name on the lock screen.
151 + require(bool(titles) and titles[0] == COMPANION and
152 + all(t == "LifeGuide" for t in titles[1:]), "fixture_notification_title_mismatch")
153 require(bool(bodies) and all(b == GENERIC_BODY for b in bodies), "fixture_notification_body_mismatch")
154 require(CANARY not in record, "fixture_notification_contains_private_canary")
155 require(re.search(r"(?:channel=|mId=['\"]?)" + re.escape(CHANNEL) + r"(?=['\"\s,)])", record),
@@ -317,7 +320,7 @@ class Harness:
320 self.fixture_installed = True
321 self.adb.shell("pm", "grant", PACKAGE, "android.permission.POST_NOTIFICATIONS")
322 self.adb.shell("cmd", "appops", "set", PACKAGE, "SCHEDULE_EXACT_ALARM", "allow")
320 - self.receipt["checks"]["fixtureUpgradePreservesFreshUserData"] = "PASS"
323 + self.receipt["checks"]["ownedFreshInstallFixtureUpgrade"] = "PASS"
324
325 def launch(self, mode):
326 require(self.fixture_installed and mode in MODES, "fixture_not_ready")
apps/lifemate/tool/test_standalone_android_test.py
+12
@@ -187,6 +187,18 @@ class ParsingTest(unittest.TestCase):
187 with self.subTest(update=update), self.assertRaises(subject.AcceptanceError):
188 subject.fixture_marker(subject.MARKER + json.dumps(marker), marker["nonce"], "seed")
189
190 + def test_public_lock_screen_version_has_separate_generic_title(self):
191 + key = '0|' + subject.PACKAGE + '|1|lifeguide-plan:' + '22222222-2222-4222-8222-222222222222' + '|10001'
192 + primary = (f'NotificationRecord(pkg={subject.PACKAGE} key={key}: Notification(channel={subject.CHANNEL}))\n'
193 + f'android.title=String ({subject.COMPANION})\nandroid.text=String ({subject.GENERIC_BODY})\n')
194 + public = f'publicVersion\nandroid.title=String (LifeGuide)\nandroid.text=String ({subject.GENERIC_BODY})\n'
195 + self.assertTrue(subject.check_notification_record(primary + public, key)['titleMatches'])
196 + for bad in (primary.replace(subject.COMPANION, 'wrong') + public,
197 + primary + public.replace('LifeGuide)', 'wrong)'),
198 + primary + public.replace(subject.GENERIC_BODY, subject.CANARY)):
199 + with self.assertRaises(subject.AcceptanceError):
200 + subject.check_notification_record(bad, key)
201 +
202 def test_notification_parser_accepts_only_owned_uuid_tag(self):
203 identifier = "33333333-3333-4333-8333-333333333333"
204 key = f"0|{subject.PACKAGE}|1|lifeguide-plan:{identifier}|10123"