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
1814adfe425e67c9ec12b0841a62c5c03ce00838eaJohn Spurlockimport com.android.internal.policy.impl.keyguard.KeyguardHostView.OnDismissAction;
1934c4fe523ad96fb59cec28832b38806d04a6bebfJohn Spurlock
2014adfe425e67c9ec12b0841a62c5c03ce00838eaJohn Spurlockpublic interface KeyguardSecurityCallback {
2134c4fe523ad96fb59cec28832b38806d04a6bebfJohn Spurlock
22dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
23dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Dismiss the given security screen.
24dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @param securityVerified true if the user correctly entered credentials for the given screen.
25dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
26dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void dismiss(boolean securityVerified);
27dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
28dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
29dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Manually report user activity to keep the device awake. If timeout is 0,
30dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * uses user-defined timeout.
31dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @param timeout
32dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
33dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void userActivity(long timeout);
34dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
35dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
36dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Checks if keyguard is in "verify credentials" mode.
37dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @return true if user has been asked to verify security.
38dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
39dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    boolean isVerifyUnlockOnly();
40dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
41dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
42dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Call when user correctly enters their credentials
43dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
44dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void reportSuccessfulUnlockAttempt();
45dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
46dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
47dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Call when the user incorrectly enters their credentials
48dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
49dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    void reportFailedUnlockAttempt();
50dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
51dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
52dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * Gets the number of attempts thus far as reported by {@link #reportFailedUnlockAttempt()}
53dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     * @return number of failed attempts
54dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
55dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    int getFailedAttempts();
56dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
57dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller    /**
58258341c377b6aa9f1bd29a9b507a97967e432dfeJim Miller     * Shows the backup security for the current method.  If none available, this call is a no-op.
59dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller     */
60258341c377b6aa9f1bd29a9b507a97967e432dfeJim Miller    void showBackupSecurity();
61dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller
625f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller    /**
6334c4fe523ad96fb59cec28832b38806d04a6bebfJohn Spurlock     * Sets an action to perform after the user successfully enters their credentials.
6434c4fe523ad96fb59cec28832b38806d04a6bebfJohn Spurlock     * @param action
655f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller     */
6634c4fe523ad96fb59cec28832b38806d04a6bebfJohn Spurlock    void setOnDismissAction(OnDismissAction action);
675f75aa15d7c1c5ea1c1eecd95bf2bb0920173eb2Jim Miller
68dcb3d84b82cc2448d04e73359a716581bfb657dbJim Miller}
69