Add handoff activity to parental consent flow.
Bug: 188847063 Test: manual Change-Id: Ib6f38aae487a536fb8e85d608a22378a17c1bc64
This commit is contained in:
@@ -1823,6 +1823,10 @@
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<activity android:name=".biometrics.BiometricHandoffActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<!-- Must not be exported -->
|
||||
<activity android:name=".biometrics.BiometricEnrollActivity$InternalActivity"
|
||||
android:exported="false"
|
||||
|
24
res/layout/biometric_handoff.xml
Normal file
24
res/layout/biometric_handoff.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<com.google.android.setupdesign.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="?attr/face_layout_theme"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</com.google.android.setupdesign.GlifLayout>
|
@@ -1008,6 +1008,10 @@
|
||||
<string name="biometric_settings_use_biometric_unlock_phone">Unlocking your phone</string>
|
||||
<!-- Text shown on a toggle which allows or disallows the device to use biometric for authentication. [CHAR LIMIT=50] -->
|
||||
<string name="biometric_settings_use_biometric_for_apps">Authentication in apps</string>
|
||||
<!-- Message shown during enrollment to prompt a child to give the device to a parent or guardian. [CHAR LIMIT=NONE]-->
|
||||
<string name="biometric_settings_hand_back_to_guardian">Hand the phone back to your parent</string>
|
||||
<!-- Button text shown during enrollment to proceed after a child user has handed the device to a parent or guardian. [CHAR LIMIT=22] -->
|
||||
<string name="biometric_settings_hand_back_to_guardian_ok">OK</string>
|
||||
|
||||
<!-- Title of dialog shown when the user tries to skip setting up a screen lock, warning them of potential consequences of not doing so [CHAR LIMIT=30]-->
|
||||
<string name="lock_screen_intro_skip_title">Skip screen lock?</string>
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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
|
||||
|
@@ -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 {
|
||||
|
||||
|
@@ -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 {
|
||||
|
||||
|
Reference in New Issue
Block a user