Home | History | Annotate | Download | only in keyguard
      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     int PROMPT_REASON_NONE = 0;
     25     int PROMPT_REASON_RESTART = 1;
     26 
     27     /**
     28      * Interface back to keyguard to tell it when security
     29      * @param callback
     30      */
     31     void setKeyguardCallback(KeyguardSecurityCallback callback);
     32 
     33     /**
     34      * Set {@link LockPatternUtils} object. Useful for providing a mock interface.
     35      * @param utils
     36      */
     37     void setLockPatternUtils(LockPatternUtils utils);
     38 
     39     /**
     40      * Reset the view and prepare to take input. This should do things like clearing the
     41      * password or pattern and clear error messages.
     42      */
     43     void reset();
     44 
     45     /**
     46      * Emulate activity life cycle within the view. When called, the view should clean up
     47      * and prepare to be removed.
     48      */
     49     void onPause();
     50 
     51     /**
     52      * Emulate activity life cycle within this view.  When called, the view should prepare itself
     53      * to be shown.
     54      * @param reason the root cause of the event.
     55      */
     56     void onResume(int reason);
     57 
     58     /**
     59      * Inquire whether this view requires IME (keyboard) interaction.
     60      *
     61      * @return true if IME interaction is required.
     62      */
     63     boolean needsInput();
     64 
     65     /**
     66      * Get {@link KeyguardSecurityCallback} for the given object
     67      * @return KeyguardSecurityCallback
     68      */
     69     KeyguardSecurityCallback getCallback();
     70 
     71     /**
     72      * Show a string explaining why the security view needs to be solved.
     73      *
     74      * @param reason a flag indicating which string should be shown, see {@link #PROMPT_REASON_NONE}
     75      *               and {@link #PROMPT_REASON_RESTART}
     76      */
     77     void showPromptReason(int reason);
     78 
     79     /**
     80      * Instruct the view to show usability hints, if any.
     81      *
     82      */
     83     void showUsabilityHint();
     84 
     85     /**
     86      * Starts the animation which should run when the security view appears.
     87      */
     88     void startAppearAnimation();
     89 
     90     /**
     91      * Starts the animation which should run when the security view disappears.
     92      *
     93      * @param finishRunnable the runnable to be run when the animation ended
     94      * @return true if an animation started and {@code finishRunnable} will be run, false if no
     95      *         animation started and {@code finishRunnable} will not be run
     96      */
     97     boolean startDisappearAnimation(Runnable finishRunnable);
     98 }
     99