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      */
userActivity()27     void userActivity();
28 
29     /**
30      * Report that the keyguard is done.
31      * @param authenticated Whether the user securely got past the keyguard.
32      *   the only reason for this to be false is if the keyguard was instructed
33      *   to appear temporarily to verify the user is supposed to get past the
34      *   keyguard, and the user fails to do so.
35      */
keyguardDone(boolean authenticated)36     void keyguardDone(boolean authenticated);
37 
38     /**
39      * Report that the keyguard is done drawing.
40      */
keyguardDoneDrawing()41     void keyguardDoneDrawing();
42 
43     /**
44      * Tell ViewMediator that the current view needs IME input
45      * @param needsInput
46      */
setNeedsInput(boolean needsInput)47     void setNeedsInput(boolean needsInput);
48 
49     /**
50      * Report that the keyguard is dismissable, pending the next keyguardDone call.
51      */
keyguardDonePending()52     void keyguardDonePending();
53 
54     /**
55      * Report when keyguard is actually gone
56      */
keyguardGone()57     void keyguardGone();
58 
59     /**
60      * Report when the UI is ready for dismissing the whole Keyguard.
61      */
readyForKeyguardDone()62     void readyForKeyguardDone();
63 
64     /**
65      * Reset the keyguard and bouncer.
66      */
resetKeyguard()67     void resetKeyguard();
68 
69     /**
70      * Play the "device trusted" sound.
71      */
playTrustedSound()72     void playTrustedSound();
73 
74     /**
75      * @return true if and only if Keyguard is showing or if Keyguard is disabled by an external app
76      *         (legacy API)
77      */
isInputRestricted()78     boolean isInputRestricted();
79 
80     /**
81      * @return true if the screen is on
82      */
isScreenOn()83     boolean isScreenOn();
84 
85     /**
86      * @return one of the reasons why the bouncer needs to be shown right now and the user can't use
87      *         his normal unlock method like fingerprint or trust agents. See
88      *         {@link KeyguardSecurityView#PROMPT_REASON_NONE}
89      *         and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}.
90      */
getBouncerPromptReason()91     int getBouncerPromptReason();
92 }
93