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.internal.widget; 18 19 20 /** 21 * LockSettingsService local system service interface. 22 * 23 * @hide Only for use within the system server. 24 */ 25 public 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 32 * 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 34 * 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 */ addEscrowToken(byte[] token, int userId, LockPatternUtils.EscrowTokenStateChangeCallback callback)38 public abstract long addEscrowToken(byte[] token, int userId, 39 LockPatternUtils.EscrowTokenStateChangeCallback callback); 40 41 /** 42 * Remove an escrow token. 43 * 44 * @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 */ removeEscrowToken(long handle, int userId)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 */ isEscrowTokenActive(long handle, int userId)53 public abstract boolean isEscrowTokenActive(long handle, int userId); 54 55 /** 56 * Set the lock credential. 57 * 58 * @return true if password is set. 59 */ setLockCredentialWithToken(byte[] credential, int type, long tokenHandle, byte[] token, int requestedQuality, int userId)60 public abstract boolean setLockCredentialWithToken(byte[] credential, int type, 61 long tokenHandle, byte[] token, int requestedQuality, int userId); 62 unlockUserWithToken(long tokenHandle, byte[] token, int userId)63 public abstract boolean unlockUserWithToken(long tokenHandle, byte[] token, int userId); 64 } 65