summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordianlujitao <dianlujitao@lineageos.org>2021-02-10 12:54:43 +0800
committerMichael Bestas <mkbestas@lineageos.org>2021-03-21 13:58:52 +0100
commit7858a4c515595f94e13bd4bfa6ab3e1d33b87962 (patch)
treea8878e28dd1f439939c021f6a61ac14dec534d92
parentce829a80bc84022e7a49dce342b41839927efa36 (diff)
Add AIDL lineage power HAL
Based on the HIDL variant and redesigned the APIs. Change-Id: I259ec61084c988db9b1a44e3c49060c51b95786a
-rw-r--r--power/aidl/Android.bp33
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/1/.hash1
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Boost.aidl23
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Feature.aidl22
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/IPower.aidl23
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Boost.aidl23
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Feature.aidl22
-rw-r--r--power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/IPower.aidl23
-rw-r--r--power/aidl/vendor/lineage/power/Boost.aidl32
-rw-r--r--power/aidl/vendor/lineage/power/Feature.aidl23
-rw-r--r--power/aidl/vendor/lineage/power/IPower.aidl49
11 files changed, 274 insertions, 0 deletions
diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp
new file mode 100644
index 0000000..3b09acf
--- /dev/null
+++ b/power/aidl/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2021 The LineageOS 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.
+
+aidl_interface {
+ name: "vendor.lineage.power",
+ vendor_available: true,
+ srcs: [
+ "vendor/lineage/power/*.aidl",
+ ],
+ stability: "vintf",
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ ndk: {
+ vndk: {
+ enabled: true,
+ },
+ },
+ },
+ versions: ["1"],
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/1/.hash b/power/aidl/aidl_api/vendor.lineage.power/1/.hash
new file mode 100644
index 0000000..da504ae
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/1/.hash
@@ -0,0 +1 @@
+ace4a945480ce17f280ee29ea1201d1c999bf1e3
diff --git a/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Boost.aidl b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Boost.aidl
new file mode 100644
index 0000000..0708042
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Boost.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@Backing(type="int") @VintfStability
+enum Boost {
+ CPU_BOOST = 0,
+ SET_PROFILE = 1,
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Feature.aidl b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Feature.aidl
new file mode 100644
index 0000000..a781a81
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/Feature.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@Backing(type="int") @VintfStability
+enum Feature {
+ SUPPORTED_PROFILES = 0,
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/IPower.aidl b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/IPower.aidl
new file mode 100644
index 0000000..2da7dfc
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/1/vendor/lineage/power/IPower.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@VintfStability
+interface IPower {
+ int getFeature(in vendor.lineage.power.Feature feature);
+ oneway void setBoost(in vendor.lineage.power.Boost type, in int durationMs);
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Boost.aidl b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Boost.aidl
new file mode 100644
index 0000000..0708042
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Boost.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@Backing(type="int") @VintfStability
+enum Boost {
+ CPU_BOOST = 0,
+ SET_PROFILE = 1,
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Feature.aidl b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Feature.aidl
new file mode 100644
index 0000000..a781a81
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/Feature.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@Backing(type="int") @VintfStability
+enum Feature {
+ SUPPORTED_PROFILES = 0,
+}
diff --git a/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/IPower.aidl b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/IPower.aidl
new file mode 100644
index 0000000..2da7dfc
--- /dev/null
+++ b/power/aidl/aidl_api/vendor.lineage.power/current/vendor/lineage/power/IPower.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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 vendor.lineage.power;
+@VintfStability
+interface IPower {
+ int getFeature(in vendor.lineage.power.Feature feature);
+ oneway void setBoost(in vendor.lineage.power.Boost type, in int durationMs);
+}
diff --git a/power/aidl/vendor/lineage/power/Boost.aidl b/power/aidl/vendor/lineage/power/Boost.aidl
new file mode 100644
index 0000000..0089747
--- /dev/null
+++ b/power/aidl/vendor/lineage/power/Boost.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 The LineageOS 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 vendor.lineage.power;
+
+/**
+ * Power hint identifiers passed to setBoost()
+ */
+@VintfStability
+@Backing(type="int")
+enum Boost {
+ /**
+ * An operation is happening where it would be ideal for the CPU to
+ * be boosted for a specific duration. The data parameter is an
+ * integer value of the boost duration in microseconds.
+ */
+ CPU_BOOST,
+ SET_PROFILE,
+}
diff --git a/power/aidl/vendor/lineage/power/Feature.aidl b/power/aidl/vendor/lineage/power/Feature.aidl
new file mode 100644
index 0000000..a31cccf
--- /dev/null
+++ b/power/aidl/vendor/lineage/power/Feature.aidl
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 The LineageOS 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 vendor.lineage.power;
+
+@VintfStability
+@Backing(type="int")
+enum Feature {
+ SUPPORTED_PROFILES,
+}
diff --git a/power/aidl/vendor/lineage/power/IPower.aidl b/power/aidl/vendor/lineage/power/IPower.aidl
new file mode 100644
index 0000000..7facc13
--- /dev/null
+++ b/power/aidl/vendor/lineage/power/IPower.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 The LineageOS 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 vendor.lineage.power;
+
+import vendor.lineage.power.Boost;
+import vendor.lineage.power.Feature;
+
+@VintfStability
+interface IPower {
+ // Adding return type to method instead of out param int value since there is only one return value.
+ /**
+ * getFeature() is called to get the current value of a particular
+ * feature or capability from the hardware or PowerHAL
+ *
+ * @return the state of power states the device supports
+ * @param feature Feature which needs to get
+ */
+ int getFeature(in Feature feature);
+
+ /**
+ * setBoost() indicates the device may need to boost some resources, as the
+ * the load is likely to increase before the kernel governors can react.
+ * Depending on the boost, it may be appropriate to raise the frequencies of
+ * CPU, GPU, memory subsystem, or stop CPU from going into deep sleep state.
+ * A particular platform may choose to ignore this hint.
+ *
+ * @param type Boost type which is to be set with a timeout.
+ * @param durationMs The expected duration of the user's interaction, if
+ * known, or 0 if the expected duration is unknown.
+ * a negative value indicates canceling previous boost.
+ * A given platform can choose to boost some time based on durationMs,
+ * and may also pick an appropriate timeout for 0 case.
+ */
+ oneway void setBoost(in Boost type, in int durationMs);
+}