Merge "Add .rc for vehicle HAL"
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
index 984a095..2ded34b 100644
--- a/audio/2.0/Android.bp
+++ b/audio/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.audio@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
srcs: [
"types.hal",
"IDevice.hal",
@@ -28,8 +28,8 @@
genrule {
name: "android.hardware.audio@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
srcs: [
"types.hal",
"IDevice.hal",
@@ -97,5 +97,7 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.effect@2.0",
],
}
diff --git a/audio/2.0/IDevice.hal b/audio/2.0/IDevice.hal
index 84e0d28..38bfe21 100644
--- a/audio/2.0/IDevice.hal
+++ b/audio/2.0/IDevice.hal
@@ -180,19 +180,20 @@
/*
* Gets the HW synchronization source of the device. Calling this method is
- * equivalent to getting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy
- * HAL.
+ * equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
*
- * @return retval operation completion status.
* @return hwAvSync HW synchronization source
*/
- getHwAvSync() generates (Result retval, AudioHwSync hwAvSync);
+ getHwAvSync() generates (AudioHwSync hwAvSync);
/*
* Sets whether the screen is on. Calling this method is equivalent to
* setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
+ *
+ * @param turnedOn whether the screen is turned on.
+ * @return retval operation completion status.
*/
- setScreenState(bool turnedOn);
+ setScreenState(bool turnedOn) generates (Result retval);
/*
* Generic method for retrieving vendor-specific parameter values.
diff --git a/audio/2.0/IStream.hal b/audio/2.0/IStream.hal
index 09ba42a..dc43346 100644
--- a/audio/2.0/IStream.hal
+++ b/audio/2.0/IStream.hal
@@ -134,18 +134,20 @@
/*
* Applies audio effect to the stream.
*
- * @param effect the effect to apply.
+ * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
+ * the effect to apply.
* @return retval operation completion status.
*/
- addEffect(IEffect effect) generates (Result retval);
+ addEffect(uint64_t effectId) generates (Result retval);
/*
* Stops application of the effect to the stream.
*
- * @param effect the effect to apply.
+ * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
+ * the effect to remove.
* @return retval operation completion status.
*/
- removeEffect(IEffect effect) generates (Result retval);
+ removeEffect(uint64_t effectId) generates (Result retval);
/*
* Put the audio hardware input/output into standby mode.
@@ -158,10 +160,9 @@
/*
* Return the set of device(s) which this stream is connected to.
*
- * @return retval operation completion status.
* @return device set of device(s) which this stream is connected to.
*/
- getDevice() generates (Result retval, AudioDevice device);
+ getDevice() generates (AudioDevice device);
/*
* Connects the stream to the device.
diff --git a/audio/2.0/IStreamIn.hal b/audio/2.0/IStreamIn.hal
index 049df75..6cf7425 100644
--- a/audio/2.0/IStreamIn.hal
+++ b/audio/2.0/IStreamIn.hal
@@ -61,10 +61,9 @@
* typically occurs when the user space process is blocked longer than the
* capacity of audio driver buffers.
*
- * @return retval operation completion status.
* @return framesLost the number of input audio frames lost.
*/
- getInputFramesLost() generates (Result retval, uint32_t framesLost);
+ getInputFramesLost() generates (uint32_t framesLost);
/**
* Return a recent count of the number of audio frames received and the
diff --git a/audio/2.0/IStreamOut.hal b/audio/2.0/IStreamOut.hal
index adce538..55a852d 100644
--- a/audio/2.0/IStreamOut.hal
+++ b/audio/2.0/IStreamOut.hal
@@ -142,12 +142,12 @@
* 'setCallback' has not been called, then 'drain' must block until
* completion.
*
- * If 'type' is 'AUDIO_DRAIN_ALL', the drain completes when all previously
- * written data has been played.
+ * If 'type' is 'ALL', the drain completes when all previously written data
+ * has been played.
*
- * If 'type' is 'AUDIO_DRAIN_EARLY_NOTIFY', the drain completes shortly
- * before all data for the current track has played to allow time for the
- * framework to perform a gapless track switch.
+ * If 'type' is 'EARLY_NOTIFY', the drain completes shortly before all data
+ * for the current track has played to allow time for the framework to
+ * perform a gapless track switch.
*
* Drain must return immediately on 'stop' and 'flush' calls.
*
diff --git a/audio/2.0/default/Android.mk b/audio/2.0/default/Android.mk
index a987b41..a5c0383 100644
--- a/audio/2.0/default/Android.mk
+++ b/audio/2.0/default/Android.mk
@@ -17,20 +17,53 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio@2.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ Conversions.cpp \
+ Device.cpp \
+ DevicesFactory.cpp \
+ ParametersUtil.cpp \
+ PrimaryDevice.cpp \
+ Stream.cpp \
+ StreamIn.cpp \
+ StreamOut.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libhidl \
+ libhwbinder \
+ libutils \
+ libhardware \
+ liblog \
+ android.hardware.audio@2.0 \
+ android.hardware.audio.common@2.0 \
+ android.hardware.audio.common@2.0-util \
+
+LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper
+
+include $(BUILD_SHARED_LIBRARY)
+
+#
+# Service
+#
+
+include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.audio@2.0-service
LOCAL_INIT_RC := android.hardware.audio@2.0-service.rc
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
- service.cpp
+ service.cpp
LOCAL_SHARED_LIBRARIES := \
- libhidl \
- liblog \
- libhwbinder \
- libutils \
- libhardware \
- android.hardware.soundtrigger@2.0 \
- android.hardware.audio.common@2.0
+ libhidl \
+ liblog \
+ libhwbinder \
+ libutils \
+ libhardware \
+ android.hardware.audio@2.0 \
+ android.hardware.audio.common@2.0 \
+ android.hardware.audio.effect@2.0 \
+ android.hardware.soundtrigger@2.0 \
ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
LOCAL_MULTILIB := 32
diff --git a/audio/2.0/default/Conversions.cpp b/audio/2.0/default/Conversions.cpp
new file mode 100644
index 0000000..1ba16e1
--- /dev/null
+++ b/audio/2.0/default/Conversions.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <stdio.h>
+
+#include "Conversions.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+std::string deviceAddressToHal(const DeviceAddress& address) {
+ // HAL assumes that the address is NUL-terminated.
+ char halAddress[AUDIO_DEVICE_MAX_ADDRESS_LEN];
+ memset(halAddress, 0, sizeof(halAddress));
+ uint32_t halDevice = static_cast<uint32_t>(address.device);
+ if ((halDevice & AUDIO_DEVICE_OUT_ALL_A2DP) != 0
+ || (halDevice & AUDIO_DEVICE_IN_BLUETOOTH_A2DP) != 0) {
+ snprintf(halAddress, sizeof(halAddress),
+ "%02X:%02X:%02X:%02X:%02X:%02X",
+ address.address.mac[0], address.address.mac[1], address.address.mac[2],
+ address.address.mac[3], address.address.mac[4], address.address.mac[5]);
+ } else if ((halDevice & AUDIO_DEVICE_OUT_IP) != 0 || (halDevice & AUDIO_DEVICE_IN_IP) != 0) {
+ snprintf(halAddress, sizeof(halAddress),
+ "%d.%d.%d.%d",
+ address.address.ipv4[0], address.address.ipv4[1],
+ address.address.ipv4[2], address.address.ipv4[3]);
+ } else if ((halDevice & AUDIO_DEVICE_OUT_ALL_USB) != 0
+ || (halDevice & AUDIO_DEVICE_IN_ALL_USB) != 0) {
+ snprintf(halAddress, sizeof(halAddress),
+ "card=%d;device=%d",
+ address.address.alsa.card, address.address.alsa.device);
+ } else if ((halDevice & AUDIO_DEVICE_OUT_BUS) != 0 || (halDevice & AUDIO_DEVICE_IN_BUS) != 0) {
+ snprintf(halAddress, sizeof(halAddress),
+ "%s", address.busAddress.c_str());
+ } else if ((halDevice & AUDIO_DEVICE_OUT_REMOTE_SUBMIX) != 0
+ || (halDevice & AUDIO_DEVICE_IN_REMOTE_SUBMIX) != 0) {
+ snprintf(halAddress, sizeof(halAddress),
+ "%s", address.rSubmixAddress.c_str());
+ }
+ return halAddress;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/Conversions.h b/audio/2.0/default/Conversions.h
new file mode 100644
index 0000000..ebda5c5
--- /dev/null
+++ b/audio/2.0/default/Conversions.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef android_hardware_audio_V2_0_Conversions_H_
+#define android_hardware_audio_V2_0_Conversions_H_
+
+#include <string>
+
+#include <android/hardware/audio/2.0/types.h>
+#include <system/audio.h>
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::V2_0::DeviceAddress;
+
+std::string deviceAddressToHal(const DeviceAddress& address);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_audio_V2_0_Conversions_H_
diff --git a/audio/2.0/default/Device.cpp b/audio/2.0/default/Device.cpp
new file mode 100644
index 0000000..05824c7
--- /dev/null
+++ b/audio/2.0/default/Device.cpp
@@ -0,0 +1,534 @@
+ /*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "DeviceHAL"
+
+#include <algorithm>
+#include <memory.h>
+#include <string.h>
+
+#include <utils/Log.h>
+
+#include "Conversions.h"
+#include "Device.h"
+#include "StreamIn.h"
+#include "StreamOut.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+Device::Device(audio_hw_device_t* device)
+ : mDevice(device) {
+}
+
+Device::~Device() {
+ int status = audio_hw_device_close(mDevice);
+ ALOGW_IF(status, "Error closing audio hw device %p: %s", mDevice, strerror(-status));
+ mDevice = nullptr;
+}
+
+// static
+void Device::audioConfigToHal(const AudioConfig& config, audio_config_t* halConfig) {
+ memset(halConfig, 0, sizeof(audio_config_t));
+ halConfig->sample_rate = config.sampleRateHz;
+ halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
+ halConfig->format = static_cast<audio_format_t>(config.format);
+ audioOffloadInfoToHal(config.offloadInfo, &halConfig->offload_info);
+ halConfig->frame_count = config.frameCount;
+}
+
+// static
+void Device::audioGainConfigFromHal(
+ const struct audio_gain_config& halConfig, AudioGainConfig* config) {
+ config->index = halConfig.index;
+ config->mode = AudioGainMode(halConfig.mode);
+ config->channelMask = AudioChannelMask(halConfig.channel_mask);
+ for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
+ config->values[i] = halConfig.values[i];
+ }
+ config->rampDurationMs = halConfig.ramp_duration_ms;
+}
+
+// static
+void Device::audioGainConfigToHal(
+ const AudioGainConfig& config, struct audio_gain_config* halConfig) {
+ halConfig->index = config.index;
+ halConfig->mode = static_cast<audio_gain_mode_t>(config.mode);
+ halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
+ memset(halConfig->values, 0, sizeof(halConfig->values));
+ for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
+ halConfig->values[i] = config.values[i];
+ }
+ halConfig->ramp_duration_ms = config.rampDurationMs;
+}
+
+// static
+void Device::audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain) {
+ gain->mode = AudioGainMode(halGain.mode);
+ gain->channelMask = AudioChannelMask(halGain.channel_mask);
+ gain->minValue = halGain.min_value;
+ gain->maxValue = halGain.max_value;
+ gain->defaultValue = halGain.default_value;
+ gain->stepValue = halGain.step_value;
+ gain->minRampMs = halGain.min_ramp_ms;
+ gain->maxRampMs = halGain.max_ramp_ms;
+}
+
+// static
+void Device::audioGainToHal(const AudioGain& gain, struct audio_gain* halGain) {
+ halGain->mode = static_cast<audio_gain_mode_t>(gain.mode);
+ halGain->channel_mask = static_cast<audio_channel_mask_t>(gain.channelMask);
+ halGain->min_value = gain.minValue;
+ halGain->max_value = gain.maxValue;
+ halGain->default_value = gain.defaultValue;
+ halGain->step_value = gain.stepValue;
+ halGain->min_ramp_ms = gain.minRampMs;
+ halGain->max_ramp_ms = gain.maxRampMs;
+}
+
+// static
+void Device::audioOffloadInfoToHal(
+ const AudioOffloadInfo& offload, audio_offload_info_t* halOffload) {
+ *halOffload = AUDIO_INFO_INITIALIZER;
+ halOffload->sample_rate = offload.sampleRateHz;
+ halOffload->channel_mask = static_cast<audio_channel_mask_t>(offload.channelMask);
+ halOffload->stream_type = static_cast<audio_stream_type_t>(offload.streamType);
+ halOffload->bit_rate = offload.bitRatePerSecond;
+ halOffload->duration_us = offload.durationMicroseconds;
+ halOffload->has_video = offload.hasVideo;
+ halOffload->is_streaming = offload.isStreaming;
+}
+
+// static
+void Device::audioPortConfigFromHal(
+ const struct audio_port_config& halConfig, AudioPortConfig* config) {
+ config->id = halConfig.id;
+ config->role = AudioPortRole(halConfig.role);
+ config->type = AudioPortType(halConfig.type);
+ config->configMask = AudioPortConfigMask(halConfig.config_mask);
+ config->sampleRateHz = halConfig.sample_rate;
+ config->channelMask = AudioChannelMask(halConfig.channel_mask);
+ config->format = AudioFormat(halConfig.format);
+ audioGainConfigFromHal(halConfig.gain, &config->gain);
+ switch (halConfig.type) {
+ case AUDIO_PORT_TYPE_NONE: break;
+ case AUDIO_PORT_TYPE_DEVICE: {
+ config->ext.device.hwModule = halConfig.ext.device.hw_module;
+ config->ext.device.type = AudioDevice(halConfig.ext.device.type);
+ memcpy(config->ext.device.address.data(),
+ halConfig.ext.device.address,
+ AUDIO_DEVICE_MAX_ADDRESS_LEN);
+ break;
+ }
+ case AUDIO_PORT_TYPE_MIX: {
+ config->ext.mix.hwModule = halConfig.ext.mix.hw_module;
+ config->ext.mix.ioHandle = halConfig.ext.mix.handle;
+ if (halConfig.role == AUDIO_PORT_ROLE_SOURCE) {
+ config->ext.mix.useCase.source = AudioSource(halConfig.ext.mix.usecase.source);
+ } else if (halConfig.role == AUDIO_PORT_ROLE_SINK) {
+ config->ext.mix.useCase.stream = AudioStreamType(halConfig.ext.mix.usecase.stream);
+ }
+ break;
+ }
+ case AUDIO_PORT_TYPE_SESSION: {
+ config->ext.session.session = halConfig.ext.session.session;
+ break;
+ }
+ }
+}
+
+// static
+void Device::audioPortConfigToHal(
+ const AudioPortConfig& config, struct audio_port_config* halConfig) {
+ memset(halConfig, 0, sizeof(audio_port_config));
+ halConfig->id = config.id;
+ halConfig->role = static_cast<audio_port_role_t>(config.role);
+ halConfig->type = static_cast<audio_port_type_t>(config.type);
+ halConfig->config_mask = static_cast<unsigned int>(config.configMask);
+ halConfig->sample_rate = config.sampleRateHz;
+ halConfig->channel_mask = static_cast<audio_channel_mask_t>(config.channelMask);
+ halConfig->format = static_cast<audio_format_t>(config.format);
+ audioGainConfigToHal(config.gain, &halConfig->gain);
+ switch (config.type) {
+ case AudioPortType::NONE: break;
+ case AudioPortType::DEVICE: {
+ halConfig->ext.device.hw_module = config.ext.device.hwModule;
+ halConfig->ext.device.type = static_cast<audio_devices_t>(config.ext.device.type);
+ memcpy(halConfig->ext.device.address,
+ config.ext.device.address.data(),
+ AUDIO_DEVICE_MAX_ADDRESS_LEN);
+ break;
+ }
+ case AudioPortType::MIX: {
+ halConfig->ext.mix.hw_module = config.ext.mix.hwModule;
+ halConfig->ext.mix.handle = config.ext.mix.ioHandle;
+ if (config.role == AudioPortRole::SOURCE) {
+ halConfig->ext.mix.usecase.source =
+ static_cast<audio_source_t>(config.ext.mix.useCase.source);
+ } else if (config.role == AudioPortRole::SINK) {
+ halConfig->ext.mix.usecase.stream =
+ static_cast<audio_stream_type_t>(config.ext.mix.useCase.stream);
+ }
+ break;
+ }
+ case AudioPortType::SESSION: {
+ halConfig->ext.session.session =
+ static_cast<audio_session_t>(config.ext.session.session);
+ break;
+ }
+ }
+}
+
+// static
+std::unique_ptr<audio_port_config[]> Device::audioPortConfigsToHal(
+ const hidl_vec<AudioPortConfig>& configs) {
+ std::unique_ptr<audio_port_config[]> halConfigs(new audio_port_config[configs.size()]);
+ for (size_t i = 0; i < configs.size(); ++i) {
+ audioPortConfigToHal(configs[i], &halConfigs[i]);
+ }
+ return halConfigs;
+}
+
+// static
+void Device::audioPortFromHal(const struct audio_port& halPort, AudioPort* port) {
+ port->id = halPort.id;
+ port->role = AudioPortRole(halPort.role);
+ port->type = AudioPortType(halPort.type);
+ port->name.setToExternal(halPort.name, strlen(halPort.name));
+ port->sampleRates.resize(halPort.num_sample_rates);
+ for (size_t i = 0; i < halPort.num_sample_rates; ++i) {
+ port->sampleRates[i] = halPort.sample_rates[i];
+ }
+ port->channelMasks.resize(halPort.num_channel_masks);
+ for (size_t i = 0; i < halPort.num_channel_masks; ++i) {
+ port->channelMasks[i] = AudioChannelMask(halPort.channel_masks[i]);
+ }
+ port->formats.resize(halPort.num_formats);
+ for (size_t i = 0; i < halPort.num_formats; ++i) {
+ port->formats[i] = AudioFormat(halPort.formats[i]);
+ }
+ port->gains.resize(halPort.num_gains);
+ for (size_t i = 0; i < halPort.num_gains; ++i) {
+ audioGainFromHal(halPort.gains[i], &port->gains[i]);
+ }
+ audioPortConfigFromHal(halPort.active_config, &port->activeConfig);
+ switch (halPort.type) {
+ case AUDIO_PORT_TYPE_NONE: break;
+ case AUDIO_PORT_TYPE_DEVICE: {
+ port->ext.device.hwModule = halPort.ext.device.hw_module;
+ port->ext.device.type = AudioDevice(halPort.ext.device.type);
+ memcpy(port->ext.device.address.data(),
+ halPort.ext.device.address,
+ AUDIO_DEVICE_MAX_ADDRESS_LEN);
+ break;
+ }
+ case AUDIO_PORT_TYPE_MIX: {
+ port->ext.mix.hwModule = halPort.ext.mix.hw_module;
+ port->ext.mix.ioHandle = halPort.ext.mix.handle;
+ port->ext.mix.latencyClass = AudioMixLatencyClass(halPort.ext.mix.latency_class);
+ break;
+ }
+ case AUDIO_PORT_TYPE_SESSION: {
+ port->ext.session.session = halPort.ext.session.session;
+ break;
+ }
+ }
+}
+
+// static
+void Device::audioPortToHal(const AudioPort& port, struct audio_port* halPort) {
+ memset(halPort, 0, sizeof(audio_port));
+ halPort->id = port.id;
+ halPort->role = static_cast<audio_port_role_t>(port.role);
+ halPort->type = static_cast<audio_port_type_t>(port.type);
+ memcpy(halPort->name,
+ port.name.c_str(),
+ std::min(port.name.size(), static_cast<size_t>(AUDIO_PORT_MAX_NAME_LEN)));
+ halPort->num_sample_rates =
+ std::min(port.sampleRates.size(), static_cast<size_t>(AUDIO_PORT_MAX_SAMPLING_RATES));
+ for (size_t i = 0; i < halPort->num_sample_rates; ++i) {
+ halPort->sample_rates[i] = port.sampleRates[i];
+ }
+ halPort->num_channel_masks =
+ std::min(port.channelMasks.size(), static_cast<size_t>(AUDIO_PORT_MAX_CHANNEL_MASKS));
+ for (size_t i = 0; i < halPort->num_channel_masks; ++i) {
+ halPort->channel_masks[i] = static_cast<audio_channel_mask_t>(port.channelMasks[i]);
+ }
+ halPort->num_formats =
+ std::min(port.formats.size(), static_cast<size_t>(AUDIO_PORT_MAX_FORMATS));
+ for (size_t i = 0; i < halPort->num_formats; ++i) {
+ halPort->formats[i] = static_cast<audio_format_t>(port.formats[i]);
+ }
+ halPort->num_gains = std::min(port.gains.size(), static_cast<size_t>(AUDIO_PORT_MAX_GAINS));
+ for (size_t i = 0; i < halPort->num_gains; ++i) {
+ audioGainToHal(port.gains[i], &halPort->gains[i]);
+ }
+ audioPortConfigToHal(port.activeConfig, &halPort->active_config);
+ switch (port.type) {
+ case AudioPortType::NONE: break;
+ case AudioPortType::DEVICE: {
+ halPort->ext.device.hw_module = port.ext.device.hwModule;
+ halPort->ext.device.type = static_cast<audio_devices_t>(port.ext.device.type);
+ memcpy(halPort->ext.device.address,
+ port.ext.device.address.data(),
+ AUDIO_DEVICE_MAX_ADDRESS_LEN);
+ break;
+ }
+ case AudioPortType::MIX: {
+ halPort->ext.mix.hw_module = port.ext.mix.hwModule;
+ halPort->ext.mix.handle = port.ext.mix.ioHandle;
+ halPort->ext.mix.latency_class =
+ static_cast<audio_mix_latency_class_t>(port.ext.mix.latencyClass);
+ break;
+ }
+ case AudioPortType::SESSION: {
+ halPort->ext.session.session = static_cast<audio_session_t>(port.ext.session.session);
+ break;
+ }
+ }
+}
+
+Result Device::analyzeStatus(const char* funcName, int status) {
+ if (status != 0) {
+ ALOGW("Device %p %s: %s", mDevice, funcName, strerror(-status));
+ }
+ switch (status) {
+ case 0: return Result::OK;
+ case -EINVAL: return Result::INVALID_ARGUMENTS;
+ case -ENODATA: return Result::INVALID_STATE;
+ case -ENODEV: return Result::NOT_INITIALIZED;
+ case -ENOSYS: return Result::NOT_SUPPORTED;
+ default: return Result::INVALID_STATE;
+ }
+}
+
+char* Device::halGetParameters(const char* keys) {
+ return mDevice->get_parameters(mDevice, keys);
+}
+
+int Device::halSetParameters(const char* keysAndValues) {
+ return mDevice->set_parameters(mDevice, keysAndValues);
+}
+
+// Methods from ::android::hardware::audio::V2_0::IDevice follow.
+Return<Result> Device::initCheck() {
+ return analyzeStatus("init_check", mDevice->init_check(mDevice));
+}
+
+Return<Result> Device::setMasterVolume(float volume) {
+ Result retval(Result::NOT_SUPPORTED);
+ if (mDevice->set_master_volume != NULL) {
+ retval = analyzeStatus("set_master_volume", mDevice->set_master_volume(mDevice, volume));
+ }
+ return retval;
+}
+
+Return<void> Device::getMasterVolume(getMasterVolume_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ float volume = 0;
+ if (mDevice->get_master_volume != NULL) {
+ retval = analyzeStatus("get_master_volume", mDevice->get_master_volume(mDevice, &volume));
+ }
+ _hidl_cb(retval, volume);
+ return Void();
+}
+
+Return<Result> Device::setMicMute(bool mute) {
+ return analyzeStatus("set_mic_mute", mDevice->set_mic_mute(mDevice, mute));
+}
+
+Return<void> Device::getMicMute(getMicMute_cb _hidl_cb) {
+ bool mute = false;
+ Result retval = analyzeStatus("get_mic_mute", mDevice->get_mic_mute(mDevice, &mute));
+ _hidl_cb(retval, mute);
+ return Void();
+}
+
+Return<Result> Device::setMasterMute(bool mute) {
+ Result retval(Result::NOT_SUPPORTED);
+ if (mDevice->set_master_mute != NULL) {
+ retval = analyzeStatus("set_master_mute", mDevice->set_master_mute(mDevice, mute));
+ }
+ return retval;
+}
+
+Return<void> Device::getMasterMute(getMasterMute_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ bool mute = false;
+ if (mDevice->get_master_mute != NULL) {
+ retval = analyzeStatus("get_master_mute", mDevice->get_master_mute(mDevice, &mute));
+ }
+ _hidl_cb(retval, mute);
+ return Void();
+}
+
+Return<void> Device::getInputBufferSize(
+ const AudioConfig& config, getInputBufferSize_cb _hidl_cb) {
+ audio_config_t halConfig;
+ audioConfigToHal(config, &halConfig);
+ size_t halBufferSize = mDevice->get_input_buffer_size(mDevice, &halConfig);
+ Result retval(Result::INVALID_ARGUMENTS);
+ uint64_t bufferSize = 0;
+ if (halBufferSize != 0) {
+ retval = Result::OK;
+ bufferSize = halBufferSize;
+ }
+ _hidl_cb(retval, bufferSize);
+ return Void();
+}
+
+Return<void> Device::openOutputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlag flags,
+ openOutputStream_cb _hidl_cb) {
+ audio_config_t halConfig;
+ audioConfigToHal(config, &halConfig);
+ audio_stream_out_t *halStream;
+ int status = mDevice->open_output_stream(
+ mDevice,
+ ioHandle,
+ static_cast<audio_devices_t>(device.device),
+ static_cast<audio_output_flags_t>(flags),
+ &halConfig,
+ &halStream,
+ deviceAddressToHal(device).c_str());
+ sp<IStreamOut> streamOut;
+ if (status == OK) {
+ streamOut = new StreamOut(mDevice, halStream);
+ }
+ _hidl_cb(analyzeStatus("open_output_stream", status), streamOut);
+ return Void();
+}
+
+Return<void> Device::openInputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioInputFlag flags,
+ AudioSource source,
+ openInputStream_cb _hidl_cb) {
+ audio_config_t halConfig;
+ audioConfigToHal(config, &halConfig);
+ audio_stream_in_t *halStream;
+ int status = mDevice->open_input_stream(
+ mDevice,
+ ioHandle,
+ static_cast<audio_devices_t>(device.device),
+ &halConfig,
+ &halStream,
+ static_cast<audio_input_flags_t>(flags),
+ deviceAddressToHal(device).c_str(),
+ static_cast<audio_source_t>(source));
+ sp<IStreamIn> streamIn;
+ if (status == OK) {
+ streamIn = new StreamIn(mDevice, halStream);
+ }
+ _hidl_cb(analyzeStatus("open_input_stream", status), streamIn);
+ return Void();
+}
+
+Return<void> Device::createAudioPatch(
+ const hidl_vec<AudioPortConfig>& sources,
+ const hidl_vec<AudioPortConfig>& sinks,
+ createAudioPatch_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ AudioPatchHandle patch = 0;
+ if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
+ std::unique_ptr<audio_port_config[]> halSources(audioPortConfigsToHal(sources));
+ std::unique_ptr<audio_port_config[]> halSinks(audioPortConfigsToHal(sinks));
+ audio_patch_handle_t halPatch;
+ retval = analyzeStatus(
+ "create_audio_patch",
+ mDevice->create_audio_patch(
+ mDevice,
+ sources.size(), &halSources[0],
+ sinks.size(), &halSinks[0],
+ &halPatch));
+ if (retval == Result::OK) {
+ patch = static_cast<AudioPatchHandle>(halPatch);
+ }
+ }
+ _hidl_cb(retval, patch);
+ return Void();
+}
+
+Return<Result> Device::releaseAudioPatch(int32_t patch) {
+ if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
+ return analyzeStatus(
+ "release_audio_patch",
+ mDevice->release_audio_patch(mDevice, static_cast<audio_patch_handle_t>(patch)));
+ }
+ return Result::NOT_SUPPORTED;
+}
+
+Return<void> Device::getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) {
+ audio_port halPort;
+ audioPortToHal(port, &halPort);
+ Result retval = analyzeStatus("get_audio_port", mDevice->get_audio_port(mDevice, &halPort));
+ AudioPort resultPort = port;
+ if (retval == Result::OK) {
+ audioPortFromHal(halPort, &resultPort);
+ }
+ _hidl_cb(retval, resultPort);
+ return Void();
+}
+
+Return<Result> Device::setAudioPortConfig(const AudioPortConfig& config) {
+ if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
+ struct audio_port_config halPortConfig;
+ audioPortConfigToHal(config, &halPortConfig);
+ return analyzeStatus(
+ "set_audio_port_config", mDevice->set_audio_port_config(mDevice, &halPortConfig));
+ }
+ return Result::NOT_SUPPORTED;
+}
+
+Return<AudioHwSync> Device::getHwAvSync() {
+ int halHwAvSync;
+ Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
+ return retval == Result::OK ? halHwAvSync : AUDIO_HW_SYNC_INVALID;
+}
+
+Return<Result> Device::setScreenState(bool turnedOn) {
+ return setParam(AudioParameter::keyScreenState, turnedOn);
+}
+
+Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
+ getParametersImpl(keys, _hidl_cb);
+ return Void();
+}
+
+Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& parameters) {
+ return setParametersImpl(parameters);
+}
+
+Return<void> Device::debugDump(const native_handle_t* fd) {
+ if (fd->numFds == 1) {
+ analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/Device.h b/audio/2.0/default/Device.h
new file mode 100644
index 0000000..d7b3128
--- /dev/null
+++ b/audio/2.0/default/Device.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
+
+#include <memory>
+
+#include <media/AudioParameter.h>
+#include <hardware/audio.h>
+
+#include <android/hardware/audio/2.0/IDevice.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "ParametersUtil.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioConfig;
+using ::android::hardware::audio::common::V2_0::AudioGain;
+using ::android::hardware::audio::common::V2_0::AudioGainConfig;
+using ::android::hardware::audio::common::V2_0::AudioGainMode;
+using ::android::hardware::audio::common::V2_0::AudioHwSync;
+using ::android::hardware::audio::common::V2_0::AudioInputFlag;
+using ::android::hardware::audio::common::V2_0::AudioMixLatencyClass;
+using ::android::hardware::audio::common::V2_0::AudioOffloadInfo;
+using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
+using ::android::hardware::audio::common::V2_0::AudioPatchHandle;
+using ::android::hardware::audio::common::V2_0::AudioPort;
+using ::android::hardware::audio::common::V2_0::AudioPortConfig;
+using ::android::hardware::audio::common::V2_0::AudioPortConfigMask;
+using ::android::hardware::audio::common::V2_0::AudioPortRole;
+using ::android::hardware::audio::common::V2_0::AudioPortType;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::common::V2_0::AudioStreamType;
+using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::V2_0::IDevice;
+using ::android::hardware::audio::V2_0::IStreamIn;
+using ::android::hardware::audio::V2_0::IStreamOut;
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Device : public IDevice, public ParametersUtil {
+ explicit Device(audio_hw_device_t* device);
+
+ // Methods from ::android::hardware::audio::V2_0::IDevice follow.
+ Return<Result> initCheck() override;
+ Return<Result> setMasterVolume(float volume) override;
+ Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
+ Return<Result> setMicMute(bool mute) override;
+ Return<void> getMicMute(getMicMute_cb _hidl_cb) override;
+ Return<Result> setMasterMute(bool mute) override;
+ Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
+ Return<void> getInputBufferSize(
+ const AudioConfig& config, getInputBufferSize_cb _hidl_cb) override;
+ Return<void> openOutputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlag flags,
+ openOutputStream_cb _hidl_cb) override;
+ Return<void> openInputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioInputFlag flags,
+ AudioSource source,
+ openInputStream_cb _hidl_cb) override;
+ Return<void> createAudioPatch(
+ const hidl_vec<AudioPortConfig>& sources,
+ const hidl_vec<AudioPortConfig>& sinks,
+ createAudioPatch_cb _hidl_cb) override;
+ Return<Result> releaseAudioPatch(int32_t patch) override;
+ Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
+ Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
+ Return<AudioHwSync> getHwAvSync() override;
+ Return<Result> setScreenState(bool turnedOn) override;
+ Return<void> getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
+ Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ // Utility methods for extending interfaces.
+ Result analyzeStatus(const char* funcName, int status);
+ audio_hw_device_t* device() const { return mDevice; }
+
+ private:
+ audio_hw_device_t *mDevice;
+
+ static void audioConfigToHal(const AudioConfig& config, audio_config_t* halConfig);
+ static void audioGainConfigFromHal(
+ const struct audio_gain_config& halConfig, AudioGainConfig* config);
+ static void audioGainConfigToHal(
+ const AudioGainConfig& config, struct audio_gain_config* halConfig);
+ static void audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain);
+ static void audioGainToHal(const AudioGain& gain, struct audio_gain* halGain);
+ static void audioOffloadInfoToHal(
+ const AudioOffloadInfo& offload, audio_offload_info_t* halOffload);
+ static void audioPortConfigFromHal(
+ const struct audio_port_config& halConfig, AudioPortConfig* config);
+ static void audioPortConfigToHal(
+ const AudioPortConfig& config, struct audio_port_config* halConfig);
+ static std::unique_ptr<audio_port_config[]> audioPortConfigsToHal(
+ const hidl_vec<AudioPortConfig>& configs);
+ static void audioPortFromHal(const struct audio_port& halPort, AudioPort* port);
+ static void audioPortToHal(const AudioPort& port, struct audio_port* halPort);
+
+ virtual ~Device();
+
+ // Methods from ParametersUtil.
+ char* halGetParameters(const char* keys) override;
+ int halSetParameters(const char* keysAndValues) override;
+
+ uint32_t version() const { return mDevice->common.version; }
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
diff --git a/audio/2.0/default/DevicesFactory.cpp b/audio/2.0/default/DevicesFactory.cpp
new file mode 100644
index 0000000..1e087f2
--- /dev/null
+++ b/audio/2.0/default/DevicesFactory.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "DevicesFactoryHAL"
+
+#include <string.h>
+
+#include <utils/Log.h>
+
+#include "Device.h"
+#include "DevicesFactory.h"
+#include "PrimaryDevice.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+// static
+const char* DevicesFactory::deviceToString(IDevicesFactory::Device device) {
+ switch (device) {
+ case IDevicesFactory::Device::PRIMARY: return AUDIO_HARDWARE_MODULE_ID_PRIMARY;
+ case IDevicesFactory::Device::A2DP: return AUDIO_HARDWARE_MODULE_ID_A2DP;
+ case IDevicesFactory::Device::USB: return AUDIO_HARDWARE_MODULE_ID_USB;
+ case IDevicesFactory::Device::R_SUBMIX: return AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX;
+ }
+}
+
+// static
+int DevicesFactory::loadAudioInterface(const char *if_name, audio_hw_device_t **dev)
+{
+ const hw_module_t *mod;
+ int rc;
+
+ rc = hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID, if_name, &mod);
+ if (rc) {
+ ALOGE("%s couldn't load audio hw module %s.%s (%s)", __func__,
+ AUDIO_HARDWARE_MODULE_ID, if_name, strerror(-rc));
+ goto out;
+ }
+ rc = audio_hw_device_open(mod, dev);
+ if (rc) {
+ ALOGE("%s couldn't open audio hw device in %s.%s (%s)", __func__,
+ AUDIO_HARDWARE_MODULE_ID, if_name, strerror(-rc));
+ goto out;
+ }
+ if ((*dev)->common.version < AUDIO_DEVICE_API_VERSION_MIN) {
+ ALOGE("%s wrong audio hw device version %04x", __func__, (*dev)->common.version);
+ rc = -EINVAL;
+ audio_hw_device_close(*dev);
+ goto out;
+ }
+ return OK;
+
+out:
+ *dev = NULL;
+ return rc;
+}
+
+// Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
+Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
+ audio_hw_device_t *halDevice;
+ int halStatus = loadAudioInterface(deviceToString(device), &halDevice);
+ Result retval(Result::OK);
+ sp<IDevice> result;
+ if (halStatus == OK) {
+ if (device == IDevicesFactory::Device::PRIMARY) {
+ result = new PrimaryDevice(halDevice);
+ } else {
+ result = new ::android::hardware::audio::V2_0::implementation::Device(halDevice);
+ }
+ } else if (halStatus == -EINVAL) {
+ retval = Result::NOT_INITIALIZED;
+ } else {
+ retval = Result::INVALID_ARGUMENTS;
+ }
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) {
+ return new DevicesFactory();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/DevicesFactory.h b/audio/2.0/default/DevicesFactory.h
new file mode 100644
index 0000000..0ea9859
--- /dev/null
+++ b/audio/2.0/default/DevicesFactory.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
+
+#include <hardware/audio.h>
+
+#include <android/hardware/audio/2.0/IDevicesFactory.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::V2_0::IDevice;
+using ::android::hardware::audio::V2_0::IDevicesFactory;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct DevicesFactory : public IDevicesFactory {
+ // Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
+ Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
+
+ private:
+ static const char* deviceToString(IDevicesFactory::Device device);
+ static int loadAudioInterface(const char *if_name, audio_hw_device_t **dev);
+
+};
+
+extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
diff --git a/audio/2.0/default/ParametersUtil.cpp b/audio/2.0/default/ParametersUtil.cpp
new file mode 100644
index 0000000..75a60b9
--- /dev/null
+++ b/audio/2.0/default/ParametersUtil.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "ParametersUtil.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+Result ParametersUtil::getParam(const char* name, bool* value) {
+ String8 halValue;
+ Result retval = getParam(name, &halValue);
+ *value = false;
+ if (retval == Result::OK) {
+ *value = !(halValue == AudioParameter::valueOff);
+ }
+ return retval;
+}
+
+Result ParametersUtil::getParam(const char* name, int* value) {
+ const String8 halName(name);
+ AudioParameter keys;
+ keys.addKey(halName);
+ std::unique_ptr<AudioParameter> params = getParams(keys);
+ status_t halStatus = params->getInt(halName, *value);
+ return halStatus == OK ? Result::OK : Result::INVALID_ARGUMENTS;
+}
+
+Result ParametersUtil::getParam(const char* name, String8* value) {
+ const String8 halName(name);
+ AudioParameter keys;
+ keys.addKey(halName);
+ std::unique_ptr<AudioParameter> params = getParams(keys);
+ status_t halStatus = params->get(halName, *value);
+ return halStatus == OK ? Result::OK : Result::INVALID_ARGUMENTS;
+}
+
+void ParametersUtil::getParametersImpl(
+ const hidl_vec<hidl_string>& keys,
+ std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb) {
+ AudioParameter halKeys;
+ for (size_t i = 0; i < keys.size(); ++i) {
+ halKeys.addKey(String8(keys[i].c_str()));
+ }
+ std::unique_ptr<AudioParameter> halValues = getParams(halKeys);
+ Result retval(Result::INVALID_ARGUMENTS);
+ hidl_vec<ParameterValue> result;
+ if (halValues->size() > 0) {
+ result.resize(halValues->size());
+ String8 halKey, halValue;
+ for (size_t i = 0; i < halValues->size(); ++i) {
+ status_t status = halValues->getAt(i, halKey, halValue);
+ if (status != OK) {
+ result.resize(0);
+ break;
+ }
+ result[i].key = halKey.string();
+ result[i].value = halValue.string();
+ }
+ if (result.size() != 0) {
+ retval = Result::OK;
+ }
+ }
+ cb(retval, result);
+}
+
+std::unique_ptr<AudioParameter> ParametersUtil::getParams(const AudioParameter& keys) {
+ String8 paramsAndValues;
+ char *halValues = halGetParameters(keys.keysToString().string());
+ if (halValues != NULL) {
+ paramsAndValues.setTo(halValues);
+ free(halValues);
+ } else {
+ paramsAndValues.clear();
+ }
+ return std::unique_ptr<AudioParameter>(new AudioParameter(paramsAndValues));
+}
+
+Result ParametersUtil::setParam(const char* name, bool value) {
+ AudioParameter param;
+ param.add(String8(name), String8(value ? AudioParameter::valueOn : AudioParameter::valueOff));
+ return setParams(param);
+}
+
+Result ParametersUtil::setParam(const char* name, int value) {
+ AudioParameter param;
+ param.addInt(String8(name), value);
+ return setParams(param);
+}
+
+Result ParametersUtil::setParam(const char* name, const char* value) {
+ AudioParameter param;
+ param.add(String8(name), String8(value));
+ return setParams(param);
+}
+
+Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& parameters) {
+ AudioParameter params;
+ for (size_t i = 0; i < parameters.size(); ++i) {
+ params.add(String8(parameters[i].key.c_str()), String8(parameters[i].value.c_str()));
+ }
+ return setParams(params);
+}
+
+Result ParametersUtil::setParams(const AudioParameter& param) {
+ int halStatus = halSetParameters(param.toString().string());
+ if (halStatus == OK)
+ return Result::OK;
+ else if (halStatus == -ENOSYS)
+ return Result::INVALID_STATE;
+ else
+ return Result::INVALID_ARGUMENTS;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/ParametersUtil.h b/audio/2.0/default/ParametersUtil.h
new file mode 100644
index 0000000..49036dc
--- /dev/null
+++ b/audio/2.0/default/ParametersUtil.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef android_hardware_audio_V2_0_ParametersUtil_H_
+#define android_hardware_audio_V2_0_ParametersUtil_H_
+
+#include <functional>
+#include <memory>
+
+#include <android/hardware/audio/2.0/types.h>
+#include <hidl/HidlSupport.h>
+#include <media/AudioParameter.h>
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+
+class ParametersUtil {
+ public:
+ Result getParam(const char* name, bool* value);
+ Result getParam(const char* name, int* value);
+ Result getParam(const char* name, String8* value);
+ void getParametersImpl(
+ const hidl_vec<hidl_string>& keys,
+ std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb);
+ std::unique_ptr<AudioParameter> getParams(const AudioParameter& keys);
+ Result setParam(const char* name, bool value);
+ Result setParam(const char* name, int value);
+ Result setParam(const char* name, const char* value);
+ Result setParametersImpl(const hidl_vec<ParameterValue>& parameters);
+ Result setParams(const AudioParameter& param);
+
+ protected:
+ virtual ~ParametersUtil() {}
+
+ virtual char* halGetParameters(const char* keys) = 0;
+ virtual int halSetParameters(const char* keysAndValues) = 0;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_audio_V2_0_ParametersUtil_H_
diff --git a/audio/2.0/default/PrimaryDevice.cpp b/audio/2.0/default/PrimaryDevice.cpp
new file mode 100644
index 0000000..9f5180c
--- /dev/null
+++ b/audio/2.0/default/PrimaryDevice.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "PrimaryDeviceHAL"
+
+#include "PrimaryDevice.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+PrimaryDevice::PrimaryDevice(audio_hw_device_t* device)
+ : mDevice(new Device(device)) {
+}
+
+PrimaryDevice::~PrimaryDevice() {}
+
+// Methods from ::android::hardware::audio::V2_0::IDevice follow.
+Return<Result> PrimaryDevice::initCheck() {
+ return mDevice->initCheck();
+}
+
+Return<Result> PrimaryDevice::setMasterVolume(float volume) {
+ return mDevice->setMasterVolume(volume);
+}
+
+Return<void> PrimaryDevice::getMasterVolume(getMasterVolume_cb _hidl_cb) {
+ return mDevice->getMasterVolume(_hidl_cb);
+}
+
+Return<Result> PrimaryDevice::setMicMute(bool mute) {
+ return mDevice->setMicMute(mute);
+}
+
+Return<void> PrimaryDevice::getMicMute(getMicMute_cb _hidl_cb) {
+ return mDevice->getMicMute(_hidl_cb);
+}
+
+Return<Result> PrimaryDevice::setMasterMute(bool mute) {
+ return mDevice->setMasterMute(mute);
+}
+
+Return<void> PrimaryDevice::getMasterMute(getMasterMute_cb _hidl_cb) {
+ return mDevice->getMasterMute(_hidl_cb);
+}
+
+Return<void> PrimaryDevice::getInputBufferSize(
+ const AudioConfig& config, getInputBufferSize_cb _hidl_cb) {
+ return mDevice->getInputBufferSize(config, _hidl_cb);
+}
+
+Return<void> PrimaryDevice::openOutputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlag flags,
+ openOutputStream_cb _hidl_cb) {
+ return mDevice->openOutputStream(ioHandle, device, config, flags, _hidl_cb);
+}
+
+Return<void> PrimaryDevice::openInputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioInputFlag flags,
+ AudioSource source,
+ openInputStream_cb _hidl_cb) {
+ return mDevice->openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
+}
+
+Return<void> PrimaryDevice::createAudioPatch(
+ const hidl_vec<AudioPortConfig>& sources,
+ const hidl_vec<AudioPortConfig>& sinks,
+ createAudioPatch_cb _hidl_cb) {
+ return mDevice->createAudioPatch(sources, sinks, _hidl_cb);
+}
+
+Return<Result> PrimaryDevice::releaseAudioPatch(int32_t patch) {
+ return mDevice->releaseAudioPatch(patch);
+}
+
+Return<void> PrimaryDevice::getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) {
+ return mDevice->getAudioPort(port, _hidl_cb);
+}
+
+Return<Result> PrimaryDevice::setAudioPortConfig(const AudioPortConfig& config) {
+ return mDevice->setAudioPortConfig(config);
+}
+
+Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
+ return mDevice->getHwAvSync();
+}
+
+Return<Result> PrimaryDevice::setScreenState(bool turnedOn) {
+ return mDevice->setScreenState(turnedOn);
+}
+
+Return<void> PrimaryDevice::getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
+ return mDevice->getParameters(keys, _hidl_cb);
+}
+
+Return<Result> PrimaryDevice::setParameters(const hidl_vec<ParameterValue>& parameters) {
+ return mDevice->setParameters(parameters);
+}
+
+Return<void> PrimaryDevice::debugDump(const native_handle_t* fd) {
+ return mDevice->debugDump(fd);
+}
+
+
+// Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
+Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
+ return mDevice->analyzeStatus(
+ "set_voice_volume",
+ mDevice->device()->set_voice_volume(mDevice->device(), volume));
+}
+
+Return<Result> PrimaryDevice::setMode(AudioMode mode) {
+ return mDevice->analyzeStatus(
+ "set_mode",
+ mDevice->device()->set_mode(mDevice->device(), static_cast<audio_mode_t>(mode)));
+}
+
+Return<void> PrimaryDevice::getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) {
+ bool enabled;
+ Result retval = mDevice->getParam(AudioParameter::keyBtNrec, &enabled);
+ _hidl_cb(retval, enabled);
+ return Void();
+}
+
+Return<Result> PrimaryDevice::setBtScoNrecEnabled(bool enabled) {
+ return mDevice->setParam(AudioParameter::keyBtNrec, enabled);
+}
+
+Return<void> PrimaryDevice::getBtScoWidebandEnabled(getBtScoWidebandEnabled_cb _hidl_cb) {
+ bool enabled;
+ Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_BT_SCO_WB, &enabled);
+ _hidl_cb(retval, enabled);
+ return Void();
+}
+
+Return<Result> PrimaryDevice::setBtScoWidebandEnabled(bool enabled) {
+ return mDevice->setParam(AUDIO_PARAMETER_KEY_BT_SCO_WB, enabled);
+}
+
+Return<void> PrimaryDevice::getTtyMode(getTtyMode_cb _hidl_cb) {
+ int halMode;
+ Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_TTY_MODE, &halMode);
+ TtyMode mode = retval == Result::OK ? TtyMode(halMode) : TtyMode::OFF;
+ _hidl_cb(retval, mode);
+ return Void();
+}
+
+Return<Result> PrimaryDevice::setTtyMode(IPrimaryDevice::TtyMode mode) {
+ return mDevice->setParam(AUDIO_PARAMETER_KEY_TTY_MODE, static_cast<int>(mode));
+}
+
+Return<void> PrimaryDevice::getHacEnabled(getHacEnabled_cb _hidl_cb) {
+ bool enabled;
+ Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_HAC, &enabled);
+ _hidl_cb(retval, enabled);
+ return Void();
+}
+
+Return<Result> PrimaryDevice::setHacEnabled(bool enabled) {
+ return mDevice->setParam(AUDIO_PARAMETER_KEY_HAC, enabled);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/PrimaryDevice.h b/audio/2.0/default/PrimaryDevice.h
new file mode 100644
index 0000000..4c5b590
--- /dev/null
+++ b/audio/2.0/default/PrimaryDevice.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
+
+#include <android/hardware/audio/2.0/IPrimaryDevice.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Device.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioConfig;
+using ::android::hardware::audio::common::V2_0::AudioInputFlag;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
+using ::android::hardware::audio::common::V2_0::AudioPort;
+using ::android::hardware::audio::common::V2_0::AudioPortConfig;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::V2_0::IDevice;
+using ::android::hardware::audio::V2_0::IPrimaryDevice;
+using ::android::hardware::audio::V2_0::IStreamIn;
+using ::android::hardware::audio::V2_0::IStreamOut;
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct PrimaryDevice : public IPrimaryDevice {
+ explicit PrimaryDevice(audio_hw_device_t* device);
+
+ // Methods from ::android::hardware::audio::V2_0::IDevice follow.
+ Return<Result> initCheck() override;
+ Return<Result> setMasterVolume(float volume) override;
+ Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
+ Return<Result> setMicMute(bool mute) override;
+ Return<void> getMicMute(getMicMute_cb _hidl_cb) override;
+ Return<Result> setMasterMute(bool mute) override;
+ Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
+ Return<void> getInputBufferSize(
+ const AudioConfig& config, getInputBufferSize_cb _hidl_cb) override;
+ Return<void> openOutputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioOutputFlag flags,
+ openOutputStream_cb _hidl_cb) override;
+ Return<void> openInputStream(
+ int32_t ioHandle,
+ const DeviceAddress& device,
+ const AudioConfig& config,
+ AudioInputFlag flags,
+ AudioSource source,
+ openInputStream_cb _hidl_cb) override;
+ Return<void> createAudioPatch(
+ const hidl_vec<AudioPortConfig>& sources,
+ const hidl_vec<AudioPortConfig>& sinks,
+ createAudioPatch_cb _hidl_cb) override;
+ Return<Result> releaseAudioPatch(int32_t patch) override;
+ Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
+ Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
+ Return<AudioHwSync> getHwAvSync() override;
+ Return<Result> setScreenState(bool turnedOn) override;
+ Return<void> getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
+ Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
+ Return<Result> setVoiceVolume(float volume) override;
+ Return<Result> setMode(AudioMode mode) override;
+ Return<void> getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override;
+ Return<Result> setBtScoNrecEnabled(bool enabled) override;
+ Return<void> getBtScoWidebandEnabled(getBtScoWidebandEnabled_cb _hidl_cb) override;
+ Return<Result> setBtScoWidebandEnabled(bool enabled) override;
+ Return<void> getTtyMode(getTtyMode_cb _hidl_cb) override;
+ Return<Result> setTtyMode(IPrimaryDevice::TtyMode mode) override;
+ Return<void> getHacEnabled(getHacEnabled_cb _hidl_cb) override;
+ Return<Result> setHacEnabled(bool enabled) override;
+
+ private:
+ sp<Device> mDevice;
+
+ virtual ~PrimaryDevice();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
diff --git a/audio/2.0/default/Stream.cpp b/audio/2.0/default/Stream.cpp
new file mode 100644
index 0000000..7616bec
--- /dev/null
+++ b/audio/2.0/default/Stream.cpp
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <inttypes.h>
+
+#define LOG_TAG "StreamHAL"
+
+#include <hardware/audio.h>
+#include <hardware/audio_effect.h>
+#include <media/TypeConverter.h>
+#include <utils/Log.h>
+#include <utils/SortedVector.h>
+#include <utils/Vector.h>
+
+#include "Conversions.h"
+#include "EffectMap.h"
+#include "Stream.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+Stream::Stream(audio_stream_t* stream)
+ : mStream(stream) {
+}
+
+Stream::~Stream() {
+ mStream = nullptr;
+}
+
+Result Stream::analyzeStatus(const char* funcName, int status) {
+ if (status != 0) {
+ ALOGW("Stream %p %s: %s", mStream, funcName, strerror(-status));
+ }
+ switch (status) {
+ case 0: return Result::OK;
+ case -EINVAL: return Result::INVALID_ARGUMENTS;
+ case -ENODATA: return Result::INVALID_STATE;
+ case -ENODEV: return Result::NOT_INITIALIZED;
+ case -ENOSYS: return Result::NOT_SUPPORTED;
+ default: return Result::INVALID_STATE;
+ }
+}
+
+char* Stream::halGetParameters(const char* keys) {
+ return mStream->get_parameters(mStream, keys);
+}
+
+int Stream::halSetParameters(const char* keysAndValues) {
+ return mStream->set_parameters(mStream, keysAndValues);
+}
+
+// Methods from ::android::hardware::audio::V2_0::IStream follow.
+Return<uint64_t> Stream::getFrameSize() {
+ // Needs to be implemented by interface subclasses. But can't be declared as pure virtual,
+ // since interface subclasses implementation do not inherit from this class.
+ LOG_ALWAYS_FATAL("Stream::getFrameSize is pure abstract");
+ return uint64_t {};
+}
+
+Return<uint64_t> Stream::getFrameCount() {
+ int halFrameCount;
+ Result retval = getParam(AudioParameter::keyFrameCount, &halFrameCount);
+ return retval == Result::OK ? halFrameCount : 0;
+}
+
+Return<uint64_t> Stream::getBufferSize() {
+ return mStream->get_buffer_size(mStream);
+}
+
+Return<uint32_t> Stream::getSampleRate() {
+ return mStream->get_sample_rate(mStream);
+}
+
+Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
+ String8 halListValue;
+ Result result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue);
+ hidl_vec<uint32_t> sampleRates;
+ SortedVector<uint32_t> halSampleRates;
+ if (result == Result::OK) {
+ halSampleRates = samplingRatesFromString(
+ halListValue.string(), AudioParameter::valueListSeparator);
+ sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size());
+ }
+ _hidl_cb(sampleRates);
+ return Void();
+}
+
+Return<Result> Stream::setSampleRate(uint32_t sampleRateHz) {
+ return setParam(AudioParameter::keySamplingRate, static_cast<int>(sampleRateHz));
+}
+
+Return<AudioChannelMask> Stream::getChannelMask() {
+ return AudioChannelMask(mStream->get_channels(mStream));
+}
+
+Return<void> Stream::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
+ String8 halListValue;
+ Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue);
+ hidl_vec<AudioChannelMask> channelMasks;
+ SortedVector<audio_channel_mask_t> halChannelMasks;
+ if (result == Result::OK) {
+ halChannelMasks = channelMasksFromString(
+ halListValue.string(), AudioParameter::valueListSeparator);
+ channelMasks.resize(halChannelMasks.size());
+ for (size_t i = 0; i < halChannelMasks.size(); ++i) {
+ channelMasks[i] = AudioChannelMask(halChannelMasks[i]);
+ }
+ }
+ _hidl_cb(channelMasks);
+ return Void();
+}
+
+Return<Result> Stream::setChannelMask(AudioChannelMask mask) {
+ return setParam(AudioParameter::keyChannels, static_cast<int>(mask));
+}
+
+Return<AudioFormat> Stream::getFormat() {
+ return AudioFormat(mStream->get_format(mStream));
+}
+
+Return<void> Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) {
+ String8 halListValue;
+ Result result = getParam(AudioParameter::keyStreamSupportedFormats, &halListValue);
+ hidl_vec<AudioFormat> formats;
+ Vector<audio_format_t> halFormats;
+ if (result == Result::OK) {
+ halFormats = formatsFromString(halListValue.string(), AudioParameter::valueListSeparator);
+ formats.resize(halFormats.size());
+ for (size_t i = 0; i < halFormats.size(); ++i) {
+ formats[i] = AudioFormat(halFormats[i]);
+ }
+ }
+ _hidl_cb(formats);
+ return Void();
+}
+
+Return<Result> Stream::setFormat(AudioFormat format) {
+ return setParam(AudioParameter::keyFormat, static_cast<int>(format));
+}
+
+Return<void> Stream::getAudioProperties(getAudioProperties_cb _hidl_cb) {
+ uint32_t halSampleRate = mStream->get_sample_rate(mStream);
+ audio_channel_mask_t halMask = mStream->get_channels(mStream);
+ audio_format_t halFormat = mStream->get_format(mStream);
+ _hidl_cb(halSampleRate, AudioChannelMask(halMask), AudioFormat(halFormat));
+ return Void();
+}
+
+Return<Result> Stream::addEffect(uint64_t effectId) {
+ effect_handle_t halEffect = EffectMap::getInstance().get(effectId);
+ if (halEffect != NULL) {
+ return analyzeStatus("add_audio_effect", mStream->add_audio_effect(mStream, halEffect));
+ } else {
+ ALOGW("Invalid effect ID passed from client: %" PRIu64, effectId);
+ return Result::INVALID_ARGUMENTS;
+ }
+}
+
+Return<Result> Stream::removeEffect(uint64_t effectId) {
+ effect_handle_t halEffect = EffectMap::getInstance().get(effectId);
+ if (halEffect != NULL) {
+ return analyzeStatus(
+ "remove_audio_effect", mStream->remove_audio_effect(mStream, halEffect));
+ } else {
+ ALOGW("Invalid effect ID passed from client: %" PRIu64, effectId);
+ return Result::INVALID_ARGUMENTS;
+ }
+}
+
+Return<Result> Stream::standby() {
+ return analyzeStatus("standby", mStream->standby(mStream));
+}
+
+Return<AudioDevice> Stream::getDevice() {
+ return AudioDevice(mStream->get_device(mStream));
+}
+
+Return<Result> Stream::setDevice(const DeviceAddress& address) {
+ char* halDeviceAddress =
+ audio_device_address_to_parameter(
+ static_cast<audio_devices_t>(address.device),
+ deviceAddressToHal(address).c_str());
+ AudioParameter params((String8(halDeviceAddress)));
+ free(halDeviceAddress);
+ params.addInt(
+ String8(AudioParameter::keyRouting), static_cast<audio_devices_t>(address.device));
+ return setParams(params);
+}
+
+Return<Result> Stream::setConnectedState(const DeviceAddress& address, bool connected) {
+ return setParam(
+ connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect,
+ deviceAddressToHal(address).c_str());
+}
+
+Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
+ return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
+}
+
+Return<void> Stream::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
+ getParametersImpl(keys, _hidl_cb);
+ return Void();
+}
+
+Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& parameters) {
+ return setParametersImpl(parameters);
+}
+
+Return<void> Stream::debugDump(const native_handle_t* fd) {
+ if (fd->numFds == 1) {
+ analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
+ }
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
new file mode 100644
index 0000000..f28fbff
--- /dev/null
+++ b/audio/2.0/default/Stream.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
+
+#include <android/hardware/audio/2.0/IStream.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "ParametersUtil.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioChannelMask;
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioFormat;
+using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::V2_0::IStream;
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Stream : public IStream, public ParametersUtil {
+ explicit Stream(audio_stream_t* stream);
+
+ // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ Return<uint64_t> getFrameSize() override;
+ Return<uint64_t> getFrameCount() override;
+ Return<uint64_t> getBufferSize() override;
+ Return<uint32_t> getSampleRate() override;
+ Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
+ Return<Result> setSampleRate(uint32_t sampleRateHz) override;
+ Return<AudioChannelMask> getChannelMask() override;
+ Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
+ Return<Result> setChannelMask(AudioChannelMask mask) override;
+ Return<AudioFormat> getFormat() override;
+ Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
+ Return<Result> setFormat(AudioFormat format) override;
+ Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override;
+ Return<Result> addEffect(uint64_t effectId) override;
+ Return<Result> removeEffect(uint64_t effectId) override;
+ Return<Result> standby() override;
+ Return<AudioDevice> getDevice() override;
+ Return<Result> setDevice(const DeviceAddress& address) override;
+ Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
+ Return<Result> setHwAvSync(uint32_t hwAvSync) override;
+ Return<void> getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
+ Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ // Utility methods for extending interfaces.
+ Result analyzeStatus(const char* funcName, int status);
+
+ private:
+ audio_stream_t *mStream;
+
+ virtual ~Stream();
+
+ // Methods from ParametersUtil.
+ char* halGetParameters(const char* keys) override;
+ int halSetParameters(const char* keysAndValues) override;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
new file mode 100644
index 0000000..b590d1a
--- /dev/null
+++ b/audio/2.0/default/StreamIn.cpp
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "StreamInHAL"
+
+#include <hardware/audio.h>
+#include <utils/Log.h>
+
+#include "StreamIn.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+StreamIn::StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream)
+ : mDevice(device), mStream(stream), mStreamCommon(new Stream(&stream->common)) {
+}
+
+StreamIn::~StreamIn() {
+ mDevice->close_input_stream(mDevice, mStream);
+ mStream = nullptr;
+ mDevice = nullptr;
+}
+
+// Methods from ::android::hardware::audio::V2_0::IStream follow.
+Return<uint64_t> StreamIn::getFrameSize() {
+ return audio_stream_in_frame_size(mStream);
+}
+
+Return<uint64_t> StreamIn::getFrameCount() {
+ return mStreamCommon->getFrameCount();
+}
+
+Return<uint64_t> StreamIn::getBufferSize() {
+ return mStreamCommon->getBufferSize();
+}
+
+Return<uint32_t> StreamIn::getSampleRate() {
+ return mStreamCommon->getSampleRate();
+}
+
+Return<void> StreamIn::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
+ return mStreamCommon->getSupportedSampleRates(_hidl_cb);
+}
+
+Return<Result> StreamIn::setSampleRate(uint32_t sampleRateHz) {
+ return mStreamCommon->setSampleRate(sampleRateHz);
+}
+
+Return<AudioChannelMask> StreamIn::getChannelMask() {
+ return mStreamCommon->getChannelMask();
+}
+
+Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
+ return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
+}
+
+Return<Result> StreamIn::setChannelMask(AudioChannelMask mask) {
+ return mStreamCommon->setChannelMask(mask);
+}
+
+Return<AudioFormat> StreamIn::getFormat() {
+ return mStreamCommon->getFormat();
+}
+
+Return<void> StreamIn::getSupportedFormats(getSupportedFormats_cb _hidl_cb) {
+ return mStreamCommon->getSupportedFormats(_hidl_cb);
+}
+
+Return<Result> StreamIn::setFormat(AudioFormat format) {
+ return mStreamCommon->setFormat(format);
+}
+
+Return<void> StreamIn::getAudioProperties(getAudioProperties_cb _hidl_cb) {
+ return mStreamCommon->getAudioProperties(_hidl_cb);
+}
+
+Return<Result> StreamIn::addEffect(uint64_t effectId) {
+ return mStreamCommon->addEffect(effectId);
+}
+
+Return<Result> StreamIn::removeEffect(uint64_t effectId) {
+ return mStreamCommon->removeEffect(effectId);
+}
+
+Return<Result> StreamIn::standby() {
+ return mStreamCommon->standby();
+}
+
+Return<AudioDevice> StreamIn::getDevice() {
+ return mStreamCommon->getDevice();
+}
+
+Return<Result> StreamIn::setDevice(const DeviceAddress& address) {
+ return mStreamCommon->setDevice(address);
+}
+
+Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
+ return mStreamCommon->setConnectedState(address, connected);
+}
+
+Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
+ return mStreamCommon->setHwAvSync(hwAvSync);
+}
+
+Return<void> StreamIn::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
+ return mStreamCommon->getParameters(keys, _hidl_cb);
+}
+
+Return<Result> StreamIn::setParameters(const hidl_vec<ParameterValue>& parameters) {
+ return mStreamCommon->setParameters(parameters);
+}
+
+Return<void> StreamIn::debugDump(const native_handle_t* fd) {
+ return mStreamCommon->debugDump(fd);
+}
+
+
+// Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
+Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
+ int halSource;
+ Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource);
+ AudioSource source(AudioSource::DEFAULT);
+ if (retval == Result::OK) {
+ source = AudioSource(halSource);
+ }
+ _hidl_cb(retval, source);
+ return Void();
+}
+
+Return<Result> StreamIn::setGain(float gain) {
+ return mStreamCommon->analyzeStatus("set_gain", mStream->set_gain(mStream, gain));
+}
+
+Return<void> StreamIn::read(uint64_t size, read_cb _hidl_cb) {
+ // TODO(mnaganov): Replace with FMQ version.
+ hidl_vec<uint8_t> data;
+ data.resize(size);
+ Result retval(Result::OK);
+ ssize_t readResult = mStream->read(mStream, &data[0], data.size());
+ if (readResult >= 0 && static_cast<size_t>(readResult) != data.size()) {
+ data.resize(readResult);
+ } else if (readResult < 0) {
+ data.resize(0);
+ retval = mStreamCommon->analyzeStatus("read", readResult);
+ }
+ _hidl_cb(retval, data);
+ return Void();
+}
+
+Return<uint32_t> StreamIn::getInputFramesLost() {
+ return mStream->get_input_frames_lost(mStream);
+}
+
+Return<void> StreamIn::getCapturePosition(getCapturePosition_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ uint64_t frames = 0, time = 0;
+ if (mStream->get_capture_position != NULL) {
+ int64_t halFrames, halTime;
+ retval = mStreamCommon->analyzeStatus(
+ "get_capture_position",
+ mStream->get_capture_position(mStream, &halFrames, &halTime));
+ if (retval == Result::OK) {
+ frames = halFrames;
+ time = halTime;
+ }
+ }
+ _hidl_cb(retval, frames, time);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/StreamIn.h b/audio/2.0/default/StreamIn.h
new file mode 100644
index 0000000..83f620c
--- /dev/null
+++ b/audio/2.0/default/StreamIn.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
+
+#include <android/hardware/audio/2.0/IStreamIn.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Stream.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioChannelMask;
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioFormat;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::V2_0::IStream;
+using ::android::hardware::audio::V2_0::IStreamIn;
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct StreamIn : public IStreamIn {
+ StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream);
+
+ // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ Return<uint64_t> getFrameSize() override;
+ Return<uint64_t> getFrameCount() override;
+ Return<uint64_t> getBufferSize() override;
+ Return<uint32_t> getSampleRate() override;
+ Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
+ Return<Result> setSampleRate(uint32_t sampleRateHz) override;
+ Return<AudioChannelMask> getChannelMask() override;
+ Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
+ Return<Result> setChannelMask(AudioChannelMask mask) override;
+ Return<AudioFormat> getFormat() override;
+ Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
+ Return<Result> setFormat(AudioFormat format) override;
+ Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override;
+ Return<Result> addEffect(uint64_t effectId) override;
+ Return<Result> removeEffect(uint64_t effectId) override;
+ Return<Result> standby() override;
+ Return<AudioDevice> getDevice() override;
+ Return<Result> setDevice(const DeviceAddress& address) override;
+ Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
+ Return<Result> setHwAvSync(uint32_t hwAvSync) override;
+ Return<void> getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
+ Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ // Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
+ Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
+ Return<Result> setGain(float gain) override;
+ Return<void> read(uint64_t size, read_cb _hidl_cb) override;
+ Return<uint32_t> getInputFramesLost() override;
+ Return<void> getCapturePosition(getCapturePosition_cb _hidl_cb) override;
+
+ private:
+ audio_hw_device_t *mDevice;
+ audio_stream_in_t *mStream;
+ sp<Stream> mStreamCommon;
+
+ virtual ~StreamIn();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
new file mode 100644
index 0000000..34bae29
--- /dev/null
+++ b/audio/2.0/default/StreamOut.cpp
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "StreamOutHAL"
+
+#include <hardware/audio.h>
+#include <utils/Log.h>
+
+#include "StreamOut.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+StreamOut::StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream)
+ : mDevice(device), mStream(stream), mStreamCommon(new Stream(&stream->common)) {
+}
+
+StreamOut::~StreamOut() {
+ mCallback.clear();
+ mDevice->close_output_stream(mDevice, mStream);
+ mStream = nullptr;
+ mDevice = nullptr;
+}
+
+// Methods from ::android::hardware::audio::V2_0::IStream follow.
+Return<uint64_t> StreamOut::getFrameSize() {
+ return audio_stream_out_frame_size(mStream);
+}
+
+Return<uint64_t> StreamOut::getFrameCount() {
+ return mStreamCommon->getFrameCount();
+}
+
+Return<uint64_t> StreamOut::getBufferSize() {
+ return mStreamCommon->getBufferSize();
+}
+
+Return<uint32_t> StreamOut::getSampleRate() {
+ return mStreamCommon->getSampleRate();
+}
+
+Return<void> StreamOut::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
+ return mStreamCommon->getSupportedSampleRates(_hidl_cb);
+}
+
+Return<Result> StreamOut::setSampleRate(uint32_t sampleRateHz) {
+ return mStreamCommon->setSampleRate(sampleRateHz);
+}
+
+Return<AudioChannelMask> StreamOut::getChannelMask() {
+ return mStreamCommon->getChannelMask();
+}
+
+Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
+ return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
+}
+
+Return<Result> StreamOut::setChannelMask(AudioChannelMask mask) {
+ return mStreamCommon->setChannelMask(mask);
+}
+
+Return<AudioFormat> StreamOut::getFormat() {
+ return mStreamCommon->getFormat();
+}
+
+Return<void> StreamOut::getSupportedFormats(getSupportedFormats_cb _hidl_cb) {
+ return mStreamCommon->getSupportedFormats(_hidl_cb);
+}
+
+Return<Result> StreamOut::setFormat(AudioFormat format) {
+ return mStreamCommon->setFormat(format);
+}
+
+Return<void> StreamOut::getAudioProperties(getAudioProperties_cb _hidl_cb) {
+ return mStreamCommon->getAudioProperties(_hidl_cb);
+}
+
+Return<Result> StreamOut::addEffect(uint64_t effectId) {
+ return mStreamCommon->addEffect(effectId);
+}
+
+Return<Result> StreamOut::removeEffect(uint64_t effectId) {
+ return mStreamCommon->removeEffect(effectId);
+}
+
+Return<Result> StreamOut::standby() {
+ return mStreamCommon->standby();
+}
+
+Return<AudioDevice> StreamOut::getDevice() {
+ return mStreamCommon->getDevice();
+}
+
+Return<Result> StreamOut::setDevice(const DeviceAddress& address) {
+ return mStreamCommon->setDevice(address);
+}
+
+Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
+ return mStreamCommon->setConnectedState(address, connected);
+}
+
+Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
+ return mStreamCommon->setHwAvSync(hwAvSync);
+}
+
+Return<void> StreamOut::getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
+ return mStreamCommon->getParameters(keys, _hidl_cb);
+}
+
+Return<Result> StreamOut::setParameters(const hidl_vec<ParameterValue>& parameters) {
+ return mStreamCommon->setParameters(parameters);
+}
+
+Return<void> StreamOut::debugDump(const native_handle_t* fd) {
+ return mStreamCommon->debugDump(fd);
+}
+
+
+// Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
+Return<uint32_t> StreamOut::getLatency() {
+ return mStream->get_latency(mStream);
+}
+
+Return<Result> StreamOut::setVolume(float left, float right) {
+ Result retval(Result::NOT_SUPPORTED);
+ if (mStream->set_volume != NULL) {
+ retval = mStreamCommon->analyzeStatus(
+ "set_volume", mStream->set_volume(mStream, left, right));
+ }
+ return retval;
+}
+
+Return<void> StreamOut::write(const hidl_vec<uint8_t>& data, write_cb _hidl_cb) {
+ // TODO(mnaganov): Replace with FMQ version.
+ Result retval(Result::OK);
+ uint64_t written = 0;
+ ssize_t writeResult = mStream->write(mStream, &data[0], data.size());
+ if (writeResult >= 0) {
+ written = writeResult;
+ } else {
+ retval = mStreamCommon->analyzeStatus("write", writeResult);
+ written = 0;
+ }
+ _hidl_cb(retval, written);
+ return Void();
+}
+
+Return<void> StreamOut::getRenderPosition(getRenderPosition_cb _hidl_cb) {
+ uint32_t halDspFrames;
+ Result retval = mStreamCommon->analyzeStatus(
+ "get_render_position", mStream->get_render_position(mStream, &halDspFrames));
+ _hidl_cb(retval, halDspFrames);
+ return Void();
+}
+
+Return<void> StreamOut::getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ int64_t timestampUs = 0;
+ if (mStream->get_next_write_timestamp != NULL) {
+ retval = mStreamCommon->analyzeStatus(
+ "get_next_write_timestamp",
+ mStream->get_next_write_timestamp(mStream, ×tampUs));
+ }
+ _hidl_cb(retval, timestampUs);
+ return Void();
+}
+
+Return<Result> StreamOut::setCallback(const sp<IStreamOutCallback>& callback) {
+ if (mStream->set_callback == NULL) return Result::NOT_SUPPORTED;
+ int result = mStream->set_callback(mStream, StreamOut::asyncCallback, this);
+ if (result == 0) {
+ mCallback = callback;
+ }
+ return mStreamCommon->analyzeStatus("set_callback", result);
+}
+
+// static
+int StreamOut::asyncCallback(stream_callback_event_t event, void*, void *cookie) {
+ wp<StreamOut> weakSelf(reinterpret_cast<StreamOut*>(cookie));
+ sp<StreamOut> self = weakSelf.promote();
+ if (self == 0) return 0;
+ sp<IStreamOutCallback> callback = self->mCallback.promote();
+ if (callback == 0) return 0;
+ ALOGV("asyncCallback() event %d", event);
+ switch (event) {
+ case STREAM_CBK_EVENT_WRITE_READY:
+ callback->onWriteReady();
+ break;
+ case STREAM_CBK_EVENT_DRAIN_READY:
+ callback->onDrainReady();
+ break;
+ case STREAM_CBK_EVENT_ERROR:
+ callback->onError();
+ break;
+ default:
+ ALOGW("asyncCallback() unknown event %d", event);
+ break;
+ }
+ return 0;
+}
+
+Return<void> StreamOut::supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb) {
+ _hidl_cb(mStream->pause != NULL, mStream->resume != NULL);
+ return Void();
+}
+
+Return<Result> StreamOut::pause() {
+ return mStream->pause != NULL ?
+ mStreamCommon->analyzeStatus("pause", mStream->pause(mStream)) :
+ Result::NOT_SUPPORTED;
+}
+
+Return<Result> StreamOut::resume() {
+ return mStream->resume != NULL ?
+ mStreamCommon->analyzeStatus("resume", mStream->resume(mStream)) :
+ Result::NOT_SUPPORTED;
+}
+
+Return<bool> StreamOut::supportsDrain() {
+ return mStream->drain != NULL;
+}
+
+Return<Result> StreamOut::drain(AudioDrain type) {
+ return mStream->drain != NULL ?
+ mStreamCommon->analyzeStatus(
+ "drain", mStream->drain(mStream, static_cast<audio_drain_type_t>(type))) :
+ Result::NOT_SUPPORTED;
+}
+
+Return<Result> StreamOut::flush() {
+ return mStream->flush != NULL ?
+ mStreamCommon->analyzeStatus("flush", mStream->flush(mStream)) :
+ Result::NOT_SUPPORTED;
+}
+
+Return<void> StreamOut::getPresentationPosition(getPresentationPosition_cb _hidl_cb) {
+ Result retval(Result::NOT_SUPPORTED);
+ uint64_t frames = 0;
+ TimeSpec timeStamp = { 0, 0 };
+ if (mStream->get_presentation_position != NULL) {
+ struct timespec halTimeStamp;
+ retval = mStreamCommon->analyzeStatus(
+ "get_presentation_position",
+ mStream->get_presentation_position(mStream, &frames, &halTimeStamp));
+ if (retval == Result::OK) {
+ timeStamp.tvSec = halTimeStamp.tv_sec;
+ timeStamp.tvNSec = halTimeStamp.tv_nsec;
+ }
+ }
+ _hidl_cb(retval, frames, timeStamp);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/2.0/default/StreamOut.h b/audio/2.0/default/StreamOut.h
new file mode 100644
index 0000000..51b7df8
--- /dev/null
+++ b/audio/2.0/default/StreamOut.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
+#define HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
+
+#include <android/hardware/audio/2.0/IStreamOut.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Stream.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioChannelMask;
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioFormat;
+using ::android::hardware::audio::V2_0::AudioDrain;
+using ::android::hardware::audio::V2_0::DeviceAddress;
+using ::android::hardware::audio::V2_0::IStream;
+using ::android::hardware::audio::V2_0::IStreamOut;
+using ::android::hardware::audio::V2_0::IStreamOutCallback;
+using ::android::hardware::audio::V2_0::ParameterValue;
+using ::android::hardware::audio::V2_0::Result;
+using ::android::hardware::audio::V2_0::TimeSpec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct StreamOut : public IStreamOut {
+ StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream);
+
+ // Methods from ::android::hardware::audio::V2_0::IStream follow.
+ Return<uint64_t> getFrameSize() override;
+ Return<uint64_t> getFrameCount() override;
+ Return<uint64_t> getBufferSize() override;
+ Return<uint32_t> getSampleRate() override;
+ Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
+ Return<Result> setSampleRate(uint32_t sampleRateHz) override;
+ Return<AudioChannelMask> getChannelMask() override;
+ Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
+ Return<Result> setChannelMask(AudioChannelMask mask) override;
+ Return<AudioFormat> getFormat() override;
+ Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
+ Return<Result> setFormat(AudioFormat format) override;
+ Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override;
+ Return<Result> addEffect(uint64_t effectId) override;
+ Return<Result> removeEffect(uint64_t effectId) override;
+ Return<Result> standby() override;
+ Return<AudioDevice> getDevice() override;
+ Return<Result> setDevice(const DeviceAddress& address) override;
+ Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
+ Return<Result> setHwAvSync(uint32_t hwAvSync) override;
+ Return<void> getParameters(
+ const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override;
+ Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ // Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
+ Return<uint32_t> getLatency() override;
+ Return<Result> setVolume(float left, float right) override;
+ Return<void> write(const hidl_vec<uint8_t>& data, write_cb _hidl_cb) override;
+ Return<void> getRenderPosition(getRenderPosition_cb _hidl_cb) override;
+ Return<void> getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb) override;
+ Return<Result> setCallback(const sp<IStreamOutCallback>& callback) override;
+ Return<void> supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb) override;
+ Return<Result> pause() override;
+ Return<Result> resume() override;
+ Return<bool> supportsDrain() override;
+ Return<Result> drain(AudioDrain type) override;
+ Return<Result> flush() override;
+ Return<void> getPresentationPosition(getPresentationPosition_cb _hidl_cb) override;
+
+ private:
+ audio_hw_device_t *mDevice;
+ audio_stream_out_t *mStream;
+ sp<Stream> mStreamCommon;
+ // Do not store sp<> to avoid creating a reference loop if the entity that holds
+ // onto the output stream owns or implements the callback.
+ wp<IStreamOutCallback> mCallback;
+
+ virtual ~StreamOut();
+
+ static int asyncCallback(stream_callback_event_t event, void *param, void *cookie);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp
index 39708c2..147f7b9 100644
--- a/audio/2.0/default/service.cpp
+++ b/audio/2.0/default/service.cpp
@@ -14,28 +14,23 @@
* limitations under the License.
*/
-#define LOG_TAG "soundtriggerhal"
+#define LOG_TAG "audiohalservice"
-#include <hwbinder/IInterface.h>
-#include <hwbinder/IPCThreadState.h>
-#include <hwbinder/ProcessState.h>
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <utils/Looper.h>
-#include <utils/StrongPointer.h>
+#include <hidl/LegacySupport.h>
+#include <android/hardware/audio/2.0/IDevicesFactory.h>
+#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
using android::hardware::IPCThreadState;
using android::hardware::ProcessState;
+using android::hardware::audio::effect::V2_0::IEffectsFactory;
+using android::hardware::audio::V2_0::IDevicesFactory;
using android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
+using android::hardware::registerPassthroughServiceImplementation;
int main(int /* argc */, char* /* argv */ []) {
- android::sp<ISoundTriggerHw> service =
- ISoundTriggerHw::getService("sound_trigger.primary", true /* getStub */);
-
- service->registerAsService("sound_trigger.primary");
-
- ProcessState::self()->setThreadPoolMaxThreadCount(0);
- ProcessState::self()->startThreadPool();
- IPCThreadState::self()->joinThreadPool();
+ registerPassthroughServiceImplementation<IDevicesFactory>("audio_devices_factory");
+ registerPassthroughServiceImplementation<IEffectsFactory>("audio_effects_factory");
+ registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary");
+ return android::hardware::launchRpcServer(16);
}
diff --git a/audio/2.0/types.hal b/audio/2.0/types.hal
index 6369885..9a5e4f1 100644
--- a/audio/2.0/types.hal
+++ b/audio/2.0/types.hal
@@ -66,7 +66,7 @@
int32_t card;
int32_t device;
} alsa; // used for USB_*
- int32_t busId; // used for BUS
} address;
+ string busAddress; // used for BUS
string rSubmixAddress; // used for REMOTE_SUBMIX
};
diff --git a/audio/Android.bp b/audio/Android.bp
index 4117288..3121a36 100644
--- a/audio/Android.bp
+++ b/audio/Android.bp
@@ -3,4 +3,5 @@
"2.0",
"common/2.0",
"effect/2.0",
+ "effect/2.0/vts/functional",
]
diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp
index a00e2bd..89ce3b6 100644
--- a/audio/common/2.0/Android.bp
+++ b/audio/common/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.audio.common@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.common@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.common@2.0",
srcs: [
"types.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.audio.common@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.common@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.common@2.0",
srcs: [
"types.hal",
],
diff --git a/audio/common/2.0/default/Android.mk b/audio/common/2.0/default/Android.mk
new file mode 100644
index 0000000..aa60eb2
--- /dev/null
+++ b/audio/common/2.0/default/Android.mk
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2016 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.
+
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio.common@2.0-util
+LOCAL_SRC_FILES := \
+ EffectMap.cpp \
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/audio/common/2.0/default/EffectMap.cpp b/audio/common/2.0/default/EffectMap.cpp
new file mode 100644
index 0000000..703b91c
--- /dev/null
+++ b/audio/common/2.0/default/EffectMap.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <atomic>
+
+#include "EffectMap.h"
+
+namespace android {
+
+ANDROID_SINGLETON_STATIC_INSTANCE(EffectMap);
+
+// static
+const uint64_t EffectMap::INVALID_ID = 0;
+
+// static
+uint64_t EffectMap::makeUniqueId() {
+ static std::atomic<uint64_t> counter{INVALID_ID + 1};
+ return counter++;
+}
+
+uint64_t EffectMap::add(effect_handle_t handle) {
+ uint64_t newId = makeUniqueId();
+ std::lock_guard<std::mutex> lock(mLock);
+ mEffects.add(newId, handle);
+ return newId;
+}
+
+effect_handle_t EffectMap::get(const uint64_t& id) {
+ std::lock_guard<std::mutex> lock(mLock);
+ ssize_t idx = mEffects.indexOfKey(id);
+ return idx >= 0 ? mEffects[idx] : NULL;
+}
+
+void EffectMap::remove(effect_handle_t handle) {
+ std::lock_guard<std::mutex> lock(mLock);
+ for (size_t i = 0; i < mEffects.size(); ++i) {
+ if (mEffects[i] == handle) {
+ mEffects.removeItemsAt(i);
+ break;
+ }
+ }
+}
+
+} // namespace android
diff --git a/audio/common/2.0/default/EffectMap.h b/audio/common/2.0/default/EffectMap.h
new file mode 100644
index 0000000..82bbb1f
--- /dev/null
+++ b/audio/common/2.0/default/EffectMap.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef android_hardware_audio_V2_0_EffectMap_H_
+#define android_hardware_audio_V2_0_EffectMap_H_
+
+#include <mutex>
+
+#include <hardware/audio_effect.h>
+#include <utils/KeyedVector.h>
+#include <utils/Singleton.h>
+
+namespace android {
+
+// This class needs to be in 'android' ns because Singleton macros require that.
+class EffectMap : public Singleton<EffectMap> {
+ public:
+ static const uint64_t INVALID_ID;
+
+ uint64_t add(effect_handle_t handle);
+ effect_handle_t get(const uint64_t& id);
+ void remove(effect_handle_t handle);
+
+ private:
+ static uint64_t makeUniqueId();
+
+ std::mutex mLock;
+ KeyedVector<uint64_t, effect_handle_t> mEffects;
+};
+
+} // namespace android
+
+#endif // android_hardware_audio_V2_0_EffectMap_H_
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
index a5ec68d..75fdb52 100644
--- a/audio/common/2.0/types.hal
+++ b/audio/common/2.0/types.hal
@@ -555,8 +555,7 @@
IN_IP = BIT_IN | 0x80000,
/* audio bus implemented by the audio system (e.g an MOST stereo channel) */
IN_BUS = BIT_IN | 0x100000,
- IN_DEFAULT = BIT_IN |
- BIT_DEFAULT,
+ IN_DEFAULT = BIT_IN | BIT_DEFAULT,
IN_ALL = (IN_COMMUNICATION |
IN_AMBIENT |
@@ -798,10 +797,10 @@
union UseCase {
AudioStreamType stream;
AudioSource source;
- };
+ } useCase;
} mix;
AudioPortConfigSessionExt session;
- };
+ } ext;
};
/*
@@ -849,16 +848,5 @@
AudioPortDeviceExt device;
AudioPortMixExt mix;
AudioPortSessionExt session;
- };
-};
-
-/*
- * An audio patch represents a connection between one or more source ports and
- * one or more sink ports. Patches are connected and disconnected by audio
- * policy manager or by applications via framework APIs.
- */
-struct AudioPatch {
- AudioPatchHandle id;
- vec<AudioPortConfig> sources;
- vec<AudioPortConfig> sinks;
+ } ext;
};
diff --git a/audio/common/2.0/vts/types.vts b/audio/common/2.0/vts/types.vts
new file mode 100644
index 0000000..9c79611
--- /dev/null
+++ b/audio/common/2.0/vts/types.vts
@@ -0,0 +1,1678 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "types"
+
+package: "android.hardware.audio.common"
+
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioHandleConsts"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "AUDIO_IO_HANDLE_NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "AUDIO_MODULE_HANDLE_NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "AUDIO_PORT_HANDLE_NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "AUDIO_PATCH_HANDLE_NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::Uuid"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "timeLow"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "timeMid"
+ type: TYPE_SCALAR
+ scalar_type: "uint16_t"
+ }
+ struct_value: {
+ name: "versionAndTimeHigh"
+ type: TYPE_SCALAR
+ scalar_type: "uint16_t"
+ }
+ struct_value: {
+ name: "variantAndClockSeqHigh"
+ type: TYPE_SCALAR
+ scalar_type: "uint16_t"
+ }
+ struct_value: {
+ name: "node"
+ type: TYPE_ARRAY
+ vector_value: {
+ vector_size: 6
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioStreamType"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "DEFAULT"
+ scalar_value: {
+ int32_t: -1
+ }
+ enumerator: "MIN"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "VOICE_CALL"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "SYSTEM"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "RING"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "MUSIC"
+ scalar_value: {
+ int32_t: 3
+ }
+ enumerator: "ALARM"
+ scalar_value: {
+ int32_t: 4
+ }
+ enumerator: "NOTIFICATION"
+ scalar_value: {
+ int32_t: 5
+ }
+ enumerator: "BLUETOOTH_SCO"
+ scalar_value: {
+ int32_t: 6
+ }
+ enumerator: "ENFORCED_AUDIBLE"
+ scalar_value: {
+ int32_t: 7
+ }
+ enumerator: "DTMF"
+ scalar_value: {
+ int32_t: 8
+ }
+ enumerator: "TTS"
+ scalar_value: {
+ int32_t: 9
+ }
+ enumerator: "ACCESSIBILITY"
+ scalar_value: {
+ int32_t: 10
+ }
+ enumerator: "REROUTING"
+ scalar_value: {
+ int32_t: 11
+ }
+ enumerator: "PATCH"
+ scalar_value: {
+ int32_t: 12
+ }
+ enumerator: "PUBLIC_CNT"
+ scalar_value: {
+ int32_t: 10
+ }
+ enumerator: "FOR_POLICY_CNT"
+ scalar_value: {
+ int32_t: 12
+ }
+ enumerator: "CNT"
+ scalar_value: {
+ int32_t: 13
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioSource"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "DEFAULT"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "MIC"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "VOICE_UPLINK"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "VOICE_DOWNLINK"
+ scalar_value: {
+ int32_t: 3
+ }
+ enumerator: "VOICE_CALL"
+ scalar_value: {
+ int32_t: 4
+ }
+ enumerator: "CAMCORDER"
+ scalar_value: {
+ int32_t: 5
+ }
+ enumerator: "VOICE_RECOGNITION"
+ scalar_value: {
+ int32_t: 6
+ }
+ enumerator: "VOICE_COMMUNICATION"
+ scalar_value: {
+ int32_t: 7
+ }
+ enumerator: "REMOTE_SUBMIX"
+ scalar_value: {
+ int32_t: 8
+ }
+ enumerator: "UNPROCESSED"
+ scalar_value: {
+ int32_t: 9
+ }
+ enumerator: "CNT"
+ scalar_value: {
+ int32_t: 10
+ }
+ enumerator: "MAX"
+ scalar_value: {
+ int32_t: 9
+ }
+ enumerator: "FM_TUNER"
+ scalar_value: {
+ int32_t: 1998
+ }
+ enumerator: "HOTWORD"
+ scalar_value: {
+ int32_t: 1999
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioSessionConsts"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "OUTPUT_STAGE"
+ scalar_value: {
+ int32_t: -1
+ }
+ enumerator: "OUTPUT_MIX"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "ALLOCATE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioFormat"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "INVALID"
+ scalar_value: {
+ uint32_t: 4294967295
+ }
+ enumerator: "DEFAULT"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "PCM"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "MP3"
+ scalar_value: {
+ uint32_t: 16777216
+ }
+ enumerator: "AMR_NB"
+ scalar_value: {
+ uint32_t: 33554432
+ }
+ enumerator: "AMR_WB"
+ scalar_value: {
+ uint32_t: 50331648
+ }
+ enumerator: "AAC"
+ scalar_value: {
+ uint32_t: 67108864
+ }
+ enumerator: "HE_AAC_V1"
+ scalar_value: {
+ uint32_t: 83886080
+ }
+ enumerator: "HE_AAC_V2"
+ scalar_value: {
+ uint32_t: 100663296
+ }
+ enumerator: "VORBIS"
+ scalar_value: {
+ uint32_t: 117440512
+ }
+ enumerator: "OPUS"
+ scalar_value: {
+ uint32_t: 134217728
+ }
+ enumerator: "AC3"
+ scalar_value: {
+ uint32_t: 150994944
+ }
+ enumerator: "E_AC3"
+ scalar_value: {
+ uint32_t: 167772160
+ }
+ enumerator: "DTS"
+ scalar_value: {
+ uint32_t: 184549376
+ }
+ enumerator: "DTS_HD"
+ scalar_value: {
+ uint32_t: 201326592
+ }
+ enumerator: "IEC61937"
+ scalar_value: {
+ uint32_t: 218103808
+ }
+ enumerator: "DOLBY_TRUEHD"
+ scalar_value: {
+ uint32_t: 234881024
+ }
+ enumerator: "MAIN_MASK"
+ scalar_value: {
+ uint32_t: 4278190080
+ }
+ enumerator: "SUB_MASK"
+ scalar_value: {
+ uint32_t: 16777215
+ }
+ enumerator: "PCM_SUB_16_BIT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "PCM_SUB_8_BIT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "PCM_SUB_32_BIT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "PCM_SUB_8_24_BIT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "PCM_SUB_FLOAT"
+ scalar_value: {
+ uint32_t: 5
+ }
+ enumerator: "PCM_SUB_24_BIT_PACKED"
+ scalar_value: {
+ uint32_t: 6
+ }
+ enumerator: "MP3_SUB_NONE"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "AMR_SUB_NONE"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "AAC_SUB_MAIN"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "AAC_SUB_LC"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "AAC_SUB_SSR"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "AAC_SUB_LTP"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "AAC_SUB_HE_V1"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "AAC_SUB_SCALABLE"
+ scalar_value: {
+ uint32_t: 32
+ }
+ enumerator: "AAC_SUB_ERLC"
+ scalar_value: {
+ uint32_t: 64
+ }
+ enumerator: "AAC_SUB_LD"
+ scalar_value: {
+ uint32_t: 128
+ }
+ enumerator: "AAC_SUB_HE_V2"
+ scalar_value: {
+ uint32_t: 256
+ }
+ enumerator: "AAC_SUB_ELD"
+ scalar_value: {
+ uint32_t: 512
+ }
+ enumerator: "VORBIS_SUB_NONE"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "PCM_16_BIT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "PCM_8_BIT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "PCM_32_BIT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "PCM_8_24_BIT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "PCM_FLOAT"
+ scalar_value: {
+ uint32_t: 5
+ }
+ enumerator: "PCM_24_BIT_PACKED"
+ scalar_value: {
+ uint32_t: 6
+ }
+ enumerator: "AAC_MAIN"
+ scalar_value: {
+ uint32_t: 67108865
+ }
+ enumerator: "AAC_LC"
+ scalar_value: {
+ uint32_t: 67108866
+ }
+ enumerator: "AAC_SSR"
+ scalar_value: {
+ uint32_t: 67108868
+ }
+ enumerator: "AAC_LTP"
+ scalar_value: {
+ uint32_t: 67108872
+ }
+ enumerator: "AAC_HE_V1"
+ scalar_value: {
+ uint32_t: 67108880
+ }
+ enumerator: "AAC_SCALABLE"
+ scalar_value: {
+ uint32_t: 67108896
+ }
+ enumerator: "AAC_ERLC"
+ scalar_value: {
+ uint32_t: 67108928
+ }
+ enumerator: "AAC_LD"
+ scalar_value: {
+ uint32_t: 67108992
+ }
+ enumerator: "AAC_HE_V2"
+ scalar_value: {
+ uint32_t: 67109120
+ }
+ enumerator: "AAC_ELD"
+ scalar_value: {
+ uint32_t: 67109376
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::FixedChannelCount"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "FCC_2"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "FCC_8"
+ scalar_value: {
+ int32_t: 8
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "REPRESENTATION_POSITION"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "REPRESENTATION_INDEX"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "NONE"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "INVALID"
+ scalar_value: {
+ uint32_t: 3221225472
+ }
+ enumerator: "OUT_FRONT_LEFT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "OUT_FRONT_RIGHT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "OUT_FRONT_CENTER"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "OUT_LOW_FREQUENCY"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "OUT_BACK_LEFT"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "OUT_BACK_RIGHT"
+ scalar_value: {
+ uint32_t: 32
+ }
+ enumerator: "OUT_FRONT_LEFT_OF_CENTER"
+ scalar_value: {
+ uint32_t: 64
+ }
+ enumerator: "OUT_FRONT_RIGHT_OF_CENTER"
+ scalar_value: {
+ uint32_t: 128
+ }
+ enumerator: "OUT_BACK_CENTER"
+ scalar_value: {
+ uint32_t: 256
+ }
+ enumerator: "OUT_SIDE_LEFT"
+ scalar_value: {
+ uint32_t: 512
+ }
+ enumerator: "OUT_SIDE_RIGHT"
+ scalar_value: {
+ uint32_t: 1024
+ }
+ enumerator: "OUT_TOP_CENTER"
+ scalar_value: {
+ uint32_t: 2048
+ }
+ enumerator: "OUT_TOP_FRONT_LEFT"
+ scalar_value: {
+ uint32_t: 4096
+ }
+ enumerator: "OUT_TOP_FRONT_CENTER"
+ scalar_value: {
+ uint32_t: 8192
+ }
+ enumerator: "OUT_TOP_FRONT_RIGHT"
+ scalar_value: {
+ uint32_t: 16384
+ }
+ enumerator: "OUT_TOP_BACK_LEFT"
+ scalar_value: {
+ uint32_t: 32768
+ }
+ enumerator: "OUT_TOP_BACK_CENTER"
+ scalar_value: {
+ uint32_t: 65536
+ }
+ enumerator: "OUT_TOP_BACK_RIGHT"
+ scalar_value: {
+ uint32_t: 131072
+ }
+ enumerator: "OUT_MONO"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "OUT_STEREO"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "OUT_QUAD"
+ scalar_value: {
+ uint32_t: 51
+ }
+ enumerator: "OUT_QUAD_BACK"
+ scalar_value: {
+ uint32_t: 51
+ }
+ enumerator: "OUT_QUAD_SIDE"
+ scalar_value: {
+ uint32_t: 1539
+ }
+ enumerator: "OUT_5POINT1"
+ scalar_value: {
+ uint32_t: 63
+ }
+ enumerator: "OUT_5POINT1_BACK"
+ scalar_value: {
+ uint32_t: 63
+ }
+ enumerator: "OUT_5POINT1_SIDE"
+ scalar_value: {
+ uint32_t: 1551
+ }
+ enumerator: "OUT_7POINT1"
+ scalar_value: {
+ uint32_t: 1599
+ }
+ enumerator: "OUT_ALL"
+ scalar_value: {
+ uint32_t: 262143
+ }
+ enumerator: "IN_LEFT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "IN_RIGHT"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "IN_FRONT"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "IN_BACK"
+ scalar_value: {
+ uint32_t: 32
+ }
+ enumerator: "IN_LEFT_PROCESSED"
+ scalar_value: {
+ uint32_t: 64
+ }
+ enumerator: "IN_RIGHT_PROCESSED"
+ scalar_value: {
+ uint32_t: 128
+ }
+ enumerator: "IN_FRONT_PROCESSED"
+ scalar_value: {
+ uint32_t: 256
+ }
+ enumerator: "IN_BACK_PROCESSED"
+ scalar_value: {
+ uint32_t: 512
+ }
+ enumerator: "IN_PRESSURE"
+ scalar_value: {
+ uint32_t: 1024
+ }
+ enumerator: "IN_X_AXIS"
+ scalar_value: {
+ uint32_t: 2048
+ }
+ enumerator: "IN_Y_AXIS"
+ scalar_value: {
+ uint32_t: 4096
+ }
+ enumerator: "IN_Z_AXIS"
+ scalar_value: {
+ uint32_t: 8192
+ }
+ enumerator: "IN_VOICE_UPLINK"
+ scalar_value: {
+ uint32_t: 16384
+ }
+ enumerator: "IN_VOICE_DNLINK"
+ scalar_value: {
+ uint32_t: 32768
+ }
+ enumerator: "IN_MONO"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "IN_STEREO"
+ scalar_value: {
+ uint32_t: 12
+ }
+ enumerator: "IN_FRONT_BACK"
+ scalar_value: {
+ uint32_t: 48
+ }
+ enumerator: "IN_ALL"
+ scalar_value: {
+ uint32_t: 65532
+ }
+ enumerator: "COUNT_MAX"
+ scalar_value: {
+ uint32_t: 30
+ }
+ enumerator: "INDEX_HDR"
+ scalar_value: {
+ uint32_t: 2147483648
+ }
+ enumerator: "INDEX_MASK_1"
+ scalar_value: {
+ uint32_t: 2147483649
+ }
+ enumerator: "INDEX_MASK_2"
+ scalar_value: {
+ uint32_t: 2147483651
+ }
+ enumerator: "INDEX_MASK_3"
+ scalar_value: {
+ uint32_t: 2147483655
+ }
+ enumerator: "INDEX_MASK_4"
+ scalar_value: {
+ uint32_t: 2147483663
+ }
+ enumerator: "INDEX_MASK_5"
+ scalar_value: {
+ uint32_t: 2147483679
+ }
+ enumerator: "INDEX_MASK_6"
+ scalar_value: {
+ uint32_t: 2147483711
+ }
+ enumerator: "INDEX_MASK_7"
+ scalar_value: {
+ uint32_t: 2147483775
+ }
+ enumerator: "INDEX_MASK_8"
+ scalar_value: {
+ uint32_t: 2147483903
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioInterleave"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "LEFT"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "RIGHT"
+ scalar_value: {
+ int32_t: 1
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioMode"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "INVALID"
+ scalar_value: {
+ int32_t: -2
+ }
+ enumerator: "CURRENT"
+ scalar_value: {
+ int32_t: -1
+ }
+ enumerator: "NORMAL"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "RINGTONE"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "IN_CALL"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "IN_COMMUNICATION"
+ scalar_value: {
+ int32_t: 3
+ }
+ enumerator: "CNT"
+ scalar_value: {
+ int32_t: 4
+ }
+ enumerator: "MAX"
+ scalar_value: {
+ int32_t: 3
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioDevice"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "NONE"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "BIT_IN"
+ scalar_value: {
+ uint32_t: 2147483648
+ }
+ enumerator: "BIT_DEFAULT"
+ scalar_value: {
+ uint32_t: 1073741824
+ }
+ enumerator: "OUT_EARPIECE"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "OUT_SPEAKER"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "OUT_WIRED_HEADSET"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "OUT_WIRED_HEADPHONE"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "OUT_BLUETOOTH_SCO"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "OUT_BLUETOOTH_SCO_HEADSET"
+ scalar_value: {
+ uint32_t: 32
+ }
+ enumerator: "OUT_BLUETOOTH_SCO_CARKIT"
+ scalar_value: {
+ uint32_t: 64
+ }
+ enumerator: "OUT_BLUETOOTH_A2DP"
+ scalar_value: {
+ uint32_t: 128
+ }
+ enumerator: "OUT_BLUETOOTH_A2DP_HEADPHONES"
+ scalar_value: {
+ uint32_t: 256
+ }
+ enumerator: "OUT_BLUETOOTH_A2DP_SPEAKER"
+ scalar_value: {
+ uint32_t: 512
+ }
+ enumerator: "OUT_AUX_DIGITAL"
+ scalar_value: {
+ uint32_t: 1024
+ }
+ enumerator: "OUT_HDMI"
+ scalar_value: {
+ uint32_t: 1024
+ }
+ enumerator: "OUT_ANLG_DOCK_HEADSET"
+ scalar_value: {
+ uint32_t: 2048
+ }
+ enumerator: "OUT_DGTL_DOCK_HEADSET"
+ scalar_value: {
+ uint32_t: 4096
+ }
+ enumerator: "OUT_USB_ACCESSORY"
+ scalar_value: {
+ uint32_t: 8192
+ }
+ enumerator: "OUT_USB_DEVICE"
+ scalar_value: {
+ uint32_t: 16384
+ }
+ enumerator: "OUT_REMOTE_SUBMIX"
+ scalar_value: {
+ uint32_t: 32768
+ }
+ enumerator: "OUT_TELEPHONY_TX"
+ scalar_value: {
+ uint32_t: 65536
+ }
+ enumerator: "OUT_LINE"
+ scalar_value: {
+ uint32_t: 131072
+ }
+ enumerator: "OUT_HDMI_ARC"
+ scalar_value: {
+ uint32_t: 262144
+ }
+ enumerator: "OUT_SPDIF"
+ scalar_value: {
+ uint32_t: 524288
+ }
+ enumerator: "OUT_FM"
+ scalar_value: {
+ uint32_t: 1048576
+ }
+ enumerator: "OUT_AUX_LINE"
+ scalar_value: {
+ uint32_t: 2097152
+ }
+ enumerator: "OUT_SPEAKER_SAFE"
+ scalar_value: {
+ uint32_t: 4194304
+ }
+ enumerator: "OUT_IP"
+ scalar_value: {
+ uint32_t: 8388608
+ }
+ enumerator: "OUT_BUS"
+ scalar_value: {
+ uint32_t: 16777216
+ }
+ enumerator: "OUT_DEFAULT"
+ scalar_value: {
+ uint32_t: 1073741824
+ }
+ enumerator: "OUT_ALL"
+ scalar_value: {
+ uint32_t: 1107296255
+ }
+ enumerator: "OUT_ALL_A2DP"
+ scalar_value: {
+ uint32_t: 896
+ }
+ enumerator: "OUT_ALL_SCO"
+ scalar_value: {
+ uint32_t: 112
+ }
+ enumerator: "OUT_ALL_USB"
+ scalar_value: {
+ uint32_t: 24576
+ }
+ enumerator: "IN_COMMUNICATION"
+ scalar_value: {
+ uint32_t: 2147483649
+ }
+ enumerator: "IN_AMBIENT"
+ scalar_value: {
+ uint32_t: 2147483650
+ }
+ enumerator: "IN_BUILTIN_MIC"
+ scalar_value: {
+ uint32_t: 2147483652
+ }
+ enumerator: "IN_BLUETOOTH_SCO_HEADSET"
+ scalar_value: {
+ uint32_t: 2147483656
+ }
+ enumerator: "IN_WIRED_HEADSET"
+ scalar_value: {
+ uint32_t: 2147483664
+ }
+ enumerator: "IN_AUX_DIGITAL"
+ scalar_value: {
+ uint32_t: 2147483680
+ }
+ enumerator: "IN_HDMI"
+ scalar_value: {
+ uint32_t: 2147483680
+ }
+ enumerator: "IN_VOICE_CALL"
+ scalar_value: {
+ uint32_t: 2147483712
+ }
+ enumerator: "IN_TELEPHONY_RX"
+ scalar_value: {
+ uint32_t: 2147483712
+ }
+ enumerator: "IN_BACK_MIC"
+ scalar_value: {
+ uint32_t: 2147483776
+ }
+ enumerator: "IN_REMOTE_SUBMIX"
+ scalar_value: {
+ uint32_t: 2147483904
+ }
+ enumerator: "IN_ANLG_DOCK_HEADSET"
+ scalar_value: {
+ uint32_t: 2147484160
+ }
+ enumerator: "IN_DGTL_DOCK_HEADSET"
+ scalar_value: {
+ uint32_t: 2147484672
+ }
+ enumerator: "IN_USB_ACCESSORY"
+ scalar_value: {
+ uint32_t: 2147485696
+ }
+ enumerator: "IN_USB_DEVICE"
+ scalar_value: {
+ uint32_t: 2147487744
+ }
+ enumerator: "IN_FM_TUNER"
+ scalar_value: {
+ uint32_t: 2147491840
+ }
+ enumerator: "IN_TV_TUNER"
+ scalar_value: {
+ uint32_t: 2147500032
+ }
+ enumerator: "IN_LINE"
+ scalar_value: {
+ uint32_t: 2147516416
+ }
+ enumerator: "IN_SPDIF"
+ scalar_value: {
+ uint32_t: 2147549184
+ }
+ enumerator: "IN_BLUETOOTH_A2DP"
+ scalar_value: {
+ uint32_t: 2147614720
+ }
+ enumerator: "IN_LOOPBACK"
+ scalar_value: {
+ uint32_t: 2147745792
+ }
+ enumerator: "IN_IP"
+ scalar_value: {
+ uint32_t: 2148007936
+ }
+ enumerator: "IN_BUS"
+ scalar_value: {
+ uint32_t: 2148532224
+ }
+ enumerator: "IN_DEFAULT"
+ scalar_value: {
+ uint32_t: 3221225472
+ }
+ enumerator: "IN_ALL"
+ scalar_value: {
+ uint32_t: 3223322623
+ }
+ enumerator: "IN_ALL_SCO"
+ scalar_value: {
+ uint32_t: 2147483656
+ }
+ enumerator: "IN_ALL_USB"
+ scalar_value: {
+ uint32_t: 2147489792
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioOutputFlag"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "DIRECT"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "PRIMARY"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "FAST"
+ scalar_value: {
+ int32_t: 4
+ }
+ enumerator: "DEEP_BUFFER"
+ scalar_value: {
+ int32_t: 8
+ }
+ enumerator: "COMPRESS_OFFLOAD"
+ scalar_value: {
+ int32_t: 16
+ }
+ enumerator: "NON_BLOCKING"
+ scalar_value: {
+ int32_t: 32
+ }
+ enumerator: "HW_AV_SYNC"
+ scalar_value: {
+ int32_t: 64
+ }
+ enumerator: "TTS"
+ scalar_value: {
+ int32_t: 128
+ }
+ enumerator: "RAW"
+ scalar_value: {
+ int32_t: 256
+ }
+ enumerator: "SYNC"
+ scalar_value: {
+ int32_t: 512
+ }
+ enumerator: "IEC958_NONAUDIO"
+ scalar_value: {
+ int32_t: 1024
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioInputFlag"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "FAST"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "HW_HOTWORD"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "RAW"
+ scalar_value: {
+ int32_t: 4
+ }
+ enumerator: "SYNC"
+ scalar_value: {
+ int32_t: 8
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioOffloadInfo"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "sampleRateHz"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "channelMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ struct_value: {
+ name: "format"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioFormat"
+ }
+ struct_value: {
+ name: "streamType"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioStreamType"
+ }
+ struct_value: {
+ name: "bitRatePerSecond"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "durationMicroseconds"
+ type: TYPE_SCALAR
+ scalar_type: "int64_t"
+ }
+ struct_value: {
+ name: "hasVideo"
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+ struct_value: {
+ name: "isStreaming"
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioConfig"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "sampleRateHz"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "channelMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ struct_value: {
+ name: "format"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioFormat"
+ }
+ struct_value: {
+ name: "offloadInfo"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioOffloadInfo"
+ }
+ struct_value: {
+ name: "frameCount"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioGainMode"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "JOINT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "CHANNELS"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "RAMP"
+ scalar_value: {
+ uint32_t: 4
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioGain"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "mode"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioGainMode"
+ }
+ struct_value: {
+ name: "channelMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ struct_value: {
+ name: "minValue"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "maxValue"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "defaultValue"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "stepValue"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "minRampMs"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "maxRampMs"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioGainConfig"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "index"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "mode"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioGainMode"
+ }
+ struct_value: {
+ name: "channelMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ struct_value: {
+ name: "values"
+ type: TYPE_ARRAY
+ vector_value: {
+ vector_size: 32
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+ struct_value: {
+ name: "rampDurationMs"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortRole"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "SOURCE"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "SINK"
+ scalar_value: {
+ int32_t: 2
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortType"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "NONE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "DEVICE"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "MIX"
+ scalar_value: {
+ int32_t: 2
+ }
+ enumerator: "SESSION"
+ scalar_value: {
+ int32_t: 3
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfigDeviceExt"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "hwModule"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "type"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioDevice"
+ }
+ struct_value: {
+ name: "address"
+ type: TYPE_ARRAY
+ vector_value: {
+ vector_size: 32
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfigSessionExt"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "session"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfigMask"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "SAMPLE_RATE"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "CHANNEL_MASK"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "FORMAT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "GAIN"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "ALL"
+ scalar_value: {
+ uint32_t: 15
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfig"
+ type: TYPE_STRUCT
+ sub_struct: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfig::Ext"
+ type: TYPE_UNION
+ sub_union: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfig::Ext::AudioPortConfigMixExt"
+ type: TYPE_STRUCT
+ sub_struct: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortConfig::Ext::AudioPortConfigMixExt::UseCase"
+ type: TYPE_UNION
+ union_value: {
+ name: "stream"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioStreamType"
+ }
+ union_value: {
+ name: "source"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioSource"
+ }
+ }
+ struct_value: {
+ name: "hwModule"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "ioHandle"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+ union_value: {
+ name: "device"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfigDeviceExt"
+ }
+ union_value: {
+ name: "mix"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfig::Ext::AudioPortConfigMixExt"
+ }
+ union_value: {
+ name: "session"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfigSessionExt"
+ }
+ }
+ struct_value: {
+ name: "id"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "configMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfigMask"
+ }
+ struct_value: {
+ name: "sampleRateHz"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ struct_value: {
+ name: "channelMask"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ struct_value: {
+ name: "format"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioFormat"
+ }
+ struct_value: {
+ name: "gain"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioGainConfig"
+ }
+ struct_value: {
+ name: "type"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortType"
+ }
+ struct_value: {
+ name: "role"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortRole"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortDeviceExt"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "hwModule"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "type"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioDevice"
+ }
+ struct_value: {
+ name: "address"
+ type: TYPE_ARRAY
+ vector_value: {
+ vector_size: 32
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioMixLatencyClass"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "LOW"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "NORMAL"
+ scalar_value: {
+ int32_t: 1
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortMixExt"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "hwModule"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "ioHandle"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "latencyClass"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioMixLatencyClass"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPortSessionExt"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "session"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPort"
+ type: TYPE_STRUCT
+ sub_struct: {
+ name: "::android::hardware::audio::common::V2_0::AudioPort::Ext"
+ type: TYPE_UNION
+ union_value: {
+ name: "device"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortDeviceExt"
+ }
+ union_value: {
+ name: "mix"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortMixExt"
+ }
+ union_value: {
+ name: "session"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortSessionExt"
+ }
+ }
+ struct_value: {
+ name: "id"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "role"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortRole"
+ }
+ struct_value: {
+ name: "name"
+ type: TYPE_STRING
+ }
+ struct_value: {
+ name: "sampleRates"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+ struct_value: {
+ name: "channelMasks"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioChannelMask"
+ }
+ }
+ struct_value: {
+ name: "formats"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioFormat"
+ }
+ }
+ struct_value: {
+ name: "gains"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioGain"
+ }
+ }
+ struct_value: {
+ name: "activeConfig"
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfig"
+ }
+ struct_value: {
+ name: "type"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortType"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::audio::common::V2_0::AudioPatch"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "id"
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ struct_value: {
+ name: "sources"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfig"
+ }
+ }
+ struct_value: {
+ name: "sinks"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::audio::common::V2_0::AudioPortConfig"
+ }
+ }
+}
+
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
index a7b4131..78829be 100644
--- a/audio/effect/2.0/Android.bp
+++ b/audio/effect/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.audio.effect@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.effect@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.effect@2.0",
srcs: [
"types.hal",
"IAcousticEchoCancelerEffect.hal",
@@ -42,8 +42,8 @@
genrule {
name: "android.hardware.audio.effect@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.effect@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio.effect@2.0",
srcs: [
"types.hal",
"IAcousticEchoCancelerEffect.hal",
@@ -152,5 +152,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.audio.common@2.0",
],
}
diff --git a/audio/effect/2.0/IEffect.hal b/audio/effect/2.0/IEffect.hal
index f1cc795..615a460 100644
--- a/audio/effect/2.0/IEffect.hal
+++ b/audio/effect/2.0/IEffect.hal
@@ -48,9 +48,11 @@
/*
* Reset the effect engine. Keep configuration but resets state and buffer
* content.
+ *
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- reset();
+ reset() generates (Result retval);
/*
* Enable processing.
@@ -74,9 +76,10 @@
* descriptor to receive this command when the device changes.
*
* @param device output device specification.
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- setDevice(AudioDevice device);
+ setDevice(AudioDevice device) generates (Result retval);
/*
* Set and get volume. Used by audio framework to delegate volume control to
@@ -94,9 +97,11 @@
* @return result updated volume values. It is OK to receive an empty vector
* as a result in which case the effect framework has
* delegated volume control to another effect.
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- setAndGetVolume(vec<int32_t> volumes) generates (vec<int32_t> result);
+ setAndGetVolume(vec<uint32_t> volumes)
+ generates (Result retval, vec<uint32_t> result);
/*
* Set the audio mode. The effect implementation must set
@@ -104,9 +109,10 @@
* when the audio mode changes.
*
* @param mode desired audio mode.
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- setAudioMode(AudioMode mode);
+ setAudioMode(AudioMode mode) generates (Result retval);
/*
* Apply new audio parameters configurations for input and output buffers of
@@ -130,58 +136,63 @@
* receive this command when the device changes.
*
* @param device input device specification.
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- setInputDevice(AudioDevice device);
+ setInputDevice(AudioDevice device) generates (Result retval);
/*
* Read audio parameters configurations for input and output buffers.
*
+ * @return retval operation completion status.
* @return config configuration descriptor.
*/
@callflow(next={"*"})
- getConfig() generates (EffectConfig config);
+ getConfig() generates (Result retval, EffectConfig config);
/*
* Read audio parameters configurations for input and output buffers of
* reverse stream.
*
+ * @return retval operation completion status.
* @return config configuration descriptor.
*/
@callflow(next={"*"})
- getConfigReverse() generates (EffectConfig config);
+ getConfigReverse() generates (Result retval, EffectConfig config);
/*
- * Queries for supported configurations for a particular feature (e.g. get
- * the supported combinations of main and auxiliary channels for a noise
- * suppressor). The command parameter is a list of the feature identifiers.
+ * Queries for supported combinations of main and auxiliary channels
+ * (e.g. for a multi-microphone noise suppressor).
*
+ * @param maxConfigs maximum number of the combinations to return.
* @return retval absence of the feature support is indicated using
- * NOT_SUPPORTED code.
+ * NOT_SUPPORTED code. RESULT_TOO_BIG is returned if
+ * the number of supported combinations exceeds 'maxConfigs'.
* @return result list of configuration descriptors.
*/
@callflow(next={"*"})
- getFeatureSupportedConfigs(vec<EffectFeature> features)
- generates (Result retval, vec<EffectFeatureConfig> result);
+ getSupportedAuxChannelsConfigs(uint32_t maxConfigs)
+ generates (Result retval, vec<EffectAuxChannelsConfig> result);
/*
- * Retrieves current configuration for a given feature.
+ * Retrieves the current configuration of main and auxiliary channels.
*
* @return retval absence of the feature support is indicated using
* NOT_SUPPORTED code.
* @return result configuration descriptor.
*/
@callflow(next={"*"})
- getFeatureConfig(EffectFeature feature)
- generates (Result retval, EffectFeatureConfig result);
+ getAuxChannelsConfig()
+ generates (Result retval, EffectAuxChannelsConfig result);
/*
- * Sets current configuration for a given feature.
+ * Sets the current configuration of main and auxiliary channels.
*
- * @return retval operation completion status.
+ * @return retval operation completion status; absence of the feature
+ * support is indicated using NOT_SUPPORTED code.
*/
@callflow(next={"*"})
- setFeatureConfig(EffectFeatureConfig featureConfig)
+ setAuxChannelsConfig(EffectAuxChannelsConfig config)
generates (Result retval);
/*
@@ -189,9 +200,10 @@
* recognition...).
*
* @param source source descriptor.
+ * @return retval operation completion status.
*/
@callflow(next={"*"})
- setAudioSource(AudioSource source);
+ setAudioSource(AudioSource source) generates (Result retval);
/*
* This command indicates if the playback thread the effect is attached to
@@ -207,10 +219,11 @@
/*
* Returns the effect descriptor.
*
+ * @return retval operation completion status.
* @return descriptor effect descriptor.
*/
@callflow(next={"*"})
- getDescriptor() generates (EffectDescriptor descriptor);
+ getDescriptor() generates (Result retval, EffectDescriptor descriptor);
/*
* Effect process function. Takes input samples as specified (count and
@@ -223,13 +236,18 @@
* off the effect gracefully and when done indicate that it is OK to stop
* calling the 'process' function by returning the INVALID_STATE status.
*
+ * Output audio buffer must contain no more frames than the input audio
+ * buffer. Since the effect may transform input channels into a different
+ * amount of channels, the caller provides the output frame size.
+ *
* @param inBuffer input audio buffer.
+ * @param outFrameSize output frame size in bytes.
* @return retval operation completion status.
* @return outBuffer output audio buffer.
*/
// TODO(mnaganov): replace with FMQ version.
@callflow(next={"*"})
- process(AudioBuffer inBuffer)
+ process(AudioBuffer inBuffer, uint32_t outFrameSize)
generates (Result retval, AudioBuffer outBuffer);
/*
@@ -238,13 +256,18 @@
* reference stream, this function MUST return NOT_SUPPORTED. For example,
* this function would typically implemented by an Echo Canceler.
*
+ * Output audio buffer must contain no more frames than the input audio
+ * buffer. Since the effect may transform input channels into a different
+ * amount of channels, the caller provides the output frame size.
+ *
* @param inBuffer input audio buffer.
+ * @param outFrameSize output frame size in bytes.
* @return retval operation completion status.
* @return outBuffer output audio buffer.
*/
// TODO(mnaganov): replace with FMQ version.
@callflow(next={"*"})
- processReverse(AudioBuffer inBuffer)
+ processReverse(AudioBuffer inBuffer, uint32_t outFrameSize)
generates (Result retval, AudioBuffer outBuffer);
/*
@@ -261,10 +284,11 @@
*
* @param commandId the ID of the command.
* @param data command data.
+ * @param resultMaxSize maximum size in bytes of the result; can be 0.
* @return status command completion status.
* @return result result data.
*/
- command(uint32_t commandId, vec<uint8_t> data)
+ command(uint32_t commandId, vec<uint8_t> data, uint32_t resultMaxSize)
generates (int32_t status, vec<uint8_t> result);
/*
@@ -302,10 +326,84 @@
* implemented in software.
*
* @param parameter identifying data of the parameter.
+ * @param valueMaxSize maximum size in bytes of the value.
* @return retval operation completion status.
* @return result the value of the parameter.
*/
@callflow(next={"*"})
- getParameter(vec<uint8_t> parameter)
+ getParameter(vec<uint8_t> parameter, uint32_t valueMaxSize)
generates (Result retval, vec<uint8_t> value);
+
+ /*
+ * Get supported configs for a vendor-specific feature. The configs returned
+ * are not interpreted by Android Framework and are passed as-is between the
+ * application and the effect.
+ *
+ * The effect must use INVALID_ARGUMENTS return code if the feature ID is
+ * unknown. If the effect does not support getting vendor-specific feature
+ * configs, it must return NOT_SUPPORTED. If the feature is supported but
+ * the total number of supported configurations exceeds the maximum number
+ * indicated by the caller, the method must return RESULT_TOO_BIG.
+ *
+ * Use this method only if the effect is provided by a third party, and
+ * there is no interface defined for it. This method only works for effects
+ * implemented in software.
+ *
+ * @param featureId feature identifier.
+ * @param maxConfigs maximum number of configs to return.
+ * @param configSize size of each config in bytes.
+ * @return retval operation completion status.
+ * @return configsCount number of configs returned.
+ * @return configsData data for all the configs returned.
+ */
+ @callflow(next={"*"})
+ getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize) generates (
+ Result retval,
+ uint32_t configsCount,
+ vec<uint8_t> configsData);
+
+ /*
+ * Get the current config for a vendor-specific feature. The config returned
+ * is not interpreted by Android Framework and is passed as-is between the
+ * application and the effect.
+ *
+ * The effect must use INVALID_ARGUMENTS return code if the feature ID is
+ * unknown. If the effect does not support getting vendor-specific
+ * feature configs, it must return NOT_SUPPORTED.
+ *
+ * Use this method only if the effect is provided by a third party, and
+ * there is no interface defined for it. This method only works for effects
+ * implemented in software.
+ *
+ * @param featureId feature identifier.
+ * @param configSize size of the config in bytes.
+ * @return retval operation completion status.
+ * @return configData config data.
+ */
+ @callflow(next={"*"})
+ getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize)
+ generates (Result retval, vec<uint8_t> configData);
+
+ /*
+ * Set the current config for a vendor-specific feature. The config data
+ * is not interpreted by Android Framework and is passed as-is between the
+ * application and the effect.
+ *
+ * The effect must use INVALID_ARGUMENTS return code if the feature ID is
+ * unknown. If the effect does not support getting vendor-specific
+ * feature configs, it must return NOT_SUPPORTED.
+ *
+ * Use this method only if the effect is provided by a third party, and
+ * there is no interface defined for it. This method only works for effects
+ * implemented in software.
+ *
+ * @param featureId feature identifier.
+ * @param configData config data.
+ * @return retval operation completion status.
+ */
+ setCurrentConfigForFeature(uint32_t featureId, vec<uint8_t> configData)
+ generates (Result retval);
};
diff --git a/audio/effect/2.0/IEffectsFactory.hal b/audio/effect/2.0/IEffectsFactory.hal
index 6763825..c82b4a2 100644
--- a/audio/effect/2.0/IEffectsFactory.hal
+++ b/audio/effect/2.0/IEffectsFactory.hal
@@ -50,9 +50,11 @@
* directed to in audio HAL.
* @return retval operation completion status.
* @return result the interface for the created effect.
+ * @return effectId the unique ID of the effect to be used with
+ * IStream::addEffect and IStream::removeEffect methods.
*/
createEffect(Uuid uid, AudioSession session, AudioIoHandle ioHandle)
- generates (Result retval, IEffect result);
+ generates (Result retval, IEffect result, uint64_t effectId);
/*
* Dumps information about effects into the provided file descriptor.
diff --git a/audio/effect/2.0/IEnvironmentalReverbEffect.hal b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
index bd7aeeb..d9b1ee6 100644
--- a/audio/effect/2.0/IEnvironmentalReverbEffect.hal
+++ b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
@@ -124,6 +124,16 @@
getReverbLevel() generates (Result retval, int16_t reverbLevel);
/*
+ * Sets the reverb delay of the room.
+ */
+ setReverbDelay(uint32_t reverDelay) generates (Result retval);
+
+ /*
+ * Gets the reverb delay of the room.
+ */
+ getReverbDelay() generates (Result retval, uint32_t reverbDelay);
+
+ /*
* Sets room diffusion.
*/
setDiffusion(int16_t diffusion) generates (Result retval);
diff --git a/audio/effect/2.0/IVisualizerEffect.hal b/audio/effect/2.0/IVisualizerEffect.hal
index 2a7ddb8..70dabf9 100644
--- a/audio/effect/2.0/IVisualizerEffect.hal
+++ b/audio/effect/2.0/IVisualizerEffect.hal
@@ -36,10 +36,10 @@
getCaptureSize() generates (Result retval, uint16_t captureSize);
enum ScalingMode {
- // Keep in sync with
+ // Keep in sync with SCALING_MODE_... in
// frameworks/base/media/java/android/media/audiofx/Visualizer.java
- SCALING_MODE_NORMALIZED = 0,
- SCALING_MODE_AS_PLAYED = 1
+ NORMALIZED = 0,
+ AS_PLAYED = 1
};
/*
@@ -63,10 +63,10 @@
getLatency() generates (Result retval, uint32_t latencyMs);
enum MeasurementMode {
- // Keep in sync with
+ // Keep in sync with MEASUREMENT_MODE_... in
// frameworks/base/media/java/android/media/audiofx/Visualizer.java
- MEASUREMENT_MODE_NONE = 0x0,
- MEASUREMENT_MODE_PEAK_RMS = 0x1
+ NONE = 0x0,
+ PEAK_RMS = 0x1
};
/*
@@ -97,7 +97,7 @@
int32_t peakMb; // millibels
int32_t rmsMb; // millibels
} peakAndRms;
- };
+ } value;
};
/*
* Retrieves the lastest measurements. The measurements to be made
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
new file mode 100644
index 0000000..c2f50f9
--- /dev/null
+++ b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "AEC_Effect_HAL"
+#include <system/audio_effects/effect_aec.h>
+#include <utils/Log.h>
+
+#include "AcousticEchoCancelerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+AcousticEchoCancelerEffect::AcousticEchoCancelerEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+AcousticEchoCancelerEffect::~AcousticEchoCancelerEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> AcousticEchoCancelerEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> AcousticEchoCancelerEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> AcousticEchoCancelerEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> AcousticEchoCancelerEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> AcousticEchoCancelerEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> AcousticEchoCancelerEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> AcousticEchoCancelerEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> AcousticEchoCancelerEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> AcousticEchoCancelerEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> AcousticEchoCancelerEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> AcousticEchoCancelerEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> AcousticEchoCancelerEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> AcousticEchoCancelerEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect follow.
+Return<Result> AcousticEchoCancelerEffect::setEchoDelay(uint32_t echoDelayMs) {
+ return mEffect->setParam(AEC_PARAM_ECHO_DELAY, echoDelayMs);
+}
+
+Return<void> AcousticEchoCancelerEffect::getEchoDelay(getEchoDelay_cb _hidl_cb) {
+ return mEffect->getIntegerParam(AEC_PARAM_ECHO_DELAY, _hidl_cb);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
new file mode 100644
index 0000000..cebc2d4
--- /dev/null
+++ b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IAcousticEchoCancelerEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
+ explicit AcousticEchoCancelerEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect follow.
+ Return<Result> setEchoDelay(uint32_t echoDelayMs) override;
+ Return<void> getEchoDelay(getEchoDelay_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~AcousticEchoCancelerEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
diff --git a/audio/effect/2.0/default/Android.mk b/audio/effect/2.0/default/Android.mk
new file mode 100644
index 0000000..50c4bd6
--- /dev/null
+++ b/audio/effect/2.0/default/Android.mk
@@ -0,0 +1,32 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.audio.effect@2.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ AcousticEchoCancelerEffect.cpp \
+ AutomaticGainControlEffect.cpp \
+ BassBoostEffect.cpp \
+ Conversions.cpp \
+ DownmixEffect.cpp \
+ Effect.cpp \
+ EffectsFactory.cpp \
+ EnvironmentalReverbEffect.cpp \
+ EqualizerEffect.cpp \
+ LoudnessEnhancerEffect.cpp \
+ NoiseSuppressionEffect.cpp \
+ PresetReverbEffect.cpp \
+ VirtualizerEffect.cpp \
+ VisualizerEffect.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libhidl \
+ libhwbinder \
+ libutils \
+ libeffects \
+ liblog \
+ android.hardware.audio.common@2.0 \
+ android.hardware.audio.common@2.0-util \
+ android.hardware.audio.effect@2.0 \
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
new file mode 100644
index 0000000..34cbe97
--- /dev/null
+++ b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "AGC_Effect_HAL"
+#include <utils/Log.h>
+
+#include "AutomaticGainControlEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+AutomaticGainControlEffect::AutomaticGainControlEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+AutomaticGainControlEffect::~AutomaticGainControlEffect() {}
+
+void AutomaticGainControlEffect::propertiesFromHal(
+ const t_agc_settings& halProperties,
+ IAutomaticGainControlEffect::AllProperties* properties) {
+ properties->targetLevelMb = halProperties.targetLevel;
+ properties->compGainMb = halProperties.compGain;
+ properties->limiterEnabled = halProperties.limiterEnabled;
+}
+
+void AutomaticGainControlEffect::propertiesToHal(
+ const IAutomaticGainControlEffect::AllProperties& properties,
+ t_agc_settings* halProperties) {
+ halProperties->targetLevel = properties.targetLevelMb;
+ halProperties->compGain = properties.compGainMb;
+ halProperties->limiterEnabled = properties.limiterEnabled;
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> AutomaticGainControlEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> AutomaticGainControlEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> AutomaticGainControlEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> AutomaticGainControlEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> AutomaticGainControlEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> AutomaticGainControlEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> AutomaticGainControlEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> AutomaticGainControlEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> AutomaticGainControlEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> AutomaticGainControlEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> AutomaticGainControlEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> AutomaticGainControlEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> AutomaticGainControlEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> AutomaticGainControlEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> AutomaticGainControlEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IAutomaticGainControlEffect follow.
+Return<Result> AutomaticGainControlEffect::setTargetLevel(int16_t targetLevelMb) {
+ return mEffect->setParam(AGC_PARAM_TARGET_LEVEL, targetLevelMb);
+}
+
+Return<void> AutomaticGainControlEffect::getTargetLevel(getTargetLevel_cb _hidl_cb) {
+ return mEffect->getIntegerParam(AGC_PARAM_TARGET_LEVEL, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setCompGain(int16_t compGainMb) {
+ return mEffect->setParam(AGC_PARAM_COMP_GAIN, compGainMb);
+}
+
+Return<void> AutomaticGainControlEffect::getCompGain(getCompGain_cb _hidl_cb) {
+ return mEffect->getIntegerParam(AGC_PARAM_COMP_GAIN, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setLimiterEnabled(bool enabled) {
+ return mEffect->setParam(AGC_PARAM_LIMITER_ENA, enabled);
+}
+
+Return<void> AutomaticGainControlEffect::isLimiterEnabled(isLimiterEnabled_cb _hidl_cb) {
+ return mEffect->getIntegerParam(AGC_PARAM_LIMITER_ENA, _hidl_cb);
+}
+
+Return<Result> AutomaticGainControlEffect::setAllProperties(const IAutomaticGainControlEffect::AllProperties& properties) {
+ t_agc_settings halProperties;
+ propertiesToHal(properties, &halProperties);
+ return mEffect->setParam(AGC_PARAM_PROPERTIES, halProperties);
+}
+
+Return<void> AutomaticGainControlEffect::getAllProperties(getAllProperties_cb _hidl_cb) {
+ t_agc_settings halProperties;
+ Result retval = mEffect->getParam(AGC_PARAM_PROPERTIES, halProperties);
+ AllProperties properties;
+ propertiesFromHal(halProperties, &properties);
+ _hidl_cb(retval, properties);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.h b/audio/effect/2.0/default/AutomaticGainControlEffect.h
new file mode 100644
index 0000000..f4b228c
--- /dev/null
+++ b/audio/effect/2.0/default/AutomaticGainControlEffect.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
+
+#include <system/audio_effects/effect_agc.h>
+
+#include <android/hardware/audio/effect/2.0/IAutomaticGainControlEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::effect::V2_0::IAutomaticGainControlEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct AutomaticGainControlEffect : public IAutomaticGainControlEffect {
+ explicit AutomaticGainControlEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IAutomaticGainControlEffect follow.
+ Return<Result> setTargetLevel(int16_t targetLevelMb) override;
+ Return<void> getTargetLevel(getTargetLevel_cb _hidl_cb) override;
+ Return<Result> setCompGain(int16_t compGainMb) override;
+ Return<void> getCompGain(getCompGain_cb _hidl_cb) override;
+ Return<Result> setLimiterEnabled(bool enabled) override;
+ Return<void> isLimiterEnabled(isLimiterEnabled_cb _hidl_cb) override;
+ Return<Result> setAllProperties(
+ const IAutomaticGainControlEffect::AllProperties& properties) override;
+ Return<void> getAllProperties(getAllProperties_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~AutomaticGainControlEffect();
+
+ void propertiesFromHal(
+ const t_agc_settings& halProperties,
+ IAutomaticGainControlEffect::AllProperties* properties);
+ void propertiesToHal(
+ const IAutomaticGainControlEffect::AllProperties& properties,
+ t_agc_settings* halProperties);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
diff --git a/audio/effect/2.0/default/BassBoostEffect.cpp b/audio/effect/2.0/default/BassBoostEffect.cpp
new file mode 100644
index 0000000..1b12f76
--- /dev/null
+++ b/audio/effect/2.0/default/BassBoostEffect.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "BassBoost_HAL"
+#include <system/audio_effects/effect_bassboost.h>
+#include <utils/Log.h>
+
+#include "BassBoostEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+BassBoostEffect::BassBoostEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+BassBoostEffect::~BassBoostEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> BassBoostEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> BassBoostEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> BassBoostEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> BassBoostEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> BassBoostEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> BassBoostEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> BassBoostEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> BassBoostEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> BassBoostEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> BassBoostEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> BassBoostEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> BassBoostEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> BassBoostEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> BassBoostEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> BassBoostEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> BassBoostEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> BassBoostEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> BassBoostEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> BassBoostEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> BassBoostEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> BassBoostEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> BassBoostEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> BassBoostEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> BassBoostEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> BassBoostEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> BassBoostEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IBassBoostEffect follow.
+Return<void> BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb) {
+ return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb);
+}
+
+Return<Result> BassBoostEffect::setStrength(uint16_t strength) {
+ return mEffect->setParam(BASSBOOST_PARAM_STRENGTH, strength);
+}
+
+Return<void> BassBoostEffect::getStrength(getStrength_cb _hidl_cb) {
+ return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH, _hidl_cb);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/BassBoostEffect.h b/audio/effect/2.0/default/BassBoostEffect.h
new file mode 100644
index 0000000..23377e1
--- /dev/null
+++ b/audio/effect/2.0/default/BassBoostEffect.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IBassBoostEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::effect::V2_0::IBassBoostEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct BassBoostEffect : public IBassBoostEffect {
+ explicit BassBoostEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IBassBoostEffect follow.
+ Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb) override;
+ Return<Result> setStrength(uint16_t strength) override;
+ Return<void> getStrength(getStrength_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~BassBoostEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
diff --git a/audio/effect/2.0/default/Conversions.cpp b/audio/effect/2.0/default/Conversions.cpp
new file mode 100644
index 0000000..ef2374c
--- /dev/null
+++ b/audio/effect/2.0/default/Conversions.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <memory.h>
+#include <stdio.h>
+
+#include "Conversions.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+void effectDescriptorFromHal(
+ const effect_descriptor_t& halDescriptor, EffectDescriptor* descriptor) {
+ uuidFromHal(halDescriptor.type, &descriptor->type);
+ uuidFromHal(halDescriptor.uuid, &descriptor->uuid);
+ descriptor->flags = EffectFlags(halDescriptor.flags);
+ descriptor->cpuLoad = halDescriptor.cpuLoad;
+ descriptor->memoryUsage = halDescriptor.memoryUsage;
+ memcpy(descriptor->name.data(), halDescriptor.name, descriptor->name.size());
+ memcpy(descriptor->implementor.data(),
+ halDescriptor.implementor, descriptor->implementor.size());
+}
+
+void uuidFromHal(const effect_uuid_t& halUuid, Uuid* uuid) {
+ uuid->timeLow = halUuid.timeLow;
+ uuid->timeMid = halUuid.timeMid;
+ uuid->versionAndTimeHigh = halUuid.timeHiAndVersion;
+ uuid->variantAndClockSeqHigh = halUuid.clockSeq;
+ memcpy(uuid->node.data(), halUuid.node, uuid->node.size());
+}
+
+void uuidToHal(const Uuid& uuid, effect_uuid_t* halUuid) {
+ halUuid->timeLow = uuid.timeLow;
+ halUuid->timeMid = uuid.timeMid;
+ halUuid->timeHiAndVersion = uuid.versionAndTimeHigh;
+ halUuid->clockSeq = uuid.variantAndClockSeqHigh;
+ memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
+}
+
+std::string uuidToString(const effect_uuid_t& halUuid) {
+ char str[64];
+ snprintf(str, sizeof(str), "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
+ halUuid.timeLow,
+ halUuid.timeMid,
+ halUuid.timeHiAndVersion,
+ halUuid.clockSeq,
+ halUuid.node[0],
+ halUuid.node[1],
+ halUuid.node[2],
+ halUuid.node[3],
+ halUuid.node[4],
+ halUuid.node[5]);
+ return str;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/Conversions.h b/audio/effect/2.0/default/Conversions.h
new file mode 100644
index 0000000..5348ae6
--- /dev/null
+++ b/audio/effect/2.0/default/Conversions.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef android_hardware_audio_effect_V2_0_Conversions_H_
+#define android_hardware_audio_effect_V2_0_Conversions_H_
+
+#include <string>
+
+#include <android/hardware/audio/effect/2.0/types.h>
+#include <system/audio_effect.h>
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::Uuid;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+
+void effectDescriptorFromHal(
+ const effect_descriptor_t& halDescriptor, EffectDescriptor* descriptor);
+void uuidFromHal(const effect_uuid_t& halUuid, Uuid* uuid);
+void uuidToHal(const Uuid& uuid, effect_uuid_t* halUuid);
+std::string uuidToString(const effect_uuid_t& halUuid);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_audio_effect_V2_0_Conversions_H_
diff --git a/audio/effect/2.0/default/DownmixEffect.cpp b/audio/effect/2.0/default/DownmixEffect.cpp
new file mode 100644
index 0000000..4c0a0bf
--- /dev/null
+++ b/audio/effect/2.0/default/DownmixEffect.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "Downmix_HAL"
+#include <system/audio_effects/effect_downmix.h>
+#include <utils/Log.h>
+
+#include "DownmixEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+DownmixEffect::DownmixEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+DownmixEffect::~DownmixEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> DownmixEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> DownmixEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> DownmixEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> DownmixEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> DownmixEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> DownmixEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> DownmixEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> DownmixEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> DownmixEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> DownmixEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> DownmixEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> DownmixEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> DownmixEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> DownmixEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> DownmixEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> DownmixEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> DownmixEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> DownmixEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> DownmixEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> DownmixEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> DownmixEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> DownmixEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> DownmixEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> DownmixEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> DownmixEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> DownmixEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IDownmixEffect follow.
+Return<Result> DownmixEffect::setType(IDownmixEffect::Type preset) {
+ return mEffect->setParam(DOWNMIX_PARAM_TYPE, static_cast<downmix_type_t>(preset));
+}
+
+Return<void> DownmixEffect::getType(getType_cb _hidl_cb) {
+ downmix_type_t halPreset = DOWNMIX_TYPE_INVALID;
+ Result retval = mEffect->getParam(DOWNMIX_PARAM_TYPE, halPreset);
+ _hidl_cb(retval, Type(halPreset));
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/DownmixEffect.h b/audio/effect/2.0/default/DownmixEffect.h
new file mode 100644
index 0000000..5ed4ffd
--- /dev/null
+++ b/audio/effect/2.0/default/DownmixEffect.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IDownmixEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::effect::V2_0::IDownmixEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct DownmixEffect : public IDownmixEffect {
+ explicit DownmixEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IDownmixEffect follow.
+ Return<Result> setType(IDownmixEffect::Type preset) override;
+ Return<void> getType(getType_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~DownmixEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
diff --git a/audio/effect/2.0/default/Effect.cpp b/audio/effect/2.0/default/Effect.cpp
new file mode 100644
index 0000000..82d0292
--- /dev/null
+++ b/audio/effect/2.0/default/Effect.cpp
@@ -0,0 +1,615 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <memory>
+#include <memory.h>
+
+#define LOG_TAG "EffectHAL"
+#include <media/EffectsFactoryApi.h>
+#include <utils/Log.h>
+
+#include "Conversions.h"
+#include "Effect.h"
+#include "EffectMap.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioChannelMask;
+using ::android::hardware::audio::common::V2_0::AudioFormat;
+
+// static
+const char *Effect::sContextResultOfCommand = "returned status";
+const char *Effect::sContextCallToCommand = "error";
+const char *Effect::sContextCallFunction = sContextCallToCommand;
+
+Effect::Effect(effect_handle_t handle) : mHandle(handle) {
+}
+
+Effect::~Effect() {
+ int status = EffectRelease(mHandle);
+ ALOGW_IF(status, "Error releasing effect %p: %s", mHandle, strerror(-status));
+ EffectMap::getInstance().remove(mHandle);
+ mHandle = 0;
+}
+
+// static
+template<typename T> size_t Effect::alignedSizeIn(size_t s) {
+ return (s + sizeof(T) - 1) / sizeof(T);
+}
+
+// static
+template<typename T> void Effect::hidlVecToHal(
+ const hidl_vec<T>& vec, uint32_t* halDataSize, void** halData) {
+ *halDataSize = static_cast<T>(vec.size() * sizeof(T));
+ *halData = static_cast<void*>(const_cast<T*>(&vec[0]));
+}
+
+// static
+void Effect::effectAuxChannelsConfigFromHal(
+ const channel_config_t& halConfig, EffectAuxChannelsConfig* config) {
+ config->mainChannels = AudioChannelMask(halConfig.main_channels);
+ config->auxChannels = AudioChannelMask(halConfig.aux_channels);
+}
+
+// static
+void Effect::effectAuxChannelsConfigToHal(
+ const EffectAuxChannelsConfig& config, channel_config_t* halConfig) {
+ halConfig->main_channels = static_cast<audio_channel_mask_t>(config.mainChannels);
+ halConfig->aux_channels = static_cast<audio_channel_mask_t>(config.auxChannels);
+}
+
+// static
+void Effect::effectBufferConfigFromHal(
+ const buffer_config_t& halConfig, EffectBufferConfig* config) {
+ // TODO(mnaganov): Use FMQ instead of AudioBuffer.
+ (void)halConfig.buffer.frameCount;
+ (void)halConfig.buffer.raw;
+ config->samplingRateHz = halConfig.samplingRate;
+ config->channels = AudioChannelMask(halConfig.channels);
+ config->format = AudioFormat(halConfig.format);
+ config->accessMode = EffectBufferAccess(halConfig.accessMode);
+ config->mask = EffectConfigParameters(halConfig.mask);
+}
+
+// static
+void Effect::effectBufferConfigToHal(const EffectBufferConfig& config, buffer_config_t* halConfig) {
+ // TODO(mnaganov): Use FMQ instead of AudioBuffer.
+ halConfig->buffer.frameCount = 0;
+ halConfig->buffer.raw = NULL;
+ halConfig->samplingRate = config.samplingRateHz;
+ halConfig->channels = static_cast<uint32_t>(config.channels);
+ // TODO(mnaganov): As the calling code does not use BP for now, implement later.
+ halConfig->bufferProvider.cookie = NULL;
+ halConfig->bufferProvider.getBuffer = NULL;
+ halConfig->bufferProvider.releaseBuffer = NULL;
+ halConfig->format = static_cast<uint8_t>(config.format);
+ halConfig->accessMode = static_cast<uint8_t>(config.accessMode);
+ halConfig->mask = static_cast<uint8_t>(config.mask);
+}
+
+// static
+void Effect::effectConfigFromHal(const effect_config_t& halConfig, EffectConfig* config) {
+ effectBufferConfigFromHal(halConfig.inputCfg, &config->inputCfg);
+ effectBufferConfigFromHal(halConfig.outputCfg, &config->outputCfg);
+}
+
+// static
+void Effect::effectConfigToHal(const EffectConfig& config, effect_config_t* halConfig) {
+ effectBufferConfigToHal(config.inputCfg, &halConfig->inputCfg);
+ effectBufferConfigToHal(config.outputCfg, &halConfig->outputCfg);
+}
+
+// static
+void Effect::effectOffloadParamToHal(
+ const EffectOffloadParameter& offload, effect_offload_param_t* halOffload) {
+ halOffload->isOffload = offload.isOffload;
+ halOffload->ioHandle = offload.ioHandle;
+}
+
+// static
+std::vector<uint8_t> Effect::parameterToHal(
+ uint32_t paramSize,
+ const void* paramData,
+ uint32_t valueSize,
+ const void** valueData) {
+ size_t valueOffsetFromData = alignedSizeIn<uint32_t>(paramSize) * sizeof(uint32_t);
+ size_t halParamBufferSize = sizeof(effect_param_t) + valueOffsetFromData + valueSize;
+ std::vector<uint8_t> halParamBuffer(halParamBufferSize, 0);
+ effect_param_t *halParam = reinterpret_cast<effect_param_t*>(&halParamBuffer[0]);
+ halParam->psize = paramSize;
+ halParam->vsize = valueSize;
+ memcpy(halParam->data, paramData, paramSize);
+ if (valueData) {
+ if (*valueData) {
+ // Value data is provided.
+ memcpy(halParam->data + valueOffsetFromData, *valueData, valueSize);
+ } else {
+ // The caller needs the pointer to the value data location.
+ *valueData = halParam->data + valueOffsetFromData;
+ }
+ }
+ return halParamBuffer;
+}
+
+Result Effect::analyzeCommandStatus(const char* commandName, const char* context, status_t status) {
+ return analyzeStatus("command", commandName, context, status);
+}
+
+Result Effect::analyzeStatus(
+ const char* funcName,
+ const char* subFuncName,
+ const char* contextDescription,
+ status_t status) {
+ if (status != OK) {
+ ALOGW("Effect %p %s %s %s: %s",
+ mHandle, funcName, subFuncName, contextDescription, strerror(-status));
+ }
+ switch (status) {
+ case OK: return Result::OK;
+ case -EINVAL: return Result::INVALID_ARGUMENTS;
+ case -ENODATA: return Result::INVALID_STATE;
+ case -ENODEV: return Result::NOT_INITIALIZED;
+ case -ENOMEM: return Result::RESULT_TOO_BIG;
+ case -ENOSYS: return Result::NOT_SUPPORTED;
+ default: return Result::INVALID_STATE;
+ }
+}
+
+void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb) {
+ uint32_t halResultSize = sizeof(effect_config_t);
+ effect_config_t halConfig;
+ status_t status = (*mHandle)->command(
+ mHandle, commandCode, 0, NULL, &halResultSize, &halConfig);
+ EffectConfig config;
+ if (status == OK) {
+ effectConfigFromHal(halConfig, &config);
+ }
+ cb(analyzeCommandStatus(commandName, sContextCallToCommand, status), config);
+}
+
+Result Effect::getCurrentConfigImpl(
+ uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess) {
+ uint32_t halCmd = featureId;
+ uint32_t halResult[alignedSizeIn<uint32_t>(sizeof(uint32_t) + configSize)];
+ memset(halResult, 0, sizeof(halResult));
+ uint32_t halResultSize = 0;
+ return sendCommandReturningStatusAndData(
+ EFFECT_CMD_GET_FEATURE_CONFIG, "GET_FEATURE_CONFIG",
+ sizeof(uint32_t), &halCmd,
+ &halResultSize, halResult,
+ sizeof(uint32_t),
+ [&]{ onSuccess(&halResult[1]); });
+}
+
+Result Effect::getParameterImpl(
+ uint32_t paramSize,
+ const void* paramData,
+ uint32_t valueSize,
+ GetParameterSuccessCallback onSuccess) {
+ // As it is unknown what method HAL uses for copying the provided parameter data,
+ // it is safer to make sure that input and output buffers do not overlap.
+ std::vector<uint8_t> halCmdBuffer =
+ parameterToHal(paramSize, paramData, valueSize, nullptr);
+ const void *valueData = nullptr;
+ std::vector<uint8_t> halParamBuffer =
+ parameterToHal(paramSize, paramData, valueSize, &valueData);
+ uint32_t halParamBufferSize = halParamBuffer.size();
+
+ return sendCommandReturningStatusAndData(
+ EFFECT_CMD_GET_PARAM, "GET_PARAM",
+ halCmdBuffer.size(), &halCmdBuffer[0],
+ &halParamBufferSize, &halParamBuffer[0],
+ sizeof(effect_param_t),
+ [&]{
+ effect_param_t *halParam = reinterpret_cast<effect_param_t*>(&halParamBuffer[0]);
+ onSuccess(halParam->vsize, valueData);
+ });
+}
+
+Result Effect::getSupportedConfigsImpl(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ GetSupportedConfigsSuccessCallback onSuccess) {
+ uint32_t halCmd[2] = { featureId, maxConfigs };
+ uint32_t halResultSize = 2 * sizeof(uint32_t) + maxConfigs * sizeof(configSize);
+ uint8_t halResult[halResultSize];
+ memset(&halResult[0], 0, halResultSize);
+ return sendCommandReturningStatusAndData(
+ EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS, "GET_FEATURE_SUPPORTED_CONFIGS",
+ sizeof(halCmd), halCmd,
+ &halResultSize, &halResult[0],
+ 2 * sizeof(uint32_t),
+ [&]{
+ uint32_t *halResult32 = reinterpret_cast<uint32_t*>(&halResult[0]);
+ uint32_t supportedConfigs = *(++halResult32); // skip status field
+ if (supportedConfigs > maxConfigs) supportedConfigs = maxConfigs;
+ onSuccess(supportedConfigs, ++halResult32);
+ });
+}
+
+void Effect::processImpl(
+ ProcessFunction process,
+ const char* funcName,
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ ProcessCallback cb) {
+ audio_buffer_t halInBuffer;
+ halInBuffer.frameCount = inBuffer.frameCount;
+ halInBuffer.u8 = const_cast<uint8_t*>(&inBuffer.data[0]);
+ audio_buffer_t halOutBuffer;
+ halOutBuffer.frameCount = halInBuffer.frameCount;
+ // TODO(mnaganov): Consider stashing the buffer to avoid reallocating it every time.
+ std::unique_ptr<uint8_t[]> halOutBufferData(
+ new uint8_t[halOutBuffer.frameCount * outFrameSize]);
+ halOutBuffer.u8 = &halOutBufferData[0];
+ status_t status = process(mHandle, &halInBuffer, &halOutBuffer);
+ Result retval = analyzeStatus(funcName, "", sContextCallFunction, status);
+ AudioBuffer outBuffer;
+ if (status == OK) {
+ outBuffer.frameCount = halOutBuffer.frameCount;
+ outBuffer.data.setToExternal(halOutBuffer.u8, halOutBuffer.frameCount * outFrameSize);
+ } else {
+ outBuffer.frameCount = 0;
+ }
+ cb(retval, outBuffer);
+}
+
+Result Effect::sendCommand(int commandCode, const char* commandName) {
+ return sendCommand(commandCode, commandName, 0, NULL);
+}
+
+Result Effect::sendCommand(
+ int commandCode, const char* commandName, uint32_t size, void* data) {
+ status_t status = (*mHandle)->command(mHandle, commandCode, size, data, 0, NULL);
+ return analyzeCommandStatus(commandName, sContextCallToCommand, status);
+}
+
+Result Effect::sendCommandReturningData(
+ int commandCode, const char* commandName,
+ uint32_t* replySize, void* replyData) {
+ return sendCommandReturningData(commandCode, commandName, 0, NULL, replySize, replyData);
+}
+
+Result Effect::sendCommandReturningData(
+ int commandCode, const char* commandName,
+ uint32_t size, void* data,
+ uint32_t* replySize, void* replyData) {
+ uint32_t expectedReplySize = *replySize;
+ status_t status = (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+ if (status == OK && *replySize != expectedReplySize) {
+ status = -ENODATA;
+ }
+ return analyzeCommandStatus(commandName, sContextCallToCommand, status);
+}
+
+Result Effect::sendCommandReturningStatus(int commandCode, const char* commandName) {
+ return sendCommandReturningStatus(commandCode, commandName, 0, NULL);
+}
+
+Result Effect::sendCommandReturningStatus(
+ int commandCode, const char* commandName, uint32_t size, void* data) {
+ uint32_t replyCmdStatus;
+ uint32_t replySize = sizeof(uint32_t);
+ return sendCommandReturningStatusAndData(
+ commandCode, commandName, size, data, &replySize, &replyCmdStatus, replySize, []{});
+}
+
+Result Effect::sendCommandReturningStatusAndData(
+ int commandCode, const char* commandName,
+ uint32_t size, void* data,
+ uint32_t* replySize, void* replyData,
+ uint32_t minReplySize,
+ CommandSuccessCallback onSuccess) {
+ status_t status =
+ (*mHandle)->command(mHandle, commandCode, size, data, replySize, replyData);
+ Result retval;
+ if (status == OK && minReplySize >= sizeof(uint32_t) && *replySize >= minReplySize) {
+ uint32_t commandStatus = *reinterpret_cast<uint32_t*>(replyData);
+ retval = analyzeCommandStatus(commandName, sContextResultOfCommand, commandStatus);
+ if (commandStatus == OK) {
+ onSuccess();
+ }
+ } else {
+ retval = analyzeCommandStatus(commandName, sContextCallToCommand, status);
+ }
+ return retval;
+}
+
+Result Effect::setConfigImpl(
+ int commandCode, const char* commandName,
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ effect_config_t halConfig;
+ effectConfigToHal(config, &halConfig);
+ if (inputBufferProvider != 0) {
+ LOG_FATAL("Using input buffer provider is not supported");
+ }
+ if (outputBufferProvider != 0) {
+ LOG_FATAL("Using output buffer provider is not supported");
+ }
+ return sendCommandReturningStatus(
+ commandCode, commandName, sizeof(effect_config_t), &halConfig);
+}
+
+
+Result Effect::setParameterImpl(
+ uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData) {
+ std::vector<uint8_t> halParamBuffer = parameterToHal(
+ paramSize, paramData, valueSize, &valueData);
+ return sendCommandReturningStatus(
+ EFFECT_CMD_SET_PARAM, "SET_PARAM", halParamBuffer.size(), &halParamBuffer[0]);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> Effect::init() {
+ return sendCommandReturningStatus(EFFECT_CMD_INIT, "INIT");
+}
+
+Return<Result> Effect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return setConfigImpl(
+ EFFECT_CMD_SET_CONFIG, "SET_CONFIG", config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> Effect::reset() {
+ return sendCommand(EFFECT_CMD_RESET, "RESET");
+}
+
+Return<Result> Effect::enable() {
+ return sendCommandReturningStatus(EFFECT_CMD_ENABLE, "ENABLE");
+}
+
+Return<Result> Effect::disable() {
+ return sendCommandReturningStatus(EFFECT_CMD_DISABLE, "DISABLE");
+}
+
+Return<Result> Effect::setDevice(AudioDevice device) {
+ uint32_t halDevice = static_cast<uint32_t>(device);
+ return sendCommand(EFFECT_CMD_SET_DEVICE, "SET_DEVICE", sizeof(uint32_t), &halDevice);
+}
+
+Return<void> Effect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ uint32_t halDataSize;
+ void *halData;
+ hidlVecToHal(volumes, &halDataSize, &halData);
+ uint32_t halResultSize = halDataSize;
+ uint32_t halResult[volumes.size()];
+ Result retval = sendCommandReturningData(
+ EFFECT_CMD_SET_VOLUME, "SET_VOLUME", halDataSize, halData, &halResultSize, halResult);
+ hidl_vec<uint32_t> result;
+ if (retval == Result::OK) {
+ result.setToExternal(&halResult[0], halResultSize);
+ }
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+Return<Result> Effect::setAudioMode(AudioMode mode) {
+ uint32_t halMode = static_cast<uint32_t>(mode);
+ return sendCommand(
+ EFFECT_CMD_SET_AUDIO_MODE, "SET_AUDIO_MODE", sizeof(uint32_t), &halMode);
+}
+
+Return<Result> Effect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return setConfigImpl(EFFECT_CMD_SET_CONFIG_REVERSE, "SET_CONFIG_REVERSE",
+ config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> Effect::setInputDevice(AudioDevice device) {
+ uint32_t halDevice = static_cast<uint32_t>(device);
+ return sendCommand(
+ EFFECT_CMD_SET_INPUT_DEVICE, "SET_INPUT_DEVICE", sizeof(uint32_t), &halDevice);
+}
+
+Return<void> Effect::getConfig(getConfig_cb _hidl_cb) {
+ getConfigImpl(EFFECT_CMD_GET_CONFIG, "GET_CONFIG", _hidl_cb);
+ return Void();
+}
+
+Return<void> Effect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ getConfigImpl(EFFECT_CMD_GET_CONFIG_REVERSE, "GET_CONFIG_REVERSE", _hidl_cb);
+ return Void();
+}
+
+Return<void> Effect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ hidl_vec<EffectAuxChannelsConfig> result;
+ Result retval = getSupportedConfigsImpl(
+ EFFECT_FEATURE_AUX_CHANNELS,
+ maxConfigs,
+ sizeof(channel_config_t),
+ [&] (uint32_t supportedConfigs, void* configsData) {
+ result.resize(supportedConfigs);
+ channel_config_t *config = reinterpret_cast<channel_config_t*>(configsData);
+ for (size_t i = 0; i < result.size(); ++i) {
+ effectAuxChannelsConfigFromHal(*config++, &result[i]);
+ }
+ });
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+Return<void> Effect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ uint32_t halCmd = EFFECT_FEATURE_AUX_CHANNELS;
+ uint32_t halResult[alignedSizeIn<uint32_t>(sizeof(uint32_t) + sizeof(channel_config_t))];
+ memset(halResult, 0, sizeof(halResult));
+ uint32_t halResultSize = 0;
+ EffectAuxChannelsConfig result;
+ Result retval = getCurrentConfigImpl(
+ EFFECT_FEATURE_AUX_CHANNELS,
+ sizeof(channel_config_t),
+ [&] (void* configData) {
+ effectAuxChannelsConfigFromHal(
+ *reinterpret_cast<channel_config_t*>(configData), &result);
+ });
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+Return<Result> Effect::setAuxChannelsConfig(const EffectAuxChannelsConfig& config) {
+ uint32_t halCmd[alignedSizeIn<uint32_t>(sizeof(uint32_t) + sizeof(channel_config_t))];
+ halCmd[0] = EFFECT_FEATURE_AUX_CHANNELS;
+ effectAuxChannelsConfigToHal(config, reinterpret_cast<channel_config_t*>(&halCmd[1]));
+ return sendCommandReturningStatus(EFFECT_CMD_SET_FEATURE_CONFIG,
+ "SET_FEATURE_CONFIG AUX_CHANNELS", sizeof(halCmd), halCmd);
+}
+
+Return<Result> Effect::setAudioSource(AudioSource source) {
+ uint32_t halSource = static_cast<uint32_t>(source);
+ return sendCommand(
+ EFFECT_CMD_SET_AUDIO_SOURCE, "SET_AUDIO_SOURCE", sizeof(uint32_t), &halSource);
+}
+
+Return<Result> Effect::offload(const EffectOffloadParameter& param) {
+ effect_offload_param_t halParam;
+ effectOffloadParamToHal(param, &halParam);
+ return sendCommandReturningStatus(
+ EFFECT_CMD_OFFLOAD, "OFFLOAD", sizeof(effect_offload_param_t), &halParam);
+}
+
+Return<void> Effect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ effect_descriptor_t halDescriptor;
+ memset(&halDescriptor, 0, sizeof(effect_descriptor_t));
+ status_t status = (*mHandle)->get_descriptor(mHandle, &halDescriptor);
+ EffectDescriptor descriptor;
+ if (status == OK) {
+ effectDescriptorFromHal(halDescriptor, &descriptor);
+ }
+ _hidl_cb(analyzeStatus("get_descriptor", "", sContextCallFunction, status), descriptor);
+ return Void();
+}
+
+Return<void> Effect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ processImpl((*mHandle)->process, "process", inBuffer, outFrameSize, _hidl_cb);
+ return Void();
+}
+
+Return<void> Effect::processReverse(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, processReverse_cb _hidl_cb) {
+ if ((*mHandle)->process_reverse != NULL) {
+ processImpl(
+ (*mHandle)->process_reverse, "process_reverse", inBuffer, outFrameSize, _hidl_cb);
+ } else {
+ _hidl_cb(Result::NOT_SUPPORTED, AudioBuffer());
+ }
+ return Void();
+}
+
+Return<void> Effect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ uint32_t halDataSize;
+ void *halData;
+ hidlVecToHal(data, &halDataSize, &halData);
+ uint32_t halResultSize = resultMaxSize;
+ std::unique_ptr<uint8_t[]> halResult(new uint8_t[halResultSize]);
+ memset(&halResult[0], 0, halResultSize);
+ status_t status = (*mHandle)->command(
+ mHandle, commandId, halDataSize, halData, &halResultSize, &halResult[0]);
+ hidl_vec<uint8_t> result;
+ if (status == OK) {
+ result.setToExternal(&halResult[0], halResultSize);
+ }
+ _hidl_cb(status, result);
+ return Void();
+}
+
+Return<Result> Effect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return setParameterImpl(parameter.size(), ¶meter[0], value.size(), &value[0]);
+}
+
+Return<void> Effect::getParameter(
+ const hidl_vec<uint8_t>& parameter, uint32_t valueMaxSize, getParameter_cb _hidl_cb) {
+ hidl_vec<uint8_t> value;
+ Result retval = getParameterImpl(
+ parameter.size(),
+ ¶meter[0],
+ valueMaxSize,
+ [&] (uint32_t valueSize, const void* valueData) {
+ value.setToExternal(
+ reinterpret_cast<uint8_t*>(const_cast<void*>(valueData)), valueSize);
+ });
+ _hidl_cb(retval, value);
+ return Void();
+}
+
+Return<void> Effect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ uint32_t configCount = 0;
+ hidl_vec<uint8_t> result;
+ Result retval = getSupportedConfigsImpl(
+ featureId,
+ maxConfigs,
+ configSize,
+ [&] (uint32_t supportedConfigs, void* configsData) {
+ configCount = supportedConfigs;
+ result.resize(configCount * configSize);
+ memcpy(&result[0], configsData, result.size());
+ });
+ _hidl_cb(retval, configCount, result);
+ return Void();
+}
+
+Return<void> Effect::getCurrentConfigForFeature(
+ uint32_t featureId, uint32_t configSize, getCurrentConfigForFeature_cb _hidl_cb) {
+ hidl_vec<uint8_t> result;
+ Result retval = getCurrentConfigImpl(
+ featureId,
+ configSize,
+ [&] (void* configData) {
+ result.resize(configSize);
+ memcpy(&result[0], configData, result.size());
+ });
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+Return<Result> Effect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ uint32_t halCmd[alignedSizeIn<uint32_t>(sizeof(uint32_t) + configData.size())];
+ memset(halCmd, 0, sizeof(halCmd));
+ halCmd[0] = featureId;
+ memcpy(&halCmd[1], &configData[0], configData.size());
+ return sendCommandReturningStatus(
+ EFFECT_CMD_SET_FEATURE_CONFIG, "SET_FEATURE_CONFIG", sizeof(halCmd), halCmd);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/Effect.h b/audio/effect/2.0/default/Effect.h
new file mode 100644
index 0000000..e27a7e4
--- /dev/null
+++ b/audio/effect/2.0/default/Effect.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
+
+#include <vector>
+
+#include <android/hardware/audio/effect/2.0/IEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include <hardware/audio_effect.h>
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::common::V2_0::Uuid;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectFeature;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Effect : public IEffect {
+ explicit Effect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Utility methods for extending interfaces.
+ template<typename T> Return<void> getIntegerParam(
+ uint32_t paramId, std::function<void(Result retval, T paramValue)> cb) {
+ T value;
+ Result retval = getParameterImpl(
+ sizeof(uint32_t), ¶mId,
+ sizeof(T),
+ [&] (uint32_t valueSize, const void* valueData) {
+ if (valueSize > sizeof(T)) valueSize = sizeof(T);
+ memcpy(&value, valueData, valueSize);
+ });
+ cb(retval, value);
+ return Void();
+ }
+
+ template<typename T> Result getParam(uint32_t paramId, T& paramValue) {
+ return getParameterImpl(
+ sizeof(uint32_t), ¶mId,
+ sizeof(T),
+ [&] (uint32_t valueSize, const void* valueData) {
+ if (valueSize > sizeof(T)) valueSize = sizeof(T);
+ memcpy(¶mValue, valueData, valueSize);
+ });
+ }
+
+ template<typename T> Result getParam(uint32_t paramId, uint32_t paramArg, T& paramValue) {
+ uint32_t params[2] = { paramId, paramArg };
+ return getParameterImpl(
+ sizeof(params), params,
+ sizeof(T),
+ [&] (uint32_t valueSize, const void* valueData) {
+ if (valueSize > sizeof(T)) valueSize = sizeof(T);
+ memcpy(¶mValue, valueData, valueSize);
+ });
+ }
+
+ template<typename T> Result setParam(uint32_t paramId, const T& paramValue) {
+ return setParameterImpl(sizeof(uint32_t), ¶mId, sizeof(T), ¶mValue);
+ }
+
+ template<typename T> Result setParam(uint32_t paramId, uint32_t paramArg, const T& paramValue) {
+ uint32_t params[2] = { paramId, paramArg };
+ return setParameterImpl(sizeof(params), params, sizeof(T), ¶mValue);
+ }
+
+ private:
+ friend struct VirtualizerEffect; // for getParameterImpl
+ friend struct VisualizerEffect; // to allow executing commands
+
+ typedef int32_t (*ProcessFunction)(
+ effect_handle_t self, audio_buffer_t* inBuffer, audio_buffer_t* outBuffer);
+ using CommandSuccessCallback = std::function<void()>;
+ using GetConfigCallback = std::function<void(Result retval, const EffectConfig& config)>;
+ using GetCurrentConfigSuccessCallback = std::function<void(void* configData)>;
+ using GetParameterSuccessCallback =
+ std::function<void(uint32_t valueSize, const void* valueData)>;
+ using GetSupportedConfigsSuccessCallback =
+ std::function<void(uint32_t supportedConfigs, void* configsData)>;
+ using ProcessCallback = std::function<void(Result retval, const AudioBuffer& outBuffer)>;
+
+ static const char *sContextResultOfCommand;
+ static const char *sContextCallToCommand;
+ static const char *sContextCallFunction;
+
+ effect_handle_t mHandle;
+
+ virtual ~Effect();
+
+ template<typename T> static size_t alignedSizeIn(size_t s);
+ template<typename T> static void hidlVecToHal(
+ const hidl_vec<T>& vec, uint32_t* halDataSize, void** halData);
+ static void effectAuxChannelsConfigFromHal(
+ const channel_config_t& halConfig, EffectAuxChannelsConfig* config);
+ static void effectAuxChannelsConfigToHal(
+ const EffectAuxChannelsConfig& config, channel_config_t* halConfig);
+ static void effectBufferConfigFromHal(
+ const buffer_config_t& halConfig, EffectBufferConfig* config);
+ static void effectBufferConfigToHal(
+ const EffectBufferConfig& config, buffer_config_t* halConfig);
+ static void effectConfigFromHal(const effect_config_t& halConfig, EffectConfig* config);
+ static void effectConfigToHal(const EffectConfig& config, effect_config_t* halConfig);
+ static void effectOffloadParamToHal(
+ const EffectOffloadParameter& offload, effect_offload_param_t* halOffload);
+ static std::vector<uint8_t> parameterToHal(
+ uint32_t paramSize, const void* paramData, uint32_t valueSize, const void** valueData);
+
+ Result analyzeCommandStatus(
+ const char* commandName, const char* context, status_t status);
+ Result analyzeStatus(
+ const char* funcName,
+ const char* subFuncName,
+ const char* contextDescription,
+ status_t status);
+ void getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb);
+ Result getCurrentConfigImpl(
+ uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess);
+ Result getParameterImpl(
+ uint32_t paramSize,
+ const void* paramData,
+ uint32_t valueSize,
+ GetParameterSuccessCallback onSuccess);
+ Result getSupportedConfigsImpl(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ GetSupportedConfigsSuccessCallback onSuccess);
+ void processImpl(
+ ProcessFunction process,
+ const char* funcName,
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ ProcessCallback cb);
+ Result sendCommand(int commandCode, const char* commandName);
+ Result sendCommand(int commandCode, const char* commandName, uint32_t size, void* data);
+ Result sendCommandReturningData(
+ int commandCode, const char* commandName, uint32_t* replySize, void* replyData);
+ Result sendCommandReturningData(
+ int commandCode, const char* commandName,
+ uint32_t size, void* data,
+ uint32_t* replySize, void* replyData);
+ Result sendCommandReturningStatus(int commandCode, const char* commandName);
+ Result sendCommandReturningStatus(
+ int commandCode, const char* commandName, uint32_t size, void* data);
+ Result sendCommandReturningStatusAndData(
+ int commandCode, const char* commandName,
+ uint32_t size, void* data,
+ uint32_t* replySize, void* replyData,
+ uint32_t minReplySize,
+ CommandSuccessCallback onSuccess);
+ Result setConfigImpl(
+ int commandCode, const char* commandName,
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider);
+ Result setParameterImpl(
+ uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
diff --git a/audio/effect/2.0/default/EffectsFactory.cpp b/audio/effect/2.0/default/EffectsFactory.cpp
new file mode 100644
index 0000000..30fcb26
--- /dev/null
+++ b/audio/effect/2.0/default/EffectsFactory.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "EffectFactoryHAL"
+#include <media/EffectsFactoryApi.h>
+#include <system/audio_effects/effect_aec.h>
+#include <system/audio_effects/effect_agc.h>
+#include <system/audio_effects/effect_bassboost.h>
+#include <system/audio_effects/effect_downmix.h>
+#include <system/audio_effects/effect_environmentalreverb.h>
+#include <system/audio_effects/effect_equalizer.h>
+#include <system/audio_effects/effect_loudnessenhancer.h>
+#include <system/audio_effects/effect_ns.h>
+#include <system/audio_effects/effect_presetreverb.h>
+#include <system/audio_effects/effect_virtualizer.h>
+#include <system/audio_effects/effect_visualizer.h>
+#include <utils/Log.h>
+
+#include "AcousticEchoCancelerEffect.h"
+#include "AutomaticGainControlEffect.h"
+#include "BassBoostEffect.h"
+#include "Conversions.h"
+#include "EffectsFactory.h"
+#include "DownmixEffect.h"
+#include "Effect.h"
+#include "EffectMap.h"
+#include "EnvironmentalReverbEffect.h"
+#include "EqualizerEffect.h"
+#include "LoudnessEnhancerEffect.h"
+#include "NoiseSuppressionEffect.h"
+#include "PresetReverbEffect.h"
+#include "VirtualizerEffect.h"
+#include "VisualizerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+// static
+sp<IEffect> EffectsFactory::dispatchEffectInstanceCreation(
+ const effect_descriptor_t& halDescriptor, effect_handle_t handle) {
+ const effect_uuid_t *halUuid = &halDescriptor.type;
+ if (memcmp(halUuid, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) {
+ return new AcousticEchoCancelerEffect(handle);
+ } else if (memcmp(halUuid, FX_IID_AGC, sizeof(effect_uuid_t)) == 0) {
+ return new AutomaticGainControlEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_BASSBOOST, sizeof(effect_uuid_t)) == 0) {
+ return new BassBoostEffect(handle);
+ } else if (memcmp(halUuid, EFFECT_UIID_DOWNMIX, sizeof(effect_uuid_t)) == 0) {
+ return new DownmixEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_ENVIRONMENTALREVERB, sizeof(effect_uuid_t)) == 0) {
+ return new EnvironmentalReverbEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_EQUALIZER, sizeof(effect_uuid_t)) == 0) {
+ return new EqualizerEffect(handle);
+ } else if (memcmp(halUuid, FX_IID_LOUDNESS_ENHANCER, sizeof(effect_uuid_t)) == 0) {
+ return new LoudnessEnhancerEffect(handle);
+ } else if (memcmp(halUuid, FX_IID_NS, sizeof(effect_uuid_t)) == 0) {
+ return new NoiseSuppressionEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_PRESETREVERB, sizeof(effect_uuid_t)) == 0) {
+ return new PresetReverbEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_VIRTUALIZER, sizeof(effect_uuid_t)) == 0) {
+ return new VirtualizerEffect(handle);
+ } else if (memcmp(halUuid, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0) {
+ return new VisualizerEffect(handle);
+ }
+ return new Effect(handle);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffectsFactory follow.
+Return<void> EffectsFactory::getAllDescriptors(getAllDescriptors_cb _hidl_cb) {
+ Result retval(Result::OK);
+ hidl_vec<EffectDescriptor> result;
+ uint32_t numEffects;
+ status_t status;
+
+restart:
+ numEffects = 0;
+ status = EffectQueryNumberEffects(&numEffects);
+ if (status != OK) {
+ retval = Result::NOT_INITIALIZED;
+ ALOGW("Error querying number of effects: %s", strerror(-status));
+ goto exit;
+ }
+ result.resize(numEffects);
+ for (uint32_t i = 0; i < numEffects; ++i) {
+ effect_descriptor_t halDescriptor;
+ status = EffectQueryEffect(i, &halDescriptor);
+ if (status == OK) {
+ effectDescriptorFromHal(halDescriptor, &result[i]);
+ } else {
+ ALOGW("Error querying effect at position %d / %d: %s",
+ i, numEffects, strerror(-status));
+ switch (status) {
+ case -ENOSYS: {
+ // Effect list has changed.
+ goto restart;
+ }
+ case -ENOENT: {
+ // No more effects available.
+ result.resize(i);
+ }
+ default: {
+ result.resize(0);
+ retval = Result::NOT_INITIALIZED;
+ }
+ }
+ break;
+ }
+ }
+
+exit:
+ _hidl_cb(retval, result);
+ return Void();
+}
+
+Return<void> EffectsFactory::getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) {
+ effect_uuid_t halUuid;
+ uuidToHal(uid, &halUuid);
+ effect_descriptor_t halDescriptor;
+ status_t status = EffectGetDescriptor(&halUuid, &halDescriptor);
+ EffectDescriptor descriptor;
+ effectDescriptorFromHal(halDescriptor, &descriptor);
+ Result retval(Result::OK);
+ if (status != OK) {
+ ALOGW("Error querying effect descriptor for %s: %s",
+ uuidToString(halUuid).c_str(), strerror(-status));
+ if (status == -ENOENT) {
+ retval = Result::INVALID_ARGUMENTS;
+ } else {
+ retval = Result::NOT_INITIALIZED;
+ }
+ }
+ _hidl_cb(retval, descriptor);
+ return Void();
+}
+
+Return<void> EffectsFactory::createEffect(
+ const Uuid& uid, int32_t session, int32_t ioHandle, createEffect_cb _hidl_cb) {
+ effect_uuid_t halUuid;
+ uuidToHal(uid, &halUuid);
+ effect_handle_t handle;
+ Result retval(Result::OK);
+ status_t status = EffectCreate(&halUuid, session, ioHandle, &handle);
+ sp<IEffect> effect;
+ uint64_t effectId = EffectMap::INVALID_ID;
+ if (status == OK) {
+ effect_descriptor_t halDescriptor;
+ memset(&halDescriptor, 0, sizeof(effect_descriptor_t));
+ status = (*handle)->get_descriptor(handle, &halDescriptor);
+ if (status == OK) {
+ effect = dispatchEffectInstanceCreation(halDescriptor, handle);
+ effectId = EffectMap::getInstance().add(handle);
+ } else {
+ EffectRelease(handle);
+ }
+ }
+ if (status != OK) {
+ ALOGW("Error creating effect %s: %s", uuidToString(halUuid).c_str(), strerror(-status));
+ if (status == -ENOENT) {
+ retval = Result::INVALID_ARGUMENTS;
+ } else {
+ retval = Result::NOT_INITIALIZED;
+ }
+ }
+ _hidl_cb(retval, effect, effectId);
+ return Void();
+}
+
+Return<void> EffectsFactory::debugDump(const native_handle_t* fd) {
+ if (fd->numFds == 1) {
+ EffectDumpEffects(fd->data[0]);
+ }
+ return Void();
+}
+
+
+IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* /* name */) {
+ return new EffectsFactory();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/EffectsFactory.h b/audio/effect/2.0/default/EffectsFactory.h
new file mode 100644
index 0000000..229356f
--- /dev/null
+++ b/audio/effect/2.0/default/EffectsFactory.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
+
+#include <system/audio_effect.h>
+
+#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::Uuid;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectsFactory;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct EffectsFactory : public IEffectsFactory {
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffectsFactory follow.
+ Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb) override;
+ Return<void> getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) override;
+ Return<void> createEffect(
+ const Uuid& uid, int32_t session, int32_t ioHandle, createEffect_cb _hidl_cb) override;
+ Return<void> debugDump(const native_handle_t* fd) override;
+
+ private:
+ static sp<IEffect> dispatchEffectInstanceCreation(
+ const effect_descriptor_t& halDescriptor, effect_handle_t handle);
+};
+
+extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
new file mode 100644
index 0000000..4485be4
--- /dev/null
+++ b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "EnvReverb_HAL"
+#include <utils/Log.h>
+
+#include "EnvironmentalReverbEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+EnvironmentalReverbEffect::EnvironmentalReverbEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+EnvironmentalReverbEffect::~EnvironmentalReverbEffect() {}
+
+void EnvironmentalReverbEffect::propertiesFromHal(
+ const t_reverb_settings& halProperties,
+ IEnvironmentalReverbEffect::AllProperties* properties) {
+ properties->roomLevel = halProperties.roomLevel;
+ properties->roomHfLevel = halProperties.roomHFLevel;
+ properties->decayTime = halProperties.decayTime;
+ properties->decayHfRatio = halProperties.decayHFRatio;
+ properties->reflectionsLevel = halProperties.reflectionsLevel;
+ properties->reflectionsDelay = halProperties.reflectionsDelay;
+ properties->reverbLevel = halProperties.reverbLevel;
+ properties->reverbDelay = halProperties.reverbDelay;
+ properties->diffusion = halProperties.diffusion;
+ properties->density = halProperties.density;
+}
+
+void EnvironmentalReverbEffect::propertiesToHal(
+ const IEnvironmentalReverbEffect::AllProperties& properties,
+ t_reverb_settings* halProperties) {
+ halProperties->roomLevel = properties.roomLevel;
+ halProperties->roomHFLevel = properties.roomHfLevel;
+ halProperties->decayTime = properties.decayTime;
+ halProperties->decayHFRatio = properties.decayHfRatio;
+ halProperties->reflectionsLevel = properties.reflectionsLevel;
+ halProperties->reflectionsDelay = properties.reflectionsDelay;
+ halProperties->reverbLevel = properties.reverbLevel;
+ halProperties->reverbDelay = properties.reverbDelay;
+ halProperties->diffusion = properties.diffusion;
+ halProperties->density = properties.density;
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> EnvironmentalReverbEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> EnvironmentalReverbEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> EnvironmentalReverbEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> EnvironmentalReverbEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> EnvironmentalReverbEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> EnvironmentalReverbEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> EnvironmentalReverbEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> EnvironmentalReverbEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> EnvironmentalReverbEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> EnvironmentalReverbEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> EnvironmentalReverbEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> EnvironmentalReverbEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> EnvironmentalReverbEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> EnvironmentalReverbEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> EnvironmentalReverbEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEnvironmentalReverbEffect follow.
+Return<Result> EnvironmentalReverbEffect::setBypass(bool bypass) {
+ return mEffect->setParam(REVERB_PARAM_BYPASS, bypass);
+}
+
+Return<void> EnvironmentalReverbEffect::getBypass(getBypass_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_BYPASS, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setRoomLevel(int16_t roomLevel) {
+ return mEffect->setParam(REVERB_PARAM_ROOM_LEVEL, roomLevel);
+}
+
+Return<void> EnvironmentalReverbEffect::getRoomLevel(getRoomLevel_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_ROOM_LEVEL, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setRoomHfLevel(int16_t roomHfLevel) {
+ return mEffect->setParam(REVERB_PARAM_ROOM_HF_LEVEL, roomHfLevel);
+}
+
+Return<void> EnvironmentalReverbEffect::getRoomHfLevel(getRoomHfLevel_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_ROOM_HF_LEVEL, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setDecayTime(uint32_t decayTime) {
+ return mEffect->setParam(REVERB_PARAM_DECAY_TIME, decayTime);
+}
+
+Return<void> EnvironmentalReverbEffect::getDecayTime(getDecayTime_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_DECAY_TIME, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setDecayHfRatio(int16_t decayHfRatio) {
+ return mEffect->setParam(REVERB_PARAM_DECAY_HF_RATIO, decayHfRatio);
+}
+
+Return<void> EnvironmentalReverbEffect::getDecayHfRatio(getDecayHfRatio_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_DECAY_HF_RATIO, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setReflectionsLevel(int16_t reflectionsLevel) {
+ return mEffect->setParam(REVERB_PARAM_REFLECTIONS_LEVEL, reflectionsLevel);
+}
+
+Return<void> EnvironmentalReverbEffect::getReflectionsLevel(getReflectionsLevel_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_REFLECTIONS_LEVEL, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setReflectionsDelay(uint32_t reflectionsDelay) {
+ return mEffect->setParam(REVERB_PARAM_REFLECTIONS_DELAY, reflectionsDelay);
+}
+
+Return<void> EnvironmentalReverbEffect::getReflectionsDelay(getReflectionsDelay_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_REFLECTIONS_DELAY, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setReverbLevel(int16_t reverbLevel) {
+ return mEffect->setParam(REVERB_PARAM_REVERB_LEVEL, reverbLevel);
+}
+
+Return<void> EnvironmentalReverbEffect::getReverbLevel(getReverbLevel_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_REVERB_LEVEL, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setReverbDelay(uint32_t reverbDelay) {
+ return mEffect->setParam(REVERB_PARAM_REVERB_DELAY, reverbDelay);
+}
+
+Return<void> EnvironmentalReverbEffect::getReverbDelay(getReverbDelay_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_REVERB_DELAY, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setDiffusion(int16_t diffusion) {
+ return mEffect->setParam(REVERB_PARAM_DIFFUSION, diffusion);
+}
+
+Return<void> EnvironmentalReverbEffect::getDiffusion(getDiffusion_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_DIFFUSION, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setDensity(int16_t density) {
+ return mEffect->setParam(REVERB_PARAM_DENSITY, density);
+}
+
+Return<void> EnvironmentalReverbEffect::getDensity(getDensity_cb _hidl_cb) {
+ return mEffect->getIntegerParam(REVERB_PARAM_DENSITY, _hidl_cb);
+}
+
+Return<Result> EnvironmentalReverbEffect::setAllProperties(
+ const IEnvironmentalReverbEffect::AllProperties& properties) {
+ t_reverb_settings halProperties;
+ propertiesToHal(properties, &halProperties);
+ return mEffect->setParam(REVERB_PARAM_PROPERTIES, halProperties);
+}
+
+Return<void> EnvironmentalReverbEffect::getAllProperties(getAllProperties_cb _hidl_cb) {
+ t_reverb_settings halProperties;
+ Result retval = mEffect->getParam(REVERB_PARAM_PROPERTIES, halProperties);
+ AllProperties properties;
+ propertiesFromHal(halProperties, &properties);
+ _hidl_cb(retval, properties);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.h b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
new file mode 100644
index 0000000..c97c51c
--- /dev/null
+++ b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
+
+#include <system/audio_effects/effect_environmentalreverb.h>
+
+#include <android/hardware/audio/effect/2.0/IEnvironmentalReverbEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::IEnvironmentalReverbEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect {
+ explicit EnvironmentalReverbEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEnvironmentalReverbEffect follow.
+ Return<Result> setBypass(bool bypass) override;
+ Return<void> getBypass(getBypass_cb _hidl_cb) override;
+ Return<Result> setRoomLevel(int16_t roomLevel) override;
+ Return<void> getRoomLevel(getRoomLevel_cb _hidl_cb) override;
+ Return<Result> setRoomHfLevel(int16_t roomHfLevel) override;
+ Return<void> getRoomHfLevel(getRoomHfLevel_cb _hidl_cb) override;
+ Return<Result> setDecayTime(uint32_t decayTime) override;
+ Return<void> getDecayTime(getDecayTime_cb _hidl_cb) override;
+ Return<Result> setDecayHfRatio(int16_t decayHfRatio) override;
+ Return<void> getDecayHfRatio(getDecayHfRatio_cb _hidl_cb) override;
+ Return<Result> setReflectionsLevel(int16_t reflectionsLevel) override;
+ Return<void> getReflectionsLevel(getReflectionsLevel_cb _hidl_cb) override;
+ Return<Result> setReflectionsDelay(uint32_t reflectionsDelay) override;
+ Return<void> getReflectionsDelay(getReflectionsDelay_cb _hidl_cb) override;
+ Return<Result> setReverbLevel(int16_t reverbLevel) override;
+ Return<void> getReverbLevel(getReverbLevel_cb _hidl_cb) override;
+ Return<Result> setReverbDelay(uint32_t reverbDelay) override;
+ Return<void> getReverbDelay(getReverbDelay_cb _hidl_cb) override;
+ Return<Result> setDiffusion(int16_t diffusion) override;
+ Return<void> getDiffusion(getDiffusion_cb _hidl_cb) override;
+ Return<Result> setDensity(int16_t density) override;
+ Return<void> getDensity(getDensity_cb _hidl_cb) override;
+ Return<Result> setAllProperties(
+ const IEnvironmentalReverbEffect::AllProperties& properties) override;
+ Return<void> getAllProperties(getAllProperties_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~EnvironmentalReverbEffect();
+
+ void propertiesFromHal(
+ const t_reverb_settings& halProperties,
+ IEnvironmentalReverbEffect::AllProperties* properties);
+ void propertiesToHal(
+ const IEnvironmentalReverbEffect::AllProperties& properties,
+ t_reverb_settings* halProperties);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
diff --git a/audio/effect/2.0/default/EqualizerEffect.cpp b/audio/effect/2.0/default/EqualizerEffect.cpp
new file mode 100644
index 0000000..9e20b8a
--- /dev/null
+++ b/audio/effect/2.0/default/EqualizerEffect.cpp
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <memory.h>
+
+#define LOG_TAG "Equalizer_HAL"
+#include <utils/Log.h>
+
+#include "EqualizerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+EqualizerEffect::EqualizerEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+EqualizerEffect::~EqualizerEffect() {}
+
+void EqualizerEffect::propertiesFromHal(
+ t_equalizer_settings& halProperties,
+ IEqualizerEffect::AllProperties* properties) {
+ properties->curPreset = halProperties.curPreset;
+ properties->bandLevels.setToExternal(&halProperties.bandLevels[0], halProperties.numBands);
+}
+
+std::vector<uint8_t> EqualizerEffect::propertiesToHal(
+ const IEqualizerEffect::AllProperties& properties,
+ t_equalizer_settings** halProperties) {
+ size_t bandsSize = properties.bandLevels.size() * sizeof(uint16_t);
+ std::vector<uint8_t> halBuffer(sizeof(t_equalizer_settings) + bandsSize, 0);
+ *halProperties = reinterpret_cast<t_equalizer_settings*>(&halBuffer[0]);
+ (*halProperties)->curPreset = properties.curPreset;
+ (*halProperties)->numBands = properties.bandLevels.size();
+ memcpy((*halProperties)->bandLevels, &properties.bandLevels[0], bandsSize);
+ return halBuffer;
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> EqualizerEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> EqualizerEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> EqualizerEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> EqualizerEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> EqualizerEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> EqualizerEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> EqualizerEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> EqualizerEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> EqualizerEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> EqualizerEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> EqualizerEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> EqualizerEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> EqualizerEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> EqualizerEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> EqualizerEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> EqualizerEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> EqualizerEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> EqualizerEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> EqualizerEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> EqualizerEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> EqualizerEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEqualizerEffect follow.
+Return<void> EqualizerEffect::getNumBands(getNumBands_cb _hidl_cb) {
+ return mEffect->getIntegerParam(EQ_PARAM_NUM_BANDS, _hidl_cb);
+}
+
+Return<void> EqualizerEffect::getLevelRange(getLevelRange_cb _hidl_cb) {
+ uint16_t halLevels[2] = { 0, 0 };
+ Result retval = mEffect->getParam(EQ_PARAM_LEVEL_RANGE, halLevels);
+ _hidl_cb(retval, halLevels[0], halLevels[1]);
+ return Void();
+}
+
+Return<Result> EqualizerEffect::setBandLevel(uint16_t band, uint16_t level) {
+ return mEffect->setParam(EQ_PARAM_BAND_LEVEL, band, level);
+}
+
+Return<void> EqualizerEffect::getBandLevel(uint16_t band, getBandLevel_cb _hidl_cb) {
+ uint16_t halLevel = 0;
+ Result retval = mEffect->getParam(EQ_PARAM_BAND_LEVEL, band, halLevel);
+ _hidl_cb(retval, halLevel);
+ return Void();
+}
+
+Return<void> EqualizerEffect::getBandCenterFrequency(
+ uint16_t band, getBandCenterFrequency_cb _hidl_cb) {
+ uint32_t halFreq = 0;
+ Result retval = mEffect->getParam(EQ_PARAM_CENTER_FREQ, band, halFreq);
+ _hidl_cb(retval, halFreq);
+ return Void();
+}
+
+Return<void> EqualizerEffect::getBandFrequencyRange(
+ uint16_t band, getBandFrequencyRange_cb _hidl_cb) {
+ uint32_t halFreqs[2] = { 0, 0 };
+ Result retval = mEffect->getParam(EQ_PARAM_BAND_FREQ_RANGE, band, halFreqs);
+ _hidl_cb(retval, halFreqs[0], halFreqs[1]);
+ return Void();
+}
+
+Return<void> EqualizerEffect::getBandForFrequency(uint32_t freq, getBandForFrequency_cb _hidl_cb) {
+ uint16_t halBand = 0;
+ Result retval = mEffect->getParam(EQ_PARAM_GET_BAND, freq, halBand);
+ _hidl_cb(retval, halBand);
+ return Void();
+}
+
+Return<void> EqualizerEffect::getPresetNames(getPresetNames_cb _hidl_cb) {
+ uint16_t halPresetCount = 0;
+ Result retval = mEffect->getParam(EQ_PARAM_GET_NUM_OF_PRESETS, halPresetCount);
+ hidl_vec<hidl_string> presetNames;
+ if (retval == Result::OK) {
+ presetNames.resize(halPresetCount);
+ for (uint16_t i = 0; i < halPresetCount; ++i) {
+ char halPresetName[EFFECT_STRING_LEN_MAX];
+ retval = mEffect->getParam(EQ_PARAM_GET_PRESET_NAME, i, halPresetName);
+ if (retval == Result::OK) {
+ presetNames[i] = halPresetName;
+ } else {
+ presetNames.resize(i);
+ }
+ }
+ }
+ _hidl_cb(retval, presetNames);
+ return Void();
+}
+
+Return<Result> EqualizerEffect::setCurrentPreset(uint16_t preset) {
+ return mEffect->setParam(EQ_PARAM_CUR_PRESET, preset);
+}
+
+Return<void> EqualizerEffect::getCurrentPreset(getCurrentPreset_cb _hidl_cb) {
+ return mEffect->getIntegerParam(EQ_PARAM_CUR_PRESET, _hidl_cb);
+}
+
+Return<Result> EqualizerEffect::setAllProperties(
+ const IEqualizerEffect::AllProperties& properties) {
+ t_equalizer_settings *halPropertiesPtr = nullptr;
+ std::vector<uint8_t> halBuffer = propertiesToHal(properties, &halPropertiesPtr);
+ return mEffect->setParam(EQ_PARAM_PROPERTIES, *halPropertiesPtr);
+}
+
+Return<void> EqualizerEffect::getAllProperties(getAllProperties_cb _hidl_cb) {
+ t_equalizer_settings halProperties;
+ Result retval = mEffect->getParam(EQ_PARAM_PROPERTIES, halProperties);
+ AllProperties properties;
+ propertiesFromHal(halProperties, &properties);
+ _hidl_cb(retval, properties);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/EqualizerEffect.h b/audio/effect/2.0/default/EqualizerEffect.h
new file mode 100644
index 0000000..5665e9c
--- /dev/null
+++ b/audio/effect/2.0/default/EqualizerEffect.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
+
+#include <vector>
+
+#include <system/audio_effects/effect_equalizer.h>
+
+#include <android/hardware/audio/effect/2.0/IEqualizerEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::IEqualizerEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct EqualizerEffect : public IEqualizerEffect {
+ explicit EqualizerEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEqualizerEffect follow.
+ Return<void> getNumBands(getNumBands_cb _hidl_cb) override;
+ Return<void> getLevelRange(getLevelRange_cb _hidl_cb) override;
+ Return<Result> setBandLevel(uint16_t band, uint16_t level) override;
+ Return<void> getBandLevel(uint16_t band, getBandLevel_cb _hidl_cb) override;
+ Return<void> getBandCenterFrequency(
+ uint16_t band, getBandCenterFrequency_cb _hidl_cb) override;
+ Return<void> getBandFrequencyRange(uint16_t band, getBandFrequencyRange_cb _hidl_cb) override;
+ Return<void> getBandForFrequency(uint32_t freq, getBandForFrequency_cb _hidl_cb) override;
+ Return<void> getPresetNames(getPresetNames_cb _hidl_cb) override;
+ Return<Result> setCurrentPreset(uint16_t preset) override;
+ Return<void> getCurrentPreset(getCurrentPreset_cb _hidl_cb) override;
+ Return<Result> setAllProperties(const IEqualizerEffect::AllProperties& properties) override;
+ Return<void> getAllProperties(getAllProperties_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~EqualizerEffect();
+
+ void propertiesFromHal(
+ t_equalizer_settings& halProperties,
+ IEqualizerEffect::AllProperties* properties);
+ std::vector<uint8_t> propertiesToHal(
+ const IEqualizerEffect::AllProperties& properties,
+ t_equalizer_settings** halProperties);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
new file mode 100644
index 0000000..1e724e0
--- /dev/null
+++ b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <system/audio_effects/effect_loudnessenhancer.h>
+
+#define LOG_TAG "LoudnessEnhancer_HAL"
+#include <system/audio_effects/effect_aec.h>
+#include <utils/Log.h>
+
+#include "LoudnessEnhancerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+LoudnessEnhancerEffect::LoudnessEnhancerEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+LoudnessEnhancerEffect::~LoudnessEnhancerEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> LoudnessEnhancerEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> LoudnessEnhancerEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> LoudnessEnhancerEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> LoudnessEnhancerEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> LoudnessEnhancerEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> LoudnessEnhancerEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> LoudnessEnhancerEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> LoudnessEnhancerEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> LoudnessEnhancerEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> LoudnessEnhancerEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> LoudnessEnhancerEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> LoudnessEnhancerEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> LoudnessEnhancerEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> LoudnessEnhancerEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> LoudnessEnhancerEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> LoudnessEnhancerEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> LoudnessEnhancerEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> LoudnessEnhancerEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> LoudnessEnhancerEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect follow.
+Return<Result> LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb) {
+ return mEffect->setParam(LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB, targetGainMb);
+}
+
+Return<void> LoudnessEnhancerEffect::getTargetGain(getTargetGain_cb _hidl_cb) {
+ return mEffect->getIntegerParam(LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB, _hidl_cb);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.h b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
new file mode 100644
index 0000000..e68b038
--- /dev/null
+++ b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
+
+#include <android/hardware/audio/effect/2.0/ILoudnessEnhancerEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect {
+ explicit LoudnessEnhancerEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect follow.
+ Return<Result> setTargetGain(int32_t targetGainMb) override;
+ Return<void> getTargetGain(getTargetGain_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~LoudnessEnhancerEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
new file mode 100644
index 0000000..5c392df
--- /dev/null
+++ b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "NS_Effect_HAL"
+#include <utils/Log.h>
+
+#include "NoiseSuppressionEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+NoiseSuppressionEffect::NoiseSuppressionEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+NoiseSuppressionEffect::~NoiseSuppressionEffect() {}
+
+void NoiseSuppressionEffect::propertiesFromHal(
+ const t_ns_settings& halProperties,
+ INoiseSuppressionEffect::AllProperties* properties) {
+ properties->level = Level(halProperties.level);
+ properties->type = Type(halProperties.type);
+}
+
+void NoiseSuppressionEffect::propertiesToHal(
+ const INoiseSuppressionEffect::AllProperties& properties,
+ t_ns_settings* halProperties) {
+ halProperties->level = static_cast<uint32_t>(properties.level);
+ halProperties->type = static_cast<uint32_t>(properties.type);
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> NoiseSuppressionEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> NoiseSuppressionEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> NoiseSuppressionEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> NoiseSuppressionEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> NoiseSuppressionEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> NoiseSuppressionEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> NoiseSuppressionEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> NoiseSuppressionEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> NoiseSuppressionEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> NoiseSuppressionEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> NoiseSuppressionEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> NoiseSuppressionEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> NoiseSuppressionEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> NoiseSuppressionEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> NoiseSuppressionEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> NoiseSuppressionEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> NoiseSuppressionEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> NoiseSuppressionEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> NoiseSuppressionEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::INoiseSuppressionEffect follow.
+Return<Result> NoiseSuppressionEffect::setSuppressionLevel(INoiseSuppressionEffect::Level level) {
+ return mEffect->setParam(NS_PARAM_LEVEL, static_cast<int32_t>(level));
+}
+
+Return<void> NoiseSuppressionEffect::getSuppressionLevel(getSuppressionLevel_cb _hidl_cb) {
+ int32_t halLevel = 0;
+ Result retval = mEffect->getParam(NS_PARAM_LEVEL, halLevel);
+ _hidl_cb(retval, Level(halLevel));
+ return Void();
+}
+
+Return<Result> NoiseSuppressionEffect::setSuppressionType(INoiseSuppressionEffect::Type type) {
+ return mEffect->setParam(NS_PARAM_TYPE, static_cast<int32_t>(type));
+}
+
+Return<void> NoiseSuppressionEffect::getSuppressionType(getSuppressionType_cb _hidl_cb) {
+ int32_t halType = 0;
+ Result retval = mEffect->getParam(NS_PARAM_TYPE, halType);
+ _hidl_cb(retval, Type(halType));
+ return Void();
+}
+
+Return<Result> NoiseSuppressionEffect::setAllProperties(
+ const INoiseSuppressionEffect::AllProperties& properties) {
+ t_ns_settings halProperties;
+ propertiesToHal(properties, &halProperties);
+ return mEffect->setParam(NS_PARAM_PROPERTIES, halProperties);
+}
+
+Return<void> NoiseSuppressionEffect::getAllProperties(getAllProperties_cb _hidl_cb) {
+ t_ns_settings halProperties;
+ Result retval = mEffect->getParam(NS_PARAM_PROPERTIES, halProperties);
+ AllProperties properties;
+ propertiesFromHal(halProperties, &properties);
+ _hidl_cb(retval, properties);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.h b/audio/effect/2.0/default/NoiseSuppressionEffect.h
new file mode 100644
index 0000000..83e513e
--- /dev/null
+++ b/audio/effect/2.0/default/NoiseSuppressionEffect.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
+
+#include <system/audio_effects/effect_ns.h>
+
+#include <android/hardware/audio/effect/2.0/INoiseSuppressionEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::INoiseSuppressionEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct NoiseSuppressionEffect : public INoiseSuppressionEffect {
+ explicit NoiseSuppressionEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::INoiseSuppressionEffect follow.
+ Return<Result> setSuppressionLevel(INoiseSuppressionEffect::Level level) override;
+ Return<void> getSuppressionLevel(getSuppressionLevel_cb _hidl_cb) override;
+ Return<Result> setSuppressionType(INoiseSuppressionEffect::Type type) override;
+ Return<void> getSuppressionType(getSuppressionType_cb _hidl_cb) override;
+ Return<Result> setAllProperties(
+ const INoiseSuppressionEffect::AllProperties& properties) override;
+ Return<void> getAllProperties(getAllProperties_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~NoiseSuppressionEffect();
+
+ void propertiesFromHal(
+ const t_ns_settings& halProperties,
+ INoiseSuppressionEffect::AllProperties* properties);
+ void propertiesToHal(
+ const INoiseSuppressionEffect::AllProperties& properties,
+ t_ns_settings* halProperties);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
diff --git a/audio/effect/2.0/default/PresetReverbEffect.cpp b/audio/effect/2.0/default/PresetReverbEffect.cpp
new file mode 100644
index 0000000..988bc51
--- /dev/null
+++ b/audio/effect/2.0/default/PresetReverbEffect.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "PresetReverb_HAL"
+#include <system/audio_effects/effect_presetreverb.h>
+#include <utils/Log.h>
+
+#include "PresetReverbEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+PresetReverbEffect::PresetReverbEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+PresetReverbEffect::~PresetReverbEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> PresetReverbEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> PresetReverbEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> PresetReverbEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> PresetReverbEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> PresetReverbEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> PresetReverbEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> PresetReverbEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> PresetReverbEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> PresetReverbEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> PresetReverbEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> PresetReverbEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> PresetReverbEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> PresetReverbEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> PresetReverbEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> PresetReverbEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> PresetReverbEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> PresetReverbEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> PresetReverbEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> PresetReverbEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> PresetReverbEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> PresetReverbEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> PresetReverbEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> PresetReverbEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> PresetReverbEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> PresetReverbEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> PresetReverbEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::IPresetReverbEffect follow.
+Return<Result> PresetReverbEffect::setPreset(IPresetReverbEffect::Preset preset) {
+ return mEffect->setParam(REVERB_PARAM_PRESET, static_cast<t_reverb_presets>(preset));
+}
+
+Return<void> PresetReverbEffect::getPreset(getPreset_cb _hidl_cb) {
+ t_reverb_presets halPreset = REVERB_PRESET_NONE;
+ Result retval = mEffect->getParam(REVERB_PARAM_PRESET, halPreset);
+ _hidl_cb(retval, Preset(halPreset));
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/PresetReverbEffect.h b/audio/effect/2.0/default/PresetReverbEffect.h
new file mode 100644
index 0000000..3d98102
--- /dev/null
+++ b/audio/effect/2.0/default/PresetReverbEffect.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IPresetReverbEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::IPresetReverbEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct PresetReverbEffect : public IPresetReverbEffect {
+ explicit PresetReverbEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IPresetReverbEffect follow.
+ Return<Result> setPreset(IPresetReverbEffect::Preset preset) override;
+ Return<void> getPreset(getPreset_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~PresetReverbEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
diff --git a/audio/effect/2.0/default/VirtualizerEffect.cpp b/audio/effect/2.0/default/VirtualizerEffect.cpp
new file mode 100644
index 0000000..af5252b
--- /dev/null
+++ b/audio/effect/2.0/default/VirtualizerEffect.cpp
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <memory.h>
+
+#define LOG_TAG "Virtualizer_HAL"
+#include <system/audio_effects/effect_virtualizer.h>
+#include <utils/Log.h>
+
+#include "VirtualizerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+VirtualizerEffect::VirtualizerEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)) {
+}
+
+VirtualizerEffect::~VirtualizerEffect() {}
+
+void VirtualizerEffect::speakerAnglesFromHal(
+ const int32_t* halAngles, uint32_t channelCount, hidl_vec<SpeakerAngle>& speakerAngles) {
+ speakerAngles.resize(channelCount);
+ for (uint32_t i = 0; i < channelCount; ++i) {
+ speakerAngles[i].mask = AudioChannelMask(*halAngles++);
+ speakerAngles[i].azimuth = *halAngles++;
+ speakerAngles[i].elevation = *halAngles++;
+ }
+}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> VirtualizerEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> VirtualizerEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> VirtualizerEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> VirtualizerEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> VirtualizerEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> VirtualizerEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> VirtualizerEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> VirtualizerEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> VirtualizerEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> VirtualizerEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> VirtualizerEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> VirtualizerEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> VirtualizerEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> VirtualizerEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> VirtualizerEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> VirtualizerEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> VirtualizerEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> VirtualizerEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> VirtualizerEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::IVirtualizerEffect follow.
+Return<bool> VirtualizerEffect::isStrengthSupported() {
+ bool halSupported = false;
+ mEffect->getParam(VIRTUALIZER_PARAM_STRENGTH_SUPPORTED, halSupported);
+ return halSupported;
+}
+
+Return<Result> VirtualizerEffect::setStrength(uint16_t strength) {
+ return mEffect->setParam(VIRTUALIZER_PARAM_STRENGTH, strength);
+}
+
+Return<void> VirtualizerEffect::getStrength(getStrength_cb _hidl_cb) {
+ return mEffect->getIntegerParam(VIRTUALIZER_PARAM_STRENGTH, _hidl_cb);
+}
+
+Return<void> VirtualizerEffect::getVirtualSpeakerAngles(
+ AudioChannelMask mask, AudioDevice device, getVirtualSpeakerAngles_cb _hidl_cb) {
+ uint32_t channelCount = audio_channel_count_from_out_mask(
+ static_cast<audio_channel_mask_t>(mask));
+ size_t halSpeakerAnglesSize = sizeof(int32_t) * 3 * channelCount;
+ uint32_t halParam[3] = {
+ VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES,
+ static_cast<audio_channel_mask_t>(mask),
+ static_cast<audio_devices_t>(device)
+ };
+ hidl_vec<SpeakerAngle> speakerAngles;
+ Result retval = mEffect->getParameterImpl(
+ sizeof(halParam), halParam,
+ halSpeakerAnglesSize,
+ [&] (uint32_t valueSize, const void* valueData) {
+ if (valueSize > halSpeakerAnglesSize) {
+ valueSize = halSpeakerAnglesSize;
+ } else if (valueSize < halSpeakerAnglesSize) {
+ channelCount = valueSize / (sizeof(int32_t) * 3);
+ }
+ speakerAnglesFromHal(
+ reinterpret_cast<const int32_t*>(valueData), channelCount, speakerAngles);
+ });
+ _hidl_cb(retval, speakerAngles);
+ return Void();
+}
+
+Return<Result> VirtualizerEffect::forceVirtualizationMode(AudioDevice device) {
+ return mEffect->setParam(
+ VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE, static_cast<audio_devices_t>(device));
+}
+
+Return<void> VirtualizerEffect::getVirtualizationMode(getVirtualizationMode_cb _hidl_cb) {
+ uint32_t halMode = 0;
+ Result retval = mEffect->getParam(VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE, halMode);
+ _hidl_cb(retval, AudioDevice(halMode));
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/VirtualizerEffect.h b/audio/effect/2.0/default/VirtualizerEffect.h
new file mode 100644
index 0000000..2731c4e
--- /dev/null
+++ b/audio/effect/2.0/default/VirtualizerEffect.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IVirtualizerEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioChannelMask;
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::IVirtualizerEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct VirtualizerEffect : public IVirtualizerEffect {
+ explicit VirtualizerEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IVirtualizerEffect follow.
+ Return<bool> isStrengthSupported() override;
+ Return<Result> setStrength(uint16_t strength) override;
+ Return<void> getStrength(getStrength_cb _hidl_cb) override;
+ Return<void> getVirtualSpeakerAngles(
+ AudioChannelMask mask,
+ AudioDevice device,
+ getVirtualSpeakerAngles_cb _hidl_cb) override;
+ Return<Result> forceVirtualizationMode(AudioDevice device) override;
+ Return<void> getVirtualizationMode(getVirtualizationMode_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+
+ virtual ~VirtualizerEffect();
+
+ void speakerAnglesFromHal(
+ const int32_t* halAngles, uint32_t channelCount, hidl_vec<SpeakerAngle>& speakerAngles);
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
diff --git a/audio/effect/2.0/default/VisualizerEffect.cpp b/audio/effect/2.0/default/VisualizerEffect.cpp
new file mode 100644
index 0000000..a1f92a6
--- /dev/null
+++ b/audio/effect/2.0/default/VisualizerEffect.cpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "Visualizer_HAL"
+#include <system/audio_effects/effect_visualizer.h>
+#include <utils/Log.h>
+
+#include "VisualizerEffect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+VisualizerEffect::VisualizerEffect(effect_handle_t handle)
+ : mEffect(new Effect(handle)), mCaptureSize(0), mMeasurementMode(MeasurementMode::NONE) {
+}
+
+VisualizerEffect::~VisualizerEffect() {}
+
+// Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+Return<Result> VisualizerEffect::init() {
+ return mEffect->init();
+}
+
+Return<Result> VisualizerEffect::setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> VisualizerEffect::reset() {
+ return mEffect->reset();
+}
+
+Return<Result> VisualizerEffect::enable() {
+ return mEffect->enable();
+}
+
+Return<Result> VisualizerEffect::disable() {
+ return mEffect->disable();
+}
+
+Return<Result> VisualizerEffect::setDevice(AudioDevice device) {
+ return mEffect->setDevice(device);
+}
+
+Return<void> VisualizerEffect::setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
+ return mEffect->setAndGetVolume(volumes, _hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setAudioMode(AudioMode mode) {
+ return mEffect->setAudioMode(mode);
+}
+
+Return<Result> VisualizerEffect::setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
+ return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
+}
+
+Return<Result> VisualizerEffect::setInputDevice(AudioDevice device) {
+ return mEffect->setInputDevice(device);
+}
+
+Return<void> VisualizerEffect::getConfig(getConfig_cb _hidl_cb) {
+ return mEffect->getConfig(_hidl_cb);
+}
+
+Return<void> VisualizerEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
+ return mEffect->getConfigReverse(_hidl_cb);
+}
+
+Return<void> VisualizerEffect::getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
+ return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
+}
+
+Return<void> VisualizerEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
+ return mEffect->getAuxChannelsConfig(_hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setAuxChannelsConfig(
+ const EffectAuxChannelsConfig& config) {
+ return mEffect->setAuxChannelsConfig(config);
+}
+
+Return<Result> VisualizerEffect::setAudioSource(AudioSource source) {
+ return mEffect->setAudioSource(source);
+}
+
+Return<Result> VisualizerEffect::offload(const EffectOffloadParameter& param) {
+ return mEffect->offload(param);
+}
+
+Return<void> VisualizerEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
+ return mEffect->getDescriptor(_hidl_cb);
+}
+
+Return<void> VisualizerEffect::process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) {
+ return mEffect->process(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> VisualizerEffect::processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) {
+ return mEffect->processReverse(inBuffer, outFrameSize, _hidl_cb);
+}
+
+Return<void> VisualizerEffect::command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) {
+ return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
+ return mEffect->setParameter(parameter, value);
+}
+
+Return<void> VisualizerEffect::getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) {
+ return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
+}
+
+Return<void> VisualizerEffect::getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) {
+ return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
+}
+
+Return<void> VisualizerEffect::getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) {
+ return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) {
+ return mEffect->setCurrentConfigForFeature(featureId, configData);
+}
+
+
+// Methods from ::android::hardware::audio::effect::V2_0::IVisualizerEffect follow.
+Return<Result> VisualizerEffect::setCaptureSize(uint16_t captureSize) {
+ Result retval = mEffect->setParam(VISUALIZER_PARAM_CAPTURE_SIZE, captureSize);
+ if (retval == Result::OK) {
+ mCaptureSize = captureSize;
+ }
+ return retval;
+}
+
+Return<void> VisualizerEffect::getCaptureSize(getCaptureSize_cb _hidl_cb) {
+ return mEffect->getIntegerParam(VISUALIZER_PARAM_CAPTURE_SIZE, _hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setScalingMode(IVisualizerEffect::ScalingMode scalingMode) {
+ return mEffect->setParam(VISUALIZER_PARAM_SCALING_MODE, static_cast<int32_t>(scalingMode));
+}
+
+Return<void> VisualizerEffect::getScalingMode(getScalingMode_cb _hidl_cb) {
+ int32_t halMode;
+ Result retval = mEffect->getParam(VISUALIZER_PARAM_SCALING_MODE, halMode);
+ _hidl_cb(retval, ScalingMode(halMode));
+ return Void();
+}
+
+Return<Result> VisualizerEffect::setLatency(uint32_t latencyMs) {
+ return mEffect->setParam(VISUALIZER_PARAM_LATENCY, latencyMs);
+}
+
+Return<void> VisualizerEffect::getLatency(getLatency_cb _hidl_cb) {
+ return mEffect->getIntegerParam(VISUALIZER_PARAM_LATENCY, _hidl_cb);
+}
+
+Return<Result> VisualizerEffect::setMeasurementMode(
+ IVisualizerEffect::MeasurementMode measurementMode) {
+ Result retval = mEffect->setParam(
+ VISUALIZER_PARAM_MEASUREMENT_MODE, static_cast<int32_t>(measurementMode));
+ if (retval == Result::OK) {
+ mMeasurementMode = measurementMode;
+ }
+ return retval;
+}
+
+Return<void> VisualizerEffect::getMeasurementMode(getMeasurementMode_cb _hidl_cb) {
+ int32_t halMode;
+ Result retval = mEffect->getParam(VISUALIZER_PARAM_MEASUREMENT_MODE, halMode);
+ _hidl_cb(retval, MeasurementMode(halMode));
+ return Void();
+}
+
+Return<void> VisualizerEffect::capture(capture_cb _hidl_cb) {
+ if (mCaptureSize == 0) {
+ _hidl_cb(Result::NOT_INITIALIZED, hidl_vec<uint8_t>());
+ return Void();
+ }
+ uint32_t halCaptureSize = mCaptureSize;
+ uint8_t halCapture[mCaptureSize];
+ Result retval = mEffect->sendCommandReturningData(
+ VISUALIZER_CMD_CAPTURE, "VISUALIZER_CAPTURE", &halCaptureSize, halCapture);
+ hidl_vec<uint8_t> capture;
+ if (retval == Result::OK) {
+ capture.setToExternal(&halCapture[0], halCaptureSize);
+ }
+ _hidl_cb(retval, capture);
+ return Void();
+}
+
+Return<void> VisualizerEffect::measure(measure_cb _hidl_cb) {
+ if (mMeasurementMode == MeasurementMode::NONE) {
+ _hidl_cb(Result::NOT_INITIALIZED, Measurement());
+ return Void();
+ }
+ int32_t halMeasurement[MEASUREMENT_COUNT];
+ uint32_t halMeasurementSize = sizeof(halMeasurement);
+ Result retval = mEffect->sendCommandReturningData(
+ VISUALIZER_CMD_MEASURE, "VISUALIZER_MEASURE", &halMeasurementSize, halMeasurement);
+ Measurement measurement = { .mode = MeasurementMode::PEAK_RMS };
+ measurement.value.peakAndRms.peakMb = 0;
+ measurement.value.peakAndRms.rmsMb = 0;
+ if (retval == Result::OK) {
+ measurement.value.peakAndRms.peakMb = halMeasurement[MEASUREMENT_IDX_PEAK];
+ measurement.value.peakAndRms.rmsMb = halMeasurement[MEASUREMENT_IDX_RMS];
+ }
+ _hidl_cb(retval, measurement);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
diff --git a/audio/effect/2.0/default/VisualizerEffect.h b/audio/effect/2.0/default/VisualizerEffect.h
new file mode 100644
index 0000000..505b16f
--- /dev/null
+++ b/audio/effect/2.0/default/VisualizerEffect.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
+#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
+
+#include <android/hardware/audio/effect/2.0/IVisualizerEffect.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::audio::common::V2_0::AudioDevice;
+using ::android::hardware::audio::common::V2_0::AudioMode;
+using ::android::hardware::audio::common::V2_0::AudioSource;
+using ::android::hardware::audio::effect::V2_0::AudioBuffer;
+using ::android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::V2_0::EffectConfig;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::EffectOffloadParameter;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::V2_0::IVisualizerEffect;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct VisualizerEffect : public IVisualizerEffect {
+ explicit VisualizerEffect(effect_handle_t handle);
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
+ Return<Result> init() override;
+ Return<Result> setConfig(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> reset() override;
+ Return<Result> enable() override;
+ Return<Result> disable() override;
+ Return<Result> setDevice(AudioDevice device) override;
+ Return<void> setAndGetVolume(
+ const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) override;
+ Return<Result> setAudioMode(AudioMode mode) override;
+ Return<Result> setConfigReverse(
+ const EffectConfig& config,
+ const sp<IEffectBufferProviderCallback>& inputBufferProvider,
+ const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
+ Return<Result> setInputDevice(AudioDevice device) override;
+ Return<void> getConfig(getConfig_cb _hidl_cb) override;
+ Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
+ Return<void> getSupportedAuxChannelsConfigs(
+ uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
+ Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
+ Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
+ Return<Result> setAudioSource(AudioSource source) override;
+ Return<Result> offload(const EffectOffloadParameter& param) override;
+ Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
+ Return<void> process(
+ const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb) override;
+ Return<void> processReverse(
+ const AudioBuffer& inBuffer,
+ uint32_t outFrameSize,
+ processReverse_cb _hidl_cb) override;
+ Return<void> command(
+ uint32_t commandId,
+ const hidl_vec<uint8_t>& data,
+ uint32_t resultMaxSize,
+ command_cb _hidl_cb) override;
+ Return<Result> setParameter(
+ const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) override;
+ Return<void> getParameter(
+ const hidl_vec<uint8_t>& parameter,
+ uint32_t valueMaxSize,
+ getParameter_cb _hidl_cb) override;
+ Return<void> getSupportedConfigsForFeature(
+ uint32_t featureId,
+ uint32_t maxConfigs,
+ uint32_t configSize,
+ getSupportedConfigsForFeature_cb _hidl_cb) override;
+ Return<void> getCurrentConfigForFeature(
+ uint32_t featureId,
+ uint32_t configSize,
+ getCurrentConfigForFeature_cb _hidl_cb) override;
+ Return<Result> setCurrentConfigForFeature(
+ uint32_t featureId, const hidl_vec<uint8_t>& configData) override;
+
+ // Methods from ::android::hardware::audio::effect::V2_0::IVisualizerEffect follow.
+ Return<Result> setCaptureSize(uint16_t captureSize) override;
+ Return<void> getCaptureSize(getCaptureSize_cb _hidl_cb) override;
+ Return<Result> setScalingMode(IVisualizerEffect::ScalingMode scalingMode) override;
+ Return<void> getScalingMode(getScalingMode_cb _hidl_cb) override;
+ Return<Result> setLatency(uint32_t latencyMs) override;
+ Return<void> getLatency(getLatency_cb _hidl_cb) override;
+ Return<Result> setMeasurementMode(IVisualizerEffect::MeasurementMode measurementMode) override;
+ Return<void> getMeasurementMode(getMeasurementMode_cb _hidl_cb) override;
+ Return<void> capture(capture_cb _hidl_cb) override;
+ Return<void> measure(measure_cb _hidl_cb) override;
+
+ private:
+ sp<Effect> mEffect;
+ uint16_t mCaptureSize;
+ MeasurementMode mMeasurementMode;
+
+ virtual ~VisualizerEffect();
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
index 82f6766..35015b2 100644
--- a/audio/effect/2.0/types.hal
+++ b/audio/effect/2.0/types.hal
@@ -23,7 +23,8 @@
NOT_INITIALIZED,
INVALID_ARGUMENTS,
INVALID_STATE,
- NOT_SUPPORTED
+ NOT_SUPPORTED,
+ RESULT_TOO_BIG
};
/*
@@ -207,8 +208,8 @@
// as estimated on an ARM9E core (ARMv5TE) with 0 WS
uint16_t memoryUsage; // data memory usage expressed in KB and includes
// only dynamically allocated memory
- string name; // human readable effect name
- string implementor; // human readable effect implementor name
+ uint8_t[64] name; // human readable effect name
+ uint8_t[64] implementor; // human readable effect implementor name
};
/*
@@ -272,9 +273,9 @@
CNT
};
-struct EffectFeatureConfig {
- EffectFeature feature;
- EffectConfig config;
+struct EffectAuxChannelsConfig {
+ AudioChannelMask mainChannels; // channel mask for main channels
+ AudioChannelMask auxChannels; // channel mask for auxiliary channels
};
struct EffectOffloadParameter {
diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..fc198e5
--- /dev/null
+++ b/audio/effect/2.0/vts/functional/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2016 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.
+//
+
+cc_test {
+ name: "audio_effect_hidl_hal_test",
+ gtest: true,
+ srcs: ["audio_effect_hidl_hal_test.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidl",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.audio.effect@2.0",
+ ],
+ static_libs: ["libgtest"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
diff --git a/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp b/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp
new file mode 100644
index 0000000..c7878d5
--- /dev/null
+++ b/audio/effect/2.0/vts/functional/audio_effect_hidl_hal_test.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "AudioEffectHidlHalTest"
+#include <android-base/logging.h>
+#include <cutils/native_handle.h>
+
+#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
+#include <android/hardware/audio/effect/2.0/types.h>
+
+#include <gtest/gtest.h>
+
+using ::android::hardware::audio::common::V2_0::Uuid;
+using ::android::hardware::audio::effect::V2_0::EffectDescriptor;
+using ::android::hardware::audio::effect::V2_0::IEffect;
+using ::android::hardware::audio::effect::V2_0::IEffectsFactory;
+using ::android::hardware::audio::effect::V2_0::Result;
+using ::android::hardware::Return;
+using ::android::hardware::Status;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::sp;
+
+// The main test class for Audio Effect HIDL HAL.
+class AudioEffectHidlTest : public ::testing::Test {
+ public:
+ virtual void SetUp() override {
+ // currently test passthrough mode only
+ effectsFactory = IEffectsFactory::getService("audio_effects_factory", true);
+ ASSERT_NE(effectsFactory, nullptr);
+ }
+
+ virtual void TearDown() override {}
+
+ sp<IEffectsFactory> effectsFactory;
+};
+
+// A class for test environment setup (kept since this file is a template).
+class AudioEffectHidlEnvironment : public ::testing::Environment {
+ public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+ private:
+};
+
+TEST_F(AudioEffectHidlTest, EnumerateEffects) {
+ Result retval = Result::NOT_INITIALIZED;
+ size_t effectCount = 0;
+ Return<void> ret = effectsFactory->getAllDescriptors(
+ [&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ retval = r;
+ effectCount = result.size();
+ });
+ EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+ EXPECT_EQ(retval, Result::OK);
+ EXPECT_GT(effectCount, 0u);
+}
+
+TEST_F(AudioEffectHidlTest, CreateEffect) {
+ bool gotEffect = false;
+ Uuid effectUuid;
+ Return<void> ret = effectsFactory->getAllDescriptors(
+ [&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ if (r == Result::OK && result.size() > 0) {
+ gotEffect = true;
+ effectUuid = result[0].uuid;
+ }
+ });
+ ASSERT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+ ASSERT_TRUE(gotEffect);
+ Result retval = Result::NOT_INITIALIZED;
+ sp<IEffect> effect;
+ ret = effectsFactory->createEffect(
+ effectUuid, 1 /* session */, 1 /* ioHandle */,
+ [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
+ retval = r;
+ if (r == Result::OK) {
+ effect = result;
+ }
+ });
+ EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+ EXPECT_EQ(retval, Result::OK);
+ EXPECT_NE(effect, nullptr);
+}
+
+// See b/32834072 -- we should have those operator== generated by hidl-gen.
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace common {
+namespace V2_0 {
+
+static bool operator==(const Uuid& lhs, const Uuid& rhs) {
+ return lhs.timeLow == rhs.timeLow && lhs.timeMid == rhs.timeMid &&
+ lhs.versionAndTimeHigh == rhs.versionAndTimeHigh &&
+ lhs.variantAndClockSeqHigh == rhs.variantAndClockSeqHigh &&
+ memcmp(lhs.node.data(), rhs.node.data(), lhs.node.size()) == 0;
+}
+
+} // namespace V2_0
+} // namespace common
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace V2_0 {
+
+static bool operator==(const EffectDescriptor& lhs,
+ const EffectDescriptor& rhs) {
+ return lhs.type == rhs.type && lhs.uuid == rhs.uuid &&
+ lhs.flags == rhs.flags && lhs.cpuLoad == rhs.cpuLoad &&
+ lhs.memoryUsage == rhs.memoryUsage &&
+ memcmp(lhs.name.data(), rhs.name.data(), lhs.name.size()) == 0 &&
+ memcmp(lhs.implementor.data(), rhs.implementor.data(),
+ lhs.implementor.size()) == 0;
+}
+
+} // namespace V2_0
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+TEST_F(AudioEffectHidlTest, GetDescriptor) {
+ hidl_vec<EffectDescriptor> allDescriptors;
+ Return<void> ret = effectsFactory->getAllDescriptors(
+ [&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ if (r == Result::OK) {
+ allDescriptors = result;
+ }
+ });
+ ASSERT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+ ASSERT_GT(allDescriptors.size(), 0u);
+ for (size_t i = 0; i < allDescriptors.size(); ++i) {
+ ret = effectsFactory->getDescriptor(
+ allDescriptors[i].uuid, [&](Result r, const EffectDescriptor& result) {
+ EXPECT_EQ(r, Result::OK);
+ EXPECT_EQ(result, allDescriptors[i]);
+ });
+ }
+ EXPECT_EQ(ret.getStatus().exceptionCode(), Status::EX_NONE);
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(new AudioEffectHidlEnvironment);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/benchmarks/msgq/1.0/Android.bp b/benchmarks/msgq/1.0/Android.bp
index 5fe6203..a527b32 100644
--- a/benchmarks/msgq/1.0/Android.bp
+++ b/benchmarks/msgq/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.benchmarks.msgq@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.benchmarks.msgq@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.benchmarks.msgq@1.0",
srcs: [
"IBenchmarkMsgQ.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.benchmarks.msgq@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.benchmarks.msgq@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.benchmarks.msgq@1.0",
srcs: [
"IBenchmarkMsgQ.hal",
],
diff --git a/biometrics/fingerprint/2.1/Android.bp b/biometrics/fingerprint/2.1/Android.bp
index 5ade9f3..9d2af44 100644
--- a/biometrics/fingerprint/2.1/Android.bp
+++ b/biometrics/fingerprint/2.1/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.biometrics.fingerprint@2.1_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.biometrics.fingerprint@2.1",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.biometrics.fingerprint@2.1",
srcs: [
"types.hal",
"IBiometricsFingerprint.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.biometrics.fingerprint@2.1_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.biometrics.fingerprint@2.1",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.biometrics.fingerprint@2.1",
srcs: [
"types.hal",
"IBiometricsFingerprint.hal",
diff --git a/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal b/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
index 7494c58..b7f8d88 100644
--- a/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
+++ b/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
@@ -16,8 +16,24 @@
package android.hardware.biometrics.fingerprint@2.1;
+import IBiometricsFingerprintClientCallback;
+
interface IBiometricsFingerprint {
/*
+ * Set notification callback:
+ * Registers a user function that must receive notifications from the HAL
+ * This call must block if the HAL state machine is in busy state until HAL
+ * leaves the busy state.
+ *
+ * @return isOk indicates if the request is accepted.
+ * @return debugErrno is a value the framework logs in case isOk == false.
+ */
+ @callflow(next={"setActiveGroup"})
+ @entry
+ setNotify(IBiometricsFingerprintClientCallback clientCallback)
+ generates (bool isOk, int32_t debugErrno);
+
+ /*
* Fingerprint pre-enroll enroll request:
* Generates a unique token to upper layers to indicate the start of
* an enrollment transaction. pre-enroll and post-enroll specify
@@ -138,7 +154,6 @@
* @return debugErrno is a value the framework logs in case isOk == false.
*/
@callflow(next={"authenticate", "preEnroll", "enumerate", "remove"})
- @entry
setActiveGroup(uint32_t gid, string storePath)
generates (bool isOk, int32_t debugErrno);
diff --git a/biometrics/fingerprint/2.1/default/Android.mk b/biometrics/fingerprint/2.1/default/Android.mk
new file mode 100644
index 0000000..be8bae6
--- /dev/null
+++ b/biometrics/fingerprint/2.1/default/Android.mk
@@ -0,0 +1,17 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.biometrics.fingerprint@2.1-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ BiometricsFingerprint.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidl \
+ libhardware \
+ libhwbinder \
+ libutils \
+ android.hardware.biometrics.fingerprint@2.1 \
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
new file mode 100644
index 0000000..3ee7836
--- /dev/null
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include <hardware/hardware.h>
+#include <hardware/fingerprint.h>
+#include "BiometricsFingerprint.h"
+
+namespace android {
+namespace hardware {
+namespace biometrics {
+namespace fingerprint {
+namespace V2_1 {
+namespace implementation {
+
+sp<IBiometricsFingerprintClientCallback>
+ BiometricsFingerprint::mClientCallback = nullptr;
+
+BiometricsFingerprint::BiometricsFingerprint(fingerprint_device_t *device)
+ : mDevice(device) {}
+
+BiometricsFingerprint::~BiometricsFingerprint() {
+ ALOG(LOG_VERBOSE, LOG_TAG, "nativeCloseHal()\n");
+ if (mDevice == NULL) {
+ ALOGE("No valid device");
+ return;
+ }
+ int err;
+ if (0 != (err = mDevice->common.close(
+ reinterpret_cast<hw_device_t*>(mDevice)))) {
+ ALOGE("Can't close fingerprint module, error: %d", err);
+ return;
+ }
+ mDevice = NULL;
+}
+
+Return<void> BiometricsFingerprint::setNotify(
+ const sp<IBiometricsFingerprintClientCallback>& clientCallback,
+ setNotify_cb cb) {
+ mClientCallback = clientCallback;
+ int32_t debugErrno = mDevice->set_notify(mDevice, notify);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<uint64_t> BiometricsFingerprint::preEnroll() {
+ return mDevice->pre_enroll(mDevice);
+}
+
+Return<void> BiometricsFingerprint::enroll(const HwAuthToken& hat, uint32_t gid,
+ uint32_t timeoutSec, enroll_cb cb) {
+ const hw_auth_token_t* authToken =
+ reinterpret_cast<const hw_auth_token_t*>(&hat);
+ int32_t debugErrno = mDevice->enroll(mDevice, authToken, gid, timeoutSec);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<void> BiometricsFingerprint::postEnroll(postEnroll_cb cb) {
+ int32_t debugErrno = mDevice->post_enroll(mDevice);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
+ return mDevice->get_authenticator_id(mDevice);
+}
+
+Return<void> BiometricsFingerprint::cancel(cancel_cb cb) {
+ int32_t debugErrno = mDevice->cancel(mDevice);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<void> BiometricsFingerprint::enumerate(enumerate_cb cb) {
+ int32_t debugErrno = mDevice->enumerate(mDevice);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<void> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid,
+ remove_cb cb) {
+ int32_t debugErrno = mDevice->remove(mDevice, gid, fid);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<void> BiometricsFingerprint::setActiveGroup(uint32_t gid,
+ const hidl_string& storePath, setActiveGroup_cb cb) {
+ if (storePath.size() >= PATH_MAX || storePath.size() <= 0) {
+ ALOGE("Bad path length: %zd", storePath.size());
+ }
+ int32_t debugErrno = mDevice->set_active_group(mDevice, gid,
+ storePath.c_str());
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+Return<void> BiometricsFingerprint::authenticate(uint64_t operationId,
+ uint32_t gid, authenticate_cb cb) {
+ int32_t debugErrno = mDevice->authenticate(mDevice, operationId, gid);
+ cb(debugErrno == 0, debugErrno);
+ return Void();
+}
+
+IBiometricsFingerprint* HIDL_FETCH_IBiometricsFingerprint(const char*) {
+ int err;
+ const hw_module_t *hw_mdl = NULL;
+ if (0 != (err = hw_get_module(FINGERPRINT_HARDWARE_MODULE_ID, &hw_mdl))) {
+ ALOGE("Can't open fingerprint HW Module, error: %d", err);
+ return nullptr;
+ }
+ if (hw_mdl == NULL) {
+ ALOGE("No valid fingerprint module");
+ return nullptr;
+ }
+
+ fingerprint_module_t const *module =
+ reinterpret_cast<const fingerprint_module_t*>(hw_mdl);
+ if (module->common.methods->open == NULL) {
+ ALOGE("No valid open method");
+ return nullptr;
+ }
+
+ hw_device_t *device = NULL;
+
+ if (0 != (err = module->common.methods->open(hw_mdl, NULL, &device))) {
+ ALOGE("Can't open fingerprint methods, error: %d", err);
+ return nullptr;
+ }
+
+ return new BiometricsFingerprint(
+ reinterpret_cast<fingerprint_device_t*>(device));
+}
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace fingerprint
+} // namespace biometrics
+} // namespace hardware
+} // namespace android
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h
new file mode 100644
index 0000000..4fdc328
--- /dev/null
+++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_biometrics_fingerprint_V2_1_BiometricsFingerprint_H_
+#define HIDL_GENERATED_android_hardware_biometrics_fingerprint_V2_1_BiometricsFingerprint_H_
+
+#include <utils/Log.h>
+#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace biometrics {
+namespace fingerprint {
+namespace V2_1 {
+namespace implementation {
+
+using ::android::hardware::biometrics::fingerprint::V2_1::HwAuthToken;
+using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
+using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct BiometricsFingerprint : public IBiometricsFingerprint {
+public:
+ BiometricsFingerprint(fingerprint_device_t *device);
+ ~BiometricsFingerprint();
+ // Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow.
+ Return<void> setNotify(const sp<IBiometricsFingerprintClientCallback>& clientCallback, setNotify_cb _hidl_cb) override;
+ Return<uint64_t> preEnroll() override;
+ Return<void> enroll(const HwAuthToken& hat, uint32_t gid, uint32_t timeoutSec, enroll_cb _hidl_cb) override;
+ Return<void> postEnroll(postEnroll_cb _hidl_cb) override;
+ Return<uint64_t> getAuthenticatorId() override;
+ Return<void> cancel(cancel_cb _hidl_cb) override;
+ Return<void> enumerate(enumerate_cb _hidl_cb) override;
+ Return<void> remove(uint32_t gid, uint32_t fid, remove_cb _hidl_cb) override;
+ Return<void> setActiveGroup(uint32_t gid, const hidl_string& storePath, setActiveGroup_cb _hidl_cb) override;
+ Return<void> authenticate(uint64_t operationId, uint32_t gid, authenticate_cb _hidl_cb) override;
+ static void notify(const fingerprint_msg_t *notify_msg) {
+ if (mClientCallback == nullptr) {
+ ALOGE("Receiving callbacks before the client callback is registered.");
+ return;
+ }
+ FingerprintMsg msg = {};
+ memcpy(&msg, notify_msg, sizeof(msg));
+ mClientCallback->notify(msg);
+ }
+private:
+ static sp<IBiometricsFingerprintClientCallback> mClientCallback;
+ fingerprint_device_t *mDevice;
+};
+
+extern "C" IBiometricsFingerprint* HIDL_FETCH_IBiometricsFingerprint(const char* name);
+
+} // namespace implementation
+} // namespace V2_1
+} // namespace fingerprint
+} // namespace biometrics
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_biometrics_fingerprint_V2_1_BiometricsFingerprint_H_
diff --git a/biometrics/fingerprint/2.1/default/android.hardware.biometrics.fingerprint@2.1-service.rc b/biometrics/fingerprint/2.1/default/android.hardware.biometrics.fingerprint@2.1-service.rc
new file mode 100644
index 0000000..741024d
--- /dev/null
+++ b/biometrics/fingerprint/2.1/default/android.hardware.biometrics.fingerprint@2.1-service.rc
@@ -0,0 +1,4 @@
+service fingerprint@2.1 /system/bin/hw/android.hardware.biometrics.fingerprint@2.1-service
+ class hal
+ user system
+ group system
\ No newline at end of file
diff --git a/biometrics/fingerprint/2.1/default/service.cpp b/biometrics/fingerprint/2.1/default/service.cpp
new file mode 100644
index 0000000..9867039
--- /dev/null
+++ b/biometrics/fingerprint/2.1/default/service.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service"
+
+#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
+
+#include <hidl/LegacySupport.h>
+
+using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+ return defaultPassthroughServiceImplementation<IBiometricsFingerprint>("fingerprint");
+}
diff --git a/bluetooth/1.0/Android.bp b/bluetooth/1.0/Android.bp
index ab0b1a9..d8f3ca5 100644
--- a/bluetooth/1.0/Android.bp
+++ b/bluetooth/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.bluetooth@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
srcs: [
"types.hal",
"IBluetoothHci.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.bluetooth@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.bluetooth@1.0",
srcs: [
"types.hal",
"IBluetoothHci.hal",
diff --git a/boot/1.0/Android.bp b/boot/1.0/Android.bp
index 6c959d9..cad7497 100644
--- a/boot/1.0/Android.bp
+++ b/boot/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.boot@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
srcs: [
"types.hal",
"IBootControl.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.boot@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.boot@1.0",
srcs: [
"types.hal",
"IBootControl.hal",
diff --git a/boot/1.0/default/android.hardware.boot@1.0-service.rc b/boot/1.0/default/android.hardware.boot@1.0-service.rc
index 57c1aff..67d400b 100644
--- a/boot/1.0/default/android.hardware.boot@1.0-service.rc
+++ b/boot/1.0/default/android.hardware.boot@1.0-service.rc
@@ -1,4 +1,4 @@
service boot-hal-1-0 /system/bin/hw/android.hardware.boot@1.0-service
class hal
- user system
- group system readproc
+ user root
+ group root
diff --git a/boot/1.0/vts/Android.mk b/boot/1.0/vts/Android.mk
new file mode 100644
index 0000000..16b92c1
--- /dev/null
+++ b/boot/1.0/vts/Android.mk
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build VTS driver for Boot Control v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_boot@1.0
+
+LOCAL_SRC_FILES := \
+ BootControl.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES := \
+ android.hardware.boot@1.0\
+ system/core/base/include \
+ system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+ android.hardware.boot@1.0 \
+ libbase \
+ libutils \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_datatype \
+ libvts_measurement \
+ libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
+
+# build profiler for boot.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_boot@1.0
+
+LOCAL_SRC_FILES := \
+ BootControl.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.boot@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/boot/1.0/vts/BootControl.vts b/boot/1.0/vts/BootControl.vts
new file mode 100644
index 0000000..384ae50
--- /dev/null
+++ b/boot/1.0/vts/BootControl.vts
@@ -0,0 +1,93 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IBootControl"
+
+package: "android.hardware.boot"
+
+import: "android.hardware.boot@1.0::types"
+
+interface: {
+ api: {
+ name: "getNumberSlots"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "getCurrentSlot"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "markBootSuccessful"
+ return_type_hidl: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::boot::V1_0::CommandResult"
+ }
+ }
+
+ api: {
+ name: "setActiveBootSlot"
+ return_type_hidl: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::boot::V1_0::CommandResult"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "setSlotAsUnbootable"
+ return_type_hidl: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::boot::V1_0::CommandResult"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "isSlotBootable"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::boot::V1_0::BoolResult"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "isSlotMarkedSuccessful"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::boot::V1_0::BoolResult"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+ api: {
+ name: "getSuffix"
+ return_type_hidl: {
+ type: TYPE_STRING
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+ }
+
+}
diff --git a/boot/1.0/vts/types.vts b/boot/1.0/vts/types.vts
new file mode 100644
index 0000000..ebeaa60
--- /dev/null
+++ b/boot/1.0/vts/types.vts
@@ -0,0 +1,42 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.boot"
+
+
+attribute: {
+ name: "::android::hardware::boot::V1_0::CommandResult"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "success"
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+ struct_value: {
+ name: "errMsg"
+ type: TYPE_STRING
+ }
+}
+
+attribute: {
+ name: "::android::hardware::boot::V1_0::BoolResult"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "int32_t"
+
+ enumerator: "FALSE"
+ scalar_value: {
+ int32_t: 0
+ }
+ enumerator: "TRUE"
+ scalar_value: {
+ int32_t: 1
+ }
+ enumerator: "INVALID_SLOT"
+ scalar_value: {
+ int32_t: -1
+ }
+ }
+}
+
diff --git a/broadcastradio/1.0/Android.bp b/broadcastradio/1.0/Android.bp
index 75736d1..c337e08 100644
--- a/broadcastradio/1.0/Android.bp
+++ b/broadcastradio/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.broadcastradio@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
srcs: [
"types.hal",
"IBroadcastRadio.hal",
@@ -22,8 +22,8 @@
genrule {
name: "android.hardware.broadcastradio@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
srcs: [
"types.hal",
"IBroadcastRadio.hal",
diff --git a/contexthub/1.0/Android.bp b/contexthub/1.0/Android.bp
new file mode 100644
index 0000000..23c44de
--- /dev/null
+++ b/contexthub/1.0/Android.bp
@@ -0,0 +1,59 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.contexthub@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.contexthub@1.0",
+ srcs: [
+ "types.hal",
+ "IContexthub.hal",
+ "IContexthubCallback.hal",
+ ],
+ out: [
+ "android/hardware/contexthub/1.0/types.cpp",
+ "android/hardware/contexthub/1.0/ContexthubAll.cpp",
+ "android/hardware/contexthub/1.0/ContexthubCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.contexthub@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.contexthub@1.0",
+ srcs: [
+ "types.hal",
+ "IContexthub.hal",
+ "IContexthubCallback.hal",
+ ],
+ out: [
+ "android/hardware/contexthub/1.0/types.h",
+ "android/hardware/contexthub/1.0/IContexthub.h",
+ "android/hardware/contexthub/1.0/IHwContexthub.h",
+ "android/hardware/contexthub/1.0/BnContexthub.h",
+ "android/hardware/contexthub/1.0/BpContexthub.h",
+ "android/hardware/contexthub/1.0/BsContexthub.h",
+ "android/hardware/contexthub/1.0/IContexthubCallback.h",
+ "android/hardware/contexthub/1.0/IHwContexthubCallback.h",
+ "android/hardware/contexthub/1.0/BnContexthubCallback.h",
+ "android/hardware/contexthub/1.0/BpContexthubCallback.h",
+ "android/hardware/contexthub/1.0/BsContexthubCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.contexthub@1.0",
+ generated_sources: ["android.hardware.contexthub@1.0_genc++"],
+ generated_headers: ["android.hardware.contexthub@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.contexthub@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/contexthub/1.0/Android.mk b/contexthub/1.0/Android.mk
new file mode 100644
index 0000000..72291e6
--- /dev/null
+++ b/contexthub/1.0/Android.mk
@@ -0,0 +1,552 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.contexthub@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (AsyncEventType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/AsyncEventType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.AsyncEventType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ContextHub)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/ContextHub.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.ContextHub
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ContextHubMsg)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/ContextHubMsg.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.ContextHubMsg
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubAppInfo)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubAppInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubAppInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubMemoryFlag)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubMemoryFlag.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubMemoryFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubMemoryType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubMemoryType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubMemoryType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemRange)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/MemRange.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.MemRange
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanoAppBinary)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/NanoAppBinary.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.NanoAppBinary
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanoAppFlags)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/NanoAppFlags.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.NanoAppFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PhysicalSensor)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/PhysicalSensor.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.PhysicalSensor
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Result)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/Result.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.Result
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SensorType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/SensorType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.SensorType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (TransactionResult)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/TransactionResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.TransactionResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IContexthub.hal
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/IContexthub.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IContexthub.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::IContexthub
+
+$(GEN): $(LOCAL_PATH)/IContexthub.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IContexthubCallback.hal
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/IContexthubCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::IContexthubCallback
+
+$(GEN): $(LOCAL_PATH)/IContexthubCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.contexthub@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (AsyncEventType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/AsyncEventType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.AsyncEventType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ContextHub)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/ContextHub.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.ContextHub
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ContextHubMsg)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/ContextHubMsg.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.ContextHubMsg
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubAppInfo)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubAppInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubAppInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubMemoryFlag)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubMemoryFlag.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubMemoryFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HubMemoryType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/HubMemoryType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.HubMemoryType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemRange)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/MemRange.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.MemRange
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanoAppBinary)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/NanoAppBinary.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.NanoAppBinary
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanoAppFlags)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/NanoAppFlags.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.NanoAppFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PhysicalSensor)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/PhysicalSensor.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.PhysicalSensor
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Result)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/Result.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.Result
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SensorType)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/SensorType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.SensorType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (TransactionResult)
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/TransactionResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::types.TransactionResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IContexthub.hal
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/IContexthub.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IContexthub.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::IContexthub
+
+$(GEN): $(LOCAL_PATH)/IContexthub.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IContexthubCallback.hal
+#
+GEN := $(intermediates)/android/hardware/contexthub/1.0/IContexthubCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IContexthubCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.contexthub@1.0::IContexthubCallback
+
+$(GEN): $(LOCAL_PATH)/IContexthubCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/contexthub/1.0/IContexthub.hal b/contexthub/1.0/IContexthub.hal
new file mode 100644
index 0000000..8d19aeb
--- /dev/null
+++ b/contexthub/1.0/IContexthub.hal
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2016 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.contexthub@1.0;
+
+import IContexthubCallback;
+
+interface IContexthub {
+ /*
+ * Enumerate all available context hubs on the system.
+ *
+ * @return hubs list of hubs on this system.
+ */
+ getHubs() generates (vec<ContextHub> hubs);
+
+ /*
+ * Register a callback for the HAL implementation to send asynchronous
+ * messages to the service from a context hub. There can be a maximum of
+ * one callback registered with the HAL. A call to this function when a
+ * callback has already been registered must override the previous
+ * registration.
+ *
+ * @param hubId identifier for the hub
+ * callback an implementation of the IContextHubCallbacks
+ *
+ * @return result OK on success
+ * BAD_VALUE if parameters are not sane
+ *
+ */
+ registerCallback(uint32_t hubId, IContexthubCallback cb) generates (Result result);
+
+ /**
+ * Send a message to a hub
+ *
+ * @param hubId identifier for hub to send message to
+ * msg message to be sent
+ *
+ * @return result OK if successful, error code otherwise
+ * BAD_VALUE if parameters are not sane
+ * TRANSACTION_FAILED if message send failed
+ */
+ sendMessageToHub(uint32_t hubId, ContextHubMsg msg)
+ generates (Result result);
+
+ /**
+ * Loads a nanoApp. After loading, the nanoApp's init method must be called.
+ * After the init method for nanoApp returns success, this must be indicated
+ * to the service by an asynchronous call to handleTxnResult.
+ *
+ * @param hubId identifer of the contextHub
+ * appBinary binary for the nanoApp
+ * msg message to be sent
+ *
+ * @return result OK if transation started
+ * BAD_VALUE if parameters are not sane
+ * TRANSACTION_PENDING if hub is busy with another
+ * load/unload transaction
+ * TRANSACTION_FAILED if load failed synchronously
+ *
+ */
+ loadNanoApp(uint32_t hubId, NanoAppBinary appBinary, uint32_t transactionId)
+ generates (Result result);
+
+ /**
+ * Unloads a nanoApp. Before the unload, the apps deinit method is called.
+ * After this, success must be indicated to the service through an
+ * asynchronous call to handleTxnResult.
+ *
+ * @param hubId identifer of the contextHub
+ * appId appIdentifier returned by the HAL
+ * msg message to be sent
+ *
+ * @return result OK if transation started
+ * BAD_VALUE if parameters are not sane
+ * TRANSACTION_PENDING if hub is busy with another
+ * load/unload transaction
+ * TRANSACTION_FAILED if unload failed synchronously
+ *
+ */
+ unloadNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId)
+ generates (Result result);
+
+ /**
+ * Enables a nanoApp. The app's init method is called.
+ * After this, success must be indicated to the service through an
+ * asynchronous message.
+ *
+ * @param hubId identifer of the contextHub
+ * appId appIdentifier returned by the HAL
+ * msg message to be sent
+ *
+ * @return result OK if transation started
+ * BAD_VALUE if parameters are not sane
+ * TRANSACTION_PENDING if hub is busy with another
+ * load/unload transaction
+ * FAILED_TRANSACTION if load fails immediately
+ *
+ */
+ enableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId)
+ generates (Result result);
+
+ /**
+ * Disables a nanoApp. The app's deinit method is called.
+ * After this, success must be indicated to the service through an
+ * asynchronous message.
+ *
+ * @param hubId identifer of the contextHub
+ * appId appIdentifier returned by the HAL
+ * msg message to be sent
+ *
+ * @return result OK if transation started
+ * BAD_VALUE if parameters are not sane
+ * TRANSACTION_PENDING if hub is busy with another
+ * load/unload transaction
+ * FAILED_TRANSACTION if load fails immediately
+ *
+ */
+ disableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId)
+ generates (Result result);
+
+ /**
+ * Queries for Loaded apps on the hub
+ *
+ * @param hubId identifer of the contextHub
+ *
+ * @return apps all nanoApps on the hub
+ *
+ */
+ queryApps(uint32_t hubId) generates (Result result);
+
+ /**
+ * Reboots context hub OS, restarts all the nanoApps.
+ * No reboot notification is sent to nanoApps; reboot happens immediately
+ * and unconditionally; all volatile contexthub state and any data is lost
+ * as a result.
+ *
+ * @param hubId identifer of the contextHub
+ *
+ * @return result OK on success
+ * BAD_VALUE if parameters are not sane
+ *
+ */
+ reboot(uint32_t hubId) generates (Result result);
+};
diff --git a/contexthub/1.0/IContexthubCallback.hal b/contexthub/1.0/IContexthubCallback.hal
new file mode 100644
index 0000000..29c41ce
--- /dev/null
+++ b/contexthub/1.0/IContexthubCallback.hal
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 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.contexthub@1.0;
+
+interface IContexthubCallback {
+ /*
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send asynchronous messages back
+ * to the service and registered clients of the ContextHub service.
+ *
+ * @params hubId : identifier of the hub calling callback
+ * msg : message
+ *
+ */
+ handleClientMsg(uint32_t hubId, ContextHubMsg msg);
+
+ /*
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send the response for a
+ * transaction.
+ *
+ * @params hubId : identifier of the hub calling callback
+ * txnId : transaction id whose result is being sent
+ * passed in by the service at start of transacation.
+ * result: result of transaction.
+ *
+ */
+ handleTxnResult(uint32_t hubId, uint32_t txnId,
+ TransactionResult result);
+
+ /*
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send an asynchronous event
+ * to the ContextHub service.
+ *
+ * @params hubId : identifier of the hub calling callback
+ * msg : message
+ *
+ */
+ handleHubEvent(uint32_t hubId, AsyncEventType evt);
+
+ /*
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send information about the
+ * currently loaded and active nanoapps on the hub.
+ */
+ handleAppsInfo(uint32_t hubId, vec<HubAppInfo> appInfo);
+};
diff --git a/contexthub/1.0/types.hal b/contexthub/1.0/types.hal
new file mode 100644
index 0000000..7d5a1ac
--- /dev/null
+++ b/contexthub/1.0/types.hal
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2016 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.contexthub@1.0;
+
+enum Result : uint32_t {
+ OK, // Success
+ BAD_PARAMS, // Parameters not sane
+ NOT_INIT, // not initialized
+ TRANSACTION_FAILED, // transaction failed
+ TRANSACTION_PENDING, // Pending transaction, cannot accept a new request
+};
+
+
+enum NanoAppFlags : uint32_t {
+ SIGNED = (1<<0), // Signed nanoapp
+ ENCRYPTED = (1<<1),// Encrypted nanoapp
+};
+
+struct NanoAppBinary {
+ uint32_t headerVersion; // 0x1 for this version
+ uint32_t magic; // "NANO"
+ uint64_t appId; // App Id contains vendor id
+ uint32_t appVersion; // Version of the app
+ uint32_t flags; // mask of NanoAppFlags
+ uint64_t hwHubType; // which hub type is this compiled for
+ // a unique UUID for each h/w + toolchain
+ // combination.
+ vec<uint8_t> customBinary; // start of custom binary data
+};
+
+enum SensorType : uint32_t {
+ RESERVED,
+ ACCELEROMETER,
+ GYROSCOPE,
+ MAGNETOMETER,
+ BAROMETER,
+ PROXIMITY_SENSOR,
+ AMBIENT_LIGHT_SENSOR,
+
+ GPS = 0x100,
+ // Reserving this space for variants on GPS
+
+ WIFI = 0x200,
+ // Reserving this space for variants on WIFI
+
+ AUDIO = 0x300,
+ // Reserving this space for variants on Audio
+
+ CAMERA = 0x400,
+ // Reserving this space for variants on Camera
+
+ BLE = 0x500,
+
+ PRIVATE_SENSOR_BASE = 0x10000,
+ // Sensor types beyond PRIVATE_SENSOR_BASE are custom types
+};
+
+struct PhysicalSensor{
+ SensorType sensorType; // From the definitions above eg: 100
+ string type; // Type as a string. eg: "GPS"
+ string name; // Identifier eg: "Bosch BMI160"
+ string vendor; // Vendor : eg "STM"
+ uint32_t version; // Version : eg 0x1001
+ uint32_t fifoReservedCount; // Batching possible in hardware. Please
+ // note that here hardware does not include
+ // the context hub itself. Thus, this
+ // definition may be different from say the
+ // number advertised in the sensors HAL
+ // which allows for batching in a hub.
+ uint32_t fifoMaxCount; // maximum number of batchable events.
+ uint64_t minDelayMs; // in milliseconds, corresponding to highest
+ // sampling freq.
+ uint64_t maxDelayMs; // in milliseconds, corresponds to minimum
+ // sampling frequency
+ float peakPowerMw; // At max frequency & no batching, power
+ // in milliwatts
+};
+
+struct ContextHub {
+ string name; // descriptive name eg: "Awesome Hub #1"
+ string vendor; // hub hardware vendor eg: "Qualcomm"
+ string toolchain; // toolchain to make binaries eg: "gcc ARM"
+ uint32_t platformVersion; // Version of the hardware : eg 0x20
+ uint32_t toolchainVersion; // Version of the toolchain : eg: 0x484
+ uint32_t hubId; // a device unique id for this hub
+
+ float peakMips; // Peak MIPS platform can deliver
+ float stoppedPowerDrawMw; // if stopped, retention power, milliwatts
+ float sleepPowerDrawMw; // if sleeping, retention power, milliwatts
+ float peakPowerDrawMw; // for a busy CPUm power in milliwatts
+
+ vec<PhysicalSensor> connectedSensors; // array of connected sensors
+
+ uint32_t maxSupportedMsgLen;// This is the maximum size of the message that can
+ // be sent to the hub in one chunk (in bytes)
+};
+
+struct ContextHubMsg {
+ uint64_t appName; // intended recipient
+ uint32_t msgType; // identifier for message
+ vec<uint8_t> msg; // message body
+};
+
+enum HubMemoryType : uint32_t {
+ MAIN = 0, // Main memory
+ SECONDARY = 1, // Secondary memory
+ TCM = 2, // Tightly coupled memory
+};
+
+enum HubMemoryFlag : uint32_t {
+ READ = (1<<0), // Readable
+ WRITE = (1<<1), // Writable
+ EXEC = (1<<2), // Executable
+};
+
+struct MemRange {
+ uint32_t totalBytes; // total capacity in bytes
+ uint32_t freeBytes; // free capacity in bytes
+ HubMemoryType type; // type of memory, see HubMemoryType
+ uint32_t flags; // mask of HubMemoryFlag
+};
+
+enum AsyncEventType : uint32_t {
+ RESTARTED = 1, // Hub restarted unexpectedly
+};
+
+enum TransactionResult {
+ SUCCESS, // successful completion of transaction
+ FAILURE, // failed transaction
+};
+
+struct HubAppInfo {
+ uint64_t appId; // Identifier of the app
+ uint32_t version; // version of the app
+ vec<MemRange> memUsage; // Memory used by this app
+};
+
diff --git a/contexthub/Android.bp b/contexthub/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/contexthub/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+ "1.0",
+]
diff --git a/example/extension/light/2.0/Android.bp b/example/extension/light/2.0/Android.bp
index 5d58512..2a4eddf 100644
--- a/example/extension/light/2.0/Android.bp
+++ b/example/extension/light/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.example.extension.light@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
srcs: [
"types.hal",
"IExtLight.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.example.extension.light@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.example.extension.light@2.0",
srcs: [
"types.hal",
"IExtLight.hal",
@@ -48,5 +48,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.light@2.0",
],
}
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
index 9b9abe3..1f538ca 100644
--- a/gnss/1.0/Android.bp
+++ b/gnss/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.gnss@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
srcs: [
"types.hal",
"IAGnss.hal",
@@ -48,8 +48,8 @@
genrule {
name: "android.hardware.gnss@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
srcs: [
"types.hal",
"IAGnss.hal",
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index 0d800be..004d7d2 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.graphics.allocator@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
srcs: [
"types.hal",
"IAllocator.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.graphics.allocator@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
srcs: [
"types.hal",
"IAllocator.hal",
diff --git a/graphics/allocator/2.0/IAllocator.hal b/graphics/allocator/2.0/IAllocator.hal
index 8accb82..ff08a7e 100644
--- a/graphics/allocator/2.0/IAllocator.hal
+++ b/graphics/allocator/2.0/IAllocator.hal
@@ -26,11 +26,16 @@
* is supported.
*/
TEST_ALLOCATE = 1,
+
+ /*
+ * layerCount must be 1 unless this capability is supported.
+ */
+ LAYERED_BUFFERS = 2,
};
struct BufferDescriptorInfo {
/*
- * The width specifies how many columns of pixels should be in the
+ * The width specifies how many columns of pixels must be in the
* allocated buffer, but does not necessarily represent the offset in
* columns between the same column in adjacent rows. The rows may be
* padded.
@@ -38,11 +43,16 @@
uint32_t width;
/*
- * The height specifies how many rows of pixels should be in the
+ * The height specifies how many rows of pixels must be in the
* allocated buffer.
*/
uint32_t height;
+ /*
+ * The number of image layers that must be in the allocated buffer.
+ */
+ uint32_t layerCount;
+
/* Buffer pixel format. */
PixelFormat format;
diff --git a/graphics/allocator/2.0/default/Gralloc.cpp b/graphics/allocator/2.0/default/Gralloc.cpp
index a7fc6c1..8a74661 100644
--- a/graphics/allocator/2.0/default/Gralloc.cpp
+++ b/graphics/allocator/2.0/default/Gralloc.cpp
@@ -74,6 +74,7 @@
GRALLOC1_PFN_DESTROY_DESCRIPTOR destroyDescriptor;
GRALLOC1_PFN_SET_DIMENSIONS setDimensions;
GRALLOC1_PFN_SET_FORMAT setFormat;
+ GRALLOC1_PFN_SET_LAYER_COUNT setLayerCount;
GRALLOC1_PFN_SET_CONSUMER_USAGE setConsumerUsage;
GRALLOC1_PFN_SET_PRODUCER_USAGE setProducerUsage;
GRALLOC1_PFN_ALLOCATE allocate;
@@ -135,6 +136,10 @@
GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR);
initDispatch(mDispatch.setDimensions, GRALLOC1_FUNCTION_SET_DIMENSIONS);
initDispatch(mDispatch.setFormat, GRALLOC1_FUNCTION_SET_FORMAT);
+ if (hasCapability(Capability::LAYERED_BUFFERS)) {
+ initDispatch(
+ mDispatch.setLayerCount, GRALLOC1_FUNCTION_SET_LAYER_COUNT);
+ }
initDispatch(mDispatch.setConsumerUsage,
GRALLOC1_FUNCTION_SET_CONSUMER_USAGE);
initDispatch(mDispatch.setProducerUsage,
@@ -191,6 +196,11 @@
err = mDispatch.setFormat(mDevice, descriptor,
static_cast<int32_t>(descriptorInfo.format));
}
+ if (err == GRALLOC1_ERROR_NONE &&
+ hasCapability(Capability::LAYERED_BUFFERS)) {
+ err = mDispatch.setLayerCount(mDevice, descriptor,
+ descriptorInfo.layerCount);
+ }
if (err == GRALLOC1_ERROR_NONE) {
uint64_t producerUsageMask = descriptorInfo.producerUsageMask;
if (producerUsageMask & GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN) {
diff --git a/graphics/common/1.0/Android.bp b/graphics/common/1.0/Android.bp
index ba66f94..fa95ca0 100644
--- a/graphics/common/1.0/Android.bp
+++ b/graphics/common/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.graphics.common@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.common@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.common@1.0",
srcs: [
"types.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.graphics.common@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.common@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.common@1.0",
srcs: [
"types.hal",
],
diff --git a/graphics/common/1.0/Android.mk b/graphics/common/1.0/Android.mk
new file mode 100644
index 0000000..17b67b6
--- /dev/null
+++ b/graphics/common/1.0/Android.mk
@@ -0,0 +1,265 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.graphics.common@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (ColorMode)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/ColorMode.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.ColorMode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ColorTransform)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/ColorTransform.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.ColorTransform
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Dataspace)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Dataspace.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Dataspace
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Hdr)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Hdr.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Hdr
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PixelFormat)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/PixelFormat.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.PixelFormat
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Transform)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Transform.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Transform
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.graphics.common@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (ColorMode)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/ColorMode.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.ColorMode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (ColorTransform)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/ColorTransform.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.ColorTransform
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Dataspace)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Dataspace.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Dataspace
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Hdr)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Hdr.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Hdr
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PixelFormat)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/PixelFormat.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.PixelFormat
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Transform)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Transform.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0::types.Transform
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.graphics.common@1.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/graphics/common/1.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava-constants -randroid.hardware:hardware/interfaces \
+ android.hardware.graphics.common@1.0
+
+$(GEN):
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/graphics/composer/2.1/Android.bp b/graphics/composer/2.1/Android.bp
index bc948e8..fa58dbb 100644
--- a/graphics/composer/2.1/Android.bp
+++ b/graphics/composer/2.1/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.graphics.composer@2.1_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
srcs: [
"types.hal",
"IComposer.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.graphics.composer@2.1_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
srcs: [
"types.hal",
"IComposer.hal",
@@ -56,5 +56,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.graphics.allocator@2.0",
],
}
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
index 3718503..19b1388 100644
--- a/graphics/mapper/2.0/Android.bp
+++ b/graphics/mapper/2.0/Android.bp
@@ -1,15 +1,4 @@
-genrule {
- name: "android.hardware.graphics.mapper@2.0_genc++_headers",
- cmd: "cp $in $genDir/android/hardware/graphics/mapper/2.0",
- srcs: ["IMapper.h", "types.h"],
- out: [
- "android/hardware/graphics/mapper/2.0/IMapper.h",
- "android/hardware/graphics/mapper/2.0/types.h",
- ],
-}
-
cc_library_static {
name: "android.hardware.graphics.mapper@2.0",
- generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
- export_generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
+ export_include_dirs: ["include"],
}
diff --git a/graphics/mapper/2.0/default/GrallocMapper.cpp b/graphics/mapper/2.0/default/GrallocMapper.cpp
index eeca5c7..2af1d2c 100644
--- a/graphics/mapper/2.0/default/GrallocMapper.cpp
+++ b/graphics/mapper/2.0/default/GrallocMapper.cpp
@@ -15,10 +15,13 @@
#define LOG_TAG "GrallocMapperPassthrough"
+#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <hardware/gralloc1.h>
#include <log/log.h>
+#include <unordered_set>
+
namespace android {
namespace hardware {
namespace graphics {
@@ -26,6 +29,8 @@
namespace V2_0 {
namespace implementation {
+using Capability = allocator::V2_0::IAllocator::Capability;
+
class GrallocDevice : public Device {
public:
GrallocDevice();
@@ -38,6 +43,8 @@
uint32_t* outWidth, uint32_t* outHeight);
Error getFormat(const native_handle_t* bufferHandle,
PixelFormat* outFormat);
+ Error getLayerCount(const native_handle_t* bufferHandle,
+ uint32_t* outLayerCount);
Error getProducerUsageMask(const native_handle_t* bufferHandle,
uint64_t* outUsageMask);
Error getConsumerUsageMask(const native_handle_t* bufferHandle,
@@ -58,15 +65,21 @@
int32_t* outReleaseFence);
private:
+ void initCapabilities();
+
void initDispatch();
+ bool hasCapability(Capability capability) const;
gralloc1_device_t* mDevice;
+ std::unordered_set<Capability> mCapabilities;
+
struct {
GRALLOC1_PFN_RETAIN retain;
GRALLOC1_PFN_RELEASE release;
GRALLOC1_PFN_GET_DIMENSIONS getDimensions;
GRALLOC1_PFN_GET_FORMAT getFormat;
+ GRALLOC1_PFN_GET_LAYER_COUNT getLayerCount;
GRALLOC1_PFN_GET_PRODUCER_USAGE getProducerUsage;
GRALLOC1_PFN_GET_CONSUMER_USAGE getConsumerUsage;
GRALLOC1_PFN_GET_BACKING_STORE getBackingStore;
@@ -96,6 +109,7 @@
LOG_ALWAYS_FATAL("failed to open gralloc1 device");
}
+ initCapabilities();
initDispatch();
}
@@ -104,6 +118,19 @@
gralloc1_close(mDevice);
}
+void GrallocDevice::initCapabilities()
+{
+ uint32_t count;
+ mDevice->getCapabilities(mDevice, &count, nullptr);
+
+ std::vector<Capability> caps(count);
+ mDevice->getCapabilities(mDevice, &count, reinterpret_cast<
+ std::underlying_type<Capability>::type*>(caps.data()));
+ caps.resize(count);
+
+ mCapabilities.insert(caps.cbegin(), caps.cend());
+}
+
void GrallocDevice::initDispatch()
{
#define CHECK_FUNC(func, desc) do { \
@@ -118,6 +145,9 @@
CHECK_FUNC(release, GRALLOC1_FUNCTION_RELEASE);
CHECK_FUNC(getDimensions, GRALLOC1_FUNCTION_GET_DIMENSIONS);
CHECK_FUNC(getFormat, GRALLOC1_FUNCTION_GET_FORMAT);
+ if (hasCapability(Capability::LAYERED_BUFFERS)) {
+ CHECK_FUNC(getLayerCount, GRALLOC1_FUNCTION_GET_LAYER_COUNT);
+ }
CHECK_FUNC(getProducerUsage, GRALLOC1_FUNCTION_GET_PRODUCER_USAGE);
CHECK_FUNC(getConsumerUsage, GRALLOC1_FUNCTION_GET_CONSUMER_USAGE);
CHECK_FUNC(getBackingStore, GRALLOC1_FUNCTION_GET_BACKING_STORE);
@@ -130,6 +160,11 @@
#undef CHECK_FUNC
}
+bool GrallocDevice::hasCapability(Capability capability) const
+{
+ return (mCapabilities.count(capability) > 0);
+}
+
Error GrallocDevice::retain(const native_handle_t* bufferHandle)
{
int32_t error = mDispatch.retain(mDevice, bufferHandle);
@@ -158,6 +193,19 @@
return static_cast<Error>(error);
}
+Error GrallocDevice::getLayerCount(const native_handle_t* bufferHandle,
+ uint32_t* outLayerCount)
+{
+ if (hasCapability(Capability::LAYERED_BUFFERS)) {
+ int32_t error = mDispatch.getLayerCount(mDevice, bufferHandle,
+ outLayerCount);
+ return static_cast<Error>(error);
+ } else {
+ *outLayerCount = 1;
+ return Error::NONE;
+ }
+}
+
Error GrallocDevice::getProducerUsageMask(const native_handle_t* bufferHandle,
uint64_t* outUsageMask)
{
@@ -238,6 +286,7 @@
.release = release,
.getDimensions = getDimensions,
.getFormat = getFormat,
+ .getLayerCount = getLayerCount,
.getProducerUsageMask = getProducerUsageMask,
.getConsumerUsageMask = getConsumerUsageMask,
.getBackingStore = getBackingStore,
@@ -296,6 +345,12 @@
return cast(device)->getFormat(bufferHandle, outFormat);
}
+ static Error getLayerCount(Device* device,
+ const native_handle_t* bufferHandle, uint32_t* outLayerCount)
+ {
+ return cast(device)->getLayerCount(bufferHandle, outLayerCount);
+ }
+
static Error getProducerUsageMask(Device* device,
const native_handle_t* bufferHandle, uint64_t* outUsageMask)
{
diff --git a/graphics/mapper/2.0/IMapper.h b/graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/IMapper.h
similarity index 95%
rename from graphics/mapper/2.0/IMapper.h
rename to graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/IMapper.h
index 23faa80..ac8ec45 100644
--- a/graphics/mapper/2.0/IMapper.h
+++ b/graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/IMapper.h
@@ -128,6 +128,21 @@
PixelFormat* outFormat);
/*
+ * Gets the number of layers of the buffer.
+ *
+ * See IAllocator::BufferDescriptorInfo for more information.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get format.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return layerCount is the number of layers of the buffer.
+ */
+ typedef Error (*getLayerCount)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint32_t* outLayerCount);
+
+ /*
* Gets the producer usage flags which were used to allocate this buffer.
*
* See IAllocator::BufferDescriptorInfo for more information.
@@ -364,6 +379,7 @@
Device::release release;
Device::getDimensions getDimensions;
Device::getFormat getFormat;
+ Device::getLayerCount getLayerCount;
Device::getProducerUsageMask getProducerUsageMask;
Device::getConsumerUsageMask getConsumerUsageMask;
Device::getBackingStore getBackingStore;
diff --git a/graphics/mapper/2.0/types.h b/graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/types.h
similarity index 100%
rename from graphics/mapper/2.0/types.h
rename to graphics/mapper/2.0/include/android/hardware/graphics/mapper/2.0/types.h
diff --git a/health/1.0/Android.bp b/health/1.0/Android.bp
new file mode 100644
index 0000000..fb3d8c0
--- /dev/null
+++ b/health/1.0/Android.bp
@@ -0,0 +1,51 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.health@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.health@1.0",
+ srcs: [
+ "types.hal",
+ "IHealth.hal",
+ ],
+ out: [
+ "android/hardware/health/1.0/types.cpp",
+ "android/hardware/health/1.0/HealthAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.health@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.health@1.0",
+ srcs: [
+ "types.hal",
+ "IHealth.hal",
+ ],
+ out: [
+ "android/hardware/health/1.0/types.h",
+ "android/hardware/health/1.0/IHealth.h",
+ "android/hardware/health/1.0/IHwHealth.h",
+ "android/hardware/health/1.0/BnHealth.h",
+ "android/hardware/health/1.0/BpHealth.h",
+ "android/hardware/health/1.0/BsHealth.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.health@1.0",
+ generated_sources: ["android.hardware.health@1.0_genc++"],
+ generated_headers: ["android.hardware.health@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.health@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/health/1.0/Android.mk b/health/1.0/Android.mk
new file mode 100644
index 0000000..776a2c2
--- /dev/null
+++ b/health/1.0/Android.mk
@@ -0,0 +1,270 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (BatteryHealth)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/BatteryHealth.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.BatteryHealth
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (BatteryStatus)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/BatteryStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.BatteryStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HealthConfig)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/HealthConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.HealthConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HealthInfo)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/HealthInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.HealthInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Result)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/Result.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.Result
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IHealth.hal
+#
+GEN := $(intermediates)/android/hardware/health/1.0/IHealth.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHealth.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::IHealth
+
+$(GEN): $(LOCAL_PATH)/IHealth.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (BatteryHealth)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/BatteryHealth.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.BatteryHealth
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (BatteryStatus)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/BatteryStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.BatteryStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HealthConfig)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/HealthConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.HealthConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (HealthInfo)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/HealthInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.HealthInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Result)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/Result.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::types.Result
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IHealth.hal
+#
+GEN := $(intermediates)/android/hardware/health/1.0/IHealth.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IHealth.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0::IHealth
+
+$(GEN): $(LOCAL_PATH)/IHealth.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health@1.0-java-constants
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+#
+GEN := $(intermediates)/android/hardware/health/1.0/Constants.java
+$(GEN): $(HIDL)
+$(GEN): $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/IHealth.hal
+
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava-constants -randroid.hardware:hardware/interfaces \
+ android.hardware.health@1.0
+
+$(GEN):
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+# Avoid dependency cycle of framework.jar -> this-library -> framework.jar
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core-oj
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/health/1.0/IHealth.hal b/health/1.0/IHealth.hal
new file mode 100644
index 0000000..3828589
--- /dev/null
+++ b/health/1.0/IHealth.hal
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 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.health@1.0;
+
+interface IHealth {
+ /**
+ * This function lets you change healthd configuration from default if
+ * desired. It must be called exactly once at startup time.
+ *
+ * The configuration values are described in 'struct HealthConfig'.
+ * To use default configuration, simply return without modifying the
+ * fields of the config parameter.
+ *
+ * @param default healthd configuration.
+ */
+ init(HealthConfig config) generates (HealthConfig configOut);
+
+ /**
+ * This function is a hook to update/change device's HealthInfo (as described
+ * in 'struct HealthInfo').
+ *
+ * 'HealthInfo' describes device's battery and charging status, typically
+ * read from kernel. These values may be modified in this call.
+ *
+ * @param Device Health info as described in 'struct HealthInfo'.
+ * @return skipLogging Indication to the caller to add 'or' skip logging the health
+ * information. Return 'true' to skip logging the update.
+ * @return infoOut HealthInfo to be sent to client code. (May or may
+ * not be modified).
+ */
+ update(HealthInfo info) generates (bool skipLogging, HealthInfo infoOut);
+
+ /**
+ * This function is called by healthd when framework queries for remaining
+ * energy in the Battery through BatteryManager APIs.
+ *
+ * @return result Result of querying enery counter for the battery.
+ * @return energy Battery remaining energy in nanowatt-hours.
+ * Must be '0' if result is anything other than Result::SUCCESS.
+ */
+ energyCounter() generates (Result result, int64_t energy);
+};
diff --git a/health/1.0/default/Android.mk b/health/1.0/default/Android.mk
new file mode 100644
index 0000000..3d9d58a
--- /dev/null
+++ b/health/1.0/default/Android.mk
@@ -0,0 +1,56 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health@1.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
+LOCAL_SRC_FILES := \
+ Health.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libhidl \
+ libhwbinder \
+ liblog \
+ libutils \
+ android.hardware.health@1.0 \
+
+LOCAL_STATIC_LIBRARIES := android.hardware.health@1.0-convert
+
+LOCAL_HAL_STATIC_LIBRARIES := libhealthd
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.health@1.0-convert
+LOCAL_SRC_FILES := convert.cpp
+LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libhidl \
+ libutils \
+ android.hardware.health@1.0 \
+
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.health@1.0-service
+LOCAL_INIT_RC := android.hardware.health@1.0-service.rc
+LOCAL_SRC_FILES := \
+ HealthService.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libhwbinder \
+ libhidl \
+ android.hardware.health@1.0 \
+
+include $(BUILD_EXECUTABLE)
+
+include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/health/1.0/default/Health.cpp b/health/1.0/default/Health.cpp
new file mode 100644
index 0000000..1a02956
--- /dev/null
+++ b/health/1.0/default/Health.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#define LOG_TAG "health-hal"
+
+#include <Health.h>
+#include <include/hal_conversion.h>
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::health::V1_0::hal_conversion::convertToHealthConfig;
+using ::android::hardware::health::V1_0::hal_conversion::convertFromHealthConfig;
+using ::android::hardware::health::V1_0::hal_conversion::convertToHealthInfo;
+using ::android::hardware::health::V1_0::hal_conversion::convertFromHealthInfo;
+
+// Methods from ::android::hardware::health::V1_0::IHealth follow.
+Return<void> Health::init(const HealthConfig& config, init_cb _hidl_cb) {
+ struct healthd_config healthd_config = {};
+ HealthConfig configOut;
+
+ // To keep working with existing healthd static HALs,
+ // convert the new HealthConfig to the old healthd_config
+ // and back.
+
+ convertFromHealthConfig(config, &healthd_config);
+ healthd_board_init(&healthd_config);
+ mGetEnergyCounter = healthd_config.energyCounter;
+ convertToHealthConfig(&healthd_config, configOut);
+
+ _hidl_cb(configOut);
+
+ return Void();
+}
+
+Return<void> Health::update(const HealthInfo& info, update_cb _hidl_cb) {
+ struct android::BatteryProperties p = {};
+ HealthInfo infoOut;
+
+ // To keep working with existing healthd static HALs,
+ // convert the new HealthInfo to android::Batteryproperties
+ // and back.
+
+ convertFromHealthInfo(info, &p);
+ int skipLogging = healthd_board_battery_update(&p);
+ convertToHealthInfo(&p, infoOut);
+
+ _hidl_cb(!!skipLogging, infoOut);
+
+ return Void();
+}
+
+Return<void> Health::energyCounter(energyCounter_cb _hidl_cb) {
+ int64_t energy = 0;
+ Result result = Result::NOT_SUPPORTED;
+
+ if (mGetEnergyCounter) {
+ int status = mGetEnergyCounter(&energy);
+ if (status == 0) {
+ result = Result::SUCCESS;
+ }
+ }
+
+ _hidl_cb(result, energy);
+
+ return Void();
+}
+
+IHealth* HIDL_FETCH_IHealth(const char* /* name */) {
+ return new Health();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace health
+} // namespace hardware
+} // namespace android
diff --git a/health/1.0/default/Health.h b/health/1.0/default/Health.h
new file mode 100644
index 0000000..c05751f
--- /dev/null
+++ b/health/1.0/default/Health.h
@@ -0,0 +1,42 @@
+#ifndef HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
+#define HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
+
+#include <android/hardware/health/1.0/IHealth.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+#include <healthd/healthd.h>
+#include <utils/String8.h>
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::health::V1_0::HealthInfo;
+using ::android::hardware::health::V1_0::HealthConfig;
+using ::android::hardware::health::V1_0::IHealth;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Health : public IHealth {
+ // Methods from ::android::hardware::health::V1_0::IHealth follow.
+ Return<void> init(const HealthConfig& config, init_cb _hidl_cb) override;
+ Return<void> update(const HealthInfo& info, update_cb _hidl_cb) override;
+ Return<void> energyCounter(energyCounter_cb _hidl_cb) override;
+private:
+ std::function<int(int64_t *)> mGetEnergyCounter;
+};
+
+extern "C" IHealth* HIDL_FETCH_IHealth(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace health
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
diff --git a/health/1.0/default/HealthService.cpp b/health/1.0/default/HealthService.cpp
new file mode 100644
index 0000000..107f33d
--- /dev/null
+++ b/health/1.0/default/HealthService.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2016 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.
+ */
+
+#define LOG_TAG "android.hardware.health@1.0-service"
+
+#include <android/hardware/health/1.0/IHealth.h>
+#include <hidl/LegacySupport.h>
+
+using android::hardware::health::V1_0::IHealth;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+ return defaultPassthroughServiceImplementation<IHealth>("health");
+}
diff --git a/health/1.0/default/android.hardware.health@1.0-service.rc b/health/1.0/default/android.hardware.health@1.0-service.rc
new file mode 100644
index 0000000..a0d6a56
--- /dev/null
+++ b/health/1.0/default/android.hardware.health@1.0-service.rc
@@ -0,0 +1,4 @@
+service health-hal-1-0 /system/bin/hw/android.hardware.health@1.0-service
+ class hal
+ user system
+ group system
diff --git a/health/1.0/default/convert.cpp b/health/1.0/default/convert.cpp
new file mode 100644
index 0000000..7f1e3c4
--- /dev/null
+++ b/health/1.0/default/convert.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "include/hal_conversion.h"
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V1_0 {
+namespace hal_conversion {
+
+void convertToHealthConfig(const struct healthd_config *hc, HealthConfig& config) {
+ config.periodicChoresIntervalFast = hc->periodic_chores_interval_fast;
+ config.periodicChoresIntervalSlow = hc->periodic_chores_interval_slow;
+
+ config.batteryStatusPath = hc->batteryStatusPath.string();
+ config.batteryHealthPath = hc->batteryHealthPath.string();
+ config.batteryPresentPath = hc->batteryPresentPath.string();
+ config.batteryCapacityPath = hc->batteryCapacityPath.string();
+ config.batteryVoltagePath = hc->batteryVoltagePath.string();
+ config.batteryTemperaturePath = hc->batteryTemperaturePath.string();
+ config.batteryTechnologyPath = hc->batteryTechnologyPath.string();
+ config.batteryCurrentNowPath = hc->batteryCurrentNowPath.string();
+ config.batteryCurrentAvgPath = hc->batteryCurrentAvgPath.string();
+ config.batteryChargeCounterPath = hc->batteryChargeCounterPath.string();
+ config.batteryFullChargePath = hc->batteryFullChargePath.string();
+ config.batteryCycleCountPath = hc->batteryCycleCountPath.string();
+
+}
+
+void convertFromHealthConfig(const HealthConfig& c, struct healthd_config *hc) {
+ hc->periodic_chores_interval_fast = c.periodicChoresIntervalFast;
+ hc->periodic_chores_interval_slow = c.periodicChoresIntervalSlow;
+
+ hc->batteryStatusPath =
+ android::String8(c.batteryStatusPath.c_str(),
+ c.batteryStatusPath.size());
+
+ hc->batteryHealthPath =
+ android::String8(c.batteryHealthPath.c_str(),
+ c.batteryHealthPath.size());
+
+ hc->batteryPresentPath =
+ android::String8(c.batteryPresentPath.c_str(),
+ c.batteryPresentPath.size());
+
+ hc->batteryCapacityPath =
+ android::String8(c.batteryCapacityPath.c_str(),
+ c.batteryCapacityPath.size());
+
+ hc->batteryVoltagePath =
+ android::String8(c.batteryVoltagePath.c_str(),
+ c.batteryVoltagePath.size());
+
+ hc->batteryTemperaturePath =
+ android::String8(c.batteryTemperaturePath.c_str(),
+ c.batteryTemperaturePath.size());
+
+ hc->batteryTechnologyPath =
+ android::String8(c.batteryTechnologyPath.c_str(),
+ c.batteryTechnologyPath.size());
+
+ hc->batteryCurrentNowPath =
+ android::String8(c.batteryCurrentNowPath.c_str(),
+ c.batteryCurrentNowPath.size());
+
+ hc->batteryCurrentAvgPath =
+ android::String8(c.batteryCurrentAvgPath.c_str(),
+ c.batteryCurrentNowPath.size());
+
+ hc->batteryChargeCounterPath =
+ android::String8(c.batteryChargeCounterPath.c_str(),
+ c.batteryChargeCounterPath.size());
+
+ hc->batteryFullChargePath =
+ android::String8(c.batteryFullChargePath.c_str(),
+ c.batteryFullChargePath.size());
+
+ hc->batteryCycleCountPath =
+ android::String8(c.batteryCycleCountPath.c_str(),
+ c.batteryCycleCountPath.size());
+
+ // energyCounter is handled through special means so all calls to
+ // the function go across the HALs
+
+ // boot_min_cap - never used in Android (only in charger-mode).
+
+ // screen_on - never used in Android (only in charger mode).
+}
+
+void convertToHealthInfo(const struct android::BatteryProperties *p,
+ HealthInfo& info) {
+ info.chargerAcOnline = p->chargerAcOnline;
+ info.chargerUsbOnline = p->chargerUsbOnline;
+ info.chargerWirelessOnline = p->chargerWirelessOnline;
+ info.maxChargingCurrent = p->maxChargingCurrent;
+ info.maxChargingVoltage = p->maxChargingVoltage;
+ info.batteryStatus = static_cast<BatteryStatus>(p->batteryStatus);
+ info.batteryHealth = static_cast<BatteryHealth>(p->batteryHealth);
+ info.batteryPresent = p->batteryPresent;
+ info.batteryLevel = p->batteryLevel;
+ info.batteryVoltage = p->batteryVoltage;
+ info.batteryTemperature = p->batteryTemperature;
+ info.batteryCurrent = p->batteryCurrent;
+ info.batteryCycleCount = p->batteryCycleCount;
+ info.batteryFullCharge = p->batteryFullCharge;
+ info.batteryChargeCounter = p->batteryChargeCounter;
+ info.batteryTechnology = p->batteryTechnology;
+}
+
+void convertFromHealthInfo(const HealthInfo& info,
+ struct android::BatteryProperties *p) {
+ p->chargerAcOnline = info.chargerAcOnline;
+ p->chargerUsbOnline = info.chargerUsbOnline;
+ p->chargerWirelessOnline = info.chargerWirelessOnline;
+ p->maxChargingCurrent = info.maxChargingCurrent;
+ p->maxChargingVoltage = info.maxChargingVoltage;
+ p->batteryStatus = static_cast<int>(info.batteryStatus);
+ p->batteryHealth = static_cast<int>(info.batteryHealth);
+ p->batteryPresent = info.batteryPresent;
+ p->batteryLevel = info.batteryLevel;
+ p->batteryVoltage = info.batteryVoltage;
+ p->batteryTemperature = info.batteryTemperature;
+ p->batteryCurrent = info.batteryCurrent;
+ p->batteryCycleCount = info.batteryCycleCount;
+ p->batteryFullCharge = info.batteryFullCharge;
+ p->batteryChargeCounter = info.batteryChargeCounter;
+ p->batteryTechnology = android::String8(info.batteryTechnology.c_str());
+}
+
+} // namespace hal_conversion
+} // namespace V1_0
+} // namespace health
+} // namespace hardware
+} // namespace android
diff --git a/health/1.0/default/include/hal_conversion.h b/health/1.0/default/include/hal_conversion.h
new file mode 100644
index 0000000..a92b208
--- /dev/null
+++ b/health/1.0/default/include/hal_conversion.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#ifndef HARDWARE_INTERFACES_HEALTH_V1_0_DEFAULT_INCLUDE_HAL_CONVERSION_H_
+#define HARDWARE_INTERFACES_HEALTH_V1_0_DEFAULT_INCLUDE_HAL_CONVERSION_H_
+
+#include <android/hardware/health/1.0/IHealth.h>
+#include <healthd/healthd.h>
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V1_0 {
+namespace hal_conversion {
+
+void convertToHealthConfig(const struct healthd_config *hc,
+ HealthConfig& config);
+void convertFromHealthConfig(const HealthConfig& c, struct healthd_config *hc);
+
+void convertToHealthInfo(const struct android::BatteryProperties *p,
+ HealthInfo& info);
+void convertFromHealthInfo(const HealthInfo& info,
+ struct android::BatteryProperties *p);
+
+} // namespace hal_conversion
+} // namespace V1_0
+} // namespace sensors
+} // namespace hardware
+} // namespace android
+
+#endif // HARDWARE_INTERFACES_HEALTH_V1_0_DEFAULT_INCLUDE_HAL_CONVERSION_H_
diff --git a/health/1.0/default/libhealthd/Android.mk b/health/1.0/default/libhealthd/Android.mk
new file mode 100644
index 0000000..a5f4445
--- /dev/null
+++ b/health/1.0/default/libhealthd/Android.mk
@@ -0,0 +1,10 @@
+# Copyright 2016 The Android Open Source Project
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := healthd_board_default.cpp
+LOCAL_MODULE := libhealthd.default
+LOCAL_CFLAGS := -Werror
+LOCAL_C_INCLUDES := system/core/healthd/include system/core/base/include
+include $(BUILD_STATIC_LIBRARY)
diff --git a/health/1.0/default/libhealthd/healthd_board_default.cpp b/health/1.0/default/libhealthd/healthd_board_default.cpp
new file mode 100644
index 0000000..127f98e
--- /dev/null
+++ b/health/1.0/default/libhealthd/healthd_board_default.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#include <healthd/healthd.h>
+
+void healthd_board_init(struct healthd_config*)
+{
+ // use defaults
+}
+
+int healthd_board_battery_update(struct android::BatteryProperties*)
+{
+ // return 0 to log periodic polled battery status to kernel log
+ return 0;
+}
diff --git a/health/1.0/types.hal b/health/1.0/types.hal
new file mode 100644
index 0000000..c5b5cc1
--- /dev/null
+++ b/health/1.0/types.hal
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2016 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.health@1.0;
+
+/*
+ * Possible return values for optional HAL method(s) like
+ * IHealth::energyCounter()
+ */
+enum Result : int32_t {
+ SUCCESS,
+ NOT_SUPPORTED,
+ UNKNOWN,
+};
+
+/*
+ * Possible values for Battery Status.
+ * Note: These are currently in sync with BatteryManager and must not
+ * be extended / altered.
+ */
+@export(name="", value_prefix="BATTERY_STATUS_")
+enum BatteryStatus : int32_t {
+ UNKNOWN = 1,
+ CHARGING = 2,
+ DISCHARGING = 3,
+ /*
+ * Battery is *not* charging - special case when charger is present
+ * but battery isn't charging
+ */
+ NOT_CHARGING = 4,
+ FULL = 5,
+};
+
+/*
+ * Possible values for Battery Health.
+ * Note: These are currently in sync with BatteryManager and must not
+ * be extended / altered.
+ */
+@export(name="", value_prefix="BATTERY_HEALTH_")
+enum BatteryHealth : int32_t {
+ UNKNOWN = 1,
+ GOOD = 2,
+ OVERHEAT = 3,
+ DEAD = 4,
+ OVER_VOLTAGE = 5,
+ /*
+ * Battery experienced an unknown/unspecifid failure.
+ */
+ UNSPECIFIED_FAILURE = 6,
+ COLD = 7,
+};
+
+struct HealthConfig {
+
+ /*
+ * periodicChoresIntervalFast is used while the device is not in
+ * suspend, or in suspend and connected to a charger (to watch for battery
+ * overheat due to charging)
+ */
+ int32_t periodicChoresIntervalFast;
+
+ /*
+ * periodicChoresIntervalSlow is used when the device is in suspend and
+ * not connected to a charger (to watch for a battery drained to zero
+ * remaining capacity).
+ */
+ int32_t periodicChoresIntervalSlow;
+
+ /*
+ * power_supply sysfs attribute file paths. Set these to specific paths
+ * to use for the associated battery parameters. Clients must search
+ * for appropriate power_supply attribute files to use, for any paths
+ * left empty after the HAL is initialized.
+ */
+
+ /*
+ * batteryStatusPath - file path to read battery charging status.
+ * (POWER_SUPPLY_PROP_STATUS)
+ */
+ string batteryStatusPath;
+
+
+ /*
+ * batteryHealthPath - file path to read battery health.
+ * (POWER_SUPPLY_PROP_HEALTH)
+ */
+ string batteryHealthPath;
+
+ /*
+ * batteryPresentPath - file path to read battery present status.
+ * (POWER_SUPPLY_PROP_PRESENT)
+ */
+ string batteryPresentPath;
+
+
+ /*
+ * batteryCapacityPath - file path to read remaining battery capacity.
+ * (POWER_SUPPLY_PROP_CAPACITY)
+ */
+ string batteryCapacityPath;
+
+ /*
+ * batteryVoltagePath - file path to read battery voltage.
+ * (POWER_SUPPLY_PROP_VOLTAGE_NOW)
+ */
+ string batteryVoltagePath;
+
+ /*
+ * batteryTemperaturePath - file path to read battery temperature in tenths
+ * of degree celcius. (POWER_SUPPLY_PROP_TEMP)
+ */
+ string batteryTemperaturePath;
+
+ /*
+ * batteryTechnologyPath - file path to read battery technology.
+ * (POWER_SUPPLY_PROP_TECHNOLOGY)
+ */
+ string batteryTechnologyPath;
+
+ /*
+ * batteryCurrentNowPath - file path to read battery instantaneous current.
+ * (POWER_SUPPLY_PROP_CURRENT_NOW)
+ */
+ string batteryCurrentNowPath;
+
+ /*
+ * batteryCurrentAvgPath - file path to read battery average current.
+ * (POWER_SUPPLY_PROP_CURRENT_AVG)
+ */
+ string batteryCurrentAvgPath;
+
+ /*
+ * batteryChargeCounterPath - file path to read battery accumulated charge.
+ * (POWER_SUPPLY_PROP_CHARGE_COUNTER)
+ */
+ string batteryChargeCounterPath;
+
+ /*
+ * batteryFullChargerPath - file path to read battery charge value when it
+ * is considered to be full. (POWER_SUPPLY_PROP_CHARGE_FULL)
+ */
+ string batteryFullChargePath;
+
+ /*
+ * batteryCycleCountPath - file path to read battery charge cycle count.
+ * (POWER_SUPPLY_PROP_CYCLE_COUNT)
+ */
+ string batteryCycleCountPath;
+};
+
+/*
+ * The parameter to healthd mainloop update calls
+ */
+struct HealthInfo {
+ /* AC charger state - 'true' if online */
+ bool chargerAcOnline;
+
+ /* USB charger state - 'true' if online */
+ bool chargerUsbOnline;
+
+ /* Wireless charger state - 'true' if online */
+ bool chargerWirelessOnline;
+
+ /* Maximum charging current supported by charger in uA */
+ int32_t maxChargingCurrent;
+
+ /* Maximum charging voltage supported by charger in uV */
+ int32_t maxChargingVoltage;
+
+ BatteryStatus batteryStatus;
+
+ BatteryHealth batteryHealth;
+
+ /* 'true' if battery is present */
+ bool batteryPresent;
+
+ /* Remaining battery capacity in percent */
+ int32_t batteryLevel;
+
+ /* Instantaneous battery voltage in uV */
+ int32_t batteryVoltage;
+
+ /* Instantaneous battery temperature in tenths of degree celcius */
+ int32_t batteryTemperature;
+
+ /* Instantaneous battery current in uA */
+ int32_t batteryCurrent;
+
+ /* Battery charge cycle count */
+ int32_t batteryCycleCount;
+
+ /* Battery charge value when it is considered to be "full" in uA-h */
+ int32_t batteryFullCharge;
+
+ /* Instantaneous battery capacity in uA-h */
+ int32_t batteryChargeCounter;
+
+ /* Battery technology, e.g. "Li-ion, Li-Poly" etc. */
+ string batteryTechnology;
+};
diff --git a/health/Android.bp b/health/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/health/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+ "1.0",
+]
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
index ff2414c..b762cc1 100644
--- a/light/2.0/Android.bp
+++ b/light/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.light@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
srcs: [
"types.hal",
"ILight.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.light@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
srcs: [
"types.hal",
"ILight.hal",
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
index 4b6864c..83c09cf 100644
--- a/memtrack/1.0/Android.bp
+++ b/memtrack/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.memtrack@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
srcs: [
"types.hal",
"IMemtrack.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.memtrack@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.memtrack@1.0",
srcs: [
"types.hal",
"IMemtrack.hal",
diff --git a/memtrack/1.0/vts/Android.mk b/memtrack/1.0/vts/Android.mk
new file mode 100644
index 0000000..c0fe968
--- /dev/null
+++ b/memtrack/1.0/vts/Android.mk
@@ -0,0 +1,87 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build VTS driver for memtrack v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_memtrack@1.0
+
+LOCAL_SRC_FILES := \
+ Memtrack.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES := \
+ android.hardware.memtrack@1.0 \
+ system/core/base/include \
+ system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+ android.hardware.memtrack@1.0 \
+ libbase \
+ libutils \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_datatype \
+ libvts_measurement \
+ libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
+
+# build profiler for memtrack.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_memtrack@1.0
+
+LOCAL_SRC_FILES := \
+ Memtrack.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.memtrack@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/memtrack/1.0/vts/Memtrack.vts b/memtrack/1.0/vts/Memtrack.vts
new file mode 100644
index 0000000..9fce2a0
--- /dev/null
+++ b/memtrack/1.0/vts/Memtrack.vts
@@ -0,0 +1,33 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IMemtrack"
+
+package: "android.hardware.memtrack"
+
+import: "android.hardware.memtrack@1.0::types"
+
+interface: {
+ api: {
+ name: "getMemory"
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::memtrack::V1_0::MemtrackStatus"
+ }
+ return_type_hidl: {
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::memtrack::V1_0::MemtrackRecord"
+ }
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::memtrack::V1_0::MemtrackType"
+ }
+ }
+
+}
diff --git a/memtrack/1.0/vts/types.vts b/memtrack/1.0/vts/types.vts
new file mode 100644
index 0000000..bec090f
--- /dev/null
+++ b/memtrack/1.0/vts/types.vts
@@ -0,0 +1,121 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.memtrack"
+
+
+attribute: {
+ name: "::android::hardware::memtrack::V1_0::MemtrackFlag"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "SMAPS_ACCOUNTED"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "SMAPS_UNACCOUNTED"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "SHARED"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "SHARED_PSS"
+ scalar_value: {
+ uint32_t: 16
+ }
+ enumerator: "PRIVATE"
+ scalar_value: {
+ uint32_t: 32
+ }
+ enumerator: "SYSTEM"
+ scalar_value: {
+ uint32_t: 64
+ }
+ enumerator: "DEDICATED"
+ scalar_value: {
+ uint32_t: 128
+ }
+ enumerator: "NONSECURE"
+ scalar_value: {
+ uint32_t: 256
+ }
+ enumerator: "SECURE"
+ scalar_value: {
+ uint32_t: 512
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::memtrack::V1_0::MemtrackType"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "OTHER"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "GL"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "GRAPHICS"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "MULTIMEDIA"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "CAMERA"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "NUM_TYPES"
+ scalar_value: {
+ uint32_t: 5
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::memtrack::V1_0::MemtrackStatus"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "SUCCESS"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "MEMORY_TRACKING_NOT_SUPPORTED"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "TYPE_NOT_SUPPORTED"
+ scalar_value: {
+ uint32_t: 2
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::memtrack::V1_0::MemtrackRecord"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "sizeInBytes"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+ struct_value: {
+ name: "flags"
+ type: TYPE_SCALAR
+ scalar_type: "uint32_t"
+ }
+}
+
diff --git a/nfc/1.0/Android.bp b/nfc/1.0/Android.bp
index 9c3bb5f..b6e8d08 100644
--- a/nfc/1.0/Android.bp
+++ b/nfc/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.nfc@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.nfc@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.nfc@1.0",
srcs: [
"types.hal",
"INfc.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.nfc@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.nfc@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.nfc@1.0",
srcs: [
"types.hal",
"INfc.hal",
diff --git a/nfc/1.0/vts/Nfc.vts b/nfc/1.0/vts/Nfc.vts
index 1f50698..c2313d5 100644
--- a/nfc/1.0/vts/Nfc.vts
+++ b/nfc/1.0/vts/Nfc.vts
@@ -19,6 +19,16 @@
predefined_type: "INfcClientCallback"
is_callback: true
}
+ callflow: {
+ entry: true
+ }
+ callflow: {
+ next: "write"
+ next: "coreInitialized"
+ next: "prediscover"
+ next: "powerCycle"
+ next: "controlGranted"
+ }
}
api: {
@@ -34,6 +44,14 @@
scalar_type: "uint8_t"
}
}
+ callflow: {
+ next: "write"
+ next: "prediscover"
+ next: "coreInitialized"
+ next: "close"
+ next: "powerCycle"
+ next: "controlGranted"
+ }
}
api: {
@@ -49,6 +67,11 @@
scalar_type: "uint8_t"
}
}
+ callflow: {
+ next: "write"
+ next: "prediscover"
+ next: "close"
+ }
}
api: {
@@ -57,6 +80,13 @@
type: TYPE_SCALAR
scalar_type: "int32_t"
}
+ callflow: {
+ next: "write"
+ next: "close"
+ next: "coreInitialized"
+ next: "powerCycle"
+ next: "controlGranted"
+ }
}
api: {
@@ -65,6 +95,9 @@
type: TYPE_SCALAR
scalar_type: "int32_t"
}
+ callflow: {
+ exit: true
+ }
}
api: {
@@ -73,6 +106,13 @@
type: TYPE_SCALAR
scalar_type: "int32_t"
}
+ callflow: {
+ next: "write"
+ next: "close"
+ next: "prediscover"
+ next: "coreInitialized"
+ next: "powerCycle"
+ }
}
api: {
@@ -81,6 +121,13 @@
type: TYPE_SCALAR
scalar_type: "int32_t"
}
+ callflow: {
+ next: "write"
+ next: "coreInitialized"
+ next: "prediscover"
+ next: "controlGranted"
+ next: "close"
+ }
}
}
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
index 52ec33f..a671474 100644
--- a/power/1.0/Android.bp
+++ b/power/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.power@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
srcs: [
"types.hal",
"IPower.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.power@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
srcs: [
"types.hal",
"IPower.hal",
diff --git a/power/1.0/vts/Android.mk b/power/1.0/vts/Android.mk
new file mode 100644
index 0000000..4d5117b
--- /dev/null
+++ b/power/1.0/vts/Android.mk
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build VTS driver for Power v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_power@1.0
+
+LOCAL_SRC_FILES := \
+ Power.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES := \
+ android.hardware.power@1.0 \
+ system/core/base/include \
+ system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+ android.hardware.power@1.0 \
+ libbase \
+ libutils \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_datatype \
+ libvts_measurement \
+ libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
+
+# build profiler for power.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_power@1.0
+
+LOCAL_SRC_FILES := \
+ Power.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.power@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/power/1.0/vts/Power.vts b/power/1.0/vts/Power.vts
new file mode 100644
index 0000000..1711290
--- /dev/null
+++ b/power/1.0/vts/Power.vts
@@ -0,0 +1,57 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "IPower"
+
+package: "android.hardware.power"
+
+import: "android.hardware.power@1.0::types"
+
+interface: {
+ api: {
+ name: "setInteractive"
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+ }
+
+ api: {
+ name: "powerHint"
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::power::V1_0::PowerHint"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "setFeature"
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::power::V1_0::Feature"
+ }
+ arg: {
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+ }
+
+ api: {
+ name: "getPlatformLowPowerStats"
+ return_type_hidl: {
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::power::V1_0::PowerStatePlatformSleepState"
+ }
+ }
+ return_type_hidl: {
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::power::V1_0::Status"
+ }
+ }
+
+}
diff --git a/power/1.0/vts/types.vts b/power/1.0/vts/types.vts
new file mode 100644
index 0000000..94c003b
--- /dev/null
+++ b/power/1.0/vts/types.vts
@@ -0,0 +1,133 @@
+component_class: HAL_HIDL
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.power"
+
+
+attribute: {
+ name: "::android::hardware::power::V1_0::PowerHint"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "VSYNC"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "INTERACTION"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "VIDEO_ENCODE"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "VIDEO_DECODE"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "LOW_POWER"
+ scalar_value: {
+ uint32_t: 5
+ }
+ enumerator: "SUSTAINED_PERFORMANCE"
+ scalar_value: {
+ uint32_t: 6
+ }
+ enumerator: "VR_MODE"
+ scalar_value: {
+ uint32_t: 7
+ }
+ enumerator: "LAUNCH"
+ scalar_value: {
+ uint32_t: 8
+ }
+ enumerator: "DISABLE_TOUCH"
+ scalar_value: {
+ uint32_t: 9
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::power::V1_0::Feature"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "POWER_FEATURE_DOUBLE_TAP_TO_WAKE"
+ scalar_value: {
+ uint32_t: 1
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::power::V1_0::Status"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "SUCCESS"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "FILESYSTEM_ERROR"
+ scalar_value: {
+ uint32_t: 1
+ }
+ }
+}
+
+attribute: {
+ name: "::android::hardware::power::V1_0::PowerStateVoter"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "name"
+ type: TYPE_STRING
+ }
+ struct_value: {
+ name: "totalTimeInMsecVotedForSinceBoot"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+ struct_value: {
+ name: "totalNumberOfTimesVotedSinceBoot"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+}
+
+attribute: {
+ name: "::android::hardware::power::V1_0::PowerStatePlatformSleepState"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "name"
+ type: TYPE_STRING
+ }
+ struct_value: {
+ name: "residencyInMsecSinceBoot"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+ struct_value: {
+ name: "totalTransitions"
+ type: TYPE_SCALAR
+ scalar_type: "uint64_t"
+ }
+ struct_value: {
+ name: "supportedOnlyInSuspend"
+ type: TYPE_SCALAR
+ scalar_type: "bool_t"
+ }
+ struct_value: {
+ name: "voters"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_STRUCT
+ predefined_type: "::android::hardware::power::V1_0::PowerStateVoter"
+ }
+ }
+}
+
diff --git a/radio/1.0/Android.bp b/radio/1.0/Android.bp
index 5927549..0f89421 100644
--- a/radio/1.0/Android.bp
+++ b/radio/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.radio@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
srcs: [
"types.hal",
"IRadio.hal",
@@ -24,8 +24,8 @@
genrule {
name: "android.hardware.radio@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.radio@1.0",
srcs: [
"types.hal",
"IRadio.hal",
diff --git a/radio/1.0/Android.mk b/radio/1.0/Android.mk
index 5cfd32e..35bb9e6 100644
--- a/radio/1.0/Android.mk
+++ b/radio/1.0/Android.mk
@@ -285,6 +285,227 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaCallWaiting)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaiting.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaiting
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberPlan)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberPlan.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberPlan
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberPresentation)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberPresentation.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberPresentation
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaDisplayInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaDisplayInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaDisplayInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInfoRecName)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInfoRecName.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInfoRecName
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInformationRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInformationRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInformationRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInformationRecords)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInformationRecords.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInformationRecords
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaLineControlInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaLineControlInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaLineControlInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaNumberInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaNumberInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaNumberInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaOtaProvisionStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaOtaProvisionStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaOtaProvisionStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaRedirectingNumberInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRedirectingNumberInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaRedirectingNumberInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaRedirectingReason)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRedirectingReason.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaRedirectingReason
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CdmaRoamingType)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRoamingType.java
@@ -302,6 +523,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaSignalInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaSignalInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaSignalInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CdmaSignalStrength)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CdmaSignalStrength.java
@@ -540,6 +778,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaT53AudioControlInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaT53AudioControlInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaT53AudioControlInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaT53ClirInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaT53ClirInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaT53ClirInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CellIdentityCdma)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CellIdentityCdma.java
@@ -744,6 +1016,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CfData)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CfData.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CfData
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (ClipStatus)
#
GEN := $(intermediates)/android/hardware/radio/1.0/ClipStatus.java
@@ -1254,6 +1543,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (PcoDataInfo)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/PcoDataInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.PcoDataInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PersoSubstate)
#
GEN := $(intermediates)/android/hardware/radio/1.0/PersoSubstate.java
@@ -1271,6 +1577,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (PhoneRestrictedState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/PhoneRestrictedState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.PhoneRestrictedState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PinState)
#
GEN := $(intermediates)/android/hardware/radio/1.0/PinState.java
@@ -1441,6 +1764,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (RadioIndicationType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioIndicationType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioIndicationType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (RadioResponseInfo)
#
GEN := $(intermediates)/android/hardware/radio/1.0/RadioResponseInfo.java
@@ -1764,6 +2104,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SimRefreshResult)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SimRefreshResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SimRefreshResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SimRefreshType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SimRefreshType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SimRefreshType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (SmsAcknowledgeFailCause)
#
GEN := $(intermediates)/android/hardware/radio/1.0/SmsAcknowledgeFailCause.java
@@ -1815,6 +2189,108 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SrvccState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SrvccState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SrvccState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsInfoData)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsInfoData.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsInfoData
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsRequestType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsRequestType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsRequestType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsServiceType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsServiceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsServiceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsTeleserviceType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsTeleserviceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsTeleserviceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (StkCcUnsolSsResult)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/StkCcUnsolSsResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.StkCcUnsolSsResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (SubscriptionType)
#
GEN := $(intermediates)/android/hardware/radio/1.0/SubscriptionType.java
@@ -1832,6 +2308,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SuppServiceClass)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SuppServiceClass.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SuppServiceClass
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SuppSvcNotification)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SuppSvcNotification.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SuppSvcNotification
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (TdScdmaSignalStrength)
#
GEN := $(intermediates)/android/hardware/radio/1.0/TdScdmaSignalStrength.java
@@ -1900,6 +2410,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (UssdModeType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/UssdModeType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.UssdModeType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (UusDcs)
#
GEN := $(intermediates)/android/hardware/radio/1.0/UusDcs.java
@@ -2370,6 +2897,227 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaCallWaiting)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaiting.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaiting
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberPlan)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberPlan.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberPlan
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberPresentation)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberPresentation.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberPresentation
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaCallWaitingNumberType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaCallWaitingNumberType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaCallWaitingNumberType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaDisplayInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaDisplayInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaDisplayInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInfoRecName)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInfoRecName.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInfoRecName
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInformationRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInformationRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInformationRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaInformationRecords)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaInformationRecords.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaInformationRecords
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaLineControlInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaLineControlInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaLineControlInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaNumberInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaNumberInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaNumberInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaOtaProvisionStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaOtaProvisionStatus.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaOtaProvisionStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaRedirectingNumberInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRedirectingNumberInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaRedirectingNumberInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaRedirectingReason)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRedirectingReason.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaRedirectingReason
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CdmaRoamingType)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CdmaRoamingType.java
@@ -2387,6 +3135,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaSignalInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaSignalInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaSignalInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CdmaSignalStrength)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CdmaSignalStrength.java
@@ -2625,6 +3390,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CdmaT53AudioControlInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaT53AudioControlInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaT53AudioControlInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (CdmaT53ClirInfoRecord)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CdmaT53ClirInfoRecord.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CdmaT53ClirInfoRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (CellIdentityCdma)
#
GEN := $(intermediates)/android/hardware/radio/1.0/CellIdentityCdma.java
@@ -2829,6 +3628,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (CfData)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/CfData.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.CfData
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (ClipStatus)
#
GEN := $(intermediates)/android/hardware/radio/1.0/ClipStatus.java
@@ -3339,6 +4155,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (PcoDataInfo)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/PcoDataInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.PcoDataInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PersoSubstate)
#
GEN := $(intermediates)/android/hardware/radio/1.0/PersoSubstate.java
@@ -3356,6 +4189,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (PhoneRestrictedState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/PhoneRestrictedState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.PhoneRestrictedState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (PinState)
#
GEN := $(intermediates)/android/hardware/radio/1.0/PinState.java
@@ -3526,6 +4376,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (RadioIndicationType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/RadioIndicationType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.RadioIndicationType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (RadioResponseInfo)
#
GEN := $(intermediates)/android/hardware/radio/1.0/RadioResponseInfo.java
@@ -3849,6 +4716,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SimRefreshResult)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SimRefreshResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SimRefreshResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SimRefreshType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SimRefreshType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SimRefreshType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (SmsAcknowledgeFailCause)
#
GEN := $(intermediates)/android/hardware/radio/1.0/SmsAcknowledgeFailCause.java
@@ -3900,6 +4801,108 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SrvccState)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SrvccState.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SrvccState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsInfoData)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsInfoData.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsInfoData
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsRequestType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsRequestType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsRequestType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsServiceType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsServiceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsServiceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SsTeleserviceType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SsTeleserviceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SsTeleserviceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (StkCcUnsolSsResult)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/StkCcUnsolSsResult.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.StkCcUnsolSsResult
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (SubscriptionType)
#
GEN := $(intermediates)/android/hardware/radio/1.0/SubscriptionType.java
@@ -3917,6 +4920,40 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (SuppServiceClass)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SuppServiceClass.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SuppServiceClass
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SuppSvcNotification)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/SuppSvcNotification.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.SuppSvcNotification
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (TdScdmaSignalStrength)
#
GEN := $(intermediates)/android/hardware/radio/1.0/TdScdmaSignalStrength.java
@@ -3985,6 +5022,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (UssdModeType)
+#
+GEN := $(intermediates)/android/hardware/radio/1.0/UssdModeType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.radio@1.0::types.UssdModeType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (UusDcs)
#
GEN := $(intermediates)/android/hardware/radio/1.0/UusDcs.java
diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal
index 8f28e3f..4dbae17 100644
--- a/radio/1.0/IRadioIndication.hal
+++ b/radio/1.0/IRadioIndication.hal
@@ -21,9 +21,453 @@
*/
interface IRadioIndication {
/*
- * Called when radio state changes.
+ * Indicates when radio state changes.
*
+ * @param type Type of radio indication
* @param radioState Current radio state
*/
- oneway radioStateChanged(RadioState radioState);
+ oneway radioStateChanged(RadioIndicationType type, RadioState radioState);
+
+ /*
+ * Indicates when call state has changed.
+ * Callee must invoke IRadio.getCurrentCalls()
+ * Must be invoked on, for example,
+ * "RING", "BUSY", "NO CARRIER", and also call state
+ * transitions (DIALING->ALERTING ALERTING->ACTIVE)
+ *
+ * Redundent or extraneous invocations are tolerated
+ *
+ * @param type Type of radio indication
+ */
+ oneway callStateChanged(RadioIndicationType type);
+
+ /*
+ * Indicates when voice network state changed
+ * Callee must invoke IRadio.getVoiceRegistrationState() and IRadio.getOperator()
+ *
+ * @param type Type of radio indication
+ */
+ oneway voiceNetworkStateChanged(RadioIndicationType type);
+
+ /*
+ * Indicates when new SMS is received.
+ * Callee must subsequently confirm the receipt of the SMS with a
+ * acknowledgeLastIncomingGsmSms()
+ *
+ * Server must not send newSms() nor newSmsStatusReport() messages until a
+ * acknowledgeLastIncomingGsmSms() has been received
+ *
+ * @param type Type of radio indication
+ * @param pdu PDU of SMS-DELIVER represented as byte array.
+ * The PDU starts with the SMSC address per TS 27.005 (+CMT:)
+ */
+ oneway newSms(RadioIndicationType type, vec<uint8_t> pdu);
+
+ /*
+ * Indicates when new SMS Status Report is received.
+ * Callee must subsequently confirm the receipt of the SMS with a
+ * acknowledgeLastIncomingGsmSms()
+ *
+ * Server must not send newSms() nor newSmsStatusReport() messages until a
+ * acknowledgeLastIncomingGsmSms() has been received
+ *
+ * @param type Type of radio indication
+ * @param pdu PDU of SMS-STATUS-REPORT represented as byte array.
+ * The PDU starts with the SMSC address per TS 27.005 (+CMT:)
+ */
+ oneway newSmsStatusReport(RadioIndicationType type, vec<uint8_t> pdu);
+
+ /*
+ * Indicates when new SMS has been stored on SIM card
+ *
+ * @param type Type of radio indication
+ */
+ oneway newSmsOnSim(RadioIndicationType type);
+
+ /*
+ * Indicates when a new USSD message is received.
+ * The USSD session is assumed to persist if the type code is REQUEST, otherwise
+ * the current session (if any) is assumed to have terminated.
+ *
+ * @param type Type of radio indication
+ * @param modeType USSD type code
+ */
+ oneway onUssd(RadioIndicationType type, UssdModeType modeType);
+
+ /*
+ * Indicates when radio has received a NITZ time message.
+ *
+ * @param type Type of radio indication
+ * @param nitzTime NITZ time string in the form "yy/mm/dd,hh:mm:ss(+/-)tz,dt"
+ * @param receivedTime milliseconds since boot that the NITZ time was received
+ */
+ oneway nitzTimeReceived(RadioIndicationType type, string nitzTime, uint64_t receivedTime);
+
+ /*
+ * Indicates current signal strength of the radio.
+ *
+ * @param type Type of radio indication
+ * @param signalStrength SignalStrength information as defined in types.hal
+ */
+ oneway currentSignalStrength(RadioIndicationType type, SignalStrength signalStrength);
+
+ /*
+ * Indicates data call contexts have changed.
+ *
+ * @param type Type of radio indication
+ * @param dcList array of SetupDataCallResult identical to that
+ * returned by IRadio.getDataCallList(). It is the complete list
+ * of current data contexts including new contexts that have been
+ * activated. A data call is only removed from this list when the
+ * framework sends a IRadio.deactivateDataCall() or the radio
+ * is powered off/on
+ */
+ oneway dataCallListChanged(RadioIndicationType type, vec<SetupDataCallResult> dcList);
+
+ /*
+ * Reports supplementary service related notification from the network.
+ *
+ * @param type Type of radio indication
+ * @param suppSvc SuppSvcNotification as defined in types.hal
+ */
+ oneway suppSvcNotify(RadioIndicationType type, SuppSvcNotification suppSvc);
+
+ /*
+ * Indicates when STK session is terminated by SIM.
+ *
+ * @param type Type of radio indication
+ */
+ oneway stkSessionEnd(RadioIndicationType type);
+
+ /*
+ * Indicates when SIM issue a STK proactive command to applications
+ *
+ * @param type Type of radio indication
+ * @param cmd SAT/USAT proactive represented as byte array starting with command tag.
+ * Refer ETSI TS 102.223 section 9.4 for command types
+ */
+ oneway stkProactiveCommand(RadioIndicationType type, vec<uint8_t> cmd);
+
+ /*
+ * Indicates when SIM notifies applcations some event happens.
+ *
+ * @param type Type of radio indication
+ * @param cmd SAT/USAT commands or responses
+ * sent by ME to SIM or commands handled by ME, represented as byte array
+ * starting with first byte of response data for command tag. Refer
+ * ETSI TS 102.223 section 9.4 for command types
+ */
+ oneway stkEventNotify(RadioIndicationType type, vec<uint8_t> cmd);
+
+ /*
+ * Indicates when SIM wants application to setup a voice call.
+ *
+ * @param type Type of radio indication
+ * @param timeout Timeout value in millisec for setting up voice call
+ */
+ oneway stkCallSetup(RadioIndicationType type, int64_t timeout);
+
+ /*
+ * Indicates that SMS storage on the SIM is full. Sent when the network
+ * attempts to deliver a new SMS message. Messages cannot be saved on the
+ * SIM until space is freed. In particular, incoming Class 2 messages must not
+ * be stored
+ *
+ * @param type Type of radio indication
+ */
+ oneway simSmsStorageFull(RadioIndicationType type);
+
+ /*
+ * Indicates that file(s) on the SIM have been updated, or the SIM
+ * has been reinitialized.
+ * Note: If the SIM state changes as a result of the SIM refresh (eg,
+ * SIM_READY -> SIM_LOCKED_OR_ABSENT), simStatusChanged()
+ * must be sent.
+ *
+ * @param type Type of radio indication
+ * @param refreshResult Result of sim refresh
+ */
+ oneway simRefresh(RadioIndicationType type, SimRefreshResult refreshResult);
+
+ /*
+ * Ring indication for an incoming call (eg, RING or CRING event).
+ * There must be at least one callRing() at the beginning
+ * of a call and sending multiple is optional. If the system property
+ * ro.telephony.call_ring.multiple is false then the upper layers
+ * must generate the multiple events internally. Otherwise the vendor
+ * code must generate multiple callRing() if
+ * ro.telephony.call_ring.multiple is true or if it is absent.
+ *
+ * The rate of these events is controlled by ro.telephony.call_ring.delay
+ * and has a default value of 3000 (3 seconds) if absent.
+ *
+ * @param type Type of radio indication
+ * @param isGsm true for GSM & false for CDMA
+ * @param record Cdma Signal Information
+ */
+ oneway callRing(RadioIndicationType type, bool isGsm, CdmaSignalInfoRecord record);
+
+ /*
+ * Indicates that SIM state changes.
+ * Callee must invoke getIccCardStatus()
+ *
+ * @param type Type of radio indication
+ */
+ oneway simStatusChanged(RadioIndicationType type);
+
+ /*
+ * Indicates when new CDMA SMS is received
+ * Callee must subsequently confirm the receipt of the SMS with
+ * acknowledgeLastIncomingCdmaSms()
+ * Server must not send cdmaNewSms() messages until
+ * acknowledgeLastIncomingCdmaSms() has been received
+ *
+ * @param type Type of radio indication
+ * @param msg Cdma Sms Message
+ */
+ oneway cdmaNewSms(RadioIndicationType type, CdmaSmsMessage msg);
+
+ /*
+ * Indicates when new Broadcast SMS is received
+ *
+ * @param type Type of radio indication
+ * @param data If received from GSM network, "data" is byte array of 88 bytes
+ * which indicates each page of a CBS Message sent to the MS by the
+ * BTS as coded in 3GPP 23.041 Section 9.4.1.2.
+ * If received from UMTS network, "data" is byte array of 90 up to 1252
+ * bytes which contain between 1 and 15 CBS Message pages sent as one
+ * packet to the MS by the BTS as coded in 3GPP 23.041 Section 9.4.2.2
+ */
+ oneway newBroadcastSms(RadioIndicationType type, vec<uint8_t> data);
+
+ /*
+ * Indicates that SMS storage on the RUIM is full. Messages
+ * cannot be saved on the RUIM until space is freed.
+ *
+ * @param type Type of radio indication
+ */
+ oneway cdmaRuimSmsStorageFull(RadioIndicationType type);
+
+ /*
+ * Indicates a restricted state change (eg, for Domain Specific Access Control).
+ * Radio must send this msg after radio off/on cycle no matter it is changed or not.
+ *
+ * @param type Type of radio indication
+ * @param state Bitmask of restricted state as defined by PhoneRestrictedState
+ */
+ oneway restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
+
+ /*
+ * Indicates that the radio system selection module has
+ * autonomously entered emergency callback mode.
+ *
+ * @param type Type of radio indication
+ */
+ oneway enterEmergencyCallbackMode(RadioIndicationType type);
+
+ /*
+ * Indicates when CDMA radio receives a call waiting indication.
+ *
+ * @param type Type of radio indication
+ * @param callWaitingRecord Cdma CallWaiting information
+ */
+ oneway cdmaCallWaiting(RadioIndicationType type, CdmaCallWaiting callWaitingRecord);
+
+ /*
+ * Indicates when CDMA radio receives an update of the progress of an OTASP/OTAPA call.
+ *
+ * @param type Type of radio indication
+ * @param status Cdma OTA provision status
+ */
+ oneway cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
+
+ /*
+ * Indicates when CDMA radio receives one or more info recs.
+ *
+ * @param type Type of radio indication
+ * @param records New Cdma Information
+ */
+ oneway cdmaInfoRec(RadioIndicationType type, CdmaInformationRecords records);
+
+ /*
+ * This is for OEM specific use.
+ *
+ * @param type Type of radio indication
+ * @param data data passed as raw bytes
+ */
+ oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
+
+ /*
+ * Indicates that nework doesn't have in-band information, need to
+ * play out-band tone.
+ *
+ * @param type Type of radio indication
+ * @param start true = start play ringback tone, false = stop playing ringback tone
+ */
+ oneway indicateRingbackTone(RadioIndicationType type, bool start);
+
+ /*
+ * Indicates that framework/application must reset the uplink mute state.
+ *
+ * @param type Type of radio indication
+ */
+ oneway resendIncallMute(RadioIndicationType type);
+
+ /*
+ * Indicates when CDMA subscription source changed.
+ *
+ * @param type Type of radio indication
+ * @param cdmaSource New Cdma SubscriptionSource
+ */
+ oneway cdmaSubscriptionSourceChanged(RadioIndicationType type,
+ CdmaSubscriptionSource cdmaSource);
+
+ /*
+ * Indicates when PRL (preferred roaming list) changes.
+ *
+ * @param type Type of radio indication
+ * @param version PRL version after PRL changes
+ */
+ oneway cdmaPrlChanged(RadioIndicationType type, int32_t version);
+
+ /*
+ * Indicates when Emergency Callback Mode Ends.
+ * Indicates that the radio system selection module has
+ * proactively exited emergency callback mode.
+ *
+ * @param type Type of radio indication
+ */
+ oneway exitEmergencyCallbackMode(RadioIndicationType type);
+
+ /*
+ * TODO(Consider moving this to separate interface. Client will receive this function with an
+ * IRadioResponse interface so that all requests in that IRadioResponse will fail before
+ * rilConnected() is received)
+ *
+ * Indicates the ril connects and returns the version
+ *
+ * @param type Type of radio indication
+ */
+ oneway rilConnected(RadioIndicationType type);
+
+ /*
+ * Indicates that voice technology has changed. Responds with new rat.
+ *
+ * @param type Type of radio indication
+ * @param rat Current new voice rat
+ */
+ oneway voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
+
+ /*
+ * Same information as returned by getCellInfoList().
+ *
+ * @param type Type of radio indication
+ * @param records Current cell information known to radio
+ */
+ oneway cellInfoList(RadioIndicationType type, vec<CellInfo> records);
+
+ /*
+ * Indicates when IMS registration state has changed.
+ * To get IMS registration state and IMS SMS format, callee needs to invoke
+ * getImsRegistrationState()
+ *
+ * @param type Type of radio indication
+ */
+ oneway imsNetworkStateChanged(RadioIndicationType type);
+
+ /*
+ * Indicated when there is a change in subscription status.
+ * This event must be sent in the following scenarios
+ * - subscription readiness at modem, which was selected by telephony layer
+ * - when subscription is deactivated by modem due to UICC card removal
+ * - when network invalidates the subscription i.e. attach reject due to authentication reject
+ *
+ * @param type Type of radio indication
+ * @param activate false for subscription deactivated, true for subscription activated
+ */
+ oneway subscriptionStatusChanged(RadioIndicationType type, bool activate);
+
+ /*
+ * Indicates when Single Radio Voice Call Continuity (SRVCC)
+ * progress state has changed
+ *
+ * @param type Type of radio indication
+ * @param state New Srvcc State
+ */
+ oneway srvccStateNotify(RadioIndicationType type, SrvccState state);
+
+ /*
+ * Indicates when the hardware configuration associated with the RILd changes.
+ *
+ * @param type Type of radio indication
+ * @param configs Array of hardware configs
+ */
+ oneway hardwareConfigChanged(RadioIndicationType type, vec<HardwareConfig> configs);
+
+ /*
+ * Sent when setRadioCapability() completes.
+ * Returns the phone radio capability exactly as
+ * getRadioCapability() and must be the
+ * same set as sent by setRadioCapability().
+ *
+ * @param type Type of radio indication
+ * @param rc Current radio capability
+ */
+ oneway radioCapabilityIndication(RadioIndicationType type, RadioCapability rc);
+
+ /*
+ * Indicates when Supplementary service(SS) response is received when DIAL/USSD/SS is changed to
+ * SS by call control.
+ *
+ * @param type Type of radio indication
+ */
+ oneway onSupplementaryServiceIndication(RadioIndicationType type, StkCcUnsolSsResult ss);
+
+ /*
+ * Indicates when there is an ALPHA from UICC during Call Control.
+ *
+ * @param type Type of radio indication
+ * @param alpha ALPHA string from UICC in UTF-8 format
+ */
+ oneway stkCallControlAlphaNotify(RadioIndicationType type, string alpha);
+
+ /*
+ * Indicates when there is an incoming Link Capacity Estimate (LCE) info report.
+ *
+ * @param type Type of radio indication
+ * @param lce LceData information
+ */
+ oneway lceData(RadioIndicationType type, LceDataInfo lce);
+
+ /*
+ * Indicates when there is new Carrier PCO data received for a data call. Ideally
+ * only new data must be forwarded, though this is not required. Multiple
+ * boxes of carrier PCO data for a given call must result in a series of
+ * pcoData() calls.
+ *
+ * @param type Type of radio indication
+ * @param pco New PcoData
+ */
+ oneway pcoData(RadioIndicationType type, PcoDataInfo pco);
+
+ /*
+ * Indicates when there is a modem reset.
+ *
+ * When modem restarts, one of the following radio state transitions must happen
+ * 1) RadioState:ON->RadioState:UNAVAILABLE->RadioState:ON or
+ * 2) RadioState:OFF->RadioState:UNAVAILABLE->RadioState:OFF
+ * This message must be sent either just before the Radio State changes to RadioState:UNAVAILABLE
+ * or just after but must never be sent after the Radio State changes from RadioState:UNAVAILABLE
+ * to RadioState:ON/RadioState:OFF again.
+ * It must NOT be sent after the Radio state changes to RadioState:ON/RadioState:OFF after the
+ * modem restart as that may be interpreted as a second modem reset by the
+ * framework.
+ *
+ * @param type Type of radio indication
+ * @param reason the reason for the reset. It
+ * may be a crash signature if the restart was due to a crash or some
+ * string such as "user-initiated restart" or "AT command initiated
+ * restart" that explains the cause of the modem restart
+ */
+ oneway modemReset(RadioIndicationType type, string reason);
};
\ No newline at end of file
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index 013c76c..194733a 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -147,11 +147,14 @@
};
enum RadioResponseType : int32_t {
- RESPONSE_SOLICITED,
- RESPONSE_UNSOLICITED,
- RESPONSE_SOLICITED_ACK,
- RESPONSE_SOLICITED_ACK_EXP,
- RESPONSE_UNSOLICITED_ACK_EXP,
+ SOLICITED,
+ SOLICITED_ACK,
+ SOLICITED_ACK_EXP,
+};
+
+enum RadioIndicationType : int32_t {
+ UNSOLICITED,
+ UNSOLICITED_ACK_EXP,
};
enum RestrictedState : int32_t {
@@ -846,6 +849,78 @@
THREE_GPP2 // 3GPP2 Technologies - CDMA
};
+enum RadioCapabilityPhase : int32_t {
+ CONFIGURED = 0, // Logical Modem's (LM) initial value
+ // and value after FINISH completes
+ START = 1, // START is sent before APPLY and indicates that an
+ // APPLY is forthcoming with these same parameters
+ APPLY = 2, // APPLY is sent after all LM's receive START and returned
+ // RadioCapability.status = 0. If any START's fail, hal
+ // implementation must not send APPLY.
+ UNSOL_RSP = 3, // UNSOL_RSP is sent with unsol radioCapability()
+ FINISH = 4 // FINISH is sent after all commands have completed. If an
+ // error occurs in any previous command, the
+ // RadioAccessesFamily and logicalModemUuid fields must be
+ // the prior configuration thus restoring the configuration
+ // to the previous value. An error returned by FINISH
+ // will generally be ignored or may cause that logical
+ // modem to be removed from service.
+};
+
+enum RadioCapabilityStatus : int32_t {
+ NONE = 0, // This parameter has no meaning with
+ // RadioCapabilityPhase:START, RadioCapabilityPhase:APPLY
+ SUCCESS = 1, // Tell modem the action transaction of set radio
+ // capability was success with RadioCapabilityPhase:FINISH
+ FAIL = 2, // Tell modem the action transaction of set radio
+ // capability is fail with RadioCapabilityPhase:FINISH.
+};
+
+enum RadioAccessFamily : int32_t {
+ UNKNOWN = 1 << RadioTechnology:UNKNOWN,
+ GPRS = 1 << RadioTechnology:GPRS,
+ EDGE = 1 << RadioTechnology:EDGE,
+ UMTS = 1 << RadioTechnology:UMTS,
+ IS95A = 1 << RadioTechnology:IS95A,
+ IS95B = 1 << RadioTechnology:IS95B,
+ ONE_X_RTT = 1 << RadioTechnology:ONE_X_RTT,
+ EVDO_0 = 1 << RadioTechnology:EVDO_0,
+ EVDO_A = 1 << RadioTechnology:EVDO_A,
+ HSDPA = 1 << RadioTechnology:HSDPA,
+ HSUPA = 1 << RadioTechnology:HSUPA,
+ HSPA = 1 << RadioTechnology:HSPA,
+ EVDO_B = 1 << RadioTechnology:EVDO_B,
+ EHRPD = 1 << RadioTechnology:EHRPD,
+ LTE = 1 << RadioTechnology:LTE,
+ HSPAP = 1 << RadioTechnology:HSPAP,
+ GSM = 1 << RadioTechnology:GSM,
+ TD_SCDMA = 1 << RadioTechnology:TD_SCDMA,
+ LTE_CA = 1 << RadioTechnology:LTE_CA
+};
+
+enum UssdModeType : int32_t {
+ NOTIFY, // USSD-Notify
+ REQUEST, // USSD-Request
+ NW_RELEASE, // Session terminated by network
+ LOCAL_CLIENT, // other local client (eg, SIM Toolkit) has responded
+ NOT_SUPPORTED, // Operation not supported
+ NW_TIMEOUT, // Network timeout
+};
+
+enum SimRefreshType : int32_t {
+ SIM_FILE_UPDATE = 0, // A file on SIM has been updated.
+ SIM_INIT = 1, // SIM initialized. All files should be re-read.
+ SIM_RESET = 2 // SIM reset. SIM power required, SIM may be locked a
+ // nd all files must be re-read.
+};
+
+enum SrvccState :int32_t {
+ HANDOVER_STARTED = 0,
+ HANDOVER_COMPLETED = 1,
+ HANDOVER_FAILED = 2,
+ HANDOVER_CANCELED = 3
+};
+
enum UiccSubActStatus : int32_t {
DEACTIVATE,
ACTIVATE
@@ -863,6 +938,134 @@
THREE_GPP2
};
+enum PhoneRestrictedState : int32_t {
+ NONE = 0x00, // No restriction at all including voice/SMS/USSD/SS/AV64
+ // and packet data
+ CS_EMERGENCY = 0x01, // Block emergency call due to restriction. But allow all
+ // normal voice/SMS/USSD/SS/AV64.
+ CS_NORMAL = 0x02, // Block all normal voice/SMS/USSD/SS/AV64 due to
+ // restriction. Only Emergency call allowed.
+ CS_ALL = 0x04, // Block all voice/SMS/USSD/SS/AV64 including emergency
+ // call due to restriction.
+ PS_ALL = 0x10 // Block packet data access due to restriction.
+};
+
+enum CdmaCallWaitingNumberPresentation : int32_t {
+ ALLOWED = 0,
+ RESTRICTED = 1,
+ UNKNOWN = 2,
+};
+
+enum CdmaCallWaitingNumberType : int32_t {
+ UNKNOWN = 0,
+ INTERNATIONAL = 1,
+ NATIONAL = 2,
+ NETWORK_SPECIFIC = 3,
+ SUBSCRIBER = 4
+};
+
+enum CdmaCallWaitingNumberPlan : int32_t {
+ UNKNOWN = 0,
+ ISDN = 1,
+ DATA = 3,
+ TELEX = 4,
+ NATIONAL = 8,
+ PRIVATE = 9
+};
+
+enum CdmaOtaProvisionStatus : int32_t {
+ SPL_UNLOCKED,
+ SPC_RETRIES_EXCEEDED,
+ A_KEY_EXCHANGED,
+ SSD_UPDATED,
+ NAM_DOWNLOADED,
+ MDN_DOWNLOADED,
+ IMSI_DOWNLOADED,
+ PRL_DOWNLOADED,
+ COMMITTED,
+ OTAPA_STARTED,
+ OTAPA_STOPPED,
+ OTAPA_ABORTED
+};
+
+/* Names of the CDMA info records (C.S0005 section 3.7.5) */
+enum CdmaInfoRecName : int32_t {
+ DISPLAY,
+ CALLED_PARTY_NUMBER,
+ CALLING_PARTY_NUMBER,
+ CONNECTED_NUMBER,
+ SIGNAL,
+ REDIRECTING_NUMBER,
+ LINE_CONTROL,
+ EXTENDED_DISPLAY,
+ T53_CLIR,
+ T53_RELEASE,
+ T53_AUDIO_CONTROL
+};
+
+/* Redirecting Number Information Record as defined in C.S0005 section 3.7.5.11 */
+enum CdmaRedirectingReason : int32_t {
+ UNKNOWN = 0,
+ CALL_FORWARDING_BUSY = 1,
+ CALL_FORWARDING_NO_REPLY = 2,
+ CALLED_DTE_OUT_OF_ORDER = 9,
+ CALL_FORWARDING_BY_THE_CALLED_DTE = 10,
+ CALL_FORWARDING_UNCONDITIONAL = 15,
+ RESERVED
+};
+
+enum SsServiceType : int32_t {
+ CFU,
+ CF_BUSY,
+ CF_NO_REPLY,
+ CF_NOT_REACHABLE,
+ CF_ALL,
+ CF_ALL_CONDITIONAL,
+ CLIP,
+ CLIR,
+ COLP,
+ COLR,
+ WAIT,
+ BAOC,
+ BAOIC,
+ BAOIC_EXC_HOME,
+ BAIC,
+ BAIC_ROAMING,
+ ALL_BARRING,
+ OUTGOING_BARRING,
+ INCOMING_BARRING
+};
+
+enum SsRequestType : int32_t {
+ ACTIVATION,
+ DEACTIVATION,
+ INTERROGATION,
+ REGISTRATION,
+ ERASURE
+};
+
+enum SsTeleserviceType : int32_t {
+ ALL_TELE_AND_BEARER_SERVICES,
+ ALL_TELESEVICES,
+ TELEPHONY,
+ ALL_DATA_TELESERVICES,
+ SMS_SERVICES,
+ ALL_TELESERVICES_EXCEPT_SMS
+};
+
+enum SuppServiceClass : int32_t {
+ NONE = 0,
+ VOICE = 1 << 0,
+ DATA = 1 << 1,
+ FAX = 1 << 2,
+ SMS = 1 << 3,
+ DATA_SYNC = 1 << 4,
+ DATA_ASYNC = 1 << 5,
+ PACKET = 1 << 6,
+ PAD = 1 << 7,
+ MAX = 1 << 7
+};
+
struct RadioResponseInfo {
RadioResponseType type; // Response type
int32_t serial; // Serial number of the request
@@ -1283,7 +1486,7 @@
};
struct CdmaSmsWriteArgs {
- CdmaSmsWriteArgsStatus status; // Status of message. See TS 27.005 3.1
+ CdmaSmsWriteArgsStatus status; // Status of message. See TS 27.005 3.1
CdmaSmsMessage message;
};
@@ -1408,7 +1611,7 @@
bool registered; // true if this cell is registered false if not registered
TimeStampType timeStampType; // type of time stamp represented by timeStamp
uint64_t timeStamp; // Time in nanos as returned by ril_nano_time
- // Only 1 of the below vectors must be of size 1 based on the CellInfoType & others must be
+ // Only one of the below vectors must be of size 1 based on the CellInfoType & others must be
// of size 0
vec<CellInfoGsm> gsm; // Valid only if type = gsm and size = 1 else must be empty
vec<CellInfoCdma> cdma; // Valid only if type = cdma and size = 1 else must be
@@ -1435,7 +1638,7 @@
int32_t messageRef; // Valid field if retry is set to true.
// Contains messageRef from SendSmsResult stuct
// corresponding to failed MO SMS.
- // Only 1 of the below vectors must be of size 1 based on the RadioTechnologyFamily & others
+ // Only one of the below vectors must be of size 1 based on the RadioTechnologyFamily & others
// must be of size 0
vec<CdmaSmsMessage> cdmaMessage; // Valid field if tech is 3GPP2 and size = 1 else must be
// empty
@@ -1488,7 +1691,7 @@
string uuid; // RadioConst:MAX_UUID_LENGTH is max length of the
// string
HardwareConfigState state;
- // Only 1 of the below vectors must have size = 1 based on the HardwareConfigType and other
+ // Only one of the below vectors must have size = 1 based on the HardwareConfigType and other
// must have size = 0.
vec<HardwareConfigModem> modem; // Valid only if type is Modem and size = 1 else must be
// empty
@@ -1514,56 +1717,6 @@
bool enabled; // True to enable the profile, false to disable
};
-enum RadioCapabilityPhase : int32_t {
- CONFIGURED = 0, // LM is configured is initial value and value after
- // FINISH completes
- START = 1, // START is sent before Apply and indicates that an
- // APPLY will be
- // forthcoming with these same parameters
- APPLY = 2, // APPLY is sent after all LM's receive START and returned
- // RadioCapability.status = 0, if any START's fail no
- // APPLY will be sent
- UNSOL_RSP = 3, // UNSOL_RSP is sent with unsol radioCapability()
- FINISH = 4 // FINISH is sent after all commands have completed. If an
- // error occurs in any previous command the
- // RadioAccessesFamily and logicalModemUuid fields will be
- // the prior configuration thus restoring the configuration
- // to the previous value. An error returned by this command
- // will generally be ignored or may cause that logical
- // modem to be removed from service.
-};
-
-enum RadioCapabilityStatus : int32_t {
- NONE = 0, // This parameter has no meaning with RC_PHASE_START,
- // RadioCapabilityPhase:APPLY
- SUCCESS = 1, // Tell modem the action transaction of set radio
- // capability was success with RadioCapabilityPhase:FINISH
- FAIL = 2, // Tell modem the action transaction of set radio
- // capability is fail with RadioCapabilityPhase:FINISH.
-};
-
-enum RadioAccessFamily : int32_t {
- UNKNOWN = (1 << RadioTechnology:UNKNOWN),
- GPRS = (1 << RadioTechnology:GPRS),
- EDGE = (1 << RadioTechnology:EDGE),
- UMTS = (1 << RadioTechnology:UMTS),
- IS95A = (1 << RadioTechnology:IS95A),
- IS95B = (1 << RadioTechnology:IS95B),
- ONE_X_RTT = (1 << RadioTechnology:ONE_X_RTT),
- EVDO_0 = (1 << RadioTechnology:EVDO_0),
- EVDO_A = (1 << RadioTechnology:EVDO_A),
- HSDPA = (1 << RadioTechnology:HSDPA),
- HSUPA = (1 << RadioTechnology:HSUPA),
- HSPA = (1 << RadioTechnology:HSPA),
- EVDO_B = (1 << RadioTechnology:EVDO_B),
- EHRPD = (1 << RadioTechnology:EHRPD),
- LTE = (1 << RadioTechnology:LTE),
- HSPAP = (1 << RadioTechnology:HSPAP),
- GSM = (1 << RadioTechnology:GSM),
- TD_SCDMA = (1 << RadioTechnology:TD_SCDMA),
- LTE_CA = (1 << RadioTechnology:LTE_CA)
-};
-
struct RadioCapability {
int32_t session; // Unique session value defined by framework returned in
// all "responses/unsol"
@@ -1626,3 +1779,156 @@
// is ABCD, all carriers with the same mcc/mnc are
// allowed.
};
+
+struct SuppSvcNotification {
+ bool isMT; // notification type
+ // false = MO intermediate result code
+ // true = MT unsolicited result code
+ bool isCode1; // See 27.007 7.17
+ // true = "code1" for MO
+ // false = "code2" for MT
+ int32_t index; // CUG index. See 27.007 7.17.
+ int32_t type; // "type" from 27.007 7.17 (MT only).
+ string number; // "number" from 27.007 7.17
+ // (MT only, may be empty string).
+};
+
+struct SimRefreshResult {
+ SimRefreshType type;
+ int32_t efId; // is the EFID of the updated file if the result is
+ // SIM_FILE_UPDATE or 0 for any other result.
+ string aid; // is AID(application ID) of the card application
+ // See ETSI 102.221 8.1 and 101.220 4
+ // For SIM_FILE_UPDATE result it must be set to AID of
+ // application in which updated EF resides or it must be
+ // empty string if EF is outside of an application.
+ // For SIM_INIT result this field is set to AID of
+ // application that caused REFRESH
+ // For SIM_RESET result it is empty string.
+};
+
+/* CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 */
+struct CdmaSignalInfoRecord {
+ bool isPresent; // true if signal information record is present
+ int8_t signalType; // as defined 3.7.5.5-1
+ int8_t alertPitch; // as defined 3.7.5.5-2
+ int8_t signal; // as defined 3.7.5.5-3, 3.7.5.5-4 or 3.7.5.5-5
+};
+
+struct CdmaCallWaiting {
+ string number; // Remote party number
+ CdmaCallWaitingNumberPresentation numberPresentation;
+ string name; // Remote party name
+ CdmaSignalInfoRecord signalInfoRecord;
+ // Number type/Number plan required to support International Call Waiting
+ CdmaCallWaitingNumberType numbertype;
+ CdmaCallWaitingNumberPlan numberPlan;
+};
+
+/*
+ * Display Info Rec as defined in C.S0005 section 3.7.5.1
+ * Extended Display Info Rec as defined in C.S0005 section 3.7.5.16
+ * Note: the Extended Display info rec contains multiple records of the
+ * form: display_tag, display_len, and display_len occurrences of the
+ * char field if the display_tag is not 10000000 or 10000001.
+ * To save space, the records are stored consecutively in a byte buffer.
+ * The display_tag, display_len and chari fields are all 1 byte.
+ */
+struct CdmaDisplayInfoRecord {
+ string alphaBuf; // Max length = RadioConst:CDMA_ALPHA_INFO_BUFFER_LENGTH
+};
+
+/*
+ * Called Party Number Info Rec as defined in C.S0005 section 3.7.5.2
+ * Calling Party Number Info Rec as defined in C.S0005 section 3.7.5.3
+ * Connected Number Info Rec as defined in C.S0005 section 3.7.5.4
+ */
+struct CdmaNumberInfoRecord {
+ string number; // Max length = RADIP_CDMA_NUMBER_INFO_BUFFER_LENGTH
+ uint8_t numberType;
+ uint8_t numberPlan;
+ uint8_t pi;
+ uint8_t si;
+};
+
+struct CdmaRedirectingNumberInfoRecord{
+ CdmaNumberInfoRecord redirectingNumber;
+ CdmaRedirectingReason redirectingReason; // redirectingReason is set to UNKNOWN if not included
+};
+
+/* Line Control Information Record as defined in C.S0005 section 3.7.5.15 */
+struct CdmaLineControlInfoRecord {
+ uint8_t lineCtrlPolarityIncluded;
+ uint8_t lineCtrlToggle;
+ uint8_t lineCtrlReverse;
+ uint8_t lineCtrlPowerDenial;
+};
+
+/* T53 CLIR Information Record */
+struct CdmaT53ClirInfoRecord {
+ uint8_t cause;
+};
+
+/* T53 Audio Control Information Record */
+struct CdmaT53AudioControlInfoRecord {
+ uint8_t upLink;
+ uint8_t downLink;
+};
+
+struct CdmaInformationRecord {
+ CdmaInfoRecName name;
+ // Only one of the below vectors must have size = 1 based on the
+ // CdmaInfoRecName. All other vectors must have size 0.
+ vec<CdmaDisplayInfoRecord> display; // Display and Extended Display Info Rec
+ vec<CdmaNumberInfoRecord> number; // Called Party Number, Calling Party Number, Connected
+ // number Info Rec
+ vec<CdmaSignalInfoRecord> signal; // Signal Info Rec
+ vec<CdmaRedirectingNumberInfoRecord> redir; // Redirecting Number Info Rec
+ vec<CdmaLineControlInfoRecord> lineCtrl; // Line Control Info Rec
+ vec<CdmaT53ClirInfoRecord> clir; // T53 CLIR Info Rec
+ vec<CdmaT53AudioControlInfoRecord> audioCtrl; // T53 Audio Control Info Rec
+};
+
+struct CdmaInformationRecords {
+ vec<CdmaInformationRecord> infoRec; // Max length = RadioConst:CDMA_MAX_NUMBER_OF_INFO_RECS
+};
+
+struct CfData {
+ vec<CallForwardInfo> cfInfo; // This is the response data
+ // for SS request to query call
+ // forward status. see getCallForwardStatus()
+ // Max size = RadioConst:NUM_SERVICE_CLASSES
+};
+
+struct SsInfoData {
+ vec<int32_t> ssInfo; // This is the response data for all of the SS GET/SET
+ // Radio requests. E.g. IRadio.getClir() returns
+ // two ints, so first two values of ssInfo[] will be
+ // used for response if serviceType is SS_CLIR and
+ // requestType is SS_INTERROGATION
+ // Max size = RadioConst:SS_INFO_MAX
+};
+
+struct StkCcUnsolSsResult {
+ SsServiceType serviceType;
+ SsRequestType requestType;
+ SsTeleserviceType teleserviceType;
+ SuppServiceClass serviceClass;
+ RadioError result;
+ // Only one of the below vectors may contain values and other must be empty
+ vec<SsInfoData> ssInfo; // Valid only for all SsserviceType except
+ // SsServiceType:CF_* else empty.
+ vec<CfData> cfData; // Valid for SsServiceType:CF_* else empty
+};
+
+struct PcoDataInfo {
+ int32_t cid; // Context ID, uniquely identifies this call
+ string bearerProto; // One of the PDP_type values in TS 27.007 section 10.1.1.
+ // For example, "IP", "IPV6", "IPV4V6"
+ int32_t pcoId; // The protocol ID for this box. Note that only IDs from
+ // FF00H - FFFFH are accepted. If more than one is
+ // included from the network, multiple calls must be made
+ // to send all of them.
+ vec<uint8_t> contents; // Carrier-defined content. It is binary, opaque and
+ // loosely defined in LTE Layer 3 spec 24.008
+};
\ No newline at end of file
diff --git a/sensors/1.0/Android.bp b/sensors/1.0/Android.bp
index 13e9bee..2039613 100644
--- a/sensors/1.0/Android.bp
+++ b/sensors/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.sensors@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.sensors@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.sensors@1.0",
srcs: [
"types.hal",
"ISensors.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.sensors@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.sensors@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.sensors@1.0",
srcs: [
"types.hal",
"ISensors.hal",
diff --git a/sensors/1.0/default/Android.bp b/sensors/1.0/default/Android.bp
index d454cdb..d8d0c82 100644
--- a/sensors/1.0/default/Android.bp
+++ b/sensors/1.0/default/Android.bp
@@ -16,6 +16,7 @@
static_libs: [
"android.hardware.sensors@1.0-convert",
],
+ local_include_dirs: ["include/sensors"],
}
cc_library_static {
@@ -33,6 +34,7 @@
"libhidl",
"android.hardware.sensors@1.0",
],
+ local_include_dirs: ["include/sensors"],
}
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index f4e1841..18725e7 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "include/convert.h"
+#include "convert.h"
#include <android-base/logging.h>
diff --git a/sensors/1.0/default/include/convert.h b/sensors/1.0/default/include/sensors/convert.h
similarity index 100%
rename from sensors/1.0/default/include/convert.h
rename to sensors/1.0/default/include/sensors/convert.h
diff --git a/sensors/1.0/types.hal b/sensors/1.0/types.hal
index ba4921c..460cef5 100644
--- a/sensors/1.0/types.hal
+++ b/sensors/1.0/types.hal
@@ -674,6 +674,29 @@
SENSOR_TYPE_ADDITIONAL_INFO = 33,
/*
+ * SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT
+ * trigger-mode: on-change
+ * wake-up sensor: yes
+ *
+ * A sensor of this type is defined for devices that are supposed to be worn
+ * by the user in the normal use case (such as a watch, wristband, etc) and
+ * is not yet defined for other device.
+ *
+ * A sensor of this type triggers an event each time the wearable device
+ * is removed from the body and each time it's put back onto the body.
+ * It must be low-latency and be able to detect the on-body to off-body
+ * transition within one second (event delivery time included),
+ * and 3-second latency to determine the off-body to on-body transition
+ * (event delivery time included).
+ *
+ * There are only two valid event values for the sensor to return :
+ * 0.0 for off-body
+ * 1.0 for on-body
+ *
+ */
+ SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34,
+
+ /*
* Base for device manufacturers private sensor types.
* These sensor types can't be exposed in the SDK.
*/
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
index cda8c22..79ae797 100644
--- a/soundtrigger/2.0/Android.bp
+++ b/soundtrigger/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.soundtrigger@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
srcs: [
"types.hal",
"ISoundTriggerHw.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.soundtrigger@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
srcs: [
"types.hal",
"ISoundTriggerHw.hal",
@@ -56,5 +56,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.audio.common@2.0",
],
}
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index 4af053c..97693fb 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.bar@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
srcs: [
"IBar.hal",
"IImportTypes.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.tests.bar@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
srcs: [
"IBar.hal",
"IImportTypes.hal",
@@ -52,5 +52,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.tests.foo@1.0",
],
}
diff --git a/tests/baz/1.0/Android.bp b/tests/baz/1.0/Android.bp
index 18a554d..1a7c300 100644
--- a/tests/baz/1.0/Android.bp
+++ b/tests/baz/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.baz@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.baz@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.baz@1.0",
srcs: [
"types.hal",
"IBase.hal",
@@ -20,8 +20,8 @@
genrule {
name: "android.hardware.tests.baz@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.baz@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.baz@1.0",
srcs: [
"types.hal",
"IBase.hal",
diff --git a/tests/expression/1.0/Android.bp b/tests/expression/1.0/Android.bp
index 2061283..6acb3f9 100644
--- a/tests/expression/1.0/Android.bp
+++ b/tests/expression/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.expression@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.expression@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.expression@1.0",
srcs: [
"IExpression.hal",
"IExpressionExt.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.tests.expression@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.expression@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.expression@1.0",
srcs: [
"IExpression.hal",
"IExpressionExt.hal",
diff --git a/tests/foo/1.0/Android.bp b/tests/foo/1.0/Android.bp
index 7a556ed..7e30fe3 100644
--- a/tests/foo/1.0/Android.bp
+++ b/tests/foo/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.foo@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.foo@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.foo@1.0",
srcs: [
"types.hal",
"IFoo.hal",
@@ -24,8 +24,8 @@
genrule {
name: "android.hardware.tests.foo@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.foo@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.foo@1.0",
srcs: [
"types.hal",
"IFoo.hal",
diff --git a/tests/inheritance/1.0/Android.bp b/tests/inheritance/1.0/Android.bp
index 92d6fe7..f522ac0 100644
--- a/tests/inheritance/1.0/Android.bp
+++ b/tests/inheritance/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.inheritance@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
srcs: [
"IChild.hal",
"IFetcher.hal",
@@ -20,8 +20,8 @@
genrule {
name: "android.hardware.tests.inheritance@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.inheritance@1.0",
srcs: [
"IChild.hal",
"IFetcher.hal",
diff --git a/tests/libhwbinder/1.0/Android.bp b/tests/libhwbinder/1.0/Android.bp
index aad24a6..2598f30 100644
--- a/tests/libhwbinder/1.0/Android.bp
+++ b/tests/libhwbinder/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.libhwbinder@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.libhwbinder@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.libhwbinder@1.0",
srcs: [
"IBenchmark.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.tests.libhwbinder@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.libhwbinder@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.libhwbinder@1.0",
srcs: [
"IBenchmark.hal",
],
diff --git a/tests/msgq/1.0/Android.bp b/tests/msgq/1.0/Android.bp
index 2eb36c0..e685bcc 100644
--- a/tests/msgq/1.0/Android.bp
+++ b/tests/msgq/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.msgq@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.msgq@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.msgq@1.0",
srcs: [
"ITestMsgQ.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.tests.msgq@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.msgq@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.msgq@1.0",
srcs: [
"ITestMsgQ.hal",
],
diff --git a/tests/pointer/1.0/Android.bp b/tests/pointer/1.0/Android.bp
index 2b1e8b2..ad8d014 100644
--- a/tests/pointer/1.0/Android.bp
+++ b/tests/pointer/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tests.pointer@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.pointer@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.pointer@1.0",
srcs: [
"IGraph.hal",
"IPointer.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.tests.pointer@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.pointer@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.pointer@1.0",
srcs: [
"IGraph.hal",
"IPointer.hal",
diff --git a/thermal/1.0/Android.bp b/thermal/1.0/Android.bp
index 76a38a0..60f2626 100644
--- a/thermal/1.0/Android.bp
+++ b/thermal/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.thermal@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
srcs: [
"types.hal",
"IThermal.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.thermal@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.thermal@1.0",
srcs: [
"types.hal",
"IThermal.hal",
diff --git a/tv/cec/1.0/Android.bp b/tv/cec/1.0/Android.bp
index 4fd1b7e..bb1ae82 100644
--- a/tv/cec/1.0/Android.bp
+++ b/tv/cec/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tv.cec@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.cec@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.cec@1.0",
srcs: [
"types.hal",
"IHdmiCec.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.tv.cec@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.cec@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.cec@1.0",
srcs: [
"types.hal",
"IHdmiCec.hal",
@@ -51,9 +51,9 @@
"libutils",
"libcutils",
],
-export_shared_lib_headers: [
- "libhidl",
- "libhwbinder",
- "libutils",
+ export_shared_lib_headers: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
],
}
diff --git a/tv/cec/1.0/Android.mk b/tv/cec/1.0/Android.mk
index 8cc9c47..5d6f03f 100644
--- a/tv/cec/1.0/Android.mk
+++ b/tv/cec/1.0/Android.mk
@@ -149,6 +149,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (MaxLength)
+#
+GEN := $(intermediates)/android/hardware/tv/cec/1.0/MaxLength.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tv.cec@1.0::types.MaxLength
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (OptionKey)
#
GEN := $(intermediates)/android/hardware/tv/cec/1.0/OptionKey.java
@@ -388,6 +405,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (MaxLength)
+#
+GEN := $(intermediates)/android/hardware/tv/cec/1.0/MaxLength.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.tv.cec@1.0::types.MaxLength
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (OptionKey)
#
GEN := $(intermediates)/android/hardware/tv/cec/1.0/OptionKey.java
diff --git a/tv/cec/1.0/default/HdmiCec.cpp b/tv/cec/1.0/default/HdmiCec.cpp
index c4bae41..ebe2681 100644
--- a/tv/cec/1.0/default/HdmiCec.cpp
+++ b/tv/cec/1.0/default/HdmiCec.cpp
@@ -389,7 +389,7 @@
int ret = 0;
const hw_module_t* hw_module = nullptr;
- ret = hw_get_module (hal, &hw_module);
+ ret = hw_get_module (HDMI_CEC_HARDWARE_MODULE_ID, &hw_module);
if (ret == 0) {
ret = hdmi_cec_open (hw_module, &hdmi_cec_device);
if (ret != 0) {
diff --git a/tv/cec/1.0/default/HdmiCec.h b/tv/cec/1.0/default/HdmiCec.h
index 3e80cb1..49237d5 100644
--- a/tv/cec/1.0/default/HdmiCec.h
+++ b/tv/cec/1.0/default/HdmiCec.h
@@ -34,6 +34,7 @@
using ::android::hardware::tv::cec::V1_0::CecLogicalAddress;
using ::android::hardware::tv::cec::V1_0::CecMessage;
+using ::android::hardware::tv::cec::V1_0::MaxLength;
using ::android::hardware::tv::cec::V1_0::HdmiPortInfo;
using ::android::hardware::tv::cec::V1_0::IHdmiCec;
using ::android::hardware::tv::cec::V1_0::IHdmiCecCallback;
@@ -65,7 +66,8 @@
static void eventCallback(const hdmi_event_t* event, void* arg) {
if (mCallback != nullptr && event != nullptr) {
if (event->type == HDMI_EVENT_CEC_MESSAGE) {
- size_t length = std::min(event->cec.length, static_cast<size_t>(15));
+ size_t length = std::min(event->cec.length,
+ static_cast<size_t>(MaxLength::MESSAGE_BODY));
CecMessage cecMessage {
.initiator = static_cast<CecLogicalAddress>(event->cec.initiator),
.destination = static_cast<CecLogicalAddress>(event->cec.destination),
diff --git a/tv/cec/1.0/types.hal b/tv/cec/1.0/types.hal
index 421fe9c..ec2e373 100644
--- a/tv/cec/1.0/types.hal
+++ b/tv/cec/1.0/types.hal
@@ -16,6 +16,10 @@
package android.hardware.tv.cec@1.0;
+enum MaxLength : int32_t {
+ MESSAGE_BODY = 15,
+};
+
enum CecDeviceType : int32_t {
INACTIVE = -1,
TV = 0,
@@ -196,8 +200,8 @@
/* logical address of receiver */
CecLogicalAddress destination;
- /* The maximum size of body is 15 as specified in the section 6 of the CEC
- * Spec 1.4b. Overflowed data must be ignored. */
+ /* The maximum size of body is 15 (MaxLength::MESSAGE_BODY) as specified in
+ * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored. */
vec<uint8_t> body;
};
diff --git a/tv/input/1.0/Android.bp b/tv/input/1.0/Android.bp
index fa736b0..512634b 100644
--- a/tv/input/1.0/Android.bp
+++ b/tv/input/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.tv.input@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
srcs: [
"types.hal",
"ITvInput.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.tv.input@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tv.input@1.0",
srcs: [
"types.hal",
"ITvInput.hal",
@@ -56,5 +56,6 @@
"libhidl",
"libhwbinder",
"libutils",
+ "android.hardware.audio.common@2.0",
],
}
diff --git a/vehicle/2.0/Android.bp b/vehicle/2.0/Android.bp
index 27ac213..d51fe25 100644
--- a/vehicle/2.0/Android.bp
+++ b/vehicle/2.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.vehicle@2.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
srcs: [
"types.hal",
"IVehicle.hal",
@@ -18,8 +18,8 @@
genrule {
name: "android.hardware.vehicle@2.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
srcs: [
"types.hal",
"IVehicle.hal",
diff --git a/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp b/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp
index 0d2180f..910413e 100644
--- a/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp
+++ b/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp
@@ -40,7 +40,7 @@
}
float updatedRate = std::max(oldOpts.sampleRate, newOpts.sampleRate);
- SubscribeFlags updatedFlags = oldOpts.flags | newOpts.flags;
+ SubscribeFlags updatedFlags = SubscribeFlags(oldOpts.flags | newOpts.flags);
bool updated = updatedRate > oldOpts.sampleRate
|| updatedAreas != oldOpts.vehicleAreas
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
index cb551c1..b19621c 100644
--- a/vehicle/2.0/types.hal
+++ b/vehicle/2.0/types.hal
@@ -296,6 +296,20 @@
| VehicleArea:GLOBAL),
/*
+ * State of the vehicles turn signals
+ *
+ * Values from VehicleTurnSignal
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ TURN_SIGNAL_STATE = (
+ 0x0408
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
* Fan speed setting
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -2420,8 +2434,9 @@
UNDEFINED = 0x0,
/*
- * Subscribe to event that was originated in vehicle HAL (most luckly this
- * event came from vehicle itself). */
+ * Subscribe to event that was originated in vehicle HAL
+ * (most likely this event came from the vehicle itself).
+ */
HAL_EVENT = 0x1,
/*
@@ -2457,9 +2472,7 @@
*/
float sampleRate;
- /*
- * Flags that indicates what kind of events listen to.
- */
+ /* Flags that indicate what kind of events listen to. */
SubscribeFlags flags;
};
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
index 85bbc5e..faf4341 100644
--- a/vibrator/1.0/Android.bp
+++ b/vibrator/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.vibrator@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
srcs: [
"types.hal",
"IVibrator.hal",
@@ -16,8 +16,8 @@
genrule {
name: "android.hardware.vibrator@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vibrator@1.0",
srcs: [
"types.hal",
"IVibrator.hal",
diff --git a/vr/1.0/Android.bp b/vr/1.0/Android.bp
index eaed921..fc4619f 100644
--- a/vr/1.0/Android.bp
+++ b/vr/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.vr@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0",
srcs: [
"IVr.hal",
],
@@ -14,8 +14,8 @@
genrule {
name: "android.hardware.vr@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vr@1.0",
srcs: [
"IVr.hal",
],
diff --git a/vr/1.0/vts/Android.mk b/vr/1.0/vts/Android.mk
new file mode 100644
index 0000000..3c45652
--- /dev/null
+++ b/vr/1.0/vts/Android.mk
@@ -0,0 +1,85 @@
+#
+# Copyright (C) 2016 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build VTS driver for Vr v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_vr@1.0
+
+LOCAL_SRC_FILES := \
+ Vr.vts \
+
+LOCAL_C_INCLUDES := \
+ android.hardware.vr@1.0 \
+ system/core/base/include \
+ system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+ android.hardware.vr@1.0 \
+ libbase \
+ libutils \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_datatype \
+ libvts_measurement \
+ libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
+
+# build profiler for Vr.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_vr@1.0
+
+LOCAL_SRC_FILES := \
+ Vr.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.vr@1.0 \
+ libbase \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_multidevice_proto \
+ libvts_profiling \
+ libutils \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 7453fe7..b730931 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.wifi@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi@1.0",
srcs: [
"types.hal",
"IWifi.hal",
@@ -34,8 +34,8 @@
genrule {
name: "android.hardware.wifi@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi@1.0",
srcs: [
"types.hal",
"IWifi.hal",
diff --git a/wifi/supplicant/1.0/Android.bp b/wifi/supplicant/1.0/Android.bp
index d4247d2..08c6f9a 100644
--- a/wifi/supplicant/1.0/Android.bp
+++ b/wifi/supplicant/1.0/Android.bp
@@ -2,8 +2,8 @@
genrule {
name: "android.hardware.wifi.supplicant@1.0_genc++",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi.supplicant@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi.supplicant@1.0",
srcs: [
"types.hal",
"ISupplicant.hal",
@@ -38,8 +38,8 @@
genrule {
name: "android.hardware.wifi.supplicant@1.0_genc++_headers",
- tool: "hidl-gen",
- cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi.supplicant@1.0",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.wifi.supplicant@1.0",
srcs: [
"types.hal",
"ISupplicant.hal",
diff --git a/wifi/supplicant/1.0/ISupplicant.hal b/wifi/supplicant/1.0/ISupplicant.hal
index 64bbd7b..32d73da 100644
--- a/wifi/supplicant/1.0/ISupplicant.hal
+++ b/wifi/supplicant/1.0/ISupplicant.hal
@@ -141,4 +141,19 @@
* @return enabled true if set, false otherwise.
*/
isDebugShowKeysEnabled() generates (bool enabled);
+
+ /**
+ * Set concurrency priority.
+ *
+ * When both P2P and STA mode ifaces are active, this must be used
+ * to prioritize either STA or P2P connection to resolve conflicts
+ * arising during single channel concurrency.
+ *
+ * @param type The type of iface to prioritize.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ */
+ setConcurrencyPriority(IfaceType type) generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
index 06cd30e..48a4f5b 100644
--- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
@@ -24,6 +24,36 @@
* interface (e.g p2p0) it controls.
*/
interface ISupplicantP2pIface extends ISupplicantIface {
+ enum WpsProvisionMethod : uint32_t {
+ /**
+ * Push button method.
+ */
+ PBC,
+ /**
+ * Display pin method configuration - pin is generated and displayed on
+ * device.
+ */
+ DISPLAY,
+ /**
+ * Keypad pin method configuration - pin is entered on device.
+ */
+ KEYPAD,
+ /**
+ * Label pin method configuration - pin is labelled on device.
+ */
+ LABEL
+ };
+
+ enum GroupCapabilityMask : uint32_t {
+ GROUP_OWNER = 1 << 0,
+ PERSISTENT_GROUP = 1 << 1,
+ GROUP_LIMIT = 1 << 2,
+ INTRA_BSS_DIST = 1 << 3,
+ CROSS_CONN = 1 << 4,
+ PERSISTENT_RECONN = 1 << 5,
+ GROUP_FORMATION = 1 << 6
+ };
+
/**
* Register for callbacks from this interface.
*
@@ -42,4 +72,419 @@
*/
registerCallback(ISupplicantP2pIfaceCallback callback)
generates (SupplicantStatus status);
+
+ /**
+ * Gets the MAC address of the device.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * @return deviceAddress MAC address of the device.
+ */
+ getDeviceAddress()
+ generates (SupplicantStatus status, MacAddress deviceAddress);
+
+ /**
+ * Set the postfix to be used for P2P SSID's.
+ *
+ * @param postfix String to be appended to SSID.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ setSsidPostfix(string postfix) generates (SupplicantStatus status);
+
+ /**
+ * Set the Maximum idle time in seconds for P2P groups.
+ * This value controls how long a P2P group is maintained after there
+ * is no other members in the group. As a group owner, this means no
+ * associated stations in the group. As a P2P client, this means no
+ * group owner seen in scan results.
+ *
+ * @param timeoutInSec Timeout value in seconds.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ setGroupIdle(uint32_t timeoutInSec) generates (SupplicantStatus status);
+
+ /**
+ * Turn on/off power save mode for the interface.
+ *
+ * @param enable Indicate if power save is to be turned on/off.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
+ * |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
+ */
+ setPowerSave(bool enable) generates (SupplicantStatus status);
+
+ /**
+ * Initiate a P2P service discovery with an optional timeout.
+ *
+ * @param timeoutInSec Max time to be spent is peforming discovery.
+ * Set to 0 to indefinely continue discovery untill and explicit
+ * |stopFind| is sent.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ find(uint32_t timeoutInSec) generates (SupplicantStatus status);
+
+ /**
+ * Stop an ongoing P2P service discovery.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ stopFind() generates (SupplicantStatus status);
+
+ /**
+ * Flush P2P peer table and state.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ flush() generates (SupplicantStatus status);
+
+ /**
+ * Start P2P group formation with a discovered P2P peer. This includes
+ * optional group owner negotiation, group interface setup, provisioning,
+ * and establishing data connection.
+ *
+ * @param peerAddress MAC address of the device to connect to.
+ * @method provisionMethod Provisioning method to use.
+ * @param preSelectedPin Pin to be used, if |provisionMethod| uses one of the
+ * preselected |PIN*| methods.
+ * @param joinExistingGroup Indicates that this is a command to join an
+ * existing group as a client. It skips the group owner negotiation
+ * part. This must send a Provision Discovery Request message to the
+ * target group owner before associating for WPS provisioning.
+ * @param persistent Used to request a persistent group to be formed.
+ * @param goIntent Used to override the default Intent for this group owner
+ * negotiation (Values from 1-15). Refer to section 4.1.6 in
+ * Wi-Fi Peer-to-Peer (P2P) Technical Specification Version 1.7.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * @return generatedPin Pin generated, if |provisionMethod| uses one of the
+ * generated |PIN*| methods.
+ */
+ connect(MacAddress peerAddress,
+ WpsProvisionMethod provisionMethod,
+ vec<uint8_t> preSelectedPin,
+ bool joinExistingGroup,
+ bool persistent,
+ uint32_t goIntent)
+ generates (SupplicantStatus status, vec<uint8_t> generatedPin);
+
+ /**
+ * Cancel an ongoing P2P group formation and joining-a-group related
+ * operation. This operation unauthorizes the specific peer device (if any
+ * had been authorized to start group formation), stops P2P find (if in
+ * progress), stops pending operations for join-a-group, and removes the
+ * P2P group interface (if one was used) that is in the WPS provisioning
+ * step. If the WPS provisioning step has been completed, the group is not
+ * terminated.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_NOT_STARTED|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ cancelConnect() generates (SupplicantStatus status);
+
+ /**
+ * Send P2P provision discovery request to the specified peer. The
+ * parameters for this command are the P2P device address of the peer and the
+ * desired configuration method.
+ *
+ * @param peerAddress MAC address of the device to send discovery.
+ * @method provisionMethod Provisioning method to use.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ provisionDiscovery(MacAddress peerAddress,
+ WpsProvisionMethod provisionMethod)
+ generates (SupplicantStatus status);
+
+ /**
+ * Set up a P2P group owner manually (i.e., without group owner
+ * negotiation with a specific peer). This is also known as autonomous
+ * group owner. Optional |persistent| may be used to specify restart of a
+ * persistent group.
+ *
+ * @param persistent Used to request a persistent group to be formed.
+ * @param persistentNetworkId Used to specify the restart of a persistent
+ * group.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ addGroup(bool persistent, SupplicantNetworkId persistentNetworkId)
+ generates (SupplicantStatus status);
+
+ /**
+ * Terminate a P2P group. If a new virtual network interface was used for
+ * the group, it must also be removed. The network interface name of the
+ * group interface is used as a parameter for this command.
+ *
+ * @param groupIfName Group interface name to use.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ removeGroup(string groupIfName) generates (SupplicantStatus status);
+
+ /**
+ * Reject connection attempt from a peer (specified with a device
+ * address). This is a mechanism to reject a pending group owner negotiation
+ * with a peer and request to automatically block any further connection or
+ * discovery of the peer.
+ *
+ * @param peerAddress MAC address of the device to reject.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ reject(MacAddress peerAddress) generates (SupplicantStatus status);
+
+ /**
+ * Invite a device to a persistent group.
+ * If the peer device is the group owner of the persistent group, the peer
+ * parameter is not needed. Otherwise it is used to specify which
+ * device to invite. |goDeviceAddress| parameter may be used to override
+ * the group owner device address for Invitation Request should it not be
+ * known for some reason (this should not be needed in most cases).
+ *
+ * @param groupIfName Group interface name to use.
+ * @param goDeviceAddress MAC address of the group owner device.
+ * @param peerAddress MAC address of the device to invite.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ invite(string groupIfName, MacAddress goDeviceAddress, MacAddress peerAddress)
+ generates (SupplicantStatus status);
+
+ /**
+ * Reinvoke a device from a persistent group.
+ *
+ * @param persistentNetworkId Used to specify the persistent group.
+ * @param peerAddress MAC address of the device to reinvoke.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ reinvoke(SupplicantNetworkId persistentNetworkId, MacAddress peerAddress)
+ generates (SupplicantStatus status);
+
+ /**
+ * Configure Extended Listen Timing.
+ *
+ * If enabled, listen state must be entered every |intervalInMillis| for at
+ * least |periodInMillis|. Both values have acceptable range of 1-65535
+ * (with interval obviously having to be larger than or equal to duration).
+ * If the P2P module is not idle at the time the Extended Listen Timing
+ * timeout occurs, the Listen State operation must be skipped.
+ *
+ * @param periodInMillis Period in milliseconds.
+ * @param intervalInMillis Interval in milliseconds.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ configureExtListen(bool enable,
+ uint32_t periodInMillis,
+ uint32_t intervalInMillis)
+ generates (SupplicantStatus status);
+
+ /**
+ * Set P2P Listen channel.
+ *
+ * When specifying a social channel on the 2.4 GHz band (1/6/11) there is no
+ * need to specify the operating class since it defaults to 81. When
+ * specifying a social channel on the 60 GHz band (2), specify the 60 GHz
+ * operating class (180).
+ *
+ * @param channel Wifi channel. eg, 1, 6, 11.
+ * @param operatingClass Operating Class indicates the channel set of the AP
+ * indicated by this BSSID
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ setListenChannel(uint32_t channel, uint32_t operatingClass)
+ generates (SupplicantStatus status);
+
+ /**
+ * Gets the operational SSID of the device.
+ *
+ * @param peerAddress MAC address of the peer.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * @return ssid SSID of the device
+ */
+ getSsid(MacAddress peerAddress)
+ generates (SupplicantStatus status, Ssid ssid);
+
+ /**
+ * Gets the capability of the group which the device is a
+ * member of.
+ *
+ * @param peerAddress MAC address of the peer.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * @return capabilityMask Combination of |GroupCapabilityMask| values.
+ */
+ getGroupCapability(MacAddress peerAddress)
+ generates (SupplicantStatus status, uint32_t capabilities);
+
+ /**
+ * This command can be used to add a bonjour service.
+ *
+ * @param query Hex dump of the query data.
+ * @param return Hex dump of the response data.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ addBonjourService(vec<uint8_t> query, vec<uint8_t> response)
+ generates (SupplicantStatus status);
+
+ /**
+ * This command can be used to remove a bonjour service.
+ *
+ * @param query Hex dump of the query data.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_NOT_STARTED|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ removeBonjourService(vec<uint8_t> query) generates (SupplicantStatus status);
+
+ /**
+ * This command can be used to add a UPNP service.
+ *
+ * @param version Version to be used.
+ * @package serviceName Service name to be used.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ addUpnpService(uint32_t version, string serviceName)
+ generates (SupplicantStatus status);
+
+ /**
+ * This command can be used to remove a UPNP service.
+ *
+ * @param version Version to be used.
+ * @package serviceName Service name to be used.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_NOT_STARTED|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ removeUpnpService(uint32_t version, string serviceName)
+ generates (SupplicantStatus status);
+
+ /**
+ * This command can be used to flush all services from the
+ * device.
+ *
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ flushServices(uint32_t version, string serviceName)
+ generates (SupplicantStatus status);
+
+ /**
+ * Schedule a P2P service discovery request. The parameters for this command
+ * are the device address of the peer device (or 00:00:00:00:00:00 for
+ * wildcard query that is sent to every discovered P2P peer that supports
+ * service discovery) and P2P Service Query TLV(s) as hexdump.
+ *
+ * @param peerAddress MAC address of the device to discover.
+ * @param query Hex dump of the query data.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ * @return identifier Identifier for the request. Can be used to cancel the
+ * request.
+ */
+ requestServiceDiscovery(MacAddress peerAddress, vec<uint8_t> query)
+ generates (SupplicantStatus status, uint64_t identifier);
+
+ /**
+ * Cancel a previous service discovery request.
+ *
+ * @return identifier Identifier for the request to cancel.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_NOT_STARTED|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ cancelServiceDiscovery(uint64_t identifier)
+ generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.0/ISupplicantStaIface.hal b/wifi/supplicant/1.0/ISupplicantStaIface.hal
index a68e961..868758e 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIface.hal
@@ -25,6 +25,30 @@
*/
interface ISupplicantStaIface extends ISupplicantIface {
/**
+ * Access Network Query Protocol info ID elements
+ * for IEEE Std 802.11u-2011.
+ */
+ enum AnqpInfoId : uint32_t {
+ VENUE_NAME = 258,
+ ROAMING_CONSORTIUM = 261,
+ IP_ADDR_TYPE_AVAILABILITY = 262,
+ NAI_REALM = 263,
+ ANQP_3GPP_CELLULAR_NETWORK = 264,
+ DOMAIN_NAME = 268
+ };
+
+ /**
+ * Access Network Query Protocol subtype elements
+ * for Hotspot 2.0.
+ */
+ enum Hs20AnqpSubtypes : uint32_t {
+ OPERATOR_FRIENDLY_NAME = 2,
+ WAN_METRICS = 4,
+ CONNECTION_CAPABILITY = 5,
+ OSU_PROVIDERS_LIST = 8,
+ };
+
+ /**
* Register for callbacks from this interface.
*
* These callbacks are invoked for events that are specific to this interface.
@@ -133,4 +157,40 @@
*/
initiateTdlsTeardown(MacAddress macAddress)
generates (SupplicantStatus status);
+
+ /**
+ * Initiate ANQP (for IEEE 802.11u Interworking/Hotspot 2.0) queries with the
+ * specified access point.
+ * The ANQP data fetched must be returned in the
+ * |ISupplicantStaIfaceCallback.onAnqpQueryDone| callback.
+ *
+ * @param macAddress MAC address of the access point.
+ * @param infoElements List of information elements to query for.
+ * @param subtypes List of HS20 subtypes to query for.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ initiateAnqpQuery(MacAddress macAddress,
+ vec<AnqpInfoId> infoElements,
+ vec<Hs20AnqpSubtypes> subTypes)
+ generates (SupplicantStatus status);
+
+ /**
+ * Initiate the Hotspot 2.0 icon query with the specified accesss point.
+ * The icon data fetched must be returned in the
+ * |ISupplicantStaIfaceCallback.onHs20IconQueryDone| callback.
+ *
+ * @param macAddress MAC address of the access point.
+ * @param fileName Name of the file to request from the access point.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ initiateHs20IconQuery(MacAddress macAddress, string fileName)
+ generates (SupplicantStatus status);
};
diff --git a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
index 77423ed..4c66eba 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
@@ -105,6 +105,40 @@
};
/**
+ * OSU Method. Refer to section 4.8.1.3 of the Hotspot 2.0 spec.
+ */
+ enum OsuMethod : uint8_t {
+ OMA_DM = 0,
+ SOAP_XML_SPP = 1
+ };
+
+ /**
+ * ANQP data for IEEE Std 802.11u-2011.
+ * The format of the data within these elements follows the IEEE
+ * Std 802.11u-2011 standard.
+ */
+ struct AnqpData {
+ vec<uint8_t> venueName;
+ vec<uint8_t> roamingConsortium;
+ vec<uint8_t> ipAddrTypeAvailability;
+ vec<uint8_t> naiRealm;
+ vec<uint8_t> anqp3gppCellularNetwork;
+ vec<uint8_t> domainName;
+ };
+
+ /**
+ * ANQP data for Hotspot 2.0.
+ * The format of the data within these elements follows the Hotspot 2.0
+ * standard.
+ */
+ struct Hs20AnqpData {
+ vec<uint8_t> operatorFriendlyName;
+ vec<uint8_t> wanMetrics;
+ vec<uint8_t> connectionCapability;
+ vec<uint8_t> osuProvidersList;
+ };
+
+ /**
* Used to indicate that a new network has been added.
*
* @param id Network ID allocated to the corresponding network.
@@ -138,4 +172,49 @@
*/
oneway onStateChanged(
State newState, Bssid bssid, SupplicantNetworkId id, Ssid ssid);
+
+ /**
+ * Used to indicate the result of ANQP (either for IEEE 802.11u Interworking
+ * or Hotspot 2.0) query.
+ *
+ * @param macAddress MAC address of the access point.
+ * @param data ANQP data fetched from the access point.
+ * All the fields in this struct must be empty if the query failed.
+ * @param hs20Data ANQP data fetched from the Hotspot 2.0 access point.
+ * All the fields in this struct must be empty if the query failed.
+ */
+ oneway onAnqpQueryDone(MacAddress macAddress,
+ AnqpData data,
+ Hs20AnqpData hs20Data);
+
+ /**
+ * Used to indicate the result of Hotspot 2.0 Icon query.
+ *
+ * @param macAddress MAC address of the access point.
+ * @param fileName Name of the file that was requested.
+ * @param data Icon data fetched from the access point.
+ * Must be empty if the query failed.
+ */
+ oneway onHs20IconQueryDone(MacAddress macAddress,
+ string fileName,
+ vec<uint8_t> data);
+
+ /**
+ * Used to indicate a Hotspot 2.0 subscription remediation event.
+ *
+ * @param osuMethod OSU method.
+ * @param url URL of the server.
+ */
+ oneway onHs20SubscriptionRemediation(OsuMethod osuMethod, string url);
+
+ /**
+ * Used to indicate a Hotspot 2.0 imminent deauth notice.
+ * @param reasonCode Code to indicate the deauth reason.
+ * Refer to section 3.2.1.2 of the Hotspot 2.0 spec.
+ * @param reAuthDelayInSec Delay before reauthenticating.
+ * @param url URL of the server.
+ */
+ oneway onHs20DeauthImminentNotice(uint32_t reasonCode,
+ uint32_t reAuthDelayInSec,
+ string url);
};
diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
index d159c57..e414a07 100644
--- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal
@@ -150,6 +150,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -162,6 +163,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -187,6 +189,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -200,6 +203,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -213,6 +217,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -226,6 +231,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -240,6 +246,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -255,6 +262,7 @@
* |ParamSizeLimits.PSK_PASSPHRASE_MAX_LEN_IN_BYTES|.
* @return status Status of the operation.
* Possible status codes:
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.SUCCESS|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
@@ -273,6 +281,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -287,6 +296,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -313,6 +323,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -327,6 +338,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -340,6 +352,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -353,6 +366,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -366,6 +380,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -379,6 +394,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -391,6 +407,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -403,6 +420,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -415,6 +433,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -427,6 +446,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -439,6 +459,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -464,6 +485,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
@@ -476,6 +498,7 @@
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/