1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 5 * except in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the 10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 * KIND, either express or implied. See the License for the specific language governing 12 * permissions and limitations under the License. 13 * 14 */ 15 16 package com.android.systemui.statusbar.notification.icon.ui.viewbinder 17 18 import com.android.systemui.CoreStartable 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.util.asIndenting 21 import com.android.systemui.util.printCollection 22 import dagger.Binds 23 import dagger.multibindings.ClassKey 24 import dagger.multibindings.IntoMap 25 import java.io.PrintWriter 26 import javax.inject.Inject 27 28 @SysUISingleton 29 class StatusBarIconViewBindingFailureTracker @Inject constructor() : CoreStartable { 30 31 var aodFailures: Collection<String> = emptyList() 32 var statusBarFailures: Collection<String> = emptyList() 33 var shelfFailures: Collection<String> = emptyList() 34 35 // TODO(b/310681665): Ideally we wouldn't need to implement CoreStartable at all, and could just 36 // @Binds @IntoSet the Dumpable. startnull37 override fun start() { 38 // no-op, we're just using this as a dumpable 39 } 40 dumpnull41 override fun dump(pw: PrintWriter, args: Array<out String>) { 42 pw.asIndenting().run { 43 printCollection("AOD Icon binding failures:", aodFailures) 44 printCollection("Status Bar Icon binding failures:", statusBarFailures) 45 printCollection("Shelf Icon binding failures:", shelfFailures) 46 } 47 } 48 49 @dagger.Module 50 interface Module { 51 @Binds 52 @IntoMap 53 @ClassKey(StatusBarIconViewBindingFailureTracker::class) bindStartablenull54 fun bindStartable(impl: StatusBarIconViewBindingFailureTracker): CoreStartable 55 } 56 } 57