Skip to content

Keep Aegis in the task when auto-locking in the background - #1848

Open
lacostej wants to merge 1 commit into
beemdevelopment:masterfrom
lacostej:keep-window-on-lock
Open

lacostej wants to merge 1 commit into
beemdevelopment:masterfrom
lacostej:keep-window-on-lock

Conversation

@lacostej

Copy link
Copy Markdown

Since targeting above Android 11, the reflective Activity.finish(int) from #714 is denied (hiddenapi: ... finish(I)V (api=max-target-r) ... denied), so every auto lock falls back to finishAndRemoveTask() and Aegis vanishes from recents on each screen lock (#991).

With this PR, a lock that arrives while Aegis is in the background no longer removes the task: activities opened on top of MainActivity (such as the entry editor) are closed, MainActivity clears its entries but stays open, and its existing onStart opens AuthActivity when the user returns, showing the same unlock screen as a cold start, so no background activity launch is needed. Locks that arrive while Aegis is visible (back-button lock, panic, the late SCREEN_OFF from #1576) behave as before.

With secure screen disabled, the recents thumbnail can show the codes from before the lock, which is the same exposure #714 had.

Tested on a Samsung phone with targetSdk 36 (lock on the entry list, lock on the edit screen, back-button lock), and with the new AutoLockTest on an API 35 emulator; with the fix reverted, testLockInBackgroundKeepsMainActivity fails.

When the vault locks while MainActivity is stopped (screen off, minimize),
only finish the activities above it; MainActivity's onStart already asks for
auth when the user returns. The reflective finish(int) that used to keep the
task in recents is denied for apps targeting above Android 11, so the
fallback finishAndRemoveTask() closed the app on every screen lock.
@lacostej
lacostej marked this pull request as ready for review October 23, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant