diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6f6482daeb5..0c65f012d18 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1823,6 +1823,10 @@
android:exported="false"
android:screenOrientation="portrait"/>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1fba96c26e4..7493e744e2e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1008,6 +1008,10 @@
Unlocking your phone
Authentication in apps
+
+ Hand the phone back to your parent
+
+ OK
Skip screen lock?
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index 6ab9ab8828c..db5e003456a 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -69,6 +69,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
private static final int REQUEST_CONFIRM_LOCK = 2;
// prompt for parental consent options
private static final int REQUEST_CHOOSE_OPTIONS = 3;
+ // prompt hand phone back to parent after enrollment
+ private static final int REQUEST_HANDOFF_PARENT = 4;
public static final int RESULT_SKIP = BiometricEnrollBase.RESULT_SKIP;
@@ -303,11 +305,8 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
final boolean isStillPrompting = mParentalConsentHelper.launchNext(
this, REQUEST_CHOOSE_OPTIONS, resultCode, data);
if (!isStillPrompting) {
- Log.d(TAG, "Enrollment options set, starting enrollment now");
-
- mParentalOptions = mParentalConsentHelper.getConsentResult();
- mParentalConsentHelper = null;
- startEnroll();
+ Log.d(TAG, "Enrollment options set, requesting handoff");
+ launchHandoffToParent();
}
} else {
Log.d(TAG, "Unknown or cancelled parental consent");
@@ -315,6 +314,18 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
finish();
}
break;
+ case REQUEST_HANDOFF_PARENT:
+ if (resultCode == RESULT_OK) {
+ Log.d(TAG, "Enrollment options set, starting enrollment");
+ mParentalOptions = mParentalConsentHelper.getConsentResult();
+ mParentalConsentHelper = null;
+ startEnroll();
+ } else {
+ Log.d(TAG, "Unknown or cancelled handoff");
+ setResult(RESULT_CANCELED);
+ finish();
+ }
+ break;
default:
Log.w(TAG, "Unknown consenting requestCode: " + requestCode + ", finishing");
finish();
@@ -492,6 +503,11 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
mMultiBiometricEnrollHelper.startNextStep();
}
+ private void launchHandoffToParent() {
+ final Intent intent = BiometricUtils.getHandoffToParentIntent(this, getIntent());
+ startActivityForResult(intent, REQUEST_HANDOFF_PARENT);
+ }
+
@Override
public int getMetricsCategory() {
return SettingsEnums.BIOMETRIC_ENROLL_ACTIVITY;
diff --git a/src/com/android/settings/biometrics/BiometricHandoffActivity.java b/src/com/android/settings/biometrics/BiometricHandoffActivity.java
new file mode 100644
index 00000000000..f8ffe32cc1e
--- /dev/null
+++ b/src/com/android/settings/biometrics/BiometricHandoffActivity.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2021 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.biometrics;
+
+import android.app.settings.SettingsEnums;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.android.settings.R;
+
+import com.google.android.setupcompat.template.FooterBarMixin;
+import com.google.android.setupcompat.template.FooterButton;
+import com.google.android.setupdesign.GlifLayout;
+
+/**
+ * Prompts the user to hand the device to their parent or guardian.
+ */
+public class BiometricHandoffActivity extends BiometricEnrollBase {
+
+ @Nullable
+ private FooterButton mPrimaryFooterButton;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.biometric_handoff);
+
+ setHeaderText(R.string.biometric_settings_hand_back_to_guardian);
+
+ final GlifLayout layout = getLayout();
+ mFooterBarMixin = layout.getMixin(FooterBarMixin.class);
+ mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton());
+ }
+
+ @NonNull
+ protected FooterButton getPrimaryFooterButton() {
+ if (mPrimaryFooterButton == null) {
+ mPrimaryFooterButton = new FooterButton.Builder(this)
+ .setText(R.string.biometric_settings_hand_back_to_guardian_ok)
+ .setButtonType(FooterButton.ButtonType.NEXT)
+ .setListener(this::onNextButtonClick)
+ .setTheme(R.style.SudGlifButton_Primary)
+ .build();
+ }
+ return mPrimaryFooterButton;
+ }
+
+ @Override
+ protected void onNextButtonClick(View view) {
+ setResult(RESULT_OK);
+ finish();
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ // TODO (b/188847063): add new category
+ return SettingsEnums.BIOMETRIC_ENROLL_ACTIVITY;
+ }
+}
diff --git a/src/com/android/settings/biometrics/BiometricUtils.java b/src/com/android/settings/biometrics/BiometricUtils.java
index 03cdb0d653d..a98c3555f71 100644
--- a/src/com/android/settings/biometrics/BiometricUtils.java
+++ b/src/com/android/settings/biometrics/BiometricUtils.java
@@ -176,6 +176,19 @@ public class BiometricUtils {
return intent;
}
+ /**
+ * Start an activity that prompts the user to hand the device to their parent or guardian.
+ * @param context caller's context
+ * @param activityIntent The intent that started the caller's activity
+ * @return Intent for starting BiometricHandoffActivity
+ */
+ public static Intent getHandoffToParentIntent(@NonNull Context context,
+ @NonNull Intent activityIntent) {
+ final Intent intent = new Intent(context, BiometricHandoffActivity.class);
+ WizardManagerHelper.copyWizardManagerExtras(activityIntent, intent);
+ return intent;
+ }
+
/**
* @param activity Reference to the calling activity, used to startActivity
* @param intent Intent pointing to the enrollment activity
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollParentalConsent.java b/src/com/android/settings/biometrics/face/FaceEnrollParentalConsent.java
index 1f55d82145f..5770a2e337d 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollParentalConsent.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollParentalConsent.java
@@ -30,7 +30,7 @@ import com.android.settings.R;
/**
* Displays parental consent information for face authentication.
*
- * TODO(b/188847063): swap strings for consent screen
+ * TODO (b/188847063): add new metrics category
*/
public class FaceEnrollParentalConsent extends FaceEnrollIntroduction {
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollParentalConsent.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollParentalConsent.java
index 5d8cf9b0423..fbd52b74ab5 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollParentalConsent.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollParentalConsent.java
@@ -30,7 +30,7 @@ import com.android.settings.R;
/**
* Displays parental consent information for fingerprint authentication.
*
- * TODO(b/188847063): swap strings for consent screen
+ * TODO (b/188847063): add new metrics category
*/
public class FingerprintEnrollParentalConsent extends FingerprintEnrollIntroduction {