1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.biometrics; 18 19 import android.app.settings.SettingsEnums; 20 import android.os.Bundle; 21 import android.view.View; 22 23 import androidx.annotation.NonNull; 24 import androidx.annotation.Nullable; 25 26 import com.android.settings.R; 27 28 import com.google.android.setupcompat.template.FooterBarMixin; 29 import com.google.android.setupcompat.template.FooterButton; 30 import com.google.android.setupdesign.GlifLayout; 31 32 /** 33 * Prompts the user to hand the device to their parent or guardian. 34 */ 35 public class BiometricHandoffActivity extends BiometricEnrollBase { 36 37 @Nullable 38 private FooterButton mPrimaryFooterButton; 39 40 @Override onCreate(@ullable Bundle savedInstanceState)41 protected void onCreate(@Nullable Bundle savedInstanceState) { 42 super.onCreate(savedInstanceState); 43 setContentView(R.layout.biometric_handoff); 44 45 setHeaderText(R.string.biometric_settings_hand_back_to_guardian); 46 47 final GlifLayout layout = getLayout(); 48 mFooterBarMixin = layout.getMixin(FooterBarMixin.class); 49 mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton()); 50 } 51 52 @NonNull getPrimaryFooterButton()53 protected FooterButton getPrimaryFooterButton() { 54 if (mPrimaryFooterButton == null) { 55 mPrimaryFooterButton = new FooterButton.Builder(this) 56 .setText(R.string.biometric_settings_hand_back_to_guardian_ok) 57 .setButtonType(FooterButton.ButtonType.NEXT) 58 .setListener(this::onNextButtonClick) 59 .setTheme(R.style.SudGlifButton_Primary) 60 .build(); 61 } 62 return mPrimaryFooterButton; 63 } 64 65 @Override onNextButtonClick(View view)66 protected void onNextButtonClick(View view) { 67 setResult(RESULT_OK); 68 finish(); 69 } 70 71 @Override getMetricsCategory()72 public int getMetricsCategory() { 73 return SettingsEnums.BIOMETRIC_CONSENT_PARENT_TO_CHILD; 74 } 75 } 76