# 13. Call Screening Service Production Hardening meta: id: android-production-13 feature: android-production priority: P1 depends_on: [] tags: [native-features, spamshield, production] objective: - Harden the CallScreeningService for production use with robust spam detection and minimal latency deliverables: - CallScreeningService production-ready - Spam database local caching - Real-time caller lookup - Permission handling and user guidance steps: 1. Audit existing service: - Review android/app/.../service/CallScreeningService.kt - Identify gaps in production readiness - Test current functionality 2. Implement local spam database: - Cache spam numbers locally (Room database) - Sync with backend periodically - Hash numbers for privacy - Support pattern matching (wildcards) 3. Optimize lookup performance: - Use indexed database queries - Target <100ms lookup time - Cache frequent lookups in memory - Use Bloom filter for fast negative checks 4. Add caller identification: - Display caller info for known contacts - Show spam likelihood percentage - Show spam category (telemarketer, scam, etc.) 5. Handle permissions: - Request CALL_SCREENING role - Guide user to Default Apps settings - Handle permission denial gracefully - Re-check permission on app launch 6. Add user controls: - Toggle for call screening - Toggle for call blocking - Manage blocked numbers - Report false positives/negatives 7. Add logging and analytics: - Log screened calls (anonymized) - Track block rate and accuracy - Report metrics to backend 8. Test thoroughly: - Test with simulated calls - Test on physical devices - Test with various carriers tests: - Unit: Test spam lookup logic - Integration: Test CallScreeningService binding - Device: Test with actual incoming calls acceptance_criteria: - CallScreeningService registered and active - Local spam database synced daily - Caller lookup <100ms - Known spam calls blocked or flagged - User can enable/disable screening - Block list manageable from app - Permission handling with user guidance - False positive reporting mechanism - No crashes during call handling - Works on Android 10+ (API 29+) - Battery impact minimal validation: - Enable call screening → incoming spam call blocked - Check database → spam numbers cached locally - Measure lookup time → <100ms - Report false positive → number removed from block list - Disable in app → screening stops notes: - CallScreeningService requires special role (not just permission) - User must set app as default call screening app in Settings - Different carriers may handle call screening differently - Test thoroughly on physical devices with real SIM cards