Fingerprint: Use AOSP fingerprint setup

Switch to AOSP fingerprint setup now that Marshmallow supports it.

Change-Id: I55ef80671c758034be324027f168af03dda66aef
This commit is contained in:
d34d 2015-11-29 17:12:37 -08:00 committed by Clark Scheff
parent ea2d42d654
commit 070fbeaf5d
4 changed files with 44 additions and 155 deletions

View File

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The CyanogenMod 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/header" />
<FrameLayout android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/PageContent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/PageSummaryText"
android:textSize="16sp"
android:paddingLeft="@dimen/content_margin_left"
android:layout_marginBottom="@dimen/summary_margin_bottom"
android:paddingRight="@dimen/location_text_margin_right"
android:text="@string/fingerprint_setup_summary" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/location_text_margin_right"
android:drawableStart="@drawable/ic_check_mark"
android:drawablePadding="24dp"
android:gravity="center_vertical"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/fingerprint_setup_backup_lock_method"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/location_text_margin_right"
android:drawableStart="@drawable/ic_check_mark"
android:drawablePadding="24dp"
android:gravity="center_vertical"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/fingerprint_setup_add_fingerprint"/>
<TextView
android:id="@+id/setup_fingerprint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/content_margin_left"
android:paddingRight="@dimen/location_text_margin_right"
android:gravity="center_vertical"
android:textSize="16sp"
android:textAllCaps="true"
android:textColor="@color/fingerprint_setup_text_color"
android:text="@string/fingerprint_setup_screen_lock_setup"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>

View File

@ -84,13 +84,4 @@
<string name="setup_require_cyanogen_label"><b>Require your Cyanogen OS account password</b> in order to use your device even after a factory reset.</string>
<string name="setup_device_locked_instructions"><i>To turn this feature off/on, please go to Settings > Security</i></string>
<string name="setup_warning_skip_anyway">Without a Cyanogen OS Account, you won\'t be able to:\n\nCustomize your phone with new icons, wallpapers and more in the Themes app\n\nLocate or remotely erase your phone if it\'s lost</string>
<!-- Fingerprint setup -->
<string name="settings_fingerprint_setup_title">Select backup screen lock type</string>
<string name="settings_fingerprint_setup_details">How would you like to lock your screen?</string>
<string name="fingerprint_setup_title">Fingerprint setup</string>
<string name="fingerprint_setup_summary">To use your fingerprint sensor to unlock your screen, you\'ll need to:</string>
<string name="fingerprint_setup_backup_lock_method">Setup a secondary unlock method</string>
<string name="fingerprint_setup_add_fingerprint">Add your fingerprint</string>
<string name="fingerprint_setup_screen_lock_setup">Setup screen lock</string>
</resources>

View File

@ -40,7 +40,7 @@ public class SetupWizardApp extends Application {
public static final String ACTION_SETUP_WIFI = "com.android.net.wifi.SETUP_WIFI_NETWORK";
public static final String ACTION_VIEW_LEGAL = "cyanogenmod.intent.action.LEGALESE";
public static final String ACTION_SETUP_FINGERPRINT = "com.android.settings.SETUP_FINGERPRINT";
public static final String ACTION_SETUP_FINGERPRINT = "android.settings.FINGERPRINT_SETUP";
public static final String EXTRA_FIRST_RUN = "firstRun";
public static final String EXTRA_ALLOW_SKIP = "allowSkip";

View File

@ -23,33 +23,32 @@ import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.android.internal.widget.LockPatternUtils;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.cmstats.SetupStats;
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
import com.cyanogenmod.setupwizard.ui.LoadingFragment;
public class FingerprintSetupPage extends SetupPage {
private static final String TAG = "FingerprintSetupPage";
private LoadingFragment mLoadingFragment;
public FingerprintSetupPage(Context context, SetupDataCallbacks callbacks) {
super(context, callbacks);
}
@Override
public Fragment getFragment(FragmentManager fragmentManager, int action) {
Fragment fragment = fragmentManager.findFragmentByTag(getKey());
if (fragment == null) {
mLoadingFragment = (LoadingFragment)fragmentManager.findFragmentByTag(getKey());
if (mLoadingFragment == null) {
Bundle args = new Bundle();
args.putString(Page.KEY_PAGE_ARGUMENT, getKey());
args.putInt(Page.KEY_PAGE_ACTION, action);
fragment = new FingerprintSetupFragment();
fragment.setArguments(args);
mLoadingFragment = new LoadingFragment();
mLoadingFragment.setArguments(args);
}
return fragment;
return mLoadingFragment;
}
@Override
@ -64,60 +63,49 @@ public class FingerprintSetupPage extends SetupPage {
@Override
public int getTitleResId() {
return R.string.fingerprint_setup_title;
return R.string.loading;
}
@Override
public void doLoadAction(FragmentManager fragmentManager, int action) {
super.doLoadAction(fragmentManager, action);
launchFingerprintSetup();
}
private void launchFingerprintSetup() {
Intent intent = new Intent(SetupWizardApp.ACTION_SETUP_FINGERPRINT);
intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
ActivityOptions options =
ActivityOptions.makeCustomAnimation(mContext,
android.R.anim.fade_in,
android.R.anim.fade_out);
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
SetupStats.Label.PAGE, SetupStats.Label.FINGERPRINT_SETUP);
mLoadingFragment.startActivityForResult(intent,
SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT, options.toBundle());
}
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT == requestCode) {
if (resultCode == Activity.RESULT_OK) {
if (resultCode == Activity.RESULT_CANCELED) {
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
SetupStats.Action.EXTERNAL_PAGE_RESULT,
SetupStats.Label.FINGERPRINT_SETUP, "canceled");
getCallbacks().onPreviousPage();
} else if (resultCode == Activity.RESULT_OK) {
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
SetupStats.Action.EXTERNAL_PAGE_RESULT,
SetupStats.Label.FINGERPRINT_SETUP, "success");
getCallbacks().onNextPage();
} else {
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
SetupStats.Action.EXTERNAL_PAGE_RESULT,
SetupStats.Label.FINGERPRINT_SETUP, "skipped");
getCallbacks().onNextPage();
}
}
return true;
}
public static class FingerprintSetupFragment extends SetupPageFragment {
private TextView mSetupFingerprint;
@Override
protected void initializePage() {
mSetupFingerprint = (TextView) mRootView.findViewById(R.id.setup_fingerprint);
mSetupFingerprint.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
launchFingerprintSetup();
}
});
}
@Override
protected int getLayoutResource() {
return R.layout.setup_fingerprint;
}
private void launchFingerprintSetup() {
Intent intent = new Intent(SetupWizardApp.ACTION_SETUP_FINGERPRINT);
intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true);
intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true);
intent.putExtra(SetupWizardApp.EXTRA_USE_IMMERSIVE, true);
intent.putExtra(SetupWizardApp.EXTRA_THEME, SetupWizardApp.EXTRA_MATERIAL_LIGHT);
intent.putExtra(SetupWizardApp.EXTRA_AUTO_FINISH, false);
/*intent.putExtra(LockPatternUtils.LOCKSCREEN_FINGERPRINT_FALLBACK, true);*/
intent.putExtra(SetupWizardApp.EXTRA_TITLE,
getString(R.string.settings_fingerprint_setup_title));
intent.putExtra(SetupWizardApp.EXTRA_DETAILS,
getString(R.string.settings_fingerprint_setup_details));
ActivityOptions options =
ActivityOptions.makeCustomAnimation(getActivity(),
android.R.anim.fade_in,
android.R.anim.fade_out);
SetupStats.addEvent(SetupStats.Categories.EXTERNAL_PAGE_LOAD,
SetupStats.Action.EXTERNAL_PAGE_LAUNCH,
SetupStats.Label.PAGE, SetupStats.Label.FINGERPRINT_SETUP);
startActivityForResult(intent, SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT,
options.toBundle());
}
}
}