1 /* 2 * Copyright (C) 2020 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 HARDWARE_GOOGLE_PIXEL_PIXELSTATS_WLCREPORTER_H 18 #define HARDWARE_GOOGLE_PIXEL_PIXELSTATS_WLCREPORTER_H 19 20 #include <android/frameworks/stats/1.0/IStats.h> 21 #include <hardware/google/pixel/pixelstats/pixelatoms.pb.h> 22 23 using android::frameworks::stats::V1_0::IStats; 24 25 namespace android { 26 namespace hardware { 27 namespace google { 28 namespace pixel { 29 30 /** 31 * A class to upload wireless metrics 32 */ 33 class WlcReporter : public RefBase { 34 public: 35 /* checkAndReport 36 * isWirelessChargingLast: last wireless charge state 37 * true, for wireless charging 38 * Return: current wireless charge state 39 */ 40 bool checkAndReport(bool isWirelessChargingLast); 41 bool isWlcSupported(); 42 43 private: 44 bool isWlcOnline(); 45 bool readFileToInt(const char *path, int *val); 46 47 void doLog(); 48 // Translate device orientation value from sensor Hal to atom enum value 49 int translateDeviceOrientationToAtomValue(int orientation); 50 51 // Proto messages are 1-indexed and VendorAtom field numbers start at 2, so 52 // store everything in the values array at the index of the field number 53 // -2. 54 const int kVendorAtomOffset = 2; 55 int readPtmcId(); 56 }; 57 58 } // namespace pixel 59 } // namespace google 60 } // namespace hardware 61 } // namespace android 62 63 #endif // HARDWARE_GOOGLE_PIXEL_PIXELSTATS_WLCREPORTER_H 64