Skip to content

Conversation

Copy link

Copilot AI commented Jan 18, 2026

Fix Issues #138, #137, #135, #132, and #129

Summary

This PR addresses five critical bugs in the AppLock application that affect user experience and functionality.

Issues Fixed

Issue #138: Overlay screen stays when biometric authentication is not passed

Problem: When a user opens a locked app and the biometric prompt appears, if they exit the app (go home or to recent apps) without authenticating, the overlay remains visible over the home screen and other apps.

Solution:

  • Added biometric prompt cancellation in onPause() lifecycle method
  • When activity is paused (user moves to home/recents), biometric prompt is cancelled and activity finishes
  • This ensures the overlay is removed when user leaves without authenticating
  • Security maintained: locked app is never accessible without authentication

Files Changed:

  • app/src/main/java/dev/pranav/applock/features/lockscreen/ui/PasswordOverlayScreen.kt

Issue #137: App restarts and shows lock screen when zooming/rotating

Problem: When viewing photos or rotating the screen in locked apps (like Google Photos or Instagram), the lock screen appears and the app restarts, losing the current state.

Solution:

  • Added android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" to PasswordOverlayActivity in the manifest
  • Activity now handles configuration changes without recreation
  • Lock screen no longer triggers during normal app usage like zooming or rotating

Files Changed:

  • app/src/main/AndroidManifest.xml

Issue #135: "Lock immediately" option not working

Problem: When unlock time duration is set to 0 (lock immediately), the app doesn't lock immediately after the user leaves and returns.

Solution:

  • Modified checkAndLockApp method in all three services (Accessibility, Experimental, Shizuku)
  • When unlock duration is 0, unlock timestamps are cleared immediately
  • App now locks immediately after leaving, as expected by the user
  • Consistent behavior across all backend implementations

Files Changed:

  • app/src/main/java/dev/pranav/applock/services/AppLockAccessibilityService.kt
  • app/src/main/java/dev/pranav/applock/services/ExperimentalAppLockService.kt
  • app/src/main/java/dev/pranav/applock/services/ShizukuAppLockService.kt

Issue #132: Biometric authentication always tries face unlock

Problem: The biometric prompt always attempts face unlock even when users prefer fingerprint only, which is problematic in dark environments.

Solution:

  • Changed biometric authenticator from BIOMETRIC_WEAK or BIOMETRIC_STRONG to BIOMETRIC_STRONG only
  • This configuration prefers strong biometrics (fingerprint, iris) over weak face recognition
  • Improves user experience by prioritizing fingerprint authentication

Files Changed:

  • app/src/main/java/dev/pranav/applock/features/lockscreen/ui/PasswordOverlayScreen.kt
  • app/src/main/java/dev/pranav/applock/core/navigation/AppNavigator.kt

Issue #129: App keeps freezing

Problem: The app completely stops working after a couple of hours, likely due to uncaught exceptions in background services.

Solution:

  • Added exception handling to ExperimentalAppLockService timer task (runs every 250ms)
  • Added exception handling to ShizukuAppLockService activity callback
  • Services now continue running even if errors occur in monitoring loops
  • Prevents service crashes that could cause app to stop responding

Files Changed:

  • app/src/main/java/dev/pranav/applock/services/ExperimentalAppLockService.kt
  • app/src/main/java/dev/pranav/applock/services/ShizukuAppLockService.kt

Testing Recommendations

  1. Issue [BUG] Overlay screen stays when not passed #138: Open a locked app, wait for biometric prompt, press home button, verify overlay disappears and home screen is shown (not the locked app)
  2. Issue App restarts and shows lock screen when zooming images in third-party apps (also occurs on screen rotation) #137: Lock an app like Google Photos, open an image, rotate device, verify no lock screen appears
  3. Issue Lock immediately not working #135: Set unlock duration to "Lock immediately", unlock an app, switch away and back, verify it locks immediately (test with all three backends)
  4. Issue So many bugs #132: Test biometric authentication to verify it prioritizes fingerprint over face unlock
  5. Issue App keeps freezing. #129: Run app for extended periods (hours) with various backends, verify services don't crash or freeze

Code Quality

  • Code review completed and feedback addressed
  • Security scan passed (no vulnerabilities detected)
  • Security issue fixed: removed incorrect finish() call that would expose locked app
  • All changes are minimal and focused on fixing specific issues
  • Exception handling improved to prevent service freezes
  • Consistent behavior across all backend implementations
  • Code logic simplified where possible
Original prompt

Fix the issue #138 #137 #135 and #132 Make sure every aspect of bug is taken care for.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 18, 2026 01:20
- Issue #138: Cancel biometric prompt in onPause and finish activity when user cancels
- Issue #137: Add configChanges to PasswordOverlayActivity to handle screen rotation
- Issue #135: Skip temporarily unlocked check when duration is 0 (lock immediately)
- Issue #132: Use BIOMETRIC_STRONG only to prefer fingerprint over face unlock

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
- Simplify unlock duration logic by extracting common clearTemporarilyUnlockedApp call
- Catch specific IllegalStateException instead of generic Exception

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues for bugs 138, 137, 135, and 132 Fix overlay persistence, configuration change handling, immediate locking, and biometric preferences Jan 18, 2026
Copilot AI requested a review from PranavPurwar January 18, 2026 01:23
The finish() call in onAuthenticationError would allow access to locked app without authentication. The correct fix for issue #138 is already in onPause() which cancels biometric prompt and finishes the activity when moving to background.

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 18, 2026

@copilot I can see you're doing "// If user cancels authentication, finish the activity to remove the overlay
// This prevents the overlay from staying visible over other apps". But if...

You're absolutely correct! Calling finish() in onAuthenticationError would indeed expose the locked app without authentication, which is a security issue.

I've removed that code in commit 9251f57. The actual fix for issue #138 is already handled correctly in onPause():

  • When user moves to home/recents without authenticating, onPause() is called
  • It cancels the biometric prompt and calls finish()
  • This ensures user goes to home screen (where they navigated to), not the locked app

Security is maintained: the locked app is never accessible without proper authentication.

- Wrap ExperimentalAppLockService timer task in try-catch to prevent freezes
- Wrap ShizukuAppLockService callback in try-catch to handle exceptions gracefully
- Ensures services continue running even if errors occur in monitoring loops

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 18, 2026

@copilot Now address #129

Addressed in commit eb8c506.

Issue #129 was about the app freezing after a couple of hours. I identified that the background services (ExperimentalAppLockService and ShizukuAppLockService) lacked exception handling in their monitoring loops. If an exception occurred during the frequent checks (every 250ms), the service could crash or freeze.

Changes made:

  • Added try-catch blocks to ExperimentalAppLockService timer task
  • Added try-catch blocks to ShizukuAppLockService activity callback
  • Services now log errors and continue running instead of crashing

This ensures the app remains responsive even if temporary errors occur in the monitoring loops.

- Add lock immediately logic to ExperimentalAppLockService
- Add lock immediately logic to ShizukuAppLockService
- Ensures consistent behavior across all backend implementations

Co-authored-by: PranavPurwar <75154889+PranavPurwar@users.noreply.github.com>
Copilot AI changed the title Fix overlay persistence, configuration change handling, immediate locking, and biometric preferences Fix overlay persistence, configuration change handling, immediate locking, biometric preferences, and service freezing Jan 18, 2026
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.

2 participants