Biometrics - #1113
Open
uellenberg wants to merge 2 commits into
Open
Conversation
uellenberg
force-pushed
the
biometrics
branch
from
December 19, 2025 10:38
3739233 to
9abcf49
Compare
Author
|
Fixes #1096 @zhwanng I'm interested in getting a security feature like this into the Seadroid app. Please let me know if you have any feedback/concerns. The biggest issue right now is that MainActivity won't be opened until the user authenticates, so all of the code to register with the server and handle background backups won't be called. I think it's desirable to not force the user to authenticate every time they reboot their device in order for the background backup to work. I'm thinking of moving some of the code out of MainActivity and into the application, that way it always runs. |
There were two bugs with TextSwitchPreference: 1. The switch display was consuming click events when they should have been given to the parent. 2. The materialSwitch variable became stale, and state updates didn't propagate correctly. onBindViewHolder is always called when the underlying Preference updates, so we can fix these two issues in in. Afterwards, state should always be in sync.
This adds a simple biometric lock to the whole application. Once toggled in settings, it requires a fingerprint/password/other authentication method to be used before the app can be opened. Until it's closed, the app will stay permanently unlocked. This doesn't implement locking when moving to a different window / after a certain period of time, account-specific locks, or wiping auth data when biometrics change.
uellenberg
force-pushed
the
biometrics
branch
from
December 31, 2025 04:13
9abcf49 to
3f89532
Compare
Author
|
@zhwanng Rebased with the latest changes. |
jvenuto80
added a commit
to jvenuto80/seadroid
that referenced
this pull request
Mar 27, 2026
Add an app lock feature that uses AndroidX BiometricPrompt with DEVICE_CREDENTIAL fallback, supporting fingerprint, face, PIN, and pattern authentication — all managed by the OS with zero custom UI. Features: - Toggle in Settings > Security to enable/disable app lock - Configurable lock timeout (immediately, 1/5/15/30 min) - Lock on cold start and when returning from background - ProcessLifecycleOwner-based background detection - Background services (backup, sync) are NOT blocked - Splash screen backdrop during authentication Architecture: - AppLockManager: centralized lock state + timeout logic - LockedActivity: shows BiometricPrompt over splash screen - ActivityMonitor: gates all activities when locked - AppProcessLifeObserver: timestamps background/foreground Fixes haiwen#1096 Inspired by PR haiwen#1113 by @uellenberg. Key improvements: - Lock timeout support (re-lock after configurable period) - Background services continue without authentication - Stable biometric library (1.1.0 vs alpha) - ProcessLifecycleOwner for reliable foreground detection
jvenuto80
added a commit
to jvenuto80/seadroid
that referenced
this pull request
Mar 27, 2026
Add an app-wide lock gate using AndroidX BiometricPrompt that supports fingerprint, face, and device PIN/pattern/password authentication. Key design decisions: - Dedicated AppLockManager singleton manages lock state and timeout logic - ActivityMonitor intercepts onActivityCreated and onActivityResumed to redirect to LockedActivity when locked - AppProcessLifeObserver tracks background/foreground transitions for timeout-based re-locking - Per-account settings via encryptSignature-scoped SharedPreferences - Background services (backup, sync) are NOT blocked -- only UI access requires authentication - TextSwitchPreference forces MaterialSwitch.setChecked(isChecked()) in onBindViewHolder to work around SwitchPreferenceCompat not reliably propagating state to MaterialSwitch in custom layouts New files: - AppLockManager.java -- centralized lock state and timeout logic - LockedActivity.java -- full-screen BiometricPrompt gate with splash backdrop Modified files: - ActivityMonitor -- redirect to lock screen on create/resume - AppProcessLifeObserver -- record background timestamp, check on foreground - SeadroidApplication -- call lockIfEnabled() on cold start - SplashActivity -- early return when locked to prevent duplicate navigation - TabSettings2Fragment -- biometric switch init, sync, and timeout visibility - TextSwitchPreference -- fix MaterialSwitch state propagation - Settings -- BIOMETRIC_LOCK_SWITCH and LOCK_TIMEOUT per-account LiveData - prefs_settings_2.xml -- TextSwitchPreference and ListPreference for timeout - strings.xml, donottranslate_prefs.xml -- new string resources Resolves haiwen#1096 Inspired by PR haiwen#1113 by uellenberg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a simple biometric lock to the whole application. Once toggled in settings, it requires a fingerprint/password/other authentication method to be used before the app can be opened.
Until it's closed, the app will stay permanently unlocked. This doesn't implement locking when moving to a different window / after a certain period of time, account-specific locks, or wiping auth data when biometrics change.