Only launchHandoffToParent in SUW
Settings flow does not need to show this screen Fixes: 192586840 Test: adb shell am start -a android.settings.BIOMETRIC_ENROLL --ez require_consent true --ez skip_return_to_parent <true/false> Test: adb shell am start -a android.settings.BIOMETRIC_ENROLL --ez require_consent true Test: atest com.android.settings.biometrics.ParentalConsentHelperTest Change-Id: Ic2edbb5ec9693d05c89206d49249f59fd968aa2f
This commit is contained in:
@@ -82,6 +82,10 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
// Intent extra. If true, parental consent will be requested before user enrollment.
|
// Intent extra. If true, parental consent will be requested before user enrollment.
|
||||||
public static final String EXTRA_REQUIRE_PARENTAL_CONSENT = "require_consent";
|
public static final String EXTRA_REQUIRE_PARENTAL_CONSENT = "require_consent";
|
||||||
|
|
||||||
|
// Intent extra. If true, the screen asking the user to return the device to their parent will
|
||||||
|
// be skipped after enrollment.
|
||||||
|
public static final String EXTRA_SKIP_RETURN_TO_PARENT = "skip_return_to_parent";
|
||||||
|
|
||||||
// If EXTRA_REQUIRE_PARENTAL_CONSENT was used to start the activity then the result
|
// If EXTRA_REQUIRE_PARENTAL_CONSENT was used to start the activity then the result
|
||||||
// intent will include this extra containing a bundle of the form:
|
// intent will include this extra containing a bundle of the form:
|
||||||
// "modality" -> consented (boolean).
|
// "modality" -> consented (boolean).
|
||||||
@@ -102,6 +106,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
private boolean mIsFaceEnrollable = false;
|
private boolean mIsFaceEnrollable = false;
|
||||||
private boolean mIsFingerprintEnrollable = false;
|
private boolean mIsFingerprintEnrollable = false;
|
||||||
private boolean mParentalOptionsRequired = false;
|
private boolean mParentalOptionsRequired = false;
|
||||||
|
private boolean mSkipReturnToParent = false;
|
||||||
private Bundle mParentalOptions;
|
private Bundle mParentalOptions;
|
||||||
@Nullable private Long mGkPwHandle;
|
@Nullable private Long mGkPwHandle;
|
||||||
@Nullable private ParentalConsentHelper mParentalConsentHelper;
|
@Nullable private ParentalConsentHelper mParentalConsentHelper;
|
||||||
@@ -170,6 +175,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
|
|
||||||
// determine what can be enrolled
|
// determine what can be enrolled
|
||||||
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||||
|
|
||||||
if (mHasFeatureFace) {
|
if (mHasFeatureFace) {
|
||||||
final FaceManager faceManager = getSystemService(FaceManager.class);
|
final FaceManager faceManager = getSystemService(FaceManager.class);
|
||||||
final List<FaceSensorPropertiesInternal> faceProperties =
|
final List<FaceSensorPropertiesInternal> faceProperties =
|
||||||
@@ -193,9 +199,11 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(b/188847063): replace with real flag when ready
|
mParentalOptionsRequired = intent.getBooleanExtra(EXTRA_REQUIRE_PARENTAL_CONSENT, false);
|
||||||
mParentalOptionsRequired = intent.getBooleanExtra(
|
mSkipReturnToParent = intent.getBooleanExtra(EXTRA_SKIP_RETURN_TO_PARENT, false);
|
||||||
BiometricEnrollActivity.EXTRA_REQUIRE_PARENTAL_CONSENT, false);
|
|
||||||
|
Log.d(TAG, "parentalOptionsRequired: " + mParentalOptionsRequired
|
||||||
|
+ ", skipReturnToParent: " + mSkipReturnToParent);
|
||||||
|
|
||||||
if (mParentalOptionsRequired && mParentalOptions == null) {
|
if (mParentalOptionsRequired && mParentalOptions == null) {
|
||||||
mParentalConsentHelper = new ParentalConsentHelper(
|
mParentalConsentHelper = new ParentalConsentHelper(
|
||||||
@@ -376,7 +384,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
|
|||||||
|
|
||||||
private void finishOrLaunchHandToParent(int resultCode) {
|
private void finishOrLaunchHandToParent(int resultCode) {
|
||||||
if (mParentalOptionsRequired) {
|
if (mParentalOptionsRequired) {
|
||||||
launchHandoffToParent();
|
if (!mSkipReturnToParent) {
|
||||||
|
launchHandoffToParent();
|
||||||
|
} else {
|
||||||
|
setResult(RESULT_OK, newResultIntent());
|
||||||
|
finish();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setResult(resultCode);
|
setResult(resultCode);
|
||||||
finish();
|
finish();
|
||||||
|
Reference in New Issue
Block a user