1 /*
2  * Copyright (C) 2024 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 @file:OptIn(ExperimentalCoroutinesApi::class)
18 
19 package com.android.systemui.kosmos
20 
21 import android.content.applicationContext
22 import android.os.fakeExecutorHandler
23 import com.android.systemui.SysuiTestCase
24 import com.android.systemui.bouncer.data.repository.bouncerRepository
25 import com.android.systemui.bouncer.data.repository.fakeKeyguardBouncerRepository
26 import com.android.systemui.bouncer.domain.interactor.simBouncerInteractor
27 import com.android.systemui.classifier.falsingCollector
28 import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository
29 import com.android.systemui.common.ui.domain.interactor.configurationInteractor
30 import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository
31 import com.android.systemui.communal.domain.interactor.communalInteractor
32 import com.android.systemui.communal.domain.interactor.communalSceneInteractor
33 import com.android.systemui.communal.ui.viewmodel.communalTransitionViewModel
34 import com.android.systemui.concurrency.fakeExecutor
35 import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor
36 import com.android.systemui.deviceentry.domain.interactor.deviceEntryUdfpsInteractor
37 import com.android.systemui.deviceentry.domain.interactor.deviceUnlockedInteractor
38 import com.android.systemui.globalactions.domain.interactor.globalActionsInteractor
39 import com.android.systemui.haptics.qs.qsLongPressEffect
40 import com.android.systemui.jank.interactionJankMonitor
41 import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
42 import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
43 import com.android.systemui.keyguard.domain.interactor.fromGoneTransitionInteractor
44 import com.android.systemui.keyguard.domain.interactor.fromLockscreenTransitionInteractor
45 import com.android.systemui.keyguard.domain.interactor.fromPrimaryBouncerTransitionInteractor
46 import com.android.systemui.keyguard.domain.interactor.keyguardClockInteractor
47 import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
48 import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
49 import com.android.systemui.model.sceneContainerPlugin
50 import com.android.systemui.plugins.statusbar.statusBarStateController
51 import com.android.systemui.power.data.repository.fakePowerRepository
52 import com.android.systemui.power.domain.interactor.powerInteractor
53 import com.android.systemui.scene.domain.interactor.sceneInteractor
54 import com.android.systemui.scene.domain.startable.scrimStartable
55 import com.android.systemui.scene.sceneContainerConfig
56 import com.android.systemui.scene.shared.model.sceneDataSource
57 import com.android.systemui.settings.brightness.domain.interactor.brightnessMirrorShowingInteractor
58 import com.android.systemui.shade.data.repository.shadeRepository
59 import com.android.systemui.shade.domain.interactor.shadeInteractor
60 import com.android.systemui.shade.shadeController
61 import com.android.systemui.statusbar.chips.ui.viewmodel.ongoingActivityChipsViewModel
62 import com.android.systemui.statusbar.notification.stack.domain.interactor.headsUpNotificationInteractor
63 import com.android.systemui.statusbar.notification.stack.domain.interactor.sharedNotificationContainerInteractor
64 import com.android.systemui.statusbar.phone.scrimController
65 import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository
66 import com.android.systemui.statusbar.pipeline.wifi.data.repository.fakeWifiRepository
67 import com.android.systemui.statusbar.pipeline.wifi.domain.interactor.wifiInteractor
68 import com.android.systemui.statusbar.policy.data.repository.fakeDeviceProvisioningRepository
69 import com.android.systemui.statusbar.policy.domain.interactor.deviceProvisioningInteractor
70 import com.android.systemui.util.time.systemClock
71 import com.android.systemui.volume.domain.interactor.volumeDialogInteractor
72 import kotlinx.coroutines.ExperimentalCoroutinesApi
73 
74 /**
75  * Helper for using [Kosmos] from Java.
76  *
77  * If your test class extends [SysuiTestCase], you may use the secondary constructor so that
78  * [Kosmos.applicationContext] and [Kosmos.testCase] are automatically set.
79  */
80 @Deprecated("Please convert your test to Kotlin and use [Kosmos] directly.")
81 class KosmosJavaAdapter() {
82     constructor(testCase: SysuiTestCase) : this() {
83         kosmos.applicationContext = testCase.context
84         kosmos.testCase = testCase
85     }
86 
87     private val kosmos = Kosmos()
88 
<lambda>null89     val testDispatcher by lazy { kosmos.testDispatcher }
<lambda>null90     val testScope by lazy { kosmos.testScope }
<lambda>null91     val fakeExecutor by lazy { kosmos.fakeExecutor }
<lambda>null92     val fakeExecutorHandler by lazy { kosmos.fakeExecutorHandler }
<lambda>null93     val configurationRepository by lazy { kosmos.fakeConfigurationRepository }
<lambda>null94     val configurationInteractor by lazy { kosmos.configurationInteractor }
<lambda>null95     val bouncerRepository by lazy { kosmos.bouncerRepository }
<lambda>null96     val communalRepository by lazy { kosmos.fakeCommunalSceneRepository }
<lambda>null97     val communalTransitionViewModel by lazy { kosmos.communalTransitionViewModel }
<lambda>null98     val headsUpNotificationInteractor by lazy { kosmos.headsUpNotificationInteractor }
<lambda>null99     val keyguardRepository by lazy { kosmos.fakeKeyguardRepository }
<lambda>null100     val keyguardBouncerRepository by lazy { kosmos.fakeKeyguardBouncerRepository }
<lambda>null101     val keyguardInteractor by lazy { kosmos.keyguardInteractor }
<lambda>null102     val keyguardTransitionRepository by lazy { kosmos.fakeKeyguardTransitionRepository }
<lambda>null103     val keyguardTransitionInteractor by lazy { kosmos.keyguardTransitionInteractor }
<lambda>null104     val powerRepository by lazy { kosmos.fakePowerRepository }
<lambda>null105     val clock by lazy { kosmos.systemClock }
<lambda>null106     val mobileConnectionsRepository by lazy { kosmos.fakeMobileConnectionsRepository }
<lambda>null107     val simBouncerInteractor by lazy { kosmos.simBouncerInteractor }
<lambda>null108     val statusBarStateController by lazy { kosmos.statusBarStateController }
<lambda>null109     val interactionJankMonitor by lazy { kosmos.interactionJankMonitor }
<lambda>null110     val fakeSceneContainerConfig by lazy { kosmos.sceneContainerConfig }
<lambda>null111     val sceneInteractor by lazy { kosmos.sceneInteractor }
<lambda>null112     val falsingCollector by lazy { kosmos.falsingCollector }
<lambda>null113     val powerInteractor by lazy { kosmos.powerInteractor }
<lambda>null114     val deviceEntryInteractor by lazy { kosmos.deviceEntryInteractor }
<lambda>null115     val deviceEntryUdfpsInteractor by lazy { kosmos.deviceEntryUdfpsInteractor }
<lambda>null116     val deviceUnlockedInteractor by lazy { kosmos.deviceUnlockedInteractor }
<lambda>null117     val communalInteractor by lazy { kosmos.communalInteractor }
<lambda>null118     val communalSceneInteractor by lazy { kosmos.communalSceneInteractor }
<lambda>null119     val sceneContainerPlugin by lazy { kosmos.sceneContainerPlugin }
<lambda>null120     val deviceProvisioningInteractor by lazy { kosmos.deviceProvisioningInteractor }
<lambda>null121     val fakeDeviceProvisioningRepository by lazy { kosmos.fakeDeviceProvisioningRepository }
<lambda>null122     val fromLockscreenTransitionInteractor by lazy { kosmos.fromLockscreenTransitionInteractor }
<lambda>null123     val fromPrimaryBouncerTransitionInteractor by lazy {
124         kosmos.fromPrimaryBouncerTransitionInteractor
125     }
<lambda>null126     val fromGoneTransitionInteractor by lazy { kosmos.fromGoneTransitionInteractor }
<lambda>null127     val globalActionsInteractor by lazy { kosmos.globalActionsInteractor }
<lambda>null128     val sceneDataSource by lazy { kosmos.sceneDataSource }
<lambda>null129     val keyguardClockInteractor by lazy { kosmos.keyguardClockInteractor }
<lambda>null130     val sharedNotificationContainerInteractor by lazy {
131         kosmos.sharedNotificationContainerInteractor
132     }
<lambda>null133     val brightnessMirrorShowingInteractor by lazy { kosmos.brightnessMirrorShowingInteractor }
<lambda>null134     val qsLongPressEffect by lazy { kosmos.qsLongPressEffect }
<lambda>null135     val shadeController by lazy { kosmos.shadeController }
<lambda>null136     val shadeRepository by lazy { kosmos.shadeRepository }
<lambda>null137     val shadeInteractor by lazy { kosmos.shadeInteractor }
<lambda>null138     val wifiInteractor by lazy { kosmos.wifiInteractor }
<lambda>null139     val fakeWifiRepository by lazy { kosmos.fakeWifiRepository }
<lambda>null140     val volumeDialogInteractor by lazy { kosmos.volumeDialogInteractor }
141 
<lambda>null142     val ongoingActivityChipsViewModel by lazy { kosmos.ongoingActivityChipsViewModel }
<lambda>null143     val scrimController by lazy { kosmos.scrimController }
<lambda>null144     val scrimStartable by lazy { kosmos.scrimStartable }
145 }
146