1 /* 2 * Copyright (C) 2021 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 #ifndef ANDROID_MEDIA_THERMAL_POLICY_INTERFACE_H 18 #define ANDROID_MEDIA_THERMAL_POLICY_INTERFACE_H 19 #include <memory> 20 21 namespace android { 22 23 class ThermalPolicyCallbackInterface; 24 25 // Interface for the SessionController to control the thermal policy. 26 class ThermalPolicyInterface { 27 public: 28 // Set the associated callback interface to send the events when the thermal 29 // status changes. 30 virtual void setCallback(const std::shared_ptr<ThermalPolicyCallbackInterface>& cb) = 0; 31 32 // Get the current thermal throttling status. Returns true if throttling is on, 33 // false otherwise. 34 virtual bool getThrottlingStatus() = 0; 35 36 protected: 37 virtual ~ThermalPolicyInterface() = default; 38 }; 39 40 // Interface for notifying the SessionController of thermal throttling status. 41 class ThermalPolicyCallbackInterface { 42 public: 43 // Called when the session controller should start or stop thermal throttling. 44 virtual void onThrottlingStarted() = 0; 45 virtual void onThrottlingStopped() = 0; 46 47 protected: 48 virtual ~ThermalPolicyCallbackInterface() = default; 49 }; 50 51 } // namespace android 52 #endif // ANDROID_MEDIA_THERMAL_POLICY_INTERFACE_H 53