blob: a07c5cbde956f144ebce8c6fbc70cedd286a189b [file] [log] [blame]
Jorim Jaggi5cf17872014-03-26 18:31:48 +01001/*
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
17package com.android.keyguard;
18
19/**
20 * The callback used by the keyguard view to tell the {@link KeyguardViewMediator}
21 * various things.
22 */
23public interface ViewMediatorCallback {
24 /**
25 * Reports user activity and requests that the screen stay on.
26 */
27 void userActivity();
28
29 /**
Jorim Jaggi5cf17872014-03-26 18:31:48 +010030 * Report that the keyguard is done.
Jorim Jaggi25b4d4b2015-08-11 15:54:06 -070031 *
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 Tryshev8702ca72016-04-22 08:14:12 -070034 * @param targetUserId a user that needs to be the foreground user at the completion.
Jorim Jaggi5cf17872014-03-26 18:31:48 +010035 */
Vadim Tryshev8702ca72016-04-22 08:14:12 -070036 void keyguardDone(boolean strongAuth, int targetUserId);
Jorim Jaggi5cf17872014-03-26 18:31:48 +010037
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 Jaggi5cf17872014-03-26 18:31:48 +010050 * Report that the keyguard is dismissable, pending the next keyguardDone call.
Jorim Jaggi25b4d4b2015-08-11 15:54:06 -070051 *
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 Tryshev8702ca72016-04-22 08:14:12 -070054 * @param targetUserId a user that needs to be the foreground user at the completion.
Jorim Jaggi5cf17872014-03-26 18:31:48 +010055 */
Vadim Tryshev8702ca72016-04-22 08:14:12 -070056 void keyguardDonePending(boolean strongAuth, int targetUserId);
Jorim Jaggi5cf17872014-03-26 18:31:48 +010057
58 /**
59 * Report when keyguard is actually gone
60 */
61 void keyguardGone();
Jorim Jaggi8de4311c2014-08-11 22:36:20 +020062
63 /**
64 * Report when the UI is ready for dismissing the whole Keyguard.
65 */
66 void readyForKeyguardDone();
Adrian Roos49e057d2014-08-13 17:14:51 +020067
68 /**
Andrew Lee72b46d42015-01-30 13:23:21 -080069 * Reset the keyguard and bouncer.
70 */
71 void resetKeyguard();
72
73 /**
Adrian Roos49e057d2014-08-13 17:14:51 +020074 * Play the "device trusted" sound.
75 */
76 void playTrustedSound();
Jim Millerab954542014-10-10 18:21:49 -070077
78 /**
Matthew Ng66f0b702017-12-08 12:58:42 -080079 * When the bouncer is shown or hides
80 * @param shown
81 */
82 void onBouncerVisiblityChanged(boolean shown);
83
84 /**
Adrian Roos94e15a52015-04-16 12:23:18 -070085 * @return true if the screen is on
86 */
87 boolean isScreenOn();
Selim Cinek3122fa82015-06-18 01:38:59 -070088
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 Jaggi25b4d4b2015-08-11 15:54:06 -070092 * {@link KeyguardSecurityView#PROMPT_REASON_NONE},
93 * {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
94 * {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
Selim Cinek3122fa82015-06-18 01:38:59 -070095 */
96 int getBouncerPromptReason();
David Stevens53a39ea2017-08-23 18:41:49 -070097
98 /**
wilsonshihe7903ea2018-09-26 16:17:59 +080099 * Invoked when the secondary displays showing a keyguard window changes.
David Stevens53a39ea2017-08-23 18:41:49 -0700100 */
wilsonshihe7903ea2018-09-26 16:17:59 +0800101 void onSecondaryDisplayShowingChanged(int[] displayId);
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800102
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 Balachander0a427ef2018-07-13 15:00:58 -0700108
109 /**
110 * Call when cancel button is pressed in bouncer.
111 */
112 void onCancelClicked();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100113}