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      *
32      * @param strongAuth whether the user has authenticated with strong authentication like
33      *                   pattern, password or PIN but not by trust agents or fingerprint
34      * @param targetUserId a user that needs to be the foreground user at the completion.
35      */
keyguardDone(boolean strongAuth, int targetUserId)36     void keyguardDone(boolean strongAuth, int targetUserId);
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      *
52      * @param strongAuth whether the user has authenticated with strong authentication like
53      *                   pattern, password or PIN but not by trust agents or fingerprint
54      * @param targetUserId a user that needs to be the foreground user at the completion.
55      */
keyguardDonePending(boolean strongAuth, int targetUserId)56     void keyguardDonePending(boolean strongAuth, int targetUserId);
57 
58     /**
59      * Report when keyguard is actually gone
60      */
keyguardGone()61     void keyguardGone();
62 
63     /**
64      * Report when the UI is ready for dismissing the whole Keyguard.
65      */
readyForKeyguardDone()66     void readyForKeyguardDone();
67 
68     /**
69      * Reset the keyguard and bouncer.
70      */
resetKeyguard()71     void resetKeyguard();
72 
73     /**
74      * Play the "device trusted" sound.
75      */
playTrustedSound()76     void playTrustedSound();
77 
78     /**
79      * When the bouncer is shown or hides
80      * @param shown
81      */
onBouncerVisiblityChanged(boolean shown)82     void onBouncerVisiblityChanged(boolean shown);
83 
84     /**
85      * @return true if the screen is on
86      */
isScreenOn()87     boolean isScreenOn();
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
92      *         {@link KeyguardSecurityView#PROMPT_REASON_NONE},
93      *         {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
94      *         {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
95      */
getBouncerPromptReason()96     int getBouncerPromptReason();
97 
98     /**
99      * Consumes a message that was enqueued to be displayed on the next time the bouncer shows up.
100      * @return Message that should be displayed above the challenge.
101      */
consumeCustomMessage()102     CharSequence consumeCustomMessage();
103 
104     /**
105      * Call when cancel button is pressed in bouncer.
106      */
onCancelClicked()107     void onCancelClicked();
108 }
109