blob: 45bd2f82db8086ef7ee72d1a4749f352f4864c55 [file] [log] [blame]
#include <memory>
#include <health/utils.h>
#include <health2impl/Health.h>
#include <hidl/Status.h>
#include <log/log.h>
#include <android-base/strings.h>
#include <string>
using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::health::InitHealthdConfig;
using ::android::hardware::health::V2_1::IHealth;
using ::android::hidl::base::V1_0::IBase;
using namespace std::literals;
namespace android {
namespace hardware {
namespace health {
namespace V2_1 {
namespace implementation {
// android::hardware::health::V2_1::implementation::Health implements most
// defaults. Uncomment functions that you need to override.
class HealthImpl : public Health {
public:
HealthImpl(std::unique_ptr<healthd_config>&& config)
: Health(std::move(config)) {}
};
} // namespace implementation
} // namespace V2_1
} // namespace health
} // namespace hardware
} // namespace android
extern "C" IHealth* HIDL_FETCH_IHealth(const char* instance) {
using ::android::hardware::health::V2_1::implementation::HealthImpl;
if (instance != "default"sv) {
ALOGE("Instance is not supported");
return nullptr;
}
auto config = std::make_unique<healthd_config>();
InitHealthdConfig(config.get());
config->batteryStatusPath = "/sys/class/power_supply/pmi8998_charger/status";
return new HealthImpl(std::move(config));
}