Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | */ |
Jim Miller | 5ecd811 | 2013-01-09 18:50:26 -0800 | [diff] [blame] | 16 | package com.android.keyguard; |
Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 17 | |
Jim Miller | 5ecd811 | 2013-01-09 18:50:26 -0800 | [diff] [blame] | 18 | import com.android.keyguard.KeyguardHostView.OnDismissAction; |
John Spurlock | 14adfe4 | 2012-11-08 10:29:26 -0500 | [diff] [blame] | 19 | |
Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 20 | public interface KeyguardSecurityCallback { |
| 21 | |
| 22 | /** |
| 23 | * Dismiss the given security screen. |
| 24 | * @param securityVerified true if the user correctly entered credentials for the given screen. |
| 25 | */ |
| 26 | void dismiss(boolean securityVerified); |
| 27 | |
| 28 | /** |
| 29 | * Manually report user activity to keep the device awake. If timeout is 0, |
| 30 | * uses user-defined timeout. |
| 31 | * @param timeout |
| 32 | */ |
| 33 | void userActivity(long timeout); |
| 34 | |
| 35 | /** |
| 36 | * Checks if keyguard is in "verify credentials" mode. |
| 37 | * @return true if user has been asked to verify security. |
| 38 | */ |
| 39 | boolean isVerifyUnlockOnly(); |
| 40 | |
| 41 | /** |
| 42 | * Call when user correctly enters their credentials |
| 43 | */ |
| 44 | void reportSuccessfulUnlockAttempt(); |
| 45 | |
| 46 | /** |
| 47 | * Call when the user incorrectly enters their credentials |
| 48 | */ |
| 49 | void reportFailedUnlockAttempt(); |
| 50 | |
| 51 | /** |
| 52 | * Gets the number of attempts thus far as reported by {@link #reportFailedUnlockAttempt()} |
| 53 | * @return number of failed attempts |
| 54 | */ |
| 55 | int getFailedAttempts(); |
| 56 | |
| 57 | /** |
Jim Miller | 258341c | 2012-08-30 16:50:10 -0700 | [diff] [blame] | 58 | * Shows the backup security for the current method. If none available, this call is a no-op. |
Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 59 | */ |
Jim Miller | 258341c | 2012-08-30 16:50:10 -0700 | [diff] [blame] | 60 | void showBackupSecurity(); |
Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 61 | |
Jim Miller | 5f75aa1 | 2012-08-29 15:10:34 -0700 | [diff] [blame] | 62 | /** |
John Spurlock | 34c4fe5 | 2012-11-07 10:12:29 -0500 | [diff] [blame] | 63 | * Sets an action to perform after the user successfully enters their credentials. |
| 64 | * @param action |
Jim Miller | 5f75aa1 | 2012-08-29 15:10:34 -0700 | [diff] [blame] | 65 | */ |
John Spurlock | 34c4fe5 | 2012-11-07 10:12:29 -0500 | [diff] [blame] | 66 | void setOnDismissAction(OnDismissAction action); |
Jim Miller | 5f75aa1 | 2012-08-29 15:10:34 -0700 | [diff] [blame] | 67 | |
Jim Miller | dcb3d84 | 2012-08-23 19:18:12 -0700 | [diff] [blame] | 68 | } |