Fixed unicorn multi-enrollment flow.
Test: Verified that Unicorn SUW flows can now enroll a face. Test: Verified normal SUW flow works as expected. Fixes: 237088482 Fixes: 234663447 Change-Id: I9c4100f61b5e7d40fc9ed67c6918ec7bf31fc30a
This commit is contained in:
@@ -333,6 +333,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Log.d(TAG,
|
||||
"onActivityResult(requestCode=" + requestCode + ", resultCode=" + resultCode + ")");
|
||||
// single enrollment is handled entirely by the launched activity
|
||||
// this handles multi enroll or if parental consent is required
|
||||
if (mParentalConsentHelper != null) {
|
||||
|
@@ -184,7 +184,8 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()) {
|
||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
finish();
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -302,7 +303,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// TODO(b/229924331): Add tests for the enrollment flows.
|
||||
Log.d(TAG,
|
||||
"onActivityResult(requestCode=" + requestCode + ", resultCode=" + resultCode + ")");
|
||||
final boolean cameFromMultiBioFpAuthAddAnother =
|
||||
requestCode == BiometricUtils.REQUEST_ADD_ANOTHER
|
||||
&& BiometricUtils.isMultiBiometricFingerprintEnrollmentFlow(this);
|
||||
|
@@ -240,7 +240,6 @@ public class BiometricUtils {
|
||||
return activity.getIntent().hasExtra(MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used for checking if a multi-biometric enrollment flowstarts with Fingerprint
|
||||
* and ends with Face.
|
||||
@@ -254,6 +253,18 @@ public class BiometricUtils {
|
||||
MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FINGERPRINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if the activity is a multi biometric flow activity.
|
||||
*
|
||||
* @param activity Activity to check
|
||||
* @return True if the activity is going through a multi-biometric enrollment flow, that starts
|
||||
* with Fingerprint.
|
||||
*/
|
||||
public static boolean isAnyMultiBiometricFlow(@NonNull Activity activity) {
|
||||
return isMultiBiometricFaceEnrollmentFlow(activity)
|
||||
|| isMultiBiometricFingerprintEnrollmentFlow(activity);
|
||||
}
|
||||
|
||||
public static void copyMultiBiometricExtras(@NonNull Intent fromIntent,
|
||||
@NonNull Intent toIntent) {
|
||||
PendingIntent pendingIntent = (PendingIntent) fromIntent.getExtra(
|
||||
|
@@ -74,7 +74,8 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction().remove(mSidecar).commitAllowingStateLoss();
|
||||
}
|
||||
if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||
if (!WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||
setResult(RESULT_TIMEOUT);
|
||||
}
|
||||
finish();
|
||||
|
@@ -139,12 +139,12 @@ public class ParentalConsentHelper {
|
||||
|
||||
@Nullable
|
||||
private Intent getNextConsentIntent(@NonNull Context context) {
|
||||
if (mRequireFace && mConsentFace == null) {
|
||||
return new Intent(context, FaceEnrollParentalConsent.class);
|
||||
}
|
||||
if (mRequireFingerprint && mConsentFingerprint == null) {
|
||||
return new Intent(context, FingerprintEnrollParentalConsent.class);
|
||||
}
|
||||
if (mRequireFace && mConsentFace == null) {
|
||||
return new Intent(context, FaceEnrollParentalConsent.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -53,11 +53,7 @@ public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final String text =
|
||||
getText(R.string.security_settings_face_enroll_introduction_consent_message_0)
|
||||
+ "\n\n"
|
||||
+ getText(R.string.security_settings_face_enroll_introduction_consent_message);
|
||||
setDescriptionText(text);
|
||||
setDescriptionText(R.string.security_settings_face_enroll_introduction_consent_message_0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -21,6 +21,7 @@ import android.content.Intent;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
@@ -48,6 +49,9 @@ import java.util.List;
|
||||
public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
||||
BiometricEnrollSidecar.Listener {
|
||||
|
||||
|
||||
private static final String TAG = "FingerprintEnrollFindSensor";
|
||||
|
||||
@Nullable
|
||||
private FingerprintFindSensorAnimation mAnimation;
|
||||
|
||||
@@ -294,6 +298,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.d(TAG,
|
||||
"onActivityResult(requestCode=" + requestCode + ", resultCode=" + resultCode + ")");
|
||||
boolean enrolledFingerprint = false;
|
||||
if (data != null) {
|
||||
enrolledFingerprint = data.getBooleanExtra(EXTRA_FINISHED_ENROLL_FINGERPRINT, false);
|
||||
|
@@ -82,7 +82,7 @@ public class ParentalConsentHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchNext_face_and_fingerprint_all_consent() {
|
||||
public void testLaunchNext__fingerprint_all_consent() {
|
||||
testLaunchNext(
|
||||
true /* requireFace */, true /* grantFace */,
|
||||
true /* requireFingerprint */, true /* grantFace */,
|
||||
@@ -158,13 +158,13 @@ public class ParentalConsentHelperTest {
|
||||
boolean requireFingerprint, boolean grantFingerprint,
|
||||
long gkpw) {
|
||||
final List<Pair<String, Boolean>> expectedLaunches = new ArrayList<>();
|
||||
if (requireFace) {
|
||||
expectedLaunches.add(new Pair(FaceEnrollParentalConsent.class.getName(), grantFace));
|
||||
}
|
||||
if (requireFingerprint) {
|
||||
expectedLaunches.add(
|
||||
new Pair(FingerprintEnrollParentalConsent.class.getName(), grantFingerprint));
|
||||
}
|
||||
if (requireFace) {
|
||||
expectedLaunches.add(new Pair(FaceEnrollParentalConsent.class.getName(), grantFace));
|
||||
}
|
||||
|
||||
// initial consent status
|
||||
final ParentalConsentHelper helper = new ParentalConsentHelper(gkpw);
|
||||
|
Reference in New Issue
Block a user