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 #pragma once 17 18 #include <PowerStatsAidl.h> 19 20 namespace aidl { 21 namespace android { 22 namespace hardware { 23 namespace power { 24 namespace stats { 25 26 class UfsStateResidencyDataProvider : public PowerStats::IStateResidencyDataProvider { 27 public: 28 UfsStateResidencyDataProvider(std::string prefix); 29 ~UfsStateResidencyDataProvider() = default; 30 31 /* 32 * See IStateResidencyDataProvider::getStateResidencies 33 */ 34 bool getStateResidencies( 35 std::unordered_map<std::string, std::vector<StateResidency>> *residencies) override; 36 37 /* 38 * See IStateResidencyDataProvider::getInfo 39 */ 40 std::unordered_map<std::string, std::vector<State>> getInfo() override; 41 42 private: 43 int64_t readStat(std::string path); 44 45 const std::string kPrefix; 46 }; 47 48 } // namespace stats 49 } // namespace power 50 } // namespace hardware 51 } // namespace android 52 } // namespace aidl 53