Merge "Fixed unicorn multi-enrollment flow." into tm-d1-dev am: 431542dddc
am: e30a71787e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/19093051 Change-Id: I80312c96248ff2231386c154ebe0f9bf54ae4f34 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -333,6 +333,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
Log.d(TAG,
|
||||||
|
"onActivityResult(requestCode=" + requestCode + ", resultCode=" + resultCode + ")");
|
||||||
// single enrollment is handled entirely by the launched activity
|
// single enrollment is handled entirely by the launched activity
|
||||||
// this handles multi enroll or if parental consent is required
|
// this handles multi enroll or if parental consent is required
|
||||||
if (mParentalConsentHelper != null) {
|
if (mParentalConsentHelper != null) {
|
||||||
|
@@ -184,7 +184,8 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()) {
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
setResult(RESULT_TIMEOUT);
|
setResult(RESULT_TIMEOUT);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import android.hardware.biometrics.BiometricAuthenticator;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -302,7 +303,8 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
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 =
|
final boolean cameFromMultiBioFpAuthAddAnother =
|
||||||
requestCode == BiometricUtils.REQUEST_ADD_ANOTHER
|
requestCode == BiometricUtils.REQUEST_ADD_ANOTHER
|
||||||
&& BiometricUtils.isMultiBiometricFingerprintEnrollmentFlow(this);
|
&& BiometricUtils.isMultiBiometricFingerprintEnrollmentFlow(this);
|
||||||
|
@@ -240,7 +240,6 @@ public class BiometricUtils {
|
|||||||
return activity.getIntent().hasExtra(MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE);
|
return activity.getIntent().hasExtra(MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for checking if a multi-biometric enrollment flowstarts with Fingerprint
|
* Used for checking if a multi-biometric enrollment flowstarts with Fingerprint
|
||||||
* and ends with Face.
|
* and ends with Face.
|
||||||
@@ -254,6 +253,18 @@ public class BiometricUtils {
|
|||||||
MultiBiometricEnrollHelper.EXTRA_ENROLL_AFTER_FINGERPRINT);
|
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,
|
public static void copyMultiBiometricExtras(@NonNull Intent fromIntent,
|
||||||
@NonNull Intent toIntent) {
|
@NonNull Intent toIntent) {
|
||||||
PendingIntent pendingIntent = (PendingIntent) fromIntent.getExtra(
|
PendingIntent pendingIntent = (PendingIntent) fromIntent.getExtra(
|
||||||
|
@@ -74,7 +74,8 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
|||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction().remove(mSidecar).commitAllowingStateLoss();
|
.beginTransaction().remove(mSidecar).commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
if (!WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
setResult(RESULT_TIMEOUT);
|
setResult(RESULT_TIMEOUT);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
|
@@ -139,12 +139,12 @@ public class ParentalConsentHelper {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private Intent getNextConsentIntent(@NonNull Context context) {
|
private Intent getNextConsentIntent(@NonNull Context context) {
|
||||||
if (mRequireFace && mConsentFace == null) {
|
|
||||||
return new Intent(context, FaceEnrollParentalConsent.class);
|
|
||||||
}
|
|
||||||
if (mRequireFingerprint && mConsentFingerprint == null) {
|
if (mRequireFingerprint && mConsentFingerprint == null) {
|
||||||
return new Intent(context, FingerprintEnrollParentalConsent.class);
|
return new Intent(context, FingerprintEnrollParentalConsent.class);
|
||||||
}
|
}
|
||||||
|
if (mRequireFace && mConsentFace == null) {
|
||||||
|
return new Intent(context, FaceEnrollParentalConsent.class);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,11 +53,7 @@ public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
final String text =
|
setDescriptionText(R.string.security_settings_face_enroll_introduction_consent_message_0);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -21,6 +21,7 @@ import android.content.Intent;
|
|||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.OrientationEventListener;
|
import android.view.OrientationEventListener;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -48,6 +49,9 @@ import java.util.List;
|
|||||||
public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
||||||
BiometricEnrollSidecar.Listener {
|
BiometricEnrollSidecar.Listener {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String TAG = "FingerprintEnrollFindSensor";
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private FingerprintFindSensorAnimation mAnimation;
|
private FingerprintFindSensorAnimation mAnimation;
|
||||||
|
|
||||||
@@ -294,6 +298,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
Log.d(TAG,
|
||||||
|
"onActivityResult(requestCode=" + requestCode + ", resultCode=" + resultCode + ")");
|
||||||
boolean enrolledFingerprint = false;
|
boolean enrolledFingerprint = false;
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
enrolledFingerprint = data.getBooleanExtra(EXTRA_FINISHED_ENROLL_FINGERPRINT, false);
|
enrolledFingerprint = data.getBooleanExtra(EXTRA_FINISHED_ENROLL_FINGERPRINT, false);
|
||||||
|
@@ -82,7 +82,7 @@ public class ParentalConsentHelperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLaunchNext_face_and_fingerprint_all_consent() {
|
public void testLaunchNext__fingerprint_all_consent() {
|
||||||
testLaunchNext(
|
testLaunchNext(
|
||||||
true /* requireFace */, true /* grantFace */,
|
true /* requireFace */, true /* grantFace */,
|
||||||
true /* requireFingerprint */, true /* grantFace */,
|
true /* requireFingerprint */, true /* grantFace */,
|
||||||
@@ -158,13 +158,13 @@ public class ParentalConsentHelperTest {
|
|||||||
boolean requireFingerprint, boolean grantFingerprint,
|
boolean requireFingerprint, boolean grantFingerprint,
|
||||||
long gkpw) {
|
long gkpw) {
|
||||||
final List<Pair<String, Boolean>> expectedLaunches = new ArrayList<>();
|
final List<Pair<String, Boolean>> expectedLaunches = new ArrayList<>();
|
||||||
if (requireFace) {
|
|
||||||
expectedLaunches.add(new Pair(FaceEnrollParentalConsent.class.getName(), grantFace));
|
|
||||||
}
|
|
||||||
if (requireFingerprint) {
|
if (requireFingerprint) {
|
||||||
expectedLaunches.add(
|
expectedLaunches.add(
|
||||||
new Pair(FingerprintEnrollParentalConsent.class.getName(), grantFingerprint));
|
new Pair(FingerprintEnrollParentalConsent.class.getName(), grantFingerprint));
|
||||||
}
|
}
|
||||||
|
if (requireFace) {
|
||||||
|
expectedLaunches.add(new Pair(FaceEnrollParentalConsent.class.getName(), grantFace));
|
||||||
|
}
|
||||||
|
|
||||||
// initial consent status
|
// initial consent status
|
||||||
final ParentalConsentHelper helper = new ParentalConsentHelper(gkpw);
|
final ParentalConsentHelper helper = new ParentalConsentHelper(gkpw);
|
||||||
|
Reference in New Issue
Block a user