Merge "Add "eyes open" setting message to face enroll intro" into sc-dev

This commit is contained in:
Curtis Belmonte
2021-07-13 16:36:53 +00:00
committed by Android (Google) Code Review
5 changed files with 55 additions and 1 deletions

View File

@@ -107,6 +107,28 @@
style="@style/BiometricEnrollIntroMessage" />
</LinearLayout>
<LinearLayout
android:id="@+id/info_row_require_eyes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/icon_require_eyes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_settings_24dp"/>
<Space
android:layout_width="16dp"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/info_message_require_eyes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/BiometricEnrollIntroMessage" />
</LinearLayout>
<!-- How it works -->
<TextView
android:layout_width="match_parent"

View File

@@ -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 "require eyes" info section on the face enroll intro screen -->
<bool name="config_face_intro_show_require_eyes">true</bool>
<!-- Whether to use the Lottie animation for the face education enrollment screen -->
<bool name="config_face_education_use_lottie">false</bool>

View File

@@ -796,6 +796,11 @@
<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 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] -->
<string name="security_settings_face_enroll_introduction_info_consent_gaze"></string>
<!-- Title of a section on the face enrollment introduction page that explains how face unlock works. [CHAR LIMIT=40] -->
<string name="security_settings_face_enroll_introduction_how_title"></string>
<!-- Message on the face enrollment introduction page that explains how face unlock works. [CHAR LIMIT=NONE] -->

View File

@@ -24,6 +24,7 @@ import android.hardware.face.FaceSensorPropertiesInternal;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -74,11 +75,13 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Apply extracted theme color to icons.
final ImageView iconGlasses = findViewById(R.id.icon_glasses);
final ImageView iconLooking = findViewById(R.id.icon_looking);
iconGlasses.getBackground().setColorFilter(getIconColorFilter());
iconLooking.getBackground().setColorFilter(getIconColorFilter());
// Set text for views with multiple variations.
final TextView infoMessageGlasses = findViewById(R.id.info_message_glasses);
final TextView infoMessageLooking = findViewById(R.id.info_message_looking);
final TextView howMessage = findViewById(R.id.how_message);
@@ -86,10 +89,20 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
final TextView inControlMessage = findViewById(R.id.message_in_control);
infoMessageGlasses.setText(getInfoMessageGlasses());
infoMessageLooking.setText(getInfoMessageLooking());
howMessage.setText(getHowMessage());
inControlTitle.setText(getInControlTitle());
howMessage.setText(getHowMessage());
inControlMessage.setText(getInControlMessage());
// 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);
final ImageView iconRequireEyes = findViewById(R.id.icon_require_eyes);
final TextView infoMessageRequireEyes = findViewById(R.id.info_message_require_eyes);
infoRowRequireEyes.setVisibility(View.VISIBLE);
iconRequireEyes.getBackground().setColorFilter(getIconColorFilter());
infoMessageRequireEyes.setText(getInfoMessageRequireEyes());
}
mFaceManager = Utils.getFaceManagerOrNull(this);
mFaceFeatureProvider = FeatureFactory.getFactory(getApplicationContext())
.getFaceFeatureProvider();
@@ -126,6 +139,11 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
return R.string.security_settings_face_enroll_introduction_info_looking;
}
@StringRes
protected int getInfoMessageRequireEyes() {
return R.string.security_settings_face_enroll_introduction_info_gaze;
}
@StringRes
protected int getHowMessage() {
return R.string.security_settings_face_enroll_introduction_how_message;

View File

@@ -80,6 +80,12 @@ public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
return R.string.security_settings_face_enroll_introduction_info_consent_looking;
}
@Override
@StringRes
protected int getInfoMessageRequireEyes() {
return R.string.security_settings_face_enroll_introduction_info_consent_gaze;
}
@Override
@StringRes
protected int getHowMessage() {