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

Commit e05697fc authored by lbill's avatar lbill
Browse files

2-1/ Add config_suw_support_face_enroll to customize SUW face enroll flow

1. Add config_suw_support_face_enroll default is TRUE
2. Impl FaceFeatureProvider to obtain the config
3. Overlay config_suw_support_face_enroll by requirements

Test: Flash build and manual check if device go through face enroll in SUW
Bug: 262469686
Change-Id: I61aa5c818bedfb490f2172a7481f59fda7295c1a
Merged-In: I61aa5c818bedfb490f2172a7481f59fda7295c1a
parent 8e578082
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -292,6 +292,9 @@
    <!-- Whether to use the Lottie animation for the face education enrollment screen -->
    <bool name="config_face_education_use_lottie">false</bool>

    <!-- Whether to support enrollment during setup wizard flow -->
    <bool name="config_suw_support_face_enroll">true</bool>

    <!-- App intent -->
    <string name="config_account_intent_uri" translatable="false"></string>

+10 −4
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.core.InstrumentedActivity;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.password.ChooseLockGeneric;
import com.android.settings.password.ChooseLockPattern;
import com.android.settings.password.ChooseLockSettingsHelper;
@@ -215,11 +216,16 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
                mIsFaceEnrollable =
                        faceManager.getEnrolledFaces(mUserId).size() < maxEnrolls;

                // exclude face enrollment from setup wizard if configured as a convenience
                // isSetupWizard is always false for unicorn enrollment, so if consent is
                // required check if setup has completed instead.
                final boolean isSettingUp = isSetupWizard || (mParentalOptionsRequired
                final boolean parentalConsent = isSetupWizard || (mParentalOptionsRequired
                        && !WizardManagerHelper.isUserSetupComplete(this));
                if (parentalConsent && isMultiSensor && mIsFaceEnrollable) {
                    // Exclude face enrollment from setup wizard if feature config not supported
                    // in setup wizard flow, we still allow user enroll faces through settings.
                    mIsFaceEnrollable = FeatureFactory.getFactory(getApplicationContext())
                            .getFaceFeatureProvider()
                            .isSetupWizardSupported(getApplicationContext());
                    Log.d(TAG, "config_suw_support_face_enroll: " + mIsFaceEnrollable);
                }
            }
        }
        if (mHasFeatureFingerprint) {
+3 −0
Original line number Diff line number Diff line
@@ -22,4 +22,7 @@ import android.content.Context;
public interface FaceFeatureProvider {
    /** Returns true if attention checking is supported. */
    boolean isAttentionSupported(Context context);

    /** Returns true if setup wizard supported face enrollment. */
    boolean isSetupWizardSupported(Context context);
}
+7 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
package com.android.settings.biometrics.face;

import android.content.Context;
import android.provider.Settings;

import androidx.annotation.NonNull;

public class FaceFeatureProviderImpl implements FaceFeatureProvider {

@@ -25,4 +26,9 @@ public class FaceFeatureProviderImpl implements FaceFeatureProvider {
    public boolean isAttentionSupported(Context context) {
        return true;
    }

    @Override
    public boolean isSetupWizardSupported(@NonNull Context context) {
        return true;
    }
}