• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.car.settings.security;
18 
19 import androidx.annotation.Nullable;
20 import androidx.fragment.app.Fragment;
21 
22 import com.android.car.settings.common.BaseCarSettingsActivity;
23 
24 /**
25  * Prompts the user to enter their pin, password, or pattern lock (if set) and returns
26  * {@link #RESULT_OK} on a successful entry or immediately if the user has no lock setup.
27  */
28 public class CheckLockActivity extends BaseCarSettingsActivity implements CheckLockListener {
29     @Override
30     @Nullable
getInitialFragment()31     protected Fragment getInitialFragment() {
32         Fragment lockFragment = ConfirmPasswordFragmentFactory.getFragment(/* context= */ this);
33         if (lockFragment == null) {
34             // User has not set a password
35             setResult(RESULT_OK);
36             finish();
37         }
38         return lockFragment;
39     }
40 
41     @Override
onLockVerified(byte[] lock)42     public void onLockVerified(byte[] lock) {
43         setResult(RESULT_OK);
44         finish();
45     }
46 }
47