Repository navigation
fix: prevent bypassing lock screens - #247
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive dismissal behavior lacks regression coverage and still needs verification on Android 16 and earlier supported versions.
2 open issues
What changed in this PR
This PR closes Escape-key dismissal paths in the passcode and pattern lock screens and moves back handling to the AndroidX dispatcher for Android 16 compatibility.
Changes:
- Replace legacy Back interception with lifecycle-aware callbacks.
- Route Escape and toolbar navigation through the same cancellation guards.
- Preserve cancellation for optional setup and removal while blocking dismissal of mandatory locks.
| File | Description |
|---|---|
| opencloudApp/src/main/java/eu/opencloud/android/presentation/security/pattern/PatternActivity.kt | Adds guarded Back callbacks and routes Escape through the dispatcher. |
| opencloudApp/src/main/java/eu/opencloud/android/presentation/security/passcode/PassCodeActivity.kt | Applies guarded dispatcher handling to Back, Escape, and toolbar navigation. |
Review effort: Balanced
Comment on lines
+84
to
+86
| if ((ACTION_CREATE == intent.action && intent.extras?.getBoolean(EXTRAS_LOCK_ENFORCED) != true) || ACTION_REMOVE == intent.action) { | ||
| PassCodeManager.onActivityStopped(this@PassCodeActivity) | ||
| finish() |
Comment on lines
+354
to
+356
| KeyEvent.KEYCODE_ESCAPE -> { | ||
| onBackPressedDispatcher.onBackPressed() | ||
| true |
wernrab
force-pushed
the
prevent-bypassing-lock-screens
branch
from
October 27, 2026 09:53
3b411ae to
687e31e
Compare
Comment on lines
+74
to
+77
| private val onBackPressedCallback = object : OnBackPressedCallback(true) { | ||
| override fun handleOnBackPressed() { | ||
| if ((ACTION_REQUEST_WITH_RESULT == intent.action && intent.extras?.getBoolean(EXTRAS_LOCK_ENFORCED) != true) || | ||
| ACTION_CHECK_WITH_RESULT == intent.action) { |
wernrab
force-pushed
the
prevent-bypassing-lock-screens
branch
from
October 27, 2026 14:21
b91a05c to
0d3431e
Compare
wernrab
marked this pull request as ready for review
October 28, 2026 09:59
wernrab
marked this pull request as draft
October 28, 2026 14:17
wernrab
force-pushed
the
prevent-bypassing-lock-screens
branch
from
October 30, 2026 11:42
5254188 to
230b1fd
Compare
wernrab
marked this pull request as ready for review
October 30, 2026 12:20
guruz
approved these changes
Oct 30, 2026
kulmann
approved these changes
Nov 2, 2026
wernrab
force-pushed
the
prevent-bypassing-lock-screens
branch
from
November 2, 2026 11:45
230b1fd to
37e8e74
Compare
Reported-by: CyberNative AI LLC (https://cybernative.ai)
wernrab
force-pushed
the
prevent-bypassing-lock-screens
branch
from
November 2, 2026 11:46
37e8e74 to
55fd26a
Compare
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.

A user could bypass the lock screens by simply pressing Escape. Hint for testing: The Escape key might send KEYCODE_BACK, but you can send a real Escape keypress by using this adb command:
adb shell input keyevent KEYCODE_ESCAPERunning Apps targeting API 36 on Android 16 lead to a different behaviour regarding back navigation.
onBackPressedandKeyEvent.KEYCODE_BACKare no longer used. See hereReported by CyberNative AI LLC (https://cybernative.ai), thank you