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

Commit c3fae471 authored by Jason Chang's avatar Jason Chang
Browse files

(2/2) Fix No clear steps for "re-enroll face unlock

When the user has face id registered but failed enrolling in
device lock state, lead users directly to the confirm deletion
dialog in Face Unlock settings.
- When receiving a face id re-enroll extra intent data, lead users
directly to the confirm deletion dialog in Face Unlock settings.

Bug: 233069240

Test: manually force enrolling face id fail, then doing test steps:
1. Receive notification that face unlock needs to be re-enrolled
2. Tap it then entering device
3. Check if showing the confirm deletion dialog in Face Unlock
settings.

Change-Id: I4eb09cf4a7d92a1dd9866c5c8b938aeb8c7eddf5
parent 6113725b
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.util.Log;
import android.util.Log;
import android.widget.Button;


import androidx.preference.Preference;
import androidx.preference.Preference;


@@ -47,6 +48,7 @@ import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.LayoutPreference;


import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;
@@ -60,6 +62,7 @@ public class FaceSettings extends DashboardFragment {


    private static final String TAG = "FaceSettings";
    private static final String TAG = "FaceSettings";
    private static final String KEY_TOKEN = "hw_auth_token";
    private static final String KEY_TOKEN = "hw_auth_token";
    private static final String KEY_RE_ENROLL_FACE = "re_enroll_face_unlock";


    private static final String PREF_KEY_DELETE_FACE_DATA =
    private static final String PREF_KEY_DELETE_FACE_DATA =
            "security_settings_face_delete_faces_container";
            "security_settings_face_delete_faces_container";
@@ -211,6 +214,20 @@ public class FaceSettings extends DashboardFragment {
        final boolean hasEnrolled = mFaceManager.hasEnrolledTemplates(mUserId);
        final boolean hasEnrolled = mFaceManager.hasEnrolledTemplates(mUserId);
        mEnrollButton.setVisible(!hasEnrolled);
        mEnrollButton.setVisible(!hasEnrolled);
        mRemoveButton.setVisible(hasEnrolled);
        mRemoveButton.setVisible(hasEnrolled);

        // When the user has face id registered but failed enrolling in device lock state,
        // lead users directly to the confirm deletion dialog in Face Unlock settings.
        if (hasEnrolled) {
            final boolean isReEnrollFaceUnlock = getIntent().getBooleanExtra(
                    FaceSettings.KEY_RE_ENROLL_FACE, false);
            if (isReEnrollFaceUnlock) {
                final Button removeBtn = ((LayoutPreference) mRemoveButton).findViewById(
                        R.id.security_settings_face_settings_remove_button);
                if (removeBtn != null && removeBtn.isEnabled()) {
                    mRemoveController.onClick(removeBtn);
                }
            }
        }
    }
    }


    @Override
    @Override