KeyguardSecurityCallback.java revision dcb3d84b82cc2448d04e73359a716581bfb657db
1dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller/*
2dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Copyright (C) 2012 The Android Open Source Project
3dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller *
4dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Licensed under the Apache License, Version 2.0 (the "License");
5dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * you may not use this file except in compliance with the License.
6dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * You may obtain a copy of the License at
7dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller *
8dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller *      http://www.apache.org/licenses/LICENSE-2.0
9dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller *
10dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * Unless required by applicable law or agreed to in writing, software
11dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * distributed under the License is distributed on an "AS IS" BASIS,
12dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * See the License for the specific language governing permissions and
14dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller * limitations under the License.
15dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller */
16dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerpackage com.android.internal.policy.impl.keyguard;
17dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
18dcb3d84b82cc2448d04e73359a716581bfb657dbJim Millerpublic interface KeyguardSecurityCallback {
19dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
20dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
21dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Dismiss the given security screen.
22dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @param securityVerified true if the user correctly entered credentials for the given screen.
23dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
24dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void dismiss(boolean securityVerified);
25dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
26dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
27dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Manually report user activity to keep the device awake. If timeout is 0,
28dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * uses user-defined timeout.
29dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @param timeout
30dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
31dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void userActivity(long timeout);
32dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
33dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
34dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Checks if keyguard is in "verify credentials" mode.
35dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @return true if user has been asked to verify security.
36dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
37dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    boolean isVerifyUnlockOnly();
38dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
39dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
40dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Call when user correctly enters their credentials
41dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
42dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void reportSuccessfulUnlockAttempt();
43dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
44dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
45dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Call when the user incorrectly enters their credentials
46dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
47dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void reportFailedUnlockAttempt();
48dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
49dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
50dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Gets the number of attempts thus far as reported by {@link #reportFailedUnlockAttempt()}
51dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @return number of failed attempts
52dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
53dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    int getFailedAttempts();
54dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
55dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
56dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Shows the backup unlock for the current method.  If none available, this call is a NOP.
57dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
58dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void showBackupUnlock();
59dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
60dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void keyguardDoneDrawing();
61dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
62dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller}
63