1 /*
2  * Copyright (C) 2022 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.strategy;
18 
19 import android.annotation.NonNull;
20 
21 import com.android.server.display.DisplayBrightnessState;
22 import com.android.server.display.brightness.StrategyExecutionRequest;
23 import com.android.server.display.brightness.StrategySelectionNotifyRequest;
24 
25 import java.io.PrintWriter;
26 
27 /**
28  * Decides the DisplayBrighntessState that the display should change to based on strategy-specific
29  * logic within each implementation. Clamping should be done outside of DisplayBrightnessStrategy if
30  * not an integral part of the strategy.
31  */
32 public interface DisplayBrightnessStrategy {
33     /**
34      * Decides the DisplayBrightnessState that the system should change to.
35      *
36      * @param strategyExecutionRequest The request to evaluate the updated brightness
37      */
updateBrightness( StrategyExecutionRequest strategyExecutionRequest)38     DisplayBrightnessState updateBrightness(
39             StrategyExecutionRequest strategyExecutionRequest);
40 
41     /**
42      * Returns the name of the Strategy
43      */
44     @NonNull
getName()45     String getName();
46 
47     /**
48      * Returns the reason for the change of the brightness
49      */
getReason()50     int getReason();
51 
52     /**
53      * Dumps the state of the Strategy
54      * @param writer
55      */
dump(PrintWriter writer)56     void dump(PrintWriter writer);
57 
58      /**
59      * Notifies this strategy about the selection of a DisplayBrightnessStrategy
60      */
strategySelectionPostProcessor( StrategySelectionNotifyRequest strategySelectionNotifyRequest)61     void strategySelectionPostProcessor(
62             StrategySelectionNotifyRequest strategySelectionNotifyRequest);
63 }
64