OSDN Git Service

Resolve challenge lifecycle race conditions
authorKevin Chyn <kchyn@google.com>
Tue, 4 Jun 2019 20:29:40 +0000 (13:29 -0700)
committerKevin Chyn <kchyn@google.com>
Tue, 4 Jun 2019 21:27:28 +0000 (14:27 -0700)
commitf20bb1c635ebda997a785f4829e3791b4179a29e
tree19372a65e270f6ca54708da4fece6f1a162434e1
parente716ce107de6e7bcc1beddc3aa0d2326dd0a2b59
Resolve challenge lifecycle race conditions

1) FaceSettings now gets closed when it loses foreground. This prevents
   A) Keyguard/LockSettingsService's resetLockout's revokeChallenge from
   leaving FaceSettings with a stale HAT which prevents users from
   enrolling or toggling elements that require the HAT.
   B) generateChallenge has a timeout, which may already have been met
   C) User may have forgotten FaceSettings was open and lost context. Thus
   it makes no sense to show ConfirmLock* since the user may have no idea
   why it's showing anymore.

2) FaceSettings now generatesChallenge in onResume. onCreate is too early
   since again, FaceSettings can be launched via intent while on Keyguard.
   Similarly, we must ensure that Settings's challenge is generated
   late enough (e.g. when it actually gains foregroundness)

Fixes: 133440610
Fixes: 133498264

Test: Open face settings, confirm password, lock screen. After unlocking,
      user needs to re-open face settings.

Test: Modify HAL/framework to show re-enroll notification
      Tap re-enroll notificaton on keyguard
      Delete and re-enroll in settings, successful

Test: FaceSettings enroll works accross orientation change

Test: Tapping enroll button doesn't cause challenge to be revoked
      due to onStop()

Change-Id: I60f606314c458a61e9c1b4f4b66bc27bc44287da
src/com/android/settings/biometrics/face/FaceSettings.java
src/com/android/settings/biometrics/face/FaceSettingsEnrollButtonPreferenceController.java