Home | History | Annotate | Download | only in widget
      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. If the user
     33      * has no secure lockscreen, then the token is activated immediately.
     34      *
     35      * @return a unique 64-bit token handle which is needed to refer to this token later.
     36      */
     37     public abstract long addEscrowToken(byte[] token, int userId);
     38 
     39     /**
     40      * Remove an escrow token.
     41      * @return true if the given handle refers to a valid token previously returned from
     42      * {@link #addEscrowToken}, whether it's active or not. return false otherwise.
     43      */
     44     public abstract boolean removeEscrowToken(long handle, int userId);
     45 
     46     /**
     47      * Check if the given escrow token is active or not. Only active token can be used to call
     48      * {@link #setLockCredentialWithToken} and {@link #unlockUserWithToken}
     49      */
     50     public abstract boolean isEscrowTokenActive(long handle, int userId);
     51 
     52     public abstract boolean setLockCredentialWithToken(String credential, int type,
     53             long tokenHandle, byte[] token, int requestedQuality, int userId);
     54 
     55     public abstract boolean unlockUserWithToken(long tokenHandle, byte[] token, int userId);
     56 }
     57