Added mandatory scrolling for FaceIntroduction

Test: Verified in SUW/Settings user must scroll through contents in
order to go to the next screen.
Bug: 141380294

Change-Id: I483ab6ae6a282c81ba2f2c4d1d9d1f21c6cb9453
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index 965b8ed..e3b5c05 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -33,6 +33,7 @@
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.util.WizardManagerHelper;
 import com.google.android.setupdesign.span.LinkSpan;
+import com.google.android.setupdesign.template.RequireScrollMixin;
 
 public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
 
@@ -67,14 +68,25 @@
             );
         }
 
-        mFooterBarMixin.setPrimaryButton(
-                new FooterButton.Builder(this)
-                        .setText(R.string.security_settings_face_enroll_introduction_agree)
-                        .setListener(this::onNextButtonClick)
-                        .setButtonType(FooterButton.ButtonType.NEXT)
-                        .setTheme(R.style.SudGlifButton_Primary)
-                        .build()
-        );
+        FooterButton.Builder nextButtonBuilder = new FooterButton.Builder(this)
+                .setText(R.string.security_settings_face_enroll_introduction_agree)
+                .setButtonType(FooterButton.ButtonType.NEXT)
+                .setTheme(R.style.SudGlifButton_Primary);
+        if (maxFacesEnrolled()) {
+            nextButtonBuilder.setListener(this::onNextButtonClick);
+            mFooterBarMixin.setPrimaryButton(nextButtonBuilder.build());
+        } else {
+            final FooterButton agreeButton = nextButtonBuilder.build();
+            mFooterBarMixin.setPrimaryButton(agreeButton);
+            final RequireScrollMixin requireScrollMixin = getLayout().getMixin(
+                    RequireScrollMixin.class);
+            requireScrollMixin.requireScrollWithButton(this, agreeButton,
+                    R.string.sud_more_button_label,
+                    button -> {
+                        onNextButtonClick(button);
+                    });
+        }
+
     }
 
     @Override
@@ -134,13 +146,22 @@
         return findViewById(R.id.error_text);
     }
 
-    @Override
-    protected int checkMaxEnrolled() {
+    private boolean maxFacesEnrolled() {
         if (mFaceManager != null) {
             final int max = getResources().getInteger(
                     com.android.internal.R.integer.config_faceMaxTemplatesPerUser);
             final int numEnrolledFaces = mFaceManager.getEnrolledFaces(mUserId).size();
-            if (numEnrolledFaces >= max) {
+            return numEnrolledFaces >= max;
+        } else {
+            return false;
+        }
+    }
+
+    //TODO: Refactor this to something that conveys it is used for getting a string ID.
+    @Override
+    protected int checkMaxEnrolled() {
+        if (mFaceManager != null) {
+            if (maxFacesEnrolled()) {
                 return R.string.face_intro_error_max;
             }
         } else {