15cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi/*
25cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * Copyright (C) 2014 The Android Open Source Project
35cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi *
45cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * Licensed under the Apache License, Version 2.0 (the "License");
55cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * you may not use this file except in compliance with the License.
65cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * You may obtain a copy of the License at
75cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi *
85cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi *      http://www.apache.org/licenses/LICENSE-2.0
95cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi *
105cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * Unless required by applicable law or agreed to in writing, software
115cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * distributed under the License is distributed on an "AS IS" BASIS,
125cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * See the License for the specific language governing permissions and
145cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * limitations under the License
155cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi */
165cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
175cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggipackage com.android.keyguard;
185cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
195cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi/**
205cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * The callback used by the keyguard view to tell the {@link KeyguardViewMediator}
215cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi * various things.
225cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi */
235cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggipublic interface ViewMediatorCallback {
245cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
255cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Reports user activity and requests that the screen stay on.
265cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
275cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void userActivity();
285cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
295cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
305cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Report that the keyguard is done.
315cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * @param authenticated Whether the user securely got past the keyguard.
325cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     *   the only reason for this to be false is if the keyguard was instructed
335cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     *   to appear temporarily to verify the user is supposed to get past the
345cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     *   keyguard, and the user fails to do so.
355cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
365cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void keyguardDone(boolean authenticated);
375cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
385cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
395cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Report that the keyguard is done drawing.
405cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
415cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void keyguardDoneDrawing();
425cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
435cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
445cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Tell ViewMediator that the current view needs IME input
455cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * @param needsInput
465cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
475cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void setNeedsInput(boolean needsInput);
485cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
495cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
505cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Report that the keyguard is dismissable, pending the next keyguardDone call.
515cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
525cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void keyguardDonePending();
535cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi
545cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    /**
555cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     * Report when keyguard is actually gone
565cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi     */
575cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi    void keyguardGone();
588de4311c51229efbe2f2d0afbf298982c5cadd96Jorim Jaggi
598de4311c51229efbe2f2d0afbf298982c5cadd96Jorim Jaggi    /**
608de4311c51229efbe2f2d0afbf298982c5cadd96Jorim Jaggi     * Report when the UI is ready for dismissing the whole Keyguard.
618de4311c51229efbe2f2d0afbf298982c5cadd96Jorim Jaggi     */
628de4311c51229efbe2f2d0afbf298982c5cadd96Jorim Jaggi    void readyForKeyguardDone();
6349e057d7eedb44f5397781254acab4e0ef08a9cfAdrian Roos
6449e057d7eedb44f5397781254acab4e0ef08a9cfAdrian Roos    /**
6572b46d429cbab54af962c25ffe087c5f927f7340Andrew Lee     * Reset the keyguard and bouncer.
6672b46d429cbab54af962c25ffe087c5f927f7340Andrew Lee     */
6772b46d429cbab54af962c25ffe087c5f927f7340Andrew Lee    void resetKeyguard();
6872b46d429cbab54af962c25ffe087c5f927f7340Andrew Lee
6972b46d429cbab54af962c25ffe087c5f927f7340Andrew Lee    /**
7049e057d7eedb44f5397781254acab4e0ef08a9cfAdrian Roos     * Play the "device trusted" sound.
7149e057d7eedb44f5397781254acab4e0ef08a9cfAdrian Roos     */
7249e057d7eedb44f5397781254acab4e0ef08a9cfAdrian Roos    void playTrustedSound();
73ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller
74ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller    /**
75ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller     * @return true if and only if Keyguard is showing or if Keyguard is disabled by an external app
76ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller     *         (legacy API)
77ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller     */
78ab954546dc49e1070ed8513efbddc8954b529c23Jim Miller    boolean isInputRestricted();
7994e15a59b757678949cccb5d783bee1638e84697Adrian Roos
8094e15a59b757678949cccb5d783bee1638e84697Adrian Roos    /**
8194e15a59b757678949cccb5d783bee1638e84697Adrian Roos     * @return true if the screen is on
8294e15a59b757678949cccb5d783bee1638e84697Adrian Roos     */
8394e15a59b757678949cccb5d783bee1638e84697Adrian Roos    boolean isScreenOn();
843122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek
853122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek    /**
863122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek     * @return one of the reasons why the bouncer needs to be shown right now and the user can't use
873122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek     *         his normal unlock method like fingerprint or trust agents. See
883122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek     *         {@link KeyguardSecurityView#PROMPT_REASON_NONE}
893122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek     *         and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}.
903122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek     */
913122fa85b2f18c0a89f5fe1ef0942c530a271843Selim Cinek    int getBouncerPromptReason();
925cf17879a31b7b78c09ec50b727f921840dcf783Jorim Jaggi}
93