Update fingerprint layouts for landscape

- Refine the portrait layout to be reused for landscape
- Add strings for UDFPS enrollment
- Remove the landcaspe layout since it is no longer used.

Fixes: 171294253
Test: visual verified
Change-Id: Ibbfa5515437e2c2a348db9b621b4e60ba922a383
This commit is contained in:
Mill Chen
2021-03-09 05:52:58 +08:00
parent f97df931df
commit 7cd08b6aa2
8 changed files with 40 additions and 300 deletions

View File

@@ -1,135 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/sud_glif_blank_template"
style="?attr/fingerprint_layout_theme">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:clipToPadding="false"
android:clipChildren="false"
android:paddingBottom="0dp">
<!-- Both texts are kept as separate text views so it doesn't jump around in portrait.
See layouts/fingerprint_enroll_enrolling_base.xml. -->
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginBottom="@dimen/sud_content_frame_padding_bottom"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<ImageView
android:id="@+id/sud_layout_icon"
style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:src="@drawable/ic_fingerprint_header" />
<TextView
android:id="@+id/suc_layout_title"
style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/SudDescription.Glif"
android:id="@+id/sud_layout_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_start_message"/>
<TextView
style="@style/SudDescription.Glif"
android:id="@+id/repeat_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_repeat_message"
android:visibility="invisible"/>
</FrameLayout>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<com.google.android.setupdesign.view.FillContentLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginVertical="24dp"
android:layout_weight="1"
android:paddingTop="0dp"
android:paddingBottom="0dp">
<include layout="@layout/fingerprint_enroll_enrolling_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</com.google.android.setupdesign.view.FillContentLayout>
<TextView
style="@style/TextAppearance.ErrorText"
android:id="@+id/error_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_gravity="center_horizontal|bottom"
android:accessibilityLiveRegion="polite"
android:gravity="center_horizontal"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2015 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setup_wizard_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout="@layout/sud_glif_blank_template"
style="?attr/fingerprint_layout_theme">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:clipToPadding="false"
android:clipChildren="false">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<ImageView
android:id="@+id/sud_layout_icon"
style="@style/SudGlifIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="?attr/sudGlifHeaderGravity"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:contentDescription="@null"
android:src="@drawable/ic_fingerprint_header"/>
<TextView
android:id="@+id/suc_layout_title"
style="@style/SudGlifHeaderTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"/>
<TextView
android:id="@+id/sud_layout_description"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
</LinearLayout>
<com.google.android.setupdesign.view.FillContentLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent">
<ImageView
android:id="@+id/fingerprint_in_app_indicator"
style="@style/SudContentIllustration"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@android:string/fingerprint_icon_content_description"
android:src="@drawable/fingerprint_enroll_finish" />
</com.google.android.setupdesign.view.FillContentLayout>
</LinearLayout>
</ScrollView>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -30,31 +30,6 @@
android:clipToPadding="false"
android:clipChildren="false">
<!-- Make both texts included for layout, so the lower part doesn't jump around when we
switch the text -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/SudDescription.Glif"
android:id="@+id/sud_layout_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:text="@string/security_settings_fingerprint_enroll_start_message"/>
<TextView
style="@style/SudDescription.Glif"
android:id="@+id/repeat_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:text="@string/security_settings_fingerprint_enroll_repeat_message"
android:visibility="invisible"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"

View File

@@ -30,15 +30,6 @@
android:clipToPadding="false"
android:clipChildren="false">
<TextView
android:id="@+id/sud_layout_description"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/sud_description_glif_margin_top"
android:minLines="3"
android:text="@string/security_settings_fingerprint_enroll_finish_message"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"

View File

@@ -30,28 +30,6 @@
android:clipChildren="false"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/sud_layout_description"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3"
android:text="@string/security_settings_fingerprint_enroll_start_message" />
<TextView
android:id="@+id/repeat_message"
style="@style/SudDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security_settings_fingerprint_enroll_repeat_message"
android:visibility="invisible" />
</FrameLayout>
<TextView
android:id="@+id/error_text"
style="@style/TextAppearance.ErrorText"

View File

@@ -963,10 +963,18 @@
<string name="security_settings_fingerprint_enroll_start_title">Touch the sensor</string>
<!-- Message shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_start_message">Put your finger on the sensor and lift after you feel a vibration</string>
<!-- Message shown in fingerprint enrollment dialog to begin enrollment [CHAR LIMIT=NONE] -->
<string name="security_settings_udfps_enroll_start_message">Each time you touch, keep your finger on the icon until you feel a vibration</string>
<!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=40] -->
<string name="security_settings_fingerprint_enroll_repeat_title">Lift, then touch again</string>
<!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=40] -->
<string name="security_settings_udfps_enroll_title_one_more_time">One more time</string>
<!-- Title shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=60] -->
<string name="security_settings_udfps_enroll_repeat_title_touch_icon">Touch the fingerprint icon as it moves</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_fingerprint_enroll_repeat_message">Keep lifting your finger to add the different parts of your fingerprint</string>
<!-- Message shown in fingerprint enrollment dialog to repeat touching the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="security_settings_udfps_enroll_repeat_message">This helps capture your full fingerprint</string>
<!-- Title shown in fingerprint enrollment dialog once enrollment is completed [CHAR LIMIT=29] -->
<string name="security_settings_fingerprint_enroll_finish_title">Fingerprint added</string>
<!-- Message shown in fingerprint enrollment dialog once enrollment is completed -->

View File

@@ -52,7 +52,6 @@ import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.util.DescriptionStyler;
import java.util.List;
@@ -66,6 +65,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
private static final int PROGRESS_BAR_MAX = 10000;
private static final int FINISH_DELAY = 250;
/**
* Enroll with two center touches before going to guided enrollment.
*/
private static final int NUM_CENTER_TOUCHES = 2;
/**
* If we don't see progress during this time, we show an error message to remind the users that
@@ -95,8 +98,6 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
private boolean mCanAssumeUdfps;
@Nullable private ProgressBar mProgressBar;
private ObjectAnimator mProgressAnim;
private TextView mStartMessage;
private TextView mRepeatMessage;
private TextView mErrorText;
private Interpolator mFastOutSlowInInterpolator;
private Interpolator mLinearOutSlowInInterpolator;
@@ -145,23 +146,18 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
if (mCanAssumeUdfps) {
setContentView(R.layout.udfps_enroll_enrolling);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
setContentView(R.layout.fingerprint_enroll_enrolling);
setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
}
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
mStartMessage = findViewById(R.id.sud_layout_description);
mRepeatMessage = findViewById(R.id.repeat_message);
mErrorText = findViewById(R.id.error_text);
mProgressBar = findViewById(R.id.fingerprint_progress_bar);
mVibrator = getSystemService(Vibrator.class);
if (getLayout().shouldApplyPartnerHeavyThemeResource()) {
DescriptionStyler.applyPartnerCustomizationHeavyStyle(mRepeatMessage);
} else if (getLayout().shouldApplyPartnerResource()) {
DescriptionStyler.applyPartnerCustomizationLightStyle(mRepeatMessage);
}
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
new FooterButton.Builder(this)
@@ -229,7 +225,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
protected void onStart() {
super.onStart();
updateProgress(false /* animate */);
updateDescription();
updateTitleAndDescription();
if (mRestoring) {
startIconAnimation();
}
@@ -297,14 +293,32 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
return new Intent(this, FingerprintEnrollFinish.class);
}
private void updateDescription() {
private void updateTitleAndDescription() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
mStartMessage.setVisibility(View.VISIBLE);
mRepeatMessage.setVisibility(View.INVISIBLE);
if (mCanAssumeUdfps) {
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
mStartMessage.setVisibility(View.INVISIBLE);
mRepeatMessage.setVisibility(View.VISIBLE);
setDescriptionText(R.string.security_settings_fingerprint_enroll_start_message);
}
} else if (mCanAssumeUdfps && !isCenterEnrollmentComplete()) {
setHeaderText(R.string.security_settings_udfps_enroll_title_one_more_time);
setDescriptionText(R.string.security_settings_udfps_enroll_start_message);
} else {
if (mCanAssumeUdfps) {
setHeaderText(R.string.security_settings_udfps_enroll_repeat_title_touch_icon);
setDescriptionText(R.string.security_settings_udfps_enroll_repeat_message);
} else {
setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_message);
}
}
}
private boolean isCenterEnrollmentComplete() {
if (mSidecar == null || mSidecar.getEnrollmentSteps() == -1) {
return false;
}
final int stepsEnrolled = mSidecar.getEnrollmentSteps() - mSidecar.getEnrollmentRemaining();
return stepsEnrolled >= NUM_CENTER_TOUCHES;
}
@Override
@@ -337,7 +351,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
@Override
public void onEnrollmentProgressChange(int steps, int remaining) {
updateProgress(true /* animate */);
updateDescription();
updateTitleAndDescription();
clearError();
animateFlash();
mErrorText.removeCallbacks(mTouchAgainRunnable);

View File

@@ -55,6 +55,7 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_finish);
setHeaderText(R.string.security_settings_fingerprint_enroll_finish_title);
setDescriptionText(R.string.security_settings_fingerprint_enroll_finish_message);
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(