LifeMate — Personal, Family & Learning Companion
docs/offline-data-rescue-options
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | #!/usr/bin/env python3 |
| 2 | """Inspect the device-only APK binary manifest. Signature/install are separate.""" |
| 3 | import argparse |
| 4 | import hashlib |
| 5 | import json |
| 6 | from pathlib import Path |
| 7 | from zipfile import ZipFile |
| 8 | |
| 9 | from check_apk_manifest import manifest_tags |
| 10 | |
| 11 | PACKAGE = 'ir.lifeguide.app.device' |
| 12 | LABEL = 'لایفگاید شخصی' |
| 13 | |
| 14 | |
| 15 | def check(apk): |
| 16 | apk = Path(apk) |
| 17 | with ZipFile(apk) as archive: |
| 18 | tags = manifest_tags(archive.read('AndroidManifest.xml')) |
| 19 | manifest = next(a for tag, a in tags if tag == 'manifest') |
| 20 | application = next(a for tag, a in tags if tag == 'application') |
| 21 | sdk = next(a for tag, a in tags if tag == 'uses-sdk') |
| 22 | permissions = {a.get('name') for tag, a in tags if tag.startswith('uses-permission')} |
| 23 | allowed = {'android.permission.POST_NOTIFICATIONS', |
| 24 | 'android.permission.RECEIVE_BOOT_COMPLETED', |
| 25 | 'android.permission.SCHEDULE_EXACT_ALARM', |
| 26 | PACKAGE + '.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'} |
| 27 | if manifest.get('package') != PACKAGE or application.get('label') != LABEL: |
| 28 | raise ValueError('Expected the separate LifeGuide personal device edition') |
| 29 | if manifest.get('versionName') != '0.7.2-personal.1' or manifest.get('versionCode') != 9: |
| 30 | raise ValueError('Unexpected personal APK version') |
| 31 | if (application.get('debuggable') is not True or |
| 32 | application.get('allowBackup') is not False or |
| 33 | application.get('usesCleartextTraffic') is not False): |
| 34 | raise ValueError('Personal debug, backup and network gates are required') |
| 35 | if not permissions <= allowed or not (allowed - {PACKAGE + '.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'}) <= permissions: |
| 36 | raise ValueError('Unexpected or missing device edition permissions; INTERNET is forbidden') |
| 37 | if sdk.get('minSdkVersion') != 24 or sdk.get('targetSdkVersion') != 36: |
| 38 | raise ValueError('Unexpected Android SDK versions') |
| 39 | activities = [a for tag, a in tags if tag == 'activity'] |
| 40 | if not any(a.get('name') == 'ir.lifeguide.app.MainActivity' and a.get('exported') is True for a in activities): |
| 41 | raise ValueError('Personal APK must resolve the existing fully-qualified MainActivity') |
| 42 | receivers = [a for tag, a in tags if tag == 'receiver'] |
| 43 | if not any(a.get('name') == 'ir.lifeguide.app.LocalReminderReceiver' and a.get('exported') is False for a in receivers): |
| 44 | raise ValueError('Reminder receiver must remain private') |
| 45 | return {'result': 'PASS', 'package': PACKAGE, 'label': LABEL, |
| 46 | 'versionName': manifest['versionName'], 'versionCode': 9, |
| 47 | 'debuggable': True, 'allowBackup': False, 'usesCleartextTraffic': False, |
| 48 | 'internetPermission': False, 'permissions': sorted(permissions), |
| 49 | 'minSdkVersion': 24, 'targetSdkVersion': 36, |
| 50 | 'sha256': hashlib.sha256(apk.read_bytes()).hexdigest(), |
| 51 | 'limitations': 'Debug initial personal edition; signature and actual lifecycle checked separately.'} |
| 52 | |
| 53 | |
| 54 | if __name__ == '__main__': |
| 55 | parser = argparse.ArgumentParser(description=__doc__) |
| 56 | parser.add_argument('apk', type=Path) |
| 57 | options = parser.parse_args() |
| 58 | print(json.dumps(check(options.apk), ensure_ascii=False, indent=2)) |