blob: d459bfbbcdc48400f259fafd7594cb1307a1d1bf [file] [log] [blame]
Rubin Xufcd49f92017-08-24 18:21:52 +01001/*
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
17package com.android.internal.widget;
18
19
20/**
21 * LockSettingsService local system service interface.
22 *
23 * @hide Only for use within the system server.
24 */
25public abstract class LockSettingsInternal {
26
27 /**
28 * Create an escrow token for the current user, which can later be used to unlock FBE
29 * or change user password.
30 *
31 * After adding, if the user currently has lockscreen password, he will need to perform a
Ram Periathiruvadi32d53552019-02-19 13:25:46 -080032 * confirm credential operation in order to activate the token for future use.
33 * Once the token is activated, the callback that is passed here is called. If the user
Rubin Xufcd49f92017-08-24 18:21:52 +010034 * has no secure lockscreen, then the token is activated immediately.
35 *
36 * @return a unique 64-bit token handle which is needed to refer to this token later.
37 */
Ram Periathiruvadi32d53552019-02-19 13:25:46 -080038 public abstract long addEscrowToken(byte[] token, int userId,
39 LockPatternUtils.EscrowTokenStateChangeCallback callback);
Rubin Xufcd49f92017-08-24 18:21:52 +010040
41 /**
42 * Remove an escrow token.
Ram Periathiruvadi32d53552019-02-19 13:25:46 -080043 *
Rubin Xufcd49f92017-08-24 18:21:52 +010044 * @return true if the given handle refers to a valid token previously returned from
45 * {@link #addEscrowToken}, whether it's active or not. return false otherwise.
46 */
47 public abstract boolean removeEscrowToken(long handle, int userId);
48
49 /**
50 * Check if the given escrow token is active or not. Only active token can be used to call
51 * {@link #setLockCredentialWithToken} and {@link #unlockUserWithToken}
52 */
53 public abstract boolean isEscrowTokenActive(long handle, int userId);
54
Rich Canningsf64ec632019-02-21 12:40:36 -080055 /**
56 * Set the lock credential.
Ram Periathiruvadi32d53552019-02-19 13:25:46 -080057 *
Rich Canningsf64ec632019-02-21 12:40:36 -080058 * @return true if password is set.
59 */
60 public abstract boolean setLockCredentialWithToken(byte[] credential, int type,
Rubin Xufcd49f92017-08-24 18:21:52 +010061 long tokenHandle, byte[] token, int requestedQuality, int userId);
62
63 public abstract boolean unlockUserWithToken(long tokenHandle, byte[] token, int userId);
64}