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.domain.interactor 17 18 import android.util.Log 19 import com.android.systemui.CoreStartable 20 import com.android.systemui.dagger.SysUISingleton 21 import java.util.Set 22 import javax.inject.Inject 23 24 @SysUISingleton 25 class KeyguardTransitionCoreStartable 26 @Inject 27 constructor( 28 private val interactors: Set<TransitionInteractor>, 29 private val auditLogger: KeyguardTransitionAuditLogger, 30 private val statusBarDisableFlagsInteractor: StatusBarDisableFlagsInteractor, 31 private val keyguardStateCallbackInteractor: KeyguardStateCallbackInteractor, 32 private val keyguardServiceShowLockscreenInteractor: KeyguardServiceShowLockscreenInteractor, 33 ) : CoreStartable { 34 startnull35 override fun start() { 36 // By listing the interactors in a when, the compiler will help enforce all classes 37 // extending the sealed class [TransitionInteractor] will be initialized. 38 interactors.forEach { 39 // `when` needs to be an expression in order for the compiler to enforce it being 40 // exhaustive 41 val ret = 42 when (it) { 43 is FromPrimaryBouncerTransitionInteractor -> Log.d(TAG, "Started $it") 44 is FromAodTransitionInteractor -> Log.d(TAG, "Started $it") 45 is FromGoneTransitionInteractor -> Log.d(TAG, "Started $it") 46 is FromLockscreenTransitionInteractor -> Log.d(TAG, "Started $it") 47 is FromDreamingTransitionInteractor -> Log.d(TAG, "Started $it") 48 is FromGlanceableHubTransitionInteractor -> Log.d(TAG, "Started $it") 49 is FromOccludedTransitionInteractor -> Log.d(TAG, "Started $it") 50 is FromDozingTransitionInteractor -> Log.d(TAG, "Started $it") 51 is FromAlternateBouncerTransitionInteractor -> Log.d(TAG, "Started $it") 52 } 53 it.start() 54 } 55 auditLogger.start() 56 statusBarDisableFlagsInteractor.start() 57 keyguardStateCallbackInteractor.start() 58 keyguardServiceShowLockscreenInteractor.start() 59 } 60 61 companion object { 62 private const val TAG = "KeyguardTransitionCoreStartable" 63 } 64 } 65