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 targetUserId a user that needs to be the foreground user at the completion. 33 */ keyguardDone(int targetUserId)34 void keyguardDone(int targetUserId); 35 36 /** 37 * Report that the keyguard is done drawing. 38 */ keyguardDoneDrawing()39 void keyguardDoneDrawing(); 40 41 /** 42 * Tell ViewMediator that the current view needs IME input 43 * @param needsInput 44 */ setNeedsInput(boolean needsInput)45 void setNeedsInput(boolean needsInput); 46 47 /** 48 * Report that the keyguard is dismissible, pending the next keyguardDone call. 49 * 50 * @param targetUserId a user that needs to be the foreground user at the completion. 51 */ keyguardDonePending(int targetUserId)52 void keyguardDonePending(int targetUserId); 53 54 /** 55 * Report when keyguard is actually gone 56 */ keyguardGone()57 void keyguardGone(); 58 59 /** 60 * Report when the UI is ready for dismissing the whole Keyguard. 61 */ readyForKeyguardDone()62 void readyForKeyguardDone(); 63 64 /** 65 * Reset the keyguard and bouncer. 66 */ resetKeyguard()67 void resetKeyguard(); 68 69 /** 70 * Play the "device trusted" sound. 71 */ playTrustedSound()72 void playTrustedSound(); 73 74 /** 75 * @return true if the screen is on 76 */ isScreenOn()77 boolean isScreenOn(); 78 79 /** 80 * @return one of the reasons why the bouncer needs to be shown right now and the user can't use 81 * his normal unlock method like fingerprint or trust agents. See 82 * {@link KeyguardSecurityView#PROMPT_REASON_NONE}, 83 * {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and 84 * {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}. 85 */ getBouncerPromptReason()86 int getBouncerPromptReason(); 87 88 /** 89 * Consumes a message that was enqueued to be displayed on the next time the bouncer shows up. 90 * @return Message that should be displayed above the challenge. 91 */ consumeCustomMessage()92 CharSequence consumeCustomMessage(); 93 94 /** 95 * Sets a message to be consumed the next time the bouncer shows up. 96 */ setCustomMessage(CharSequence customMessage)97 void setCustomMessage(CharSequence customMessage); 98 99 /** 100 * Call when cancel button is pressed in bouncer. 101 */ onCancelClicked()102 void onCancelClicked(); 103 104 /** 105 * Determines if bouncer has swiped down. 106 */ onBouncerSwipeDown()107 void onBouncerSwipeDown(); 108 } 109