Merge "Remove work fingerprints when primary profile lock is removed" into nyc-dev

This commit is contained in:
Ricky Wai
2016-06-15 16:02:18 +00:00
committed by Android (Google) Code Review

View File

@@ -655,30 +655,35 @@ public class ChooseLockGeneric extends SettingsActivity {
} }
private void removeAllFingerprintForUserAndFinish(final int userId) { private void removeAllFingerprintForUserAndFinish(final int userId) {
if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected() if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
&& mFingerprintManager.hasEnrolledFingerprints(userId)) { if (mFingerprintManager.hasEnrolledFingerprints(userId)) {
mFingerprintManager.setActiveUser(userId); mFingerprintManager.setActiveUser(userId);
// For the purposes of M and N, groupId is the same as userId. // For the purposes of M and N, groupId is the same as userId.
final int groupId = userId; final int groupId = userId;
Fingerprint finger = new Fingerprint(null, groupId, 0, 0); Fingerprint finger = new Fingerprint(null, groupId, 0, 0);
mFingerprintManager.remove(finger, userId, mFingerprintManager.remove(finger, userId,
new RemovalCallback() { new RemovalCallback() {
@Override @Override
public void onRemovalError(Fingerprint fp, int errMsgId, public void onRemovalError(Fingerprint fp, int errMsgId,
CharSequence errString) { CharSequence errString) {
Log.v(TAG, "Fingerprint removed: " + fp.getFingerId()); Log.v(TAG, "Fingerprint removed: " + fp.getFingerId());
if (fp.getFingerId() == 0) { if (fp.getFingerId() == 0) {
removeManagedProfileFingerprintsAndFinishIfNecessary(userId); removeManagedProfileFingerprintsAndFinishIfNecessary(userId);
}
} }
}
@Override @Override
public void onRemovalSucceeded(Fingerprint fingerprint) { public void onRemovalSucceeded(Fingerprint fingerprint) {
if (fingerprint.getFingerId() == 0) { if (fingerprint.getFingerId() == 0) {
removeManagedProfileFingerprintsAndFinishIfNecessary(userId); removeManagedProfileFingerprintsAndFinishIfNecessary(userId);
}
} }
} });
}); } else {
// No fingerprints in this user, we may also want to delete managed profile
// fingerprints
removeManagedProfileFingerprintsAndFinishIfNecessary(userId);
}
} else { } else {
// The removal callback will call finish, once all fingerprints are removed. // The removal callback will call finish, once all fingerprints are removed.
// We need to wait for that to occur, otherwise, the UI will still show that // We need to wait for that to occur, otherwise, the UI will still show that