# xdtianyu/callerinfo architecture

> Architecture diagram of the GitHub repository xdtianyu/callerinfo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xdtianyu/callerinfo
- Repository: https://github.com/xdtianyu/callerinfo

## Overview

CallerInfo is an Android caller-identification app. Its central flow is an incoming call or manual lookup, caller-information resolution using local/history data and (when needed) online lookup, then presentation in the call list or floating window. The repository also includes configurable call marking, scheduling/data upgrades, and an optional companion plugin for automatic hangup and call-log annotations. Several links are documented by the README or SOURCE INDEX; where sampled source does not show the exact runtime dispatch, the graph omits that link rather than assuming it.

Main entry points: [`app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt`](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt) (Call presenter), [`app/src/main/java/org/xdty/callerinfo/model/database/DatabaseImpl.kt`](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/model/database/DatabaseImpl.kt) (Caller database), [`app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt`](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt) (Main screen), [`app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt`](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt) (Task scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and screens"]
  node_main["Main screen<br/>[MainActivity.kt]"]
  node_settingsui["Settings screen"]
  node_bottomsheet["Mark sheet"]
end

subgraph group_lookup["Caller lookup"]
  node_presenter["Call presenter"]
  node_repository["Lookup repository"]
  node_datasource["Lookup contract"]
  node_callerlist["Recent calls<br/>[CallerAdapter.kt]"]
end

subgraph group_state["Settings and state"]
  node_database[("Caller database<br/>[DatabaseImpl.kt]")]
  node_settings["Preferences<br/>[SettingImpl.kt]"]
  node_preferences["Preference actions"]
  node_application["App bootstrap<br/>[Application.kt]"]
end

subgraph group_callui["Call handling"]
  node_incoming["Incoming-call receiver<br/>[IncomingCall.kt]"]
  node_windowapi["Window coordinator<br/>[Window.kt]"]
  node_floatwindow["Floating window<br/>[FloatWindow.kt]"]
  node_alarm["Task scheduler<br/>[Alarm.kt]"]
  node_schedule["Mark scheduler<br/>[ScheduleService.kt]"]
  node_upgrade["Offline-data upgrade<br/>[UpgradeWorker.kt]"]
end

subgraph group_plugin["Companion plugin"]
  node_pluginservice["Plugin service<br/>[PluginService.java]"]
  node_pluginui["Plugin controls<br/>[MainActivity.java]"]
end

node_user(("User"))
node_network(("Online lookup"))

node_user -->|"opens"| node_main
node_main -->|"shows recents"| node_callerlist
node_main -.->|"requests lookup"| node_presenter
node_presenter -->|"queries"| node_datasource
node_repository -->|"reads history"| node_database
node_repository -.->|"online fallback"| node_network
node_presenter -->|"records calls"| node_database
node_user -->|"receives call"| node_incoming
node_incoming -.->|"handles call"| node_presenter
node_presenter -.->|"shows result"| node_windowapi
node_windowapi -->|"sends window data"| node_floatwindow
node_settingsui -->|"applies changes"| node_preferences
node_preferences -.->|"updates"| node_settings
node_bottomsheet -.->|"marks number"| node_database
node_application -->|"starts schedules"| node_alarm
node_alarm -->|"sets repeating task"| node_schedule
node_alarm -->|"enqueues work"| node_upgrade
node_upgrade -->|"checks connectivity"| node_network
node_pluginui -->|"binds service"| node_pluginservice
node_pluginservice -->|"hangs up calls"| node_user
node_pluginservice -.->|"imports records"| node_database

click node_main "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt"
click node_settingsui "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/fragment/SettingsFragment.kt"
click node_bottomsheet "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/fragment/MainBottomSheetFragment.kt"
click node_presenter "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt"
click node_repository "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/data/CallerRepository.kt"
click node_datasource "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/data/CallerDataSource.kt"
click node_callerlist "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/view/CallerAdapter.kt"
click node_database "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/model/database/DatabaseImpl.kt"
click node_settings "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/model/setting/SettingImpl.kt"
click node_preferences "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/settings/PreferenceActions.kt"
click node_application "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/application/Application.kt"
click node_incoming "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/receiver/IncomingCall.kt"
click node_windowapi "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/utils/Window.kt"
click node_floatwindow "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/service/FloatWindow.kt"
click node_alarm "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt"
click node_schedule "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/service/ScheduleService.kt"
click node_upgrade "https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/worker/UpgradeWorker.kt"
click node_pluginservice "https://github.com/xdtianyu/callerinfo/blob/master/plugin/src/main/java/org/xdty/callerinfo/plugin/PluginService.java"
click node_pluginui "https://github.com/xdtianyu/callerinfo/blob/master/plugin/src/main/java/org/xdty/callerinfo/plugin/MainActivity.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_settingsui,node_bottomsheet,node_user toneBlue
class node_presenter,node_repository,node_datasource,node_callerlist toneAmber
class node_database,node_settings,node_preferences,node_application toneMint
class node_incoming,node_windowapi,node_floatwindow,node_alarm,node_schedule,node_upgrade toneRose
class node_pluginservice,node_pluginui,node_network toneIndigo
```

## Components

### App and screens

- [Main screen](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt): `app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt`
- [Settings screen](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/fragment/SettingsFragment.kt): `app/src/main/java/org/xdty/callerinfo/fragment/SettingsFragment.kt`
- [Mark sheet](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/fragment/MainBottomSheetFragment.kt): `app/src/main/java/org/xdty/callerinfo/fragment/MainBottomSheetFragment.kt`

### Caller lookup

- [Call presenter](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt): `app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt`
- [Lookup repository](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/data/CallerRepository.kt): `app/src/main/java/org/xdty/callerinfo/data/CallerRepository.kt`
- [Lookup contract](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/data/CallerDataSource.kt): `app/src/main/java/org/xdty/callerinfo/data/CallerDataSource.kt`
- [Recent calls](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/view/CallerAdapter.kt): `app/src/main/java/org/xdty/callerinfo/view/CallerAdapter.kt`

### Settings and state

- [Caller database](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/model/database/DatabaseImpl.kt): `app/src/main/java/org/xdty/callerinfo/model/database/DatabaseImpl.kt`
- [Preferences](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/model/setting/SettingImpl.kt): `app/src/main/java/org/xdty/callerinfo/model/setting/SettingImpl.kt`
- [Preference actions](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/settings/PreferenceActions.kt): `app/src/main/java/org/xdty/callerinfo/settings/PreferenceActions.kt`
- [App bootstrap](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/application/Application.kt): `app/src/main/java/org/xdty/callerinfo/application/Application.kt`

### Call handling

- [Incoming-call receiver](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/receiver/IncomingCall.kt): `app/src/main/java/org/xdty/callerinfo/receiver/IncomingCall.kt`
- [Window coordinator](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/utils/Window.kt): `app/src/main/java/org/xdty/callerinfo/utils/Window.kt`
- [Floating window](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/service/FloatWindow.kt): `app/src/main/java/org/xdty/callerinfo/service/FloatWindow.kt`
- [Task scheduler](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt): `app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt`
- [Mark scheduler](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/service/ScheduleService.kt): `app/src/main/java/org/xdty/callerinfo/service/ScheduleService.kt`
- [Offline-data upgrade](https://github.com/xdtianyu/callerinfo/blob/master/app/src/main/java/org/xdty/callerinfo/worker/UpgradeWorker.kt): `app/src/main/java/org/xdty/callerinfo/worker/UpgradeWorker.kt`

### Companion plugin

- [Plugin service](https://github.com/xdtianyu/callerinfo/blob/master/plugin/src/main/java/org/xdty/callerinfo/plugin/PluginService.java): `plugin/src/main/java/org/xdty/callerinfo/plugin/PluginService.java`
- [Plugin controls](https://github.com/xdtianyu/callerinfo/blob/master/plugin/src/main/java/org/xdty/callerinfo/plugin/MainActivity.java): `plugin/src/main/java/org/xdty/callerinfo/plugin/MainActivity.java`

### Other components

- **User**
- **Online lookup**

## Connections

- User → Main screen: opens
- Main screen → Recent calls: shows recents (evidence: `app/src/main/java/org/xdty/callerinfo/activity/MainActivity.kt`)
- Main screen → Call presenter: requests lookup
- Call presenter → Lookup contract: queries (evidence: `app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt`)
- Lookup repository → Caller database: reads history (evidence: `app/src/main/java/org/xdty/callerinfo/data/CallerRepository.kt`)
- Lookup repository → Online lookup: online fallback
- Call presenter → Caller database: records calls (evidence: `app/src/main/java/org/xdty/callerinfo/presenter/PhoneStatePresenter.kt`)
- User → Incoming-call receiver: receives call
- Incoming-call receiver → Call presenter: handles call
- Call presenter → Window coordinator: shows result
- Window coordinator → Floating window: sends window data (evidence: `app/src/main/java/org/xdty/callerinfo/utils/Window.kt`)
- Settings screen → Preference actions: applies changes (evidence: `app/src/main/java/org/xdty/callerinfo/fragment/SettingsFragment.kt`)
- Preference actions → Preferences: updates
- Mark sheet → Caller database: marks number
- App bootstrap → Task scheduler: starts schedules (evidence: `app/src/main/java/org/xdty/callerinfo/application/Application.kt`)
- Task scheduler → Mark scheduler: sets repeating task (evidence: `app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt`)
- Task scheduler → Offline-data upgrade: enqueues work (evidence: `app/src/main/java/org/xdty/callerinfo/utils/Alarm.kt`)
- Offline-data upgrade → Online lookup: checks connectivity (evidence: `app/src/main/java/org/xdty/callerinfo/worker/UpgradeWorker.kt`)
- Plugin controls → Plugin service: binds service (evidence: `plugin/src/main/java/org/xdty/callerinfo/plugin/MainActivity.java`)
- Plugin service → User: hangs up calls (evidence: `plugin/src/main/java/org/xdty/callerinfo/plugin/PluginService.java`)
- Plugin service → Caller database: imports records
