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.server.display.brightness.clamper;
18 
19 import android.hardware.display.DisplayManagerInternal;
20 
21 import com.android.server.display.DisplayBrightnessState;
22 
23 import java.io.PrintWriter;
24 
25 public interface BrightnessStateModifier {
26     /**
27      * Applies the changes to brightness state, by modifying properties of the brightness
28      * state builder.
29      * @param request
30      * @param stateBuilder
31      */
apply(DisplayManagerInternal.DisplayPowerRequest request, DisplayBrightnessState.Builder stateBuilder)32     void apply(DisplayManagerInternal.DisplayPowerRequest request,
33             DisplayBrightnessState.Builder stateBuilder);
34 
35     /**
36      * Prints contents of this brightness state modifier
37      * @param printWriter
38      */
dump(PrintWriter printWriter)39     void dump(PrintWriter printWriter);
40 
41     /**
42      * Called when stopped. Listeners can be unregistered here.
43      */
stop()44     void stop();
45 
46     /**
47      *
48      * @return whether the brightness state modifier needs to listen to the ambient lux in order to
49      * calculate its bounds.
50      */
shouldListenToLightSensor()51     boolean shouldListenToLightSensor();
52 
53     /**
54      * Current ambient lux
55      * @param lux - ambient lux
56      */
setAmbientLux(float lux)57     void setAmbientLux(float lux);
58 }
59