• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.settingslib.enterprise;
18 
19 import android.annotation.NonNull;
20 import android.content.Context;
21 import android.content.DialogInterface;
22 import android.content.Intent;
23 import android.provider.Settings;
24 import android.util.Log;
25 
26 import androidx.annotation.Nullable;
27 
28 import com.android.settingslib.RestrictedLockUtils;
29 
30 public class BiometricActionDisabledByAdminController extends BaseActionDisabledByAdminController {
31 
32     private static final String TAG = "BiometricActionDisabledByAdminController";
33 
BiometricActionDisabledByAdminController( DeviceAdminStringProvider stringProvider)34     BiometricActionDisabledByAdminController(
35             DeviceAdminStringProvider stringProvider) {
36         super(stringProvider);
37     }
38 
39     @Override
setupLearnMoreButton(Context context)40     public void setupLearnMoreButton(Context context) {
41 
42     }
43 
44     @Override
getAdminSupportTitle(@ullable String restriction)45     public String getAdminSupportTitle(@Nullable String restriction) {
46         return mStringProvider.getDisabledBiometricsParentConsentTitle();
47     }
48 
49     @Override
getAdminSupportContentString(Context context, @Nullable CharSequence supportMessage)50     public CharSequence getAdminSupportContentString(Context context,
51             @Nullable CharSequence supportMessage) {
52         return mStringProvider.getDisabledBiometricsParentConsentContent();
53     }
54 
55     @Override
getPositiveButtonListener(@onNull Context context, @NonNull RestrictedLockUtils.EnforcedAdmin enforcedAdmin)56     public DialogInterface.OnClickListener getPositiveButtonListener(@NonNull Context context,
57             @NonNull RestrictedLockUtils.EnforcedAdmin enforcedAdmin) {
58         return (dialog, which) -> {
59             Log.d(TAG, "Positive button clicked, component: " + enforcedAdmin.component);
60             final Intent intent = new Intent(Settings.ACTION_MANAGE_SUPERVISOR_RESTRICTED_SETTING)
61                     .putExtra(Settings.EXTRA_SUPERVISOR_RESTRICTED_SETTING_KEY,
62                             Settings.SUPERVISOR_VERIFICATION_SETTING_BIOMETRICS)
63                     .setPackage(enforcedAdmin.component.getPackageName());
64             context.startActivity(intent);
65         };
66     }
67 }
68