1 /*
2 * Copyright (C) 2023 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.systemui.qs
18
19 import android.app.admin.devicePolicyManager
20 import android.content.applicationContext
21 import android.os.fakeExecutorHandler
22 import android.os.looper
23 import com.android.internal.logging.metricsLogger
24 import com.android.internal.logging.uiEventLogger
25 import com.android.internal.logging.uiEventLoggerFake
26 import com.android.systemui.InstanceIdSequenceFake
27 import com.android.systemui.animation.dialogTransitionAnimator
28 import com.android.systemui.broadcast.broadcastDispatcher
29 import com.android.systemui.classifier.falsingManager
30 import com.android.systemui.kosmos.Kosmos
31 import com.android.systemui.kosmos.Kosmos.Fixture
32 import com.android.systemui.kosmos.testDispatcher
33 import com.android.systemui.plugins.activityStarter
34 import com.android.systemui.plugins.qs.QSFactory
35 import com.android.systemui.plugins.qs.QSTile
36 import com.android.systemui.qs.footer.domain.interactor.FooterActionsInteractorImpl
37 import com.android.systemui.qs.footer.foregroundServicesRepository
38 import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsViewModel
39 import com.android.systemui.security.data.repository.securityRepository
40 import com.android.systemui.settings.userTracker
41 import com.android.systemui.statusbar.policy.deviceProvisionedController
42 import com.android.systemui.statusbar.policy.securityController
43 import com.android.systemui.user.data.repository.userSwitcherRepository
44 import com.android.systemui.user.domain.interactor.userSwitcherInteractor
45 import com.android.systemui.util.mockito.mock
46
<lambda>null47 val Kosmos.instanceIdSequenceFake: InstanceIdSequenceFake by Fixture { InstanceIdSequenceFake(0) }
<lambda>null48 val Kosmos.qsEventLogger: QsEventLoggerFake by Fixture {
49 QsEventLoggerFake(uiEventLoggerFake, instanceIdSequenceFake)
50 }
51
<lambda>null52 var Kosmos.qsTileFactory by Fixture<QSFactory> { FakeQSFactory(::tileCreator) }
53
<lambda>null54 val Kosmos.fgsManagerController by Fixture { FakeFgsManagerController() }
55
<lambda>null56 val Kosmos.footerActionsController by Fixture {
57 FooterActionsController(
58 fgsManagerController = fgsManagerController,
59 )
60 }
61
<lambda>null62 val Kosmos.qsSecurityFooterUtils by Fixture {
63 QSSecurityFooterUtils(
64 applicationContext,
65 devicePolicyManager,
66 userTracker,
67 fakeExecutorHandler,
68 activityStarter,
69 securityController,
70 looper,
71 dialogTransitionAnimator,
72 )
73 }
74
<lambda>null75 val Kosmos.footerActionsInteractor by Fixture {
76 FooterActionsInteractorImpl(
77 activityStarter = activityStarter,
78 metricsLogger = metricsLogger,
79 uiEventLogger = uiEventLogger,
80 deviceProvisionedController = deviceProvisionedController,
81 qsSecurityFooterUtils = qsSecurityFooterUtils,
82 fgsManagerController = fgsManagerController,
83 userSwitcherInteractor = userSwitcherInteractor,
84 securityRepository = securityRepository,
85 foregroundServicesRepository = foregroundServicesRepository,
86 userSwitcherRepository = userSwitcherRepository,
87 broadcastDispatcher = broadcastDispatcher,
88 bgDispatcher = testDispatcher,
89 )
90 }
91
<lambda>null92 val Kosmos.footerActionsViewModelFactory by Fixture {
93 FooterActionsViewModel.Factory(
94 context = applicationContext,
95 falsingManager = falsingManager,
96 footerActionsInteractor = footerActionsInteractor,
97 globalActionsDialogLiteProvider = { mock() },
98 activityStarter,
99 showPowerButton = true,
100 )
101 }
102
tileCreatornull103 private fun tileCreator(spec: String): QSTile {
104 return FakeQSTile(0).apply { tileSpec = spec }
105 }
106