Revert "Fingerprint: Use AOSP fingerprint setup"

This reverts commit 070fbeaf5d.

We still need to show the fingerprint setup screen which allows
the user to skip setting up a fingerprint if they choose to do so.

Change-Id: Ifa49ad1ac0e5cf113290b973ac5e9cd8abdbed9a
This commit is contained in:
d34d 2015-12-03 16:48:54 -08:00
parent 070fbeaf5d
commit a2f4c5812e
4 changed files with 155 additions and 44 deletions

View File

@ -0,0 +1,90 @@
<?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,4 +84,13 @@
<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_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_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> <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> </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_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_VIEW_LEGAL = "cyanogenmod.intent.action.LEGALESE";
public static final String ACTION_SETUP_FINGERPRINT = "android.settings.FINGERPRINT_SETUP"; public static final String ACTION_SETUP_FINGERPRINT = "com.android.settings.SETUP_FINGERPRINT";
public static final String EXTRA_FIRST_RUN = "firstRun"; public static final String EXTRA_FIRST_RUN = "firstRun";
public static final String EXTRA_ALLOW_SKIP = "allowSkip"; public static final String EXTRA_ALLOW_SKIP = "allowSkip";

View File

@ -23,32 +23,33 @@ import android.app.FragmentManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; 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.R;
import com.cyanogenmod.setupwizard.SetupWizardApp; import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.cmstats.SetupStats; import com.cyanogenmod.setupwizard.cmstats.SetupStats;
import com.cyanogenmod.setupwizard.ui.LoadingFragment; import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
public class FingerprintSetupPage extends SetupPage { public class FingerprintSetupPage extends SetupPage {
private static final String TAG = "FingerprintSetupPage"; private static final String TAG = "FingerprintSetupPage";
private LoadingFragment mLoadingFragment;
public FingerprintSetupPage(Context context, SetupDataCallbacks callbacks) { public FingerprintSetupPage(Context context, SetupDataCallbacks callbacks) {
super(context, callbacks); super(context, callbacks);
} }
@Override @Override
public Fragment getFragment(FragmentManager fragmentManager, int action) { public Fragment getFragment(FragmentManager fragmentManager, int action) {
mLoadingFragment = (LoadingFragment)fragmentManager.findFragmentByTag(getKey()); Fragment fragment = fragmentManager.findFragmentByTag(getKey());
if (mLoadingFragment == null) { if (fragment == null) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(Page.KEY_PAGE_ARGUMENT, getKey()); args.putString(Page.KEY_PAGE_ARGUMENT, getKey());
args.putInt(Page.KEY_PAGE_ACTION, action); args.putInt(Page.KEY_PAGE_ACTION, action);
mLoadingFragment = new LoadingFragment(); fragment = new FingerprintSetupFragment();
mLoadingFragment.setArguments(args); fragment.setArguments(args);
} }
return mLoadingFragment; return fragment;
} }
@Override @Override
@ -63,49 +64,60 @@ public class FingerprintSetupPage extends SetupPage {
@Override @Override
public int getTitleResId() { public int getTitleResId() {
return R.string.loading; return R.string.fingerprint_setup_title;
} }
@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 @Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT == requestCode) { if (SetupWizardApp.REQUEST_CODE_SETUP_FINGERPRINT == requestCode) {
if (resultCode == Activity.RESULT_CANCELED) { if (resultCode == Activity.RESULT_OK) {
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(); getCallbacks().onNextPage();
} }
} }
return true; 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());
}
}
} }