Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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.keyguard; |
| 18 | |
| 19 | /** |
| 20 | * The callback used by the keyguard view to tell the {@link KeyguardViewMediator} |
| 21 | * various things. |
| 22 | */ |
| 23 | public interface ViewMediatorCallback { |
| 24 | /** |
| 25 | * Reports user activity and requests that the screen stay on. |
| 26 | */ |
| 27 | void userActivity(); |
| 28 | |
| 29 | /** |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 30 | * Report that the keyguard is done. |
Jorim Jaggi | 25b4d4b | 2015-08-11 15:54:06 -0700 | [diff] [blame] | 31 | * |
| 32 | * @param strongAuth whether the user has authenticated with strong authentication like |
| 33 | * pattern, password or PIN but not by trust agents or fingerprint |
Vadim Tryshev | 8702ca7 | 2016-04-22 08:14:12 -0700 | [diff] [blame] | 34 | * @param targetUserId a user that needs to be the foreground user at the completion. |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 35 | */ |
Vadim Tryshev | 8702ca7 | 2016-04-22 08:14:12 -0700 | [diff] [blame] | 36 | void keyguardDone(boolean strongAuth, int targetUserId); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Report that the keyguard is done drawing. |
| 40 | */ |
| 41 | void keyguardDoneDrawing(); |
| 42 | |
| 43 | /** |
| 44 | * Tell ViewMediator that the current view needs IME input |
| 45 | * @param needsInput |
| 46 | */ |
| 47 | void setNeedsInput(boolean needsInput); |
| 48 | |
| 49 | /** |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 50 | * Report that the keyguard is dismissable, pending the next keyguardDone call. |
Jorim Jaggi | 25b4d4b | 2015-08-11 15:54:06 -0700 | [diff] [blame] | 51 | * |
| 52 | * @param strongAuth whether the user has authenticated with strong authentication like |
| 53 | * pattern, password or PIN but not by trust agents or fingerprint |
Vadim Tryshev | 8702ca7 | 2016-04-22 08:14:12 -0700 | [diff] [blame] | 54 | * @param targetUserId a user that needs to be the foreground user at the completion. |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 55 | */ |
Vadim Tryshev | 8702ca7 | 2016-04-22 08:14:12 -0700 | [diff] [blame] | 56 | void keyguardDonePending(boolean strongAuth, int targetUserId); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * Report when keyguard is actually gone |
| 60 | */ |
| 61 | void keyguardGone(); |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * Report when the UI is ready for dismissing the whole Keyguard. |
| 65 | */ |
| 66 | void readyForKeyguardDone(); |
Adrian Roos | 49e057d | 2014-08-13 17:14:51 +0200 | [diff] [blame] | 67 | |
| 68 | /** |
Andrew Lee | 72b46d4 | 2015-01-30 13:23:21 -0800 | [diff] [blame] | 69 | * Reset the keyguard and bouncer. |
| 70 | */ |
| 71 | void resetKeyguard(); |
| 72 | |
| 73 | /** |
Adrian Roos | 49e057d | 2014-08-13 17:14:51 +0200 | [diff] [blame] | 74 | * Play the "device trusted" sound. |
| 75 | */ |
| 76 | void playTrustedSound(); |
Jim Miller | ab95454 | 2014-10-10 18:21:49 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
Matthew Ng | 66f0b70 | 2017-12-08 12:58:42 -0800 | [diff] [blame] | 79 | * When the bouncer is shown or hides |
| 80 | * @param shown |
| 81 | */ |
| 82 | void onBouncerVisiblityChanged(boolean shown); |
| 83 | |
| 84 | /** |
Adrian Roos | 94e15a5 | 2015-04-16 12:23:18 -0700 | [diff] [blame] | 85 | * @return true if the screen is on |
| 86 | */ |
| 87 | boolean isScreenOn(); |
Selim Cinek | 3122fa8 | 2015-06-18 01:38:59 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * @return one of the reasons why the bouncer needs to be shown right now and the user can't use |
| 91 | * his normal unlock method like fingerprint or trust agents. See |
Jorim Jaggi | 25b4d4b | 2015-08-11 15:54:06 -0700 | [diff] [blame] | 92 | * {@link KeyguardSecurityView#PROMPT_REASON_NONE}, |
| 93 | * {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and |
| 94 | * {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}. |
Selim Cinek | 3122fa8 | 2015-06-18 01:38:59 -0700 | [diff] [blame] | 95 | */ |
| 96 | int getBouncerPromptReason(); |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 97 | |
| 98 | /** |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 99 | * Invoked when the secondary displays showing a keyguard window changes. |
David Stevens | 53a39ea | 2017-08-23 18:41:49 -0700 | [diff] [blame] | 100 | */ |
wilsonshih | e7903ea | 2018-09-26 16:17:59 +0800 | [diff] [blame] | 101 | void onSecondaryDisplayShowingChanged(int[] displayId); |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 102 | |
| 103 | /** |
| 104 | * Consumes a message that was enqueued to be displayed on the next time the bouncer shows up. |
| 105 | * @return Message that should be displayed above the challenge. |
| 106 | */ |
| 107 | CharSequence consumeCustomMessage(); |
Aarthi Balachander | 0a427ef | 2018-07-13 15:00:58 -0700 | [diff] [blame] | 108 | |
| 109 | /** |
| 110 | * Call when cancel button is pressed in bouncer. |
| 111 | */ |
| 112 | void onCancelClicked(); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 113 | } |