Merge "[ConfigStore] Return data space and pixel format for wide color gamut."
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index bc453d8..e117a98 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -286,7 +286,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.neuralnetworks</name>
- <version>1.0</version>
+ <version>1.0-2</version>
<interface>
<name>IDevice</name>
<regex-instance>.*</regex-instance>
diff --git a/configstore/1.2/Android.bp b/configstore/1.2/Android.bp
index c525a72..bb4dd4a 100644
--- a/configstore/1.2/Android.bp
+++ b/configstore/1.2/Android.bp
@@ -10,10 +10,13 @@
"ISurfaceFlingerConfigs.hal",
],
interfaces: [
- "android.hardware.configstore@1.1",
"android.hardware.configstore@1.0",
+ "android.hardware.configstore@1.1",
+ "android.hardware.graphics.common@1.0",
+ "android.hardware.graphics.common@1.1",
"android.hardware.graphics.common@1.2",
"android.hidl.base@1.0",
],
gen_java: true,
}
+
diff --git a/power/stats/1.0/Android.bp b/power/stats/1.0/Android.bp
index 2f16a21..9a956e4 100644
--- a/power/stats/1.0/Android.bp
+++ b/power/stats/1.0/Android.bp
@@ -14,9 +14,15 @@
"android.hidl.base@1.0",
],
types: [
- "Status",
- "RailInfo",
"EnergyData",
+ "PowerEntityInfo",
+ "PowerEntityStateInfo",
+ "PowerEntityStateResidencyData",
+ "PowerEntityStateResidencyResult",
+ "PowerEntityStateSpace",
+ "PowerEntityType",
+ "RailInfo",
+ "Status",
],
gen_java: false,
}
diff --git a/power/stats/1.0/IPowerStats.hal b/power/stats/1.0/IPowerStats.hal
index b5b3cc9..75c6a72 100644
--- a/power/stats/1.0/IPowerStats.hal
+++ b/power/stats/1.0/IPowerStats.hal
@@ -96,4 +96,67 @@
streamEnergyData(uint32_t timeMs, uint32_t samplingRate)
generates(fmq_sync<EnergyData> mqDesc, uint32_t numSamples,
uint32_t railsPerSample, Status status);
+
+ /**
+ * PowerEntity information:
+ * Reports information related to all supported PowerEntity(s) for which
+ * data is available. A PowerEntity is defined as a platform subsystem,
+ * peripheral, or power domain that impacts the total device power
+ * consumption.
+ *
+ * @return powerEntityInfos List of information on each PowerEntity
+ * @return status SUCCESS on success or NOT_SUPPORTED if
+ * feature is not enabled or FILESYSTEM_ERROR on filesystem nodes
+ * access error.
+ */
+ getPowerEntityInfo()
+ generates(vec<PowerEntityInfo> powerEntityInfos, Status status);
+
+ /**
+ * 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 powerEntityStateSpaces PowerEntity state space information for
+ * each specified PowerEntity.
+ * @return status SUCCESS if powerEntityStateInfos contains state space
+ * information for at least one PowerEntity, NOT_SUPPORTED if feature
+ * is not enabled, INVALID_INPUT if no requested PowerEntity(s)
+ * provide state space information, FILESYSTEM_ERROR if no state space
+ * information is returned due to filesystem errors.
+ */
+ getPowerEntityStateInfo(vec<uint32_t> powerEntityIds)
+ generates(vec<PowerEntityStateSpace> powerEntityStateSpaces,
+ Status status);
+
+ /**
+ * 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
+ * transition to another state. Residency data is an accumulation of time
+ * that a specified PowerEntity resided in each of its possible states,
+ * the number of times that each state was entered, and a timestamp
+ * corresponding to the last time that state was entered. Data is
+ * accumulated starting from the last time the PowerEntity was reset.
+ *
+ * @param powerEntityId collection of IDs of PowerEntity(s) for which
+ * residency data is requested. PowerEntity name to ID mapping may
+ * be queried from getPowerEntityInfo(). To get state residency
+ * data for all PowerEntity(s) pass an empty vector.
+ * @return stateResidencyResults state residency data for the
+ * specified powerEntity(s)
+ * @return status SUCCESS if stateResidencyResults contains residency
+ * data for at least one PowerEntity, NOT_SUPPORTED if
+ * feature is not enabled, INVALID_INPUT if no requested
+ * PowerEntity(s) provide state residency data, FILESYSTEM_ERROR
+ * if no data is returned due to filesystem errors.
+ */
+ getPowerEntityStateResidencyData(vec<uint32_t> powerEntityIds)
+ generates(vec<PowerEntityStateResidencyResult> stateResidencyResults,
+ Status status);
};
diff --git a/power/stats/1.0/types.hal b/power/stats/1.0/types.hal
index 703e542..986a6bb 100644
--- a/power/stats/1.0/types.hal
+++ b/power/stats/1.0/types.hal
@@ -36,7 +36,7 @@
struct EnergyData {
/**
- * Index corrensponding to the rail. This index matches
+ * Index corresponding to the rail. This index matches
* the index returned in RailInfo
*/
uint32_t index;
@@ -45,3 +45,85 @@
/** Accumulated energy since device boot in microwatt-seconds (uWs) */
uint64_t energy;
};
+
+enum PowerEntityType : uint32_t {
+ /**
+ * 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,
+};
+
+/**
+ * PowerEntityInfo contains information, such as the ID, name, and type of a
+ * given PowerEntity.
+ */
+struct PowerEntityInfo {
+ /** ID corresponding to the PowerEntity */
+ uint32_t powerEntityId;
+ /**
+ * Name of the PowerEntity. This is unique and opaque to the
+ * Android framework
+ */
+ string powerEntityName;
+ /** Type of the PowerEntity */
+ PowerEntityType type;
+};
+
+struct PowerEntityStateInfo {
+ /** ID corresponding to the state */
+ uint32_t powerEntityStateId;
+ /** Name of the state */
+ string powerEntityStateName;
+};
+
+/**
+ * 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.
+ */
+struct PowerEntityStateSpace {
+ /** ID of the corresponding PowerEntity */
+ uint32_t powerEntityId;
+
+ /** List of states that the PowerEntity may reside in */
+ vec<PowerEntityStateInfo> states;
+};
+
+/** Contains residency data for a single state */
+struct PowerEntityStateResidencyData {
+ /** ID of the corresponding PowerEntityStateInfo */
+ uint32_t powerEntityStateId;
+ /**
+ * Total time in milliseconds that the corresponding PowerEntity resided
+ * in this state since the PowerEntity was reset
+ */
+ uint64_t totalTimeInStateMs;
+ /**
+ * Total number of times that the state was entered since the corresponding
+ * PowerEntity was reset
+ */
+ uint64_t totalStateEntryCount;
+ /**
+ * Last time this state was entered. Time in milliseconds since the
+ * corresponding PowerEntity was reset
+ */
+ uint64_t lastEntryTimestampMs;
+};
+
+struct PowerEntityStateResidencyResult {
+ /** ID of the corresponding PowerEntity */
+ uint32_t powerEntityId;
+ /** Residency data for each state the PowerEntity's state space */
+ vec<PowerEntityStateResidencyData> stateResidencyData;
+};
diff --git a/sensors/2.0/default/Sensor.cpp b/sensors/2.0/default/Sensor.cpp
index 21c1591..d3e3f7e 100644
--- a/sensors/2.0/default/Sensor.cpp
+++ b/sensors/2.0/default/Sensor.cpp
@@ -24,6 +24,7 @@
namespace V2_0 {
namespace implementation {
+using ::android::hardware::sensors::V1_0::MetaDataEventType;
using ::android::hardware::sensors::V1_0::SensorFlagBits;
using ::android::hardware::sensors::V1_0::SensorStatus;
@@ -64,6 +65,25 @@
}
}
+Result Sensor::flush() {
+ // Only generate a flush complete event if the sensor is enabled and if the sensor is not a
+ // one-shot sensor.
+ if (!mIsEnabled || (mSensorInfo.flags & static_cast<uint32_t>(SensorFlagBits::ONE_SHOT_MODE))) {
+ return Result::BAD_VALUE;
+ }
+
+ // Note: If a sensor supports batching, write all of the currently batched events for the sensor
+ // to the Event FMQ prior to writing the flush complete event.
+ Event ev;
+ ev.sensorHandle = mSensorInfo.sensorHandle;
+ ev.sensorType = SensorType::ADDITIONAL_INFO;
+ ev.u.meta.what = MetaDataEventType::META_DATA_FLUSH_COMPLETE;
+ std::vector<Event> evs{ev};
+ mCallback->postEvents(evs);
+
+ return Result::OK;
+}
+
void Sensor::startThread(Sensor* sensor) {
sensor->run();
}
diff --git a/sensors/2.0/default/Sensor.h b/sensors/2.0/default/Sensor.h
index e467b56..75d9aab 100644
--- a/sensors/2.0/default/Sensor.h
+++ b/sensors/2.0/default/Sensor.h
@@ -25,6 +25,7 @@
#include <vector>
using ::android::hardware::sensors::V1_0::Event;
+using ::android::hardware::sensors::V1_0::Result;
using ::android::hardware::sensors::V1_0::SensorInfo;
using ::android::hardware::sensors::V1_0::SensorType;
@@ -48,6 +49,7 @@
const SensorInfo& getSensorInfo() const;
void batch(int32_t samplingPeriodNs);
void activate(bool enable);
+ Result flush();
protected:
void run();
diff --git a/sensors/2.0/default/Sensors.cpp b/sensors/2.0/default/Sensors.cpp
index 39c1ded..cceb7d5 100644
--- a/sensors/2.0/default/Sensors.cpp
+++ b/sensors/2.0/default/Sensors.cpp
@@ -112,9 +112,12 @@
return Result::BAD_VALUE;
}
-Return<Result> Sensors::flush(int32_t /* sensorHandle */) {
- // TODO implement
- return Result{};
+Return<Result> Sensors::flush(int32_t sensorHandle) {
+ auto sensor = mSensors.find(sensorHandle);
+ if (sensor != mSensors.end()) {
+ return sensor->second->flush();
+ }
+ return Result::BAD_VALUE;
}
Return<Result> Sensors::injectSensorData(const Event& /* event */) {