3 files renamed (via git mv, history preserved):
- TakLockHandler.kt → LockdownHandler.kt
- TakPassphraseStore.kt → LockdownPassphraseStore.kt
- TakUnlockDialog.kt → LockdownUnlockDialog.kt
16 files updated with consistent renames across the entire codebase. No stray TAK-named symbols remain in any .kt or .aidl source file.
What stayed the same (wire protocol / firmware-defined):
- The firmware notification strings: "TAK_LOCKED", "TAK_NEEDS_PROVISION", "TAK_UNLOCKED", "TAK_UNLOCK_FAILED" — still matched as string literals in LockdownHandler.kt
- Config.DeviceConfig.Role.TAK / TAK_TRACKER proto enum values
- The SharedPrefs key changed from "tak_passphrase_store" → "lockdown_passphrase_store" (existing stored passphrases won't migrate automatically — users will need to re-enter on first launch of the updated app)
Implement the client-side TAK passphrase authentication flow for
devices running TAK-locked firmware.
Key components:
- TakPassphraseStore: per-device passphrase persistence using
EncryptedSharedPreferences (Android Keystore AES-256-GCM), with
boot and hour TTL fields stored alongside the passphrase
- TakLockHandler: orchestrates the full lock/unlock lifecycle —
auto-unlock on reconnect using stored credentials, passphrase
submission, token info parsing, and backoff/failure handling
- MeshCommandSender: sendTakPassphrase() and sendTakLockNow() build
plain local packets that bypass PKC signing and session_passkey;
hour TTL is encoded as an absolute Unix epoch as required by firmware
- ServiceRepository: TakLockState sealed class (None, Locked,
NeedsProvision, Unlocked, LockNowAcknowledged, UnlockFailed,
UnlockBackoff), TakTokenInfo (boots remaining + expiry epoch), and
sessionAuthorized flag
- TakUnlockDialog: Compose dialog for passphrase entry, shown on
Locked and NeedsProvision states; onDismissRequest is a no-op to
prevent race conditions with firmware response timing; cancel
disconnects the user and navigates to the Connections tab
- Lock Now (Security settings): immediately disconnects the client
after informing firmware, purges cached config, navigates away
without showing a passphrase dialog
- ConnectionsScreen: suppress "region unset" prompt while the device
is TAK-locked, since pre-auth config is zeroed/redacted and would
lead the user to a blank LoRa settings screen
- AIDL: sendTakUnlock() and sendTakLockNow() wired through
MeshService → MeshActionHandler → TakLockHandler
- Security settings: "Lock Now (TAK)" button and token info display
showing boots remaining and expiry date
The `drainPacketQueueAndDispatch` test is being ignored because it is flaky and causes intermittent CI failures. This appears to be due to timing issues within the Nordic BLE mock library.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit centralizes all Android Intent constants into a new `MeshtasticIntent` object within the `core/api` module.
This refactoring makes the constants accessible to external applications and removes the duplicated definitions from the main application. The app and the service example have been updated to use these new centralized constants.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Keeps the connection state as 'Connecting' if it was not 'Disconnected' when `handleConnected` is called.
This prevents the UI from briefly showing a disconnected state during a reconnection attempt, such as when the device is rebooting.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit modifies the `onConnectionChanged` function to ensure that all connection state changes are reported, including transitions to the same state. Previously, redundant notifications were suppressed unless the state was `Connected`. This change allows for consistent handling of all connection events.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces several enhancements to the service broadcasts and data handling:
- **Disconnect Broadcast**: Adds and triggers a new `ACTION_MESH_DISCONNECTED` broadcast when the mesh connection state changes to `Disconnected`. This provides a more specific intent for apps to listen for disconnection events.
- **Expanded App Port Handling**:
- Adds explicit broadcast actions for various app port numbers (e.g., `ATAK_PLUGIN`, `PRIVATE_APP`, `DETECTION_SENSOR_APP`).
- Ensures that packets for `ATAK`, `PRIVATE_APP`, and `DETECTION_SENSOR_APP` are now correctly broadcast to external applications.
- Implements a default behavior to broadcast any unrecognized port numbers, allowing for future extensibility and support for third-party apps.
- **Backward Compatibility**: When broadcasting received data, a secondary broadcast with the numeric port number is also sent to maintain compatibility with older applications that may rely on it.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>