Fix Settings search crashed.

Add the check condition in the getNonIndexableKeys to
check if the FaceManager exist or not.

Fixes: 147076221
Test: manual
Change-Id: I898c936403ce90869a9da28aa14297eb6bf5d730
This commit is contained in:
Stanley Wang
2020-01-06 14:10:40 +08:00
parent 8b47bd8665
commit e037faf830

View File

@@ -329,10 +329,13 @@ public class FaceSettings extends DashboardFragment {
@Override
public List<String> getNonIndexableKeys(Context context) {
final List<String> keys = super.getNonIndexableKeys(context);
if (isAvailable(context)) {
final FaceManager faceManager = context.getSystemService(FaceManager.class);
final boolean hasEnrolled = faceManager.hasEnrolledTemplates(
UserHandle.myUserId());
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK : PREF_KEY_DELETE_FACE_DATA);
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
: PREF_KEY_DELETE_FACE_DATA);
}
return keys;
}
};