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  */
16 package com.android.keyguard;
17 
18 import com.android.internal.widget.LockPatternUtils;
19 
20 public interface KeyguardSecurityView {
21     static public final int SCREEN_ON = 1;
22     static public final int VIEW_REVEALED = 2;
23 
24     /**
25      * Interface back to keyguard to tell it when security
26      * @param callback
27      */
setKeyguardCallback(KeyguardSecurityCallback callback)28     void setKeyguardCallback(KeyguardSecurityCallback callback);
29 
30     /**
31      * Set {@link LockPatternUtils} object. Useful for providing a mock interface.
32      * @param utils
33      */
setLockPatternUtils(LockPatternUtils utils)34     void setLockPatternUtils(LockPatternUtils utils);
35 
36     /**
37      * Reset the view and prepare to take input. This should do things like clearing the
38      * password or pattern and clear error messages.
39      */
reset()40     void reset();
41 
42     /**
43      * Emulate activity life cycle within the view. When called, the view should clean up
44      * and prepare to be removed.
45      */
onPause()46     void onPause();
47 
48     /**
49      * Emulate activity life cycle within this view.  When called, the view should prepare itself
50      * to be shown.
51      * @param reason the root cause of the event.
52      */
onResume(int reason)53     void onResume(int reason);
54 
55     /**
56      * Inquire whether this view requires IME (keyboard) interaction.
57      *
58      * @return true if IME interaction is required.
59      */
needsInput()60     boolean needsInput();
61 
62     /**
63      * Get {@link KeyguardSecurityCallback} for the given object
64      * @return KeyguardSecurityCallback
65      */
getCallback()66     KeyguardSecurityCallback getCallback();
67 
68     /**
69      * Instruct the view to show usability hints, if any.
70      *
71      */
showUsabilityHint()72     void showUsabilityHint();
73 
74     /**
75      * Place the security view into bouncer mode.
76      * Animate transisiton if duration is non-zero.
77      * @param duration millisends for the transisiton animation.
78      */
showBouncer(int duration)79     void showBouncer(int duration);
80 
81     /**
82      * Place the security view into non-bouncer mode.
83      * Animate transisiton if duration is non-zero.
84      * @param duration millisends for the transisiton animation.
85      */
hideBouncer(int duration)86     void hideBouncer(int duration);
87 
88     /**
89      * Starts the animation which should run when the security view appears.
90      */
startAppearAnimation()91     void startAppearAnimation();
92 
93     /**
94      * Starts the animation which should run when the security view disappears.
95      *
96      * @param finishRunnable the runnable to be run when the animation ended
97      * @return true if an animation started and {@code finishRunnable} will be run, false if no
98      *         animation started and {@code finishRunnable} will not be run
99      */
startDisappearAnimation(Runnable finishRunnable)100     boolean startDisappearAnimation(Runnable finishRunnable);
101 }
102