1 /*
2  * Copyright (C) 2018 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.phone;
18 
19 import android.graphics.Rect;
20 
21 import com.android.systemui.Dumpable;
22 import com.android.systemui.plugins.DarkIconDispatcher;
23 
24 import java.util.ArrayList;
25 import java.util.Collection;
26 
27 import kotlinx.coroutines.flow.StateFlow;
28 
29 /**
30  * Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area
31  * and dark intensity.
32  */
33 public interface SysuiDarkIconDispatcher extends DarkIconDispatcher, Dumpable {
34 
35     /**
36      * @return LightBarTransitionsController
37      */
getTransitionsController()38     LightBarTransitionsController getTransitionsController();
39 
40     /**
41      * Flow equivalent of registering {@link DarkReceiver} using
42      * {@link DarkIconDispatcher#addDarkReceiver(DarkReceiver)}
43      */
darkChangeFlow()44     StateFlow<DarkChange> darkChangeFlow();
45 
46     /** Model for {@link #darkChangeFlow()} */
47     class DarkChange {
48 
49         public static final DarkChange EMPTY = new DarkChange(new ArrayList<>(), 0, 0);
50 
DarkChange(Collection<Rect> areas, float darkIntensity, int tint)51         public DarkChange(Collection<Rect> areas, float darkIntensity, int tint) {
52             this.areas = areas;
53             this.darkIntensity = darkIntensity;
54             this.tint = tint;
55         }
56 
57         public final Collection<Rect> areas;
58         public final float darkIntensity;
59         public final int tint;
60     }
61 }
62