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.pipeline.dagger 18 19 import com.android.systemui.CoreStartable 20 import com.android.systemui.dagger.SysUISingleton 21 import com.android.systemui.log.LogBuffer 22 import com.android.systemui.log.LogBufferFactory 23 import com.android.systemui.qs.pipeline.data.repository.InstalledTilesComponentRepository 24 import com.android.systemui.qs.pipeline.data.repository.InstalledTilesComponentRepositoryImpl 25 import com.android.systemui.qs.pipeline.data.repository.TileSpecRepository 26 import com.android.systemui.qs.pipeline.data.repository.TileSpecSettingsRepository 27 import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor 28 import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractorImpl 29 import com.android.systemui.qs.pipeline.domain.startable.QSPipelineCoreStartable 30 import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger 31 import dagger.Binds 32 import dagger.Module 33 import dagger.Provides 34 import dagger.multibindings.ClassKey 35 import dagger.multibindings.IntoMap 36 37 @Module(includes = [QSAutoAddModule::class]) 38 abstract class QSPipelineModule { 39 40 /** Implementation for [TileSpecRepository] */ 41 @Binds 42 abstract fun provideTileSpecRepository(impl: TileSpecSettingsRepository): TileSpecRepository 43 44 @Binds 45 abstract fun bindCurrentTilesInteractor( 46 impl: CurrentTilesInteractorImpl 47 ): CurrentTilesInteractor 48 49 @Binds 50 abstract fun provideInstalledTilesPackageRepository( 51 impl: InstalledTilesComponentRepositoryImpl 52 ): InstalledTilesComponentRepository 53 54 @Binds 55 @IntoMap 56 @ClassKey(QSPipelineCoreStartable::class) 57 abstract fun provideCoreStartable(startable: QSPipelineCoreStartable): CoreStartable 58 59 companion object { 60 /** 61 * Provides a logging buffer for all logs related to the new Quick Settings pipeline to log 62 * the list of current tiles. 63 */ 64 @Provides 65 @SysUISingleton 66 @QSTileListLog 67 fun provideQSTileListLogBuffer(factory: LogBufferFactory): LogBuffer { 68 return factory.create(QSPipelineLogger.TILE_LIST_TAG, maxSize = 700, systrace = false) 69 } 70 } 71 } 72