powerstats: Simplify Power Stats HAL API

Removing unused types, and statuses.

Removing getPowerEntityStateSpace and moving that functionality into
getPowerEntityInfo.

Bug: 167218032
Test: m
Change-Id: I6dabd18a41338e715713f43c2e009003dcc003b6
diff --git a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl
index b13f0c7..6772f6f 100644
--- a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl
+++ b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl
@@ -20,12 +20,6 @@
 interface IPowerStats {
   android.hardware.powerstats.EnergyData[] getEnergyData(in int[] railIndices);
   android.hardware.powerstats.PowerEntityInfo[] getPowerEntityInfo();
-  android.hardware.powerstats.PowerEntityStateSpace[] getPowerEntityStateInfo(in int[] powerEntityIds);
   android.hardware.powerstats.PowerEntityStateResidencyResult[] getPowerEntityStateResidencyData(in int[] powerEntityIds);
   android.hardware.powerstats.RailInfo[] getRailInfo();
-  const int SUCCESS = 0;
-  const int NOT_SUPPORTED = 1;
-  const int INVALID_INPUT = 2;
-  const int FILESYSTEM_ERROR = 3;
-  const int INSUFFICIENT_RESOURCES = 4;
 }
diff --git a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl
index 8cacd55..016af91 100644
--- a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl
+++ b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl
@@ -20,5 +20,5 @@
 parcelable PowerEntityInfo {
   int powerEntityId;
   String powerEntityName;
-  android.hardware.powerstats.PowerEntityType type;
+  android.hardware.powerstats.PowerEntityStateInfo[] states;
 }
diff --git a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityStateSpace.aidl b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityStateSpace.aidl
deleted file mode 100644
index 0508fea..0000000
--- a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityStateSpace.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.powerstats;
-@VintfStability
-parcelable PowerEntityStateSpace {
-  int powerEntityId;
-  android.hardware.powerstats.PowerEntityStateInfo[] states;
-}
diff --git a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityType.aidl b/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityType.aidl
deleted file mode 100644
index 5deefa9..0000000
--- a/powerstats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityType.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.powerstats;
-@Backing(type="int") @VintfStability
-enum PowerEntityType {
-  SUBSYSTEM = 0,
-  PERIPHERAL = 1,
-  POWER_DOMAIN = 2,
-}
diff --git a/powerstats/aidl/android/hardware/powerstats/IPowerStats.aidl b/powerstats/aidl/android/hardware/powerstats/IPowerStats.aidl
index f8f69e0..93d1448 100644
--- a/powerstats/aidl/android/hardware/powerstats/IPowerStats.aidl
+++ b/powerstats/aidl/android/hardware/powerstats/IPowerStats.aidl
@@ -19,17 +19,10 @@
 import android.hardware.powerstats.EnergyData;
 import android.hardware.powerstats.PowerEntityInfo;
 import android.hardware.powerstats.PowerEntityStateResidencyResult;
-import android.hardware.powerstats.PowerEntityStateSpace;
 import android.hardware.powerstats.RailInfo;
 
 @VintfStability
 interface IPowerStats {
-    const int SUCCESS = 0;
-    const int NOT_SUPPORTED = 1;
-    const int INVALID_INPUT = 2;
-    const int FILESYSTEM_ERROR = 3;
-    const int INSUFFICIENT_RESOURCES = 4;
-
     /**
      * Rail level energy measurements for low frequency clients:
      * Reports accumulated energy since boot on each rail.
@@ -53,21 +46,6 @@
     PowerEntityInfo[] getPowerEntityInfo();
 
     /**
-     * PowerEntity state information:
-     * Reports the set of power states for which the specified
-     * PowerEntity(s) provide residency data.
-     *
-     * @param powerEntityIds collection of IDs of PowerEntity(s) for which
-     *     state information is requested. PowerEntity name to ID mapping may
-     *     be queried from getPowerEntityInfo(). To get state space
-     *     information for all PowerEntity(s) pass an empty vector.
-     *
-     * @return PowerEntity state space information for
-     *     each specified PowerEntity that provides state space information.
-     */
-    PowerEntityStateSpace[] getPowerEntityStateInfo(in int[] powerEntityIds);
-
-    /**
      * PowerEntity residencies for low frequency clients:
      * Reports accumulated residency data for each specified PowerEntity.
      * Each PowerEntity may reside in one of multiple states. It may also
diff --git a/powerstats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl b/powerstats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl
index 2b5b352..72222a6 100644
--- a/powerstats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl
+++ b/powerstats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl
@@ -16,7 +16,7 @@
 
 package android.hardware.powerstats;
 
-import android.hardware.powerstats.PowerEntityType;
+import android.hardware.powerstats.PowerEntityStateInfo;
 
 /**
  * PowerEntityInfo contains information, such as the ID, name, and type of a
@@ -33,7 +33,7 @@
      */
     String powerEntityName;
     /**
-     * Type of the PowerEntity
+     * List of states that the PowerEntity may reside in
      */
-    PowerEntityType type;
+    PowerEntityStateInfo[] states;
 }
\ No newline at end of file
diff --git a/powerstats/aidl/android/hardware/powerstats/PowerEntityStateSpace.aidl b/powerstats/aidl/android/hardware/powerstats/PowerEntityStateSpace.aidl
deleted file mode 100644
index 8e30665..0000000
--- a/powerstats/aidl/android/hardware/powerstats/PowerEntityStateSpace.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.powerstats;
-
-import android.hardware.powerstats.PowerEntityStateInfo;
-
-/**
- * PowerEntityStateSpace contains the state space information of a given
- * PowerEntity. The state space, is the set of possible states that a given
- * PowerEntity provides residency data for.
- */
-@VintfStability
-parcelable PowerEntityStateSpace {
-    /**
-     * Unique ID of the corresponding PowerEntity
-     */
-    int powerEntityId;
-    /**
-     * List of states that the PowerEntity may reside in
-     */
-    PowerEntityStateInfo[] states;
-}
-
diff --git a/powerstats/aidl/android/hardware/powerstats/PowerEntityType.aidl b/powerstats/aidl/android/hardware/powerstats/PowerEntityType.aidl
deleted file mode 100644
index a8cd0b7..0000000
--- a/powerstats/aidl/android/hardware/powerstats/PowerEntityType.aidl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.powerstats;
-
-@VintfStability
-@Backing(type="int")
-enum PowerEntityType {
-    /**
-     * A subsystem is a self-contained compute unit. Some examples include
-     * application processor, DSP, GPU.
-     */
-    SUBSYSTEM = 0,
-    /**
-     * A peripheral is an auxiliary device that connects to and works with a
-     * compute unit. Some examples include simple sensors, camera, display.
-     */
-    PERIPHERAL = 1,
-    /**
-     * A power domain is a single subsystem or a collection of subsystems
-     * that is controlled by a single voltage rail.
-     */
-    POWER_DOMAIN = 2,
-}
\ No newline at end of file
diff --git a/powerstats/aidl/default/PowerStats.cpp b/powerstats/aidl/default/PowerStats.cpp
index 50a829e..8d6a0ee 100644
--- a/powerstats/aidl/default/PowerStats.cpp
+++ b/powerstats/aidl/default/PowerStats.cpp
@@ -34,13 +34,7 @@
     (void)_aidl_return;
     return ndk::ScopedAStatus::ok();
 }
-ndk::ScopedAStatus PowerStats::getPowerEntityStateInfo(
-        const std::vector<int32_t>& in_powerEntityIds,
-        std::vector<PowerEntityStateSpace>* _aidl_return) {
-    (void)in_powerEntityIds;
-    (void)_aidl_return;
-    return ndk::ScopedAStatus::ok();
-}
+
 ndk::ScopedAStatus PowerStats::getPowerEntityStateResidencyData(
         const std::vector<int32_t>& in_powerEntityIds,
         std::vector<PowerEntityStateResidencyResult>* _aidl_return) {
@@ -48,6 +42,7 @@
     (void)_aidl_return;
     return ndk::ScopedAStatus::ok();
 }
+
 ndk::ScopedAStatus PowerStats::getRailInfo(std::vector<RailInfo>* _aidl_return) {
     (void)_aidl_return;
     return ndk::ScopedAStatus::ok();
diff --git a/powerstats/aidl/default/PowerStats.h b/powerstats/aidl/default/PowerStats.h
index 392d1e6..49240cb 100644
--- a/powerstats/aidl/default/PowerStats.h
+++ b/powerstats/aidl/default/PowerStats.h
@@ -29,9 +29,6 @@
     ndk::ScopedAStatus getEnergyData(const std::vector<int32_t>& in_railIndices,
                                      std::vector<EnergyData>* _aidl_return) override;
     ndk::ScopedAStatus getPowerEntityInfo(std::vector<PowerEntityInfo>* _aidl_return) override;
-    ndk::ScopedAStatus getPowerEntityStateInfo(
-            const std::vector<int32_t>& in_powerEntityIds,
-            std::vector<PowerEntityStateSpace>* _aidl_return) override;
     ndk::ScopedAStatus getPowerEntityStateResidencyData(
             const std::vector<int32_t>& in_powerEntityIds,
             std::vector<PowerEntityStateResidencyResult>* _aidl_return) override;