Merge "Added test for overloading." am: a3ba3c359c am: 51eac9ecae am: 0a94cf6e57
am: a8bebf4b23
Change-Id: Ief961afe9671dc9712e3eda0a7bbe397bdeb9f17
diff --git a/Android.bp b/Android.bp
index 5d7c8b8..4f13c3f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,6 +1,10 @@
// This is an autogenerated file, do not edit.
subdirs = [
+ "audio/common/2.0",
+ "audio/effect/2.0",
"benchmarks/msgq/1.0",
+ "memtrack/1.0",
+ "memtrack/1.0/default",
"nfc/1.0",
"nfc/1.0/default",
"radio/1.0",
@@ -11,6 +15,7 @@
"tests/libhwbinder/1.0",
"tests/msgq/1.0",
"tests/pointer/1.0",
+ "vibrator/1.0",
"wifi/1.0",
"wifi/supplicant/1.0",
]
diff --git a/audio/common/2.0/Android.bp b/audio/common/2.0/Android.bp
new file mode 100644
index 0000000..655c0c9
--- /dev/null
+++ b/audio/common/2.0/Android.bp
@@ -0,0 +1,38 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+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",
+ srcs: [
+ "types.hal",
+ ],
+ out: [
+ "android/hardware/audio/common/2.0/types.cpp",
+ ],
+}
+
+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",
+ srcs: [
+ "types.hal",
+ ],
+ out: [
+ "android/hardware/audio/common/2.0/types.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.audio.common@2.0",
+ generated_sources: ["android.hardware.audio.common@2.0_genc++"],
+ generated_headers: ["android.hardware.audio.common@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.audio.common@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
new file mode 100644
index 0000000..dd75706
--- /dev/null
+++ b/audio/common/2.0/types.hal
@@ -0,0 +1,925 @@
+/*
+ * 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.audio.common@2.0;
+
+/*
+ *
+ * IDs and Handles
+ *
+ */
+
+/*
+ * Handle type for identifying audio sources and sinks.
+ */
+typedef int32_t AudioIoHandle;
+
+/*
+ * Audio hw module handle functions or structures referencing a module.
+ */
+typedef int32_t AudioModuleHandle;
+
+/*
+ * Each port has a unique ID or handle allocated by policy manager.
+ */
+typedef int32_t AudioPortHandle;
+
+/*
+ * Each patch is identified by a handle at the interface used to create that
+ * patch. For instance, when a patch is created by the audio HAL, the HAL
+ * allocates and returns a handle. This handle is unique to a given audio HAL
+ * hardware module. But the same patch receives another system wide unique
+ * handle allocated by the framework. This unique handle is used for all
+ * transactions inside the framework.
+ */
+typedef int32_t AudioPatchHandle;
+
+/*
+ * A HW synchronization source returned by the audio HAL.
+ */
+typedef uint32_t AudioHwSync;
+
+/*
+ * Each port has a unique ID or handle allocated by policy manager.
+ */
+@export(name="")
+enum AudioHandleConsts {
+ AUDIO_IO_HANDLE_NONE = 0,
+ AUDIO_MODULE_HANDLE_NONE = 0,
+ AUDIO_PORT_HANDLE_NONE = 0,
+ AUDIO_PATCH_HANDLE_NONE = 0,
+};
+
+/*
+ * Commonly used structure for passing unique identifieds (UUID).
+ * For the definition of UUID, refer to ITU-T X.667 spec.
+ */
+struct Uuid {
+ uint32_t timeLow;
+ uint16_t timeMid;
+ uint16_t versionAndTimeHigh;
+ uint16_t variantAndClockSeqHigh;
+ uint8_t[6] node;
+};
+
+
+/*
+ *
+ * Audio streams
+ *
+ */
+
+/*
+ * Audio stream type describing the intented use case of a stream.
+ */
+@export(name="audio_stream_type_t")
+enum AudioStreamType : int32_t {
+ // These values must kept in sync with
+ // frameworks/base/media/java/android/media/AudioSystem.java
+ // TODO: Synchronization should be done automatically by tools
+ AUDIO_STREAM_DEFAULT = -1,
+ AUDIO_STREAM_MIN = 0,
+ AUDIO_STREAM_VOICE_CALL = 0,
+ AUDIO_STREAM_SYSTEM = 1,
+ AUDIO_STREAM_RING = 2,
+ AUDIO_STREAM_MUSIC = 3,
+ AUDIO_STREAM_ALARM = 4,
+ AUDIO_STREAM_NOTIFICATION = 5,
+ AUDIO_STREAM_BLUETOOTH_SCO = 6,
+ AUDIO_STREAM_ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user
+ // and must be routed to speaker
+ AUDIO_STREAM_DTMF = 8,
+ AUDIO_STREAM_TTS = 9, // Transmitted Through Speaker
+ // Plays over speaker only, silent
+ // on other devices
+ AUDIO_STREAM_ACCESSIBILITY = 10, // For accessibility talk back prompts
+ AUDIO_STREAM_REROUTING = 11, // For dynamic policy output mixes
+ AUDIO_STREAM_PATCH = 12, // For internal audio flinger tracks.
+ // Fixed volume
+ AUDIO_STREAM_PUBLIC_CNT = AUDIO_STREAM_TTS + 1,
+ // Number of streams considered by audio policy for volume and routing
+ AUDIO_STREAM_FOR_POLICY_CNT = AUDIO_STREAM_PATCH,
+ AUDIO_STREAM_CNT = AUDIO_STREAM_PATCH + 1
+};
+
+@export(name="audio_source_t")
+enum AudioSource {
+ // These values must kept in sync with
+ // frameworks/base/media/java/android/media/MediaRecorder.java,
+ // frameworks/av/services/audiopolicy/AudioPolicyService.cpp,
+ // system/media/audio_effects/include/audio_effects/audio_effects_conf.h
+ AUDIO_SOURCE_DEFAULT = 0,
+ AUDIO_SOURCE_MIC = 1,
+ AUDIO_SOURCE_VOICE_UPLINK = 2,
+ AUDIO_SOURCE_VOICE_DOWNLINK = 3,
+ AUDIO_SOURCE_VOICE_CALL = 4,
+ AUDIO_SOURCE_CAMCORDER = 5,
+ AUDIO_SOURCE_VOICE_RECOGNITION = 6,
+ AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
+ /*
+ * Source for the mix to be presented remotely. An example of remote
+ * presentation is Wifi Display where a dongle attached to a TV can be used
+ * to play the mix captured by this audio source.
+ */
+ AUDIO_SOURCE_REMOTE_SUBMIX = 8,
+ /*
+ * Source for unprocessed sound. Usage examples include level measurement
+ * and raw signal analysis.
+ */
+ AUDIO_SOURCE_UNPROCESSED = 9,
+
+ AUDIO_SOURCE_CNT,
+ AUDIO_SOURCE_MAX = AUDIO_SOURCE_CNT - 1,
+ AUDIO_SOURCE_FM_TUNER = 1998,
+ /*
+ * A low-priority, preemptible audio source for for background software
+ * hotword detection. Same tuning as AUDIO_SOURCE_VOICE_RECOGNITION.
+ * Used only internally to the framework.
+ */
+ AUDIO_SOURCE_HOTWORD = 1999
+};
+
+typedef int32_t AudioSession;
+/*
+ * Special audio session values.
+ */
+@export(name="audio_session_t")
+enum AudioSessionConsts : int32_t {
+ /*
+ * Session for effects attached to a particular output stream
+ * (value must be less than 0)
+ */
+ AUDIO_SESSION_OUTPUT_STAGE = -1,
+ /*
+ * Session for effects applied to output mix. These effects can
+ * be moved by audio policy manager to another output stream
+ * (value must be 0)
+ */
+ AUDIO_SESSION_OUTPUT_MIX = 0,
+ /*
+ * Application does not specify an explicit session ID to be used, and
+ * requests a new session ID to be allocated TODO use unique values for
+ * AUDIO_SESSION_OUTPUT_MIX and AUDIO_SESSION_ALLOCATE, after all uses have
+ * been updated from 0 to the appropriate symbol, and have been tested.
+ * Corresponds to AudioManager.AUDIO_SESSION_ID_GENERATE and
+ * AudioSystem.AUDIO_SESSION_ALLOCATE.
+ */
+ AUDIO_SESSION_ALLOCATE = 0,
+ /*
+ * For use with AudioRecord::start(), this indicates no trigger session.
+ * It is also used with output tracks and patch tracks, which never have a
+ * session.
+ */
+ AUDIO_SESSION_NONE = 0
+};
+
+/*
+ * Audio format is a 32-bit word that consists of:
+ * main format field (upper 8 bits)
+ * sub format field (lower 24 bits).
+ *
+ * The main format indicates the main codec type. The sub format field indicates
+ * options and parameters for each format. The sub format is mainly used for
+ * record to indicate for instance the requested bitrate or profile. It can
+ * also be used for certain formats to give informations not present in the
+ * encoded audio stream (e.g. octet alignement for AMR).
+ */
+@export(name="audio_format_t")
+enum AudioFormat : uint32_t {
+ AUDIO_FORMAT_INVALID = 0xFFFFFFFFUL,
+ AUDIO_FORMAT_DEFAULT = 0,
+ AUDIO_FORMAT_PCM = 0x00000000UL, /* DO NOT CHANGE */
+ AUDIO_FORMAT_MP3 = 0x01000000UL,
+ AUDIO_FORMAT_AMR_NB = 0x02000000UL,
+ AUDIO_FORMAT_AMR_WB = 0x03000000UL,
+ AUDIO_FORMAT_AAC = 0x04000000UL,
+ /* Deprecated, Use AUDIO_FORMAT_AAC_HE_V1*/
+ AUDIO_FORMAT_HE_AAC_V1 = 0x05000000UL,
+ /* Deprecated, Use AUDIO_FORMAT_AAC_HE_V2*/
+ AUDIO_FORMAT_HE_AAC_V2 = 0x06000000UL,
+ AUDIO_FORMAT_VORBIS = 0x07000000UL,
+ AUDIO_FORMAT_OPUS = 0x08000000UL,
+ AUDIO_FORMAT_AC3 = 0x09000000UL,
+ AUDIO_FORMAT_E_AC3 = 0x0A000000UL,
+ AUDIO_FORMAT_DTS = 0x0B000000UL,
+ AUDIO_FORMAT_DTS_HD = 0x0C000000UL,
+ // IEC61937 is encoded audio wrapped in 16-bit PCM.
+ AUDIO_FORMAT_IEC61937 = 0x0D000000UL,
+ AUDIO_FORMAT_DOLBY_TRUEHD = 0x0E000000UL,
+ AUDIO_FORMAT_MAIN_MASK = 0xFF000000UL, /* Deprecated */
+ AUDIO_FORMAT_SUB_MASK = 0x00FFFFFFUL,
+
+ /* Subformats */
+ AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1, // PCM signed 16 bits
+ AUDIO_FORMAT_PCM_SUB_8_BIT = 0x2, // PCM unsigned 8 bits
+ AUDIO_FORMAT_PCM_SUB_32_BIT = 0x3, // PCM signed .31 fixed point
+ AUDIO_FORMAT_PCM_SUB_8_24_BIT = 0x4, // PCM signed 8.23 fixed point
+ AUDIO_FORMAT_PCM_SUB_FLOAT = 0x5, // PCM single-precision float pt
+ AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED = 0x6, // PCM signed .23 fix pt (3 bytes)
+
+ AUDIO_FORMAT_MP3_SUB_NONE = 0x0,
+
+ AUDIO_FORMAT_AMR_SUB_NONE = 0x0,
+
+ AUDIO_FORMAT_AAC_SUB_MAIN = 0x1,
+ AUDIO_FORMAT_AAC_SUB_LC = 0x2,
+ AUDIO_FORMAT_AAC_SUB_SSR = 0x4,
+ AUDIO_FORMAT_AAC_SUB_LTP = 0x8,
+ AUDIO_FORMAT_AAC_SUB_HE_V1 = 0x10,
+ AUDIO_FORMAT_AAC_SUB_SCALABLE = 0x20,
+ AUDIO_FORMAT_AAC_SUB_ERLC = 0x40,
+ AUDIO_FORMAT_AAC_SUB_LD = 0x80,
+ AUDIO_FORMAT_AAC_SUB_HE_V2 = 0x100,
+ AUDIO_FORMAT_AAC_SUB_ELD = 0x200,
+
+ AUDIO_FORMAT_VORBIS_SUB_NONE = 0x0,
+
+ /* Aliases */
+ /* note != AudioFormat.ENCODING_PCM_16BIT */
+ AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_16_BIT),
+ /* note != AudioFormat.ENCODING_PCM_8BIT */
+ AUDIO_FORMAT_PCM_8_BIT = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_8_BIT),
+ AUDIO_FORMAT_PCM_32_BIT = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_32_BIT),
+ AUDIO_FORMAT_PCM_8_24_BIT = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_8_24_BIT),
+ AUDIO_FORMAT_PCM_FLOAT = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_FLOAT),
+ AUDIO_FORMAT_PCM_24_BIT_PACKED = (AUDIO_FORMAT_PCM |
+ AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED),
+ AUDIO_FORMAT_AAC_MAIN = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_MAIN),
+ AUDIO_FORMAT_AAC_LC = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_LC),
+ AUDIO_FORMAT_AAC_SSR = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_SSR),
+ AUDIO_FORMAT_AAC_LTP = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_LTP),
+ AUDIO_FORMAT_AAC_HE_V1 = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_HE_V1),
+ AUDIO_FORMAT_AAC_SCALABLE = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_SCALABLE),
+ AUDIO_FORMAT_AAC_ERLC = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_ERLC),
+ AUDIO_FORMAT_AAC_LD = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_LD),
+ AUDIO_FORMAT_AAC_HE_V2 = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_HE_V2),
+ AUDIO_FORMAT_AAC_ELD = (AUDIO_FORMAT_AAC |
+ AUDIO_FORMAT_AAC_SUB_ELD)
+};
+
+/*
+ * Usage of these values highlights places in the code that use 2- or 8- channel
+ * assumptions.
+ */
+@export(name="")
+enum FixedChannelCount {
+ FCC_2 = 2, // This is typically due to legacy implementation of stereo I/O
+ FCC_8 = 8 // This is typically due to audio mixer and resampler limitations
+};
+
+/*
+ * A channel mask per se only defines the presence or absence of a channel, not
+ * the order. See AUDIO_INTERLEAVE_* for the platform convention of order.
+ *
+ * AudioChannelMask is an opaque type and its internal layout should not be
+ * assumed as it may change in the future. Instead, always use functions
+ * to examine it.
+ *
+ * These are the current representations:
+ *
+ * AUDIO_CHANNEL_REPRESENTATION_POSITION
+ * is a channel mask representation for position assignment. Each low-order
+ * bit corresponds to the spatial position of a transducer (output), or
+ * interpretation of channel (input). The user of a channel mask needs to
+ * know the context of whether it is for output or input. The constants
+ * AUDIO_CHANNEL_OUT_* or AUDIO_CHANNEL_IN_* apply to the bits portion. It
+ * is not permitted for no bits to be set.
+ *
+ * AUDIO_CHANNEL_REPRESENTATION_INDEX
+ * is a channel mask representation for index assignment. Each low-order
+ * bit corresponds to a selected channel. There is no platform
+ * interpretation of the various bits. There is no concept of output or
+ * input. It is not permitted for no bits to be set.
+ *
+ * All other representations are reserved for future use.
+ *
+ * Warning: current representation distinguishes between input and output, but
+ * this will not the be case in future revisions of the platform. Wherever there
+ * is an ambiguity between input and output that is currently resolved by
+ * checking the channel mask, the implementer should look for ways to fix it
+ * with additional information outside of the mask.
+ */
+@export(name="")
+enum AudioChannelMask : uint32_t {
+ AUDIO_CHANNEL_REPRESENTATION_POSITION = 0, /* must be 0 for compatibility */
+ /* 1 is reserved for future use */
+ AUDIO_CHANNEL_REPRESENTATION_INDEX = 2,
+ /* 3 is reserved for future use */
+
+ /* These can be a complete value of AudioChannelMask */
+ AUDIO_CHANNEL_NONE = 0x0,
+ AUDIO_CHANNEL_INVALID = 0xC0000000,
+
+ /*
+ * These can be the bits portion of an AudioChannelMask
+ * with representation AUDIO_CHANNEL_REPRESENTATION_POSITION.
+ */
+
+ /* output channels */
+ AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1,
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2,
+ AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4,
+ AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8,
+ AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10,
+ AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20,
+ AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40,
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80,
+ AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100,
+ AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200,
+ AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400,
+ AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800,
+ AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000,
+ AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000,
+ AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000,
+ AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000,
+ AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000,
+ AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000,
+
+ AUDIO_CHANNEL_OUT_MONO = AUDIO_CHANNEL_OUT_FRONT_LEFT,
+ AUDIO_CHANNEL_OUT_STEREO = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT),
+ AUDIO_CHANNEL_OUT_QUAD = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_BACK_LEFT |
+ AUDIO_CHANNEL_OUT_BACK_RIGHT),
+ AUDIO_CHANNEL_OUT_QUAD_BACK = AUDIO_CHANNEL_OUT_QUAD,
+ /* like AUDIO_CHANNEL_OUT_QUAD_BACK with *_SIDE_* instead of *_BACK_* */
+ AUDIO_CHANNEL_OUT_QUAD_SIDE = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_SIDE_LEFT |
+ AUDIO_CHANNEL_OUT_SIDE_RIGHT),
+ AUDIO_CHANNEL_OUT_5POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_FRONT_CENTER |
+ AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
+ AUDIO_CHANNEL_OUT_BACK_LEFT |
+ AUDIO_CHANNEL_OUT_BACK_RIGHT),
+ AUDIO_CHANNEL_OUT_5POINT1_BACK = AUDIO_CHANNEL_OUT_5POINT1,
+ /* like AUDIO_CHANNEL_OUT_5POINT1_BACK with *_SIDE_* instead of *_BACK_* */
+ AUDIO_CHANNEL_OUT_5POINT1_SIDE = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_FRONT_CENTER |
+ AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
+ AUDIO_CHANNEL_OUT_SIDE_LEFT |
+ AUDIO_CHANNEL_OUT_SIDE_RIGHT),
+ /* matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND */
+ AUDIO_CHANNEL_OUT_7POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_FRONT_CENTER |
+ AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
+ AUDIO_CHANNEL_OUT_BACK_LEFT |
+ AUDIO_CHANNEL_OUT_BACK_RIGHT |
+ AUDIO_CHANNEL_OUT_SIDE_LEFT |
+ AUDIO_CHANNEL_OUT_SIDE_RIGHT),
+ AUDIO_CHANNEL_OUT_ALL = (AUDIO_CHANNEL_OUT_FRONT_LEFT |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT |
+ AUDIO_CHANNEL_OUT_FRONT_CENTER |
+ AUDIO_CHANNEL_OUT_LOW_FREQUENCY |
+ AUDIO_CHANNEL_OUT_BACK_LEFT |
+ AUDIO_CHANNEL_OUT_BACK_RIGHT |
+ AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
+ AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
+ AUDIO_CHANNEL_OUT_BACK_CENTER|
+ AUDIO_CHANNEL_OUT_SIDE_LEFT|
+ AUDIO_CHANNEL_OUT_SIDE_RIGHT|
+ AUDIO_CHANNEL_OUT_TOP_CENTER|
+ AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT|
+ AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER|
+ AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT|
+ AUDIO_CHANNEL_OUT_TOP_BACK_LEFT|
+ AUDIO_CHANNEL_OUT_TOP_BACK_CENTER|
+ AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT),
+
+ /* These are bits only, not complete values */
+
+ /* input channels */
+ AUDIO_CHANNEL_IN_LEFT = 0x4,
+ AUDIO_CHANNEL_IN_RIGHT = 0x8,
+ AUDIO_CHANNEL_IN_FRONT = 0x10,
+ AUDIO_CHANNEL_IN_BACK = 0x20,
+ AUDIO_CHANNEL_IN_LEFT_PROCESSED = 0x40,
+ AUDIO_CHANNEL_IN_RIGHT_PROCESSED = 0x80,
+ AUDIO_CHANNEL_IN_FRONT_PROCESSED = 0x100,
+ AUDIO_CHANNEL_IN_BACK_PROCESSED = 0x200,
+ AUDIO_CHANNEL_IN_PRESSURE = 0x400,
+ AUDIO_CHANNEL_IN_X_AXIS = 0x800,
+ AUDIO_CHANNEL_IN_Y_AXIS = 0x1000,
+ AUDIO_CHANNEL_IN_Z_AXIS = 0x2000,
+ AUDIO_CHANNEL_IN_VOICE_UPLINK = 0x4000,
+ AUDIO_CHANNEL_IN_VOICE_DNLINK = 0x8000,
+
+ AUDIO_CHANNEL_IN_MONO = AUDIO_CHANNEL_IN_FRONT,
+ AUDIO_CHANNEL_IN_STEREO = (AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT),
+ AUDIO_CHANNEL_IN_FRONT_BACK = (AUDIO_CHANNEL_IN_FRONT |
+ AUDIO_CHANNEL_IN_BACK),
+ AUDIO_CHANNEL_IN_ALL = (AUDIO_CHANNEL_IN_LEFT |
+ AUDIO_CHANNEL_IN_RIGHT |
+ AUDIO_CHANNEL_IN_FRONT |
+ AUDIO_CHANNEL_IN_BACK|
+ AUDIO_CHANNEL_IN_LEFT_PROCESSED |
+ AUDIO_CHANNEL_IN_RIGHT_PROCESSED |
+ AUDIO_CHANNEL_IN_FRONT_PROCESSED |
+ AUDIO_CHANNEL_IN_BACK_PROCESSED|
+ AUDIO_CHANNEL_IN_PRESSURE |
+ AUDIO_CHANNEL_IN_X_AXIS |
+ AUDIO_CHANNEL_IN_Y_AXIS |
+ AUDIO_CHANNEL_IN_Z_AXIS |
+ AUDIO_CHANNEL_IN_VOICE_UPLINK |
+ AUDIO_CHANNEL_IN_VOICE_DNLINK),
+
+ /*
+ * Expresses the convention when stereo audio samples are stored interleaved
+ * in an array. This should improve readability by allowing code to use
+ * symbolic indices instead of hard-coded [0] and [1].
+ *
+ * For multi-channel beyond stereo, the platform convention is that channels
+ * are interleaved in order from least significant channel mask bit to most
+ * significant channel mask bit, with unused bits skipped. Any exceptions
+ * to this convention will be noted at the appropriate API.
+ */
+ AUDIO_INTERLEAVE_LEFT = 0,
+ AUDIO_INTERLEAVE_RIGHT = 1,
+
+ AUDIO_CHANNEL_COUNT_MAX = 30,
+ AUDIO_CHANNEL_INDEX_HDR =
+ AUDIO_CHANNEL_REPRESENTATION_INDEX << AUDIO_CHANNEL_COUNT_MAX,
+ AUDIO_CHANNEL_INDEX_MASK_1 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 1) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_2 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 2) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_3 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 3) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_4 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 4) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_5 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 5) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_6 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 6) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_7 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 7) - 1),
+ AUDIO_CHANNEL_INDEX_MASK_8 = AUDIO_CHANNEL_INDEX_HDR | ((1 << 8) - 1)
+};
+
+/*
+ * Major modes for a mobile device. The current mode setting affects audio
+ * routing.
+ */
+@export(name="audio_mode_t")
+enum AudioMode {
+ AUDIO_MODE_INVALID = -2,
+ AUDIO_MODE_CURRENT = -1,
+ AUDIO_MODE_NORMAL = 0,
+ AUDIO_MODE_RINGTONE = 1,
+ AUDIO_MODE_IN_CALL = 2,
+ AUDIO_MODE_IN_COMMUNICATION = 3,
+
+ AUDIO_MODE_CNT,
+ AUDIO_MODE_MAX = AUDIO_MODE_CNT - 1,
+};
+
+@export(name="")
+enum AudioDevice : uint32_t {
+ AUDIO_DEVICE_NONE = 0x0,
+ /* reserved bits */
+ AUDIO_DEVICE_BIT_IN = 0x80000000,
+ AUDIO_DEVICE_BIT_DEFAULT = 0x40000000,
+ /* output devices */
+ AUDIO_DEVICE_OUT_EARPIECE = 0x1,
+ AUDIO_DEVICE_OUT_SPEAKER = 0x2,
+ AUDIO_DEVICE_OUT_WIRED_HEADSET = 0x4,
+ AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 0x8,
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 0x10,
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20,
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40,
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 0x80,
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100,
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200,
+ AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400,
+ AUDIO_DEVICE_OUT_HDMI = AUDIO_DEVICE_OUT_AUX_DIGITAL,
+ /* uses an analog connection (multiplexed over the USB pins for instance) */
+ AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800,
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000,
+ /* USB accessory mode: Android device is USB device and dock is USB host */
+ AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000,
+ /* USB host mode: Android device is USB host and dock is USB device */
+ AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000,
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000,
+ /* Telephony voice TX path */
+ AUDIO_DEVICE_OUT_TELEPHONY_TX = 0x10000,
+ /* Analog jack with line impedance detected */
+ AUDIO_DEVICE_OUT_LINE = 0x20000,
+ /* HDMI Audio Return Channel */
+ AUDIO_DEVICE_OUT_HDMI_ARC = 0x40000,
+ /* S/PDIF out */
+ AUDIO_DEVICE_OUT_SPDIF = 0x80000,
+ /* FM transmitter out */
+ AUDIO_DEVICE_OUT_FM = 0x100000,
+ /* Line out for av devices */
+ AUDIO_DEVICE_OUT_AUX_LINE = 0x200000,
+ /* limited-output speaker device for acoustic safety */
+ AUDIO_DEVICE_OUT_SPEAKER_SAFE = 0x400000,
+ AUDIO_DEVICE_OUT_IP = 0x800000,
+ /* audio bus implemented by the audio system (e.g an MOST stereo channel) */
+ AUDIO_DEVICE_OUT_BUS = 0x1000000,
+ AUDIO_DEVICE_OUT_DEFAULT = AUDIO_DEVICE_BIT_DEFAULT,
+ AUDIO_DEVICE_OUT_ALL = (AUDIO_DEVICE_OUT_EARPIECE |
+ AUDIO_DEVICE_OUT_SPEAKER |
+ AUDIO_DEVICE_OUT_WIRED_HEADSET |
+ AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT |
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER |
+ AUDIO_DEVICE_OUT_HDMI |
+ AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET |
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
+ AUDIO_DEVICE_OUT_USB_ACCESSORY |
+ AUDIO_DEVICE_OUT_USB_DEVICE |
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX |
+ AUDIO_DEVICE_OUT_TELEPHONY_TX |
+ AUDIO_DEVICE_OUT_LINE |
+ AUDIO_DEVICE_OUT_HDMI_ARC |
+ AUDIO_DEVICE_OUT_SPDIF |
+ AUDIO_DEVICE_OUT_FM |
+ AUDIO_DEVICE_OUT_AUX_LINE |
+ AUDIO_DEVICE_OUT_SPEAKER_SAFE |
+ AUDIO_DEVICE_OUT_IP |
+ AUDIO_DEVICE_OUT_BUS |
+ AUDIO_DEVICE_OUT_DEFAULT),
+ AUDIO_DEVICE_OUT_ALL_A2DP = (AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
+ AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER),
+ AUDIO_DEVICE_OUT_ALL_SCO = (AUDIO_DEVICE_OUT_BLUETOOTH_SCO |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET |
+ AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT),
+ AUDIO_DEVICE_OUT_ALL_USB = (AUDIO_DEVICE_OUT_USB_ACCESSORY |
+ AUDIO_DEVICE_OUT_USB_DEVICE),
+ /* input devices */
+ AUDIO_DEVICE_IN_COMMUNICATION = AUDIO_DEVICE_BIT_IN | 0x1,
+ AUDIO_DEVICE_IN_AMBIENT = AUDIO_DEVICE_BIT_IN | 0x2,
+ AUDIO_DEVICE_IN_BUILTIN_MIC = AUDIO_DEVICE_BIT_IN | 0x4,
+ AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = AUDIO_DEVICE_BIT_IN | 0x8,
+ AUDIO_DEVICE_IN_WIRED_HEADSET = AUDIO_DEVICE_BIT_IN | 0x10,
+ AUDIO_DEVICE_IN_AUX_DIGITAL = AUDIO_DEVICE_BIT_IN | 0x20,
+ AUDIO_DEVICE_IN_HDMI = AUDIO_DEVICE_IN_AUX_DIGITAL,
+ /* Telephony voice RX path */
+ AUDIO_DEVICE_IN_VOICE_CALL = AUDIO_DEVICE_BIT_IN | 0x40,
+ AUDIO_DEVICE_IN_TELEPHONY_RX = AUDIO_DEVICE_IN_VOICE_CALL,
+ AUDIO_DEVICE_IN_BACK_MIC = AUDIO_DEVICE_BIT_IN | 0x80,
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX = AUDIO_DEVICE_BIT_IN | 0x100,
+ AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x200,
+ AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x400,
+ AUDIO_DEVICE_IN_USB_ACCESSORY = AUDIO_DEVICE_BIT_IN | 0x800,
+ AUDIO_DEVICE_IN_USB_DEVICE = AUDIO_DEVICE_BIT_IN | 0x1000,
+ /* FM tuner input */
+ AUDIO_DEVICE_IN_FM_TUNER = AUDIO_DEVICE_BIT_IN | 0x2000,
+ /* TV tuner input */
+ AUDIO_DEVICE_IN_TV_TUNER = AUDIO_DEVICE_BIT_IN | 0x4000,
+ /* Analog jack with line impedance detected */
+ AUDIO_DEVICE_IN_LINE = AUDIO_DEVICE_BIT_IN | 0x8000,
+ /* S/PDIF in */
+ AUDIO_DEVICE_IN_SPDIF = AUDIO_DEVICE_BIT_IN | 0x10000,
+ AUDIO_DEVICE_IN_BLUETOOTH_A2DP = AUDIO_DEVICE_BIT_IN | 0x20000,
+ AUDIO_DEVICE_IN_LOOPBACK = AUDIO_DEVICE_BIT_IN | 0x40000,
+ AUDIO_DEVICE_IN_IP = AUDIO_DEVICE_BIT_IN | 0x80000,
+ /* audio bus implemented by the audio system (e.g an MOST stereo channel) */
+ AUDIO_DEVICE_IN_BUS = AUDIO_DEVICE_BIT_IN | 0x100000,
+ AUDIO_DEVICE_IN_DEFAULT = AUDIO_DEVICE_BIT_IN |
+ AUDIO_DEVICE_BIT_DEFAULT,
+
+ AUDIO_DEVICE_IN_ALL = (AUDIO_DEVICE_IN_COMMUNICATION |
+ AUDIO_DEVICE_IN_AMBIENT |
+ AUDIO_DEVICE_IN_BUILTIN_MIC |
+ AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET |
+ AUDIO_DEVICE_IN_WIRED_HEADSET |
+ AUDIO_DEVICE_IN_HDMI |
+ AUDIO_DEVICE_IN_TELEPHONY_RX |
+ AUDIO_DEVICE_IN_BACK_MIC |
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX |
+ AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET |
+ AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET |
+ AUDIO_DEVICE_IN_USB_ACCESSORY |
+ AUDIO_DEVICE_IN_USB_DEVICE |
+ AUDIO_DEVICE_IN_FM_TUNER |
+ AUDIO_DEVICE_IN_TV_TUNER |
+ AUDIO_DEVICE_IN_LINE |
+ AUDIO_DEVICE_IN_SPDIF |
+ AUDIO_DEVICE_IN_BLUETOOTH_A2DP |
+ AUDIO_DEVICE_IN_LOOPBACK |
+ AUDIO_DEVICE_IN_IP |
+ AUDIO_DEVICE_IN_BUS |
+ AUDIO_DEVICE_IN_DEFAULT),
+ AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
+ AUDIO_DEVICE_IN_ALL_USB = (AUDIO_DEVICE_IN_USB_ACCESSORY |
+ AUDIO_DEVICE_IN_USB_DEVICE),
+};
+
+/*
+ * The audio output flags serve two purposes:
+ *
+ * - when an AudioTrack is created they indicate a "wish" to be connected to an
+ * output stream with attributes corresponding to the specified flags;
+ *
+ * - when present in an output profile descriptor listed for a particular audio
+ * hardware module, they indicate that an output stream can be opened that
+ * supports the attributes indicated by the flags.
+ *
+ * The audio policy manager will try to match the flags in the request
+ * (when getOuput() is called) to an available output stream.
+ */
+@export(name="audio_output_flags_t")
+enum AudioOutputFlag {
+ AUDIO_OUTPUT_FLAG_NONE = 0x0, // no attributes
+ AUDIO_OUTPUT_FLAG_DIRECT = 0x1, // this output directly connects a track
+ // to one output stream: no software mixer
+ AUDIO_OUTPUT_FLAG_PRIMARY = 0x2, // this output is the primary output of
+ // the device. It is unique and must be
+ // present. It is opened by default and
+ // receives routing, audio mode and volume
+ // controls related to voice calls.
+ AUDIO_OUTPUT_FLAG_FAST = 0x4, // output supports "fast tracks",
+ // defined elsewhere
+ AUDIO_OUTPUT_FLAG_DEEP_BUFFER = 0x8, // use deep audio buffers
+ AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD = 0x10, // offload playback of compressed
+ // streams to hardware codec
+ AUDIO_OUTPUT_FLAG_NON_BLOCKING = 0x20, // use non-blocking write
+ AUDIO_OUTPUT_FLAG_HW_AV_SYNC = 0x40, // output uses a hardware A/V sync
+ AUDIO_OUTPUT_FLAG_TTS = 0x80, // output for streams transmitted through
+ // speaker at a sample rate high enough
+ // to accommodate lower-range ultrasonic p/b
+ AUDIO_OUTPUT_FLAG_RAW = 0x100, // minimize signal processing
+ AUDIO_OUTPUT_FLAG_SYNC = 0x200, // synchronize I/O streams
+ AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO = 0x400, // Audio stream contains
+ // compressed audio in
+ // SPDIF data bursts, not PCM.
+};
+
+/*
+ * The audio input flags are analogous to audio output flags.
+ * Currently they are used only when an AudioRecord is created,
+ * to indicate a preference to be connected to an input stream with
+ * attributes corresponding to the specified flags.
+ */
+@export(name="audio_input_flags_t")
+enum AudioInputFlags {
+ AUDIO_INPUT_FLAG_NONE = 0x0, // no attributes
+ AUDIO_INPUT_FLAG_FAST = 0x1, // prefer an input that supports
+ // "fast tracks"
+ AUDIO_INPUT_FLAG_HW_HOTWORD = 0x2, // prefer an input that captures from
+ // hw hotword source
+ AUDIO_INPUT_FLAG_RAW = 0x4, // minimize signal processing
+ AUDIO_INPUT_FLAG_SYNC = 0x8, // synchronize I/O streams
+};
+
+/*
+ * Additional information about the stream passed to hardware decoders.
+ */
+struct AudioOffloadInfo {
+ uint32_t sampleRateHz;
+ AudioChannelMask channelMask;
+ AudioFormat format;
+ AudioStreamType streamType;
+ uint32_t bitRatePerSecond;
+ int64_t durationMicroseconds; // -1 if unknown
+ bool hasVideo;
+ bool isStreaming;
+};
+
+/*
+ * Commonly used audio stream configuration parameters.
+ */
+struct AudioConfig {
+ uint32_t sampleRateHz;
+ AudioChannelMask channelMask;
+ AudioFormat format;
+ AudioOffloadInfo offloadInfo;
+ uint64_t frameCount;
+};
+
+
+/*
+ *
+ * Volume control
+ *
+ */
+
+/*
+ * Type of gain control exposed by an audio port.
+ */
+@export(name="")
+enum AudioGainMode : uint32_t {
+ AUDIO_GAIN_MODE_JOINT = 0x1, // supports joint channel gain control
+ AUDIO_GAIN_MODE_CHANNELS = 0x2, // supports separate channel gain control
+ AUDIO_GAIN_MODE_RAMP = 0x4 // supports gain ramps
+};
+
+/*
+ * An audio_gain struct is a representation of a gain stage.
+ * A gain stage is always attached to an audio port.
+ */
+struct AudioGain {
+ AudioGainMode mode;
+ AudioChannelMask channelMask; // channels which gain an be controlled
+ int32_t minValue; // minimum gain value in millibels
+ int32_t maxValue; // maximum gain value in millibels
+ int32_t defaultValue; // default gain value in millibels
+ uint32_t stepValue; // gain step in millibels
+ uint32_t minRampMs; // minimum ramp duration in ms
+ uint32_t maxRampMs; // maximum ramp duration in ms
+};
+
+/*
+ * The gain configuration structure is used to get or set the gain values of a
+ * given port.
+ */
+struct AudioGainConfig {
+ int32_t index; // index of the corresponding AudioGain in AudioPort.gains
+ AudioGainMode mode;
+ AudioChannelMask channelMask; // channels which gain value follows
+ /*
+ * 4 = sizeof(AudioChannelMask),
+ * 8 is not "FCC_8", so it won't need to be changed for > 8 channels.
+ * Gain values in millibels for each channel ordered from LSb to MSb in
+ * channel mask. The number of values is 1 in joint mode or
+ * popcount(channel_mask).
+ */
+ int32_t[4 * 8] values;
+ uint32_t rampDurationMs; // ramp duration in ms
+};
+
+
+/*
+ *
+ * Routing control
+ *
+ */
+
+/*
+ * Types defined here are used to describe an audio source or sink at internal
+ * framework interfaces (audio policy, patch panel) or at the audio HAL.
+ * Sink and sources are grouped in a concept of “audio port” representing an
+ * audio end point at the edge of the system managed by the module exposing
+ * the interface.
+ */
+
+/* Audio port role: either source or sink */
+@export(name="audio_port_role_t")
+enum AudioPortRole {
+ AUDIO_PORT_ROLE_NONE,
+ AUDIO_PORT_ROLE_SOURCE,
+ AUDIO_PORT_ROLE_SINK,
+};
+
+/*
+ * Audio port type indicates if it is a session (e.g AudioTrack),
+ * a mix (e.g PlaybackThread output) or a physical device
+ * (e.g AUDIO_DEVICE_OUT_SPEAKER)
+ */
+@export(name="audio_port_type_t")
+enum AudioPortType {
+ AUDIO_PORT_TYPE_NONE,
+ AUDIO_PORT_TYPE_DEVICE,
+ AUDIO_PORT_TYPE_MIX,
+ AUDIO_PORT_TYPE_SESSION,
+};
+
+/*
+ * Extension for audio port configuration structure when the audio port is a
+ * hardware device.
+ */
+struct AudioPortConfigDeviceExt {
+ AudioModuleHandle hwModule; // module the device is attached to
+ AudioDevice type; // device type (e.g AUDIO_DEVICE_OUT_SPEAKER)
+ uint8_t[32] address; // device address. "" if N/A
+};
+
+/*
+ * Extension for audio port configuration structure when the audio port is an
+ * audio session.
+ */
+struct AudioPortConfigSessionExt {
+ AudioSession session;
+};
+
+/*
+ * Flags indicating which fields are to be considered in AudioPortConfig.
+ */
+@export(name="")
+enum AudioPortConfigMask : uint32_t {
+ AUDIO_PORT_CONFIG_SAMPLE_RATE = 0x1,
+ AUDIO_PORT_CONFIG_CHANNEL_MASK = 0x2,
+ AUDIO_PORT_CONFIG_FORMAT = 0x4,
+ AUDIO_PORT_CONFIG_GAIN = 0x8,
+ AUDIO_PORT_CONFIG_ALL = AUDIO_PORT_CONFIG_SAMPLE_RATE |
+ AUDIO_PORT_CONFIG_CHANNEL_MASK |
+ AUDIO_PORT_CONFIG_FORMAT |
+ AUDIO_PORT_CONFIG_GAIN
+};
+
+/*
+ * Audio port configuration structure used to specify a particular configuration
+ * of an audio port.
+ */
+struct AudioPortConfig {
+ AudioPortHandle id;
+ AudioPortConfigMask configMask;
+ uint32_t sampleRateHz;
+ AudioChannelMask channelMask;
+ AudioFormat format;
+ AudioGainConfig gain;
+ AudioPortType type; // type is used as a discriminator for Ext union
+ AudioPortRole role; // role is used as a discriminator for UseCase union
+ union Ext {
+ AudioPortConfigDeviceExt device;
+ struct AudioPortConfigMixExt {
+ AudioModuleHandle hwModule; // module the stream is attached to
+ AudioIoHandle ioHandle; // I/O handle of the input/output stream
+ union UseCase {
+ AudioStreamType stream;
+ AudioSource source;
+ };
+ } mix;
+ AudioPortConfigSessionExt session;
+ };
+};
+
+/*
+ * Extension for audio port structure when the audio port is a hardware device.
+ */
+struct AudioPortDeviceExt {
+ AudioModuleHandle hwModule; // module the device is attached to
+ AudioDevice type;
+ uint8_t[32] address;
+};
+
+/*
+ * Latency class of the audio mix.
+ */
+@export(name="audio_mix_latency_class_t")
+enum AudioMixLatencyClass {
+ AUDIO_LATENCY_LOW,
+ AUDIO_LATENCY_NORMAL
+} ;
+
+struct AudioPortMixExt {
+ AudioModuleHandle hwModule; // module the stream is attached to
+ AudioIoHandle ioHandle; // I/O handle of the stream
+ AudioMixLatencyClass latencyClass;
+};
+
+/*
+ * Extension for audio port structure when the audio port is an audio session.
+ */
+struct AudioPortSessionExt {
+ AudioSession session;
+};
+
+struct AudioPort {
+ AudioPortHandle id;
+ AudioPortRole role;
+ string name;
+ vec<uint32_t> sampleRates;
+ vec<AudioChannelMask> channelMasks;
+ vec<AudioFormat> formats;
+ vec<AudioGain> gains;
+ AudioPortConfig activeConfig; // current audio port configuration
+ AudioPortType type; // type is used as a discriminator
+ union Ext {
+ 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;
+};
diff --git a/audio/effect/2.0/Android.bp b/audio/effect/2.0/Android.bp
new file mode 100644
index 0000000..4dd2b1e
--- /dev/null
+++ b/audio/effect/2.0/Android.bp
@@ -0,0 +1,151 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+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",
+ srcs: [
+ "types.hal",
+ "IAcousticEchoCancelerEffect.hal",
+ "IAutomaticGainControlEffect.hal",
+ "IBassBoostEffect.hal",
+ "IDownmixEffect.hal",
+ "IEffect.hal",
+ "IEffectBufferProviderCallback.hal",
+ "IEffectsFactory.hal",
+ "IEnvironmentalReverbEffect.hal",
+ "IEqualizerEffect.hal",
+ "ILoudnessEnhancerEffect.hal",
+ "INoiseSuppressionEffect.hal",
+ "IPresetReverbEffect.hal",
+ "IVirtualizerEffect.hal",
+ "IVisualizerEffect.hal",
+ ],
+ out: [
+ "android/hardware/audio/effect/2.0/types.cpp",
+ "android/hardware/audio/effect/2.0/AcousticEchoCancelerEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/AutomaticGainControlEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/BassBoostEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/DownmixEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/EffectAll.cpp",
+ "android/hardware/audio/effect/2.0/EffectBufferProviderCallbackAll.cpp",
+ "android/hardware/audio/effect/2.0/EffectsFactoryAll.cpp",
+ "android/hardware/audio/effect/2.0/EnvironmentalReverbEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/EqualizerEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/LoudnessEnhancerEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/NoiseSuppressionEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/PresetReverbEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/VirtualizerEffectAll.cpp",
+ "android/hardware/audio/effect/2.0/VisualizerEffectAll.cpp",
+ ],
+}
+
+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",
+ srcs: [
+ "types.hal",
+ "IAcousticEchoCancelerEffect.hal",
+ "IAutomaticGainControlEffect.hal",
+ "IBassBoostEffect.hal",
+ "IDownmixEffect.hal",
+ "IEffect.hal",
+ "IEffectBufferProviderCallback.hal",
+ "IEffectsFactory.hal",
+ "IEnvironmentalReverbEffect.hal",
+ "IEqualizerEffect.hal",
+ "ILoudnessEnhancerEffect.hal",
+ "INoiseSuppressionEffect.hal",
+ "IPresetReverbEffect.hal",
+ "IVirtualizerEffect.hal",
+ "IVisualizerEffect.hal",
+ ],
+ out: [
+ "android/hardware/audio/effect/2.0/types.h",
+ "android/hardware/audio/effect/2.0/IAcousticEchoCancelerEffect.h",
+ "android/hardware/audio/effect/2.0/IHwAcousticEchoCancelerEffect.h",
+ "android/hardware/audio/effect/2.0/BnAcousticEchoCancelerEffect.h",
+ "android/hardware/audio/effect/2.0/BpAcousticEchoCancelerEffect.h",
+ "android/hardware/audio/effect/2.0/BsAcousticEchoCancelerEffect.h",
+ "android/hardware/audio/effect/2.0/IAutomaticGainControlEffect.h",
+ "android/hardware/audio/effect/2.0/IHwAutomaticGainControlEffect.h",
+ "android/hardware/audio/effect/2.0/BnAutomaticGainControlEffect.h",
+ "android/hardware/audio/effect/2.0/BpAutomaticGainControlEffect.h",
+ "android/hardware/audio/effect/2.0/BsAutomaticGainControlEffect.h",
+ "android/hardware/audio/effect/2.0/IBassBoostEffect.h",
+ "android/hardware/audio/effect/2.0/IHwBassBoostEffect.h",
+ "android/hardware/audio/effect/2.0/BnBassBoostEffect.h",
+ "android/hardware/audio/effect/2.0/BpBassBoostEffect.h",
+ "android/hardware/audio/effect/2.0/BsBassBoostEffect.h",
+ "android/hardware/audio/effect/2.0/IDownmixEffect.h",
+ "android/hardware/audio/effect/2.0/IHwDownmixEffect.h",
+ "android/hardware/audio/effect/2.0/BnDownmixEffect.h",
+ "android/hardware/audio/effect/2.0/BpDownmixEffect.h",
+ "android/hardware/audio/effect/2.0/BsDownmixEffect.h",
+ "android/hardware/audio/effect/2.0/IEffect.h",
+ "android/hardware/audio/effect/2.0/IHwEffect.h",
+ "android/hardware/audio/effect/2.0/BnEffect.h",
+ "android/hardware/audio/effect/2.0/BpEffect.h",
+ "android/hardware/audio/effect/2.0/BsEffect.h",
+ "android/hardware/audio/effect/2.0/IEffectBufferProviderCallback.h",
+ "android/hardware/audio/effect/2.0/IHwEffectBufferProviderCallback.h",
+ "android/hardware/audio/effect/2.0/BnEffectBufferProviderCallback.h",
+ "android/hardware/audio/effect/2.0/BpEffectBufferProviderCallback.h",
+ "android/hardware/audio/effect/2.0/BsEffectBufferProviderCallback.h",
+ "android/hardware/audio/effect/2.0/IEffectsFactory.h",
+ "android/hardware/audio/effect/2.0/IHwEffectsFactory.h",
+ "android/hardware/audio/effect/2.0/BnEffectsFactory.h",
+ "android/hardware/audio/effect/2.0/BpEffectsFactory.h",
+ "android/hardware/audio/effect/2.0/BsEffectsFactory.h",
+ "android/hardware/audio/effect/2.0/IEnvironmentalReverbEffect.h",
+ "android/hardware/audio/effect/2.0/IHwEnvironmentalReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BnEnvironmentalReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BpEnvironmentalReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BsEnvironmentalReverbEffect.h",
+ "android/hardware/audio/effect/2.0/IEqualizerEffect.h",
+ "android/hardware/audio/effect/2.0/IHwEqualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BnEqualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BpEqualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BsEqualizerEffect.h",
+ "android/hardware/audio/effect/2.0/ILoudnessEnhancerEffect.h",
+ "android/hardware/audio/effect/2.0/IHwLoudnessEnhancerEffect.h",
+ "android/hardware/audio/effect/2.0/BnLoudnessEnhancerEffect.h",
+ "android/hardware/audio/effect/2.0/BpLoudnessEnhancerEffect.h",
+ "android/hardware/audio/effect/2.0/BsLoudnessEnhancerEffect.h",
+ "android/hardware/audio/effect/2.0/INoiseSuppressionEffect.h",
+ "android/hardware/audio/effect/2.0/IHwNoiseSuppressionEffect.h",
+ "android/hardware/audio/effect/2.0/BnNoiseSuppressionEffect.h",
+ "android/hardware/audio/effect/2.0/BpNoiseSuppressionEffect.h",
+ "android/hardware/audio/effect/2.0/BsNoiseSuppressionEffect.h",
+ "android/hardware/audio/effect/2.0/IPresetReverbEffect.h",
+ "android/hardware/audio/effect/2.0/IHwPresetReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BnPresetReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BpPresetReverbEffect.h",
+ "android/hardware/audio/effect/2.0/BsPresetReverbEffect.h",
+ "android/hardware/audio/effect/2.0/IVirtualizerEffect.h",
+ "android/hardware/audio/effect/2.0/IHwVirtualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BnVirtualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BpVirtualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BsVirtualizerEffect.h",
+ "android/hardware/audio/effect/2.0/IVisualizerEffect.h",
+ "android/hardware/audio/effect/2.0/IHwVisualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BnVisualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BpVisualizerEffect.h",
+ "android/hardware/audio/effect/2.0/BsVisualizerEffect.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.audio.effect@2.0",
+ generated_sources: ["android.hardware.audio.effect@2.0_genc++"],
+ generated_headers: ["android.hardware.audio.effect@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.audio.effect@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ "android.hardware.audio.common@2.0",
+ ],
+}
diff --git a/audio/effect/2.0/IAcousticEchoCancelerEffect.hal b/audio/effect/2.0/IAcousticEchoCancelerEffect.hal
new file mode 100644
index 0000000..9e2e0c3
--- /dev/null
+++ b/audio/effect/2.0/IAcousticEchoCancelerEffect.hal
@@ -0,0 +1,32 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IAcousticEchoCancelerEffect extends IEffect {
+ /*
+ * Sets echo delay value in milliseconds.
+ */
+ setEchoDelay(uint32_t echoDelayMs) generates (Result retval);
+
+ /*
+ * Gets echo delay value in milliseconds.
+ */
+ getEchoDelay() generates (Result retval, uint32_t echoDelayMs);
+};
diff --git a/audio/effect/2.0/IAutomaticGainControlEffect.hal b/audio/effect/2.0/IAutomaticGainControlEffect.hal
new file mode 100644
index 0000000..a02002d
--- /dev/null
+++ b/audio/effect/2.0/IAutomaticGainControlEffect.hal
@@ -0,0 +1,68 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IAutomaticGainControlEffect extends IEffect {
+ /*
+ * Sets target level in millibels.
+ */
+ setTargetLevel(int16_t targetLevelMb) generates (Result retval);
+
+ /*
+ * Gets target level.
+ */
+ getTargetLevel() generates (Result retval, int16_t targetLevelMb);
+
+ /*
+ * Sets gain in the compression range in millibels.
+ */
+ setCompGain(int16_t compGainMb) generates (Result retval);
+
+ /*
+ * Gets gain in the compression range.
+ */
+ getCompGain() generates (Result retval, int16_t compGainMb);
+
+ /*
+ * Enables or disables limiter.
+ */
+ setLimiterEnabled(bool enabled) generates (Result retval);
+
+ /*
+ * Returns whether limiter is enabled.
+ */
+ isLimiterEnabled() generates (Result retval, bool enabled);
+
+ struct AllProperties {
+ int16_t targetLevelMb;
+ int16_t compGainMb;
+ bool limiterEnabled;
+ };
+
+ /*
+ * Sets all properties at once.
+ */
+ setAllProperties(AllProperties properties) generates (Result retval);
+
+ /*
+ * Gets all properties at once.
+ */
+ getAllProperties() generates (Result retval, AllProperties properties);
+};
diff --git a/audio/effect/2.0/IBassBoostEffect.hal b/audio/effect/2.0/IBassBoostEffect.hal
new file mode 100644
index 0000000..bcf7b7d
--- /dev/null
+++ b/audio/effect/2.0/IBassBoostEffect.hal
@@ -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.
+ */
+
+package android.hardware.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IBassBoostEffect extends IEffect {
+ /*
+ * Returns whether setting bass boost strength is supported.
+ */
+ isStrengthSupported() generates (Result retval, bool strengthSupported);
+
+ enum StrengthRange : uint16_t {
+ MIN = 0,
+ MAX = 1000
+ };
+
+ /*
+ * Sets bass boost strength.
+ *
+ * @param strength strength of the effect. The valid range for strength
+ * strength is [0, 1000], where 0 per mille designates the
+ * mildest effect and 1000 per mille designates the
+ * strongest.
+ * @return retval operation completion status.
+ */
+ setStrength(uint16_t strength) generates (Result retval);
+
+ /*
+ * Gets virtualization strength.
+ */
+ getStrength() generates (Result retval, uint16_t strength);
+};
diff --git a/audio/effect/2.0/IDownmixEffect.hal b/audio/effect/2.0/IDownmixEffect.hal
new file mode 100644
index 0000000..817e14c
--- /dev/null
+++ b/audio/effect/2.0/IDownmixEffect.hal
@@ -0,0 +1,31 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IDownmixEffect extends IEffect {
+ enum Type {
+ STRIP, // throw away the extra channels
+ FOLD // mix the extra channels with FL/FR
+ };
+
+ setType(Type preset) generates (Result retval);
+
+ getType() generates (Result retval, Type preset);
+};
diff --git a/audio/effect/2.0/IEffect.hal b/audio/effect/2.0/IEffect.hal
new file mode 100644
index 0000000..f1cc795
--- /dev/null
+++ b/audio/effect/2.0/IEffect.hal
@@ -0,0 +1,311 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffectBufferProviderCallback;
+
+interface IEffect {
+ /*
+ * Initialize effect engine--all configurations return to default.
+ *
+ * @return retval operation completion status.
+ */
+ @entry
+ @callflow(next={"*"})
+ init() generates (Result retval);
+
+ /*
+ * Apply new audio parameters configurations for input and output buffers.
+ * The provider callbacks may be empty, but in this case the buffer
+ * must be provided in the EffectConfig structure.
+ *
+ * @param config configuration descriptor.
+ * @param inputBufferProvider optional buffer provider reference.
+ * @param outputBufferProvider optional buffer provider reference.
+ * @return retval operation completion status.
+ */
+ @callflow(next={"*"})
+ setConfig(EffectConfig config,
+ IEffectBufferProviderCallback inputBufferProvider,
+ IEffectBufferProviderCallback outputBufferProvider)
+ generates (Result retval);
+
+ /*
+ * Reset the effect engine. Keep configuration but resets state and buffer
+ * content.
+ */
+ @callflow(next={"*"})
+ reset();
+
+ /*
+ * Enable processing.
+ *
+ * @return retval operation completion status.
+ */
+ @callflow(next={"process"})
+ enable() generates (Result retval);
+
+ /*
+ * Disable processing.
+ *
+ * @return retval operation completion status.
+ */
+ @exit
+ disable() generates (Result retval);
+
+ /*
+ * Set the rendering device the audio output path is connected to. The
+ * effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its
+ * descriptor to receive this command when the device changes.
+ *
+ * @param device output device specification.
+ */
+ @callflow(next={"*"})
+ setDevice(AudioDevice device);
+
+ /*
+ * Set and get volume. Used by audio framework to delegate volume control to
+ * effect engine. The effect implementation must set EFFECT_FLAG_VOLUME_IND
+ * or EFFECT_FLAG_VOLUME_CTRL flag in its descriptor to receive this command
+ * before every call to 'process' function If EFFECT_FLAG_VOLUME_CTRL flag
+ * is set in the effect descriptor, the effect engine must return the volume
+ * that should be applied before the effect is processed. The overall volume
+ * (the volume actually applied by the effect engine multiplied by the
+ * returned value) should match the value indicated in the command.
+ *
+ * @param volumes vector containing volume for each channel defined in
+ * EffectConfig for output buffer expressed in 8.24 fixed
+ * point format.
+ * @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.
+ */
+ @callflow(next={"*"})
+ setAndGetVolume(vec<int32_t> volumes) generates (vec<int32_t> result);
+
+ /*
+ * Set the audio mode. The effect implementation must set
+ * EFFECT_FLAG_AUDIO_MODE_IND flag in its descriptor to receive this command
+ * when the audio mode changes.
+ *
+ * @param mode desired audio mode.
+ */
+ @callflow(next={"*"})
+ setAudioMode(AudioMode mode);
+
+ /*
+ * Apply new audio parameters configurations for input and output buffers of
+ * reverse stream. An example of reverse stream is the echo reference
+ * supplied to an Acoustic Echo Canceler.
+ *
+ * @param config configuration descriptor.
+ * @param inputBufferProvider optional buffer provider reference.
+ * @param outputBufferProvider optional buffer provider reference.
+ * @return retval operation completion status.
+ */
+ @callflow(next={"*"})
+ setConfigReverse(EffectConfig config,
+ IEffectBufferProviderCallback inputBufferProvider,
+ IEffectBufferProviderCallback outputBufferProvider)
+ generates (Result retval);
+
+ /*
+ * Set the capture device the audio input path is connected to. The effect
+ * implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to
+ * receive this command when the device changes.
+ *
+ * @param device input device specification.
+ */
+ @callflow(next={"*"})
+ setInputDevice(AudioDevice device);
+
+ /*
+ * Read audio parameters configurations for input and output buffers.
+ *
+ * @return config configuration descriptor.
+ */
+ @callflow(next={"*"})
+ getConfig() generates (EffectConfig config);
+
+ /*
+ * Read audio parameters configurations for input and output buffers of
+ * reverse stream.
+ *
+ * @return config configuration descriptor.
+ */
+ @callflow(next={"*"})
+ getConfigReverse() generates (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.
+ *
+ * @return retval absence of the feature support is indicated using
+ * NOT_SUPPORTED code.
+ * @return result list of configuration descriptors.
+ */
+ @callflow(next={"*"})
+ getFeatureSupportedConfigs(vec<EffectFeature> features)
+ generates (Result retval, vec<EffectFeatureConfig> result);
+
+ /*
+ * Retrieves current configuration for a given feature.
+ *
+ * @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);
+
+ /*
+ * Sets current configuration for a given feature.
+ *
+ * @return retval operation completion status.
+ */
+ @callflow(next={"*"})
+ setFeatureConfig(EffectFeatureConfig featureConfig)
+ generates (Result retval);
+
+ /*
+ * Set the audio source the capture path is configured for (Camcorder, voice
+ * recognition...).
+ *
+ * @param source source descriptor.
+ */
+ @callflow(next={"*"})
+ setAudioSource(AudioSource source);
+
+ /*
+ * This command indicates if the playback thread the effect is attached to
+ * is offloaded or not, and updates the I/O handle of the playback thread
+ * the effect is attached to.
+ *
+ * @param param effect offload descriptor.
+ * @return retval operation completion status.
+ */
+ @callflow(next={"*"})
+ offload(EffectOffloadParameter param) generates (Result retval);
+
+ /*
+ * Returns the effect descriptor.
+ *
+ * @return descriptor effect descriptor.
+ */
+ @callflow(next={"*"})
+ getDescriptor() generates (EffectDescriptor descriptor);
+
+ /*
+ * Effect process function. Takes input samples as specified (count and
+ * location) in input buffer and returns processed samples as specified in
+ * output buffer. If the buffer descriptor is empty the function must use
+ * either the buffer or the buffer provider callback installed by the
+ * setConfig command. The effect framework must call the 'process' function
+ * after the 'enable' command is received and until the 'disable' is
+ * received. When the engine receives the 'disable' command it should turn
+ * off the effect gracefully and when done indicate that it is OK to stop
+ * calling the 'process' function by returning the INVALID_STATE status.
+ *
+ * @param inBuffer input audio buffer.
+ * @return retval operation completion status.
+ * @return outBuffer output audio buffer.
+ */
+ // TODO(mnaganov): replace with FMQ version.
+ @callflow(next={"*"})
+ process(AudioBuffer inBuffer)
+ generates (Result retval, AudioBuffer outBuffer);
+
+ /*
+ * Process reverse stream function. This function is used to pass a
+ * reference stream to the effect engine. If the engine does not need a
+ * reference stream, this function MUST return NOT_SUPPORTED. For example,
+ * this function would typically implemented by an Echo Canceler.
+ *
+ * @param inBuffer input audio buffer.
+ * @return retval operation completion status.
+ * @return outBuffer output audio buffer.
+ */
+ // TODO(mnaganov): replace with FMQ version.
+ @callflow(next={"*"})
+ processReverse(AudioBuffer inBuffer)
+ generates (Result retval, AudioBuffer outBuffer);
+
+ /*
+ * Execute a vendor specific command on the effect. The command code
+ * and data, as well as result data are not interpreted by Android
+ * Framework and are passed as-is between the application and the effect.
+ *
+ * The effect must use standard POSIX.1-2001 error codes for the operation
+ * completion status.
+ *
+ * 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 commandId the ID of the command.
+ * @param data command data.
+ * @return status command completion status.
+ * @return result result data.
+ */
+ command(uint32_t commandId, vec<uint8_t> data)
+ generates (int32_t status, vec<uint8_t> result);
+
+ /*
+ * Set a vendor-specific parameter and apply it immediately. The parameter
+ * code and data 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 parameter ID is
+ * unknown or if provided parameter data is invalid. If the effect does not
+ * support setting vendor-specific parameters, 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 parameter identifying data of the parameter.
+ * @param value the value of the parameter.
+ * @return retval operation completion status.
+ */
+ @callflow(next={"*"})
+ setParameter(vec<uint8_t> parameter, vec<uint8_t> value)
+ generates (Result retval);
+
+ /*
+ * Get a vendor-specific parameter value. The parameter code and returned
+ * data 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 parameter ID is
+ * unknown. If the effect does not support setting vendor-specific
+ * parameters, 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 parameter identifying data of the parameter.
+ * @return retval operation completion status.
+ * @return result the value of the parameter.
+ */
+ @callflow(next={"*"})
+ getParameter(vec<uint8_t> parameter)
+ generates (Result retval, vec<uint8_t> value);
+};
diff --git a/audio/effect/2.0/IEffectBufferProviderCallback.hal b/audio/effect/2.0/IEffectBufferProviderCallback.hal
new file mode 100644
index 0000000..545e2e5
--- /dev/null
+++ b/audio/effect/2.0/IEffectBufferProviderCallback.hal
@@ -0,0 +1,40 @@
+/*
+ * 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.audio.effect@2.0;
+
+/*
+ * This callback interface contains functions that can be used by the effect
+ * engine 'process' function to exchange input and output audio buffers.
+ */
+interface IEffectBufferProviderCallback {
+ /*
+ * Called to retrieve a buffer where data should read from by 'process'
+ * function.
+ *
+ * @return buffer audio buffer for processing
+ */
+ // TODO(mnaganov): replace with FMQ version.
+ getBuffer() generates (AudioBuffer buffer);
+
+ /*
+ * Called to provide a buffer with the data written by 'process' function.
+ *
+ * @param buffer audio buffer for processing
+ */
+ // TODO(mnaganov): replace with FMQ version.
+ putBuffer(AudioBuffer buffer);
+};
diff --git a/audio/effect/2.0/IEffectsFactory.hal b/audio/effect/2.0/IEffectsFactory.hal
new file mode 100644
index 0000000..6763825
--- /dev/null
+++ b/audio/effect/2.0/IEffectsFactory.hal
@@ -0,0 +1,64 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IEffectsFactory {
+ /*
+ * Returns descriptors of different effects in all loaded libraries.
+ *
+ * @return retval operation completion status.
+ * @return result list of effect descriptors.
+ */
+ getAllDescriptors() generates(Result retval, vec<EffectDescriptor> result);
+
+ /*
+ * Returns a descriptor of a particular effect.
+ *
+ * @return retval operation completion status.
+ * @return result effect descriptor.
+ */
+ getDescriptor(Uuid uid) generates(Result retval, EffectDescriptor result);
+
+ /*
+ * Creates an effect engine of the specified type. To release the effect
+ * engine, it is necessary to release references to the returned effect
+ * object.
+ *
+ * @param uid effect uuid.
+ * @param session audio session to which this effect instance will be
+ * attached. All effects created with the same session ID
+ * are connected in series and process the same signal
+ * stream.
+ * @param ioHandle identifies the output or input stream this effect is
+ * directed to in audio HAL.
+ * @return retval operation completion status.
+ * @return result the interface for the created effect.
+ */
+ createEffect(Uuid uid, AudioSession session, AudioIoHandle ioHandle)
+ generates (Result retval, IEffect result);
+
+ /*
+ * Dumps information about effects into the provided file descriptor.
+ * This is used for the dumpsys facility.
+ *
+ * @param fd dump file descriptor.
+ */
+ debugDump(handle fd);
+};
diff --git a/audio/effect/2.0/IEnvironmentalReverbEffect.hal b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
new file mode 100644
index 0000000..bd7aeeb
--- /dev/null
+++ b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
@@ -0,0 +1,168 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IEnvironmentalReverbEffect extends IEffect {
+ /*
+ * Sets whether the effect should be bypassed.
+ */
+ setBypass(bool bypass) generates (Result retval);
+
+ /*
+ * Gets whether the effect should be bypassed.
+ */
+ getBypass() generates (Result retval, bool bypass);
+
+ enum ParamRange : int16_t {
+ ROOM_LEVEL_MIN = -6000,
+ ROOM_LEVEL_MAX = 0,
+ ROOM_HF_LEVEL_MIN = -4000,
+ ROOM_HF_LEVEL_MAX = 0,
+ DECAY_TIME_MIN = 100,
+ DECAY_TIME_MAX = 20000,
+ DECAY_HF_RATIO_MIN = 100,
+ DECAY_HF_RATIO_MAX = 1000,
+ REFLECTIONS_LEVEL_MIN = -6000,
+ REFLECTIONS_LEVEL_MAX = 0,
+ REFLECTIONS_DELAY_MIN = 0,
+ REFLECTIONS_DELAY_MAX = 65,
+ REVERB_LEVEL_MIN = -6000,
+ REVERB_LEVEL_MAX = 0,
+ REVERB_DELAY_MIN = 0,
+ REVERB_DELAY_MAX = 65,
+ DIFFUSION_MIN = 0,
+ DIFFUSION_MAX = 1000,
+ DENSITY_MIN = 0,
+ DENSITY_MAX = 1000
+ };
+
+ /*
+ * Sets the room level.
+ */
+ setRoomLevel(int16_t roomLevel) generates (Result retval);
+
+ /*
+ * Gets the room level.
+ */
+ getRoomLevel() generates (Result retval, int16_t roomLevel);
+
+ /*
+ * Sets the room high frequences level.
+ */
+ setRoomHfLevel(int16_t roomHfLevel) generates (Result retval);
+
+ /*
+ * Gets the room high frequences level.
+ */
+ getRoomHfLevel() generates (Result retval, int16_t roomHfLevel);
+
+ /*
+ * Sets the room decay time.
+ */
+ setDecayTime(uint32_t decayTime) generates (Result retval);
+
+ /*
+ * Gets the room decay time.
+ */
+ getDecayTime() generates (Result retval, uint32_t decayTime);
+
+ /*
+ * Sets the ratio of high frequences decay.
+ */
+ setDecayHfRatio(int16_t decayHfRatio) generates (Result retval);
+
+ /*
+ * Gets the ratio of high frequences decay.
+ */
+ getDecayHfRatio() generates (Result retval, int16_t decayHfRatio);
+
+ /*
+ * Sets the level of reflections in the room.
+ */
+ setReflectionsLevel(int16_t reflectionsLevel) generates (Result retval);
+
+ /*
+ * Gets the level of reflections in the room.
+ */
+ getReflectionsLevel() generates (Result retval, int16_t reflectionsLevel);
+
+ /*
+ * Sets the reflections delay in the room.
+ */
+ setReflectionsDelay(uint32_t reflectionsDelay) generates (Result retval);
+
+ /*
+ * Gets the reflections delay in the room.
+ */
+ getReflectionsDelay() generates (Result retval, uint32_t reflectionsDelay);
+
+ /*
+ * Sets the reverb level of the room.
+ */
+ setReverbLevel(int16_t reverbLevel) generates (Result retval);
+
+ /*
+ * Gets the reverb level of the room.
+ */
+ getReverbLevel() generates (Result retval, int16_t reverbLevel);
+
+ /*
+ * Sets room diffusion.
+ */
+ setDiffusion(int16_t diffusion) generates (Result retval);
+
+ /*
+ * Gets room diffusion.
+ */
+ getDiffusion() generates (Result retval, int16_t diffusion);
+
+ /*
+ * Sets room wall density.
+ */
+ setDensity(int16_t density) generates (Result retval);
+
+ /*
+ * Gets room wall density.
+ */
+ getDensity() generates (Result retval, int16_t density);
+
+ struct AllProperties {
+ int16_t roomLevel; // in millibels, range -6000 to 0
+ int16_t roomHfLevel; // in millibels, range -4000 to 0
+ uint32_t decayTime; // in milliseconds, range 100 to 20000
+ int16_t decayHfRatio; // in permilles, range 100 to 1000
+ int16_t reflectionsLevel; // in millibels, range -6000 to 0
+ uint32_t reflectionsDelay; // in milliseconds, range 0 to 65
+ int16_t reverbLevel; // in millibels, range -6000 to 0
+ uint32_t reverbDelay; // in milliseconds, range 0 to 65
+ int16_t diffusion; // in permilles, range 0 to 1000
+ int16_t density; // in permilles, range 0 to 1000
+ };
+
+ /*
+ * Sets all properties at once.
+ */
+ setAllProperties(AllProperties properties) generates (Result retval);
+
+ /*
+ * Gets all properties at once.
+ */
+ getAllProperties() generates (Result retval, AllProperties properties);
+};
diff --git a/audio/effect/2.0/IEqualizerEffect.hal b/audio/effect/2.0/IEqualizerEffect.hal
new file mode 100644
index 0000000..afcc4b6
--- /dev/null
+++ b/audio/effect/2.0/IEqualizerEffect.hal
@@ -0,0 +1,91 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IEqualizerEffect extends IEffect {
+ /*
+ * Gets the number of frequency bands that the equalizer supports.
+ */
+ getNumBands() generates (Result retval, uint16_t numBands);
+
+ /*
+ * Returns the minimum and maximum band levels supported.
+ */
+ getLevelRange()
+ generates (Result retval, uint16_t minLevel, uint16_t maxLevel);
+
+ /*
+ * Sets the gain for the given equalizer band.
+ */
+ setBandLevel(uint16_t band, uint16_t level) generates (Result retval);
+
+ /*
+ * Gets the gain for the given equalizer band.
+ */
+ getBandLevel(uint16_t band) generates (Result retval, uint16_t level);
+
+ /*
+ * Gets the center frequency of the given band.
+ */
+ getBandCenterFrequency(uint16_t band)
+ generates (Result retval, uint32_t centerFreq);
+
+ /*
+ * Gets the frequency range of the given frequency band.
+ */
+ getBandFrequencyRange(uint16_t band)
+ generates (Result retval, uint32_t minFreqHz, uint32_t maxFreqHz);
+
+ /*
+ * Gets the band that has the most effect on the given frequency.
+ */
+ getBandForFrequency(uint32_t freq) generates (Result retval, uint16_t band);
+
+ /*
+ * Gets the names of all presets the equalizer supports.
+ */
+ getPresetNames() generates (Result retval, vec<string> names);
+
+ /*
+ * Sets the current preset using the index of the preset in the names
+ * vector returned via 'getPresetNames'.
+ */
+ setCurrentPreset(uint16_t preset) generates (Result retval);
+
+ /*
+ * Gets the current preset.
+ */
+ getCurrentPreset() generates (Result retval, uint16_t preset);
+
+ struct AllProperties {
+ uint16_t curPreset;
+ vec<uint16_t> bandLevels;
+ };
+
+ /*
+ * Sets all properties at once.
+ */
+ setAllProperties(AllProperties properties) generates (Result retval);
+
+ /*
+ * Gets all properties at once.
+ */
+ getAllProperties() generates (Result retval, AllProperties properties);
+};
diff --git a/audio/effect/2.0/ILoudnessEnhancerEffect.hal b/audio/effect/2.0/ILoudnessEnhancerEffect.hal
new file mode 100644
index 0000000..3e1ee4e
--- /dev/null
+++ b/audio/effect/2.0/ILoudnessEnhancerEffect.hal
@@ -0,0 +1,32 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface ILoudnessEnhancerEffect extends IEffect {
+ /*
+ * Sets target gain expressed in millibels.
+ */
+ setTargetGain(int32_t targetGainMb) generates (Result retval);
+
+ /*
+ * Gets target gain expressed in millibels.
+ */
+ getTargetGain() generates (Result retval, int32_t targetGainMb);
+};
diff --git a/audio/effect/2.0/INoiseSuppressionEffect.hal b/audio/effect/2.0/INoiseSuppressionEffect.hal
new file mode 100644
index 0000000..58e439f
--- /dev/null
+++ b/audio/effect/2.0/INoiseSuppressionEffect.hal
@@ -0,0 +1,68 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface INoiseSuppressionEffect extends IEffect {
+ enum Level {
+ LOW,
+ MEDIUM,
+ HIGH
+ };
+
+ /*
+ * Sets suppression level.
+ */
+ setSuppressionLevel(Level level) generates (Result retval);
+
+ /*
+ * Gets suppression level.
+ */
+ getSuppressionLevel() generates (Result retval, Level level);
+
+ enum Type {
+ SINGLE_CHANNEL,
+ MULTI_CHANNEL
+ };
+
+ /*
+ * Set suppression type.
+ */
+ setSuppressionType(Type type) generates (Result retval);
+
+ /*
+ * Get suppression type.
+ */
+ getSuppressionType() generates (Result retval, Type type);
+
+ struct AllProperties {
+ Level level;
+ Type type;
+ };
+
+ /*
+ * Sets all properties at once.
+ */
+ setAllProperties(AllProperties properties) generates (Result retval);
+
+ /*
+ * Gets all properties at once.
+ */
+ getAllProperties() generates (Result retval, AllProperties properties);
+};
diff --git a/audio/effect/2.0/IPresetReverbEffect.hal b/audio/effect/2.0/IPresetReverbEffect.hal
new file mode 100644
index 0000000..58dfd40
--- /dev/null
+++ b/audio/effect/2.0/IPresetReverbEffect.hal
@@ -0,0 +1,37 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IPresetReverbEffect extends IEffect {
+ enum Preset {
+ NONE, // no reverb or reflections
+ SMALLROOM, // a small room less than five meters in length
+ MEDIUMROOM, // a medium room with a length of ten meters or less
+ LARGEROOM, // a large-sized room suitable for live performances
+ MEDIUMHALL, // a medium-sized hall
+ LARGEHALL, // a large-sized hall suitable for a full orchestra
+ PLATE, // synthesis of the traditional plate reverb
+ LAST = PLATE
+ };
+
+ setPreset(Preset preset) generates (Result retval);
+
+ getPreset() generates (Result retval, Preset preset);
+};
diff --git a/audio/effect/2.0/IVirtualizerEffect.hal b/audio/effect/2.0/IVirtualizerEffect.hal
new file mode 100644
index 0000000..2b7116c
--- /dev/null
+++ b/audio/effect/2.0/IVirtualizerEffect.hal
@@ -0,0 +1,76 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IVirtualizerEffect extends IEffect {
+ /*
+ * Returns whether setting virtualization strength is supported.
+ */
+ isStrengthSupported() generates (bool strengthSupported);
+
+ enum StrengthRange : uint16_t {
+ MIN = 0,
+ MAX = 1000
+ };
+
+ /*
+ * Sets virtualization strength.
+ *
+ * @param strength strength of the effect. The valid range for strength
+ * strength is [0, 1000], where 0 per mille designates the
+ * mildest effect and 1000 per mille designates the
+ * strongest.
+ * @return retval operation completion status.
+ */
+ setStrength(uint16_t strength) generates (Result retval);
+
+ /*
+ * Gets virtualization strength.
+ */
+ getStrength() generates (Result retval, uint16_t strength);
+
+ struct SpeakerAngle {
+ AudioChannelMask mask; // speaker channel mask (1 bit set).
+ // all angles are expressed in degrees and
+ // are relative to the listener.
+ int16_t azimuth; // 0 is the direction the listener faces
+ // 180 is behind the listener
+ // -90 is to their left
+ int16_t elevation; // 0 is the horizontal plane
+ // +90 is above the listener, -90 is below
+ };
+ /*
+ * Retrieves virtual speaker angles for the given channel mask on the
+ * specified device.
+ */
+ getVirtualSpeakerAngles(AudioChannelMask mask, AudioDevice device)
+ generates (Result retval, vec<SpeakerAngle> speakerAngles);
+
+ /*
+ * Forces the virtualizer effect for the given output device.
+ */
+ forceVirtualizationMode(AudioDevice device) generates (Result retval);
+
+ /*
+ * Returns audio device reflecting the current virtualization mode,
+ * AUDIO_DEVICE_NONE when not virtualizing.
+ */
+ getVirtualizationMode() generates (Result retval, AudioDevice device);
+};
diff --git a/audio/effect/2.0/IVisualizerEffect.hal b/audio/effect/2.0/IVisualizerEffect.hal
new file mode 100644
index 0000000..2a7ddb8
--- /dev/null
+++ b/audio/effect/2.0/IVisualizerEffect.hal
@@ -0,0 +1,110 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+import IEffect;
+
+interface IVisualizerEffect extends IEffect {
+ enum CaptureSizeRange {
+ MAX = 1024, // maximum capture size in samples
+ MIN = 128 // minimum capture size in samples
+ };
+
+ /*
+ * Sets the number PCM samples in the capture.
+ */
+ setCaptureSize(uint16_t captureSize) generates (Result retval);
+
+ /*
+ * Gets the number PCM samples in the capture.
+ */
+ getCaptureSize() generates (Result retval, uint16_t captureSize);
+
+ enum ScalingMode {
+ // Keep in sync with
+ // frameworks/base/media/java/android/media/audiofx/Visualizer.java
+ SCALING_MODE_NORMALIZED = 0,
+ SCALING_MODE_AS_PLAYED = 1
+ };
+
+ /*
+ * Specifies the way the captured data is scaled.
+ */
+ setScalingMode(ScalingMode scalingMode) generates (Result retval);
+
+ /*
+ * Retrieves the way the captured data is scaled.
+ */
+ getScalingMode() generates (Result retval, ScalingMode scalingMode);
+
+ /*
+ * Informs the visualizer about the downstream latency.
+ */
+ setLatency(uint32_t latencyMs) generates (Result retval);
+
+ /*
+ * Gets the downstream latency.
+ */
+ getLatency() generates (Result retval, uint32_t latencyMs);
+
+ enum MeasurementMode {
+ // Keep in sync with
+ // frameworks/base/media/java/android/media/audiofx/Visualizer.java
+ MEASUREMENT_MODE_NONE = 0x0,
+ MEASUREMENT_MODE_PEAK_RMS = 0x1
+ };
+
+ /*
+ * Specifies which measurements are to be made.
+ */
+ setMeasurementMode(MeasurementMode measurementMode)
+ generates (Result retval);
+
+ /*
+ * Retrieves which measurements are to be made.
+ */
+ getMeasurementMode() generates (
+ Result retval, MeasurementMode measurementMode);
+
+ /*
+ * Retrieves the latest PCM snapshot captured by the visualizer engine. The
+ * number of samples to capture is specified by 'setCaptureSize' parameter.
+ *
+ * @return retval operation completion status.
+ * @return samples samples in 8 bit unsigned format (0 = 0x80)
+ */
+ capture() generates (Result retval, vec<uint8_t> samples);
+
+ struct Measurement {
+ MeasurementMode mode; // discriminator
+ union Values {
+ struct PeakAndRms {
+ int32_t peakMb; // millibels
+ int32_t rmsMb; // millibels
+ } peakAndRms;
+ };
+ };
+ /*
+ * Retrieves the lastest measurements. The measurements to be made
+ * are specified by 'setMeasurementMode' parameter.
+ *
+ * @return retval operation completion status.
+ * @return result measurement.
+ */
+ measure() generates (Result retval, Measurement result);
+};
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
new file mode 100644
index 0000000..3560382
--- /dev/null
+++ b/audio/effect/2.0/types.hal
@@ -0,0 +1,303 @@
+/*
+ * 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.audio.effect@2.0;
+
+import android.hardware.audio.common@2.0;
+
+enum Result {
+ OK,
+ NOT_INITIALIZED,
+ INVALID_ARGUMENTS,
+ INVALID_STATE,
+ NOT_SUPPORTED
+};
+
+/*
+ * Effect engine capabilities/requirements flags.
+ *
+ * Definitions for flags field of effect descriptor.
+ *
+ * +----------------+--------+--------------------------------------------------
+ * | description | bits | values
+ * +----------------+--------+--------------------------------------------------
+ * | connection | 0..2 | 0 insert: after track process
+ * | mode | | 1 auxiliary: connect to track auxiliary
+ * | | | output and use send level
+ * | | | 2 replace: replaces track process function;
+ * | | | must implement SRC, volume and mono to stereo.
+ * | | | 3 pre processing: applied below audio HAL on in
+ * | | | 4 post processing: applied below audio HAL on out
+ * | | | 5 - 7 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | insertion | 3..5 | 0 none
+ * | preference | | 1 first of the chain
+ * | | | 2 last of the chain
+ * | | | 3 exclusive (only effect in the insert chain)
+ * | | | 4..7 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | Volume | 6..8 | 0 none
+ * | management | | 1 implements volume control
+ * | | | 2 requires volume indication
+ * | | | 4 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | Device | 9..11 | 0 none
+ * | indication | | 1 requires device updates
+ * | | | 2, 4 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | Sample input | 12..13 | 1 direct: process() function or
+ * | mode | | EFFECT_CMD_SET_CONFIG command must specify
+ * | | | a buffer descriptor
+ * | | | 2 provider: process() function uses the
+ * | | | bufferProvider indicated by the
+ * | | | EFFECT_CMD_SET_CONFIG command to request input.
+ * | | | buffers.
+ * | | | 3 both: both input modes are supported
+ * +----------------+--------+--------------------------------------------------
+ * | Sample output | 14..15 | 1 direct: process() function or
+ * | mode | | EFFECT_CMD_SET_CONFIG command must specify
+ * | | | a buffer descriptor
+ * | | | 2 provider: process() function uses the
+ * | | | bufferProvider indicated by the
+ * | | | EFFECT_CMD_SET_CONFIG command to request output
+ * | | | buffers.
+ * | | | 3 both: both output modes are supported
+ * +----------------+--------+--------------------------------------------------
+ * | Hardware | 16..17 | 0 No hardware acceleration
+ * | acceleration | | 1 non tunneled hw acceleration: the process()
+ * | | | function reads the samples, send them to HW
+ * | | | accelerated effect processor, reads back
+ * | | | the processed samples and returns them
+ * | | | to the output buffer.
+ * | | | 2 tunneled hw acceleration: the process()
+ * | | | function is transparent. The effect interface
+ * | | | is only used to control the effect engine.
+ * | | | This mode is relevant for global effects
+ * | | | actually applied by the audio hardware on
+ * | | | the output stream.
+ * +----------------+--------+--------------------------------------------------
+ * | Audio Mode | 18..19 | 0 none
+ * | indication | | 1 requires audio mode updates
+ * | | | 2..3 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | Audio source | 20..21 | 0 none
+ * | indication | | 1 requires audio source updates
+ * | | | 2..3 reserved
+ * +----------------+--------+--------------------------------------------------
+ * | Effect offload | 22 | 0 The effect cannot be offloaded to an audio DSP
+ * | supported | | 1 The effect can be offloaded to an audio DSP
+ * +----------------+--------+--------------------------------------------------
+ * | Process | 23 | 0 The effect implements a process function.
+ * | function | | 1 The effect does not implement a process
+ * | not | | function: enabling the effect has no impact
+ * | implemented | | on latency or CPU load.
+ * | | | Effect implementations setting this flag do not
+ * | | | have to implement a process function.
+ * +----------------+--------+--------------------------------------------------
+ */
+// TODO(mnaganov): Consider if "EFFECT_FLAG_" prefix can be dropped.
+enum EffectFlags {
+ // Insert mode
+ EFFECT_FLAG_TYPE_SHIFT = 0,
+ EFFECT_FLAG_TYPE_SIZE = 3,
+ EFFECT_FLAG_TYPE_MASK =
+ ((1 << EFFECT_FLAG_TYPE_SIZE) -1) << EFFECT_FLAG_TYPE_SHIFT,
+ EFFECT_FLAG_TYPE_INSERT = 0 << EFFECT_FLAG_TYPE_SHIFT,
+ EFFECT_FLAG_TYPE_AUXILIARY = 1 << EFFECT_FLAG_TYPE_SHIFT,
+ EFFECT_FLAG_TYPE_REPLACE = 2 << EFFECT_FLAG_TYPE_SHIFT,
+ EFFECT_FLAG_TYPE_PRE_PROC = 3 << EFFECT_FLAG_TYPE_SHIFT,
+ EFFECT_FLAG_TYPE_POST_PROC = 4 << EFFECT_FLAG_TYPE_SHIFT,
+
+ // Insert preference
+ EFFECT_FLAG_INSERT_SHIFT = EFFECT_FLAG_TYPE_SHIFT + EFFECT_FLAG_TYPE_SIZE,
+ EFFECT_FLAG_INSERT_SIZE = 3,
+ EFFECT_FLAG_INSERT_MASK =
+ ((1 << EFFECT_FLAG_INSERT_SIZE) -1) << EFFECT_FLAG_INSERT_SHIFT,
+ EFFECT_FLAG_INSERT_ANY = 0 << EFFECT_FLAG_INSERT_SHIFT,
+ EFFECT_FLAG_INSERT_FIRST = 1 << EFFECT_FLAG_INSERT_SHIFT,
+ EFFECT_FLAG_INSERT_LAST = 2 << EFFECT_FLAG_INSERT_SHIFT,
+ EFFECT_FLAG_INSERT_EXCLUSIVE = 3 << EFFECT_FLAG_INSERT_SHIFT,
+
+ // Volume control
+ EFFECT_FLAG_VOLUME_SHIFT =
+ EFFECT_FLAG_INSERT_SHIFT + EFFECT_FLAG_INSERT_SIZE,
+ EFFECT_FLAG_VOLUME_SIZE = 3,
+ EFFECT_FLAG_VOLUME_MASK =
+ ((1 << EFFECT_FLAG_VOLUME_SIZE) -1) << EFFECT_FLAG_VOLUME_SHIFT,
+ EFFECT_FLAG_VOLUME_CTRL = 1 << EFFECT_FLAG_VOLUME_SHIFT,
+ EFFECT_FLAG_VOLUME_IND = 2 << EFFECT_FLAG_VOLUME_SHIFT,
+ EFFECT_FLAG_VOLUME_NONE = 0 << EFFECT_FLAG_VOLUME_SHIFT,
+
+ // Device indication
+ EFFECT_FLAG_DEVICE_SHIFT =
+ EFFECT_FLAG_VOLUME_SHIFT + EFFECT_FLAG_VOLUME_SIZE,
+ EFFECT_FLAG_DEVICE_SIZE = 3,
+ EFFECT_FLAG_DEVICE_MASK =
+ ((1 << EFFECT_FLAG_DEVICE_SIZE) -1) << EFFECT_FLAG_DEVICE_SHIFT,
+ EFFECT_FLAG_DEVICE_IND = 1 << EFFECT_FLAG_DEVICE_SHIFT,
+ EFFECT_FLAG_DEVICE_NONE = 0 << EFFECT_FLAG_DEVICE_SHIFT,
+
+ // Sample input modes
+ EFFECT_FLAG_INPUT_SHIFT =
+ EFFECT_FLAG_DEVICE_SHIFT + EFFECT_FLAG_DEVICE_SIZE,
+ EFFECT_FLAG_INPUT_SIZE = 2,
+ EFFECT_FLAG_INPUT_MASK =
+ ((1 << EFFECT_FLAG_INPUT_SIZE) -1) << EFFECT_FLAG_INPUT_SHIFT,
+ EFFECT_FLAG_INPUT_DIRECT = 1 << EFFECT_FLAG_INPUT_SHIFT,
+ EFFECT_FLAG_INPUT_PROVIDER = 2 << EFFECT_FLAG_INPUT_SHIFT,
+ EFFECT_FLAG_INPUT_BOTH = 3 << EFFECT_FLAG_INPUT_SHIFT,
+
+ // Sample output modes
+ EFFECT_FLAG_OUTPUT_SHIFT = EFFECT_FLAG_INPUT_SHIFT + EFFECT_FLAG_INPUT_SIZE,
+ EFFECT_FLAG_OUTPUT_SIZE = 2,
+ EFFECT_FLAG_OUTPUT_MASK =
+ ((1 << EFFECT_FLAG_OUTPUT_SIZE) -1) << EFFECT_FLAG_OUTPUT_SHIFT,
+ EFFECT_FLAG_OUTPUT_DIRECT = 1 << EFFECT_FLAG_OUTPUT_SHIFT,
+ EFFECT_FLAG_OUTPUT_PROVIDER = 2 << EFFECT_FLAG_OUTPUT_SHIFT,
+ EFFECT_FLAG_OUTPUT_BOTH = 3 << EFFECT_FLAG_OUTPUT_SHIFT,
+
+ // Hardware acceleration mode
+ EFFECT_FLAG_HW_ACC_SHIFT =
+ EFFECT_FLAG_OUTPUT_SHIFT + EFFECT_FLAG_OUTPUT_SIZE,
+ EFFECT_FLAG_HW_ACC_SIZE = 2,
+ EFFECT_FLAG_HW_ACC_MASK =
+ ((1 << EFFECT_FLAG_HW_ACC_SIZE) -1) << EFFECT_FLAG_HW_ACC_SHIFT,
+ EFFECT_FLAG_HW_ACC_SIMPLE = 1 << EFFECT_FLAG_HW_ACC_SHIFT,
+ EFFECT_FLAG_HW_ACC_TUNNEL = 2 << EFFECT_FLAG_HW_ACC_SHIFT,
+
+ // Audio mode indication
+ EFFECT_FLAG_AUDIO_MODE_SHIFT =
+ EFFECT_FLAG_HW_ACC_SHIFT + EFFECT_FLAG_HW_ACC_SIZE,
+ EFFECT_FLAG_AUDIO_MODE_SIZE = 2,
+ EFFECT_FLAG_AUDIO_MODE_MASK =
+ ((1 << EFFECT_FLAG_AUDIO_MODE_SIZE) -1) << EFFECT_FLAG_AUDIO_MODE_SHIFT,
+ EFFECT_FLAG_AUDIO_MODE_IND = 1 << EFFECT_FLAG_AUDIO_MODE_SHIFT,
+ EFFECT_FLAG_AUDIO_MODE_NONE = 0 << EFFECT_FLAG_AUDIO_MODE_SHIFT,
+
+ // Audio source indication
+ EFFECT_FLAG_AUDIO_SOURCE_SHIFT =
+ EFFECT_FLAG_AUDIO_MODE_SHIFT + EFFECT_FLAG_AUDIO_MODE_SIZE,
+ EFFECT_FLAG_AUDIO_SOURCE_SIZE = 2,
+ EFFECT_FLAG_AUDIO_SOURCE_MASK = ((1 << EFFECT_FLAG_AUDIO_SOURCE_SIZE) -1)
+ << EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
+ EFFECT_FLAG_AUDIO_SOURCE_IND = 1 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
+ EFFECT_FLAG_AUDIO_SOURCE_NONE = 0 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
+
+ // Effect offload indication
+ EFFECT_FLAG_OFFLOAD_SHIFT =
+ EFFECT_FLAG_AUDIO_SOURCE_SHIFT + EFFECT_FLAG_AUDIO_SOURCE_SIZE,
+ EFFECT_FLAG_OFFLOAD_SIZE = 1,
+ EFFECT_FLAG_OFFLOAD_MASK =
+ ((1 << EFFECT_FLAG_OFFLOAD_SIZE) -1) << EFFECT_FLAG_OFFLOAD_SHIFT,
+ EFFECT_FLAG_OFFLOAD_SUPPORTED = 1 << EFFECT_FLAG_OFFLOAD_SHIFT,
+
+ // Effect has no process indication
+ EFFECT_FLAG_NO_PROCESS_SHIFT =
+ EFFECT_FLAG_OFFLOAD_SHIFT + EFFECT_FLAG_OFFLOAD_SIZE,
+ EFFECT_FLAG_NO_PROCESS_SIZE = 1,
+ EFFECT_FLAG_NO_PROCESS_MASK =
+ ((1 << EFFECT_FLAG_NO_PROCESS_SIZE) -1) << EFFECT_FLAG_NO_PROCESS_SHIFT,
+ EFFECT_FLAG_NO_PROCESS = 1 << EFFECT_FLAG_NO_PROCESS_SHIFT
+};
+
+/*
+ * The effect descriptor contains necessary information to facilitate the
+ * enumeration of the effect engines present in a library.
+ */
+struct EffectDescriptor {
+ Uuid type; // UUID of to the OpenSL ES interface implemented
+ // by this effect
+ Uuid uuid; // UUID for this particular implementation
+ EffectFlags flags; // effect engine capabilities/requirements flags
+ uint16_t cpuLoad; // CPU load indication expressed in 0.1 MIPS units
+ // 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
+};
+
+/*
+ * A buffer is a chunk of audio data for processing. Multi-channel audio is
+ * always interleaved. The channel order is from LSB to MSB with regard to the
+ * channel mask definition in audio.h, audio_channel_mask_t, e.g.:
+ * Stereo: L, R; 5.1: FL, FR, FC, LFE, BL, BR.
+ *
+ * The buffer size is expressed in frame count, a frame being composed of
+ * samples for all channels at a given time. Frame size for unspecified format
+ * (AUDIO_FORMAT_OTHER) is 8 bit by definition.
+ */
+// TODO(mnaganov): replace with FMQ version.
+struct AudioBuffer {
+ uint32_t frameCount;
+ vec<uint8_t> data;
+};
+
+enum EffectBufferAccess {
+ EFFECT_BUFFER_ACCESS_WRITE,
+ EFFECT_BUFFER_ACCESS_READ,
+ EFFECT_BUFFER_ACCESS_ACCUMULATE
+};
+
+/*
+ * Determines what fields of EffectBufferConfig need to be considered.
+ */
+enum EffectConfigParameters {
+ EFFECT_CONFIG_BUFFER = 0x0001, // buffer field
+ EFFECT_CONFIG_SMP_RATE = 0x0002, // samplingRate
+ EFFECT_CONFIG_CHANNELS = 0x0004, // channels
+ EFFECT_CONFIG_FORMAT = 0x0008, // format
+ EFFECT_CONFIG_ACC_MODE = 0x0010, // accessMode
+ EFFECT_CONFIG_ALL = EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE |
+ EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT |
+ EFFECT_CONFIG_ACC_MODE
+};
+
+/*
+ * The buffer config structure specifies the input or output audio format
+ * to be used by the effect engine.
+ */
+struct EffectBufferConfig {
+ AudioBuffer buffer;
+ uint32_t samplingRateHz;
+ AudioChannelMask channels;
+ AudioFormat format;
+ EffectBufferAccess accessMode;
+ EffectConfigParameters mask;
+};
+
+struct EffectConfig {
+ EffectBufferConfig inputCfg;
+ EffectBufferConfig outputCfg;
+};
+
+enum EffectFeature {
+ EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels
+ // (e.g. dual mic noise suppressor)
+ EFFECT_FEATURE_CNT
+};
+
+struct EffectFeatureConfig {
+ EffectFeature feature;
+ EffectConfig config;
+};
+
+struct EffectOffloadParameter {
+ bool isOffload; // true if the playback thread the effect
+ // is attached to is offloaded
+ AudioIoHandle ioHandle; // io handle of the playback thread
+ // the effect is attached to
+};
diff --git a/memtrack/1.0/Android.bp b/memtrack/1.0/Android.bp
new file mode 100644
index 0000000..3696aea
--- /dev/null
+++ b/memtrack/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+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",
+ srcs: [
+ "types.hal",
+ "IMemtrack.hal",
+ ],
+ out: [
+ "android/hardware/memtrack/1.0/types.cpp",
+ "android/hardware/memtrack/1.0/MemtrackAll.cpp",
+ ],
+}
+
+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",
+ srcs: [
+ "types.hal",
+ "IMemtrack.hal",
+ ],
+ out: [
+ "android/hardware/memtrack/1.0/types.h",
+ "android/hardware/memtrack/1.0/IMemtrack.h",
+ "android/hardware/memtrack/1.0/IHwMemtrack.h",
+ "android/hardware/memtrack/1.0/BnMemtrack.h",
+ "android/hardware/memtrack/1.0/BpMemtrack.h",
+ "android/hardware/memtrack/1.0/BsMemtrack.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.memtrack@1.0",
+ generated_sources: ["android.hardware.memtrack@1.0_genc++"],
+ generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.memtrack@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/memtrack/1.0/Android.mk b/memtrack/1.0/Android.mk
new file mode 100644
index 0000000..4abe505
--- /dev/null
+++ b/memtrack/1.0/Android.mk
@@ -0,0 +1,204 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.memtrack@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 (MemtrackFlag)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackFlag.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.memtrack@1.0::types.MemtrackFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackRecord)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackRecord.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.memtrack@1.0::types.MemtrackRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackStatus)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackStatus.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.memtrack@1.0::types.MemtrackStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackType)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackType.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.memtrack@1.0::types.MemtrackType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IMemtrack.hal
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/IMemtrack.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMemtrack.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.memtrack@1.0::IMemtrack
+
+$(GEN): $(LOCAL_PATH)/IMemtrack.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.memtrack@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 (MemtrackFlag)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackFlag.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.memtrack@1.0::types.MemtrackFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackRecord)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackRecord.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.memtrack@1.0::types.MemtrackRecord
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackStatus)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackStatus.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.memtrack@1.0::types.MemtrackStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (MemtrackType)
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/MemtrackType.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.memtrack@1.0::types.MemtrackType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IMemtrack.hal
+#
+GEN := $(intermediates)/android/hardware/memtrack/1.0/IMemtrack.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IMemtrack.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.memtrack@1.0::IMemtrack
+
+$(GEN): $(LOCAL_PATH)/IMemtrack.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/memtrack/1.0/IMemtrack.hal b/memtrack/1.0/IMemtrack.hal
new file mode 100644
index 0000000..064f2fe
--- /dev/null
+++ b/memtrack/1.0/IMemtrack.hal
@@ -0,0 +1,68 @@
+/*
+ * 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.memtrack@1.0;
+
+/*
+ * The Memory Tracker HAL is designed to return information about
+ * device-specific memory usage.
+ * The primary goal is to be able to track memory that is not
+ * trackable in any other way, for example texture memory that is allocated by
+ * a process, but not mapped in to that process's address space.
+ * A secondary goal is to be able to categorize memory used by a process into
+ * GL, graphics, etc. All memory sizes must be in real memory usage,
+ * accounting for stride, bit depth, rounding up to page size, etc.
+ *
+ * Constructor for the interface should be used to perform memtrack management
+ * setup actions and is called once before any calls to getMemory().
+ */
+interface IMemtrack {
+ /*
+ * getMemory() populates MemtrackRecord vector with the sizes of memory
+ * plus associated flags for that memory.
+ *
+ * This function must be thread-safe, it may get called from multiple
+ * threads at the same time.
+ *
+ * A process collecting memory statistics will call getMemory for each
+ * combination of pid and memory type. For each memory type that it
+ * recognizes, the HAL must fill out an array of memtrack_record
+ * structures breaking down the statistics of that memory type as much as
+ * possible. For example,
+ * getMemory(<pid>, GL) might return:
+ * { { 4096, ACCOUNTED | PRIVATE | SYSTEM },
+ * { 40960, UNACCOUNTED | PRIVATE | SYSTEM },
+ * { 8192, ACCOUNTED | PRIVATE | DEDICATED },
+ * { 8192, UNACCOUNTED | PRIVATE | DEDICATED } }
+ * If the HAL cannot differentiate between SYSTEM and DEDICATED memory, it
+ * could return:
+ * { { 12288, ACCOUNTED | PRIVATE },
+ * { 49152, UNACCOUNTED | PRIVATE } }
+ *
+ * Memory must not overlap between types. For example, a graphics buffer
+ * that has been mapped into the GPU as a surface must show up when
+ * GRAPHICS is requested and not when GL
+ * is requested.
+ *
+ * @param pid process for which memory infromation is requested
+ * @param type memory type that information is being requested about
+ * @return records vector of MemtrackRecord containing memory information
+ * @return retval SUCCESS on success, TYPE_NOT_FOUND if the type is not
+ * supported.
+ */
+ getMemory(int32_t pid, MemtrackType type)
+ generates (MemtrackStatus retval, vec<MemtrackRecord> records);
+};
diff --git a/memtrack/1.0/default/Android.bp b/memtrack/1.0/default/Android.bp
new file mode 100644
index 0000000..c6ab6b9
--- /dev/null
+++ b/memtrack/1.0/default/Android.bp
@@ -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.
+
+cc_library_shared {
+ name: "android.hardware.memtrack@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Memtrack.cpp"],
+
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libhidl",
+ "libhardware",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.memtrack@1.0",
+ ],
+
+}
+
+cc_binary {
+ relative_install_path: "hw",
+ name: "android.hardware.memtrack@1.0-service",
+ srcs: ["service.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libbase",
+ "libdl",
+ "libutils",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "android.hardware.memtrack@1.0",
+ ],
+
+}
diff --git a/memtrack/1.0/default/Memtrack.cpp b/memtrack/1.0/default/Memtrack.cpp
new file mode 100644
index 0000000..b953e7c
--- /dev/null
+++ b/memtrack/1.0/default/Memtrack.cpp
@@ -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.
+ */
+
+#define LOG_TAG "android.hardware.memtrack@1.0-impl"
+#include <hardware/hardware.h>
+#include <hardware/memtrack.h>
+
+#include "Memtrack.h"
+namespace android {
+namespace hardware {
+namespace memtrack {
+namespace V1_0 {
+namespace implementation {
+
+Memtrack::Memtrack(memtrack_module_t *module) : mModule(module) {
+ if (mModule)
+ mModule->init(mModule);
+}
+
+Memtrack::~Memtrack() {
+ delete(mModule);
+}
+
+Return<void> Memtrack::getMemory(int32_t pid, MemtrackType type,
+ getMemory_cb _hidl_cb) {
+ hidl_vec<MemtrackRecord> records;
+ size_t temp = 0;
+ size_t *size = &temp;
+ int ret = 0;
+
+ if (mModule->getMemory == nullptr)
+ {
+ _hidl_cb(MemtrackStatus::SUCCESS, records);
+ return Void();
+ }
+ ret = mModule->getMemory(mModule, pid, static_cast<memtrack_type>(type),
+ NULL, size);
+ if (ret == 0)
+ {
+ memtrack_record *legacy_records = new memtrack_record[*size];
+ ret = mModule->getMemory(mModule, pid,
+ static_cast<memtrack_type>(type), legacy_records, size);
+ if (ret == 0)
+ {
+ records.resize(*size);
+ for(size_t i = 0; i < *size; i++)
+ {
+ records[i].sizeInBytes = legacy_records[i].size_in_bytes;
+ records[i].flags = legacy_records[i].flags;
+ }
+ }
+ delete[] legacy_records;
+ }
+ _hidl_cb(MemtrackStatus::SUCCESS, records);
+ return Void();
+}
+
+
+IMemtrack* HIDL_FETCH_IMemtrack(const char* name) {
+ int ret = 0;
+ const hw_module_t* hw_module = NULL;
+ memtrack_module_t *memtrack_module = NULL;
+
+ ret = hw_get_module(name, &hw_module);
+ if (ret == 0 && hw_module->methods->open > 0)
+ {
+ ret = hw_module->methods->open(hw_module, name,
+ reinterpret_cast<hw_device_t**>(&memtrack_module));
+ if (ret == 0)
+ return new Memtrack(memtrack_module);
+ else {
+ ALOGE("Passthrough failed to load legacy HAL.");
+ }
+ }
+ else {
+ ALOGE ("hw_get_module %s failed: %d", name, ret);
+ }
+ return nullptr;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace memtrack
+} // namespace hardware
+} // namespace android
diff --git a/memtrack/1.0/default/Memtrack.h b/memtrack/1.0/default/Memtrack.h
new file mode 100644
index 0000000..86dae72
--- /dev/null
+++ b/memtrack/1.0/default/Memtrack.h
@@ -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.
+ */
+
+#ifndef HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+#define HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+
+#include <android/hardware/memtrack/1.0/IMemtrack.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace memtrack {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::memtrack::V1_0::IMemtrack;
+using ::android::hardware::memtrack::V1_0::MemtrackRecord;
+using ::android::hardware::memtrack::V1_0::MemtrackStatus;
+using ::android::hardware::memtrack::V1_0::MemtrackType;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Memtrack : public IMemtrack {
+ Memtrack(memtrack_module_t* module);
+ ~Memtrack();
+ Return<void> getMemory(int32_t pid, MemtrackType type, getMemory_cb _hidl_cb) override;
+
+ private:
+ memtrack_module_t* mModule;
+};
+
+extern "C" IMemtrack* HIDL_FETCH_IMemtrack(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace memtrack
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
diff --git a/memtrack/1.0/default/service.cpp b/memtrack/1.0/default/service.cpp
new file mode 100644
index 0000000..63ac695
--- /dev/null
+++ b/memtrack/1.0/default/service.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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.memtrack@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/memtrack/1.0/IMemtrack.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+using android::hardware::memtrack::V1_0::IMemtrack;
+
+int main() {
+ const char instance[] = "memtrack";
+ android::sp<IMemtrack> service = IMemtrack::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IMemtrack::getService returned NULL, exiting");
+ return -1;
+ }
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+ service->registerAsService(instance);
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/memtrack/1.0/types.hal b/memtrack/1.0/types.hal
new file mode 100644
index 0000000..3d702b3
--- /dev/null
+++ b/memtrack/1.0/types.hal
@@ -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.
+ */
+
+package android.hardware.memtrack@1.0;
+
+/*
+ * SMAPS_ACCOUNTED/SMAPS_UNACCOUNTED
+ * Flags to differentiate memory that can already be accounted for in
+ * /proc/<pid>/smaps,
+ * (Shared_Clean + Shared_Dirty + Private_Clean + Private_Dirty = Size).
+ * In general, memory mapped in to a userspace process is accounted unless
+ * it was mapped with remap_pfn_range.
+ * Exactly one of these must be set.
+ *
+ * SHARED/SHARED_PSS/PRIVATE
+ * Flags to differentiate memory shared across multiple processes vs. memory
+ * used by a single process.
+ * If SHARED_PSS flags is used, the memory must be divided by the number of
+ * processes holding reference to it (shared / num_processes).
+ * Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count shared + private memory.
+ *
+ * SYSTEM/DEDICATED
+ * Flags to differentiate memory taken from the kernel's allocation pool vs.
+ * memory that is dedicated to non-kernel allocations, for example a carveout
+ * or separate video memory. Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count system + dedicated memory.
+ *
+ * NONSECURE/SECURE
+ * Flags to differentiate memory accessible by the CPU in non-secure mode vs.
+ * memory that is protected. Only zero or one of these may be set in a record.
+ * If none are set, record is assumed to count secure + nonsecure memory.
+ */
+enum MemtrackFlag : uint32_t {
+ SMAPS_ACCOUNTED = 1 << 1,
+ SMAPS_UNACCOUNTED = 1 << 2,
+ SHARED = 1 << 3,
+ SHARED_PSS = 1 << 4,
+ PRIVATE = 1 << 5,
+ SYSTEM = 1 << 6,
+ DEDICATED = 1 << 7,
+ NONSECURE = 1 << 8,
+ SECURE = 1 << 9,
+};
+
+/* Tags which define the usage of the memory buffers. */
+enum MemtrackType : uint32_t {
+ OTHER = 0,
+ GL = 1,
+ GRAPHICS = 2,
+ MULTIMEDIA = 3,
+ CAMERA = 4,
+ NUM_TYPES,
+};
+
+enum MemtrackStatus : uint32_t {
+ SUCCESS = 0,
+ MEMORY_TRACKING_NOT_SUPPORTED = 1,
+ TYPE_NOT_SUPPORTED = 2,
+};
+
+/* A vector of MemtrackRecord is returned by the function getMemory().
+ * Each record consists of the size of the memory used by the process and
+ * flags indicate the all the MemtrackFlag that are valid for this record.
+ * see getMemory() comments for further details.
+ */
+struct MemtrackRecord {
+ uint64_t sizeInBytes;
+ /*
+ * This is the bitfield for the MemtrackFlag indicating all the flags that
+ * are valid for this record.
+ */
+ uint32_t flags;
+};
diff --git a/nfc/1.0/vts/Android.mk b/nfc/1.0/vts/Android.mk
new file mode 100644
index 0000000..15084fc
--- /dev/null
+++ b/nfc/1.0/vts/Android.mk
@@ -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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# build profiler for Nfc.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_nfc@1.0
+
+LOCAL_SRC_FILES := \
+ Nfc.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.nfc@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)
+
+# build profiler for NfcClientCallback.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_profiler_hidl_nfc_client_callback_@1.0
+
+LOCAL_SRC_FILES := \
+ NfcClientCallback.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES += \
+ test/vts/drivers/libprofiling \
+
+LOCAL_VTS_MODE := PROFILER
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.nfc@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/nfc/1.0/vts/Nfc.vts b/nfc/1.0/vts/Nfc.vts
new file mode 100644
index 0000000..8b3330f
--- /dev/null
+++ b/nfc/1.0/vts/Nfc.vts
@@ -0,0 +1,83 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "INfc"
+
+package: "android.hardware.nfc"
+
+import: "android.hardware.nfc@1.0::INfcClientCallback"
+import: "android.hardware.nfc@1.0::types"
+
+interface: {
+ api: {
+ name: "open"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_HIDL_CALLBACK
+ predefined_type: "INfcClientCallback"
+ is_callback: true
+ }
+ }
+
+ api: {
+ name: "write"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_STRUCT
+ predefined_type: "nfc_data_t"
+ }
+ }
+
+ api: {
+ name: "core_initialized"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ arg: {
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+ }
+
+ api: {
+ name: "pre_discover"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "close"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "control_granted"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+
+ api: {
+ name: "power_cycle"
+ return_type_hidl: {
+ type: TYPE_SCALAR
+ scalar_type: "int32_t"
+ }
+ }
+}
diff --git a/nfc/1.0/vts/NfcClientCallback.vts b/nfc/1.0/vts/NfcClientCallback.vts
new file mode 100644
index 0000000..aab8c27
--- /dev/null
+++ b/nfc/1.0/vts/NfcClientCallback.vts
@@ -0,0 +1,31 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "INfcClientCallback"
+
+package: "android.hardware.nfc"
+
+import: "android.hardware.nfc@1.0::types"
+
+interface: {
+ api: {
+ name: "sendEvent"
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "nfc_event_t"
+ }
+ arg: {
+ type: TYPE_ENUM
+ predefined_type: "nfc_status_t"
+ }
+ }
+
+ api: {
+ name: "sendData"
+ arg: {
+ type: TYPE_STRUCT
+ predefined_type: "nfc_data_t"
+ is_const: true
+ }
+ }
+}
diff --git a/nfc/1.0/vts/types.vts b/nfc/1.0/vts/types.vts
new file mode 100644
index 0000000..fb1d414
--- /dev/null
+++ b/nfc/1.0/vts/types.vts
@@ -0,0 +1,87 @@
+component_class: HAL_HIDL
+component_type: NFC
+component_type_version: 1.0
+component_name: "types"
+
+package: "android.hardware.nfc"
+
+
+attribute: {
+ name: "nfc_event_t"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "HAL_NFC_OPEN_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "HAL_NFC_CLOSE_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "HAL_NFC_POST_INIT_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "HAL_NFC_PRE_DISCOVER_CPLT_EVT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "HAL_NFC_REQUEST_CONTROL_EVT"
+ scalar_value: {
+ uint32_t: 4
+ }
+ enumerator: "HAL_NFC_RELEASE_CONTROL_EVT"
+ scalar_value: {
+ uint32_t: 5
+ }
+ enumerator: "HAL_NFC_ERROR_EVT"
+ scalar_value: {
+ uint32_t: 6
+ }
+ }
+}
+
+attribute: {
+ name: "nfc_status_t"
+ type: TYPE_ENUM
+ enum_value: {
+ scalar_type: "uint32_t"
+
+ enumerator: "HAL_NFC_STATUS_OK"
+ scalar_value: {
+ uint32_t: 0
+ }
+ enumerator: "HAL_NFC_STATUS_FAILED"
+ scalar_value: {
+ uint32_t: 1
+ }
+ enumerator: "HAL_NFC_STATUS_ERR_TRANSPORT"
+ scalar_value: {
+ uint32_t: 2
+ }
+ enumerator: "HAL_NFC_STATUS_ERR_CMD_TIMEOUT"
+ scalar_value: {
+ uint32_t: 3
+ }
+ enumerator: "HAL_NFC_STATUS_REFUSED"
+ scalar_value: {
+ uint32_t: 4
+ }
+ }
+}
+
+attribute: {
+ name: "nfc_data_t"
+ type: TYPE_STRUCT
+ struct_value: {
+ name: "data"
+ type: TYPE_VECTOR
+ vector_value: {
+ type: TYPE_SCALAR
+ scalar_type: "uint8_t"
+ }
+ }
+}
+
diff --git a/vibrator/1.0/Android.bp b/vibrator/1.0/Android.bp
new file mode 100644
index 0000000..64afdb5
--- /dev/null
+++ b/vibrator/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+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",
+ srcs: [
+ "types.hal",
+ "IVibrator.hal",
+ ],
+ out: [
+ "android/hardware/vibrator/1.0/types.cpp",
+ "android/hardware/vibrator/1.0/VibratorAll.cpp",
+ ],
+}
+
+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",
+ srcs: [
+ "types.hal",
+ "IVibrator.hal",
+ ],
+ out: [
+ "android/hardware/vibrator/1.0/types.h",
+ "android/hardware/vibrator/1.0/IVibrator.h",
+ "android/hardware/vibrator/1.0/IHwVibrator.h",
+ "android/hardware/vibrator/1.0/BnVibrator.h",
+ "android/hardware/vibrator/1.0/BpVibrator.h",
+ "android/hardware/vibrator/1.0/BsVibrator.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.vibrator@1.0",
+ generated_sources: ["android.hardware.vibrator@1.0_genc++"],
+ generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.vibrator@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/vibrator/1.0/Android.mk b/vibrator/1.0/Android.mk
new file mode 100644
index 0000000..54ac2f6
--- /dev/null
+++ b/vibrator/1.0/Android.mk
@@ -0,0 +1,102 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vibrator@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 (Status)
+#
+GEN := $(intermediates)/android/hardware/vibrator/1.0/Status.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.vibrator@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVibrator.hal
+#
+GEN := $(intermediates)/android/hardware/vibrator/1.0/IVibrator.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.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.vibrator@1.0::IVibrator
+
+$(GEN): $(LOCAL_PATH)/IVibrator.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vibrator@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 (Status)
+#
+GEN := $(intermediates)/android/hardware/vibrator/1.0/Status.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.vibrator@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVibrator.hal
+#
+GEN := $(intermediates)/android/hardware/vibrator/1.0/IVibrator.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVibrator.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.vibrator@1.0::IVibrator
+
+$(GEN): $(LOCAL_PATH)/IVibrator.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/vibrator/1.0/IVibrator.hal b/vibrator/1.0/IVibrator.hal
new file mode 100644
index 0000000..0a4ffca
--- /dev/null
+++ b/vibrator/1.0/IVibrator.hal
@@ -0,0 +1,35 @@
+/*
+ * 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.vibrator@1.0;
+
+interface IVibrator {
+ /** Turn on vibrator
+ *
+ * This function must only be called after the previous timeout has expired or
+ * was canceled (through off()).
+ * @param timeout_ms number of milliseconds to vibrate.
+ * @return vibratorOnRet whether vibrator command was successful or not.
+ */
+ on(uint32_t timeoutMs) generates (Status vibratorOnRet);
+
+ /** Turn off vibrator
+ *
+ * Cancel a previously-started vibration, if any.
+ * @return vibratorOffRet whether vibrator command was successful or not.
+ */
+ off() generates (Status vibratorOffRet);
+};
diff --git a/vibrator/1.0/default/Android.mk b/vibrator/1.0/default/Android.mk
new file mode 100644
index 0000000..3bb6f79
--- /dev/null
+++ b/vibrator/1.0/default/Android.mk
@@ -0,0 +1,33 @@
+#
+# 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.vibrator@1.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ Vibrator.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libhidl \
+ liblog \
+ libhwbinder \
+ libutils \
+ libhardware \
+ android.hardware.vibrator@1.0
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/vibrator/1.0/default/Vibrator.cpp b/vibrator/1.0/default/Vibrator.cpp
new file mode 100644
index 0000000..4cd3b30
--- /dev/null
+++ b/vibrator/1.0/default/Vibrator.cpp
@@ -0,0 +1,76 @@
+/*
+ * 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 "VibratorService"
+
+#include <hardware/hardware.h>
+#include <hardware/vibrator.h>
+#include "Vibrator.h"
+
+namespace android {
+namespace hardware {
+namespace vibrator {
+namespace V1_0 {
+namespace implementation {
+
+Vibrator::Vibrator(vibrator_device_t *device) : mDevice(device) {}
+
+// Methods from ::android::hardware::vibrator::V1_0::IVibrator follow.
+Return<Status> Vibrator::on(uint32_t timeout_ms) {
+ int32_t ret = mDevice->vibrator_on(mDevice, timeout_ms);
+ if (ret != 0) {
+ ALOGE("on command failed : %s", strerror(-ret));
+ return Status::ERR;
+ }
+ return Status::OK;
+}
+
+Return<Status> Vibrator::off() {
+ int32_t ret = mDevice->vibrator_off(mDevice);
+ if (ret != 0) {
+ ALOGE("off command failed : %s", strerror(-ret));
+ return Status::ERR;
+ }
+ return Status::OK;
+}
+
+IVibrator* HIDL_FETCH_IVibrator(const char *hal) {
+ vibrator_device_t *vib_device;
+ const hw_module_t *hw_module = nullptr;
+
+ int ret = hw_get_module(hal, &hw_module);
+ if (ret == 0) {
+ ret = vibrator_open(hw_module, &vib_device);
+ if (ret != 0) {
+ ALOGE("vibrator_open %s failed: %d", hal, ret);
+ }
+ } else {
+ ALOGE("hw_get_module %s failed: %d", hal, ret);
+ }
+
+ if (ret == 0) {
+ return new Vibrator(vib_device);
+ } else {
+ ALOGE("Passthrough failed to open legacy HAL.");
+ return nullptr;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace vibrator
+} // namespace hardware
+} // namespace android
diff --git a/vibrator/1.0/default/Vibrator.h b/vibrator/1.0/default/Vibrator.h
new file mode 100644
index 0000000..36c4cc1
--- /dev/null
+++ b/vibrator/1.0/default/Vibrator.h
@@ -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.
+ */
+#ifndef HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
+#define HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
+
+#include <android/hardware/vibrator/1.0/IVibrator.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace vibrator {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::vibrator::V1_0::IVibrator;
+using ::android::hardware::vibrator::V1_0::Status;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Vibrator : public IVibrator {
+ Vibrator(vibrator_device_t *device);
+
+ // Methods from ::android::hardware::vibrator::V1_0::IVibrator follow.
+ Return<Status> on(uint32_t timeoutMs) override;
+ Return<Status> off() override;
+
+ private:
+ vibrator_device_t *mDevice;
+};
+
+extern "C" IVibrator* HIDL_FETCH_IVibrator(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace vibrator
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
diff --git a/vibrator/1.0/types.hal b/vibrator/1.0/types.hal
new file mode 100644
index 0000000..8fc5683
--- /dev/null
+++ b/vibrator/1.0/types.hal
@@ -0,0 +1,22 @@
+/*
+ * 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.vibrator@1.0;
+
+enum Status: uint32_t {
+ OK = 0,
+ ERR = 1
+};