Description
MainActivity.kt:72 reads isParentalLockEnabled only once at initial composition:
val isUnlocked = remember { mutableStateOf(!settings.isParentalLockEnabled) }
If the user navigates to Settings, enables parental lock, and navigates back, isUnlocked is still true because it was captured at composition time. The lock screen only appears after the activity goes through ON_STOP -> ON_START.
Impact
- Open the app
- Go to Settings -> enable parental lock -> set a PIN
- Press back to Dashboard - still unlocked
- The lock only activates after the app is fully backgrounded and reopened
Fix: Derive isUnlocked from a StateFlow or use produceState that observes SharedPreferences changes for the parental_lock key.
Description
MainActivity.kt:72 reads isParentalLockEnabled only once at initial composition:
If the user navigates to Settings, enables parental lock, and navigates back, isUnlocked is still true because it was captured at composition time. The lock screen only appears after the activity goes through ON_STOP -> ON_START.
Impact
Fix: Derive isUnlocked from a StateFlow or use produceState that observes SharedPreferences changes for the parental_lock key.