Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e81d6b7b authored by Stanley Wang's avatar Stanley Wang
Browse files

The index implementation for face unlock settings.

- Index the delete face unlock preference and set up face unlock preference.

Fixes: 147031175
Test: manual
Change-Id: Ia984a116947d0c2e6a909f53914d081e25496f87
parent 8a9ad065
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -71,12 +71,14 @@
        android:title="@string/security_settings_face_preference_title">
        <com.android.settingslib.widget.LayoutPreference
            android:key="security_settings_face_delete_faces_container"
            android:title="@string/security_settings_face_settings_remove_face_data"
            android:selectable="false"
            android:layout="@layout/face_remove_button"
            settings:allowDividerBelow="true"/>

        <com.android.settingslib.widget.LayoutPreference
            android:key="security_settings_face_enroll_faces_container"
            android:title="@string/security_settings_face_settings_enroll"
            android:selectable="false"
            android:layout="@layout/face_enroll_button"
            settings:allowDividerBelow="true"/>
+15 −1
Original line number Diff line number Diff line
@@ -56,6 +56,11 @@ public class FaceSettings extends DashboardFragment {
    private static final String TAG = "FaceSettings";
    private static final String KEY_TOKEN = "hw_auth_token";

    private static final String PREF_KEY_DELETE_FACE_DATA =
            "security_settings_face_delete_faces_container";
    private static final String PREF_KEY_ENROLL_FACE_UNLOCK =
            "security_settings_face_enroll_faces_container";

    private UserManager mUserManager;
    private FaceManager mFaceManager;
    private int mUserId;
@@ -309,6 +314,15 @@ public class FaceSettings extends DashboardFragment {
                protected boolean isPageSearchEnabled(Context context) {
                    return isAvailable(context);
                }
            };

                @Override
                public List<String> getNonIndexableKeys(Context context) {
                    final List<String> keys = super.getNonIndexableKeys(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);
                    return keys;
                }
            };
}