Added an introduction to the fingerprint enrollment

Bug: 21468315
Change-Id: Ieb691b0e321f44b9bae2f4f8dfd458c24b98a8d9
This commit is contained in:
Selim Cinek
2015-06-11 18:59:54 -07:00
parent 7e38eea817
commit ec8500438c
7 changed files with 185 additions and 9 deletions

View File

@@ -1415,6 +1415,7 @@
<activity android:name=".fingerprint.FingerprintEnrollFindSensor" android:exported="false"/>
<activity android:name=".fingerprint.FingerprintEnrollEnrolling" android:exported="false"/>
<activity android:name=".fingerprint.FingerprintEnrollFinish" android:exported="false"/>
<activity android:name=".fingerprint.FingerprintEnrollIntroduction" android:exported="false"/>
<!-- Note this must not be exported since it returns the password in the intent -->
<activity android:name="ConfirmLockPattern$InternalActivity"

View File

@@ -0,0 +1,88 @@
<?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.android.setupwizardlib.SetupWizardLayout
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"
style="@style/SetupWizardFingerprintStyle">
<LinearLayout
style="@style/SuwContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:clipToPadding="false"
android:clipChildren="false">
<TextView
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/suw_description_margin_top"
android:text="@string/security_settings_fingerprint_enroll_introduction_message"/>
<TextView
style="@style/TextAppearance.FingerprintMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/security_settings_fingerprint_enroll_introduction_message_warning"/>
<TextView
style="@style/TextAppearance.FingerprintLink"
android:id="@+id/learn_more_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/security_settings_fingerprint_enroll_introduction_risk_link_text"/>
<View
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="-12dp"
android:layout_marginBottom="4dp"
android:layout_gravity="end"
android:orientation="horizontal">
<Button
style="@style/Button.FingerprintButton"
android:id="@+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/security_settings_fingerprint_enroll_introduction_cancel" />
<Button
style="@style/Button.FingerprintButton"
android:id="@+id/next_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end|center_vertical"
android:text="@string/security_settings_fingerprint_enroll_introduction_continue" />
</LinearLayout>
</LinearLayout>
</com.android.setupwizardlib.SetupWizardLayout>

View File

@@ -304,6 +304,11 @@
<item name="android:textColor">?android:attr/colorAccent</item>
</style>
<style name="TextAppearance.FingerprintLink"
parent="TextAppearance.FingerprintMessage">
<item name="android:textColor">?android:attr/colorAccent</item>
</style>
<style name="TextAppearance.FingerprintErrorText"
parent="android:TextAppearance.Material.Caption">
<item name="android:textColor">@color/warning</item>

View File

@@ -17,8 +17,6 @@
package com.android.settings;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
@@ -54,8 +52,7 @@ import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.TrustAgentUtils.TrustAgentComponentInfo;
import com.android.settings.fingerprint.FingerprintEnrollFindSensor;
import com.android.settings.fingerprint.FingerprintEnrollOnboard;
import com.android.settings.fingerprint.FingerprintEnrollIntroduction;
import com.android.settings.fingerprint.FingerprintSettings;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Index;
@@ -65,6 +62,8 @@ import com.android.settings.search.SearchIndexableRaw;
import java.util.ArrayList;
import java.util.List;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
/**
* Gesture lock pattern settings.
*/
@@ -358,12 +357,9 @@ public class SecuritySettings extends SettingsPreferenceFragment
R.plurals.security_settings_fingerprint_preference_summary,
fingerprintCount, fingerprintCount));
clazz = FingerprintSettings.class.getName();
} else if (!hasPassword) {
// No fingerprints registered, launch into enrollment wizard.
clazz = FingerprintEnrollOnboard.class.getName();
} else {
// Lock thingy is already set up, launch directly into find sensor step from wizard.
clazz = FingerprintEnrollFindSensor.class.getName();
clazz = FingerprintEnrollIntroduction.class.getName();
intent.putExtra(FingerprintEnrollIntroduction.EXTRA_HAS_PASSWORD, hasPassword);
}
intent.setClassName("com.android.settings", clazz);
fingerprintPreference.setIntent(intent);

View File

@@ -73,6 +73,7 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
}
} else if (requestCode == ENROLLING) {
if (resultCode == RESULT_FINISHED) {
setResult(RESULT_FINISHED);
finish();
}
} else {

View File

@@ -0,0 +1,84 @@
/*
* 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
*/
package com.android.settings.fingerprint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.android.settings.HelpUtils;
import com.android.settings.R;
/**
* Onboarding activity for fingerprint enrollment.
*/
public class FingerprintEnrollIntroduction extends FingerprintEnrollBase {
public static final String EXTRA_HAS_PASSWORD = "fp_existing_password";
private boolean mHasPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_enroll_introduction);
setHeaderText(R.string.security_settings_fingerprint_enroll_introduction_title);
findViewById(R.id.cancel_button).setOnClickListener(this);
findViewById(R.id.learn_more_button).setOnClickListener(this);
mHasPassword = getIntent().getBooleanExtra(EXTRA_HAS_PASSWORD, false);
}
@Override
protected void onNextButtonClick() {
Intent intent = new Intent();
final String clazz;
if (!mHasPassword) {
// No fingerprints registered, launch into enrollment wizard.
clazz = FingerprintEnrollOnboard.class.getName();
} else {
// Lock thingy is already set up, launch directly into find sensor step from wizard.
clazz = FingerprintEnrollFindSensor.class.getName();
}
intent.setClassName("com.android.settings", clazz);
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_FINISHED) {
finish();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.cancel_button) {
finish();
}
if (v.getId() == R.id.learn_more_button) {
launchFingerprintHelp();
}
super.onClick(v);
}
private void launchFingerprintHelp() {
Intent helpIntent = HelpUtils.getHelpIntent(this,
getString(R.string.help_url_fingerprint), getClass().getName());
startActivity(helpIntent);
}
}

View File

@@ -49,6 +49,7 @@ public class FingerprintEnrollOnboard extends FingerprintEnrollBase {
if (requestCode == CHOOSE_LOCK_GENERIC_REQUEST && resultCode == RESULT_FINISHED) {
byte[] token = data.getByteArrayExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
setResult(RESULT_FINISHED);
launchFindSensor(token);
} else {
super.onActivityResult(requestCode, resultCode, data);