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 ) : CoreStartable { 31 startnull32 override fun start() { 33 // By listing the interactors in a when, the compiler will help enforce all classes 34 // extending the sealed class [TransitionInteractor] will be initialized. 35 interactors.forEach { 36 // `when` needs to be an expression in order for the compiler to enforce it being 37 // exhaustive 38 val ret = 39 when (it) { 40 is FromPrimaryBouncerTransitionInteractor -> Log.d(TAG, "Started $it") 41 is FromAodTransitionInteractor -> Log.d(TAG, "Started $it") 42 is FromGoneTransitionInteractor -> Log.d(TAG, "Started $it") 43 is FromLockscreenTransitionInteractor -> Log.d(TAG, "Started $it") 44 is FromDreamingTransitionInteractor -> Log.d(TAG, "Started $it") 45 is FromOccludedTransitionInteractor -> Log.d(TAG, "Started $it") 46 is FromDozingTransitionInteractor -> Log.d(TAG, "Started $it") 47 is FromAlternateBouncerTransitionInteractor -> Log.d(TAG, "Started $it") 48 } 49 it.start() 50 } 51 auditLogger.start() 52 } 53 54 companion object { 55 private const val TAG = "KeyguardTransitionCoreStartable" 56 } 57 } 58