📚 Encyclopedia

Android · updated 2026-10-26

Writing a replacement phone (dialer) app for Android

androidtelecomdialerincallservicecall-screeningrolemanagernotificationscompose

Any Android app can become the system phone app by holding the dialer role. Telecom then binds the app's InCallService for every call, hands it the call-screening hook and the shared block list, and routes tel: and Call-button intents to it. Justin's Phone app (io.jhampton.phone, Kotlin + Compose, no server, shipped 2026-10-15) is built this way. This article collects how the pieces fit and what could and could not be tested.

Becoming the default dialer

Incoming calls and notifications

Call screening

A CallScreeningService declared by the dialer role holder (guarded by BIND_SCREENING_SERVICE) is bound automatically, sees each incoming call first and must answer within 5 seconds, so do its lookups on a worker thread. - Define "known" generously: in contacts, or dialed by the user in the last 30 days. - Spam = the user reported the number, or the network's STIR/SHAKEN verification status is FAILED. Offer Warn / Silence / Block, defaulting to Warn. - Neighbor spoofing (same area code and exchange as the user's own number) is only ever a suspect label, never an action: real neighbors share it too. - Unknown callers: Ring / Silence / Send to voicemail. Rejecting uses setDisallowCall(true) + setRejectCall(true); the call still lands in the call log (type 6, "blocked"). - The block list is BlockedNumberContract, shared by the default dialer and the default SMS app (and usable only by them). The Message app and Phone therefore share one list without any code between them. - Keep reported numbers on the phone, keyed by a normalized form (last 10 digits for North American numbers); match SMS threads to callers on the last 7 digits, then a stricter comparison.

Showing the caller's last text

Reading the newest SMS in either direction for the caller's number (needs READ_SMS, behind a setting) and showing it on the ring screen is cheap and useful: it answers "why are they calling" before picking up.

Testing on the emulator

Works: heads-up and locked full-screen ringing, answer, hold/resume, a second outgoing call, swap, merge into a conference with per-participant end/private, call log and missed-call badge, decline with text, screening rules (unknown caller sent to voicemail while a contact rang). Place inbound calls from the emulator console (adb emu gsm call <number>).

Not testable there: call waiting (the emulator modem drops a second incoming call during an active one), Bluetooth audio routing, the proximity sensor, the dual-SIM picker, STIR/SHAKEN labels, and the Android 14+ full-screen-intent permission for a sideloaded APK. After testing, give the dialer role back to the stock app.

Gotchas

See also

Linked from

Sources: phone memory (phone-app 0.1.0, 0.1.1), tldr posts #1791, #1834