1 /* 2 * Copyright (C) 2018 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.face; 18 19 import android.content.Context; 20 import android.content.Intent; 21 22 import androidx.preference.Preference; 23 24 import com.android.settings.R; 25 import com.android.settings.core.BasePreferenceController; 26 import com.android.settings.overlay.FeatureFactory; 27 import com.android.settings.utils.AnnotationSpan; 28 import com.android.settingslib.HelpUtils; 29 30 /** 31 * Footer for face settings showing the help text and help link. 32 */ 33 public class FaceSettingsFooterPreferenceController extends BasePreferenceController { 34 35 private static final String ANNOTATION_URL = "url"; 36 37 private FaceFeatureProvider mProvider; 38 FaceSettingsFooterPreferenceController(Context context, String preferenceKey)39 public FaceSettingsFooterPreferenceController(Context context, String preferenceKey) { 40 super(context, preferenceKey); 41 mProvider = FeatureFactory.getFactory(context).getFaceFeatureProvider(); 42 } 43 44 @Override getAvailabilityStatus()45 public int getAvailabilityStatus() { 46 return AVAILABLE_UNSEARCHABLE; 47 } 48 49 @Override updateState(Preference preference)50 public void updateState(Preference preference) { 51 super.updateState(preference); 52 53 final Intent helpIntent = HelpUtils.getHelpIntent( 54 mContext, mContext.getString(R.string.help_url_face), getClass().getName()); 55 final AnnotationSpan.LinkInfo linkInfo = 56 new AnnotationSpan.LinkInfo(mContext, ANNOTATION_URL, helpIntent); 57 58 final int footerRes = mProvider.isAttentionSupported(mContext) 59 ? R.string.security_settings_face_settings_footer 60 : R.string.security_settings_face_settings_footer_attention_not_supported; 61 62 preference.setTitle(AnnotationSpan.linkify( 63 mContext.getText(footerRes), linkInfo)); 64 } 65 } 66