Merge "[Fingerprint] Add fingerprint enroll in setup wizard" into mnc-dev
This commit is contained in:
@@ -28,11 +28,9 @@ import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
/**
|
||||
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
|
||||
@@ -70,14 +68,6 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
final SetupWizardListLayout layout = (SetupWizardListLayout) inflater.inflate(
|
||||
R.layout.setup_choose_lock_generic, container, false);
|
||||
layout.setHeaderText(getActivity().getTitle());
|
||||
ListView list = layout.getListView();
|
||||
final FingerprintManager fpm = (FingerprintManager)
|
||||
getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
if (fpm != null && fpm.isHardwareDetected()) {
|
||||
final View footer = inflater.inflate(
|
||||
R.layout.setup_screen_lock_fingerprint_details, list, false);
|
||||
list.addFooterView(footer, null, false);
|
||||
}
|
||||
|
||||
final NavigationBar navigationBar = layout.getNavigationBar();
|
||||
navigationBar.getNextButton().setEnabled(false);
|
||||
|
@@ -20,7 +20,6 @@ import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@@ -72,6 +71,10 @@ public class FingerprintEnrollBase extends Activity implements View.OnClickListe
|
||||
@Override
|
||||
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
initViews();
|
||||
}
|
||||
|
||||
protected void initViews() {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
|
||||
|
@@ -213,14 +213,17 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase
|
||||
}
|
||||
|
||||
private void launchFinish(byte[] token) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", FingerprintEnrollFinish.class.getName());
|
||||
Intent intent = getFinishIntent();
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||
startActivity(intent);
|
||||
setResult(RESULT_FINISHED);
|
||||
finish();
|
||||
}
|
||||
|
||||
protected Intent getFinishIntent() {
|
||||
return new Intent(this, FingerprintEnrollFinish.class);
|
||||
}
|
||||
|
||||
private void updateDescription() {
|
||||
if (mSidecar.getEnrollmentSteps() == -1) {
|
||||
setHeaderText(R.string.security_settings_fingerprint_enroll_start_title);
|
||||
|
@@ -61,8 +61,8 @@ public class FingerprintEnrollFinish extends FingerprintEnrollBase {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.add_another_button) {
|
||||
finish();
|
||||
startActivity(getEnrollingIntent());
|
||||
finish();
|
||||
}
|
||||
super.onClick(v);
|
||||
}
|
||||
|
@@ -47,22 +47,29 @@ public class FingerprintEnrollIntroduction extends FingerprintEnrollBase {
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClick() {
|
||||
Intent intent = new Intent();
|
||||
final String clazz;
|
||||
Intent intent;
|
||||
if (!mHasPassword) {
|
||||
// No fingerprints registered, launch into enrollment wizard.
|
||||
clazz = FingerprintEnrollOnboard.class.getName();
|
||||
intent = getOnboardIntent();
|
||||
} else {
|
||||
// Lock thingy is already set up, launch directly into find sensor step from wizard.
|
||||
clazz = FingerprintEnrollFindSensor.class.getName();
|
||||
intent = getFindSensorIntent();
|
||||
}
|
||||
intent.setClassName("com.android.settings", clazz);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
|
||||
protected Intent getOnboardIntent() {
|
||||
return new Intent(this, FingerprintEnrollOnboard.class);
|
||||
}
|
||||
|
||||
protected Intent getFindSensorIntent() {
|
||||
return new Intent(this, FingerprintEnrollFindSensor.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_FINISHED) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@@ -57,9 +57,8 @@ public class FingerprintEnrollOnboard extends FingerprintEnrollBase {
|
||||
}
|
||||
|
||||
private void launchChooseLock() {
|
||||
Intent intent = new Intent();
|
||||
Intent intent = getChooseLockIntent();
|
||||
long challenge = getSystemService(FingerprintManager.class).preEnroll();
|
||||
intent.setClassName("com.android.settings", ChooseLockGeneric.class.getName());
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
|
||||
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
|
||||
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS, true);
|
||||
@@ -68,11 +67,18 @@ public class FingerprintEnrollOnboard extends FingerprintEnrollBase {
|
||||
startActivityForResult(intent, CHOOSE_LOCK_GENERIC_REQUEST);
|
||||
}
|
||||
|
||||
protected Intent getChooseLockIntent() {
|
||||
return new Intent(this, ChooseLockGeneric.class);
|
||||
}
|
||||
|
||||
private void launchFindSensor(byte[] token) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("com.android.settings", FingerprintEnrollFindSensor.class.getName());
|
||||
Intent intent = getFindSensorIntent();
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
protected Intent getFindSensorIntent() {
|
||||
return new Intent(this, FingerprintEnrollFindSensor.class);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
|
||||
public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
|
||||
implements NavigationBar.NavigationBarListener {
|
||||
|
||||
@Override
|
||||
protected Intent getFinishIntent() {
|
||||
final Intent intent = new Intent(this, SetupFingerprintEnrollFinish.class);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SetupWizardUtils.setImmersiveMode(this);
|
||||
|
||||
final View buttonBar = findViewById(R.id.button_bar);
|
||||
if (buttonBar != null) {
|
||||
buttonBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final NavigationBar navigationBar = getNavigationBar();
|
||||
navigationBar.setNavigationBarListener(this);
|
||||
// Enrolling screen auto-advances once the fingerprint is added
|
||||
navigationBar.getNextButton().setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
onNextButtonClick();
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.ChooseLockSettingsHelper;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
|
||||
public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSensor
|
||||
implements NavigationBar.NavigationBarListener {
|
||||
|
||||
@Override
|
||||
protected Intent getEnrollingIntent() {
|
||||
Intent intent = new Intent(this, SetupFingerprintEnrollEnrolling.class);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SetupWizardUtils.setImmersiveMode(this);
|
||||
|
||||
final View nextButton = findViewById(R.id.next_button);
|
||||
if (nextButton != null) {
|
||||
nextButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
getNavigationBar().setNavigationBarListener(this);
|
||||
getNavigationBar().getBackButton().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
onNextButtonClick();
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.ChooseLockSettingsHelper;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
|
||||
public class SetupFingerprintEnrollFinish extends FingerprintEnrollFinish
|
||||
implements NavigationBar.NavigationBarListener {
|
||||
|
||||
@Override
|
||||
protected Intent getEnrollingIntent() {
|
||||
Intent intent = new Intent(this, SetupFingerprintEnrollEnrolling.class);
|
||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SetupWizardUtils.setImmersiveMode(this);
|
||||
|
||||
final View nextButton = findViewById(R.id.next_button);
|
||||
if (nextButton != null) {
|
||||
nextButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final NavigationBar navigationBar = getNavigationBar();
|
||||
navigationBar.setNavigationBarListener(this);
|
||||
navigationBar.getBackButton().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
onNextButtonClick();
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
|
||||
public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction
|
||||
implements NavigationBar.NavigationBarListener {
|
||||
|
||||
@Override
|
||||
protected Intent getOnboardIntent() {
|
||||
final Intent intent = new Intent(this, SetupFingerprintEnrollOnboard.class);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getFindSensorIntent() {
|
||||
final Intent intent = new Intent(this, SetupFingerprintEnrollFindSensor.class);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SetupWizardUtils.setImmersiveMode(this);
|
||||
|
||||
final View buttonBar = findViewById(R.id.button_bar);
|
||||
if (buttonBar != null) {
|
||||
buttonBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
getNavigationBar().setNavigationBarListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
onNextButtonClick();
|
||||
}
|
||||
}
|
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SetupChooseLockGeneric;
|
||||
import com.android.settings.SetupWizardUtils;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
|
||||
public class SetupFingerprintEnrollOnboard extends FingerprintEnrollOnboard
|
||||
implements NavigationBar.NavigationBarListener {
|
||||
|
||||
@Override
|
||||
protected Intent getChooseLockIntent() {
|
||||
Intent intent = new Intent(this, SetupChooseLockGeneric.class);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getFindSensorIntent() {
|
||||
final Intent intent = new Intent(this, SetupFingerprintEnrollFindSensor.class);
|
||||
SetupWizardUtils.copySetupExtras(getIntent(), intent);
|
||||
return intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
|
||||
resid = SetupWizardUtils.getTheme(getIntent());
|
||||
super.onApplyThemeResource(theme, resid, first);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SetupWizardUtils.setImmersiveMode(this);
|
||||
|
||||
final View nextButton = findViewById(R.id.next_button);
|
||||
if (nextButton != null) {
|
||||
nextButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
getNavigationBar().setNavigationBarListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
onNextButtonClick();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user