Use AIDL VHAL interface in power policy daemone

Bug: 222572467
Test: atest carpowerpolicyserver_test
Change-Id: I44b5ce01eca17e16d6fddb1ecd0caf87df84092e
diff --git a/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp b/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
index 46cabfa..7afb59b 100644
--- a/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
+++ b/cpp/powerpolicy/server/src/CarPowerPolicyServer.cpp
@@ -19,7 +19,10 @@
 
 #include "CarPowerPolicyServer.h"
 
+#include <aidl/android/hardware/automotive/vehicle/StatusCode.h>
 #include <aidl/android/hardware/automotive/vehicle/SubscribeOptions.h>
+#include <aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.h>
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
 #include <android-base/file.h>
 #include <android-base/stringprintf.h>
 #include <android/binder_ibinder.h>
@@ -45,8 +48,10 @@
 using ::aidl::android::frameworks::automotive::powerpolicy::ICarPowerPolicyChangeCallback;
 using ::aidl::android::frameworks::automotive::powerpolicy::PowerComponent;
 using ::aidl::android::frameworks::automotive::powerpolicy::internal::PolicyState;
+using ::aidl::android::hardware::automotive::vehicle::StatusCode;
 using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions;
-
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
+using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
 using ::android::defaultServiceManager;
 using ::android::IBinder;
 using ::android::Looper;
@@ -68,15 +73,7 @@
 using ::android::hardware::hidl_vec;
 using ::android::hardware::interfacesEqual;
 using ::android::hardware::Return;
-using ::android::hardware::automotive::vehicle::V2_0::IVehicle;
-using ::android::hardware::automotive::vehicle::V2_0::StatusCode;
-using ::android::hardware::automotive::vehicle::V2_0::SubscribeFlags;
-using ::android::hardware::automotive::vehicle::V2_0::VehicleApPowerStateReport;
-using ::android::hardware::automotive::vehicle::V2_0::VehiclePropConfig;
-using ::android::hardware::automotive::vehicle::V2_0::VehicleProperty;
-using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue;
 using ::android::hidl::base::V1_0::IBase;
-
 using ::ndk::ScopedAIBinder_DeathRecipient;
 using ::ndk::ScopedAStatus;
 using ::ndk::SharedRefBase;
@@ -89,10 +86,10 @@
 const nsecs_t kConnectionRetryIntervalNs = 200000000;  // 200 milliseconds.
 const int32_t kMaxConnectionRetry = 25;                // Retry up to 5 seconds.
 
-constexpr const char* kCarServiceInterface = "car_service";
-constexpr const char* kCarPowerPolicyServerInterface =
+constexpr const char kCarServiceInterface[] = "car_service";
+constexpr const char kCarPowerPolicyServerInterface[] =
         "android.frameworks.automotive.powerpolicy.ICarPowerPolicyServer/default";
-constexpr const char* kCarPowerPolicySystemNotificationInterface =
+constexpr const char kCarPowerPolicySystemNotificationInterface[] =
         "android.frameworks.automotive.powerpolicy.internal.ICarPowerPolicySystemNotification/"
         "default";
 
diff --git a/cpp/powerpolicy/server/src/CarPowerPolicyServer.h b/cpp/powerpolicy/server/src/CarPowerPolicyServer.h
index f46119a..b214a50 100644
--- a/cpp/powerpolicy/server/src/CarPowerPolicyServer.h
+++ b/cpp/powerpolicy/server/src/CarPowerPolicyServer.h
@@ -24,7 +24,6 @@
 #include <aidl/android/frameworks/automotive/powerpolicy/BnCarPowerPolicyServer.h>
 #include <aidl/android/frameworks/automotive/powerpolicy/internal/BnCarPowerPolicySystemNotification.h>
 #include <android-base/result.h>
-#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <binder/IBinder.h>
 #include <binder/Status.h>
 #include <utils/Looper.h>
diff --git a/cpp/powerpolicy/server/src/PolicyManager.cpp b/cpp/powerpolicy/server/src/PolicyManager.cpp
index b52b550..c855b6f 100644
--- a/cpp/powerpolicy/server/src/PolicyManager.cpp
+++ b/cpp/powerpolicy/server/src/PolicyManager.cpp
@@ -36,14 +36,13 @@
 
 using ::aidl::android::frameworks::automotive::powerpolicy::CarPowerPolicy;
 using ::aidl::android::frameworks::automotive::powerpolicy::PowerComponent;
-
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
 using ::android::base::Error;
 using ::android::base::Result;
 using ::android::base::StartsWith;
 using ::android::base::StringAppendF;
 using ::android::base::StringPrintf;
 using ::android::base::WriteStringToFd;
-using ::android::hardware::automotive::vehicle::V2_0::VehicleApPowerStateReport;
 using ::tinyxml2::XML_SUCCESS;
 using ::tinyxml2::XMLDocument;
 using ::tinyxml2::XMLElement;
diff --git a/cpp/powerpolicy/server/src/PolicyManager.h b/cpp/powerpolicy/server/src/PolicyManager.h
index 356b98b..d97f7b8 100644
--- a/cpp/powerpolicy/server/src/PolicyManager.h
+++ b/cpp/powerpolicy/server/src/PolicyManager.h
@@ -18,8 +18,8 @@
 #define CPP_POWERPOLICY_SERVER_SRC_POLICYMANAGER_H_
 
 #include <aidl/android/frameworks/automotive/powerpolicy/CarPowerPolicy.h>
+#include <aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.h>
 #include <android-base/result.h>
-#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <utils/Vector.h>
 
 #include <tinyxml2.h>
@@ -76,7 +76,7 @@
     android::base::Result<CarPowerPolicyMeta> getPowerPolicy(const std::string& policyId) const;
     android::base::Result<CarPowerPolicyPtr> getDefaultPowerPolicyForState(
             const std::string& groupId,
-            android::hardware::automotive::vehicle::V2_0::VehicleApPowerStateReport state) const;
+            aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport state) const;
     bool isPowerPolicyGroupAvailable(const std::string& groupId) const;
     bool isPreemptivePowerPolicy(const std::string& policyId) const;
     android::base::Result<void> definePowerPolicy(
diff --git a/cpp/powerpolicy/server/tests/PolicyManagerTest.cpp b/cpp/powerpolicy/server/tests/PolicyManagerTest.cpp
index 184e76a..e4994b2 100644
--- a/cpp/powerpolicy/server/tests/PolicyManagerTest.cpp
+++ b/cpp/powerpolicy/server/tests/PolicyManagerTest.cpp
@@ -16,8 +16,8 @@
 
 #include "PolicyManager.h"
 
+#include <aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.h>
 #include <android-base/file.h>
-#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <gmock/gmock.h>
 
 #include <unordered_set>
@@ -29,10 +29,9 @@
 
 using ::aidl::android::frameworks::automotive::powerpolicy::CarPowerPolicy;
 using ::aidl::android::frameworks::automotive::powerpolicy::PowerComponent;
-
-using android::hardware::automotive::vehicle::V2_0::VehicleApPowerStateReport;
-using tinyxml2::XML_SUCCESS;
-using tinyxml2::XMLDocument;
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
+using ::tinyxml2::XML_SUCCESS;
+using ::tinyxml2::XMLDocument;
 
 namespace {