Home | History | Annotate | Download | only in keyguard
      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      */
     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      */
     35     void keyguardDone(boolean strongAuth);
     36 
     37     /**
     38      * Report that the keyguard is done drawing.
     39      */
     40     void keyguardDoneDrawing();
     41 
     42     /**
     43      * Tell ViewMediator that the current view needs IME input
     44      * @param needsInput
     45      */
     46     void setNeedsInput(boolean needsInput);
     47 
     48     /**
     49      * Report that the keyguard is dismissable, pending the next keyguardDone call.
     50      *
     51      * @param strongAuth whether the user has authenticated with strong authentication like
     52      *                   pattern, password or PIN but not by trust agents or fingerprint
     53      */
     54     void keyguardDonePending(boolean strongAuth);
     55 
     56     /**
     57      * Report when keyguard is actually gone
     58      */
     59     void keyguardGone();
     60 
     61     /**
     62      * Report when the UI is ready for dismissing the whole Keyguard.
     63      */
     64     void readyForKeyguardDone();
     65 
     66     /**
     67      * Reset the keyguard and bouncer.
     68      */
     69     void resetKeyguard();
     70 
     71     /**
     72      * Play the "device trusted" sound.
     73      */
     74     void playTrustedSound();
     75 
     76     /**
     77      * @return true if and only if Keyguard is showing or if Keyguard is disabled by an external app
     78      *         (legacy API)
     79      */
     80     boolean isInputRestricted();
     81 
     82     /**
     83      * @return true if the screen is on
     84      */
     85     boolean isScreenOn();
     86 
     87     /**
     88      * @return one of the reasons why the bouncer needs to be shown right now and the user can't use
     89      *         his normal unlock method like fingerprint or trust agents. See
     90      *         {@link KeyguardSecurityView#PROMPT_REASON_NONE},
     91      *         {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
     92      *         {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
     93      */
     94     int getBouncerPromptReason();
     95 }
     96