Skip to content

[MOB-11639] Make IterableKeychain Async to prevent ANRs #912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

sumeruchat
Copy link
Collaborator

@sumeruchat sumeruchat commented Jun 23, 2025

MOB-11639: Fix IterableKeychain ANR Issues

Problem

was blocking the main thread with crypto operations, causing ANRs for customer PCLN.

Solution

  • Implemented async cache pattern with immediate read access
  • All methods now return instantly from cache
  • All methods update cache immediately, save to storage in background
  • Maintains full backward compatibility and thread safety

Changes

  • Refactored to use for non-blocking cache
  • Added comprehensive test suite (16 tests, all passing)
  • Preserved all existing APIs and encryption behavior

Manual Testing Scenarios

1. Basic Functionality

  • Initialize app with
  • Call and immediately call
  • Expected: Email returns instantly, no UI blocking

2. Rapid Successive Calls

  • Make 10 rapid calls to , ,
  • Expected: All calls return instantly (<1ms each), no ANRs

3. App Startup Performance

  • Cold start the app and measure time to first UI interaction
  • Expected: No delays from keychain operations, smooth startup

4. Background/Foreground Transitions

  • Save user data, background app, foreground app, retrieve data
  • Expected: Data persists correctly, no blocking on retrieval

5. Encryption Failure Recovery

  • Simulate encryption failure (requires debug build)
  • Expected: App continues functioning, falls back to plaintext

Status: ✅ Ready for Review
Tests: 16/16 passing
Backward Compatibility: Fully maintained

… structure in IterableKeychain.kt- Enhanced test coverage and refactored tests in IterableKeychainTest.kt- Added 421 lines and removed 236 lines across both files
@sumeruchat sumeruchat added Do Not Merge Don't merge this PR yet bug labels Jun 23, 2025
@sumeruchat sumeruchat removed the Do Not Merge Don't merge this PR yet label Jun 23, 2025
@sumeruchat sumeruchat marked this pull request as ready for review June 23, 2025 10:21
@sumeruchat sumeruchat changed the title [MOB-11639] Fix IterableKeychain ANR Issues - Async Cache Implementation [MOB-11639] Make IterableKeychain Async to prevent ANRs Jun 27, 2025
@sumeruchat sumeruchat closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant