1 /* 2 * Copyright (C) 2022 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.systemui.keyguard.shared.model 17 18 /** Model device wakefulness states. */ 19 enum class BiometricUnlockModel { 20 /** Mode in which we don't need to wake up the device when we authenticate. */ 21 NONE, 22 /** 23 * Mode in which we wake up the device, and directly dismiss Keyguard. Active when we acquire a 24 * fingerprint while the screen is off and the device was sleeping. 25 */ 26 WAKE_AND_UNLOCK, 27 /** 28 * Mode in which we wake the device up, and fade out the Keyguard contents because they were 29 * already visible while pulsing in doze mode. 30 */ 31 WAKE_AND_UNLOCK_PULSING, 32 /** 33 * Mode in which we wake up the device, but play the normal dismiss animation. Active when we 34 * acquire a fingerprint pulsing in doze mode. 35 */ 36 SHOW_BOUNCER, 37 /** 38 * Mode in which we only wake up the device, and keyguard was not showing when we authenticated. 39 */ 40 ONLY_WAKE, 41 /** 42 * Mode in which fingerprint unlocks the device or passive auth (ie face auth) unlocks the 43 * device while being requested when keyguard is occluded or showing. 44 */ 45 UNLOCK_COLLAPSING, 46 /** When bouncer is visible and will be dismissed. */ 47 DISMISS_BOUNCER, 48 /** Mode in which fingerprint wakes and unlocks the device from a dream. */ 49 WAKE_AND_UNLOCK_FROM_DREAM; 50 51 companion object { 52 private val wakeAndUnlockModes = 53 setOf(WAKE_AND_UNLOCK, WAKE_AND_UNLOCK_FROM_DREAM, WAKE_AND_UNLOCK_PULSING) 54 isWakeAndUnlocknull55 fun isWakeAndUnlock(model: BiometricUnlockModel): Boolean { 56 return wakeAndUnlockModes.contains(model) 57 } 58 } 59 } 60