summaryrefslogtreecommitdiffstats
path: root/Power.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Power.cpp')
-rw-r--r--Power.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/Power.cpp b/Power.cpp
index 19e3abe..ba8af81 100644
--- a/Power.cpp
+++ b/Power.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2017-2019 The LineageOS Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,6 +30,8 @@
#define LOG_TAG "android.hardware.power@1.2-service-qti"
+// #define LOG_NDEBUG 0
+
#include "Power.h"
#include <android-base/file.h>
#include <log/log.h>
@@ -101,6 +104,36 @@ Return<void> Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) {
return powerHint(static_cast<PowerHint_1_0>(hint), data);
}
+Return<int32_t> Power::getFeature(LineageFeature feature) {
+ if (feature == LineageFeature::SUPPORTED_PROFILES) {
+ return get_number_of_profiles();
+ }
+ return -1;
+}
+
+status_t Power::registerAsSystemService() {
+ status_t ret = 0;
+
+ ret = IPower::registerAsService();
+ if (ret != 0) {
+ ALOGE("Failed to register IPower (%d)", ret);
+ goto fail;
+ } else {
+ ALOGI("Successfully registered IPower");
+ }
+
+ ret = ILineagePower::registerAsService();
+ if (ret != 0) {
+ ALOGE("Failed to register ILineagePower (%d)", ret);
+ goto fail;
+ } else {
+ ALOGI("Successfully registered ILineagePower");
+ }
+
+fail:
+ return ret;
+}
+
} // namespace implementation
} // namespace V1_2
} // namespace power