# motorola-mt6878/hardware_motorola architecture

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

- Interactive diagram: https://gitdiagram.com/motorola-mt6878/hardware_motorola
- Repository: https://github.com/motorola-mt6878/hardware_motorola

## Overview

This repository is a collection of Motorola device components for Android: fingerprint and sensor hardware services, gesture and stylus settings/features, a 5G NR enabler, and a Qualcomm SAP SDK. Principal flows include Android framework requests reaching hardware-backed services, user-configured gestures being activated by a service, and carrier events triggering NR/DSS modem updates. Source excerpts show some relationships directly; other links below are limited to SOURCE INDEX references, so unsampled wiring is not inferred.

Main entry points: [`packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt`](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt) (Motorola telephony), [`packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt`](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt) (QCRIL tunnel), [`packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt`](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt) (Gesture service), [`aidl/fingerprint/service.cpp`](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/service.cpp) (Fingerprint service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_biometrics["Fingerprint"]
  node_fp_service["Fingerprint service<br/>[service.cpp]"]
  node_fp_impl["Fingerprint implementation<br/>[Fingerprint.cpp]"]
  node_fp_config["Fingerprint config"]
  node_fp_session["Fingerprint session<br/>[Session.cpp]"]
  node_lockout["Lockout tracking<br/>[LockoutTracker.h]"]
  node_udfps["UDFPS handler loader<br/>[UdfpsHandler.cpp]"]
  node_udfps_lib["UDFPS handler library"]
end

subgraph group_device_io["Sensors and Touch"]
  node_touch_service["Touch polling service<br/>[service.cpp]"]
  node_touch_rate["High-touch polling"]
  node_sensor_hal["Sensor HAL<br/>[SensorsSubHal.cpp]"]
  node_sensor_device["Sensor device<br/>[Sensor.cpp]"]
end

subgraph group_actions["Moto Actions"]
  node_actions_settings["Gesture preferences"]
  node_actions_service["Gesture service"]
  node_sensor_helper["Sensor helper<br/>[SensorHelper.kt]"]
  node_gesture_actions["Gesture actions<br/>[ChopForTorch.kt]"]
  node_doze_settings["Doze preferences"]
end

subgraph group_telephony["NR Enabler"]
  node_nr_service["NR enabler service"]
  node_moto_telephony["Motorola telephony"]
  node_qcril["QCRIL tunnel"]
  node_nv_info["NV information<br/>[QcomNvInfo.kt]"]
  node_nv_utils["NV utilities<br/>[QcomNvUtils.kt]"]
  node_nr_mode["NR mode<br/>[NrMode.kt]"]
end

subgraph group_stylus["Stylus Handler"]
  node_stylus_settings["Stylus settings"]
  node_stylus_events["Stylus event handler<br/>[EventHandler.kt]"]
  node_stylus_keys["Stylus key handling<br/>[KeyHandler.kt]"]
  node_stylus_utils["Stylus utilities<br/>[Utils.kt]"]
end

subgraph group_sdk["Qualcomm SDK"]
  node_qsap_api["QSAP API<br/>[qsap_api.c]"]
  node_qsap_core["QSAP core<br/>[qsap.c]"]
end

node_framework(("Android framework"))
node_modem["Qualcomm modem"]

node_framework -->|"requests biometrics"| node_fp_service
node_fp_service -->|"initializes"| node_fp_config
node_fp_service -->|"registers"| node_fp_impl
node_fp_impl -->|"uses sessions"| node_fp_session
node_fp_session -->|"tracks lockout"| node_lockout
node_fp_session -->|"uses handler"| node_udfps
node_udfps -->|"loads dynamically"| node_udfps_lib
node_framework -.->|"requests polling"| node_touch_service
node_touch_service -->|"runs service"| node_touch_rate
node_framework -.->|"uses sensors"| node_sensor_hal
node_sensor_hal -.->|"delegates"| node_sensor_device
node_framework -.->|"sets preferences"| node_actions_settings
node_actions_service -->|"reads settings"| node_actions_settings
node_actions_service -->|"configures actions"| node_sensor_helper
node_actions_service -->|"creates actions"| node_gesture_actions
node_doze_settings -->|"reads settings"| node_actions_settings
node_framework -->|"sends carrier events"| node_nr_service
node_nr_service -->|"sets NR and DSS"| node_moto_telephony
node_moto_telephony -->|"sends modem requests"| node_qcril
node_moto_telephony -->|"uses mode"| node_nr_mode
node_moto_telephony -->|"reads NV data"| node_nv_info
node_qcril -->|"uses NV records"| node_nv_info
node_qcril -->|"uses utilities"| node_nv_utils
node_qcril -.->|"exchanges requests"| node_modem
node_framework -.->|"opens settings"| node_stylus_settings
node_stylus_keys -->|"dispatches events"| node_stylus_events
node_stylus_events -->|"invokes actions"| node_stylus_utils
node_stylus_events -->|"opens on removal"| node_stylus_settings
node_qsap_api -.->|"delegates"| node_qsap_core

click node_fp_service "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/service.cpp"
click node_fp_impl "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/Fingerprint.cpp"
click node_fp_config "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/FingerprintConfig.h"
click node_fp_session "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/Session.cpp"
click node_lockout "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/LockoutTracker.h"
click node_udfps "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/udfps/UdfpsHandler.cpp"
click node_touch_service "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/touch/service.cpp"
click node_touch_rate "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/touch/HighTouchPollingRate.cpp"
click node_sensor_hal "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/sensors/SensorsSubHal.cpp"
click node_sensor_device "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/sensors/Sensor.cpp"
click node_actions_settings "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/MotoActionsSettings.kt"
click node_actions_service "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt"
click node_sensor_helper "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/SensorHelper.kt"
click node_gesture_actions "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/actions/ChopForTorch.kt"
click node_doze_settings "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/DozePreferenceFragment.kt"
click node_nr_service "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt"
click node_moto_telephony "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt"
click node_qcril "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt"
click node_nv_info "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvInfo.kt"
click node_nv_utils "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvUtils.kt"
click node_nr_mode "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrMode.kt"
click node_stylus_settings "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/StylusSettingsActivity.kt"
click node_stylus_events "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/EventHandler.kt"
click node_stylus_keys "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/KeyHandler.kt"
click node_stylus_utils "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/Utils.kt"
click node_qsap_api "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/libqsap_sdk/qsap_api.c"
click node_qsap_core "https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/libqsap_sdk/qsap.c"

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_fp_service,node_fp_impl,node_fp_config,node_fp_session,node_lockout,node_udfps,node_udfps_lib toneBlue
class node_touch_service,node_touch_rate,node_sensor_hal,node_sensor_device toneAmber
class node_actions_settings,node_actions_service,node_sensor_helper,node_gesture_actions,node_doze_settings toneMint
class node_nr_service,node_moto_telephony,node_qcril,node_nv_info,node_nv_utils,node_nr_mode toneRose
class node_stylus_settings,node_stylus_events,node_stylus_keys,node_stylus_utils,node_framework,node_modem toneIndigo
class node_qsap_api,node_qsap_core toneTeal
```

## Components

### Fingerprint

- [Fingerprint service](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/service.cpp): `aidl/fingerprint/service.cpp`
- [Fingerprint implementation](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/Fingerprint.cpp): `aidl/fingerprint/Fingerprint.cpp`
- [Fingerprint config](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/FingerprintConfig.h): `aidl/fingerprint/FingerprintConfig.h`
- [Fingerprint session](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/Session.cpp): `aidl/fingerprint/Session.cpp`
- [Lockout tracking](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/fingerprint/LockoutTracker.h): `aidl/fingerprint/LockoutTracker.h`
- [UDFPS handler loader](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/udfps/UdfpsHandler.cpp): `udfps/UdfpsHandler.cpp`
- **UDFPS handler library**

### Sensors and Touch

- [Touch polling service](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/touch/service.cpp): `aidl/touch/service.cpp`
- [High-touch polling](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/aidl/touch/HighTouchPollingRate.cpp): `aidl/touch/HighTouchPollingRate.cpp`
- [Sensor HAL](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/sensors/SensorsSubHal.cpp): `sensors/SensorsSubHal.cpp`
- [Sensor device](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/sensors/Sensor.cpp): `sensors/Sensor.cpp`

### Moto Actions

- [Gesture preferences](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/MotoActionsSettings.kt): `packages/MotoActions/src/org/lineageos/settings/device/MotoActionsSettings.kt`
- [Gesture service](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt): `packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt`
- [Sensor helper](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/SensorHelper.kt): `packages/MotoActions/src/org/lineageos/settings/device/SensorHelper.kt`
- [Gesture actions](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/actions/ChopForTorch.kt): `packages/MotoActions/src/org/lineageos/settings/device/actions/ChopForTorch.kt`
- [Doze preferences](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoActions/src/org/lineageos/settings/device/DozePreferenceFragment.kt): `packages/MotoActions/src/org/lineageos/settings/device/DozePreferenceFragment.kt`

### NR Enabler

- [NR enabler service](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt`
- [Motorola telephony](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt`
- [QCRIL tunnel](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt`
- [NV information](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvInfo.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvInfo.kt`
- [NV utilities](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvUtils.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomNvUtils.kt`
- [NR mode](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrMode.kt): `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrMode.kt`

### Stylus Handler

- [Stylus settings](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/StylusSettingsActivity.kt): `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/StylusSettingsActivity.kt`
- [Stylus event handler](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/EventHandler.kt): `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/EventHandler.kt`
- [Stylus key handling](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/KeyHandler.kt): `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/KeyHandler.kt`
- [Stylus utilities](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/packages/StylusKeyHandler/src/org/lineageos/settings/stylus/Utils.kt): `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/Utils.kt`

### Qualcomm SDK

- [QSAP API](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/libqsap_sdk/qsap_api.c): `libqsap_sdk/qsap_api.c`
- [QSAP core](https://github.com/motorola-mt6878/hardware_motorola/blob/sixteen-staging/libqsap_sdk/qsap.c): `libqsap_sdk/qsap.c`

### Other components

- **Android framework**
- **Qualcomm modem**

## Connections

- Android framework → Fingerprint service: requests biometrics (evidence: `aidl/fingerprint/service.cpp`)
- Fingerprint service → Fingerprint config: initializes (evidence: `aidl/fingerprint/service.cpp`)
- Fingerprint service → Fingerprint implementation: registers (evidence: `aidl/fingerprint/service.cpp`)
- Fingerprint implementation → Fingerprint session: uses sessions
- Fingerprint session → Lockout tracking: tracks lockout
- Fingerprint session → UDFPS handler loader: uses handler
- UDFPS handler loader → UDFPS handler library: loads dynamically (evidence: `udfps/UdfpsHandler.cpp`)
- Android framework → Touch polling service: requests polling
- Touch polling service → High-touch polling: runs service (evidence: `aidl/touch/service.cpp`)
- Android framework → Sensor HAL: uses sensors
- Sensor HAL → Sensor device: delegates
- Android framework → Gesture preferences: sets preferences
- Gesture service → Gesture preferences: reads settings (evidence: `packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt`)
- Gesture service → Sensor helper: configures actions (evidence: `packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt`)
- Gesture service → Gesture actions: creates actions (evidence: `packages/MotoActions/src/org/lineageos/settings/device/MotoActionsService.kt`)
- Doze preferences → Gesture preferences: reads settings (evidence: `packages/MotoActions/src/org/lineageos/settings/device/DozePreferenceFragment.kt`)
- Android framework → NR enabler service: sends carrier events (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt`)
- NR enabler service → Motorola telephony: sets NR and DSS (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt`)
- Motorola telephony → QCRIL tunnel: sends modem requests (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt`)
- Motorola telephony → NR mode: uses mode (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt`)
- Motorola telephony → NV information: reads NV data (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcomMotoExtTelephonyService.kt`)
- QCRIL tunnel → NV information: uses NV records (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt`)
- QCRIL tunnel → NV utilities: uses utilities (evidence: `packages/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/QcrilMsgTunnelConnector.kt`)
- QCRIL tunnel → Qualcomm modem: exchanges requests
- Android framework → Stylus settings: opens settings
- Stylus key handling → Stylus event handler: dispatches events (evidence: `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/KeyHandler.kt`)
- Stylus event handler → Stylus utilities: invokes actions (evidence: `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/EventHandler.kt`)
- Stylus event handler → Stylus settings: opens on removal (evidence: `packages/StylusKeyHandler/src/org/lineageos/settings/stylus/EventHandler.kt`)
- QSAP API → QSAP core: delegates
