Support "less secure" info row on face enroll intro

Adds an info row that can be configured to show on the face enroll
introduction screen, indicating the relative security of face compared
to other authentication methods (e.g. pattern or PIN).

Test: Manual

Bug: 196254139
Change-Id: I956083887945ac97d15722b23a14ac458568dd9e
diff --git a/res/layout/face_enroll_introduction.xml b/res/layout/face_enroll_introduction.xml
index c1c9ac6..5e7a6a1 100644
--- a/res/layout/face_enroll_introduction.xml
+++ b/res/layout/face_enroll_introduction.xml
@@ -108,6 +108,29 @@
             </LinearLayout>
 
             <LinearLayout
+                android:id="@+id/info_row_less_secure"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                android:visibility="gone">
+
+                <ImageView
+                    android:id="@+id/icon_less_secure"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:background="@drawable/ic_info_outline_24dp"/>
+                <Space
+                    android:layout_width="16dp"
+                    android:layout_height="wrap_content"/>
+                <TextView
+                    android:id="@+id/info_message_less_secure"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    style="@style/BiometricEnrollIntroMessage"
+                    android:text="@string/security_settings_face_enroll_introduction_info_less_secure" />
+            </LinearLayout>
+
+            <LinearLayout
                 android:id="@+id/info_row_require_eyes"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
diff --git a/res/values/config.xml b/res/values/config.xml
index 9ed7536..5411264 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -269,6 +269,9 @@
     <!-- ComponentName to launch a vendor-specific enrollment activity if available -->
     <string name="config_face_enroll" translatable="false"></string>
 
+    <!-- Whether to show the "less secure" info section on the face enroll intro screen -->
+    <bool name="config_face_intro_show_less_secure">false</bool>
+
     <!-- Whether to show the "require eyes" info section on the face enroll intro screen -->
     <bool name="config_face_intro_show_require_eyes">true</bool>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 11625f6..41de553 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -793,6 +793,8 @@
     <string name="security_settings_face_enroll_introduction_info_looking"></string>
     <!-- Message on the face enrollment introduction page that provides information about what could cause the phone to unlock when asking for parental consent. [CHAR LIMIT=NONE] -->
     <string name="security_settings_face_enroll_introduction_info_consent_looking"></string>
+    <!-- Message on the face enrollment introduction page that provides information about the relative security of face for unlocking the phone. [CHAR LIMIT=NONE] -->
+    <string name="security_settings_face_enroll_introduction_info_less_secure"></string>
     <!-- Message on the face enrollment introduction page that provides information about how to require eyes to be open for Face Unlock. [CHAR LIMIT=NONE] -->
     <string name="security_settings_face_enroll_introduction_info_gaze"></string>
     <!-- Message on the face enrollment introduction page that provides information about how to require eyes to be open for Face Unlock when asking for parental consent. [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
index ae21177..707dea9 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroduction.java
@@ -112,6 +112,14 @@
         howMessage.setText(getHowMessage());
         inControlMessage.setText(getInControlMessage());
 
+        // Set up and show the "less secure" info section if necessary.
+        if (getResources().getBoolean(R.bool.config_face_intro_show_less_secure)) {
+            final LinearLayout infoRowLessSecure = findViewById(R.id.info_row_less_secure);
+            final ImageView iconLessSecure = findViewById(R.id.icon_less_secure);
+            infoRowLessSecure.setVisibility(View.VISIBLE);
+            iconLessSecure.getBackground().setColorFilter(getIconColorFilter());
+        }
+
         // Set up and show the "require eyes" info section if necessary.
         if (getResources().getBoolean(R.bool.config_face_intro_show_require_eyes)) {
             final LinearLayout infoRowRequireEyes = findViewById(R.id.info_row_require_eyes);