Update buttons in FP find sensor
Remove the next button (so the user has to touch the sensor to proceed), and add a skip button. Test: cd tests/robotests && mma Bug: 62839648 Change-Id: I555948ac2f3235e08b91f0957aa8e0ce24535c08
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false">
|
android:clipToPadding="false">
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
style="@style/SuwGlifIcon"
|
style="@style/SuwGlifIcon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="?attr/suwGlifHeaderGravity"
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:src="@drawable/ic_fingerprint_header" />
|
android:src="@drawable/ic_fingerprint_header" />
|
||||||
@@ -70,13 +71,18 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
|
android:text="@string/security_settings_fingerprint_enroll_find_sensor_message"/>
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/SetupWizardButton.Positive"
|
style="@style/SetupWizardButton.Negative"
|
||||||
android:id="@+id/next_button"
|
android:id="@+id/skip_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/fingerprint_enroll_button_next" />
|
android:text="@string/skip_label" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@@ -17,10 +17,12 @@
|
|||||||
|
|
||||||
<com.android.setupwizardlib.GlifLayout
|
<com.android.setupwizardlib.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/setup_wizard_layout"
|
android:id="@+id/setup_wizard_layout"
|
||||||
style="?attr/fingerprint_layout_theme"
|
style="?attr/fingerprint_layout_theme"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:suwFooter="@layout/fingerprint_enroll_find_sensor_base_footer">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/SuwGlifButton.Primary"
|
style="@style/SuwGlifButton.Secondary"
|
||||||
android:id="@+id/next_button"
|
android:id="@+id/next_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
31
res/layout/fingerprint_enroll_find_sensor_base_footer.xml
Normal file
31
res/layout/fingerprint_enroll_find_sensor_base_footer.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2017 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- TODO: Use aapt:attr when it is fixed (b/36809755) -->
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="@style/SuwGlifButtonBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/SuwGlifButton.Secondary"
|
||||||
|
android:id="@+id/skip_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/skip_label" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@@ -22,6 +22,7 @@ import android.os.Bundle;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
@@ -48,6 +49,9 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(getContentView());
|
setContentView(getContentView());
|
||||||
|
Button skipButton = findViewById(R.id.skip_button);
|
||||||
|
skipButton.setOnClickListener(this);
|
||||||
|
|
||||||
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mLaunchedConfirmLock = savedInstanceState.getBoolean(EXTRA_KEY_LAUNCHED_CONFIRM);
|
mLaunchedConfirmLock = savedInstanceState.getBoolean(EXTRA_KEY_LAUNCHED_CONFIRM);
|
||||||
@@ -132,9 +136,15 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNextButtonClick() {
|
public void onClick(View v) {
|
||||||
mNextClicked = true;
|
switch (v.getId()) {
|
||||||
proceedToEnrolling(true /* cancelEnrollment */);
|
case R.id.skip_button:
|
||||||
|
setResult(RESULT_SKIP);
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.onClick(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void proceedToEnrolling(boolean cancelEnrollment) {
|
private void proceedToEnrolling(boolean cancelEnrollment) {
|
||||||
|
@@ -17,10 +17,12 @@
|
|||||||
|
|
||||||
<com.android.setupwizardlib.GlifLayout
|
<com.android.setupwizardlib.GlifLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/setup_wizard_layout"
|
android:id="@+id/setup_wizard_layout"
|
||||||
style="?attr/fingerprint_layout_theme"
|
style="?attr/fingerprint_layout_theme"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
app:suwFooter="@layout/fingerprint_enroll_find_sensor_base_footer">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="@style/SuwGlifButton.Primary"
|
style="@style/SuwGlifButton.Secondary"
|
||||||
android:id="@+id/next_button"
|
android:id="@+id/next_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@@ -25,15 +25,16 @@ import static org.robolectric.RuntimeEnvironment.application;
|
|||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
|
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
|
||||||
import com.android.settings.TestConfig;
|
import com.android.settings.TestConfig;
|
||||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||||
import com.android.settings.password.IFingerprintManager;
|
import com.android.settings.password.IFingerprintManager;
|
||||||
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settings.testutils.shadow.ShadowDynamicIndexableContentMonitor;
|
import com.android.settings.testutils.shadow.ShadowDynamicIndexableContentMonitor;
|
||||||
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
|
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
|
||||||
@@ -92,13 +93,26 @@ public class FingerprintEnrollFindSensorTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clickNextAndFingerprint_shouldNotCrash() {
|
public void enrollFingerprint_shouldProceed() {
|
||||||
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||||
|
|
||||||
Button nextButton = mActivity.findViewById(R.id.next_button);
|
|
||||||
nextButton.performClick();
|
|
||||||
enrollmentCallback.onEnrollmentProgress(123);
|
enrollmentCallback.onEnrollmentProgress(123);
|
||||||
nextButton.performClick();
|
enrollmentCallback.onEnrollmentError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, "test");
|
||||||
|
|
||||||
|
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||||
|
IntentForResult startedActivity =
|
||||||
|
shadowActivity.getNextStartedActivityForResult();
|
||||||
|
assertThat(startedActivity).named("Next activity 1").isNotNull();
|
||||||
|
assertThat(startedActivity.intent.getComponent())
|
||||||
|
.isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void enrollFingerprintTwice_shouldStartOneEnrolling() {
|
||||||
|
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||||
|
|
||||||
|
enrollmentCallback.onEnrollmentProgress(123);
|
||||||
|
enrollmentCallback.onEnrollmentProgress(123); // A second enroll should be a no-op
|
||||||
|
|
||||||
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||||
IntentForResult startedActivity =
|
IntentForResult startedActivity =
|
||||||
@@ -120,9 +134,7 @@ public class FingerprintEnrollFindSensorTest {
|
|||||||
public void layoutWithoutAnimation_shouldNotCrash() {
|
public void layoutWithoutAnimation_shouldNotCrash() {
|
||||||
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||||
enrollmentCallback.onEnrollmentProgress(123);
|
enrollmentCallback.onEnrollmentProgress(123);
|
||||||
|
enrollmentCallback.onEnrollmentError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, "test");
|
||||||
Button nextButton = mActivity.findViewById(R.id.next_button);
|
|
||||||
nextButton.performClick();
|
|
||||||
|
|
||||||
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||||
IntentForResult startedActivity =
|
IntentForResult startedActivity =
|
||||||
@@ -132,6 +144,16 @@ public class FingerprintEnrollFindSensorTest {
|
|||||||
.isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
|
.isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void clickSkip_shouldReturnResultSkip() {
|
||||||
|
Button skipButton = mActivity.findViewById(R.id.skip_button);
|
||||||
|
skipButton.performClick();
|
||||||
|
|
||||||
|
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||||
|
assertThat(shadowActivity.getResultCode()).named("result code")
|
||||||
|
.isEqualTo(FingerprintEnrollBase.RESULT_SKIP);
|
||||||
|
}
|
||||||
|
|
||||||
private EnrollmentCallback verifyAndCaptureEnrollmentCallback() {
|
private EnrollmentCallback verifyAndCaptureEnrollmentCallback() {
|
||||||
ArgumentCaptor<EnrollmentCallback> callbackCaptor =
|
ArgumentCaptor<EnrollmentCallback> callbackCaptor =
|
||||||
ArgumentCaptor.forClass(EnrollmentCallback.class);
|
ArgumentCaptor.forClass(EnrollmentCallback.class);
|
||||||
|
Reference in New Issue
Block a user