1 /*
2  * Copyright (C) 2019 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.ComponentName;
20 import android.content.Context;
21 import android.content.Intent;
22 import android.text.TextUtils;
23 
24 import androidx.annotation.NonNull;
25 import androidx.annotation.Nullable;
26 
27 import com.android.settings.R;
28 
29 public class FaceFeatureProviderImpl implements FaceFeatureProvider {
30 
31     /**
32      * Returns the guidance page intent if device support {@link FoldingFeature}, and we want to
33      * guide user enrolling faces with specific device posture.
34      *
35      * @param context the application context
36      * @return the posture guidance intent, otherwise null if device not support
37      */
38     @Nullable
39     @Override
getPostureGuidanceIntent(Context context)40     public Intent getPostureGuidanceIntent(Context context) {
41         final String flattenedString = context.getString(R.string.config_face_enroll_guidance_page);
42         final Intent intent;
43         if (!TextUtils.isEmpty(flattenedString)) {
44             ComponentName componentName = ComponentName.unflattenFromString(flattenedString);
45             if (componentName != null) {
46                 intent = new Intent();
47                 intent.setComponent(componentName);
48                 return intent;
49             }
50         }
51         return null;
52     }
53 
54     @Override
isAttentionSupported(Context context)55     public boolean isAttentionSupported(Context context) {
56         return true;
57     }
58 
59     @Override
isSetupWizardSupported(@onNull Context context)60     public boolean isSetupWizardSupported(@NonNull Context context) {
61         return true;
62     }
63 }
64