Merge "Simplify slicing related structs."
diff --git a/audio/7.0/IDevice.hal b/audio/7.0/IDevice.hal
index e423f29..85c789a 100644
--- a/audio/7.0/IDevice.hal
+++ b/audio/7.0/IDevice.hal
@@ -245,6 +245,7 @@
/**
* Gets the HW synchronization source of the device. Calling this method is
* equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
+ *
* Optional method
*
* @return retval operation completion status: OK or NOT_SUPPORTED.
@@ -255,6 +256,7 @@
/**
* Sets whether the screen is on. Calling this method is equivalent to
* setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
+ *
* Optional method
*
* @param turnedOn whether the screen is turned on.
diff --git a/audio/7.0/IStream.hal b/audio/7.0/IStream.hal
index 393e38f..e4987c2 100644
--- a/audio/7.0/IStream.hal
+++ b/audio/7.0/IStream.hal
@@ -110,6 +110,7 @@
/**
* Return the set of devices which this stream is connected to.
+ *
* Optional method
*
* @return retval operation completion status: OK or NOT_SUPPORTED.
@@ -133,6 +134,7 @@
/**
* Sets the HW synchronization source. Calling this method is equivalent to
* setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
+ *
* Optional method
*
* @param hwAvSync HW synchronization source
diff --git a/audio/7.0/IStreamIn.hal b/audio/7.0/IStreamIn.hal
index bf9ae52..be4bda4 100644
--- a/audio/7.0/IStreamIn.hal
+++ b/audio/7.0/IStreamIn.hal
@@ -24,6 +24,7 @@
* Returns the source descriptor of the input stream. Calling this method is
* equivalent to getting AUDIO_PARAMETER_STREAM_INPUT_SOURCE on the legacy
* HAL.
+ *
* Optional method
*
* @return retval operation completion status.
@@ -33,6 +34,7 @@
/**
* Set the input gain for the audio driver.
+ *
* Optional method
*
* @param gain 1.0f is unity, 0.0f is zero.
@@ -42,6 +44,7 @@
/**
* Called when the metadata of the stream's sink has been changed.
+ *
* Optional method
*
* @param sinkMetadata Description of the audio that is suggested by the clients.
@@ -148,7 +151,8 @@
/**
* Return a recent count of the number of audio frames received and the
- * clock time associated with that frame count.
+ * clock time associated with that frame count. The count must not reset to
+ * zero when a PCM input enters standby.
*
* @return retval INVALID_STATE if the device is not ready/available,
* NOT_SUPPORTED if the command is not supported,
diff --git a/audio/7.0/IStreamOut.hal b/audio/7.0/IStreamOut.hal
index 4daab26..359dce4 100644
--- a/audio/7.0/IStreamOut.hal
+++ b/audio/7.0/IStreamOut.hal
@@ -35,6 +35,7 @@
* allowing to directly set the volume as apposed to via the framework.
* This method might produce multiple PCM outputs or hardware accelerated
* codecs, such as MP3 or AAC.
+ *
* Optional method
*
* @param left left channel attenuation, 1.0f is unity, 0.0f is zero.
@@ -46,6 +47,7 @@
/**
* Called when the metadata of the stream's source has been changed.
+ *
* Optional method
*
* @param sourceMetadata Description of the audio that is played by the clients.
@@ -130,6 +132,7 @@
/**
* Return the number of audio frames written by the audio DSP to DAC since
* the output has exited standby.
+ *
* Optional method
*
* @return retval operation completion status.
@@ -141,6 +144,7 @@
* Get the local time at which the next write to the audio driver will be
* presented. The units are microseconds, where the epoch is decided by the
* local audio HAL.
+ *
* Optional method
*
* @return retval operation completion status.
@@ -253,8 +257,11 @@
drain(AudioDrain type) generates (Result retval);
/**
- * Notifies to the audio driver to flush the queued data. Stream must
- * already be paused before calling 'flush'.
+ * Notifies to the audio driver to flush (that is, drop) the queued
+ * data. Stream must already be paused before calling 'flush'. For
+ * compressed and offload streams the frame count returned by
+ * 'getPresentationPosition' must reset after flush.
+ *
* Optional method
*
* Implementation of this function is mandatory for offloaded playback.
@@ -266,12 +273,14 @@
/**
* Return a recent count of the number of audio frames presented to an
* external observer. This excludes frames which have been written but are
- * still in the pipeline. The count is not reset to zero when output enters
- * standby. Also returns the value of CLOCK_MONOTONIC as of this
+ * still in the pipeline. The count must not reset to zero when a PCM output
+ * enters standby. For compressed and offload streams it is recommended that
+ * HAL resets the frame count.
+ *
+ * This method also returns the value of CLOCK_MONOTONIC as of this
* presentation count. The returned count is expected to be 'recent', but
* does not need to be the most recent possible value. However, the
* associated time must correspond to whatever count is returned.
- *
* Example: assume that N+M frames have been presented, where M is a 'small'
* number. Then it is permissible to return N instead of N+M, and the
* timestamp must correspond to N rather than N+M. The terms 'recent' and
@@ -289,6 +298,7 @@
/**
* Selects a presentation for decoding from a next generation media stream
* (as defined per ETSI TS 103 190-2) and a program within the presentation.
+ *
* Optional method
*
* @param presentationId selected audio presentation.
diff --git a/audio/common/7.0/types.hal b/audio/common/7.0/types.hal
index bea0705..4f920e4 100644
--- a/audio/common/7.0/types.hal
+++ b/audio/common/7.0/types.hal
@@ -344,7 +344,7 @@
DeviceAddress device;
} destination;
AudioChannelMask channelMask;
- /** Tags from AudioTrack audio atttributes */
+ /** Tags from AudioRecord audio atttributes */
vec<AudioTag> tags;
};
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 5ba7a76..362ab41 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -495,7 +495,7 @@
* invoked carrying a proper selector;
* - program changes exactly to what was requested.
*/
-TEST_F(BroadcastRadioHalTest, DabTune) {
+TEST_P(BroadcastRadioHalTest, DabTune) {
ASSERT_TRUE(openSession());
ProgramSelector sel = {};
diff --git a/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
index 7a95f74..edc43ea 100644
--- a/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
@@ -32,7 +32,7 @@
* A PowerEntity is defined as a platform subsystem, peripheral, or power domain that impacts
* the total device power consumption.
*
- * @return List of information on each PowerEntity
+ * @return List of information on each PowerEntity for which state residency can be requested.
*/
PowerEntity[] getPowerEntityInfo();
@@ -52,11 +52,12 @@
* Passing an empty list will return state residency for all available PowerEntitys.
* ID of each PowerEntity is contained in PowerEntityInfo.
*
- * @return StateResidency since boot for each requested PowerEntity
+ * @return StateResidencyResults since boot for each requested and available PowerEntity. Note
+ * that StateResidencyResult for a given PowerEntity may not always be available. Clients shall
+ * not rely on StateResidencyResult always being returned for every request.
*
- * Returns the following service-specific exceptions in order of highest priority:
- * - STATUS_BAD_VALUE if an invalid powerEntityId is provided
- * - STATUS_FAILED_TRANSACTION if any StateResidencyResult fails to be returned
+ * Returns the following exception codes:
+ * - EX_ILLEGAL_ARGUMENT if an invalid powerEntityId is provided
*/
StateResidencyResult[] getStateResidency(in int[] powerEntityIds);
@@ -66,7 +67,7 @@
* An EnergyConsumer is a device subsystem or peripheral that consumes energy. Energy
* consumption data may be used by framework for the purpose of power attribution.
*
- * @return List of EnergyConsumers that are available.
+ * @return List of EnergyConsumers for which energy consumption can be requested.
*/
EnergyConsumer[] getEnergyConsumerInfo();
@@ -74,38 +75,40 @@
* Reports the energy consumed since boot by each requested EnergyConsumer.
*
* @param energyConsumerIds List of IDs of EnergyConsumers for which data is requested.
- * Passing an empty list will return state residency for all available EnergyConsumers.
+ * Passing an empty list will return results for all available EnergyConsumers.
*
- * @return Energy consumed since boot for each requested EnergyConsumer
+ * @return Energy consumed since boot for each requested and available EnergyConsumer. Note
+ * that EnergyConsumerResult for a given EnergyConsumer may not always be available. Clients
+ * shall not rely on EnergyConsumerResult always being returned for every request.
*
- * Returns the following service-specific exceptions in order of highest priority:
- * - STATUS_BAD_VALUE if an invalid energyConsumerId is provided
- * - STATUS_FAILED_TRANSACTION if any EnergyConsumerResult fails to be returned
+ * Returns the following exception codes:
+ * - EX_ILLEGAL_ARGUMENT if an invalid energyConsumerId is provided
*/
EnergyConsumerResult[] getEnergyConsumed(in int[] energyConsumerIds);
/**
- * Return information related to all channels monitored by Energy Meters.
+ * Return information related to all Channels monitored by Energy Meters.
*
* An Energy Meter is a device that monitors energy and may support monitoring multiple
* channels simultaneously. A channel may correspond a bus, sense resistor, or power rail.
*
- * @return Channels monitored by Energy Meters.
+ * @return All Channels for which energy measurements can be requested.
*/
Channel[] getEnergyMeterInfo();
/**
- * Reports accumulated energy for each specified channel.
+ * Reports accumulated energy for each specified Channel.
*
* @param channelIds IDs of channels for which data is requested.
* Passing an empty list will return energy measurements for all available channels.
* ID of each channel is contained in ChannelInfo.
*
- * @return Energy measured since boot for each requested channel
+ * @return Energy measured since boot for each requested and available Channel. Note
+ * that EnergyMeasurement for a given Channel may not always be available. Clients
+ * shall not rely on EnergyMeasurement always being returned for every request.
*
- * Returns the following service-specific exceptions in order of highest priority:
- * - STATUS_BAD_VALUE if an invalid channelId is provided
- * - STATUS_FAILED_TRANSACTION if any EnergyMeasurement fails to be returned
+ * Returns the following exception codes:
+ * - EX_ILLEGAL_ARGUMENT if an invalid channelId is provided
*/
EnergyMeasurement[] readEnergyMeter(in int[] channelIds);
}
diff --git a/power/stats/aidl/default/FakeEnergyMeter.h b/power/stats/aidl/default/FakeEnergyMeter.h
index f0d4ee7..56dcdcc 100644
--- a/power/stats/aidl/default/FakeEnergyMeter.h
+++ b/power/stats/aidl/default/FakeEnergyMeter.h
@@ -60,9 +60,12 @@
*_aidl_return = mEnergyMeasurements;
} else {
for (int32_t id : in_channelIds) {
- if (id >= 0 && id < mEnergyMeasurements.size()) {
- _aidl_return->push_back(mEnergyMeasurements[id]);
+ // check for invalid ids
+ if (id < 0 || id >= mEnergyMeasurements.size()) {
+ return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
}
+
+ _aidl_return->push_back(mEnergyMeasurements[id]);
}
}
diff --git a/power/stats/aidl/default/PowerStats.cpp b/power/stats/aidl/default/PowerStats.cpp
index 1373502..7cf591e 100644
--- a/power/stats/aidl/default/PowerStats.cpp
+++ b/power/stats/aidl/default/PowerStats.cpp
@@ -81,14 +81,12 @@
return getStateResidency(v, _aidl_return);
}
- binder_status_t err = STATUS_OK;
-
std::unordered_map<std::string, std::vector<StateResidency>> stateResidencies;
for (const int32_t id : in_powerEntityIds) {
- // skip any invalid ids
+ // check for invalid ids
if (id < 0 || id >= mPowerEntityInfos.size()) {
- continue;
+ return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
}
// Check to see if we already have data for the given id
@@ -106,12 +104,12 @@
};
_aidl_return->emplace_back(res);
} else {
- // Failed to retrieve results for the given id.
- err = STATUS_FAILED_TRANSACTION;
+ // Failed to get results for the given id.
+ LOG(ERROR) << "Failed to get results for " << powerEntityName;
}
}
- return ndk::ScopedAStatus::fromStatus(err);
+ return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus PowerStats::getEnergyConsumerInfo(std::vector<EnergyConsumer>* _aidl_return) {
@@ -132,12 +130,10 @@
return getEnergyConsumed(v, _aidl_return);
}
- binder_status_t err = STATUS_OK;
-
for (const auto id : in_energyConsumerIds) {
- // skip any invalid ids
+ // check for invalid ids
if (id < 0 || id >= mEnergyConsumers.size()) {
- continue;
+ return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
}
auto optionalResult = mEnergyConsumers[id]->getEnergyConsumed();
@@ -146,12 +142,12 @@
result.id = id;
_aidl_return->emplace_back(result);
} else {
- // Failed to retrieve results for the given id.
- err = STATUS_FAILED_TRANSACTION;
+ // Failed to get results for the given id.
+ LOG(ERROR) << "Failed to get results for " << mEnergyConsumerInfos[id].name;
}
}
- return ndk::ScopedAStatus::fromStatus(err);
+ return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus PowerStats::getEnergyMeterInfo(std::vector<Channel>* _aidl_return) {