Some fixes to power manager lib code
- Run clang-format on all recently added files;
- Move all new classes to android::power namespace and remove Power
prefix from all classes and enums;
- Add virtual function specifier to overrides of virtual members;
- Add missing virtual destructors;
- Remove namespaces and aliases from public api of header files;
- Delete constructor and destructor of PowerHalLoader;
- Add helper functions to convert hal results in wrapper
implementations;
- Merge test targets to single libpowermanager_test target;
Bug: 150878220
Test: atest libpowermanager_test
Change-Id: Ie2b5ad69f3b05d5f6b576671bc98e0f83b274152
diff --git a/services/powermanager/tests/PowerHalLoaderTest.cpp b/services/powermanager/tests/PowerHalLoaderTest.cpp
index 2310a72..058e1b5 100644
--- a/services/powermanager/tests/PowerHalLoaderTest.cpp
+++ b/services/powermanager/tests/PowerHalLoaderTest.cpp
@@ -19,17 +19,18 @@
#include <android-base/logging.h>
#include <android/hardware/power/1.1/IPower.h>
#include <android/hardware/power/IPower.h>
+#include <gtest/gtest.h>
+#include <powermanager/PowerHalLoader.h>
#include <future>
-#include <gtest/gtest.h>
-
-#include <powermanager/PowerHalLoader.h>
using IPowerV1_0 = android::hardware::power::V1_0::IPower;
using IPowerV1_1 = android::hardware::power::V1_1::IPower;
using IPowerAidl = android::hardware::power::IPower;
using namespace android;
+using namespace android::power;
+using namespace testing;
// -------------------------------------------------------------------------------------------------
@@ -54,14 +55,10 @@
// -------------------------------------------------------------------------------------------------
template <typename T>
-class PowerHalLoaderTest : public testing::Test {
+class PowerHalLoaderTest : public Test {
public:
- sp<T> load() {
- return ::loadHal<T>();
- }
- void unload() {
- PowerHalLoader::unloadAll();
- }
+ sp<T> load() { return ::loadHal<T>(); }
+ void unload() { PowerHalLoader::unloadAll(); }
};
// -------------------------------------------------------------------------------------------------
@@ -95,7 +92,7 @@
std::vector<std::future<sp<TypeParam>>> futures;
for (int i = 0; i < 10; i++) {
futures.push_back(
- std::async(std::launch::async, &PowerHalLoaderTest<TypeParam>::load, this));
+ std::async(std::launch::async, &PowerHalLoaderTest<TypeParam>::load, this));
}
futures[0].wait();