Adding an improve face matching settings option for Face Unlock
Adding an option which will launch a version of setup where faces can be added to the current gallery. It requires the user to first confirm their password before launching addToSetup. Patch 3 - Updated for renaming of FackLockTutorial to SetupIntro. Now it is called every time regardless of it it's showing the tutorial and a flag is passed in to determine whether or not SetupIntro shows the tutorial. Patch 4 - Removed 'Setup Complete' toast at the end of screen lock setups since it was primarily for Face Unlock and the congratulations screen removes the need for it. Change-Id: Idc5f960809d992ec7bbce59ef1e13b95ef7cce45
This commit is contained in:
@@ -637,6 +637,9 @@
|
|||||||
|
|
||||||
<!-- Security Settings --><skip />
|
<!-- Security Settings --><skip />
|
||||||
|
|
||||||
|
<!-- Security settings screen when using face unlock, setting option name to start an activity that allows the user to improve accuracy by adding additional enrollment faces -->
|
||||||
|
<string name="biometric_weak_improve_matching_title">Improve face matching</string>
|
||||||
|
|
||||||
<!-- Security settings screen, setting option name to change screen timeout -->
|
<!-- Security settings screen, setting option name to change screen timeout -->
|
||||||
<string name="lock_after_timeout">Automatically lock</string>
|
<string name="lock_after_timeout">Automatically lock</string>
|
||||||
<!-- Security settings screen, setting option summary to change screen timeout -->
|
<!-- Security settings screen, setting option summary to change screen timeout -->
|
||||||
|
@@ -26,6 +26,10 @@
|
|||||||
android:summary="@string/unlock_set_unlock_mode_biometric_weak"
|
android:summary="@string/unlock_set_unlock_mode_biometric_weak"
|
||||||
android:persistent="false"/>
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="biometric_weak_improve_matching"
|
||||||
|
android:title="@string/biometric_weak_improve_matching_title"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="visiblepattern"
|
android:key="visiblepattern"
|
||||||
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
|
android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
|
||||||
|
@@ -276,7 +276,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
KEY_UNLOCK_SET_PATTERN.equals(key) || KEY_UNLOCK_SET_PIN.equals(key);
|
KEY_UNLOCK_SET_PATTERN.equals(key) || KEY_UNLOCK_SET_PIN.equals(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent getBiometricSensorIntent(int quality) {
|
private Intent getBiometricSensorIntent() {
|
||||||
Intent fallBackIntent = new Intent().setClass(getActivity(), ChooseLockGeneric.class);
|
Intent fallBackIntent = new Intent().setClass(getActivity(), ChooseLockGeneric.class);
|
||||||
fallBackIntent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, true);
|
fallBackIntent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, true);
|
||||||
fallBackIntent.putExtra(CONFIRM_CREDENTIALS, false);
|
fallBackIntent.putExtra(CONFIRM_CREDENTIALS, false);
|
||||||
@@ -286,9 +286,8 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
boolean showTutorial = ALWAY_SHOW_TUTORIAL ||
|
boolean showTutorial = ALWAY_SHOW_TUTORIAL ||
|
||||||
!mChooseLockSettingsHelper.utils().isBiometricWeakEverChosen();
|
!mChooseLockSettingsHelper.utils().isBiometricWeakEverChosen();
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setClassName("com.android.facelock", showTutorial
|
intent.setClassName("com.android.facelock", "com.android.facelock.SetupIntro");
|
||||||
? "com.android.facelock.FaceLockTutorial"
|
intent.putExtra("showTutorial", showTutorial);
|
||||||
: "com.android.facelock.SetupFaceLock");
|
|
||||||
PendingIntent pending = PendingIntent.getActivity(getActivity(), 0, fallBackIntent, 0);
|
PendingIntent pending = PendingIntent.getActivity(getActivity(), 0, fallBackIntent, 0);
|
||||||
intent.putExtra("PendingIntent", pending);
|
intent.putExtra("PendingIntent", pending);
|
||||||
return intent;
|
return intent;
|
||||||
@@ -352,7 +351,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
|
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
|
||||||
Intent intent = getBiometricSensorIntent(quality);
|
Intent intent = getBiometricSensorIntent();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
mChooseLockSettingsHelper.utils().clearLock(false);
|
mChooseLockSettingsHelper.utils().clearLock(false);
|
||||||
|
@@ -44,7 +44,6 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public class ChooseLockPassword extends PreferenceActivity {
|
public class ChooseLockPassword extends PreferenceActivity {
|
||||||
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
||||||
@@ -388,7 +387,6 @@ public class ChooseLockPassword extends PreferenceActivity {
|
|||||||
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
|
||||||
mLockPatternUtils.clearLock(isFallback);
|
mLockPatternUtils.clearLock(isFallback);
|
||||||
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
|
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
|
||||||
Toast.makeText(getActivity(), R.string.lock_setup, Toast.LENGTH_SHORT).show();
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
} else {
|
} else {
|
||||||
updateStage(Stage.ConfirmWrong);
|
updateStage(Stage.ConfirmWrong);
|
||||||
|
@@ -35,7 +35,6 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -513,8 +512,6 @@ public class ChooseLockPattern extends PreferenceActivity {
|
|||||||
utils.saveLockPattern(mChosenPattern, isFallback);
|
utils.saveLockPattern(mChosenPattern, isFallback);
|
||||||
utils.setLockPatternEnabled(true);
|
utils.setLockPatternEnabled(true);
|
||||||
|
|
||||||
Toast.makeText(getActivity(), R.string.lock_setup, Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
if (lockVirgin) {
|
if (lockVirgin) {
|
||||||
utils.setVisiblePatternEnabled(true);
|
utils.setVisiblePatternEnabled(true);
|
||||||
utils.setTactileFeedbackEnabled(false);
|
utils.setTactileFeedbackEnabled(false);
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings;
|
|||||||
|
|
||||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -50,12 +51,15 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
// Lock Settings
|
// Lock Settings
|
||||||
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
|
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
|
||||||
|
private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING =
|
||||||
|
"biometric_weak_improve_matching";
|
||||||
private static final String KEY_LOCK_ENABLED = "lockenabled";
|
private static final String KEY_LOCK_ENABLED = "lockenabled";
|
||||||
private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
|
private static final String KEY_VISIBLE_PATTERN = "visiblepattern";
|
||||||
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
|
private static final String KEY_TACTILE_FEEDBACK_ENABLED = "unlock_tactile_feedback";
|
||||||
private static final String KEY_SECURITY_CATEGORY = "security_category";
|
private static final String KEY_SECURITY_CATEGORY = "security_category";
|
||||||
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
|
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
|
||||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
|
||||||
|
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST = 124;
|
||||||
|
|
||||||
// Misc Settings
|
// Misc Settings
|
||||||
private static final String KEY_SIM_LOCK = "sim_lock";
|
private static final String KEY_SIM_LOCK = "sim_lock";
|
||||||
@@ -326,6 +330,13 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
||||||
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
||||||
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||||
|
} else if (KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING.equals(key)) {
|
||||||
|
ChooseLockSettingsHelper helper =
|
||||||
|
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||||
|
if (!helper.launchConfirmationActivity(
|
||||||
|
CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST, null, null)) {
|
||||||
|
startBiometricWeakImprove(); // no password set, so no need to confirm
|
||||||
|
}
|
||||||
} else if (KEY_LOCK_ENABLED.equals(key)) {
|
} else if (KEY_LOCK_ENABLED.equals(key)) {
|
||||||
lockPatternUtils.setLockPatternEnabled(isToggled(preference));
|
lockPatternUtils.setLockPatternEnabled(isToggled(preference));
|
||||||
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
||||||
@@ -360,6 +371,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == CONFIRM_EXISTING_FOR_BIOMETRIC_IMPROVE_REQUEST &&
|
||||||
|
resultCode == Activity.RESULT_OK) {
|
||||||
|
startBiometricWeakImprove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
createPreferenceHierarchy();
|
createPreferenceHierarchy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,4 +392,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startBiometricWeakImprove(){
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClassName("com.android.facelock", "com.android.facelock.AddToSetup");
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user