Loading
Fix secondary user crash with system user locked
Resolve an incorrect exception causing a crash to boot animation
when unlocking secondary users, if Backup Manager is enabled for
the user and the system user has yet to be unlocked:
`java.lang.IllegalStateException: SharedPreferences in credential
encrypted storage are not available until after user is unlocked`
Provide the user's context for creating UserBackupPreferences, and
use this context's userId when determining whether credential encrypted
storage is available or not, when calling Context#getSharedPreferences.
Test: Manual: Set a screen lock for system user. Turn on Settings >
Multiple Users and create a secondary user. Run: `adb shell
settings put global allow_user_switching_when_system_user_locked 1`.
Enable Backup Manager for the user, e.g.
`adb shell bmgr --user 10 enable true` (if the user is id 10; see
`adb shell pm list users`). Reboot. Switch to the secondary user
before unlocking system. Device no longer crashes to boot animation.
Issue: calyxos#1352
Co-authored-by:
Oliver Scott <olivercscott@gmail.com>
Change-Id: I8354307d10cafe12f556ac13a38122d53399c1d8