Skip to content
distractionzeroPublic

Latest commit

 

History

55 Commits

Folders and files

Repository files navigation

Screener icon

Screener - Spam Call Blocker

Block spam calls on Android with your own rules. Free, open source and fully offline.

Layout · Build · Run on an emulator · Release build

A call blocker for Android. Screener rejects incoming calls that match your rules: a regex on the number, or a regex on the caller name the network sends. It does not replace your phone app. It only holds the call screening role (ROLE_CALL_SCREENING) and works alongside your dialer (e.g. Google Phone).

Every incoming call that reaches the service is logged with all the fields and extras the system passes in. Use the log to see what Jio, Airtel, Vi and BSNL actually send.

  • Saved contacts never reach the service, so they always ring.
  • Allow rules are checked first, then block rules, then "Block all unknown callers" if it's on.
  • Numbers are matched in international format (+919876543210, +12125550123). Numbers without a country code are read as local to your country, which is detected from the SIM and can be changed in Settings.
  • In India, the 140 series and common cloud telephony prefixes are blocked by default, and the 160 series (banks, insurance, government) is on the allow list.
  • No INTERNET permission, and backups are disabled. Everything stays on the device.

Layout

app/app/src/main/java/dev/codingcoffee/screener/
  RegexCallScreeningService.kt   # onScreenCall: decide, respond, then log
  ScreenApp.kt                   # app singletons, in-memory rule cache
  rules/RuleEngine.kt            # normalization, default rules, evaluation order
  data/SettingsStore.kt          # rules + settings (Preferences DataStore)
  data/CallLogStore.kt           # filesDir/call_log.jsonl (JSON Lines, append-only)
  ui/                            # Compose screens

Build

nix develop
cd app
./gradlew assembleDebug        # build
./gradlew testDebugUnitTest    # unit tests (rule engine)
./gradlew lintDebug            # optional

Run on an emulator

avdmanager create avd -n pixel37 -d pixel_8 -k "system-images;android-37.0;google_apis;x86_64"
emulator -avd pixel37

adb devices # ensure device is running
cd app && ./gradlew installDebug
adb shell am start -n dev.codingcoffee.screener/.MainActivity

# in case its not killed
adb emu kill

emulator -list-avds
avdmanager delete avd -n <name>

Open the app and grant the call screening role. Then simulate incoming calls:

adb emu gsm call +911409806457   # 140 series: blocked by default
adb emu gsm call +911601234567   # 160 series: allowed by default
adb emu gsm call +919876543210   # no rule: allowed (blocked if "Block all unknown callers" is on)
adb emu gsm cancel +919876543210 # hang up an allowed call

The emulator can't send a network caller name, so you can't test the "Carrier spam label" rule there. Use the rule editor's Test field instead.

On a real device, only real calls from numbers that aren't in your contacts reach the service. To check what your carrier sends (for example, whether Jio's "Spam Alert" arrives in callerDisplayName), open an entry in Activity and look at the raw JSON.

To pull the raw log from a debug build:

adb shell run-as dev.codingcoffee.screener cat files/call_log.jsonl

Release build

Signing key (once)

keytool -genkeypair -v -keystore ~/.android/screener-release.jks \
  -alias screener -keyalg RSA -keysize 4096 -validity 10000

Back up the keystore. Updates must be signed with the same key; losing it means uninstalling, which wipes rules and the call log.

Add the credentials to ~/.gradle/gradle.properties (user-level, never the repo), then chmod 600 ~/.gradle/gradle.properties:

SCREENER_STORE_FILE=/home/<you>/.android/screener-release.jks
SCREENER_STORE_PASSWORD=<password>
SCREENER_KEY_ALIAS=screener
SCREENER_KEY_PASSWORD=<password>

Use an absolute path; Gradle doesn't expand ~. Without these properties the release APK is built unsigned.

Build and verify

nix develop
cd app
./gradlew assembleRelease
$ANDROID_HOME/build-tools/36.0.0/apksigner verify --print-certs app/build/outputs/apk/release/app-release.apk

The output is app/build/outputs/apk/release/app-release.apk. If it's named app-release-unsigned.apk, the signing properties weren't picked up.

App bundle (Play Store)

nix develop
cd app
./gradlew bundleRelease
jarsigner -verify -verbose -certs app/build/outputs/bundle/release/app-release.aab

The output is app/build/outputs/bundle/release/app-release.aab, signed with the same key. With Play App Signing, this key acts as the upload key. apksigner doesn't read bundles, so jarsigner checks the signature instead.

Bump versionCode and versionName in app/app/build.gradle.kts before each release; Play rejects a versionCode it has already seen.

Install and run on the emulator

Debug and release builds are signed with different keys, so uninstall the debug build first. This wipes the app's data.

adb uninstall dev.codingcoffee.screener
adb install -r app/build/outputs/apk/release/app-release.apk
adb shell am start -n dev.codingcoffee.screener/.MainActivity

Later release builds install over the previous one with adb install -r, keeping data.

Install on a phone

With USB debugging on: adb install -r app/build/outputs/apk/release/app-release.apk. Or copy the APK to the phone and open it, allowing "Install unknown apps" when asked. If granting the call screening role is blocked as a restricted setting, go to Settings → Apps → Screener → ⋮ → Allow restricted settings.

Debugging a release crash

adb logcat -c
adb shell am start -n dev.codingcoffee.screener/.MainActivity
adb logcat -d -b crash

R8 obfuscates class names. Map them back with app/build/outputs/mapping/release/mapping.txt from the same build. run-as doesn't work on release builds; use the Copy button in Log detail to get raw entries.

Releases

Packages

Contributors

Languages