OSDN Git Service

FingerprintService: check current user correctly
authorCharles He <qiurui@google.com>
Mon, 27 Mar 2017 20:16:20 +0000 (21:16 +0100)
committerCharles He <qiurui@google.com>
Thu, 6 Apr 2017 19:54:15 +0000 (19:54 +0000)
commit959ac8e04d3c25da11ed6fca1babf56a69a032ba
treebe11b42a4f7a809464eff9c393fa066eeb7abdf6
parentc29dffed16a4a60025a7f177693e5b6f57c8ba5b
FingerprintService: check current user correctly

FingerprintService maintains a mCurrentUserId field which keeps track of
the active group/user id in the underlying daemon. This field, however,
can become invalid after the daemon crashes and before
FingerprintService reconnects to a new daemon. (mCurrentUserId is only
set upon updateActiveGroup().)

Previously, mCurrentUserId is wrongly used in the logic of
isCurrentUserOrProfile(), resulting in false negatives when
mCurrentUserId is invalid. In this CL, we use
ActivityManager.getCurrentUser() instead, which has no dependency on the
state of the daemon.

This will also reduce the complexity around mCurrentUserId, and
hopefully will make future clean-ups easier.

Test: manually kill daemon and verify fingerprint functions normally
Bug: 36152864
Change-Id: I4250fad0e7c88bde95a1da1c89e71b4931ee3b8a
services/core/java/com/android/server/fingerprint/FingerprintService.java