• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.statusbar.pipeline.icons.shared
18 
19 import com.android.systemui.dagger.SysUISingleton
20 import com.android.systemui.statusbar.pipeline.icons.shared.model.BindableIcon
21 import com.android.systemui.statusbar.pipeline.mobile.ui.StackedMobileBindableIcon
22 import com.android.systemui.statusbar.pipeline.satellite.ui.DeviceBasedSatelliteBindableIcon
23 import javax.inject.Inject
24 
25 /**
26  * Bindable status bar icons represent icon descriptions which can be registered with
27  * StatusBarIconController and can also create their own bindings. A bound icon is responsible for
28  * its own updates via the [repeatWhenAttached] view lifecycle utility. Thus,
29  * StatusBarIconController can (and will) ignore any call to setIcon.
30  *
31  * In other words, these icons are bound once (at controller init) and they will control their
32  * visibility on their own (while their overall appearance remains at the discretion of
33  * StatusBarIconController, via the ModernStatusBarViewBinding interface).
34  */
35 interface BindableIconsRegistry {
36     val bindableIcons: List<BindableIcon>
37 }
38 
39 @SysUISingleton
40 class BindableIconsRegistryImpl
41 @Inject
42 constructor(
43     /** Bindables go here */
44     oemSatellite: DeviceBasedSatelliteBindableIcon,
45     stackedMobile: StackedMobileBindableIcon,
46 ) : BindableIconsRegistry {
47     /**
48      * Adding the injected bindables to this list will get them registered with
49      * StatusBarIconController
50      */
51     override val bindableIcons: List<BindableIcon> = listOf(oemSatellite, stackedMobile)
52 }
53