Merge "Update vts files for nfc hidl file style change."
diff --git a/Android.bp b/Android.bp
index 3ab2070..2ef4e4c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,11 +1,22 @@
// This is an autogenerated file, do not edit.
subdirs = [
+ "audio/2.0",
"audio/common/2.0",
"audio/effect/2.0",
"benchmarks/msgq/1.0",
+ "graphics/allocator/2.0",
+ "graphics/allocator/2.0/default",
+ "graphics/mapper/2.0",
+ "graphics/mapper/2.0/default",
+ "light/2.0",
+ "memtrack/1.0",
+ "memtrack/1.0/default",
"nfc/1.0",
"nfc/1.0/default",
+ "power/1.0",
+ "power/1.0/default",
"radio/1.0",
+ "soundtrigger/2.0",
"tests/bar/1.0",
"tests/baz/1.0",
"tests/expression/1.0",
@@ -13,6 +24,7 @@
"tests/libhwbinder/1.0",
"tests/msgq/1.0",
"tests/pointer/1.0",
+ "vehicle/2.0",
"vibrator/1.0",
"wifi/1.0",
"wifi/supplicant/1.0",
diff --git a/audio/2.0/Android.bp b/audio/2.0/Android.bp
new file mode 100644
index 0000000..5edb042
--- /dev/null
+++ b/audio/2.0/Android.bp
@@ -0,0 +1,96 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.audio@2.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
+ srcs: [
+ "types.hal",
+ "IDevice.hal",
+ "IDevicesFactory.hal",
+ "IPrimaryDevice.hal",
+ "IStream.hal",
+ "IStreamIn.hal",
+ "IStreamOut.hal",
+ "IStreamOutCallback.hal",
+ ],
+ out: [
+ "android/hardware/audio/2.0/types.cpp",
+ "android/hardware/audio/2.0/DeviceAll.cpp",
+ "android/hardware/audio/2.0/DevicesFactoryAll.cpp",
+ "android/hardware/audio/2.0/PrimaryDeviceAll.cpp",
+ "android/hardware/audio/2.0/StreamAll.cpp",
+ "android/hardware/audio/2.0/StreamInAll.cpp",
+ "android/hardware/audio/2.0/StreamOutAll.cpp",
+ "android/hardware/audio/2.0/StreamOutCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.audio@2.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.audio@2.0",
+ srcs: [
+ "types.hal",
+ "IDevice.hal",
+ "IDevicesFactory.hal",
+ "IPrimaryDevice.hal",
+ "IStream.hal",
+ "IStreamIn.hal",
+ "IStreamOut.hal",
+ "IStreamOutCallback.hal",
+ ],
+ out: [
+ "android/hardware/audio/2.0/types.h",
+ "android/hardware/audio/2.0/IDevice.h",
+ "android/hardware/audio/2.0/IHwDevice.h",
+ "android/hardware/audio/2.0/BnDevice.h",
+ "android/hardware/audio/2.0/BpDevice.h",
+ "android/hardware/audio/2.0/BsDevice.h",
+ "android/hardware/audio/2.0/IDevicesFactory.h",
+ "android/hardware/audio/2.0/IHwDevicesFactory.h",
+ "android/hardware/audio/2.0/BnDevicesFactory.h",
+ "android/hardware/audio/2.0/BpDevicesFactory.h",
+ "android/hardware/audio/2.0/BsDevicesFactory.h",
+ "android/hardware/audio/2.0/IPrimaryDevice.h",
+ "android/hardware/audio/2.0/IHwPrimaryDevice.h",
+ "android/hardware/audio/2.0/BnPrimaryDevice.h",
+ "android/hardware/audio/2.0/BpPrimaryDevice.h",
+ "android/hardware/audio/2.0/BsPrimaryDevice.h",
+ "android/hardware/audio/2.0/IStream.h",
+ "android/hardware/audio/2.0/IHwStream.h",
+ "android/hardware/audio/2.0/BnStream.h",
+ "android/hardware/audio/2.0/BpStream.h",
+ "android/hardware/audio/2.0/BsStream.h",
+ "android/hardware/audio/2.0/IStreamIn.h",
+ "android/hardware/audio/2.0/IHwStreamIn.h",
+ "android/hardware/audio/2.0/BnStreamIn.h",
+ "android/hardware/audio/2.0/BpStreamIn.h",
+ "android/hardware/audio/2.0/BsStreamIn.h",
+ "android/hardware/audio/2.0/IStreamOut.h",
+ "android/hardware/audio/2.0/IHwStreamOut.h",
+ "android/hardware/audio/2.0/BnStreamOut.h",
+ "android/hardware/audio/2.0/BpStreamOut.h",
+ "android/hardware/audio/2.0/BsStreamOut.h",
+ "android/hardware/audio/2.0/IStreamOutCallback.h",
+ "android/hardware/audio/2.0/IHwStreamOutCallback.h",
+ "android/hardware/audio/2.0/BnStreamOutCallback.h",
+ "android/hardware/audio/2.0/BpStreamOutCallback.h",
+ "android/hardware/audio/2.0/BsStreamOutCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.audio@2.0",
+ generated_sources: ["android.hardware.audio@2.0_genc++"],
+ generated_headers: ["android.hardware.audio@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.audio@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.effect@2.0",
+ ],
+}
diff --git a/audio/2.0/IDevice.hal b/audio/2.0/IDevice.hal
new file mode 100644
index 0000000..84e0d28
--- /dev/null
+++ b/audio/2.0/IDevice.hal
@@ -0,0 +1,226 @@
+/*
+ * 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@2.0;
+
+import android.hardware.audio.common@2.0;
+import IStreamIn;
+import IStreamOut;
+
+interface IDevice {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ /*
+ * Returns whether the audio hardware interface has been initialized.
+ *
+ * @return retval OK on success, NOT_INITIALIZED on failure.
+ */
+ initCheck() generates (Result retval);
+
+ /*
+ * Sets the audio volume for all audio activities other than voice call. If
+ * NOT_SUPPORTED is returned, the software mixer will emulate this
+ * capability.
+ *
+ * @param volume 1.0f means unity, 0.0f is zero.
+ * @return retval operation completion status.
+ */
+ setMasterVolume(float volume) generates (Result retval);
+
+ /*
+ * Get the current master volume value for the HAL, if the HAL supports
+ * master volume control. For example, AudioFlinger will query this value
+ * from the primary audio HAL when the service starts and use the value for
+ * setting the initial master volume across all HALs. HALs which do not
+ * support this method must return NOT_SUPPORTED in 'retval'.
+ *
+ * @return retval operation completion status.
+ * @return volume 1.0f means unity, 0.0f is zero.
+ */
+ getMasterVolume() generates (Result retval, float volume);
+
+ /*
+ * Sets microphone muting state.
+ *
+ * @param mute whether microphone is muted.
+ * @return retval operation completion status.
+ */
+ setMicMute(bool mute) generates (Result retval);
+
+ /*
+ * Gets whether microphone is muted.
+ *
+ * @return retval operation completion status.
+ * @return mute whether microphone is muted.
+ */
+ getMicMute() generates (Result retval, bool mute);
+
+ /*
+ * Set the audio mute status for all audio activities. If the return value
+ * is NOT_SUPPORTED, the software mixer will emulate this capability.
+ *
+ * @param mute whether audio is muted.
+ * @return retval operation completion status.
+ */
+ setMasterMute(bool mute) generates (Result retval);
+
+ /**
+ * Get the current master mute status for the HAL, if the HAL supports
+ * master mute control. AudioFlinger will query this value from the primary
+ * audio HAL when the service starts and use the value for setting the
+ * initial master mute across all HALs. HAL must indicate that the feature
+ * is not supported by returning NOT_SUPPORTED status.
+ *
+ * @return retval operation completion status.
+ * @return mute whether audio is muted.
+ */
+ getMasterMute() generates (Result retval, bool mute);
+
+ /*
+ * Returns audio input buffer size according to parameters passed or
+ * INVALID_ARGUMENTS if one of the parameters is not supported.
+ *
+ * @param config audio configuration.
+ * @return retval operation completion status.
+ * @return bufferSize input buffer size in bytes.
+ */
+ getInputBufferSize(AudioConfig config)
+ generates (Result retval, uint64_t bufferSize);
+
+ /*
+ * This method creates and opens the audio hardware output stream.
+ *
+ * @param ioHandle handle assigned by AudioFlinger.
+ * @param device device type and (if needed) address.
+ * @param config stream configuration.
+ * @param flags additional flags.
+ * @return retval operation completion status.
+ * @return outStream created output stream.
+ */
+ openOutputStream(
+ AudioIoHandle ioHandle,
+ DeviceAddress device,
+ AudioConfig config,
+ AudioOutputFlag flags) generates (Result retval, IStreamOut outStream);
+
+ /*
+ * This method creates and opens the audio hardware input stream.
+ *
+ * @param ioHandle handle assigned by AudioFlinger.
+ * @param device device type and (if needed) address.
+ * @param config stream configuration.
+ * @param flags additional flags.
+ * @param source source specification.
+ * @return retval operation completion status.
+ * @return inStream created input stream.
+ */
+ openInputStream(
+ AudioIoHandle ioHandle,
+ DeviceAddress device,
+ AudioConfig config,
+ AudioInputFlag flags,
+ AudioSource source) generates (Result retval, IStreamIn inStream);
+
+ /*
+ * Creates an audio patch between several source and sink ports. The handle
+ * is allocated by the HAL and must be unique for this audio HAL module.
+ *
+ * @param sources patch sources.
+ * @param sinks patch sinks.
+ * @return retval operation completion status.
+ * @return patch created patch handle.
+ */
+ createAudioPatch(vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
+ generates (Result retval, AudioPatchHandle patch);
+
+ /*
+ * Release an audio patch.
+ *
+ * @param patch patch handle.
+ * @return retval operation completion status.
+ */
+ releaseAudioPatch(AudioPatchHandle patch) generates (Result retval);
+
+ /*
+ * Returns the list of supported attributes for a given audio port.
+ *
+ * As input, 'port' contains the information (type, role, address etc...)
+ * needed by the HAL to identify the port.
+ *
+ * As output, 'port' contains possible attributes (sampling rates, formats,
+ * channel masks, gain controllers...) for this port.
+ *
+ * @param port port identifier.
+ * @return retval operation completion status.
+ * @return port port descriptor with all parameters filled up.
+ */
+ getAudioPort(AudioPort port)
+ generates (Result retval, AudioPort port);
+
+ /*
+ * Set audio port configuration.
+ *
+ * @param config audio port configuration.
+ * @return retval operation completion status.
+ */
+ setAudioPortConfig(AudioPortConfig config) generates (Result retval);
+
+ /*
+ * Gets the HW synchronization source of the device. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy
+ * HAL.
+ *
+ * @return retval operation completion status.
+ * @return hwAvSync HW synchronization source
+ */
+ getHwAvSync() generates (Result retval, AudioHwSync hwAvSync);
+
+ /*
+ * Sets whether the screen is on. Calling this method is equivalent to
+ * setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
+ */
+ setScreenState(bool turnedOn);
+
+ /*
+ * Generic method for retrieving vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * @param keys parameter keys.
+ * @return retval operation completion status.
+ * @return parameters parameter key value pairs.
+ */
+ getParameters(vec<string> keys)
+ generates (Result retval, vec<ParameterValue> parameters);
+
+ /*
+ * Generic method for setting vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * @param parameters parameter key value pairs.
+ * @return retval operation completion status.
+ */
+ setParameters(vec<ParameterValue> parameters) generates (Result retval);
+
+ /*
+ * Dumps information about the stream into the provided file descriptor.
+ * This is used for the dumpsys facility.
+ *
+ * @param fd dump file descriptor.
+ */
+ debugDump(handle fd);
+};
diff --git a/audio/2.0/IDevicesFactory.hal b/audio/2.0/IDevicesFactory.hal
new file mode 100644
index 0000000..a4e6956
--- /dev/null
+++ b/audio/2.0/IDevicesFactory.hal
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio@2.0;
+
+import android.hardware.audio.common@2.0;
+import IDevice;
+
+interface IDevicesFactory {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ enum Device {
+ PRIMARY,
+ A2DP,
+ USB,
+ R_SUBMIX
+ };
+
+ /*
+ * Opens an audio device. To close the device, it is necessary to release
+ * references to the returned device object.
+ *
+ * @param device device type.
+ * @return retval operation completion status. Returns INVALID_ARGUMENTS
+ * if there is no corresponding hardware module found,
+ * NOT_INITIALIZED if an error occured while opening the hardware
+ * module.
+ * @return result the interface for the created device.
+ */
+ openDevice(Device device) generates (Result retval, IDevice result);
+};
diff --git a/audio/2.0/IPrimaryDevice.hal b/audio/2.0/IPrimaryDevice.hal
new file mode 100644
index 0000000..6beddfe
--- /dev/null
+++ b/audio/2.0/IPrimaryDevice.hal
@@ -0,0 +1,123 @@
+/*
+ * 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@2.0;
+
+import android.hardware.audio.common@2.0;
+import IDevice;
+
+interface IPrimaryDevice extends IDevice {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ /*
+ * Sets the audio volume of a voice call.
+ *
+ * @param volume 1.0f means unity, 0.0f is zero.
+ * @return retval operation completion status.
+ */
+ setVoiceVolume(float volume) generates (Result retval);
+
+ /*
+ * This method is used to notify the HAL about audio mode changes.
+ *
+ * @param mode new mode.
+ * @return retval operation completion status.
+ */
+ setMode(AudioMode mode) generates (Result retval);
+
+ /*
+ * Gets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
+ * Calling this method is equivalent to getting AUDIO_PARAMETER_KEY_BT_NREC
+ * on the legacy HAL.
+ *
+ * @return retval operation completion status.
+ * @return enabled whether BT SCO NR + EC are enabled.
+ */
+ getBtScoNrecEnabled() generates (Result retval, bool enabled);
+
+ /*
+ * Sets whether BT SCO Noise Reduction and Echo Cancellation are enabled.
+ * Calling this method is equivalent to setting AUDIO_PARAMETER_KEY_BT_NREC
+ * on the legacy HAL.
+ *
+ * @param enabled whether BT SCO NR + EC are enabled.
+ * @return retval operation completion status.
+ */
+ setBtScoNrecEnabled(bool enabled) generates (Result retval);
+
+ /*
+ * Gets whether BT SCO Wideband mode is enabled. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
+ *
+ * @return retval operation completion status.
+ * @return enabled whether BT Wideband is enabled.
+ */
+ getBtScoWidebandEnabled() generates (Result retval, bool enabled);
+
+ /*
+ * Sets whether BT SCO Wideband mode is enabled. Calling this method is
+ * equivalent to setting AUDIO_PARAMETER_KEY_BT_SCO_WB on the legacy HAL.
+ *
+ * @param enabled whether BT Wideband is enabled.
+ * @return retval operation completion status.
+ */
+ setBtScoWidebandEnabled(bool enabled) generates (Result retval);
+
+ enum TtyMode {
+ OFF,
+ VCO,
+ HCO,
+ FULL
+ };
+
+ /*
+ * Gets current TTY mode selection. Calling this method is equivalent to
+ * getting AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
+ *
+ * @return retval operation completion status.
+ * @return mode TTY mode.
+ */
+ getTtyMode() generates (Result retval, TtyMode mode);
+
+ /*
+ * Sets current TTY mode. Calling this method is equivalent to setting
+ * AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
+ *
+ * @param mode TTY mode.
+ * @return retval operation completion status.
+ */
+ setTtyMode(TtyMode mode) generates (Result retval);
+
+ /*
+ * Gets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
+ * enabled. Calling this method is equivalent to getting
+ * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
+ *
+ * @return retval operation completion status.
+ * @return enabled whether HAC mode is enabled.
+ */
+ getHacEnabled() generates (Result retval, bool enabled);
+
+ /*
+ * Sets whether Hearing Aid Compatibility - Telecoil (HAC-T) mode is
+ * enabled. Calling this method is equivalent to setting
+ * AUDIO_PARAMETER_KEY_HAC on the legacy HAL.
+ *
+ * @param enabled whether HAC mode is enabled.
+ * @return retval operation completion status.
+ */
+ setHacEnabled(bool enabled) generates (Result retval);
+};
diff --git a/audio/2.0/IStream.hal b/audio/2.0/IStream.hal
new file mode 100644
index 0000000..09ba42a
--- /dev/null
+++ b/audio/2.0/IStream.hal
@@ -0,0 +1,229 @@
+/*
+ * 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@2.0;
+
+import android.hardware.audio.common@2.0;
+import android.hardware.audio.effect@2.0::IEffect;
+
+interface IStream {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ /*
+ * Return the frame size (number of bytes per sample).
+ *
+ * @return frameSize frame size in bytes.
+ */
+ getFrameSize() generates (uint64_t frameSize);
+
+ /*
+ * Return the frame count of the buffer. Calling this method is equivalent
+ * to getting AUDIO_PARAMETER_STREAM_FRAME_COUNT on the legacy HAL.
+ *
+ * @return count frame count.
+ */
+ getFrameCount() generates (uint64_t count);
+
+ /*
+ * Return the size of input/output buffer in bytes for this stream.
+ * It must be a multiple of the frame size.
+ *
+ * @return buffer buffer size in bytes.
+ */
+ getBufferSize() generates (uint64_t bufferSize);
+
+ /*
+ * Return the sampling rate in Hz.
+ *
+ * @return sampleRateHz sample rate in Hz.
+ */
+ getSampleRate() generates (uint32_t sampleRateHz);
+
+ /*
+ * Return supported sampling rates of the stream. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES on the
+ * legacy HAL.
+ *
+ * @return sampleRateHz supported sample rates.
+ */
+ getSupportedSampleRates() generates (vec<uint32_t> sampleRates);
+
+ /*
+ * Sets the sampling rate of the stream. Calling this method is equivalent
+ * to setting AUDIO_PARAMETER_STREAM_SAMPLING_RATE on the legacy HAL.
+ *
+ * @param sampleRateHz sample rate in Hz.
+ * @return retval operation completion status.
+ */
+ setSampleRate(uint32_t sampleRateHz) generates (Result retval);
+
+ /*
+ * Return the channel mask of the stream.
+ *
+ * @return mask channel mask.
+ */
+ getChannelMask() generates (AudioChannelMask mask);
+
+ /*
+ * Return supported channel masks of the stream. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_CHANNELS on the legacy
+ * HAL.
+ *
+ * @return masks supported audio masks.
+ */
+ getSupportedChannelMasks() generates (vec<AudioChannelMask> masks);
+
+ /*
+ * Sets the channel mask of the stream. Calling this method is equivalent to
+ * setting AUDIO_PARAMETER_STREAM_CHANNELS on the legacy HAL.
+ *
+ * @param format audio format.
+ * @return retval operation completion status.
+ */
+ setChannelMask(AudioChannelMask mask) generates (Result retval);
+
+ /*
+ * Return the audio format of the stream.
+ *
+ * @return format audio format.
+ */
+ getFormat() generates (AudioFormat format);
+
+ /*
+ * Return supported audio formats of the stream. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_FORMATS on the legacy
+ * HAL.
+ *
+ * @return formats supported audio formats.
+ */
+ getSupportedFormats() generates (vec<AudioFormat> formats);
+
+ /*
+ * Sets the audio format of the stream. Calling this method is equivalent to
+ * setting AUDIO_PARAMETER_STREAM_FORMAT on the legacy HAL.
+ *
+ * @param format audio format.
+ * @return retval operation completion status.
+ */
+ setFormat(AudioFormat format) generates (Result retval);
+
+ /*
+ * Convenience method for retrieving several stream parameters in
+ * one transaction.
+ *
+ * @return sampleRateHz sample rate in Hz.
+ * @return mask channel mask.
+ * @return format audio format.
+ */
+ getAudioProperties() generates (
+ uint32_t sampleRateHz, AudioChannelMask mask, AudioFormat format);
+
+ /*
+ * Applies audio effect to the stream.
+ *
+ * @param effect the effect to apply.
+ * @return retval operation completion status.
+ */
+ addEffect(IEffect effect) generates (Result retval);
+
+ /*
+ * Stops application of the effect to the stream.
+ *
+ * @param effect the effect to apply.
+ * @return retval operation completion status.
+ */
+ removeEffect(IEffect effect) generates (Result retval);
+
+ /*
+ * Put the audio hardware input/output into standby mode.
+ * Driver must exit from standby mode at the next I/O operation.
+ *
+ * @return retval operation completion status.
+ */
+ standby() generates (Result retval);
+
+ /*
+ * Return the set of device(s) which this stream is connected to.
+ *
+ * @return retval operation completion status.
+ * @return device set of device(s) which this stream is connected to.
+ */
+ getDevice() generates (Result retval, AudioDevice device);
+
+ /*
+ * Connects the stream to the device.
+ *
+ * This method must only be used for HALs that do not support
+ * 'IDevice.createAudioPatch' method. Calling this method is
+ * equivalent to setting AUDIO_PARAMETER_STREAM_ROUTING in the legacy HAL
+ * interface.
+ *
+ * @param address device to connect the stream to.
+ * @return retval operation completion status.
+ */
+ setDevice(DeviceAddress address) generates (Result retval);
+
+ /*
+ * Notifies the stream about device connection state. Calling this method is
+ * equivalent to setting AUDIO_PARAMETER_DEVICE_[DIS]CONNECT on the legacy
+ * HAL.
+ *
+ * @param address audio device specification.
+ * @param connected whether the device is connected.
+ * @return retval operation completion status.
+ */
+ setConnectedState(DeviceAddress address, bool connected)
+ generates (Result retval);
+
+ /*
+ * Sets the HW synchronization source. Calling this method is equivalent to
+ * setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
+ *
+ * @param hwAvSync HW synchronization source
+ * @return retval operation completion status.
+ */
+ setHwAvSync(AudioHwSync hwAvSync) generates (Result retval);
+
+ /*
+ * Generic method for retrieving vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * @param keys parameter keys.
+ * @return retval operation completion status.
+ * @return parameters parameter key value pairs.
+ */
+ getParameters(vec<string> keys)
+ generates (Result retval, vec<ParameterValue> parameters);
+
+ /*
+ * Generic method for setting vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * @param parameters parameter key value pairs.
+ * @return retval operation completion status.
+ */
+ setParameters(vec<ParameterValue> parameters) generates (Result retval);
+
+ /*
+ * Dumps information about the stream into the provided file descriptor.
+ * This is used for the dumpsys facility.
+ *
+ * @param fd dump file descriptor.
+ */
+ debugDump(handle fd);
+};
diff --git a/audio/2.0/IStreamIn.hal b/audio/2.0/IStreamIn.hal
new file mode 100644
index 0000000..049df75
--- /dev/null
+++ b/audio/2.0/IStreamIn.hal
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio@2.0;
+
+import android.hardware.audio.common@2.0;
+import IStream;
+
+interface IStreamIn extends IStream {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ /*
+ * Returns the source descriptor of the input stream. Calling this method is
+ * equivalent to getting AUDIO_PARAMETER_STREAM_INPUT_SOURCE on the legacy
+ * HAL.
+ *
+ * @return retval operation completion status.
+ * @return source audio source.
+ */
+ getAudioSource() generates (Result retval, AudioSource source);
+
+ /*
+ * Set the input gain for the audio driver.
+ *
+ * @param gain 1.0f is unity, 0.0f is zero.
+ * @result retval operation completion status.
+ */
+ setGain(float gain) generates (Result retval);
+
+ /*
+ * Read audio buffer in from driver. If at least one frame was read prior to
+ * the error, 'read' must return that byte count and then return an error
+ * in the subsequent call.
+ *
+ * @param size maximum amount of bytes to read.
+ * @return retval operation completion status.
+ * @return data audio data.
+ */
+ // TODO(mnaganov): Replace with FMQ version.
+ read(uint64_t size) generates (Result retval, vec<uint8_t> data);
+
+ /*
+ * Return the amount of input frames lost in the audio driver since the last
+ * call of this function.
+ *
+ * Audio driver is expected to reset the value to 0 and restart counting
+ * upon returning the current value by this function call. Such loss
+ * typically occurs when the user space process is blocked longer than the
+ * capacity of audio driver buffers.
+ *
+ * @return retval operation completion status.
+ * @return framesLost the number of input audio frames lost.
+ */
+ getInputFramesLost() generates (Result retval, uint32_t framesLost);
+
+ /**
+ * Return a recent count of the number of audio frames received and the
+ * clock time associated with that frame count.
+ *
+ * @return retval INVALID_STATE if the device is not ready/available,
+ * NOT_SUPPORTED if the command is not supported,
+ * OK otherwise.
+ * @return frames the total frame count received. This must be as early in
+ * the capture pipeline as possible. In general, frames
+ * must be non-negative and must not go "backwards".
+ * @return time is the clock monotonic time when frames was measured. In
+ * general, time must be a positive quantity and must not
+ * go "backwards".
+ */
+ getCapturePosition()
+ generates (Result retval, uint64_t frames, uint64_t time);
+};
diff --git a/audio/2.0/IStreamOut.hal b/audio/2.0/IStreamOut.hal
new file mode 100644
index 0000000..adce538
--- /dev/null
+++ b/audio/2.0/IStreamOut.hal
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.audio@2.0;
+
+import android.hardware.audio.common@2.0;
+import IStream;
+import IStreamOutCallback;
+
+interface IStreamOut extends IStream {
+ typedef android.hardware.audio@2.0::Result Result;
+
+ /*
+ * Return the audio hardware driver estimated latency in milliseconds.
+ *
+ * @return latencyMs latency in milliseconds.
+ */
+ getLatency() generates (uint32_t latencyMs);
+
+ /*
+ * This method is used in situations where audio mixing is done in the
+ * hardware. This method serves as a direct interface with hardware,
+ * allowing to directly set the volume as apposed to via the framework.
+ * This method might produce multiple PCM outputs or hardware accelerated
+ * codecs, such as MP3 or AAC.
+ *
+ * @param left left channel attenuation, 1.0f is unity, 0.0f is zero.
+ * @param right right channel attenuation, 1.0f is unity, 0.0f is zero.
+ * @return retval operation completion status.
+ */
+ setVolume(float left, float right) generates (Result retval);
+
+ /*
+ * Write audio buffer to driver. On success, sets 'retval' to 'OK', and
+ * returns number of bytes written. If at least one frame was written
+ * successfully prior to the error, it is suggested that the driver return
+ * that successful (short) byte count and then return an error in the
+ * subsequent call.
+ *
+ * If 'setCallback' has previously been called to enable non-blocking mode
+ * then 'write' is not allowed to block. It must write only the number of
+ * bytes that currently fit in the driver/hardware buffer and then return
+ * this byte count. If this is less than the requested write size the
+ * callback function must be called when more space is available in the
+ * driver/hardware buffer.
+ *
+ * @param data audio data.
+ * @return retval operation completion status.
+ * @return written number of bytes written.
+ */
+ // TODO(mnaganov): Replace with FMQ version.
+ write(vec<uint8_t> data) generates (Result retval, uint64_t written);
+
+ /*
+ * Return the number of audio frames written by the audio DSP to DAC since
+ * the output has exited standby.
+ *
+ * @return retval operation completion status.
+ * @return dspFrames number of audio frames written.
+ */
+ getRenderPosition() generates (Result retval, uint32_t dspFrames);
+
+ /*
+ * Get the local time at which the next write to the audio driver will be
+ * presented. The units are microseconds, where the epoch is decided by the
+ * local audio HAL.
+ *
+ * @return retval operation completion status.
+ * @return timestampUs time of the next write.
+ */
+ getNextWriteTimestamp() generates (Result retval, int64_t timestampUs);
+
+ /*
+ * Set the callback interface for notifying completion of non-blocking
+ * write and drain.
+ *
+ * Calling this function implies that all future 'write' and 'drain'
+ * must be non-blocking and use the callback to signal completion.
+ *
+ * @return retval operation completion status.
+ */
+ setCallback(IStreamOutCallback callback) generates (Result retval);
+
+ /*
+ * Returns whether HAL supports pausing and resuming of streams.
+ *
+ * @return supportsPause true if pausing is supported.
+ * @return supportsResume true if resume is supported.
+ */
+ supportsPauseAndResume()
+ generates (bool supportsPause, bool supportsResume);
+
+ /**
+ * Notifies to the audio driver to stop playback however the queued buffers
+ * are retained by the hardware. Useful for implementing pause/resume. Empty
+ * implementation if not supported however must be implemented for hardware
+ * with non-trivial latency. In the pause state, some audio hardware may
+ * still be using power. Client code may consider calling 'suspend' after a
+ * timeout to prevent that excess power usage.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ *
+ * @return retval operation completion status.
+ */
+ pause() generates (Result retval);
+
+ /*
+ * Notifies to the audio driver to resume playback following a pause.
+ * Returns error INVALID_STATE if called without matching pause.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ *
+ * @return retval operation completion status.
+ */
+ resume() generates (Result retval);
+
+ /*
+ * Returns whether HAL supports draining of streams.
+ *
+ * @return supports true if draining is supported.
+ */
+ supportsDrain() generates (bool supports);
+
+ /**
+ * Requests notification when data buffered by the driver/hardware has been
+ * played. If 'setCallback' has previously been called to enable
+ * non-blocking mode, then 'drain' must not block, instead it must return
+ * quickly and completion of the drain is notified through the callback. If
+ * 'setCallback' has not been called, then 'drain' must block until
+ * completion.
+ *
+ * If 'type' is 'AUDIO_DRAIN_ALL', the drain completes when all previously
+ * written data has been played.
+ *
+ * If 'type' is 'AUDIO_DRAIN_EARLY_NOTIFY', the drain completes shortly
+ * before all data for the current track has played to allow time for the
+ * framework to perform a gapless track switch.
+ *
+ * Drain must return immediately on 'stop' and 'flush' calls.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ *
+ * @param type type of drain.
+ * @return retval operation completion status.
+ */
+ drain(AudioDrain type) generates (Result retval);
+
+ /*
+ * Notifies to the audio driver to flush the queued data. Stream must
+ * already be paused before calling 'flush'.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ *
+ * @return retval operation completion status.
+ */
+ flush() generates (Result retval);
+
+ /*
+ * Return a recent count of the number of audio frames presented to an
+ * external observer. This excludes frames which have been written but are
+ * still in the pipeline. The count is not reset to zero when output enters
+ * standby. Also returns the value of CLOCK_MONOTONIC as of this
+ * presentation count. The returned count is expected to be 'recent', but
+ * does not need to be the most recent possible value. However, the
+ * associated time must correspond to whatever count is returned.
+ *
+ * Example: assume that N+M frames have been presented, where M is a 'small'
+ * number. Then it is permissible to return N instead of N+M, and the
+ * timestamp must correspond to N rather than N+M. The terms 'recent' and
+ * 'small' are not defined. They reflect the quality of the implementation.
+ *
+ * @return retval operation completion status.
+ * @return frames count of presented audio frames.
+ * @return timeStamp associated clock time.
+ */
+ getPresentationPosition()
+ generates (Result retval, uint64_t frames, TimeSpec timeStamp);
+};
diff --git a/audio/2.0/IStreamOutCallback.hal b/audio/2.0/IStreamOutCallback.hal
new file mode 100644
index 0000000..267c46d
--- /dev/null
+++ b/audio/2.0/IStreamOutCallback.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@2.0;
+
+/*
+ * Asynchronous write callback interface.
+ */
+interface IStreamOutCallback {
+ /*
+ * Non blocking write completed.
+ */
+ onWriteReady();
+
+ /*
+ * Drain completed.
+ */
+ onDrainReady();
+
+ /*
+ * Stream hit an error.
+ */
+ onError();
+};
diff --git a/audio/2.0/types.hal b/audio/2.0/types.hal
new file mode 100644
index 0000000..6369885
--- /dev/null
+++ b/audio/2.0/types.hal
@@ -0,0 +1,72 @@
+/*
+ * 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@2.0;
+
+import android.hardware.audio.common@2.0;
+
+enum Result {
+ OK,
+ NOT_INITIALIZED,
+ INVALID_ARGUMENTS,
+ INVALID_STATE,
+ NOT_SUPPORTED
+};
+
+@export(name="audio_drain_type_t", value_prefix="AUDIO_DRAIN_")
+enum AudioDrain {
+ /* drain() returns when all data has been played. */
+ ALL,
+ /* drain() returns a short time before all data from the current track has
+ been played to give time for gapless track switch. */
+ EARLY_NOTIFY
+};
+
+/*
+ * A substitute for POSIX timespec.
+ */
+struct TimeSpec {
+ uint64_t tvSec; // seconds
+ uint64_t tvNSec; // nanoseconds
+};
+
+/*
+ * IEEE 802 MAC address.
+ */
+typedef uint8_t[6] MacAddress;
+
+struct ParameterValue {
+ string key;
+ string value;
+};
+
+/*
+ * Specifies a device in case when several devices of the same type
+ * can be connected (e.g. BT A2DP, USB).
+ */
+struct DeviceAddress {
+ AudioDevice device; // discriminator
+ union Address {
+ MacAddress mac; // used for BLUETOOTH_A2DP_*
+ uint8_t[4] ipv4; // used for IP
+ struct Alsa {
+ int32_t card;
+ int32_t device;
+ } alsa; // used for USB_*
+ int32_t busId; // used for BUS
+ } address;
+ string rSubmixAddress; // used for REMOTE_SUBMIX
+};
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
index dd75706..a5ec68d 100644
--- a/audio/common/2.0/types.hal
+++ b/audio/common/2.0/types.hal
@@ -85,90 +85,88 @@
/*
* Audio stream type describing the intented use case of a stream.
*/
-@export(name="audio_stream_type_t")
+@export(name="audio_stream_type_t", value_prefix="AUDIO_STREAM_")
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,
+ DEFAULT = -1,
+ MIN = 0,
+ VOICE_CALL = 0,
+ SYSTEM = 1,
+ RING = 2,
+ MUSIC = 3,
+ ALARM = 4,
+ NOTIFICATION = 5,
+ BLUETOOTH_SCO = 6,
+ ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be
+ // routed to speaker
+ DTMF = 8,
+ TTS = 9, // Transmitted Through Speaker. Plays over speaker
+ // only, silent on other devices
+ ACCESSIBILITY = 10, // For accessibility talk back prompts
+ REROUTING = 11, // For dynamic policy output mixes
+ PATCH = 12, // For internal audio flinger tracks. Fixed volume
+ PUBLIC_CNT = 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
+ FOR_POLICY_CNT = PATCH,
+ CNT = PATCH + 1
};
-@export(name="audio_source_t")
+@export(name="audio_source_t", value_prefix="AUDIO_SOURCE_")
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,
+ DEFAULT = 0,
+ MIC = 1,
+ VOICE_UPLINK = 2,
+ VOICE_DOWNLINK = 3,
+ VOICE_CALL = 4,
+ CAMCORDER = 5,
+ VOICE_RECOGNITION = 6,
+ 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,
+ REMOTE_SUBMIX = 8,
/*
* Source for unprocessed sound. Usage examples include level measurement
* and raw signal analysis.
*/
- AUDIO_SOURCE_UNPROCESSED = 9,
+ UNPROCESSED = 9,
- AUDIO_SOURCE_CNT,
- AUDIO_SOURCE_MAX = AUDIO_SOURCE_CNT - 1,
- AUDIO_SOURCE_FM_TUNER = 1998,
+ CNT,
+ MAX = CNT - 1,
+ 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.
+ * hotword detection. Same tuning as VOICE_RECOGNITION. Used only
+ * internally by the framework.
*/
- AUDIO_SOURCE_HOTWORD = 1999
+ HOTWORD = 1999
};
typedef int32_t AudioSession;
/*
* Special audio session values.
*/
-@export(name="audio_session_t")
+@export(name="audio_session_t", value_prefix="AUDIO_SESSION_")
enum AudioSessionConsts : int32_t {
/*
* Session for effects attached to a particular output stream
* (value must be less than 0)
*/
- AUDIO_SESSION_OUTPUT_STAGE = -1,
+ 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,
+ 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
@@ -177,13 +175,13 @@
* Corresponds to AudioManager.AUDIO_SESSION_ID_GENERATE and
* AudioSystem.AUDIO_SESSION_ALLOCATE.
*/
- AUDIO_SESSION_ALLOCATE = 0,
+ 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
+ NONE = 0
};
/*
@@ -197,91 +195,73 @@
* 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")
+@export(name="audio_format_t", value_prefix="AUDIO_FORMAT_")
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,
+ INVALID = 0xFFFFFFFFUL,
+ DEFAULT = 0,
+ PCM = 0x00000000UL, /* DO NOT CHANGE */
+ MP3 = 0x01000000UL,
+ AMR_NB = 0x02000000UL,
+ AMR_WB = 0x03000000UL,
+ AAC = 0x04000000UL,
+ HE_AAC_V1 = 0x05000000UL, /* Deprecated, Use AAC_HE_V1*/
+ HE_AAC_V2 = 0x06000000UL, /* Deprecated, Use AAC_HE_V2*/
+ VORBIS = 0x07000000UL,
+ OPUS = 0x08000000UL,
+ AC3 = 0x09000000UL,
+ E_AC3 = 0x0A000000UL,
+ DTS = 0x0B000000UL,
+ 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,
+ IEC61937 = 0x0D000000UL,
+ DOLBY_TRUEHD = 0x0E000000UL,
+ MAIN_MASK = 0xFF000000UL, /* Deprecated */
+ 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)
+ PCM_SUB_16_BIT = 0x1, // PCM signed 16 bits
+ PCM_SUB_8_BIT = 0x2, // PCM unsigned 8 bits
+ PCM_SUB_32_BIT = 0x3, // PCM signed .31 fixed point
+ PCM_SUB_8_24_BIT = 0x4, // PCM signed 8.23 fixed point
+ PCM_SUB_FLOAT = 0x5, // PCM single-precision float pt
+ PCM_SUB_24_BIT_PACKED = 0x6, // PCM signed .23 fix pt (3 bytes)
- AUDIO_FORMAT_MP3_SUB_NONE = 0x0,
+ MP3_SUB_NONE = 0x0,
- AUDIO_FORMAT_AMR_SUB_NONE = 0x0,
+ 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,
+ AAC_SUB_MAIN = 0x1,
+ AAC_SUB_LC = 0x2,
+ AAC_SUB_SSR = 0x4,
+ AAC_SUB_LTP = 0x8,
+ AAC_SUB_HE_V1 = 0x10,
+ AAC_SUB_SCALABLE = 0x20,
+ AAC_SUB_ERLC = 0x40,
+ AAC_SUB_LD = 0x80,
+ AAC_SUB_HE_V2 = 0x100,
+ AAC_SUB_ELD = 0x200,
- AUDIO_FORMAT_VORBIS_SUB_NONE = 0x0,
+ VORBIS_SUB_NONE = 0x0,
/* Aliases */
/* note != AudioFormat.ENCODING_PCM_16BIT */
- AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM |
- AUDIO_FORMAT_PCM_SUB_16_BIT),
+ PCM_16_BIT = (PCM | 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)
+ PCM_8_BIT = (PCM | PCM_SUB_8_BIT),
+ PCM_32_BIT = (PCM | PCM_SUB_32_BIT),
+ PCM_8_24_BIT = (PCM | PCM_SUB_8_24_BIT),
+ PCM_FLOAT = (PCM | PCM_SUB_FLOAT),
+ PCM_24_BIT_PACKED = (PCM | PCM_SUB_24_BIT_PACKED),
+ AAC_MAIN = (AAC | AAC_SUB_MAIN),
+ AAC_LC = (AAC | AAC_SUB_LC),
+ AAC_SSR = (AAC | AAC_SUB_SSR),
+ AAC_LTP = (AAC | AAC_SUB_LTP),
+ AAC_HE_V1 = (AAC | AAC_SUB_HE_V1),
+ AAC_SCALABLE = (AAC | AAC_SUB_SCALABLE),
+ AAC_ERLC = (AAC | AAC_SUB_ERLC),
+ AAC_LD = (AAC | AAC_SUB_LD),
+ AAC_HE_V2 = (AAC | AAC_SUB_HE_V2),
+ AAC_ELD = (AAC | AAC_SUB_ELD)
};
/*
@@ -304,15 +284,15 @@
*
* These are the current representations:
*
- * AUDIO_CHANNEL_REPRESENTATION_POSITION
+ * 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.
+ * OUT_* or IN_* apply to the bits portion. It is not permitted for no bits
+ * to be set.
*
- * AUDIO_CHANNEL_REPRESENTATION_INDEX
+ * 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
@@ -326,314 +306,282 @@
* checking the channel mask, the implementer should look for ways to fix it
* with additional information outside of the mask.
*/
-@export(name="")
+@export(name="", value_prefix="AUDIO_CHANNEL_")
enum AudioChannelMask : uint32_t {
- AUDIO_CHANNEL_REPRESENTATION_POSITION = 0, /* must be 0 for compatibility */
+ REPRESENTATION_POSITION = 0, /* must be 0 for compatibility */
/* 1 is reserved for future use */
- AUDIO_CHANNEL_REPRESENTATION_INDEX = 2,
+ 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,
+ NONE = 0x0,
+ INVALID = 0xC0000000,
/*
* These can be the bits portion of an AudioChannelMask
- * with representation AUDIO_CHANNEL_REPRESENTATION_POSITION.
+ * with representation 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,
+ OUT_FRONT_LEFT = 0x1,
+ OUT_FRONT_RIGHT = 0x2,
+ OUT_FRONT_CENTER = 0x4,
+ OUT_LOW_FREQUENCY = 0x8,
+ OUT_BACK_LEFT = 0x10,
+ OUT_BACK_RIGHT = 0x20,
+ OUT_FRONT_LEFT_OF_CENTER = 0x40,
+ OUT_FRONT_RIGHT_OF_CENTER = 0x80,
+ OUT_BACK_CENTER = 0x100,
+ OUT_SIDE_LEFT = 0x200,
+ OUT_SIDE_RIGHT = 0x400,
+ OUT_TOP_CENTER = 0x800,
+ OUT_TOP_FRONT_LEFT = 0x1000,
+ OUT_TOP_FRONT_CENTER = 0x2000,
+ OUT_TOP_FRONT_RIGHT = 0x4000,
+ OUT_TOP_BACK_LEFT = 0x8000,
+ OUT_TOP_BACK_CENTER = 0x10000,
+ 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),
+ OUT_MONO = OUT_FRONT_LEFT,
+ OUT_STEREO = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT),
+ OUT_QUAD = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_BACK_LEFT | OUT_BACK_RIGHT),
+ OUT_QUAD_BACK = OUT_QUAD,
+ /* like OUT_QUAD_BACK with *_SIDE_* instead of *_BACK_* */
+ OUT_QUAD_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
+ OUT_5POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
+ OUT_BACK_LEFT | OUT_BACK_RIGHT),
+ OUT_5POINT1_BACK = OUT_5POINT1,
+ /* like OUT_5POINT1_BACK with *_SIDE_* instead of *_BACK_* */
+ OUT_5POINT1_SIDE = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
+ OUT_SIDE_LEFT | 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),
+ OUT_7POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
+ OUT_BACK_LEFT | OUT_BACK_RIGHT |
+ OUT_SIDE_LEFT | OUT_SIDE_RIGHT),
+ OUT_ALL = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
+ OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
+ OUT_BACK_LEFT | OUT_BACK_RIGHT |
+ OUT_FRONT_LEFT_OF_CENTER | OUT_FRONT_RIGHT_OF_CENTER |
+ OUT_BACK_CENTER |
+ OUT_SIDE_LEFT | OUT_SIDE_RIGHT |
+ OUT_TOP_CENTER |
+ OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_CENTER | OUT_TOP_FRONT_RIGHT |
+ OUT_TOP_BACK_LEFT | OUT_TOP_BACK_CENTER | 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,
+ IN_LEFT = 0x4,
+ IN_RIGHT = 0x8,
+ IN_FRONT = 0x10,
+ IN_BACK = 0x20,
+ IN_LEFT_PROCESSED = 0x40,
+ IN_RIGHT_PROCESSED = 0x80,
+ IN_FRONT_PROCESSED = 0x100,
+ IN_BACK_PROCESSED = 0x200,
+ IN_PRESSURE = 0x400,
+ IN_X_AXIS = 0x800,
+ IN_Y_AXIS = 0x1000,
+ IN_Z_AXIS = 0x2000,
+ IN_VOICE_UPLINK = 0x4000,
+ 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),
+ IN_MONO = IN_FRONT,
+ IN_STEREO = (IN_LEFT | IN_RIGHT),
+ IN_FRONT_BACK = (IN_FRONT | IN_BACK),
+ IN_ALL = (IN_LEFT | IN_RIGHT | IN_FRONT | IN_BACK|
+ IN_LEFT_PROCESSED | IN_RIGHT_PROCESSED |
+ IN_FRONT_PROCESSED | IN_BACK_PROCESSED|
+ IN_PRESSURE |
+ IN_X_AXIS | IN_Y_AXIS | IN_Z_AXIS |
+ IN_VOICE_UPLINK | 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,
+ COUNT_MAX = 30,
+ INDEX_HDR = REPRESENTATION_INDEX << COUNT_MAX,
+ INDEX_MASK_1 = INDEX_HDR | ((1 << 1) - 1),
+ INDEX_MASK_2 = INDEX_HDR | ((1 << 2) - 1),
+ INDEX_MASK_3 = INDEX_HDR | ((1 << 3) - 1),
+ INDEX_MASK_4 = INDEX_HDR | ((1 << 4) - 1),
+ INDEX_MASK_5 = INDEX_HDR | ((1 << 5) - 1),
+ INDEX_MASK_6 = INDEX_HDR | ((1 << 6) - 1),
+ INDEX_MASK_7 = INDEX_HDR | ((1 << 7) - 1),
+ INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 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)
+
+/*
+ * 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.
+ */
+@export(name="", value_prefix="AUDIO_INTERLEAVE_")
+enum AudioInterleave {
+ LEFT = 0,
+ RIGHT = 1,
};
/*
* Major modes for a mobile device. The current mode setting affects audio
* routing.
*/
-@export(name="audio_mode_t")
+@export(name="audio_mode_t", value_prefix="AUDIO_MODE_")
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,
+ INVALID = -2,
+ CURRENT = -1,
+ NORMAL = 0,
+ RINGTONE = 1,
+ IN_CALL = 2,
+ IN_COMMUNICATION = 3,
- AUDIO_MODE_CNT,
- AUDIO_MODE_MAX = AUDIO_MODE_CNT - 1,
+ CNT,
+ MAX = CNT - 1,
};
-@export(name="")
+@export(name="", value_prefix="AUDIO_DEVICE_")
enum AudioDevice : uint32_t {
- AUDIO_DEVICE_NONE = 0x0,
+ NONE = 0x0,
/* reserved bits */
- AUDIO_DEVICE_BIT_IN = 0x80000000,
- AUDIO_DEVICE_BIT_DEFAULT = 0x40000000,
+ BIT_IN = 0x80000000,
+ 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,
+ OUT_EARPIECE = 0x1,
+ OUT_SPEAKER = 0x2,
+ OUT_WIRED_HEADSET = 0x4,
+ OUT_WIRED_HEADPHONE = 0x8,
+ OUT_BLUETOOTH_SCO = 0x10,
+ OUT_BLUETOOTH_SCO_HEADSET = 0x20,
+ OUT_BLUETOOTH_SCO_CARKIT = 0x40,
+ OUT_BLUETOOTH_A2DP = 0x80,
+ OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100,
+ OUT_BLUETOOTH_A2DP_SPEAKER = 0x200,
+ OUT_AUX_DIGITAL = 0x400,
+ OUT_HDMI = 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,
+ OUT_ANLG_DOCK_HEADSET = 0x800,
+ OUT_DGTL_DOCK_HEADSET = 0x1000,
/* USB accessory mode: Android device is USB device and dock is USB host */
- AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000,
+ 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,
+ OUT_USB_DEVICE = 0x4000,
+ OUT_REMOTE_SUBMIX = 0x8000,
/* Telephony voice TX path */
- AUDIO_DEVICE_OUT_TELEPHONY_TX = 0x10000,
+ OUT_TELEPHONY_TX = 0x10000,
/* Analog jack with line impedance detected */
- AUDIO_DEVICE_OUT_LINE = 0x20000,
+ OUT_LINE = 0x20000,
/* HDMI Audio Return Channel */
- AUDIO_DEVICE_OUT_HDMI_ARC = 0x40000,
+ OUT_HDMI_ARC = 0x40000,
/* S/PDIF out */
- AUDIO_DEVICE_OUT_SPDIF = 0x80000,
+ OUT_SPDIF = 0x80000,
/* FM transmitter out */
- AUDIO_DEVICE_OUT_FM = 0x100000,
+ OUT_FM = 0x100000,
/* Line out for av devices */
- AUDIO_DEVICE_OUT_AUX_LINE = 0x200000,
+ OUT_AUX_LINE = 0x200000,
/* limited-output speaker device for acoustic safety */
- AUDIO_DEVICE_OUT_SPEAKER_SAFE = 0x400000,
- AUDIO_DEVICE_OUT_IP = 0x800000,
+ OUT_SPEAKER_SAFE = 0x400000,
+ 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),
+ OUT_BUS = 0x1000000,
+ OUT_DEFAULT = BIT_DEFAULT,
+ OUT_ALL = (OUT_EARPIECE |
+ OUT_SPEAKER |
+ OUT_WIRED_HEADSET |
+ OUT_WIRED_HEADPHONE |
+ OUT_BLUETOOTH_SCO |
+ OUT_BLUETOOTH_SCO_HEADSET |
+ OUT_BLUETOOTH_SCO_CARKIT |
+ OUT_BLUETOOTH_A2DP |
+ OUT_BLUETOOTH_A2DP_HEADPHONES |
+ OUT_BLUETOOTH_A2DP_SPEAKER |
+ OUT_HDMI |
+ OUT_ANLG_DOCK_HEADSET |
+ OUT_DGTL_DOCK_HEADSET |
+ OUT_USB_ACCESSORY |
+ OUT_USB_DEVICE |
+ OUT_REMOTE_SUBMIX |
+ OUT_TELEPHONY_TX |
+ OUT_LINE |
+ OUT_HDMI_ARC |
+ OUT_SPDIF |
+ OUT_FM |
+ OUT_AUX_LINE |
+ OUT_SPEAKER_SAFE |
+ OUT_IP |
+ OUT_BUS |
+ OUT_DEFAULT),
+ OUT_ALL_A2DP = (OUT_BLUETOOTH_A2DP |
+ OUT_BLUETOOTH_A2DP_HEADPHONES |
+ OUT_BLUETOOTH_A2DP_SPEAKER),
+ OUT_ALL_SCO = (OUT_BLUETOOTH_SCO |
+ OUT_BLUETOOTH_SCO_HEADSET |
+ OUT_BLUETOOTH_SCO_CARKIT),
+ OUT_ALL_USB = (OUT_USB_ACCESSORY | 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,
+ IN_COMMUNICATION = BIT_IN | 0x1,
+ IN_AMBIENT = BIT_IN | 0x2,
+ IN_BUILTIN_MIC = BIT_IN | 0x4,
+ IN_BLUETOOTH_SCO_HEADSET = BIT_IN | 0x8,
+ IN_WIRED_HEADSET = BIT_IN | 0x10,
+ IN_AUX_DIGITAL = BIT_IN | 0x20,
+ IN_HDMI = 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,
+ IN_VOICE_CALL = BIT_IN | 0x40,
+ IN_TELEPHONY_RX = IN_VOICE_CALL,
+ IN_BACK_MIC = BIT_IN | 0x80,
+ IN_REMOTE_SUBMIX = BIT_IN | 0x100,
+ IN_ANLG_DOCK_HEADSET = BIT_IN | 0x200,
+ IN_DGTL_DOCK_HEADSET = BIT_IN | 0x400,
+ IN_USB_ACCESSORY = BIT_IN | 0x800,
+ IN_USB_DEVICE = BIT_IN | 0x1000,
/* FM tuner input */
- AUDIO_DEVICE_IN_FM_TUNER = AUDIO_DEVICE_BIT_IN | 0x2000,
+ IN_FM_TUNER = BIT_IN | 0x2000,
/* TV tuner input */
- AUDIO_DEVICE_IN_TV_TUNER = AUDIO_DEVICE_BIT_IN | 0x4000,
+ IN_TV_TUNER = BIT_IN | 0x4000,
/* Analog jack with line impedance detected */
- AUDIO_DEVICE_IN_LINE = AUDIO_DEVICE_BIT_IN | 0x8000,
+ IN_LINE = 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,
+ IN_SPDIF = BIT_IN | 0x10000,
+ IN_BLUETOOTH_A2DP = BIT_IN | 0x20000,
+ IN_LOOPBACK = BIT_IN | 0x40000,
+ IN_IP = 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,
+ IN_BUS = BIT_IN | 0x100000,
+ IN_DEFAULT = BIT_IN |
+ 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),
+ IN_ALL = (IN_COMMUNICATION |
+ IN_AMBIENT |
+ IN_BUILTIN_MIC |
+ IN_BLUETOOTH_SCO_HEADSET |
+ IN_WIRED_HEADSET |
+ IN_HDMI |
+ IN_TELEPHONY_RX |
+ IN_BACK_MIC |
+ IN_REMOTE_SUBMIX |
+ IN_ANLG_DOCK_HEADSET |
+ IN_DGTL_DOCK_HEADSET |
+ IN_USB_ACCESSORY |
+ IN_USB_DEVICE |
+ IN_FM_TUNER |
+ IN_TV_TUNER |
+ IN_LINE |
+ IN_SPDIF |
+ IN_BLUETOOTH_A2DP |
+ IN_LOOPBACK |
+ IN_IP |
+ IN_BUS |
+ IN_DEFAULT),
+ IN_ALL_SCO = IN_BLUETOOTH_SCO_HEADSET,
+ IN_ALL_USB = (IN_USB_ACCESSORY | IN_USB_DEVICE),
};
/*
@@ -649,31 +597,28 @@
* 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")
+@export(name="audio_output_flags_t", value_prefix="AUDIO_OUTPUT_FLAG_")
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.
+ NONE = 0x0, // no attributes
+ DIRECT = 0x1, // this output directly connects a track
+ // to one output stream: no software mixer
+ 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.
+ FAST = 0x4, // output supports "fast tracks", defined elsewhere
+ DEEP_BUFFER = 0x8, // use deep audio buffers
+ COMPRESS_OFFLOAD = 0x10, // offload playback of compressed streams to
+ // hardware codec
+ NON_BLOCKING = 0x20, // use non-blocking write
+ HW_AV_SYNC = 0x40, // output uses a hardware A/V sync
+ TTS = 0x80, // output for streams transmitted through speaker at a
+ // sample rate high enough to accommodate lower-range
+ // ultrasonic p/b
+ RAW = 0x100, // minimize signal processing
+ SYNC = 0x200, // synchronize I/O streams
+ IEC958_NONAUDIO = 0x400, // Audio stream contains compressed audio in SPDIF
+ // data bursts, not PCM.
};
/*
@@ -682,15 +627,13 @@
* 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
+@export(name="audio_input_flags_t", value_prefix="AUDIO_INPUT_FLAG_")
+enum AudioInputFlag {
+ NONE = 0x0, // no attributes
+ FAST = 0x1, // prefer an input that supports "fast tracks"
+ HW_HOTWORD = 0x2, // prefer an input that captures from hw hotword source
+ RAW = 0x4, // minimize signal processing
+ SYNC = 0x8, // synchronize I/O streams
};
/*
@@ -728,11 +671,11 @@
/*
* Type of gain control exposed by an audio port.
*/
-@export(name="")
+@export(name="", value_prefix="AUDIO_GAIN_MODE_")
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
+ JOINT = 0x1, // supports joint channel gain control
+ CHANNELS = 0x2, // supports separate channel gain control
+ RAMP = 0x4 // supports gain ramps
};
/*
@@ -785,24 +728,23 @@
*/
/* Audio port role: either source or sink */
-@export(name="audio_port_role_t")
+@export(name="audio_port_role_t", value_prefix="AUDIO_PORT_ROLE_")
enum AudioPortRole {
- AUDIO_PORT_ROLE_NONE,
- AUDIO_PORT_ROLE_SOURCE,
- AUDIO_PORT_ROLE_SINK,
+ NONE,
+ SOURCE,
+ 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)
+ * Audio port type indicates if it is a session (e.g AudioTrack), a mix (e.g
+ * PlaybackThread output) or a physical device (e.g OUT_SPEAKER)
*/
-@export(name="audio_port_type_t")
+@export(name="audio_port_type_t", value_prefix="AUDIO_PORT_TYPE_")
enum AudioPortType {
- AUDIO_PORT_TYPE_NONE,
- AUDIO_PORT_TYPE_DEVICE,
- AUDIO_PORT_TYPE_MIX,
- AUDIO_PORT_TYPE_SESSION,
+ NONE,
+ DEVICE,
+ MIX,
+ SESSION,
};
/*
@@ -811,7 +753,7 @@
*/
struct AudioPortConfigDeviceExt {
AudioModuleHandle hwModule; // module the device is attached to
- AudioDevice type; // device type (e.g AUDIO_DEVICE_OUT_SPEAKER)
+ AudioDevice type; // device type (e.g OUT_SPEAKER)
uint8_t[32] address; // device address. "" if N/A
};
@@ -826,16 +768,13 @@
/*
* Flags indicating which fields are to be considered in AudioPortConfig.
*/
-@export(name="")
+@export(name="", value_prefix="AUDIO_PORT_CONFIG_")
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
+ SAMPLE_RATE = 0x1,
+ CHANNEL_MASK = 0x2,
+ FORMAT = 0x4,
+ GAIN = 0x8,
+ ALL = SAMPLE_RATE | CHANNEL_MASK | FORMAT | GAIN
};
/*
@@ -877,10 +816,10 @@
/*
* Latency class of the audio mix.
*/
-@export(name="audio_mix_latency_class_t")
+@export(name="audio_mix_latency_class_t", value_prefix="AUDIO_LATENCY_")
enum AudioMixLatencyClass {
- AUDIO_LATENCY_LOW,
- AUDIO_LATENCY_NORMAL
+ LOW,
+ NORMAL
} ;
struct AudioPortMixExt {
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
index 3560382..82f6766 100644
--- a/audio/effect/2.0/types.hal
+++ b/audio/effect/2.0/types.hal
@@ -108,109 +108,90 @@
* | | | have to implement a process function.
* +----------------+--------+--------------------------------------------------
*/
-// TODO(mnaganov): Consider if "EFFECT_FLAG_" prefix can be dropped.
+@export(name="", value_prefix="EFFECT_FLAG_")
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,
+ TYPE_SHIFT = 0,
+ TYPE_SIZE = 3,
+ TYPE_MASK = ((1 << TYPE_SIZE) -1) << TYPE_SHIFT,
+ TYPE_INSERT = 0 << TYPE_SHIFT,
+ TYPE_AUXILIARY = 1 << TYPE_SHIFT,
+ TYPE_REPLACE = 2 << TYPE_SHIFT,
+ TYPE_PRE_PROC = 3 << TYPE_SHIFT,
+ TYPE_POST_PROC = 4 << 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,
+ INSERT_SHIFT = TYPE_SHIFT + TYPE_SIZE,
+ INSERT_SIZE = 3,
+ INSERT_MASK = ((1 << INSERT_SIZE) -1) << INSERT_SHIFT,
+ INSERT_ANY = 0 << INSERT_SHIFT,
+ INSERT_FIRST = 1 << INSERT_SHIFT,
+ INSERT_LAST = 2 << INSERT_SHIFT,
+ INSERT_EXCLUSIVE = 3 << 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,
+ VOLUME_SHIFT = INSERT_SHIFT + INSERT_SIZE,
+ VOLUME_SIZE = 3,
+ VOLUME_MASK = ((1 << VOLUME_SIZE) -1) << VOLUME_SHIFT,
+ VOLUME_CTRL = 1 << VOLUME_SHIFT,
+ VOLUME_IND = 2 << VOLUME_SHIFT,
+ VOLUME_NONE = 0 << 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,
+ DEVICE_SHIFT = VOLUME_SHIFT + VOLUME_SIZE,
+ DEVICE_SIZE = 3,
+ DEVICE_MASK = ((1 << DEVICE_SIZE) -1) << DEVICE_SHIFT,
+ DEVICE_IND = 1 << DEVICE_SHIFT,
+ DEVICE_NONE = 0 << 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,
+ INPUT_SHIFT = DEVICE_SHIFT + DEVICE_SIZE,
+ INPUT_SIZE = 2,
+ INPUT_MASK = ((1 << INPUT_SIZE) -1) << INPUT_SHIFT,
+ INPUT_DIRECT = 1 << INPUT_SHIFT,
+ INPUT_PROVIDER = 2 << INPUT_SHIFT,
+ INPUT_BOTH = 3 << 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,
+ OUTPUT_SHIFT = INPUT_SHIFT + INPUT_SIZE,
+ OUTPUT_SIZE = 2,
+ OUTPUT_MASK = ((1 << OUTPUT_SIZE) -1) << OUTPUT_SHIFT,
+ OUTPUT_DIRECT = 1 << OUTPUT_SHIFT,
+ OUTPUT_PROVIDER = 2 << OUTPUT_SHIFT,
+ OUTPUT_BOTH = 3 << 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,
+ HW_ACC_SHIFT = OUTPUT_SHIFT + OUTPUT_SIZE,
+ HW_ACC_SIZE = 2,
+ HW_ACC_MASK = ((1 << HW_ACC_SIZE) -1) << HW_ACC_SHIFT,
+ HW_ACC_SIMPLE = 1 << HW_ACC_SHIFT,
+ HW_ACC_TUNNEL = 2 << 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_MODE_SHIFT = HW_ACC_SHIFT + HW_ACC_SIZE,
+ AUDIO_MODE_SIZE = 2,
+ AUDIO_MODE_MASK = ((1 << AUDIO_MODE_SIZE) -1) << AUDIO_MODE_SHIFT,
+ AUDIO_MODE_IND = 1 << AUDIO_MODE_SHIFT,
+ AUDIO_MODE_NONE = 0 << 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,
+ AUDIO_SOURCE_SHIFT = AUDIO_MODE_SHIFT + AUDIO_MODE_SIZE,
+ AUDIO_SOURCE_SIZE = 2,
+ AUDIO_SOURCE_MASK = ((1 << AUDIO_SOURCE_SIZE) -1) << AUDIO_SOURCE_SHIFT,
+ AUDIO_SOURCE_IND = 1 << AUDIO_SOURCE_SHIFT,
+ AUDIO_SOURCE_NONE = 0 << 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,
+ OFFLOAD_SHIFT = AUDIO_SOURCE_SHIFT + AUDIO_SOURCE_SIZE,
+ OFFLOAD_SIZE = 1,
+ OFFLOAD_MASK = ((1 << OFFLOAD_SIZE) -1) << OFFLOAD_SHIFT,
+ OFFLOAD_SUPPORTED = 1 << 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
+ NO_PROCESS_SHIFT = OFFLOAD_SHIFT + OFFLOAD_SIZE,
+ NO_PROCESS_SIZE = 1,
+ NO_PROCESS_MASK = ((1 << NO_PROCESS_SIZE) -1) << NO_PROCESS_SHIFT,
+ NO_PROCESS = 1 << NO_PROCESS_SHIFT
};
/*
@@ -246,24 +227,24 @@
vec<uint8_t> data;
};
+@export(name="effect_buffer_access_e", value_prefix="EFFECT_BUFFER_")
enum EffectBufferAccess {
- EFFECT_BUFFER_ACCESS_WRITE,
- EFFECT_BUFFER_ACCESS_READ,
- EFFECT_BUFFER_ACCESS_ACCUMULATE
+ ACCESS_WRITE,
+ ACCESS_READ,
+ ACCESS_ACCUMULATE
};
/*
* Determines what fields of EffectBufferConfig need to be considered.
*/
+@export(name="", value_prefix="EFFECT_CONFIG_")
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
+ BUFFER = 0x0001, // buffer field
+ SMP_RATE = 0x0002, // samplingRate
+ CHANNELS = 0x0004, // channels
+ FORMAT = 0x0008, // format
+ ACC_MODE = 0x0010, // accessMode
+ ALL = BUFFER | SMP_RATE | CHANNELS | FORMAT | ACC_MODE
};
/*
@@ -284,10 +265,11 @@
EffectBufferConfig outputCfg;
};
+@export(name="effect_feature_e", value_prefix="EFFECT_FEATURE_")
enum EffectFeature {
- EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels
- // (e.g. dual mic noise suppressor)
- EFFECT_FEATURE_CNT
+ AUX_CHANNELS, // supports auxiliary channels
+ // (e.g. dual mic noise suppressor)
+ CNT
};
struct EffectFeatureConfig {
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
new file mode 100644
index 0000000..f29c50b
--- /dev/null
+++ b/graphics/allocator/2.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.graphics.allocator@2.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
+ srcs: [
+ "types.hal",
+ "IAllocator.hal",
+ ],
+ out: [
+ "android/hardware/graphics/allocator/2.0/types.cpp",
+ "android/hardware/graphics/allocator/2.0/AllocatorAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.graphics.allocator@2.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.allocator@2.0",
+ srcs: [
+ "types.hal",
+ "IAllocator.hal",
+ ],
+ out: [
+ "android/hardware/graphics/allocator/2.0/types.h",
+ "android/hardware/graphics/allocator/2.0/IAllocator.h",
+ "android/hardware/graphics/allocator/2.0/IHwAllocator.h",
+ "android/hardware/graphics/allocator/2.0/BnAllocator.h",
+ "android/hardware/graphics/allocator/2.0/BpAllocator.h",
+ "android/hardware/graphics/allocator/2.0/BsAllocator.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.graphics.allocator@2.0",
+ generated_sources: ["android.hardware.graphics.allocator@2.0_genc++"],
+ generated_headers: ["android.hardware.graphics.allocator@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.graphics.allocator@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/graphics/allocator/2.0/IAllocator.hal b/graphics/allocator/2.0/IAllocator.hal
new file mode 100644
index 0000000..8accb82
--- /dev/null
+++ b/graphics/allocator/2.0/IAllocator.hal
@@ -0,0 +1,177 @@
+/*
+ * 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.graphics.allocator@2.0;
+
+interface IAllocator {
+ enum Capability : int32_t {
+ /* reserved */
+ INVALID = 0,
+
+ /*
+ * testAllocate will always return UNDEFINED unless this capability
+ * is supported.
+ */
+ TEST_ALLOCATE = 1,
+ };
+
+ struct BufferDescriptorInfo {
+ /*
+ * The width specifies how many columns of pixels should be in the
+ * allocated buffer, but does not necessarily represent the offset in
+ * columns between the same column in adjacent rows. The rows may be
+ * padded.
+ */
+ uint32_t width;
+
+ /*
+ * The height specifies how many rows of pixels should be in the
+ * allocated buffer.
+ */
+ uint32_t height;
+
+ /* Buffer pixel format. */
+ PixelFormat format;
+
+ /*
+ * Buffer producer usage mask; valid flags can be found in the
+ * definition of ProducerUsage.
+ */
+ uint64_t producerUsageMask;
+
+ /*
+ * Buffer consumer usage mask; valid flags can be found in the
+ * definition of ConsumerUsage.
+ */
+ uint64_t consumerUsageMask;
+ };
+
+ /*
+ * Provides a list of supported capabilities (as described in the
+ * definition of Capability above). This list must not change after
+ * initialization.
+ *
+ * @return capabilities is a list of supported capabilities.
+ */
+ getCapabilities() generates (vec<Capability> capabilities);
+
+ /*
+ * Retrieves implementation-defined debug information, which will be
+ * displayed during, for example, `dumpsys SurfaceFlinger`.
+ *
+ * @return debugInfo is a string of debug information.
+ */
+ dumpDebugInfo() generates (string debugInfo);
+
+ /*
+ * Creates a new, opaque buffer descriptor.
+ *
+ * @param descriptorInfo specifies the attributes of the buffer
+ * descriptor.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_VALUE when any attribute in descriptorInfo is invalid.
+ * NO_RESOURCES when no more descriptors can currently be created.
+ * @return descriptor is the newly created buffer descriptor.
+ */
+ createDescriptor(BufferDescriptorInfo descriptorInfo)
+ generates (Error error,
+ BufferDescriptor descriptor);
+
+ /*
+ * Destroys an existing buffer descriptor.
+ *
+ * @param descriptor is the descriptor to destroy.
+ * @return error is either NONE or BAD_DESCRIPTOR.
+ */
+ destroyDescriptor(BufferDescriptor descriptor) generates (Error error);
+
+ /*
+ * Tests whether a buffer allocation can succeed, ignoring potential
+ * resource contention which might lead to a NO_RESOURCES error.
+ *
+ * @param descriptors is a list of buffer descriptors.
+ * @return error is NONE or NOT_SHARED upon success;
+ * NONE when buffers can be created and share a backing store.
+ * NOT_SHARED when buffers can be created but require more than a
+ * backing store.
+ * Otherwise,
+ * BAD_DESCRIPTOR when any of the descriptors is invalid.
+ * UNSUPPORTED when any of the descriptors can never be satisfied.
+ * UNDEFINED when TEST_ALLOCATE is not listed in getCapabilities.
+ */
+ testAllocate(vec<BufferDescriptor> descriptors) generates (Error error);
+
+ /*
+ * Attempts to allocate a list of buffers sharing a backing store.
+ *
+ * Each buffer will correspond to one of the descriptors passed into the
+ * function and will hold a reference to its backing store. If the device
+ * is unable to share the backing store between the buffers, it must
+ * attempt to allocate the buffers with different backing stores and
+ * return NOT_SHARED if it is successful.
+ *
+ * @param descriptors is the buffer descriptors to attempt to allocate.
+ * @return error is NONE or NOT_SHARED upon success;
+ * NONE when buffers can be created and share a backing store.
+ * NOT_SHARED when buffers can be created but require more than a
+ * backing store.
+ * Otherwise,
+ * BAD_DESCRIPTOR when any of the descriptors is invalid.
+ * UNSUPPORTED when any of the descriptors can never be satisfied.
+ * NO_RESOURCES when any of the buffers cannot be created at this
+ * time.
+ * @return buffers is the allocated buffers.
+ */
+ allocate(vec<BufferDescriptor> descriptors)
+ generates (Error error,
+ vec<Buffer> buffers);
+
+ /*
+ * Frees a buffer.
+ *
+ * @param buffer is the buffer to be freed.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer is invalid.
+ */
+ free(Buffer buffer) generates (Error error);
+
+ /*
+ * Exports a buffer for use in other client libraries or for cross-process
+ * sharing.
+ *
+ * The exported handle is a handle to the backing store of the buffer, not
+ * to the buffer itself. It however may not hold any reference to the
+ * backing store and may be considered invalid by client libraries. To use
+ * it and, in most cases, to save it for later use, a client must make a
+ * clone of the handle and have the cloned handle hold a reference to the
+ * backing store. Such a cloned handle will stay valid even after the
+ * original buffer is freed. Refer to native_handle_clone and IMapper for
+ * how a handle is cloned and how a reference is added.
+ *
+ * @param descriptor is the descriptor used to allocate the buffer.
+ * @param buffer is the buffer to be exported.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_DESCRIPTOR when the descriptor is invalid.
+ * BAD_BUFFER when the buffer is invalid.
+ * BAD_VALUE when descriptor and buffer do not match.
+ * NO_RESOURCES when the buffer cannot be exported at this time.
+ * @return bufferHandle is the exported handle.
+ */
+ exportHandle(BufferDescriptor descriptor,
+ Buffer buffer)
+ generates (Error error,
+ handle bufferHandle);
+};
diff --git a/graphics/allocator/2.0/default/Android.bp b/graphics/allocator/2.0/default/Android.bp
new file mode 100644
index 0000000..9a24773
--- /dev/null
+++ b/graphics/allocator/2.0/default/Android.bp
@@ -0,0 +1,24 @@
+cc_library_shared {
+ name: "android.hardware.graphics.allocator@2.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Gralloc.cpp"],
+ cppflags: ["-Wall", "-Wextra"],
+ shared_libs: [
+ "android.hardware.graphics.allocator@2.0",
+ "libbase",
+ "libcutils",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "liblog",
+ "libutils",
+ ],
+}
+
+cc_library_static {
+ name: "libgralloc1-adapter",
+ srcs: ["gralloc1-adapter.c"],
+ include_dirs: ["system/core/libsync/include"],
+ cflags: ["-Wall", "-Wextra", "-Wno-unused-parameter"],
+ export_include_dirs: ["."],
+}
diff --git a/graphics/allocator/2.0/default/Gralloc.cpp b/graphics/allocator/2.0/default/Gralloc.cpp
new file mode 100644
index 0000000..a7fc6c1
--- /dev/null
+++ b/graphics/allocator/2.0/default/Gralloc.cpp
@@ -0,0 +1,297 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GrallocPassthrough"
+
+#include <type_traits>
+#include <unordered_set>
+#include <vector>
+
+#include <string.h>
+
+#include <hardware/gralloc1.h>
+#include <log/log.h>
+
+#include "Gralloc.h"
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace allocator {
+namespace V2_0 {
+namespace implementation {
+
+class GrallocHal : public IAllocator {
+public:
+ GrallocHal(const hw_module_t* module);
+ virtual ~GrallocHal();
+
+ // IAllocator interface
+ Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
+ Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
+ Return<void> createDescriptor(const BufferDescriptorInfo& descriptorInfo,
+ createDescriptor_cb hidl_cb) override;
+ Return<Error> destroyDescriptor(BufferDescriptor descriptor) override;
+
+ Return<Error> testAllocate(
+ const hidl_vec<BufferDescriptor>& descriptors) override;
+ Return<void> allocate(const hidl_vec<BufferDescriptor>& descriptors,
+ allocate_cb hidl_cb) override;
+ Return<Error> free(Buffer buffer) override;
+
+ Return<void> exportHandle(BufferDescriptor descriptor,
+ Buffer buffer, exportHandle_cb hidl_cb) override;
+
+private:
+ void initCapabilities();
+
+ template<typename T>
+ void initDispatch(T& func, gralloc1_function_descriptor_t desc);
+ void initDispatch();
+
+ bool hasCapability(Capability capability) const;
+
+ gralloc1_device_t* mDevice;
+
+ std::unordered_set<Capability> mCapabilities;
+
+ struct {
+ GRALLOC1_PFN_DUMP dump;
+ GRALLOC1_PFN_CREATE_DESCRIPTOR createDescriptor;
+ GRALLOC1_PFN_DESTROY_DESCRIPTOR destroyDescriptor;
+ GRALLOC1_PFN_SET_DIMENSIONS setDimensions;
+ GRALLOC1_PFN_SET_FORMAT setFormat;
+ GRALLOC1_PFN_SET_CONSUMER_USAGE setConsumerUsage;
+ GRALLOC1_PFN_SET_PRODUCER_USAGE setProducerUsage;
+ GRALLOC1_PFN_ALLOCATE allocate;
+ GRALLOC1_PFN_RELEASE release;
+ GRALLOC1_PFN_GET_BACKING_STORE getBackingStore;
+ GRALLOC1_PFN_GET_STRIDE getStride;
+ GRALLOC1_PFN_GET_NUM_FLEX_PLANES getNumFlexPlanes;
+ } mDispatch;
+};
+
+GrallocHal::GrallocHal(const hw_module_t* module)
+ : mDevice(nullptr), mDispatch()
+{
+ int status = gralloc1_open(module, &mDevice);
+ if (status) {
+ LOG_ALWAYS_FATAL("failed to open gralloc1 device: %s",
+ strerror(-status));
+ }
+
+ initCapabilities();
+ initDispatch();
+}
+
+GrallocHal::~GrallocHal()
+{
+ gralloc1_close(mDevice);
+}
+
+void GrallocHal::initCapabilities()
+{
+ uint32_t count;
+ mDevice->getCapabilities(mDevice, &count, nullptr);
+
+ std::vector<Capability> caps(count);
+ mDevice->getCapabilities(mDevice, &count, reinterpret_cast<
+ std::underlying_type<Capability>::type*>(caps.data()));
+ caps.resize(count);
+
+ mCapabilities.insert(caps.cbegin(), caps.cend());
+}
+
+template<typename T>
+void GrallocHal::initDispatch(T& func, gralloc1_function_descriptor_t desc)
+{
+ auto pfn = mDevice->getFunction(mDevice, desc);
+ if (!pfn) {
+ LOG_ALWAYS_FATAL("failed to get gralloc1 function %d", desc);
+ }
+
+ func = reinterpret_cast<T>(pfn);
+}
+
+void GrallocHal::initDispatch()
+{
+ initDispatch(mDispatch.dump, GRALLOC1_FUNCTION_DUMP);
+ initDispatch(mDispatch.createDescriptor,
+ GRALLOC1_FUNCTION_CREATE_DESCRIPTOR);
+ initDispatch(mDispatch.destroyDescriptor,
+ GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR);
+ initDispatch(mDispatch.setDimensions, GRALLOC1_FUNCTION_SET_DIMENSIONS);
+ initDispatch(mDispatch.setFormat, GRALLOC1_FUNCTION_SET_FORMAT);
+ initDispatch(mDispatch.setConsumerUsage,
+ GRALLOC1_FUNCTION_SET_CONSUMER_USAGE);
+ initDispatch(mDispatch.setProducerUsage,
+ GRALLOC1_FUNCTION_SET_PRODUCER_USAGE);
+ initDispatch(mDispatch.allocate, GRALLOC1_FUNCTION_ALLOCATE);
+ initDispatch(mDispatch.release, GRALLOC1_FUNCTION_RELEASE);
+}
+
+bool GrallocHal::hasCapability(Capability capability) const
+{
+ return (mCapabilities.count(capability) > 0);
+}
+
+Return<void> GrallocHal::getCapabilities(getCapabilities_cb hidl_cb)
+{
+ std::vector<Capability> caps(
+ mCapabilities.cbegin(), mCapabilities.cend());
+
+ hidl_vec<Capability> reply;
+ reply.setToExternal(caps.data(), caps.size());
+ hidl_cb(reply);
+
+ return Void();
+}
+
+Return<void> GrallocHal::dumpDebugInfo(dumpDebugInfo_cb hidl_cb)
+{
+ uint32_t len = 0;
+ mDispatch.dump(mDevice, &len, nullptr);
+
+ std::vector<char> buf(len + 1);
+ mDispatch.dump(mDevice, &len, buf.data());
+ buf.resize(len + 1);
+ buf[len] = '\0';
+
+ hidl_string reply;
+ reply.setToExternal(buf.data(), len);
+ hidl_cb(reply);
+
+ return Void();
+}
+
+Return<void> GrallocHal::createDescriptor(
+ const BufferDescriptorInfo& descriptorInfo,
+ createDescriptor_cb hidl_cb)
+{
+ BufferDescriptor descriptor;
+ int32_t err = mDispatch.createDescriptor(mDevice, &descriptor);
+ if (err == GRALLOC1_ERROR_NONE) {
+ err = mDispatch.setDimensions(mDevice, descriptor,
+ descriptorInfo.width, descriptorInfo.height);
+ }
+ if (err == GRALLOC1_ERROR_NONE) {
+ err = mDispatch.setFormat(mDevice, descriptor,
+ static_cast<int32_t>(descriptorInfo.format));
+ }
+ if (err == GRALLOC1_ERROR_NONE) {
+ uint64_t producerUsageMask = descriptorInfo.producerUsageMask;
+ if (producerUsageMask & GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN) {
+ producerUsageMask |= GRALLOC1_PRODUCER_USAGE_CPU_READ;
+ }
+ if (producerUsageMask & GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN) {
+ producerUsageMask |= GRALLOC1_PRODUCER_USAGE_CPU_WRITE;
+ }
+ err = mDispatch.setProducerUsage(mDevice, descriptor,
+ descriptorInfo.producerUsageMask);
+ }
+ if (err == GRALLOC1_ERROR_NONE) {
+ uint64_t consumerUsageMask = descriptorInfo.consumerUsageMask;
+ if (consumerUsageMask & GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN) {
+ consumerUsageMask |= GRALLOC1_CONSUMER_USAGE_CPU_READ;
+ }
+ err = mDispatch.setConsumerUsage(mDevice, descriptor,
+ consumerUsageMask);
+ }
+
+ hidl_cb(static_cast<Error>(err), descriptor);
+
+ return Void();
+}
+
+Return<Error> GrallocHal::destroyDescriptor(
+ BufferDescriptor descriptor)
+{
+ int32_t err = mDispatch.destroyDescriptor(mDevice, descriptor);
+ return static_cast<Error>(err);
+}
+
+Return<Error> GrallocHal::testAllocate(
+ const hidl_vec<BufferDescriptor>& descriptors)
+{
+ if (!hasCapability(Capability::TEST_ALLOCATE)) {
+ return Error::UNDEFINED;
+ }
+
+ int32_t err = mDispatch.allocate(mDevice, descriptors.size(),
+ &descriptors[0], nullptr);
+ return static_cast<Error>(err);
+}
+
+Return<void> GrallocHal::allocate(
+ const hidl_vec<BufferDescriptor>& descriptors,
+ allocate_cb hidl_cb) {
+ std::vector<buffer_handle_t> buffers(descriptors.size());
+ int32_t err = mDispatch.allocate(mDevice, descriptors.size(),
+ &descriptors[0], buffers.data());
+ if (err != GRALLOC1_ERROR_NONE && err != GRALLOC1_ERROR_NOT_SHARED) {
+ buffers.clear();
+ }
+
+ hidl_vec<Buffer> reply;
+ reply.setToExternal(
+ reinterpret_cast<Buffer*>(buffers.data()),
+ buffers.size());
+ hidl_cb(static_cast<Error>(err), reply);
+
+ return Void();
+}
+
+Return<Error> GrallocHal::free(Buffer buffer)
+{
+ buffer_handle_t handle = reinterpret_cast<buffer_handle_t>(buffer);
+ int32_t err = mDispatch.release(mDevice, handle);
+ return static_cast<Error>(err);
+}
+
+Return<void> GrallocHal::exportHandle(BufferDescriptor /*descriptor*/,
+ Buffer buffer, exportHandle_cb hidl_cb)
+{
+ // do we want to validate?
+ buffer_handle_t handle = reinterpret_cast<buffer_handle_t>(buffer);
+
+ hidl_cb(Error::NONE, handle);
+
+ return Void();
+}
+
+IAllocator* HIDL_FETCH_IAllocator(const char* /* name */) {
+ const hw_module_t* module;
+ int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+ if (err) {
+ ALOGE("failed to get gralloc module");
+ return nullptr;
+ }
+
+ uint8_t major = (module->module_api_version >> 8) & 0xff;
+ if (major != 1) {
+ ALOGE("unknown gralloc module major version %d", major);
+ return nullptr;
+ }
+
+ return new GrallocHal(module);
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace allocator
+} // namespace graphics
+} // namespace hardware
+} // namespace android
diff --git a/graphics/allocator/2.0/default/Gralloc.h b/graphics/allocator/2.0/default/Gralloc.h
new file mode 100644
index 0000000..c79eeaa
--- /dev/null
+++ b/graphics/allocator/2.0/default/Gralloc.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC_H
+#define ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC_H
+
+#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace allocator {
+namespace V2_0 {
+namespace implementation {
+
+extern "C" IAllocator* HIDL_FETCH_IAllocator(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace allocator
+} // namespace graphics
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GRAPHICS_ALLOCATOR_V2_0_GRALLOC_H
diff --git a/graphics/allocator/2.0/default/gralloc1-adapter.c b/graphics/allocator/2.0/default/gralloc1-adapter.c
new file mode 100644
index 0000000..724cd47
--- /dev/null
+++ b/graphics/allocator/2.0/default/gralloc1-adapter.c
@@ -0,0 +1,660 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Gralloc1Adapter"
+
+#include <stdatomic.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+
+#include <cutils/native_handle.h>
+#include <hardware/gralloc1.h>
+#include <sync/sync.h>
+#include <log/log.h>
+
+#include "gralloc1-adapter.h"
+
+struct gralloc1_adapter_module {
+ struct gralloc_module_t base;
+ struct gralloc1_adapter adapter;
+};
+
+struct gralloc1_adapter_device {
+ struct gralloc1_device base;
+
+ struct alloc_device_t* alloc_dev;
+
+ /* fixed size for thread safety */
+ char saved_dump[4096];
+ size_t saved_dump_size;
+};
+
+/* additional data associated with registered buffer_handle_t */
+struct gralloc1_adapter_buffer_data {
+ struct gralloc1_adapter_buffer_info info;
+
+ atomic_int refcount;
+ bool owned;
+};
+
+struct gralloc1_adapter_buffer_descriptor {
+ int width;
+ int height;
+ int format;
+ int producer_usage;
+ int consumer_usage;
+};
+
+static const struct gralloc1_adapter_module* gralloc1_adapter_module(
+ struct gralloc1_device* dev)
+{
+ return (const struct gralloc1_adapter_module*) dev->common.module;
+}
+
+static struct gralloc1_adapter_device* gralloc1_adapter_device(
+ struct gralloc1_device* dev)
+{
+ return (struct gralloc1_adapter_device*) dev;
+}
+
+static struct gralloc1_adapter_buffer_data* lookup_buffer_data(
+ struct gralloc1_device* dev, buffer_handle_t buffer)
+{
+ const struct gralloc1_adapter_module* mod = gralloc1_adapter_module(dev);
+ if (!mod->adapter.is_registered(&mod->base, buffer))
+ return NULL;
+
+ return mod->adapter.get_data(&mod->base, buffer);
+}
+
+static struct gralloc1_adapter_buffer_descriptor* lookup_buffer_descriptor(
+ struct gralloc1_device* dev, gralloc1_buffer_descriptor_t id)
+{
+ /* do we want to validate? */
+ return (struct gralloc1_adapter_buffer_descriptor*) ((uintptr_t) id);
+}
+
+static void device_dump(struct gralloc1_device* device,
+ uint32_t* outSize, char* outBuffer)
+{
+ struct gralloc1_adapter_device* dev = gralloc1_adapter_device(device);
+
+ if (outBuffer) {
+ uint32_t copy = (uint32_t) dev->saved_dump_size;
+ if (*outSize < copy) {
+ copy = *outSize;
+ } else {
+ *outSize = copy;
+ }
+
+ memcpy(outBuffer, dev->saved_dump, copy);
+ } else {
+ /* dump is optional and may not null-terminate */
+ if (dev->alloc_dev->dump) {
+ dev->alloc_dev->dump(dev->alloc_dev, dev->saved_dump,
+ sizeof(dev->saved_dump) - 1);
+ dev->saved_dump_size = strlen(dev->saved_dump);
+ }
+
+ *outSize = (uint32_t) dev->saved_dump_size;
+ }
+}
+
+static int32_t device_create_descriptor(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t* outDescriptor)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc;
+
+ desc = calloc(1, sizeof(*desc));
+ if (!desc) {
+ return GRALLOC1_ERROR_NO_RESOURCES;
+ }
+
+ *outDescriptor = (gralloc1_buffer_descriptor_t) (uintptr_t) desc;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_destroy_descriptor(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t descriptor)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptor);
+ if (!desc) {
+ return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ }
+
+ free(desc);
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_set_consumer_usage(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t descriptor, uint64_t usage)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptor);
+ if (!desc) {
+ return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ }
+
+ desc->consumer_usage = (int) usage;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_set_dimensions(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t descriptor,
+ uint32_t width, uint32_t height)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptor);
+ if (!desc) {
+ return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ }
+
+ desc->width = (int) width;
+ desc->height = (int) height;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_set_format(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t descriptor, int32_t format)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptor);
+ if (!desc) {
+ return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ }
+
+ desc->format = format;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_set_producer_usage(struct gralloc1_device* device,
+ gralloc1_buffer_descriptor_t descriptor, uint64_t usage)
+{
+ struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptor);
+ if (!desc) {
+ return GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ }
+
+ desc->producer_usage = (int) usage;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_backing_store(struct gralloc1_device* device,
+ buffer_handle_t buffer, gralloc1_backing_store_t* outStore)
+{
+ /* we never share backing store */
+ *outStore = (gralloc1_backing_store_t) (uintptr_t) buffer;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_consumer_usage(struct gralloc1_device* device,
+ buffer_handle_t buffer, uint64_t* outUsage)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outUsage = data->info.usage;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_dimensions(struct gralloc1_device* device,
+ buffer_handle_t buffer, uint32_t* outWidth, uint32_t* outHeight)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outWidth = data->info.width;
+ *outHeight = data->info.height;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_format(struct gralloc1_device* device,
+ buffer_handle_t buffer, int32_t* outFormat)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outFormat = data->info.format;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_producer_usage(struct gralloc1_device* device,
+ buffer_handle_t buffer, uint64_t* outUsage)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outUsage = data->info.usage;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_stride(struct gralloc1_device* device,
+ buffer_handle_t buffer, uint32_t* outStride)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outStride = data->info.stride;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_allocate(struct gralloc1_device* device,
+ uint32_t numDescriptors,
+ const gralloc1_buffer_descriptor_t* descriptors,
+ buffer_handle_t* outBuffers)
+{
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ struct gralloc1_adapter_device* dev = gralloc1_adapter_device(device);
+ gralloc1_error_t err = GRALLOC1_ERROR_NONE;
+ uint32_t i;
+
+ for (i = 0; i < numDescriptors; i++) {
+ const struct gralloc1_adapter_buffer_descriptor* desc =
+ lookup_buffer_descriptor(device, descriptors[i]);
+ struct gralloc1_adapter_buffer_data* data;
+ buffer_handle_t buffer;
+ int dummy_stride;
+ int ret;
+
+ if (!desc) {
+ err = GRALLOC1_ERROR_BAD_DESCRIPTOR;
+ break;
+ }
+
+ data = calloc(1, sizeof(*data));
+ if (!data) {
+ err = GRALLOC1_ERROR_NO_RESOURCES;
+ break;
+ }
+
+ ret = dev->alloc_dev->alloc(dev->alloc_dev, desc->width, desc->height,
+ desc->format, desc->producer_usage | desc->consumer_usage,
+ &buffer, &dummy_stride);
+ if (ret) {
+ free(data);
+ err = GRALLOC1_ERROR_NO_RESOURCES;
+ break;
+ }
+
+ mod->adapter.get_info(&mod->base, buffer, &data->info);
+ data->refcount = 1;
+ data->owned = true;
+
+ mod->adapter.set_data(&mod->base, buffer, data);
+
+ outBuffers[i] = buffer;
+ }
+
+ if (err != GRALLOC1_ERROR_NONE) {
+ uint32_t j;
+ for (j = 0; j < i; j++) {
+ free(mod->adapter.get_data(&mod->base, outBuffers[i]));
+ dev->alloc_dev->free(dev->alloc_dev, outBuffers[i]);
+ }
+
+ return err;
+ }
+
+ return (numDescriptors > 1) ?
+ GRALLOC1_ERROR_NOT_SHARED : GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_retain(struct gralloc1_device* device,
+ buffer_handle_t buffer)
+{
+ static pthread_mutex_t register_mutex = PTHREAD_MUTEX_INITIALIZER;
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ struct gralloc1_adapter_buffer_data* data;
+
+ pthread_mutex_lock(®ister_mutex);
+
+ if (mod->adapter.is_registered(&mod->base, buffer)) {
+ data = mod->adapter.get_data(&mod->base, buffer);
+ data->refcount++;
+ } else {
+ int ret;
+
+ data = calloc(1, sizeof(*data));
+ if (!data) {
+ pthread_mutex_unlock(®ister_mutex);
+ return GRALLOC1_ERROR_NO_RESOURCES;
+ }
+
+ ret = mod->base.registerBuffer(&mod->base, buffer);
+ if (ret) {
+ pthread_mutex_unlock(®ister_mutex);
+ free(data);
+
+ return GRALLOC1_ERROR_NO_RESOURCES;
+ }
+
+ mod->adapter.get_info(&mod->base, buffer, &data->info);
+ data->refcount = 1;
+ data->owned = false;
+
+ mod->adapter.set_data(&mod->base, buffer, data);
+ }
+
+ pthread_mutex_unlock(®ister_mutex);
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_release(struct gralloc1_device* device,
+ buffer_handle_t buffer)
+{
+ struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ ALOGE("unable to release unregistered buffer %p", buffer);
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ data->refcount--;
+ if (!data->refcount) {
+ if (data->owned) {
+ struct gralloc1_adapter_device* dev =
+ gralloc1_adapter_device(device);
+ dev->alloc_dev->free(dev->alloc_dev, buffer);
+ } else {
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ mod->base.unregisterBuffer(&mod->base, buffer);
+
+ native_handle_close(buffer);
+ native_handle_delete((native_handle_t*) buffer);
+ }
+
+ free(data);
+ }
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_get_num_flex_planes(struct gralloc1_device* device,
+ buffer_handle_t buffer, uint32_t* outNumPlanes)
+{
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ if (!data) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ *outNumPlanes = data->info.num_flex_planes;
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_lock(struct gralloc1_device* device,
+ buffer_handle_t buffer,
+ uint64_t producerUsage, uint64_t consumerUsage,
+ const gralloc1_rect_t* accessRegion, void** outData,
+ int32_t acquireFence)
+{
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ const int usage = (int) (producerUsage | consumerUsage);
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ int ret;
+
+ if (!data) {
+ ALOGE("unable to lock unregistered buffer %p", buffer);
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ if (mod->adapter.real_module_api_version >=
+ GRALLOC_MODULE_API_VERSION_0_3) {
+ ret = mod->base.lockAsync(&mod->base,
+ buffer, usage,
+ accessRegion->left,
+ accessRegion->top,
+ accessRegion->width,
+ accessRegion->height,
+ outData, acquireFence);
+ } else {
+ if (acquireFence >= 0) {
+ sync_wait(acquireFence, -1);
+ }
+
+ ret = mod->base.lock(&mod->base,
+ buffer, usage,
+ accessRegion->left,
+ accessRegion->top,
+ accessRegion->width,
+ accessRegion->height,
+ outData);
+
+ if (acquireFence >= 0 && !ret) {
+ close(acquireFence);
+ }
+ }
+
+ return (ret) ? GRALLOC1_ERROR_NO_RESOURCES : GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_lock_flex(struct gralloc1_device* device,
+ buffer_handle_t buffer,
+ uint64_t producerUsage, uint64_t consumerUsage,
+ const gralloc1_rect_t* accessRegion,
+ struct android_flex_layout* outFlexLayout,
+ int32_t acquireFence)
+{
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ const int usage = (int) (producerUsage | consumerUsage);
+ const struct gralloc1_adapter_buffer_data* data =
+ lookup_buffer_data(device, buffer);
+ struct android_ycbcr ycbcr;
+ int ret;
+
+ if (!data) {
+ ALOGE("unable to lockFlex unregistered buffer %p", buffer);
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ if (outFlexLayout->num_planes < data->info.num_flex_planes) {
+ return GRALLOC1_ERROR_BAD_VALUE;
+ }
+
+ if (mod->adapter.real_module_api_version >=
+ GRALLOC_MODULE_API_VERSION_0_3 && mod->base.lockAsync_ycbcr) {
+ ret = mod->base.lockAsync_ycbcr(&mod->base,
+ buffer, usage,
+ accessRegion->left,
+ accessRegion->top,
+ accessRegion->width,
+ accessRegion->height,
+ &ycbcr, acquireFence);
+ } else if (mod->base.lock_ycbcr) {
+ if (acquireFence >= 0) {
+ sync_wait(acquireFence, -1);
+ }
+
+ ret = mod->base.lock_ycbcr(&mod->base,
+ buffer, usage,
+ accessRegion->left,
+ accessRegion->top,
+ accessRegion->width,
+ accessRegion->height,
+ &ycbcr);
+
+ if (acquireFence >= 0 && !ret) {
+ close(acquireFence);
+ }
+ } else {
+ return GRALLOC1_ERROR_UNSUPPORTED;
+ }
+
+ if (ret) {
+ return GRALLOC1_ERROR_NO_RESOURCES;
+ }
+
+ mod->adapter.get_flexible_layout(&mod->base, buffer,
+ &ycbcr, outFlexLayout);
+
+ return GRALLOC1_ERROR_NONE;
+}
+
+static int32_t device_unlock(struct gralloc1_device* device,
+ buffer_handle_t buffer, int32_t* outReleaseFence)
+{
+ const struct gralloc1_adapter_module* mod =
+ gralloc1_adapter_module(device);
+ int ret;
+
+ if (mod->adapter.real_module_api_version >=
+ GRALLOC_MODULE_API_VERSION_0_3) {
+ ret = mod->base.unlockAsync(&mod->base, buffer, outReleaseFence);
+ } else {
+ ret = mod->base.unlock(&mod->base, buffer);
+ if (!ret) {
+ *outReleaseFence = -1;
+ }
+ }
+
+ return (ret) ? GRALLOC1_ERROR_BAD_HANDLE : GRALLOC1_ERROR_NONE;
+}
+
+static gralloc1_function_pointer_t device_get_function(
+ struct gralloc1_device* device, int32_t descriptor)
+{
+ switch ((gralloc1_function_descriptor_t) descriptor) {
+#define CASE(id, ptr) \
+ case GRALLOC1_FUNCTION_ ## id: \
+ return (gralloc1_function_pointer_t) device_ ## ptr
+ CASE(DUMP, dump);
+ CASE(CREATE_DESCRIPTOR, create_descriptor);
+ CASE(DESTROY_DESCRIPTOR, destroy_descriptor);
+ CASE(SET_CONSUMER_USAGE, set_consumer_usage);
+ CASE(SET_DIMENSIONS, set_dimensions);
+ CASE(SET_FORMAT, set_format);
+ CASE(SET_PRODUCER_USAGE, set_producer_usage);
+ CASE(GET_BACKING_STORE, get_backing_store);
+ CASE(GET_CONSUMER_USAGE, get_consumer_usage);
+ CASE(GET_DIMENSIONS, get_dimensions);
+ CASE(GET_FORMAT, get_format);
+ CASE(GET_PRODUCER_USAGE, get_producer_usage);
+ CASE(GET_STRIDE, get_stride);
+ CASE(ALLOCATE, allocate);
+ CASE(RETAIN, retain);
+ CASE(RELEASE, release);
+ CASE(GET_NUM_FLEX_PLANES, get_num_flex_planes);
+ CASE(LOCK, lock);
+ CASE(LOCK_FLEX, lock_flex);
+ CASE(UNLOCK, unlock);
+#undef CASE
+ default: return NULL;
+ }
+}
+
+static void device_get_capabilities(struct gralloc1_device* device,
+ uint32_t* outCount, int32_t* outCapabilities)
+{
+ *outCount = 0;
+}
+
+static int device_close(struct hw_device_t* device)
+{
+ struct gralloc1_adapter_device* dev =
+ (struct gralloc1_adapter_device*) device;
+ int ret;
+
+ ret = dev->alloc_dev->common.close(&dev->alloc_dev->common);
+ if (!ret) {
+ free(dev);
+ }
+
+ return ret;
+}
+
+int gralloc1_adapter_device_open(const struct hw_module_t* module,
+ const char* id, struct hw_device_t** device)
+{
+ const struct gralloc1_adapter_module* mod =
+ (const struct gralloc1_adapter_module*) module;
+ struct alloc_device_t* alloc_dev;
+ struct gralloc1_adapter_device* dev;
+ int ret;
+
+ if (strcmp(id, GRALLOC_HARDWARE_MODULE_ID) != 0) {
+ ALOGE("unknown gralloc1 device id: %s", id);
+ return -EINVAL;
+ }
+
+ ret = module->methods->open(module, GRALLOC_HARDWARE_GPU0,
+ (struct hw_device_t**) &alloc_dev);
+ if (ret) {
+ return ret;
+ }
+
+ dev = malloc(sizeof(*dev));
+ if (!dev) {
+ alloc_dev->common.close(&alloc_dev->common);
+ return -ENOMEM;
+ }
+
+ *dev = (struct gralloc1_adapter_device) {
+ .base = {
+ .common = {
+ .tag = HARDWARE_DEVICE_TAG,
+ .version = HARDWARE_DEVICE_API_VERSION(0, 0),
+ .module = (struct hw_module_t*) mod,
+ .close = device_close,
+ },
+ .getCapabilities = device_get_capabilities,
+ .getFunction = device_get_function,
+ },
+ .alloc_dev = alloc_dev,
+ };
+
+ *device = (struct hw_device_t*) dev;
+
+ return 0;
+}
diff --git a/graphics/allocator/2.0/default/gralloc1-adapter.h b/graphics/allocator/2.0/default/gralloc1-adapter.h
new file mode 100644
index 0000000..f48cd9e
--- /dev/null
+++ b/graphics/allocator/2.0/default/gralloc1-adapter.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_GRALLOC1_ADAPTER_H
+#define ANDROID_HARDWARE_GRALLOC1_ADAPTER_H
+
+#include <stdbool.h>
+#include <hardware/gralloc.h>
+
+__BEGIN_DECLS
+
+struct gralloc1_adapter_buffer_info {
+ int width;
+ int height;
+ int format;
+ int usage;
+
+ int stride;
+ uint32_t num_flex_planes;
+};
+
+/* This struct must be embedded in the HAL's HAL_MODULE_INFO_SYM and must
+ * follow gralloc_module_t immediately. */
+struct gralloc1_adapter {
+ uint16_t real_module_api_version;
+
+ /* Return true if the buffer is registered. A locally allocated buffer is
+ * always registered.
+ *
+ * This function is called frequently. It must be thread safe just like
+ * other functions are.
+ */
+ bool (*is_registered)(const struct gralloc_module_t* mod,
+ buffer_handle_t buffer);
+
+ /* Set the adapter data for a registered buffer. */
+ void (*set_data)(const struct gralloc_module_t* mod,
+ buffer_handle_t buffer, void* data);
+
+ /* Get the adapter data for a registered buffer. */
+ void* (*get_data)(const struct gralloc_module_t* mod,
+ buffer_handle_t buffer);
+
+ /* Get the buffer info, such as width, height, etc. */
+ void (*get_info)(const struct gralloc_module_t* mod,
+ buffer_handle_t buffer,
+ struct gralloc1_adapter_buffer_info* info);
+
+ /* Get the flexilble layout matching ycbcr. */
+ void (*get_flexible_layout)(const struct gralloc_module_t* mod,
+ buffer_handle_t buffer, const struct android_ycbcr* ycbcr,
+ struct android_flex_layout* layout);
+};
+
+int gralloc1_adapter_device_open(const struct hw_module_t* module,
+ const char* id, struct hw_device_t** device);
+
+__END_DECLS
+
+#endif /* ANDROID_HARDWARE_GRALLOC1_ADAPTER_H */
diff --git a/graphics/allocator/2.0/types.hal b/graphics/allocator/2.0/types.hal
new file mode 100644
index 0000000..23b7345
--- /dev/null
+++ b/graphics/allocator/2.0/types.hal
@@ -0,0 +1,171 @@
+/*
+ * 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.graphics.allocator@2.0;
+
+enum Error : int32_t {
+ NONE = 0, /* no error */
+ BAD_DESCRIPTOR = 1, /* invalid BufferDescriptor */
+ BAD_BUFFER = 2, /* invalid Buffer */
+ BAD_VALUE = 3, /* invalid width, height, etc. */
+ NOT_SHARED = 4, /* buffers not sharing backing store */
+ NO_RESOURCES = 5, /* temporary failure due to resource contention */
+ UNDEFINED = 6, /* an operation has no defined meaning */
+ UNSUPPORTED = 7, /* permanent failure */
+};
+
+enum ProducerUsage : uint64_t {
+ /* bit 0 is reserved */
+
+ /* buffer will be read by CPU occasionally */
+ CPU_READ = 1ULL << 1,
+ /* buffer will be read by CPU frequently */
+ CPU_READ_OFTEN = 1ULL << 2,
+
+ /* bit 3 is reserved */
+ /* bit 4 is reserved */
+
+ /* buffer will be written by CPU occasionally */
+ CPU_WRITE = 1ULL << 5,
+ /* buffer will be written by CPU frequently */
+ CPU_WRITE_OFTEN = 1ULL << 6,
+
+ /* bit 7 is reserved */
+ /* bit 8 is reserved */
+
+ /* buffer will be used as a GPU render target */
+ GPU_RENDER_TARGET = 1ULL << 9,
+
+ /* bit 10 is reserved */
+ /* bit 11 is reserved */
+ /* bit 12 is reserved */
+ /* bit 13 is reserved */
+
+ /*
+ * Buffer is allocated with hardware-level protection against copying the
+ * contents (or information derived from the contents) into unprotected
+ * memory.
+ */
+ PROTECTED = 1ULL << 14,
+
+ /* bit 15 is reserved */
+ /* bit 16 is reserved */
+
+ /* buffer will be used as a camera HAL output */
+ CAMERA = 1ULL << 17,
+
+ /* bit 18 is reserved */
+ /* bit 19 is reserved */
+ /* bit 20 is reserved */
+ /* bit 21 is reserved */
+
+ /* buffer will be used as a video decoder output */
+ VIDEO_DECODER = 1ULL << 22,
+
+ /* bits 23-27 are reserved for future versions */
+ /* bits 28-31 are reserved for vendor extensions */
+
+ /* bits 32-47 are reserved for future versions */
+ /* bits 48-63 are reserved for vendor extensions */
+};
+
+enum ConsumerUsage : uint64_t {
+ /* bit 0 is reserved */
+
+ /* buffer will be read by CPU occasionally */
+ CPU_READ = 1ULL << 1,
+ /* buffer will be read by CPU frequently */
+ CPU_READ_OFTEN = 1ULL << 2,
+
+ /* bit 3 is reserved */
+ /* bit 4 is reserved */
+ /* bit 5 is reserved */
+ /* bit 6 is reserved */
+ /* bit 7 is reserved */
+
+ /* buffer will be used as a GPU texture */
+ GPU_TEXTURE = 1ULL << 8,
+
+ /* bit 9 is reserved */
+ /* bit 10 is reserved */
+
+ /* buffer will be used by hwcomposer HAL */
+ HWCOMPOSER = 1ULL << 11,
+ /* buffer will be as a hwcomposer HAL client target */
+ CLIENT_TARGET = 1ULL << 12,
+
+ /* bit 13 is reserved */
+ /* bit 14 is reserved */
+
+ /* buffer will be used as a hwcomposer HAL cursor */
+ CURSOR = 1ULL << 15,
+
+ /* buffer will be used as a video encoder input */
+ VIDEO_ENCODER = 1ULL << 16,
+
+ /* bit 17 is reserved */
+
+ /* buffer will be used as a camera HAL input */
+ CAMERA = 1ULL << 18,
+
+ /* bit 19 is reserved */
+
+ /* buffer will be used as a renderscript allocation */
+ RENDERSCRIPT = 1ULL << 20,
+
+ /* bit 21 is reserved */
+ /* bit 22 is reserved */
+
+ /* bits 23-27 are reserved for future versions */
+ /* bits 28-31 are reserved for vendor extensions */
+
+ /* bits 32-47 are reserved for future versions */
+ /* bits 48-63 are reserved for vendor extensions */
+};
+
+/*
+ * Copied from android_pixel_format_t.
+ *
+ * TODO(olv) copy comments as well and have android_pixel_format_t generated
+ */
+@export(name="android_pixel_format", value_prefix="HAL_PIXEL_FORMAT_")
+enum PixelFormat : int32_t {
+ RGBA_8888 = 1,
+ RGBX_8888 = 2,
+ RGB_888 = 3,
+ RGB_565 = 4,
+ BGRA_8888 = 5,
+ YV12 = 0x32315659,
+ Y8 = 0x20203859,
+ Y16 = 0x20363159,
+ RAW16 = 0x20,
+ RAW10 = 0x25,
+ RAW12 = 0x26,
+ RAW_OPAQUE = 0x24,
+ BLOB = 0x21,
+ IMPLEMENTATION_DEFINED = 0x22,
+ YCbCr_420_888 = 0x23,
+ YCbCr_422_888 = 0x27,
+ YCbCr_444_888 = 0x28,
+ FLEX_RGB_888 = 0x29,
+ FLEX_RGBA_8888 = 0x2A,
+ YCbCr_422_SP = 0x10,
+ YCrCb_420_SP = 0x11,
+ YCbCr_422_I = 0x14,
+};
+
+typedef uint64_t BufferDescriptor;
+typedef uint64_t Buffer;
diff --git a/graphics/mapper/2.0/Android.bp b/graphics/mapper/2.0/Android.bp
new file mode 100644
index 0000000..3718503
--- /dev/null
+++ b/graphics/mapper/2.0/Android.bp
@@ -0,0 +1,15 @@
+genrule {
+ name: "android.hardware.graphics.mapper@2.0_genc++_headers",
+ cmd: "cp $in $genDir/android/hardware/graphics/mapper/2.0",
+ srcs: ["IMapper.h", "types.h"],
+ out: [
+ "android/hardware/graphics/mapper/2.0/IMapper.h",
+ "android/hardware/graphics/mapper/2.0/types.h",
+ ],
+}
+
+cc_library_static {
+ name: "android.hardware.graphics.mapper@2.0",
+ generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.graphics.mapper@2.0_genc++_headers"],
+}
diff --git a/graphics/mapper/2.0/IMapper.h b/graphics/mapper/2.0/IMapper.h
new file mode 100644
index 0000000..23faa80
--- /dev/null
+++ b/graphics/mapper/2.0/IMapper.h
@@ -0,0 +1,388 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H
+#define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H
+
+#include <type_traits>
+
+#include <android/hardware/graphics/mapper/2.0/types.h>
+
+extern "C" {
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V2_0 {
+
+struct Device {
+ struct Rect {
+ int32_t left;
+ int32_t top;
+ int32_t width;
+ int32_t height;
+ };
+ static_assert(std::is_pod<Rect>::value, "Device::Rect is not POD");
+
+ /*
+ * Create a mapper device.
+ *
+ * @return error is NONE upon success. Otherwise,
+ * NOT_SUPPORTED when creation will never succeed.
+ * BAD_RESOURCES when creation failed at this time.
+ * @return device is the newly created mapper device.
+ */
+ typedef Error (*createDevice)(Device** outDevice);
+
+ /*
+ * Destroy a mapper device.
+ *
+ * @return error is always NONE.
+ * @param device is the mapper device to destroy.
+ */
+ typedef Error (*destroyDevice)(Device* device);
+
+ /*
+ * Adds a reference to the given buffer handle.
+ *
+ * A buffer handle received from a remote process or exported by
+ * IAllocator::exportHandle is unknown to this client-side library. There
+ * is also no guarantee that the buffer's backing store will stay alive.
+ * This function must be called at least once in both cases to intrdouce
+ * the buffer handle to this client-side library and to secure the backing
+ * store. It may also be called more than once to increase the reference
+ * count if two components in the same process want to interact with the
+ * buffer independently.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer to which a reference must be added.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid
+ * NO_RESOURCES when it is not possible to add a
+ * reference to this buffer at this time
+ */
+ typedef Error (*retain)(Device* device,
+ const native_handle_t* bufferHandle);
+
+ /*
+ * Removes a reference from the given buffer buffer.
+ *
+ * If no references remain, the buffer handle should be freed with
+ * native_handle_close/native_handle_delete. When the last buffer handle
+ * referring to a particular backing store is freed, that backing store
+ * should also be freed.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which a reference must be
+ * removed.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ */
+ typedef Error (*release)(Device* device,
+ const native_handle_t* bufferHandle);
+
+ /*
+ * Gets the width and height of the buffer in pixels.
+ *
+ * See IAllocator::BufferDescriptorInfo for more information.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get the dimensions.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return width is the width of the buffer in pixels.
+ * @return height is the height of the buffer in pixels.
+ */
+ typedef Error (*getDimensions)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint32_t* outWidth,
+ uint32_t* outHeight);
+
+ /*
+ * Gets the format of the buffer.
+ *
+ * See IAllocator::BufferDescriptorInfo for more information.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get format.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return format is the format of the buffer.
+ */
+ typedef Error (*getFormat)(Device* device,
+ const native_handle_t* bufferHandle,
+ PixelFormat* outFormat);
+
+ /*
+ * Gets the producer usage flags which were used to allocate this buffer.
+ *
+ * See IAllocator::BufferDescriptorInfo for more information.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get the producer usage
+ * flags.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return usageMask contains the producer usage flags of the buffer.
+ */
+ typedef Error (*getProducerUsageMask)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask);
+
+ /*
+ * Gets the consumer usage flags which were used to allocate this buffer.
+ *
+ * See IAllocator::BufferDescriptorInfo for more information.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get the consumer usage
+ * flags.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return usageMask contains the consumer usage flags of the buffer.
+ */
+ typedef Error (*getConsumerUsageMask)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask);
+
+ /*
+ * Gets a value that uniquely identifies the backing store of the given
+ * buffer.
+ *
+ * Buffers which share a backing store should return the same value from
+ * this function. If the buffer is present in more than one process, the
+ * backing store value for that buffer is not required to be the same in
+ * every process.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get the backing store
+ * identifier.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return store is the backing store identifier for this buffer.
+ */
+ typedef Error (*getBackingStore)(Device* device,
+ const native_handle_t* bufferHandle,
+ BackingStore* outStore);
+
+ /*
+ * Gets the stride of the buffer in pixels.
+ *
+ * The stride is the offset in pixel-sized elements between the same
+ * column in two adjacent rows of pixels. This may not be equal to the
+ * width of the buffer.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer from which to get the stride.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * UNDEFINED when the notion of a stride is not
+ * meaningful for the buffer format.
+ * @return store is the stride in pixels.
+ */
+ typedef Error (*getStride)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint32_t* outStride);
+
+ /*
+ * Returns the number of flex layout planes which are needed to represent
+ * the given buffer. This may be used to efficiently allocate only as many
+ * plane structures as necessary before calling into lockFlex.
+ *
+ * If the given buffer cannot be locked as a flex format, this function
+ * may return UNSUPPORTED (as lockFlex would).
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer for which the number of planes should
+ * be queried.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * UNSUPPORTED when the buffer's format cannot be
+ * represented in a flex layout.
+ * @return numPlanes is the number of flex planes required to describe the
+ * given buffer.
+ */
+ typedef Error (*getNumFlexPlanes)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint32_t* outNumPlanes);
+
+ /*
+ * Locks the given buffer for the specified CPU usage.
+ *
+ * Exactly one of producerUsageMask and consumerUsageMask must be 0. The
+ * usage which is not 0 must be one of the *Usage::CPU* values, as
+ * applicable. Locking a buffer for a non-CPU usage is not supported.
+ *
+ * Locking the same buffer simultaneously from multiple threads is
+ * permitted, but if any of the threads attempt to lock the buffer for
+ * writing, the behavior is undefined, except that it must not cause
+ * process termination or block the client indefinitely. Leaving the
+ * buffer content in an indeterminate state or returning an error are both
+ * acceptable.
+ *
+ * The client must not modify the content of the buffer outside of
+ * accessRegion, and the device need not guarantee that content outside of
+ * accessRegion is valid for reading. The result of reading or writing
+ * outside of accessRegion is undefined, except that it must not cause
+ * process termination.
+ *
+ * data will be filled with a pointer to the locked buffer memory. This
+ * address will represent the top-left corner of the entire buffer, even
+ * if accessRegion does not begin at the top-left corner.
+ *
+ * acquireFence is a file descriptor referring to a acquire sync fence
+ * object, which will be signaled when it is safe for the device to access
+ * the contents of the buffer (prior to locking). If it is already safe to
+ * access the buffer contents, -1 may be passed instead.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer to lock.
+ * @param producerUsageMask contains the producer usage flags to request;
+ * either this or consumerUsagemask must be 0, and the other must
+ * be a CPU usage.
+ * @param consumerUsageMask contains the consumer usage flags to request;
+ * either this or producerUsageMask must be 0, and the other must
+ * be a CPU usage.
+ * @param accessRegion is the portion of the buffer that the client
+ * intends to access.
+ * @param acquireFence is a sync fence file descriptor as described above.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * BAD_VALUE when neither or both of producerUsageMask
+ * and consumerUsageMask were 0, or the usage
+ * which was not 0 was not a CPU usage.
+ * NO_RESOURCES when the buffer cannot be locked at this
+ * time, but locking may succeed at a future
+ * time.
+ * UNSUPPORTED when the buffer cannot be locked with the
+ * given usage, and any future attempts at
+ * locking will also fail.
+ * @return data will be filled with a CPU-accessible pointer to the buffer
+ * data.
+ */
+ typedef Error (*lock)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask,
+ uint64_t consumerUsageMask,
+ const Rect* accessRegion,
+ int32_t acquireFence,
+ void** outData);
+
+ /*
+ * This is largely the same as lock(), except that instead of returning a
+ * pointer directly to the buffer data, it returns an FlexLayout struct
+ * describing how to access the data planes.
+ *
+ * This function must work on buffers with PixelFormat::YCbCr_*_888 if
+ * supported by the device, as well as with any other formats requested by
+ * multimedia codecs when they are configured with a
+ * flexible-YUV-compatible color format.
+ *
+ * This function may also be called on buffers of other formats, including
+ * non-YUV formats, but if the buffer format is not compatible with a
+ * flexible representation, it may return UNSUPPORTED.
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer to lock.
+ * @param producerUsageMask contains the producer usage flags to request;
+ * either this or consumerUsagemask must be 0, and the other must
+ * be a CPU usage.
+ * @param consumerUsageMask contains the consumer usage flags to request;
+ * either this or producerUsageMask must be 0, and the other must
+ * be a CPU usage.
+ * @param accessRegion is the portion of the buffer that the client
+ * intends to access.
+ * @param acquireFence is a sync fence file descriptor as described in
+ * lock().
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * BAD_VALUE when neither or both of producerUsageMask
+ * and consumerUsageMask were 0, or the usage
+ * which was not 0 was not a CPU usage.
+ * NO_RESOURCES when the buffer cannot be locked at this
+ * time, but locking may succeed at a future
+ * time.
+ * UNSUPPORTED when the buffer cannot be locked with the
+ * given usage, and any future attempts at
+ * locking will also fail.
+ * @return flexLayout will be filled with the description of the planes in
+ * the buffer.
+ */
+ typedef Error (*lockFlex)(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask,
+ uint64_t consumerUsageMask,
+ const Rect* accessRegion,
+ int32_t acquireFence,
+ FlexLayout* outFlexLayout);
+
+ /*
+ * This function indicates to the device that the client will be done with
+ * the buffer when releaseFence signals.
+ *
+ * releaseFence will be filled with a file descriptor referring to a
+ * release sync fence object, which will be signaled when it is safe to
+ * access the contents of the buffer (after the buffer has been unlocked).
+ * If it is already safe to access the buffer contents, then -1 may be
+ * returned instead.
+ *
+ * This function is used to unlock both buffers locked by lock() and those
+ * locked by lockFlex().
+ *
+ * @param device is the mapper device.
+ * @param bufferHandle is the buffer to unlock.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer handle is invalid.
+ * @return releaseFence is a sync fence file descriptor as described
+ * above.
+ */
+ typedef Error (*unlock)(Device* device,
+ const native_handle_t* bufferHandle,
+ int32_t* outReleaseFence);
+};
+static_assert(std::is_pod<Device>::value, "Device is not POD");
+
+struct IMapper {
+ Device::createDevice createDevice;
+ Device::destroyDevice destroyDevice;
+
+ Device::retain retain;
+ Device::release release;
+ Device::getDimensions getDimensions;
+ Device::getFormat getFormat;
+ Device::getProducerUsageMask getProducerUsageMask;
+ Device::getConsumerUsageMask getConsumerUsageMask;
+ Device::getBackingStore getBackingStore;
+ Device::getStride getStride;
+ Device::getNumFlexPlanes getNumFlexPlanes;
+ Device::lock lock;
+ Device::lockFlex lockFlex;
+ Device::unlock unlock;
+};
+static_assert(std::is_pod<IMapper>::value, "IMapper is not POD");
+
+} // namespace V2_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
+
+const void* HALLIB_FETCH_Interface(const char* name);
+
+} // extern "C"
+
+#endif /* ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_IMAPPER_H */
diff --git a/graphics/mapper/2.0/default/Android.bp b/graphics/mapper/2.0/default/Android.bp
new file mode 100644
index 0000000..b738ae8
--- /dev/null
+++ b/graphics/mapper/2.0/default/Android.bp
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library_shared {
+ name: "android.hardware.graphics.mapper.hallib",
+ relative_install_path: "hw",
+ srcs: ["GrallocMapper.cpp"],
+ cppflags: ["-Wall", "-Wextra"],
+ static_libs: ["android.hardware.graphics.mapper@2.0"],
+ shared_libs: [
+ "android.hardware.graphics.allocator@2.0",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "liblog",
+ ],
+}
diff --git a/graphics/mapper/2.0/default/GrallocMapper.cpp b/graphics/mapper/2.0/default/GrallocMapper.cpp
new file mode 100644
index 0000000..eeca5c7
--- /dev/null
+++ b/graphics/mapper/2.0/default/GrallocMapper.cpp
@@ -0,0 +1,373 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ * * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GrallocMapperPassthrough"
+
+#include <android/hardware/graphics/mapper/2.0/IMapper.h>
+#include <hardware/gralloc1.h>
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V2_0 {
+namespace implementation {
+
+class GrallocDevice : public Device {
+public:
+ GrallocDevice();
+ ~GrallocDevice();
+
+ // IMapper interface
+ Error retain(const native_handle_t* bufferHandle);
+ Error release(const native_handle_t* bufferHandle);
+ Error getDimensions(const native_handle_t* bufferHandle,
+ uint32_t* outWidth, uint32_t* outHeight);
+ Error getFormat(const native_handle_t* bufferHandle,
+ PixelFormat* outFormat);
+ Error getProducerUsageMask(const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask);
+ Error getConsumerUsageMask(const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask);
+ Error getBackingStore(const native_handle_t* bufferHandle,
+ BackingStore* outStore);
+ Error getStride(const native_handle_t* bufferHandle, uint32_t* outStride);
+ Error getNumFlexPlanes(const native_handle_t* bufferHandle,
+ uint32_t* outNumPlanes);
+ Error lock(const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Rect* accessRegion, int32_t acquireFence, void** outData);
+ Error lockFlex(const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Rect* accessRegion, int32_t acquireFence,
+ FlexLayout* outFlexLayout);
+ Error unlock(const native_handle_t* bufferHandle,
+ int32_t* outReleaseFence);
+
+private:
+ void initDispatch();
+
+ gralloc1_device_t* mDevice;
+
+ struct {
+ GRALLOC1_PFN_RETAIN retain;
+ GRALLOC1_PFN_RELEASE release;
+ GRALLOC1_PFN_GET_DIMENSIONS getDimensions;
+ GRALLOC1_PFN_GET_FORMAT getFormat;
+ GRALLOC1_PFN_GET_PRODUCER_USAGE getProducerUsage;
+ GRALLOC1_PFN_GET_CONSUMER_USAGE getConsumerUsage;
+ GRALLOC1_PFN_GET_BACKING_STORE getBackingStore;
+ GRALLOC1_PFN_GET_STRIDE getStride;
+ GRALLOC1_PFN_GET_NUM_FLEX_PLANES getNumFlexPlanes;
+ GRALLOC1_PFN_LOCK lock;
+ GRALLOC1_PFN_LOCK_FLEX lockFlex;
+ GRALLOC1_PFN_UNLOCK unlock;
+ } mDispatch;
+};
+
+GrallocDevice::GrallocDevice()
+{
+ const hw_module_t* module;
+ int status = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+ if (status) {
+ LOG_ALWAYS_FATAL("failed to get gralloc module");
+ }
+
+ uint8_t major = (module->module_api_version >> 8) & 0xff;
+ if (major != 1) {
+ LOG_ALWAYS_FATAL("unknown gralloc module major version %d", major);
+ }
+
+ status = gralloc1_open(module, &mDevice);
+ if (status) {
+ LOG_ALWAYS_FATAL("failed to open gralloc1 device");
+ }
+
+ initDispatch();
+}
+
+GrallocDevice::~GrallocDevice()
+{
+ gralloc1_close(mDevice);
+}
+
+void GrallocDevice::initDispatch()
+{
+#define CHECK_FUNC(func, desc) do { \
+ mDispatch.func = reinterpret_cast<decltype(mDispatch.func)>( \
+ mDevice->getFunction(mDevice, desc)); \
+ if (!mDispatch.func) { \
+ LOG_ALWAYS_FATAL("failed to get gralloc1 function %d", desc); \
+ } \
+} while (0)
+
+ CHECK_FUNC(retain, GRALLOC1_FUNCTION_RETAIN);
+ CHECK_FUNC(release, GRALLOC1_FUNCTION_RELEASE);
+ CHECK_FUNC(getDimensions, GRALLOC1_FUNCTION_GET_DIMENSIONS);
+ CHECK_FUNC(getFormat, GRALLOC1_FUNCTION_GET_FORMAT);
+ CHECK_FUNC(getProducerUsage, GRALLOC1_FUNCTION_GET_PRODUCER_USAGE);
+ CHECK_FUNC(getConsumerUsage, GRALLOC1_FUNCTION_GET_CONSUMER_USAGE);
+ CHECK_FUNC(getBackingStore, GRALLOC1_FUNCTION_GET_BACKING_STORE);
+ CHECK_FUNC(getStride, GRALLOC1_FUNCTION_GET_STRIDE);
+ CHECK_FUNC(getNumFlexPlanes, GRALLOC1_FUNCTION_GET_NUM_FLEX_PLANES);
+ CHECK_FUNC(lock, GRALLOC1_FUNCTION_LOCK);
+ CHECK_FUNC(lockFlex, GRALLOC1_FUNCTION_LOCK_FLEX);
+ CHECK_FUNC(unlock, GRALLOC1_FUNCTION_UNLOCK);
+
+#undef CHECK_FUNC
+}
+
+Error GrallocDevice::retain(const native_handle_t* bufferHandle)
+{
+ int32_t error = mDispatch.retain(mDevice, bufferHandle);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::release(const native_handle_t* bufferHandle)
+{
+ int32_t error = mDispatch.release(mDevice, bufferHandle);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getDimensions(const native_handle_t* bufferHandle,
+ uint32_t* outWidth, uint32_t* outHeight)
+{
+ int32_t error = mDispatch.getDimensions(mDevice, bufferHandle,
+ outWidth, outHeight);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getFormat(const native_handle_t* bufferHandle,
+ PixelFormat* outFormat)
+{
+ int32_t error = mDispatch.getFormat(mDevice, bufferHandle,
+ reinterpret_cast<int32_t*>(outFormat));
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getProducerUsageMask(const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask)
+{
+ int32_t error = mDispatch.getProducerUsage(mDevice, bufferHandle,
+ outUsageMask);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getConsumerUsageMask(const native_handle_t* bufferHandle,
+ uint64_t* outUsageMask)
+{
+ int32_t error = mDispatch.getConsumerUsage(mDevice, bufferHandle,
+ outUsageMask);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getBackingStore(const native_handle_t* bufferHandle,
+ BackingStore* outStore)
+{
+ int32_t error = mDispatch.getBackingStore(mDevice, bufferHandle,
+ outStore);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getStride(const native_handle_t* bufferHandle,
+ uint32_t* outStride)
+{
+ int32_t error = mDispatch.getStride(mDevice, bufferHandle, outStride);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::getNumFlexPlanes(const native_handle_t* bufferHandle,
+ uint32_t* outNumPlanes)
+{
+ int32_t error = mDispatch.getNumFlexPlanes(mDevice, bufferHandle,
+ outNumPlanes);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::lock(const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Rect* accessRegion, int32_t acquireFence,
+ void** outData)
+{
+ int32_t error = mDispatch.lock(mDevice, bufferHandle,
+ producerUsageMask, consumerUsageMask,
+ reinterpret_cast<const gralloc1_rect_t*>(accessRegion),
+ outData, acquireFence);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::lockFlex(const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Rect* accessRegion, int32_t acquireFence,
+ FlexLayout* outFlexLayout)
+{
+ int32_t error = mDispatch.lockFlex(mDevice, bufferHandle,
+ producerUsageMask, consumerUsageMask,
+ reinterpret_cast<const gralloc1_rect_t*>(accessRegion),
+ reinterpret_cast<android_flex_layout_t*>(outFlexLayout),
+ acquireFence);
+ return static_cast<Error>(error);
+}
+
+Error GrallocDevice::unlock(const native_handle_t* bufferHandle,
+ int32_t* outReleaseFence)
+{
+ int32_t error = mDispatch.unlock(mDevice, bufferHandle, outReleaseFence);
+ return static_cast<Error>(error);
+}
+
+class GrallocMapper : public IMapper {
+public:
+ GrallocMapper() : IMapper{
+ .createDevice = createDevice,
+ .destroyDevice = destroyDevice,
+ .retain = retain,
+ .release = release,
+ .getDimensions = getDimensions,
+ .getFormat = getFormat,
+ .getProducerUsageMask = getProducerUsageMask,
+ .getConsumerUsageMask = getConsumerUsageMask,
+ .getBackingStore = getBackingStore,
+ .getStride = getStride,
+ .getNumFlexPlanes = getNumFlexPlanes,
+ .lock = lock,
+ .lockFlex = lockFlex,
+ .unlock = unlock,
+ } {}
+
+ const IMapper* getInterface() const
+ {
+ return static_cast<const IMapper*>(this);
+ }
+
+private:
+ static GrallocDevice* cast(Device* device)
+ {
+ return reinterpret_cast<GrallocDevice*>(device);
+ }
+
+ static Error createDevice(Device** outDevice)
+ {
+ *outDevice = new GrallocDevice;
+ return Error::NONE;
+ }
+
+ static Error destroyDevice(Device* device)
+ {
+ delete cast(device);
+ return Error::NONE;
+ }
+
+ static Error retain(Device* device,
+ const native_handle_t* bufferHandle)
+ {
+ return cast(device)->retain(bufferHandle);
+ }
+
+ static Error release(Device* device,
+ const native_handle_t* bufferHandle)
+ {
+ return cast(device)->release(bufferHandle);
+ }
+
+ static Error getDimensions(Device* device,
+ const native_handle_t* bufferHandle,
+ uint32_t* outWidth, uint32_t* outHeight)
+ {
+ return cast(device)->getDimensions(bufferHandle, outWidth, outHeight);
+ }
+
+ static Error getFormat(Device* device,
+ const native_handle_t* bufferHandle, PixelFormat* outFormat)
+ {
+ return cast(device)->getFormat(bufferHandle, outFormat);
+ }
+
+ static Error getProducerUsageMask(Device* device,
+ const native_handle_t* bufferHandle, uint64_t* outUsageMask)
+ {
+ return cast(device)->getProducerUsageMask(bufferHandle, outUsageMask);
+ }
+
+ static Error getConsumerUsageMask(Device* device,
+ const native_handle_t* bufferHandle, uint64_t* outUsageMask)
+ {
+ return cast(device)->getConsumerUsageMask(bufferHandle, outUsageMask);
+ }
+
+ static Error getBackingStore(Device* device,
+ const native_handle_t* bufferHandle, BackingStore* outStore)
+ {
+ return cast(device)->getBackingStore(bufferHandle, outStore);
+ }
+
+ static Error getStride(Device* device,
+ const native_handle_t* bufferHandle, uint32_t* outStride)
+ {
+ return cast(device)->getStride(bufferHandle, outStride);
+ }
+
+ static Error getNumFlexPlanes(Device* device,
+ const native_handle_t* bufferHandle, uint32_t* outNumPlanes)
+ {
+ return cast(device)->getNumFlexPlanes(bufferHandle, outNumPlanes);
+ }
+
+ static Error lock(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Device::Rect* accessRegion, int32_t acquireFence,
+ void** outData)
+ {
+ return cast(device)->lock(bufferHandle,
+ producerUsageMask, consumerUsageMask,
+ accessRegion, acquireFence, outData);
+ }
+
+ static Error lockFlex(Device* device,
+ const native_handle_t* bufferHandle,
+ uint64_t producerUsageMask, uint64_t consumerUsageMask,
+ const Device::Rect* accessRegion, int32_t acquireFence,
+ FlexLayout* outFlexLayout)
+ {
+ return cast(device)->lockFlex(bufferHandle,
+ producerUsageMask, consumerUsageMask,
+ accessRegion, acquireFence, outFlexLayout);
+ }
+
+ static Error unlock(Device* device,
+ const native_handle_t* bufferHandle, int32_t* outReleaseFence)
+ {
+ return cast(device)->unlock(bufferHandle, outReleaseFence);
+ }
+};
+
+extern "C" const void* HALLIB_FETCH_Interface(const char* name)
+{
+ if (strcmp(name, "android.hardware.graphics.mapper@2.0::IMapper") == 0) {
+ static GrallocMapper sGrallocMapper;
+ return sGrallocMapper.getInterface();
+ }
+
+ return nullptr;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
diff --git a/graphics/mapper/2.0/types.h b/graphics/mapper/2.0/types.h
new file mode 100644
index 0000000..63a6b16
--- /dev/null
+++ b/graphics/mapper/2.0/types.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
+#define ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H
+
+#include <type_traits>
+
+#include <android/hardware/graphics/allocator/2.0/types.h>
+
+namespace android {
+namespace hardware {
+namespace graphics {
+namespace mapper {
+namespace V2_0 {
+
+using android::hardware::graphics::allocator::V2_0::Error;
+using android::hardware::graphics::allocator::V2_0::PixelFormat;
+using android::hardware::graphics::allocator::V2_0::ProducerUsage;
+using android::hardware::graphics::allocator::V2_0::ConsumerUsage;
+
+/*
+ * Structures for describing flexible YUVA/RGBA formats for consumption by
+ * applications. Such flexible formats contain a plane for each component
+ * (e.g. red, green, blue), where each plane is laid out in a grid-like
+ * pattern occupying unique byte addresses and with consistent byte offsets
+ * between neighboring pixels.
+ *
+ * The FlexLayout structure is used with any pixel format that can be
+ * represented by it, such as:
+ *
+ * - PixelFormat::YCbCr_*_888
+ * - PixelFormat::FLEX_RGB*_888
+ * - PixelFormat::RGB[AX]_888[8],BGRA_8888,RGB_888
+ * - PixelFormat::YV12,Y8,Y16,YCbCr_422_SP/I,YCrCb_420_SP
+ * - even implementation defined formats that can be represented by the
+ * structures
+ *
+ * Vertical increment (aka. row increment or stride) describes the distance in
+ * bytes from the first pixel of one row to the first pixel of the next row
+ * (below) for the component plane. This can be negative.
+ *
+ * Horizontal increment (aka. column or pixel increment) describes the
+ * distance in bytes from one pixel to the next pixel (to the right) on the
+ * same row for the component plane. This can be negative.
+ *
+ * Each plane can be subsampled either vertically or horizontally by a
+ * power-of-two factor.
+ *
+ * The bit-depth of each component can be arbitrary, as long as the pixels are
+ * laid out on whole bytes, in native byte-order, using the most significant
+ * bits of each unit.
+ */
+
+enum class FlexComponent : int32_t {
+ Y = 1 << 0, /* luma */
+ Cb = 1 << 1, /* chroma blue */
+ Cr = 1 << 2, /* chroma red */
+
+ R = 1 << 10, /* red */
+ G = 1 << 11, /* green */
+ B = 1 << 12, /* blue */
+
+ A = 1 << 30, /* alpha */
+};
+
+inline FlexComponent operator|(FlexComponent lhs, FlexComponent rhs)
+{
+ return static_cast<FlexComponent>(static_cast<int32_t>(lhs) |
+ static_cast<int32_t>(rhs));
+}
+
+inline FlexComponent& operator|=(FlexComponent &lhs, FlexComponent rhs)
+{
+ lhs = static_cast<FlexComponent>(static_cast<int32_t>(lhs) |
+ static_cast<int32_t>(rhs));
+ return lhs;
+}
+
+enum class FlexFormat : int32_t {
+ /* not a flexible format */
+ INVALID = 0x0,
+
+ Y = static_cast<int32_t>(FlexComponent::Y),
+ YCbCr = static_cast<int32_t>(FlexComponent::Y) |
+ static_cast<int32_t>(FlexComponent::Cb) |
+ static_cast<int32_t>(FlexComponent::Cr),
+ YCbCrA = static_cast<int32_t>(YCbCr) |
+ static_cast<int32_t>(FlexComponent::A),
+ RGB = static_cast<int32_t>(FlexComponent::R) |
+ static_cast<int32_t>(FlexComponent::G) |
+ static_cast<int32_t>(FlexComponent::B),
+ RGBA = static_cast<int32_t>(RGB) |
+ static_cast<int32_t>(FlexComponent::A),
+};
+
+struct FlexPlane {
+ /* pointer to the first byte of the top-left pixel of the plane. */
+ uint8_t *topLeft;
+
+ FlexComponent component;
+
+ /*
+ * bits allocated for the component in each pixel. Must be a positive
+ * multiple of 8.
+ */
+ int32_t bitsPerComponent;
+
+ /*
+ * number of the most significant bits used in the format for this
+ * component. Must be between 1 and bits_per_component, inclusive.
+ */
+ int32_t bitsUsed;
+
+ /* horizontal increment */
+ int32_t hIncrement;
+ /* vertical increment */
+ int32_t vIncrement;
+
+ /* horizontal subsampling. Must be a positive power of 2. */
+ int32_t hSubsampling;
+ /* vertical subsampling. Must be a positive power of 2. */
+ int32_t vSubsampling;
+};
+static_assert(std::is_pod<FlexPlane>::value, "FlexPlane is not POD");
+
+struct FlexLayout {
+ /* the kind of flexible format */
+ FlexFormat format;
+
+ /* number of planes; 0 for FLEX_FORMAT_INVALID */
+ uint32_t numPlanes;
+
+ /*
+ * a plane for each component; ordered in increasing component value order.
+ * E.g. FLEX_FORMAT_RGBA maps 0 -> R, 1 -> G, etc.
+ * Can be NULL for FLEX_FORMAT_INVALID
+ */
+ FlexPlane* planes;
+};
+static_assert(std::is_pod<FlexLayout>::value, "FlexLayout is not POD");
+
+typedef uint64_t BackingStore;
+
+} // namespace V2_0
+} // namespace mapper
+} // namespace graphics
+} // namespace hardware
+} // namespace android
+
+#endif /* ANDROID_HARDWARE_GRAPHICS_MAPPER_V2_0_TYPES_H */
diff --git a/light/2.0/Android.bp b/light/2.0/Android.bp
new file mode 100644
index 0000000..a3b03a7
--- /dev/null
+++ b/light/2.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.light@2.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
+ srcs: [
+ "types.hal",
+ "ILight.hal",
+ ],
+ out: [
+ "android/hardware/light/2.0/types.cpp",
+ "android/hardware/light/2.0/LightAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.light@2.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.light@2.0",
+ srcs: [
+ "types.hal",
+ "ILight.hal",
+ ],
+ out: [
+ "android/hardware/light/2.0/types.h",
+ "android/hardware/light/2.0/ILight.h",
+ "android/hardware/light/2.0/IHwLight.h",
+ "android/hardware/light/2.0/BnLight.h",
+ "android/hardware/light/2.0/BpLight.h",
+ "android/hardware/light/2.0/BsLight.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.light@2.0",
+ generated_sources: ["android.hardware.light@2.0_genc++"],
+ generated_headers: ["android.hardware.light@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.light@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/light/2.0/Android.mk b/light/2.0/Android.mk
new file mode 100644
index 0000000..8dc83f0
--- /dev/null
+++ b/light/2.0/Android.mk
@@ -0,0 +1,238 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.light@2.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (Brightness)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Brightness.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.light@2.0::types.Brightness
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Flash)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Flash.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.light@2.0::types.Flash
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (LightState)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/LightState.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.light@2.0::types.LightState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/light/2.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.light@2.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Type)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Type.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.light@2.0::types.Type
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build ILight.hal
+#
+GEN := $(intermediates)/android/hardware/light/2.0/ILight.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ILight.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.light@2.0::ILight
+
+$(GEN): $(LOCAL_PATH)/ILight.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.light@2.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 (Brightness)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Brightness.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.light@2.0::types.Brightness
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Flash)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Flash.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.light@2.0::types.Flash
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (LightState)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/LightState.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.light@2.0::types.LightState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/light/2.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.light@2.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Type)
+#
+GEN := $(intermediates)/android/hardware/light/2.0/Type.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.light@2.0::types.Type
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build ILight.hal
+#
+GEN := $(intermediates)/android/hardware/light/2.0/ILight.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ILight.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.light@2.0::ILight
+
+$(GEN): $(LOCAL_PATH)/ILight.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/light/2.0/ILight.hal b/light/2.0/ILight.hal
new file mode 100644
index 0000000..a7cd684
--- /dev/null
+++ b/light/2.0/ILight.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.light@2.0;
+
+interface ILight {
+
+ /**
+ * Set the provided lights to the provided values.
+ *
+ * @param type logical light to set
+ * @param state describes what the light should look like.
+ * @return status result of applying state transformation.
+ */
+ setLight(Type type, LightState state) generates (Status status);
+
+ /**
+ * Discover what indicator lights are available.
+ *
+ * @return types list of available lights
+ */
+ getSupportedTypes() generates (vec<Type> types);
+
+};
diff --git a/light/2.0/default/Android.mk b/light/2.0/default/Android.mk
new file mode 100644
index 0000000..61f4cc9
--- /dev/null
+++ b/light/2.0/default/Android.mk
@@ -0,0 +1,43 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.light@2.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ Light.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libhidl \
+ libhwbinder \
+ libutils \
+ liblog \
+ libcutils \
+ libhardware \
+ libbase \
+ libcutils \
+ android.hardware.light@2.0 \
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.light@2.0-service
+LOCAL_INIT_RC := android.hardware.light@2.0-service.rc
+LOCAL_SRC_FILES := \
+ service.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libhardware_legacy \
+ libhardware \
+
+LOCAL_SHARED_LIBRARIES += \
+ libhwbinder \
+ libhidl \
+ android.hardware.light@2.0 \
+
+include $(BUILD_EXECUTABLE)
diff --git a/light/2.0/default/Light.cpp b/light/2.0/default/Light.cpp
new file mode 100644
index 0000000..fe94e91
--- /dev/null
+++ b/light/2.0/default/Light.cpp
@@ -0,0 +1,140 @@
+#include "Light.h"
+
+namespace android {
+namespace hardware {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+static_assert(LIGHT_FLASH_NONE == static_cast<int>(Flash::NONE),
+ "Flash::NONE must match legacy value.");
+static_assert(LIGHT_FLASH_TIMED == static_cast<int>(Flash::TIMED),
+ "Flash::TIMED must match legacy value.");
+static_assert(LIGHT_FLASH_HARDWARE == static_cast<int>(Flash::HARDWARE),
+ "Flash::HARDWARE must match legacy value.");
+
+static_assert(BRIGHTNESS_MODE_USER == static_cast<int>(Brightness::USER),
+ "Brightness::USER must match legacy value.");
+static_assert(BRIGHTNESS_MODE_SENSOR == static_cast<int>(Brightness::SENSOR),
+ "Brightness::SENSOR must match legacy value.");
+static_assert(BRIGHTNESS_MODE_LOW_PERSISTENCE ==
+ static_cast<int>(Brightness::LOW_PERSISTENCE),
+ "Brightness::LOW_PERSISTENCE must match legacy value.");
+
+Light::Light(std::map<Type, light_device_t*> &&lights)
+ : mLights(std::move(lights)) {}
+
+// Methods from ::android::hardware::light::V2_0::ILight follow.
+Return<Status> Light::setLight(Type type, const LightState& state) {
+ auto it = mLights.find(type);
+
+ if (it == mLights.end()) {
+ return Status::LIGHT_NOT_SUPPORTED;
+ }
+
+ light_device_t* hwLight = it->second;
+
+ light_state_t legacyState {
+ .color = state.color,
+ .flashMode = static_cast<int>(state.flashMode),
+ .flashOnMS = state.flashOnMs,
+ .flashOffMS = state.flashOffMs,
+ .brightnessMode = static_cast<int>(state.brightnessMode),
+ };
+
+ int ret = hwLight->set_light(hwLight, &legacyState);
+
+ switch (ret) {
+ case -ENOSYS:
+ return Status::BRIGHTNESS_NOT_SUPPORTED;
+ case 0:
+ return Status::SUCCESS;
+ default:
+ return Status::UNKNOWN;
+ }
+}
+
+Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) {
+ Type *types = new Type[mLights.size()];
+
+ int idx = 0;
+ for(auto const &pair : mLights) {
+ Type type = pair.first;
+
+ types[idx++] = type;
+ }
+
+ {
+ hidl_vec<Type> hidl_types{};
+ hidl_types.setToExternal(types, mLights.size());
+
+ _hidl_cb(hidl_types);
+ }
+
+ delete[] types;
+
+ return Void();
+}
+
+const static std::map<Type, const char*> kLogicalLights = {
+ {Type::BACKLIGHT, LIGHT_ID_BACKLIGHT},
+ {Type::KEYBOARD, LIGHT_ID_KEYBOARD},
+ {Type::BUTTONS, LIGHT_ID_BUTTONS},
+ {Type::BATTERY, LIGHT_ID_BATTERY},
+ {Type::NOTIFICATIONS, LIGHT_ID_NOTIFICATIONS},
+ {Type::ATTENTION, LIGHT_ID_ATTENTION},
+ {Type::BLUETOOTH, LIGHT_ID_BLUETOOTH},
+ {Type::WIFI, LIGHT_ID_WIFI}
+};
+
+light_device_t* getLightDevice(const char* name) {
+ light_device_t* lightDevice;
+ const hw_module_t* hwModule = NULL;
+
+ int ret = hw_get_module (LIGHTS_HARDWARE_MODULE_ID, &hwModule);
+ if (ret == 0) {
+ ret = hwModule->methods->open(hwModule, name,
+ reinterpret_cast<hw_device_t**>(&lightDevice));
+ if (ret != 0) {
+ ALOGE("light_open %s %s failed: %d", LIGHTS_HARDWARE_MODULE_ID, name, ret);
+ }
+ } else {
+ ALOGE("hw_get_module %s %s failed: %d", LIGHTS_HARDWARE_MODULE_ID, name, ret);
+ }
+
+ if (ret == 0) {
+ return lightDevice;
+ } else {
+ ALOGE("Light passthrough failed to load legacy HAL.");
+ return nullptr;
+ }
+}
+
+ILight* HIDL_FETCH_ILight(const char* /* name */) {
+ std::map<Type, light_device_t*> lights;
+
+ for(auto const &pair : kLogicalLights) {
+ Type type = pair.first;
+ const char* name = pair.second;
+
+ light_device_t* light = getLightDevice(name);
+
+ if (light != nullptr) {
+ lights[type] = light;
+ }
+ }
+
+ if (lights.size() == 0) {
+ // Log information, but still return new Light.
+ // Some devices may not have any lights.
+ ALOGI("Could not open any lights.");
+ }
+
+ return new Light(std::move(lights));
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace light
+} // namespace hardware
+} // namespace android
diff --git a/light/2.0/default/Light.h b/light/2.0/default/Light.h
new file mode 100644
index 0000000..b32a09a
--- /dev/null
+++ b/light/2.0/default/Light.h
@@ -0,0 +1,46 @@
+#ifndef HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
+#define HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
+
+#include <android/hardware/light/2.0/ILight.h>
+#include <hardware/hardware.h>
+#include <hardware/lights.h>
+#include <hidl/Status.h>
+#include <hidl/MQDescriptor.h>
+#include <map>
+
+namespace android {
+namespace hardware {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::light::V2_0::ILight;
+using ::android::hardware::light::V2_0::LightState;
+using ::android::hardware::light::V2_0::Status;
+using ::android::hardware::light::V2_0::Type;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Light : public ILight {
+ Light(std::map<Type, light_device_t*> &&lights);
+
+ // Methods from ::android::hardware::light::V2_0::ILight follow.
+ Return<Status> setLight(Type type, const LightState& state) override;
+ Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
+
+private:
+ std::map<Type, light_device_t*> mLights;
+};
+
+extern "C" ILight* HIDL_FETCH_ILight(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace light
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
diff --git a/light/2.0/default/android.hardware.light@2.0-service.rc b/light/2.0/default/android.hardware.light@2.0-service.rc
new file mode 100644
index 0000000..4228d95
--- /dev/null
+++ b/light/2.0/default/android.hardware.light@2.0-service.rc
@@ -0,0 +1,4 @@
+service light-hal-2-0 /system/bin/hw/android.hardware.light@2.0-service
+ class hal
+ user system
+ group system readproc
\ No newline at end of file
diff --git a/light/2.0/default/service.cpp b/light/2.0/default/service.cpp
new file mode 100644
index 0000000..582d224
--- /dev/null
+++ b/light/2.0/default/service.cpp
@@ -0,0 +1,46 @@
+#define LOG_TAG "android.hardware.light@2.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/light/2.0/ILight.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+// libhwbinder:
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+// Generated HIDL files
+using android::hardware::light::V2_0::ILight;
+
+int main() {
+ ALOGI("Service is starting.");
+ const char instance[] = "light";
+ ALOGI("Retrieving default implementation of instance %s.",
+ instance);
+
+ android::sp<ILight> service = ILight::getService(instance, true);
+
+ if (service.get() == nullptr) {
+ ALOGE("ILight::getService returned NULL, exiting");
+ return -1;
+ }
+
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+
+ ALOGI("Registering instance %s.", instance);
+ service->registerAsService(instance);
+ ALOGI("Ready.");
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/light/2.0/types.hal b/light/2.0/types.hal
new file mode 100644
index 0000000..f065ce0
--- /dev/null
+++ b/light/2.0/types.hal
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.light@2.0;
+
+enum Status : int32_t {
+ SUCCESS,
+ LIGHT_NOT_SUPPORTED,
+ BRIGHTNESS_NOT_SUPPORTED,
+ UNKNOWN,
+};
+
+enum Flash : int32_t {
+ /*
+ * Keep the light steady on or off.
+ */
+ NONE,
+
+ /*
+ * Flash the light at specified rate.
+ */
+ TIMED,
+
+ /*
+ * Flash the light using hardware assist.
+ */
+ HARDWARE,
+};
+
+enum Brightness : int32_t {
+ /**
+ * Light brightness is managed by a user setting.
+ */
+ USER,
+
+ /**
+ * Light brightness is managed by a light sensor.
+ */
+ SENSOR,
+
+ /**
+ * Use a low-persistence mode for display backlights.
+ *
+ * When set, the device driver must switch to a mode optimized for low display
+ * persistence that is intended to be used when the device is being treated as a
+ * head mounted display (HMD). The actual display brightness in this mode is
+ * implementation dependent, and any value set for color in light_state may be
+ * overridden by the HAL implementation.
+ *
+ * For an optimal HMD viewing experience, the display must meet the following
+ * criteria in this mode:
+ * - Gray-to-Gray, White-to-Black, and Black-to-White switching time must be ≤ 3 ms.
+ * - The display must support low-persistence with ≤ 3.5 ms persistence.
+ * Persistence is defined as the amount of time for which a pixel is
+ * emitting light for a single frame.
+ * - Any "smart panel" or other frame buffering options that increase display
+ * latency are disabled.
+ * - Display brightness is set so that the display is still visible to the user
+ * under normal indoor lighting.
+ * - The display must update at 60 Hz at least, but higher refresh rates are
+ * recommended for low latency.
+ *
+ */
+ LOW_PERSISTENCE,
+};
+
+/*
+ * These light IDs correspond to logical lights, not physical.
+ * So for example, if your INDICATOR light is in line with your
+ * BUTTONS, it might make sense to also light the INDICATOR
+ * light to a reasonable color when the BUTTONS are lit.
+ */
+enum Type : int32_t {
+ BACKLIGHT,
+ KEYBOARD,
+ BUTTONS,
+ BATTERY,
+ NOTIFICATIONS,
+ ATTENTION,
+ BLUETOOTH,
+ WIFI,
+
+ COUNT,
+};
+
+/**
+ * The parameters that can be set for a given light.
+ *
+ * Not all lights must support all parameters. If you
+ * can do something backward-compatible, do it.
+ */
+struct LightState {
+ /**
+ * The color of the LED in ARGB.
+ *
+ * Do your best here.
+ * - If your light can only do red or green, if they ask for blue,
+ * you should do green.
+ * - If you can only do a brightness ramp, then use this formula:
+ * unsigned char brightness = ((77*((color>>16)&0x00ff))
+ * + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8;
+ * - If you can only do on or off, 0 is off, anything else is on.
+ *
+ * The high byte should be ignored. Callers will set it to 0xff (which
+ * would correspond to 255 alpha).
+ */
+ uint32_t color;
+
+ /**
+ * To flash the light at a given rate, set flashMode to LIGHT_FLASH_TIMED,
+ * and then flashOnMS should be set to the number of milliseconds to turn
+ * the light on, followed by the number of milliseconds to turn the light
+ * off.
+ */
+ Flash flashMode;
+
+ int32_t flashOnMs;
+ int32_t flashOffMs;
+
+ Brightness brightnessMode;
+};
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..50d2318
--- /dev/null
+++ b/memtrack/1.0/default/Android.bp
@@ -0,0 +1,49 @@
+// 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",
+ init_rc: ["android.hardware.memtrack@1.0-service.rc"],
+ 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/android.hardware.memtrack@1.0-service.rc b/memtrack/1.0/default/android.hardware.memtrack@1.0-service.rc
new file mode 100644
index 0000000..14e7d00
--- /dev/null
+++ b/memtrack/1.0/default/android.hardware.memtrack@1.0-service.rc
@@ -0,0 +1,4 @@
+service memtrack-hal-1-0 /system/bin/hw/android.hardware.memtrack@1.0-service
+ class hal
+ user system
+ group system
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/Android.mk b/nfc/1.0/Android.mk
index b6840bc..07775e9 100644
--- a/nfc/1.0/Android.mk
+++ b/nfc/1.0/Android.mk
@@ -13,9 +13,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
-# Build types.hal (nfc_data_t)
+# Build types.hal (NfcEvent)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_data_t.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/NfcEvent.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -23,16 +23,16 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.nfc_data_t
+ android.hardware.nfc@1.0::types.NfcEvent
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (nfc_event_t)
+# Build types.hal (NfcStatus)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_event_t.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/NfcStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -40,24 +40,7 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.nfc_event_t
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (nfc_status_t)
-#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_status_t.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.nfc@1.0::types.nfc_status_t
+ android.hardware.nfc@1.0::types.NfcStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
@@ -116,9 +99,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
-# Build types.hal (nfc_data_t)
+# Build types.hal (NfcEvent)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_data_t.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/NfcEvent.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -126,16 +109,16 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.nfc_data_t
+ android.hardware.nfc@1.0::types.NfcEvent
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (nfc_event_t)
+# Build types.hal (NfcStatus)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_event_t.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/NfcStatus.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -143,24 +126,7 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.nfc_event_t
-
-$(GEN): $(LOCAL_PATH)/types.hal
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-
-#
-# Build types.hal (nfc_status_t)
-#
-GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_status_t.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.nfc@1.0::types.nfc_status_t
+ android.hardware.nfc@1.0::types.NfcStatus
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
diff --git a/nfc/1.0/INfc.hal b/nfc/1.0/INfc.hal
index 88fd39a..f003b2c 100644
--- a/nfc/1.0/INfc.hal
+++ b/nfc/1.0/INfc.hal
@@ -27,7 +27,7 @@
* NCI initialization - ie accept CORE_RESET and subsequent commands through
* the write() call.
*
- * If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT
+ * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT
* before continuing.
*
* If open() returns any other value, the NCI stack will stop.
@@ -41,32 +41,32 @@
* This method may queue writes and return immediately. The only
* requirement is that the writes are executed in order.
*/
- write(nfc_data_t data) generates (int32_t retval);
+ write(NfcData data) generates (int32_t retval);
/*
- * core_initialized() is called after the CORE_INIT_RSP is received from the NFCC.
+ * coreInitialized() is called after the CORE_INIT_RSP is received from the NFCC.
* At this time, the HAL can do any chip-specific configuration.
*
- * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
+ * If coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT
* before continuing.
*
- * If core_initialized() returns any other value, the NCI stack will continue
+ * If coreInitialized() returns any other value, the NCI stack will continue
* immediately.
*/
- core_initialized(vec<uint8_t> data) generates (int32_t retval);
+ coreInitialized(NfcData data) generates (int32_t retval);
/*
- * pre_discover is called every time before starting RF discovery.
+ * prediscover is called every time before starting RF discovery.
* It is a good place to do vendor-specific configuration that must be
* performed every time RF discovery is about to be started.
*
- * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
+ * If prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT
* before continuing.
*
- * If pre_discover() returns any other value, the NCI stack will start
+ * If prediscover() returns any other value, the NCI stack will start
* RF discovery immediately.
*/
- pre_discover() generates (int32_t retval);
+ prediscover() generates (int32_t retval);
/*
* Close the NFC controller. Should free all resources.
@@ -75,15 +75,15 @@
/*
* Grant HAL the exclusive control to send NCI commands.
- * Called in response to HAL_REQUEST_CONTROL_EVT.
+ * Called in response to NfcEvent.REQUEST_CONTROL.
* Must only be called when there are no NCI commands pending.
- * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
+ * NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
*/
- control_granted() generates (int32_t retval);
+ controlGranted() generates (int32_t retval);
/*
* Restart controller by power cyle;
- * HAL_OPEN_CPLT_EVT will notify when operation is complete.
+ * NfcEvent.OPEN_CPLT will notify when operation is complete.
*/
- power_cycle() generates (int32_t retval);
+ powerCycle() generates (int32_t retval);
};
diff --git a/nfc/1.0/INfcClientCallback.hal b/nfc/1.0/INfcClientCallback.hal
index f10062e..a56cc09 100644
--- a/nfc/1.0/INfcClientCallback.hal
+++ b/nfc/1.0/INfcClientCallback.hal
@@ -21,11 +21,11 @@
* The callback passed in from the NFC stack that the HAL
* can use to pass events back to the stack.
*/
- sendEvent(nfc_event_t event, nfc_status_t event_status);
+ sendEvent(NfcEvent event, NfcStatus status);
/*
* The callback passed in from the NFC stack that the HAL
* can use to pass incomming data to the stack.
*/
- sendData(nfc_data_t data);
+ sendData(NfcData data);
};
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index b836ada..d3868c1 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -19,19 +19,19 @@
// Methods from ::android::hardware::nfc::V1_0::INfc follow.
::android::hardware::Return<int32_t> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
mCallback = clientCallback;
- return mDevice->open(mDevice, event_callback, data_callback);
+ return mDevice->open(mDevice, eventCallback, dataCallback);
}
-::android::hardware::Return<int32_t> Nfc::write(const nfc_data_t& data) {
- return mDevice->write(mDevice, data.data.size(), &data.data[0]);
+::android::hardware::Return<int32_t> Nfc::write(const hidl_vec<uint8_t>& data) {
+ return mDevice->write(mDevice, data.size(), &data[0]);
}
-::android::hardware::Return<int32_t> Nfc::core_initialized(const hidl_vec<uint8_t>& data) {
+::android::hardware::Return<int32_t> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
hidl_vec<uint8_t> copy = data;
return mDevice->core_initialized(mDevice, ©[0]);
}
-::android::hardware::Return<int32_t> Nfc::pre_discover() {
+::android::hardware::Return<int32_t> Nfc::prediscover() {
return mDevice->pre_discover(mDevice);
}
@@ -39,11 +39,11 @@
return mDevice->close(mDevice);
}
-::android::hardware::Return<int32_t> Nfc::control_granted() {
+::android::hardware::Return<int32_t> Nfc::controlGranted() {
return mDevice->control_granted(mDevice);
}
-::android::hardware::Return<int32_t> Nfc::power_cycle() {
+::android::hardware::Return<int32_t> Nfc::powerCycle() {
return mDevice->power_cycle(mDevice);
}
diff --git a/nfc/1.0/default/Nfc.h b/nfc/1.0/default/Nfc.h
index 98cd57e..e596495 100644
--- a/nfc/1.0/default/Nfc.h
+++ b/nfc/1.0/default/Nfc.h
@@ -13,7 +13,6 @@
using ::android::hardware::nfc::V1_0::INfc;
using ::android::hardware::nfc::V1_0::INfcClientCallback;
-using ::android::hardware::nfc::V1_0::nfc_data_t;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -23,23 +22,23 @@
struct Nfc : public INfc {
Nfc(nfc_nci_device_t* device);
::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override;
- ::android::hardware::Return<int32_t> write(const nfc_data_t& data) override;
- ::android::hardware::Return<int32_t> core_initialized(const hidl_vec<uint8_t>& data) override;
- ::android::hardware::Return<int32_t> pre_discover() override;
+ ::android::hardware::Return<int32_t> write(const hidl_vec<uint8_t>& data) override;
+ ::android::hardware::Return<int32_t> coreInitialized(const hidl_vec<uint8_t>& data) override;
+ ::android::hardware::Return<int32_t> prediscover() override;
::android::hardware::Return<int32_t> close() override;
- ::android::hardware::Return<int32_t> control_granted() override;
- ::android::hardware::Return<int32_t> power_cycle() override;
+ ::android::hardware::Return<int32_t> controlGranted() override;
+ ::android::hardware::Return<int32_t> powerCycle() override;
- static void event_callback(uint8_t event, uint8_t status) {
+ static void eventCallback(uint8_t event, uint8_t status) {
if (mCallback != nullptr) {
mCallback->sendEvent(
- (::android::hardware::nfc::V1_0::nfc_event_t) event,
- (::android::hardware::nfc::V1_0::nfc_status_t) status);
+ (::android::hardware::nfc::V1_0::NfcEvent) event,
+ (::android::hardware::nfc::V1_0::NfcStatus) status);
}
}
- static void data_callback(uint16_t data_len, uint8_t* p_data) {
- nfc_data_t data;
- data.data.setToExternal(p_data, data_len);
+ static void dataCallback(uint16_t data_len, uint8_t* p_data) {
+ hidl_vec<uint8_t> data;
+ data.setToExternal(p_data, data_len);
if (mCallback != nullptr) {
mCallback->sendData(data);
}
diff --git a/nfc/1.0/types.hal b/nfc/1.0/types.hal
index 738dfd9..a266178 100644
--- a/nfc/1.0/types.hal
+++ b/nfc/1.0/types.hal
@@ -16,24 +16,22 @@
package android.hardware.nfc@1.0;
-enum nfc_event_t : uint32_t {
- HAL_NFC_OPEN_CPLT_EVT = 0,
- HAL_NFC_CLOSE_CPLT_EVT = 1,
- HAL_NFC_POST_INIT_CPLT_EVT = 2,
- HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3,
- HAL_NFC_REQUEST_CONTROL_EVT = 4,
- HAL_NFC_RELEASE_CONTROL_EVT = 5,
- HAL_NFC_ERROR_EVT = 6
+enum NfcEvent : uint32_t {
+ OPEN_CPLT = 0,
+ CLOSE_CPLT = 1,
+ POST_INIT_CPLT = 2,
+ PRE_DISCOVER_CPLT = 3,
+ REQUEST_CONTROL = 4,
+ RELEASE_CONTROL = 5,
+ ERROR = 6
};
-enum nfc_status_t : uint32_t {
- HAL_NFC_STATUS_OK = 0,
- HAL_NFC_STATUS_FAILED = 1,
- HAL_NFC_STATUS_ERR_TRANSPORT = 2,
- HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3,
- HAL_NFC_STATUS_REFUSED = 4
+enum NfcStatus : uint32_t {
+ OK = 0,
+ FAILED = 1,
+ ERR_TRANSPORT = 2,
+ ERR_CMD_TIMEOUT = 3,
+ REFUSED = 4
};
-struct nfc_data_t {
- vec<uint8_t> data;
-};
+typedef vec<uint8_t> NfcData;
diff --git a/nfc/1.0/vts/Android.mk b/nfc/1.0/vts/Android.mk
index 15084fc..6f63e03 100644
--- a/nfc/1.0/vts/Android.mk
+++ b/nfc/1.0/vts/Android.mk
@@ -16,6 +16,45 @@
LOCAL_PATH := $(call my-dir)
+# build VTS driver for Nfc v1.0.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libvts_driver_hidl_nfc@1.0
+
+LOCAL_SRC_FILES := \
+ Nfc.vts \
+ NfcClientCallback.vts \
+ types.vts \
+
+LOCAL_C_INCLUDES := \
+ android.hardware.nfc@1.0 \
+ system/core/base/include \
+ system/core/include \
+
+LOCAL_SHARED_LIBRARIES += \
+ android.hardware.nfc@1.0 \
+ libbase \
+ libutils \
+ libcutils \
+ liblog \
+ libhidl \
+ libhwbinder \
+ libprotobuf-cpp-full \
+ libvts_common \
+ libvts_datatype \
+ libvts_measurement \
+ libvts_multidevice_proto \
+
+LOCAL_CFLAGS += -DENABLE_TREBLE
+
+LOCAL_STATIC_LIBRARIES := \
+
+LOCAL_PROTOC_OPTIMIZE_TYPE := full
+
+LOCAL_MULTILIB := both
+
+include $(BUILD_SHARED_LIBRARY)
+
# build profiler for Nfc.
include $(CLEAR_VARS)
diff --git a/nfc/1.0/vts/types.vts b/nfc/1.0/vts/types.vts
index 8e4f93b..969a8af 100644
--- a/nfc/1.0/vts/types.vts
+++ b/nfc/1.0/vts/types.vts
@@ -4,7 +4,6 @@
package: "android.hardware.nfc"
-
attribute: {
name: "NfcEvent"
type: TYPE_ENUM
diff --git a/power/1.0/Android.bp b/power/1.0/Android.bp
new file mode 100644
index 0000000..9b4d81e
--- /dev/null
+++ b/power/1.0/Android.bp
@@ -0,0 +1,46 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.power@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ srcs: [
+ "types.hal",
+ "IPower.hal",
+ ],
+ out: [
+ "android/hardware/power/1.0/types.cpp",
+ "android/hardware/power/1.0/PowerAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.power@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.power@1.0",
+ srcs: [
+ "types.hal",
+ "IPower.hal",
+ ],
+ out: [
+ "android/hardware/power/1.0/types.h",
+ "android/hardware/power/1.0/IPower.h",
+ "android/hardware/power/1.0/IHwPower.h",
+ "android/hardware/power/1.0/BnPower.h",
+ "android/hardware/power/1.0/BpPower.h",
+ "android/hardware/power/1.0/BsPower.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.power@1.0",
+ generated_sources: ["android.hardware.power@1.0_genc++"],
+ generated_headers: ["android.hardware.power@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.power@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/power/1.0/Android.mk b/power/1.0/Android.mk
new file mode 100644
index 0000000..5f1260b
--- /dev/null
+++ b/power/1.0/Android.mk
@@ -0,0 +1,238 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.power@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 (Feature)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Feature.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.power@1.0::types.Feature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerHint)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerHint.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.power@1.0::types.PowerHint
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStatePlatformSleepState)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStatePlatformSleepState.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.power@1.0::types.PowerStatePlatformSleepState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStateVoter)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStateVoter.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.power@1.0::types.PowerStateVoter
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/power/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.power@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IPower.hal
+#
+GEN := $(intermediates)/android/hardware/power/1.0/IPower.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IPower.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.power@1.0::IPower
+
+$(GEN): $(LOCAL_PATH)/IPower.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.power@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 (Feature)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/Feature.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.power@1.0::types.Feature
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerHint)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerHint.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.power@1.0::types.PowerHint
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStatePlatformSleepState)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStatePlatformSleepState.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.power@1.0::types.PowerStatePlatformSleepState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (PowerStateVoter)
+#
+GEN := $(intermediates)/android/hardware/power/1.0/PowerStateVoter.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.power@1.0::types.PowerStateVoter
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (Status)
+#
+GEN := $(intermediates)/android/hardware/power/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.power@1.0::types.Status
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IPower.hal
+#
+GEN := $(intermediates)/android/hardware/power/1.0/IPower.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IPower.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.power@1.0::IPower
+
+$(GEN): $(LOCAL_PATH)/IPower.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/power/1.0/IPower.hal b/power/1.0/IPower.hal
new file mode 100644
index 0000000..6cba42a
--- /dev/null
+++ b/power/1.0/IPower.hal
@@ -0,0 +1,89 @@
+/*
+ * 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.power@1.0;
+
+/*
+ * Constructor for the interface performs power management setup actions at
+ * runtime startup, such as to set default cpufreq parameters.
+ */
+interface IPower {
+ /*
+ * setInteractive() performs power management actions upon the
+ * system entering interactive state (that is, the system is awake
+ * and ready for interaction, often with UI devices such as
+ * display and touchscreen enabled) or non-interactive state (the
+ * system appears asleep, display usually turned off). The
+ * non-interactive state may be entered after a period of
+ * inactivity in order to conserve battery power during
+ * such inactive periods.
+ *
+ * Typical actions are to turn on or off devices and adjust
+ * cpufreq parameters. This function may also call the
+ * appropriate interfaces to allow the kernel to suspend the
+ * system to low-power sleep state when entering non-interactive
+ * state, and to disallow low-power suspend when the system is in
+ * interactive state. When low-power suspend state is allowed, the
+ * kernel may suspend the system whenever no wakelocks are held.
+ *
+ * For example,
+ * This function can be called to enter non-interactive state after
+ * turning off the screen (if present) and called to enter
+ * interactive state prior to turning on the screen.
+ *
+ * @param interactive is true when the system is transitioning to an
+ * interactive state and false when transitioning to a
+ * non-interactive state.
+ */
+ setInteractive(bool interactive);
+
+ /*
+ * powerHint() is called to pass hints on power requirements which
+ * may result in adjustment of power/performance parameters of the
+ * cpufreq governor and other controls.
+ *
+ * A particular platform may choose to ignore any hint.
+ *
+ * @param hint PowerHint which is passed
+ * @param data contains additional information about the hint
+ * and is described along with the comments for each of the hints.
+ */
+ powerHint(PowerHint hint, int32_t data);
+
+ /*
+ * setFeature() is called to turn on or off a particular feature
+ * depending on the state parameter.
+ *
+ * @param feature Feature which needs to be set
+ * @param activate true/false to enable/disable the feature
+ */
+ setFeature(Feature feature, bool activate);
+
+ /*
+ * Platform-level sleep state stats:
+ * Report cumulative info on the statistics on platform-level sleep states
+ * since boot.
+ *
+ * Higher the index in the returned <states> vector deeper the state is
+ * i.e. lesser steady-state power is consumed by the platform to be
+ * resident in that state.
+ *
+ * @return states of power states the device supports
+ * @return retval SUCCESS on success or FILESYSTEM_ERROR on filesystem
+ * nodes access error.
+ */
+ getPlatformLowPowerStats()
+ generates (vec<PowerStatePlatformSleepState> states, Status retval);
+};
diff --git a/power/1.0/default/Android.bp b/power/1.0/default/Android.bp
new file mode 100644
index 0000000..4c31c6f
--- /dev/null
+++ b/power/1.0/default/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_library_shared {
+ name: "android.hardware.power@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Power.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "android.hardware.power@1.0",
+ ],
+
+}
+
+cc_binary {
+ relative_install_path: "hw",
+ name: "android.hardware.power@1.0-service",
+ srcs: ["service.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libdl",
+ "libutils",
+ "libhardware",
+ "libhidl",
+ "libhwbinder",
+ "android.hardware.power@1.0",
+ ],
+
+}
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
new file mode 100644
index 0000000..5d0593b
--- /dev/null
+++ b/power/1.0/default/Power.cpp
@@ -0,0 +1,159 @@
+/*
+ * 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.power@1.0-impl"
+#include <hardware/hardware.h>
+#include <hardware/power.h>
+#include "Power.h"
+
+namespace android {
+namespace hardware {
+namespace power {
+namespace V1_0 {
+namespace implementation {
+
+Power::Power(power_module_t *module) : mModule(module) {
+ if (mModule)
+ mModule->init(mModule);
+}
+
+Power::~Power() {
+ delete(mModule);
+}
+
+// Methods from ::android::hardware::power::V1_0::IPower follow.
+Return<void> Power::setInteractive(bool interactive) {
+ if (mModule->setInteractive > 0)
+ mModule->setInteractive(mModule, interactive ? 1 : 0);
+ return Void();
+}
+
+Return<void> Power::powerHint(PowerHint hint, int32_t data) {
+ int32_t param = data;
+ if (mModule->powerHint > 0)
+ mModule->powerHint(mModule, static_cast<power_hint_t>(hint), ¶m);
+ return Void();
+}
+
+Return<void> Power::setFeature(Feature feature, bool activate) {
+ if (mModule->setFeature > 0)
+ mModule->setFeature(mModule, static_cast<feature_t>(feature),
+ activate ? 1 : 0);
+ return Void();
+}
+
+Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
+ hidl_vec<PowerStatePlatformSleepState> states;
+ ssize_t number_platform_modes;
+ size_t *voters = nullptr;
+ power_state_platform_sleep_state_t *legacy_states = nullptr;
+ int ret;
+
+ if (mModule->get_number_of_platform_modes == nullptr ||
+ mModule->get_voter_list == nullptr ||
+ mModule->get_platform_low_power_stats == nullptr)
+ {
+ _hidl_cb(states, Status::SUCCESS);
+ return Void();
+ }
+
+ number_platform_modes = mModule->get_number_of_platform_modes(mModule);
+ if (number_platform_modes > 0)
+ {
+ voters = new size_t [number_platform_modes];
+ if (voters == nullptr)
+ goto done;
+
+ ret = mModule->get_voter_list(mModule, voters);
+ if (ret != 0)
+ goto done;
+
+ legacy_states = new power_state_platform_sleep_state_t [number_platform_modes];
+ if (legacy_states == nullptr)
+ goto done;
+
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ legacy_states[i].voters = nullptr;
+ legacy_states[i].voters = new power_state_voter_t [voters[i]];
+ if (legacy_states[i].voters == nullptr)
+ goto done;
+ }
+
+ ret = mModule->get_platform_low_power_stats(mModule, legacy_states);
+ if (ret != 0)
+ goto done;
+
+ states.resize(number_platform_modes);
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ power_state_platform_sleep_state_t& legacy_state = legacy_states[i];
+ PowerStatePlatformSleepState& state = states[i];
+ state.name = legacy_state.name;
+ state.residencyInMsecSinceBoot = legacy_state.residency_in_msec_since_boot;
+ state.totalTransitions = legacy_state.total_transitions;
+ state.supportedOnlyInSuspend = legacy_state.supported_only_in_suspend;
+ state.voters.resize(voters[i]);
+ for(size_t j = 0; j < voters[i]; j++)
+ {
+ state.voters[j].name = legacy_state.voters[j].name;
+ state.voters[j].totalTimeInMsecVotedForSinceBoot = legacy_state.voters[j].total_time_in_msec_voted_for_since_boot;
+ state.voters[j].totalNumberOfTimesVotedSinceBoot = legacy_state.voters[j].total_number_of_times_voted_since_boot;
+ }
+ }
+ }
+done:
+ if (legacy_states)
+ {
+ for (int i = 0; i < number_platform_modes; i++)
+ {
+ if(legacy_states[i].voters)
+ delete(legacy_states[i].voters);
+ }
+ }
+ delete[] legacy_states;
+ delete[] voters;
+ _hidl_cb(states, Status::SUCCESS);
+ return Void();
+}
+
+IPower* HIDL_FETCH_IPower(const char* name) {
+ int ret = 0;
+ const hw_module_t* hw_module = NULL;
+ power_module_t *power_module;
+ 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**>(&power_module));
+ if (ret == 0) {
+ return new Power(power_module);
+ }
+ else {
+ ALOGE("Passthrough failed to load legacy HAL.");
+ return nullptr;
+ }
+ }
+ else {
+ ALOGE ("hw_get_module %s failed: %d", name, ret);
+ return nullptr;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace power
+} // namespace hardware
+} // namespace android
diff --git a/power/1.0/default/Power.h b/power/1.0/default/Power.h
new file mode 100644
index 0000000..a0495be
--- /dev/null
+++ b/power/1.0/default/Power.h
@@ -0,0 +1,61 @@
+/*
+ * 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_power_V1_0_Power_H_
+#define HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
+
+#include <android/hardware/power/1.0/IPower.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace power {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::power::V1_0::Feature;
+using ::android::hardware::power::V1_0::IPower;
+using ::android::hardware::power::V1_0::PowerHint;
+using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
+using ::android::hardware::power::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 Power : public IPower {
+ Power(power_module_t* module);
+ ~Power();
+ Return<void> setInteractive(bool interactive) override;
+ Return<void> powerHint(PowerHint hint, int32_t data) override;
+ Return<void> setFeature(Feature feature, bool activate) override;
+ Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
+
+ private:
+ power_module_t* mModule;
+};
+
+extern "C" IPower* HIDL_FETCH_IPower(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace power
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
diff --git a/power/1.0/default/service.cpp b/power/1.0/default/service.cpp
new file mode 100644
index 0000000..bad1adf
--- /dev/null
+++ b/power/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.power@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/power/1.0/IPower.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::power::V1_0::IPower;
+
+int main() {
+ const char instance[] = "power";
+ android::sp<IPower> service = IPower::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IPower::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/power/1.0/types.hal b/power/1.0/types.hal
new file mode 100644
index 0000000..c27242e
--- /dev/null
+++ b/power/1.0/types.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.power@1.0;
+
+/* Power hint identifiers passed to powerHint() */
+enum PowerHint : uint32_t {
+ /*
+ * Foreground app has started or stopped requesting a VSYNC pulse
+ * from SurfaceFlinger. If the app has started requesting VSYNC
+ * then CPU and GPU load is expected soon, and it may be appropriate
+ * to raise speeds of CPU, memory bus, etc. The data parameter is
+ * non-zero to indicate VSYNC pulse is now requested, or zero for
+ * VSYNC pulse no longer requested.
+ */
+ VSYNC = 0x00000001,
+
+
+ /*
+ * User is interacting with the device, for example, touchscreen
+ * events are incoming. CPU and GPU load may be expected soon,
+ * and it may be appropriate to raise speeds of CPU, memory bus,
+ * etc. The data parameter is the estimated length of the interaction
+ * in milliseconds, or 0 if unknown.
+ */
+ INTERACTION = 0x00000002,
+
+
+ /* DO NOT USE VIDEO_ENCODE/_DECODE! They will be removed in
+ * KLP.
+ */
+ VIDEO_ENCODE = 0x00000003,
+ VIDEO_DECODE = 0x00000004,
+
+ /*
+ * Low power mode is activated or deactivated. Low power mode
+ * is intended to save battery at the cost of performance. The data
+ * parameter is non-zero when low power mode is activated, and zero
+ * when deactivated.
+ */
+ LOW_POWER = 0x00000005,
+
+ /*
+ * Sustained Performance mode is actived or deactivated. Sustained
+ * performance mode is intended to provide a consistent level of
+ * performance for a prolonged amount of time. The data parameter is
+ * non-zero when sustained performance mode is activated, and zero
+ * when deactivated.
+ */
+ SUSTAINED_PERFORMANCE = 0x00000006,
+
+ /*
+ * VR Mode is activated or deactivated. VR mode is intended to
+ * provide minimum guarantee for performance for the amount of time the
+ * device can sustain it. The data parameter is non-zero when the mode
+ * is activated and zero when deactivated.
+ */
+ VR_MODE = 0x00000007,
+
+ /*
+ * This hint indicates that an application has been launched. Can be used
+ * for device specific optimizations during application launch. The data
+ * parameter is non-zero when the application starts to launch and zero when
+ * it has been launched.
+ */
+ LAUNCH = 0x00000008,
+
+ /*
+ * When device enters some special modes, e.g. theater mode in Android
+ * Wear, there is no touch interaction expected between device and user.
+ * Touch controller could be disabled in those modes to save power.
+ * The data parameter is non-zero when touch could be disabled, and zero
+ * when touch needs to be re-enabled.
+ */
+ DISABLE_TOUCH = 0x00000009
+};
+
+enum Feature : uint32_t {
+ /*
+ * Enabling/Disabling this feature will allow/disallow the system
+ * to wake up by tapping the screen twice.
+ */
+ POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 0x00000001
+};
+
+enum Status : uint32_t {
+ SUCCESS = 0,
+ FILESYSTEM_ERROR = 1
+};
+/*
+ * Platform-level sleep state stats:
+ * PowerStateVoter struct is useful for describing the individual voters
+ * when a Platform-level sleep state is chosen by aggregation of votes from
+ * multiple clients/system conditions.
+ *
+ * This helps in attirbuting what in the device is blocking the device from
+ * entering the lowest Platform-level sleep state.
+ */
+struct PowerStateVoter {
+ /*
+ * Name of the voter.
+ */
+ string name;
+
+ /*
+ * Total time in msec the voter voted for the platform sleep state since
+ * boot.
+ */
+ uint64_t totalTimeInMsecVotedForSinceBoot;
+
+ /*
+ * Number of times the voter voted for the platform sleep state since boot.
+ */
+ uint64_t totalNumberOfTimesVotedSinceBoot;
+};
+
+/*
+ * Platform-level sleep state stats:
+ * PowerStatePlatformSleepState represents the Platform-level sleep state
+ * the device is capable of getting into.
+ *
+ * SoCs usually have more than one Platform-level sleep state.
+ */
+struct PowerStatePlatformSleepState {
+ /*
+ * Platform-level Sleep state name.
+ */
+ string name;
+
+ /*
+ * Time spent in msec at this platform-level sleep state since boot.
+ */
+ uint64_t residencyInMsecSinceBoot;
+
+ /*
+ * Total number of times system entered this state.
+ */
+ uint64_t totalTransitions;
+
+ /*
+ * This platform-level sleep state can only be reached during system suspend
+ */
+ bool supportedOnlyInSuspend;
+
+ /*
+ * voters is useful if the Platform-level sleep state
+ * is chosen by aggregation votes from multiple clients/system conditions.
+ * All the voters have to say yes or all the system conditions need to be
+ * met to enter a platform-level sleep state.
+ *
+ * Vector of size zero implies either the info is not available
+ * or the system does not follow a voting mechanism to choose this
+ * Platform-level sleep state.
+ */
+ vec<PowerStateVoter> voters;
+};
diff --git a/soundtrigger/2.0/Android.bp b/soundtrigger/2.0/Android.bp
new file mode 100644
index 0000000..10a917b
--- /dev/null
+++ b/soundtrigger/2.0/Android.bp
@@ -0,0 +1,55 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.soundtrigger@2.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
+ srcs: [
+ "types.hal",
+ "ISoundTriggerHw.hal",
+ "ISoundTriggerHwCallback.hal",
+ ],
+ out: [
+ "android/hardware/soundtrigger/2.0/types.cpp",
+ "android/hardware/soundtrigger/2.0/SoundTriggerHwAll.cpp",
+ "android/hardware/soundtrigger/2.0/SoundTriggerHwCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.soundtrigger@2.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.soundtrigger@2.0",
+ srcs: [
+ "types.hal",
+ "ISoundTriggerHw.hal",
+ "ISoundTriggerHwCallback.hal",
+ ],
+ out: [
+ "android/hardware/soundtrigger/2.0/types.h",
+ "android/hardware/soundtrigger/2.0/ISoundTriggerHw.h",
+ "android/hardware/soundtrigger/2.0/IHwSoundTriggerHw.h",
+ "android/hardware/soundtrigger/2.0/BnSoundTriggerHw.h",
+ "android/hardware/soundtrigger/2.0/BpSoundTriggerHw.h",
+ "android/hardware/soundtrigger/2.0/BsSoundTriggerHw.h",
+ "android/hardware/soundtrigger/2.0/ISoundTriggerHwCallback.h",
+ "android/hardware/soundtrigger/2.0/IHwSoundTriggerHwCallback.h",
+ "android/hardware/soundtrigger/2.0/BnSoundTriggerHwCallback.h",
+ "android/hardware/soundtrigger/2.0/BpSoundTriggerHwCallback.h",
+ "android/hardware/soundtrigger/2.0/BsSoundTriggerHwCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.soundtrigger@2.0",
+ generated_sources: ["android.hardware.soundtrigger@2.0_genc++"],
+ generated_headers: ["android.hardware.soundtrigger@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.soundtrigger@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ "android.hardware.audio.common@2.0",
+ ],
+}
diff --git a/soundtrigger/2.0/ISoundTriggerHw.hal b/soundtrigger/2.0/ISoundTriggerHw.hal
new file mode 100644
index 0000000..a1be85d
--- /dev/null
+++ b/soundtrigger/2.0/ISoundTriggerHw.hal
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.soundtrigger@2.0;
+
+import android.hardware.audio.common@2.0;
+
+import ISoundTriggerHwCallback;
+
+interface ISoundTriggerHw {
+
+ /*
+ * Sound trigger implementation descriptor read by the framework via
+ * getProperties(). Used by SoundTrigger service to report to applications
+ * and manage concurrency and policy.
+ */
+ struct Properties {
+ /* Implementor name */
+ string implementor;
+ /* Implementation description */
+ string description;
+ /* Implementation version */
+ uint32_t version;
+ /* Unique implementation ID. The UUID must change with each version of
+ the engine implementation */
+ Uuid uuid;
+ /* Maximum number of concurrent sound models loaded */
+ uint32_t maxSoundModels;
+ /* Maximum number of key phrases */
+ uint32_t maxKeyPhrases;
+ /* Maximum number of concurrent users detected */
+ uint32_t maxUsers;
+ /* All supported modes. e.g RecognitionMode.VOICE_TRIGGER */
+ uint32_t recognitionModes;
+ /* Supports seamless transition from detection to capture */
+ bool captureTransition;
+ /* Maximum buffering capacity in ms if captureTransition is true */
+ uint32_t maxBufferMs;
+ /* Supports capture by other use cases while detection is active */
+ bool concurrentCapture;
+ /* Returns the trigger capture in event */
+ bool triggerInEvent;
+ /* Rated power consumption when detection is active with TDB
+ * silence/sound/speech ratio */
+ uint32_t powerConsumptionMw;
+ };
+
+
+ /*
+ * Base sound model descriptor. This struct is the header of a larger block
+ * passed to loadSoundModel() and contains the binary data of the
+ * sound model.
+ */
+ struct SoundModel {
+ /* Model type. e.g. SoundModelType.KEYPHRASE */
+ SoundModelType type;
+ /* Unique sound model ID. */
+ Uuid uuid;
+ /* Unique vendor ID. Identifies the engine the sound model
+ * was build for */
+ Uuid vendorUuid;
+ /* Opaque data transparent to Android framework */
+ vec<uint8_t> data;
+ };
+
+ /* Key phrase descriptor */
+ struct Phrase {
+ /* Unique keyphrase ID assigned at enrollment time */
+ uint32_t id;
+ /* Recognition modes supported by this key phrase */
+ uint32_t recognitionModes;
+ /* List of users IDs associated with this key phrase */
+ vec<uint32_t> users;
+ /* Locale - Java Locale style (e.g. en_US) */
+ string locale;
+ /* Phrase text in UTF-8 format. */
+ string text;
+ };
+
+ /*
+ * Specialized sound model for key phrase detection.
+ * Proprietary representation of key phrases in binary data must match
+ * information indicated by phrases field
+ */
+ struct PhraseSoundModel {
+ /* Common part of sound model descriptor */
+ SoundModel common;
+ /* List of descriptors for key phrases supported by this sound model */
+ vec<Phrase> phrases;
+ };
+
+ /*
+ * Configuration for sound trigger capture session passed to
+ * startRecognition() method
+ */
+ struct RecognitionConfig {
+ /* IO handle that will be used for capture. N/A if captureRequested
+ * is false */
+ AudioIoHandle captureHandle;
+ /* Input device requested for detection capture */
+ AudioDevice captureDevice;
+ /* Capture and buffer audio for this recognition instance */
+ bool captureRequested;
+ /* Configuration for each key phrase */
+ vec<PhraseRecognitionExtra> phrases;
+ /* Opaque capture configuration data transparent to the framework */
+ vec<uint8_t> data;
+ };
+
+
+ /*
+ * Retrieve implementation properties.
+ * @return retval Operation completion status: 0 in case of success,
+ * -ENODEV in case of initialization error.
+ * @return properties A Properties structure containing implementation
+ * description and capabilities.
+ */
+ getProperties() generates (int32_t retval, Properties properties);
+
+ /*
+ * Load a sound model. Once loaded, recognition of this model can be
+ * started and stopped. Only one active recognition per model at a time.
+ * The SoundTrigger service must handle concurrent recognition requests by
+ * different users/applications on the same model.
+ * The implementation returns a unique handle used by other functions
+ * (unloadSoundModel(), startRecognition(), etc...
+ * @param soundModel A SoundModel structure describing the sound model to
+ * load.
+ * @param callback The callback interface on which the soundmodelCallback()
+ * method will be called upon completion.
+ * @param cookie The value of the cookie argument passed to the completion
+ * callback. This unique context information is assigned and
+ * used only by the framework.
+ * @return retval Operation completion status: 0 in case of success,
+ * -EINVAL in case of invalid sound model (e.g 0 data size),
+ * -ENOSYS in case of invalid operation (e.g max number of
+ * models exceeded),
+ * -ENOMEM in case of memory allocation failure,
+ * -ENODEV in case of initialization error.
+ * @return modelHandle A unique handle assigned by the HAL for use by the
+ * framework when controlling activity for this sound model.
+ */
+ loadSoundModel(SoundModel soundModel,
+ ISoundTriggerHwCallback callback,
+ CallbackCookie cookie)
+ generates (int32_t retval, SoundModelHandle modelHandle);
+
+ /*
+ * Unload a sound model. A sound model may be unloaded to make room for a
+ * new one to overcome implementation limitations.
+ * @param modelHandle the handle of the sound model to unload
+ * @return retval Operation completion status: 0 in case of success,
+ * -ENOSYS if the model is not loaded,
+ * -ENODEV in case of initialization error.
+ */
+ unloadSoundModel(SoundModelHandle modelHandle)
+ generates (int32_t retval);
+
+ /*
+ * Start recognition on a given model. Only one recognition active
+ * at a time per model. Once recognition succeeds of fails, the callback
+ * is called.
+ * @param modelHandle the handle of the sound model to use for recognition
+ * @param config A RecognitionConfig structure containing attributes of the
+ * recognition to perform
+ * @param callback The callback interface on which the recognitionCallback()
+ * method must be called upon recognition.
+ * @param cookie The value of the cookie argument passed to the recognition
+ * callback. This unique context information is assigned and
+ * used only by the framework.
+ * @return retval Operation completion status: 0 in case of success,
+ * -EINVAL in case of invalid recognition attributes,
+ * -ENOSYS in case of invalid model handle,
+ * -ENOMEM in case of memory allocation failure,
+ * -ENODEV in case of initialization error.
+ */
+ startRecognition(SoundModelHandle modelHandle,
+ RecognitionConfig config,
+ ISoundTriggerHwCallback callback,
+ CallbackCookie cookie)
+ generates (int32_t retval);
+
+ /*
+ * Stop recognition on a given model.
+ * The implementation must not call the recognition callback when stopped
+ * via this method.
+ * @param modelHandle The handle of the sound model to use for recognition
+ * @return retval Operation completion status: 0 in case of success,
+ * -ENOSYS in case of invalid model handle,
+ * -ENODEV in case of initialization error.
+ */
+ stopRecognition(SoundModelHandle modelHandle)
+ generates (int32_t retval);
+
+ /*
+ * Stop recognition on all models.
+ * @return retval Operation completion status: 0 in case of success,
+ * -ENODEV in case of initialization error.
+ */
+ stopAllRecognitions()
+ generates (int32_t retval);
+};
diff --git a/soundtrigger/2.0/ISoundTriggerHwCallback.hal b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
new file mode 100644
index 0000000..294d451
--- /dev/null
+++ b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.soundtrigger@2.0;
+
+import android.hardware.audio.common@2.0;
+
+interface ISoundTriggerHwCallback {
+ enum RecognitionStatus : uint32_t {
+ SUCCESS = 0,
+ ABORT = 1,
+ FAILURE = 2,
+ };
+
+ enum SoundModelStatus : uint32_t {
+ UPDATED = 0,
+ };
+
+ /*
+ * Generic recognition event sent via recognition callback
+ */
+ struct RecognitionEvent {
+ /* Recognition status e.g. SUCCESS */
+ RecognitionStatus status;
+ /* Sound model type for this event. e.g SoundModelType.TYPE_KEYPHRASE */
+ SoundModelType type;
+ /* Handle of loaded sound model which triggered the event */
+ SoundModelHandle model;
+ /* It is possible to capture audio from this */
+ /* utterance buffered by the implementation */
+ bool captureAvailable;
+ /* Audio session ID. framework use */
+ int32_t captureSession;
+ /* Delay in ms between end of model detection and start of audio
+ /* available for capture. A negative value is possible
+ * (e.g. if key phrase is also available for capture */
+ int32_t captureDelayMs;
+ /* Duration in ms of audio captured before the start of the trigger.
+ * 0 if none. */
+ int32_t capturePreambleMs;
+ /* The opaque data is the capture of the trigger sound */
+ bool triggerInData;
+ /* Audio format of either the trigger in event data or to use for
+ * capture of the rest of the utterance */
+ AudioConfig audioConfig;
+ /* Opaque event data */
+ vec<uint8_t> data;
+ };
+
+ /*
+ * Specialized recognition event for key phrase recognitions
+ */
+ struct PhraseRecognitionEvent {
+ /* Common part of the recognition event */
+ RecognitionEvent common;
+ /* List of descriptors for each recognized key phrase */
+ vec<PhraseRecognitionExtra> phraseExtras;
+ };
+
+ /*
+ * Event sent via load sound model callback
+ */
+ struct ModelEvent {
+ /* Sound model status e.g. SoundModelStatus.UPDATED */
+ SoundModelStatus status;
+ /* Loaded sound model that triggered the event */
+ SoundModelHandle model;
+ /* Opaque event data, passed transparently by the framework */
+ vec<uint8_t> data;
+ };
+
+ typedef int32_t CallbackCookie;
+
+ /*
+ * Callback method called by the HAL when the sound recognition triggers
+ * @param event A RecognitionEvent structure containing detailed results
+ * of the recognition triggered
+ * @param cookie The cookie passed by the framework when recognition was
+ * started (see ISoundtriggerHw.startRecognition()
+ */
+ recognitionCallback(RecognitionEvent event, CallbackCookie cookie);
+ /*
+ * Callback method called by the HAL when the sound model loading completes
+ * @param event A ModelEvent structure containing detailed results of the
+ * model loading operation
+ * @param cookie The cookie passed by the framework when loading was
+ * initiated (see ISoundtriggerHw.loadSoundModel()
+ */
+ soundModelCallback(ModelEvent event, CallbackCookie cookie);
+};
diff --git a/soundtrigger/2.0/types.hal b/soundtrigger/2.0/types.hal
new file mode 100644
index 0000000..26928ba
--- /dev/null
+++ b/soundtrigger/2.0/types.hal
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.soundtrigger@2.0;
+
+/*
+ * Sound model types modes used in ISoundTriggerHw.SoundModel
+ */
+enum SoundModelType : int32_t {
+ /* use for unspecified sound model type */
+ UNKNOWN = -1,
+ /* use for key phrase sound models */
+ KEYPHRASE = 0,
+ /* use for all models other than keyphrase */
+ GENERIC = 1,
+};
+
+typedef int32_t SoundModelHandle;
+
+
+/*
+ * Recognition modes used in ISoundTriggerHw.RecognitionConfig,
+ * ISoundTriggerHw.Properties or PhraseRecognitionExtra
+ */
+enum RecognitionMode : uint32_t {
+ /* simple voice trigger */
+ VOICE_TRIGGER = (1 << 0),
+ /* trigger only if one user in model identified */
+ USER_IDENTIFICATION = (1 << 1),
+ /* trigger only if one user in mode authenticated */
+ USER_AUTHENTICATION = (1 << 2),
+ /* generic sound trigger */
+ GENERIC_TRIGGER = (1 << 3),
+};
+
+/*
+ * Confidence level for each user in structure PhraseRecognitionExtra
+ */
+struct ConfidenceLevel {
+ /* user ID */
+ uint32_t userId;
+ /* confidence level in percent (0 - 100): */
+ /* - min level for recognition configuration */
+ /* - detected level for recognition event */
+ uint32_t levelPercent;
+};
+
+/*
+ * Specialized recognition event for key phrase detection
+ */
+struct PhraseRecognitionExtra {
+ /* keyphrase ID */
+ uint32_t id;
+ /* recognition modes used for this keyphrase */
+ uint32_t recognitionModes;
+ /* confidence level for mode RecognitionMode.VOICE_TRIGGER */
+ uint32_t confidenceLevel;
+ /* list of confidence levels per user for
+ * RecognitionMode.USER_IDENTIFICATION and
+ * RecognitionMode.USER_AUTHENTICATION */
+ vec<ConfidenceLevel> levels;
+};
+
+/* TODO(elaurent) remove when Java build problem is fixed */
+union Dummy {
+ uint32_t dummy1;
+ int32_t dummy2;
+};
\ No newline at end of file
diff --git a/tests/foo/1.0/IFoo.hal b/tests/foo/1.0/IFoo.hal
index 3d82353..614f1e4 100644
--- a/tests/foo/1.0/IFoo.hal
+++ b/tests/foo/1.0/IFoo.hal
@@ -80,6 +80,7 @@
};
doThis(float param);
+ doThis(uint32_t param);
doThatAndReturnSomething(int64_t param) generates (int32_t result);
doQuiteABit(int32_t a, int64_t b, float c, double d) generates (double something);
doSomethingElse(int32_t[15] param) generates (int32_t[32] something);
diff --git a/vehicle/2.0/Android.bp b/vehicle/2.0/Android.bp
new file mode 100644
index 0000000..cb30e1b
--- /dev/null
+++ b/vehicle/2.0/Android.bp
@@ -0,0 +1,54 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.vehicle@2.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
+ srcs: [
+ "types.hal",
+ "IVehicle.hal",
+ "IVehicleCallback.hal",
+ ],
+ out: [
+ "android/hardware/vehicle/2.0/types.cpp",
+ "android/hardware/vehicle/2.0/VehicleAll.cpp",
+ "android/hardware/vehicle/2.0/VehicleCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.vehicle@2.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.vehicle@2.0",
+ srcs: [
+ "types.hal",
+ "IVehicle.hal",
+ "IVehicleCallback.hal",
+ ],
+ out: [
+ "android/hardware/vehicle/2.0/types.h",
+ "android/hardware/vehicle/2.0/IVehicle.h",
+ "android/hardware/vehicle/2.0/IHwVehicle.h",
+ "android/hardware/vehicle/2.0/BnVehicle.h",
+ "android/hardware/vehicle/2.0/BpVehicle.h",
+ "android/hardware/vehicle/2.0/BsVehicle.h",
+ "android/hardware/vehicle/2.0/IVehicleCallback.h",
+ "android/hardware/vehicle/2.0/IHwVehicleCallback.h",
+ "android/hardware/vehicle/2.0/BnVehicleCallback.h",
+ "android/hardware/vehicle/2.0/BpVehicleCallback.h",
+ "android/hardware/vehicle/2.0/BsVehicleCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.vehicle@2.0",
+ generated_sources: ["android.hardware.vehicle@2.0_genc++"],
+ generated_headers: ["android.hardware.vehicle@2.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.vehicle@2.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/vehicle/2.0/Android.mk b/vehicle/2.0/Android.mk
new file mode 100644
index 0000000..be63595
--- /dev/null
+++ b/vehicle/2.0/Android.mk
@@ -0,0 +1,1708 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vehicle@2.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(local-generated-sources-dir)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+#
+# Build types.hal (StatusCode)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/StatusCode.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.vehicle@2.0::types.StatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SubscribeFlags)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/SubscribeFlags.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.vehicle@2.0::types.SubscribeFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SubscribeOptions)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/SubscribeOptions.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.vehicle@2.0::types.SubscribeOptions
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerBootupReason)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerBootupReason.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.vehicle@2.0::types.VehicleApPowerBootupReason
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerSetState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerSetState.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.vehicle@2.0::types.VehicleApPowerSetState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerState.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.vehicle@2.0::types.VehicleApPowerState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateConfigFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateConfigFlag.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.vehicle@2.0::types.VehicleApPowerStateConfigFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateIndex.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.vehicle@2.0::types.VehicleApPowerStateIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateShutdownParam)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateShutdownParam.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.vehicle@2.0::types.VehicleApPowerStateShutdownParam
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleArea)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleArea.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.vehicle@2.0::types.VehicleArea
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaConfig)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaConfig.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.vehicle@2.0::types.VehicleAreaConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaDoor)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaDoor.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.vehicle@2.0::types.VehicleAreaDoor
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaMirror)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaMirror.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.vehicle@2.0::types.VehicleAreaMirror
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaSeat)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaSeat.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.vehicle@2.0::types.VehicleAreaSeat
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaWindow)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaWindow.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.vehicle@2.0::types.VehicleAreaWindow
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaZone)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaZone.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.vehicle@2.0::types.VehicleAreaZone
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioContextFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioContextFlag.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.vehicle@2.0::types.VehicleAudioContextFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioExtFocusFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioExtFocusFlag.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.vehicle@2.0::types.VehicleAudioExtFocusFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusIndex.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.vehicle@2.0::types.VehicleAudioFocusIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusRequest)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusRequest.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.vehicle@2.0::types.VehicleAudioFocusRequest
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusState.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.vehicle@2.0::types.VehicleAudioFocusState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioHwVariantConfigFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioHwVariantConfigFlag.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.vehicle@2.0::types.VehicleAudioHwVariantConfigFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioRoutingPolicyIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioRoutingPolicyIndex.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.vehicle@2.0::types.VehicleAudioRoutingPolicyIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioStream)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioStream.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.vehicle@2.0::types.VehicleAudioStream
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioStreamFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioStreamFlag.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.vehicle@2.0::types.VehicleAudioStreamFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeCapabilityFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeCapabilityFlag.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.vehicle@2.0::types.VehicleAudioVolumeCapabilityFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeIndex.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.vehicle@2.0::types.VehicleAudioVolumeIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeLimitIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeLimitIndex.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.vehicle@2.0::types.VehicleAudioVolumeLimitIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeState.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.vehicle@2.0::types.VehicleAudioVolumeState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleDisplay)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleDisplay.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.vehicle@2.0::types.VehicleDisplay
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleDrivingStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleDrivingStatus.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.vehicle@2.0::types.VehicleDrivingStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleGear)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleGear.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.vehicle@2.0::types.VehicleGear
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleHvacFanDirection)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleHvacFanDirection.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.vehicle@2.0::types.VehicleHvacFanDirection
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleHwKeyInputAction)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleHwKeyInputAction.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.vehicle@2.0::types.VehicleHwKeyInputAction
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleInstrumentClusterType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleInstrumentClusterType.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.vehicle@2.0::types.VehicleInstrumentClusterType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePermissionModel)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePermissionModel.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.vehicle@2.0::types.VehiclePermissionModel
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropConfig)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropConfig.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.vehicle@2.0::types.VehiclePropConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropValue)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropValue.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.vehicle@2.0::types.VehiclePropValue
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleProperty)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleProperty.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.vehicle@2.0::types.VehicleProperty
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyAccess)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyAccess.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.vehicle@2.0::types.VehiclePropertyAccess
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyChangeMode)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyChangeMode.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.vehicle@2.0::types.VehiclePropertyChangeMode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyGroup)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyGroup.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.vehicle@2.0::types.VehiclePropertyGroup
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyOperation)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyOperation.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.vehicle@2.0::types.VehiclePropertyOperation
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyType.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.vehicle@2.0::types.VehiclePropertyType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleRadioConstants)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleRadioConstants.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.vehicle@2.0::types.VehicleRadioConstants
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleTurnSignal)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleTurnSignal.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.vehicle@2.0::types.VehicleTurnSignal
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleUnit)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleUnit.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.vehicle@2.0::types.VehicleUnit
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVehicle.hal
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/IVehicle.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVehicle.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IVehicleCallback.hal
+$(GEN): $(LOCAL_PATH)/IVehicleCallback.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.vehicle@2.0::IVehicle
+
+$(GEN): $(LOCAL_PATH)/IVehicle.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVehicleCallback.hal
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/IVehicleCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVehicleCallback.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.vehicle@2.0::IVehicleCallback
+
+$(GEN): $(LOCAL_PATH)/IVehicleCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vehicle@2.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 (StatusCode)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/StatusCode.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.vehicle@2.0::types.StatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SubscribeFlags)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/SubscribeFlags.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.vehicle@2.0::types.SubscribeFlags
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (SubscribeOptions)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/SubscribeOptions.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.vehicle@2.0::types.SubscribeOptions
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerBootupReason)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerBootupReason.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.vehicle@2.0::types.VehicleApPowerBootupReason
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerSetState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerSetState.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.vehicle@2.0::types.VehicleApPowerSetState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerState.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.vehicle@2.0::types.VehicleApPowerState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateConfigFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateConfigFlag.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.vehicle@2.0::types.VehicleApPowerStateConfigFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateIndex.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.vehicle@2.0::types.VehicleApPowerStateIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleApPowerStateShutdownParam)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleApPowerStateShutdownParam.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.vehicle@2.0::types.VehicleApPowerStateShutdownParam
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleArea)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleArea.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.vehicle@2.0::types.VehicleArea
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaConfig)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaConfig.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.vehicle@2.0::types.VehicleAreaConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaDoor)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaDoor.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.vehicle@2.0::types.VehicleAreaDoor
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaMirror)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaMirror.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.vehicle@2.0::types.VehicleAreaMirror
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaSeat)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaSeat.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.vehicle@2.0::types.VehicleAreaSeat
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaWindow)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaWindow.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.vehicle@2.0::types.VehicleAreaWindow
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAreaZone)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAreaZone.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.vehicle@2.0::types.VehicleAreaZone
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioContextFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioContextFlag.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.vehicle@2.0::types.VehicleAudioContextFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioExtFocusFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioExtFocusFlag.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.vehicle@2.0::types.VehicleAudioExtFocusFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusIndex.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.vehicle@2.0::types.VehicleAudioFocusIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusRequest)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusRequest.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.vehicle@2.0::types.VehicleAudioFocusRequest
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioFocusState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioFocusState.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.vehicle@2.0::types.VehicleAudioFocusState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioHwVariantConfigFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioHwVariantConfigFlag.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.vehicle@2.0::types.VehicleAudioHwVariantConfigFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioRoutingPolicyIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioRoutingPolicyIndex.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.vehicle@2.0::types.VehicleAudioRoutingPolicyIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioStream)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioStream.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.vehicle@2.0::types.VehicleAudioStream
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioStreamFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioStreamFlag.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.vehicle@2.0::types.VehicleAudioStreamFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeCapabilityFlag)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeCapabilityFlag.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.vehicle@2.0::types.VehicleAudioVolumeCapabilityFlag
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeIndex.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.vehicle@2.0::types.VehicleAudioVolumeIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeLimitIndex)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeLimitIndex.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.vehicle@2.0::types.VehicleAudioVolumeLimitIndex
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleAudioVolumeState)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleAudioVolumeState.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.vehicle@2.0::types.VehicleAudioVolumeState
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleDisplay)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleDisplay.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.vehicle@2.0::types.VehicleDisplay
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleDrivingStatus)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleDrivingStatus.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.vehicle@2.0::types.VehicleDrivingStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleGear)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleGear.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.vehicle@2.0::types.VehicleGear
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleHvacFanDirection)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleHvacFanDirection.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.vehicle@2.0::types.VehicleHvacFanDirection
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleHwKeyInputAction)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleHwKeyInputAction.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.vehicle@2.0::types.VehicleHwKeyInputAction
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleInstrumentClusterType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleInstrumentClusterType.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.vehicle@2.0::types.VehicleInstrumentClusterType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePermissionModel)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePermissionModel.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.vehicle@2.0::types.VehiclePermissionModel
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropConfig)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropConfig.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.vehicle@2.0::types.VehiclePropConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropValue)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropValue.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.vehicle@2.0::types.VehiclePropValue
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleProperty)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleProperty.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.vehicle@2.0::types.VehicleProperty
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyAccess)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyAccess.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.vehicle@2.0::types.VehiclePropertyAccess
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyChangeMode)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyChangeMode.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.vehicle@2.0::types.VehiclePropertyChangeMode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyGroup)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyGroup.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.vehicle@2.0::types.VehiclePropertyGroup
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyOperation)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyOperation.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.vehicle@2.0::types.VehiclePropertyOperation
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehiclePropertyType)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehiclePropertyType.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.vehicle@2.0::types.VehiclePropertyType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleRadioConstants)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleRadioConstants.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.vehicle@2.0::types.VehicleRadioConstants
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleTurnSignal)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleTurnSignal.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.vehicle@2.0::types.VehicleTurnSignal
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (VehicleUnit)
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/VehicleUnit.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.vehicle@2.0::types.VehicleUnit
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVehicle.hal
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/IVehicle.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVehicle.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IVehicleCallback.hal
+$(GEN): $(LOCAL_PATH)/IVehicleCallback.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.vehicle@2.0::IVehicle
+
+$(GEN): $(LOCAL_PATH)/IVehicle.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IVehicleCallback.hal
+#
+GEN := $(intermediates)/android/hardware/vehicle/2.0/IVehicleCallback.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IVehicleCallback.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.vehicle@2.0::IVehicleCallback
+
+$(GEN): $(LOCAL_PATH)/IVehicleCallback.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/vehicle/2.0/IVehicle.hal b/vehicle/2.0/IVehicle.hal
new file mode 100644
index 0000000..0885539
--- /dev/null
+++ b/vehicle/2.0/IVehicle.hal
@@ -0,0 +1,99 @@
+/*
+ * 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.vehicle@2.0;
+
+import IVehicleCallback;
+
+interface IVehicle {
+ /**
+ * Returns a list of all property configurations supported by this vehicle
+ * HAL.
+ */
+ getAllPropConfigs() generates (vec<VehiclePropConfig> propConfigs);
+
+ /*
+ * Returns a list of property configurations for given properties.
+ */
+ getPropConfigs(vec<VehicleProperty> props)
+ generates (vec<VehiclePropConfig> propConfigs);
+
+ /**
+ * Get a vehicle property value.
+ *
+ * For VehiclePropertyChangeMode::STATIC properties, this method must always
+ * return the same value always.
+ * For VehiclePropertyChangeMode::ON_CHANGE properties, it must return the
+ * latest available value.
+ *
+ * If there is no data available yet, which can happen during initial stage,
+ * this call must return immediately with an error code of
+ * StatusCode::TRY_AGAIN.
+ */
+ get(VehicleProperty propId, int32_t areaId)
+ generates (StatusCode status, VehiclePropValue propValue);
+
+ /**
+ * Set a vehicle property value.
+ *
+ * Timestamp of data must be ignored for set operation.
+ *
+ * Setting some properties require having initial state available. If initial
+ * data is not available yet this call must return StatusCode::TRY_AGAIN.
+ * For a property with separate power control this call must return
+ * StatusCode::NOT_AVAILABLE error if property is not powered on.
+ */
+ set(VehiclePropValue propValue) generates (StatusCode status);
+
+ /**
+ * Subscribes to property events.
+ *
+ * Clients must be able to subscribe to multiple properties at a time
+ * depending on data provided in options argument.
+ *
+ * @param listener This client must be called on aproperiate event.
+ * @param options List of options to subscribe. SubscribeOption contains
+ * information such as propery Id, area Id, sample rate, etc.
+ */
+ subscribe(IVehicleCallback listener, vec<SubscribeOptions> options)
+ generates (StatusCode status);
+
+ /**
+ * Unsubscribes from property events.
+ *
+ * If this client wasn't subscribed to the given property, this method
+ * must return StatusCode::INVALID_ARGUMENT.
+ */
+ unsubscribe(VehicleProperty propId) generates (StatusCode status);
+
+ /**
+ * Print out debugging state for the vehicle hal.
+ *
+ * The text must be in ASCII encoding only.
+ *
+ * Performance requirements:
+ *
+ * The HAL must return from this call in less than 10ms. This call must avoid
+ * deadlocks, as it may be called at any point of operation. Any synchronization
+ * primitives used (such as mutex locks or semaphores) must be acquired
+ * with a timeout.
+ *
+ * TODO(pavelm): we cannot use handle here due to Java compatability, it's
+ * better to pass file descriptor and write debug data directly in vehicle HAL
+ * rather than passing back a string.
+ */
+ debugDump() generates (string s);
+};
diff --git a/vehicle/2.0/IVehicleCallback.hal b/vehicle/2.0/IVehicleCallback.hal
new file mode 100644
index 0000000..1e9034f
--- /dev/null
+++ b/vehicle/2.0/IVehicleCallback.hal
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.vehicle@2.0;
+
+interface IVehicleCallback {
+
+ /*
+ * Event callback happens whenever a variable that the API user has
+ * subscribed to needs to be reported. This may be based purely on
+ * threshold and frequency (a regular subscription, see subscribe call's
+ * arguments) or when the IVehicle#set method was called and the actual
+ * change needs to be reported.
+ *
+ * These callbacks are chunked.
+ *
+ * @param values that has been updated.
+ */
+ onPropertyEvent(vec<VehiclePropValue> propValues);
+
+ /*
+ * This method gets called if the client was susbscribed to a property using
+ * SubscribeFlags::SET_CALL flag and IVehicle#set(...) method was called.
+ *
+ * These events must be delivered to subscriber immediately without any
+ * batching.
+ *
+ * @param value Value that was set by a client.
+ */
+ onPropertySet(VehiclePropValue propValue);
+
+ /*
+ * Called by HAL server when error condition has occurred.
+ *
+ * @param errorCode - any value from StatusCode enum.
+ * @parm property - a property where error has happened. If this is
+ * a generic error, this value should be VehicleProperty::INVALID.
+ * @param operation Represent the operation where the error has happened.
+ */
+ onError(StatusCode errorCode,
+ VehicleProperty propId,
+ VehiclePropertyOperation operation);
+};
diff --git a/vehicle/2.0/default/Android.mk b/vehicle/2.0/default/Android.mk
new file mode 100644
index 0000000..a30d753
--- /dev/null
+++ b/vehicle/2.0/default/Android.mk
@@ -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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vehicle@2.0-impl
+# TODO(pavelm): add LOCAL_INIT_RC
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ Vehicle.cpp \
+ VehicleCallback.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ libhidl \
+ libhwbinder \
+ libutils \
+ android.hardware.vehicle@2.0 \
+
+include $(BUILD_SHARED_LIBRARY)
+
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.vehicle@2.0-service
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ VehicleService.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libbinder \
+ libhidl \
+ libhwbinder \
+ libutils \
+ android.hardware.vehicle@2.0
+
+include $(BUILD_EXECUTABLE)
diff --git a/vehicle/2.0/default/Vehicle.cpp b/vehicle/2.0/default/Vehicle.cpp
new file mode 100644
index 0000000..a4933df
--- /dev/null
+++ b/vehicle/2.0/default/Vehicle.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Vehicle.h"
+#include "VehicleUtils.h"
+
+#include <utils/SystemClock.h>
+
+namespace android {
+namespace hardware {
+namespace vehicle {
+namespace V2_0 {
+namespace implementation {
+
+const VehiclePropConfig kVehicleProperties[] = {
+ {
+ .prop = VehicleProperty::INFO_MAKE,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::STATIC,
+ .permissionModel = VehiclePermissionModel::OEM_ONLY,
+ .configString = init_hidl_string("Some=configuration,options=if,you=have,any=?"),
+ },
+
+ {
+ .prop = VehicleProperty::HVAC_FAN_SPEED,
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .permissionModel = VehiclePermissionModel::NO_RESTRICTION,
+ .supportedAreas = static_cast<int32_t>(
+ VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT),
+ .areaConfigs = init_hidl_vec({
+ VehicleAreaConfig {
+ .areaId = enum_val(VehicleAreaZone::ROW_2_LEFT),
+ .minInt32Value = 1,
+ .maxInt32Value = 7},
+ VehicleAreaConfig {
+ .areaId = enum_val(VehicleAreaZone::ROW_1_RIGHT),
+ .minInt32Value = 1,
+ .maxInt32Value = 5,
+ }
+ }),
+ },
+
+ {
+ .prop = VehicleProperty::INFO_FUEL_CAPACITY,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .permissionModel = VehiclePermissionModel::OEM_ONLY,
+ .areaConfigs = init_hidl_vec({
+ VehicleAreaConfig {
+ .minFloatValue = 0,
+ .maxFloatValue = 1.0
+ }
+ })
+ }
+};
+
+const char kInfoMake[] = "Android Super Car";
+
+
+Return<void> Vehicle::getAllPropConfigs(getAllPropConfigs_cb _hidl_cb) {
+ hidl_vec<VehiclePropConfig> configs;
+
+ configs.setToExternal(const_cast<VehiclePropConfig*>(kVehicleProperties),
+ arraysize(kVehicleProperties));
+
+ _hidl_cb(configs);
+ return Void();
+}
+
+Return<void> Vehicle::getPropConfigs(const hidl_vec<VehicleProperty>& properties,
+ getAllPropConfigs_cb _hidl_cb) {
+ // TODO(pavelm): add default implementation
+ hidl_vec<VehiclePropConfig> configs;
+ _hidl_cb(configs);
+ return Void();
+}
+
+Return<void> Vehicle::get(VehicleProperty propId, int32_t areaId, get_cb _hidl_cb) {
+ VehiclePropValue v {
+ .prop = propId,
+ .areaId = areaId,
+ .timestamp = elapsedRealtimeNano(),
+ };
+
+ StatusCode status = StatusCode::OK;
+
+ if (propId == VehicleProperty::INFO_MAKE) {
+ v.value.stringValue.setToExternal(kInfoMake, strlen(kInfoMake));
+ } else if (propId == VehicleProperty::HVAC_FAN_SPEED) {
+ v.value.int32Values = init_hidl_vec({42});
+ } else {
+ status = StatusCode::INVALID_ARG;
+ }
+
+ _hidl_cb(status, v);
+
+ return Void();
+}
+
+Return<StatusCode> Vehicle::set(const VehiclePropValue& value) {
+ // TODO(pavelm): add default implementation
+ return StatusCode::OK;
+}
+
+Return<StatusCode> Vehicle::subscribe(const sp<IVehicleCallback>& listener,
+ const hidl_vec<SubscribeOptions>& options) {
+ // TODO(pavelm): add default implementation
+ return StatusCode::OK;
+}
+
+Return<StatusCode> Vehicle::unsubscribe(VehicleProperty propId) {
+ // TODO(pavelm): add default implementation
+ return StatusCode::OK;
+}
+
+Return<void> Vehicle::debugDump(debugDump_cb _hidl_cb) {
+ hidl_string debug;
+ debug = "Put debug data here";
+
+ _hidl_cb(debug);
+
+ return Void();
+}
+
+IVehicle* HIDL_FETCH_IVehicle(const char* /* name */) {
+ return new Vehicle();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace vehicle
+} // namespace hardware
+} // namespace android
diff --git a/vehicle/2.0/default/Vehicle.h b/vehicle/2.0/default/Vehicle.h
new file mode 100644
index 0000000..c0fe03e
--- /dev/null
+++ b/vehicle/2.0/default/Vehicle.h
@@ -0,0 +1,61 @@
+/*
+ * 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_vehicle_V2_0_Vehicle_H_
+#define HIDL_GENERATED_android_hardware_vehicle_V2_0_Vehicle_H_
+
+#include <android/hardware/vehicle/2.0/IVehicle.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace vehicle {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::vehicle::V2_0::IVehicle;
+using ::android::hardware::vehicle::V2_0::IVehicleCallback;
+using ::android::hardware::vehicle::V2_0::SubscribeOptions;
+using ::android::hardware::vehicle::V2_0::VehiclePropConfig;
+using ::android::hardware::vehicle::V2_0::VehiclePropValue;
+using ::android::hardware::vehicle::V2_0::VehicleProperty;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct Vehicle : public IVehicle {
+ // Methods from ::android::hardware::vehicle::V2_0::IVehicle follow.
+ Return<void> getAllPropConfigs(getAllPropConfigs_cb _hidl_cb) override;
+ Return<void> getPropConfigs(const hidl_vec<VehicleProperty>& properties, getPropConfigs_cb _hidl_cb) override;
+ Return<void> get(VehicleProperty propId, int32_t areaId, get_cb _hidl_cb) override;
+ Return<StatusCode> set(const VehiclePropValue& value) override;
+ Return<StatusCode> subscribe(const sp<IVehicleCallback>& listener, const hidl_vec<SubscribeOptions>& options) override;
+ Return<StatusCode> unsubscribe(VehicleProperty propId) override;
+ Return<void> debugDump(debugDump_cb _hidl_cb = nullptr) override;
+};
+
+extern "C" IVehicle* HIDL_FETCH_IVehicle(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace vehicle
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_vehicle_V2_0_Vehicle_H_
diff --git a/vehicle/2.0/default/VehicleCallback.cpp b/vehicle/2.0/default/VehicleCallback.cpp
new file mode 100644
index 0000000..985b7dc
--- /dev/null
+++ b/vehicle/2.0/default/VehicleCallback.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VehicleCallback.h"
+
+namespace android {
+namespace hardware {
+namespace vehicle {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::vehicle::V2_0::IVehicleCallback follow.
+Return<void> VehicleCallback::onPropertyEvent(const hidl_vec<VehiclePropValue>& value) {
+ // TODO(pavelm): add default implementation
+ return Void();
+}
+
+// Methods from ::android::hardware::vehicle::V2_0::IVehicleCallback follow.
+Return<void> VehicleCallback::onPropertySet(const VehiclePropValue& value) {
+ // TODO(pavelm): add default implementation
+ return Void();
+}
+
+Return<void> VehicleCallback::onError(StatusCode errorCode,
+ VehicleProperty propId,
+ VehiclePropertyOperation operation) {
+ // TODO(pavelm): add default implementation
+ return Void();
+}
+
+
+IVehicleCallback* HIDL_FETCH_IVehicleCallback(const char* /* name */) {
+ return new VehicleCallback();
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace vehicle
+} // namespace hardware
+} // namespace android
diff --git a/vehicle/2.0/default/VehicleCallback.h b/vehicle/2.0/default/VehicleCallback.h
new file mode 100644
index 0000000..d037c94
--- /dev/null
+++ b/vehicle/2.0/default/VehicleCallback.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_vehicle_V2_0_VehicleCallback_H_
+#define HIDL_GENERATED_android_hardware_vehicle_V2_0_VehicleCallback_H_
+
+#include <android/hardware/vehicle/2.0/IVehicleCallback.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+namespace android {
+namespace hardware {
+namespace vehicle {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::hardware::vehicle::V2_0::IVehicleCallback;
+using ::android::hardware::vehicle::V2_0::VehiclePropValue;
+using ::android::hardware::vehicle::V2_0::VehicleProperty;
+using ::android::hardware::vehicle::V2_0::VehiclePropertyOperation;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+struct VehicleCallback : public IVehicleCallback {
+ // Methods from ::android::hardware::vehicle::V2_0::IVehicleCallback follow.
+ Return<void> onPropertyEvent(const hidl_vec<VehiclePropValue>& values) override;
+ Return<void> onPropertySet(const VehiclePropValue& value) override;
+ Return<void> onError(StatusCode errorCode, VehicleProperty propId, VehiclePropertyOperation operation) override;
+
+};
+
+extern "C" IVehicleCallback* HIDL_FETCH_IVehicleCallback(const char* name);
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace vehicle
+} // namespace hardware
+} // namespace android
+
+#endif // HIDL_GENERATED_android_hardware_vehicle_V2_0_VehicleCallback_H_
diff --git a/vehicle/2.0/default/VehicleService.cpp b/vehicle/2.0/default/VehicleService.cpp
new file mode 100644
index 0000000..b685977
--- /dev/null
+++ b/vehicle/2.0/default/VehicleService.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.vehicle@2.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+
+#include <hwbinder/IPCThreadState.h>
+
+#include <android/hardware/vehicle/2.0/IVehicle.h>
+
+using namespace android;
+using namespace android::hardware;
+using namespace android::hardware::vehicle::V2_0;
+
+int main(int /* argc */, char* /* argv */ []) {
+ ALOGI("Service is starting");
+ android::sp<IVehicle> service = IVehicle::getService("Vehicle");
+ if (service.get() == NULL) {
+ ALOGE("IVehicle::getService returned NULL, exiting");
+ return 1;
+ }
+
+ ALOGI("Registering as service");
+ // will register the -impl as a binderized service in this process
+ service->registerAsService("Vehicle");
+
+ ALOGI("Ready");
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/vehicle/2.0/default/VehicleUtils.h b/vehicle/2.0/default/VehicleUtils.h
new file mode 100644
index 0000000..78e34e5
--- /dev/null
+++ b/vehicle/2.0/default/VehicleUtils.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef android_hardware_vehicle_V2_0_VehicleUtils_H_
+#define android_hardware_vehicle_V2_0_VehicleUtils_H_
+
+#include <hidl/HidlSupport.h>
+#include <android/hardware/vehicle/2.0/types.h>
+
+namespace android {
+namespace hardware {
+namespace vehicle {
+namespace V2_0 {
+
+hidl_string init_hidl_string(const char *cstr) {
+ hidl_string hidlString;
+ hidlString = cstr;
+ return hidlString;
+}
+
+template <typename T>
+hidl_vec<T> init_hidl_vec(std::initializer_list<T> values) {
+ hidl_vec<T> vector;
+ vector.resize(values.size());
+ size_t i = 0;
+ for (auto& c : values) {
+ vector[i++] = c;
+ }
+ return vector;
+}
+
+// OR operator for class enums. The return type will be enum's underline type.
+template <typename ENUM>
+typename std::underlying_type<ENUM>::type operator |(ENUM v1, ENUM v2) {
+ return static_cast<typename std::underlying_type<ENUM>::type>(v1)
+ | static_cast<typename std::underlying_type<ENUM>::type>(v2);
+}
+
+// AND operator for class enums. The return type will be enum's underline type.
+template <typename ENUM>
+typename std::underlying_type<ENUM>::type operator &(ENUM v1, ENUM v2) {
+ return static_cast<typename std::underlying_type<ENUM>::type>(v1)
+ | static_cast<typename std::underlying_type<ENUM>::type>(v2);
+}
+
+// Returns underlying (integer) value for given enum.
+template <typename ENUM>
+typename std::underlying_type<ENUM>::type enum_val(ENUM const value)
+{
+ return static_cast<typename std::underlying_type<ENUM>::type>(value);
+}
+
+VehiclePropertyType getPropType(VehicleProperty prop) {
+ return static_cast<VehiclePropertyType>(
+ static_cast<int32_t>(prop) & static_cast<int32_t>(VehiclePropertyType::MASK));
+}
+
+VehiclePropertyGroup getPropGroup(VehicleProperty prop) {
+ return static_cast<VehiclePropertyGroup>(
+ static_cast<int32_t>(prop) & static_cast<int32_t>(VehiclePropertyGroup::MASK));
+}
+
+bool checkPropType(VehicleProperty prop, VehiclePropertyType type) {
+ return getPropType(prop) == type;
+}
+
+bool isSystemProperty(VehicleProperty prop) {
+ return VehiclePropertyGroup::SYSTEM == getPropGroup(prop);
+}
+
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace hardware
+} // namespace android
+
+#endif android_hardware_vehicle_V2_0_VehicleUtils_H_
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
new file mode 100644
index 0000000..03c1021
--- /dev/null
+++ b/vehicle/2.0/types.hal
@@ -0,0 +1,2394 @@
+/*
+ * 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.vehicle@2.0;
+
+/*
+ * Enumerates supported data types for VehicleProperty.
+ *
+ * This is a bitwise flag that supposed to be used in VehicleProperty enum.
+ */
+enum VehiclePropertyType : int32_t {
+ STRING = 0x00100000,
+ BOOLEAN = 0x00200000,
+ INT32 = 0x00400000,
+ INT32_VEC = 0x00410000,
+ INT64 = 0x00500000,
+ FLOAT = 0x00600000,
+ FLOAT_VEC = 0x00610000,
+ BYTES = 0x00700000,
+
+ MASK = 0x00ff0000
+};
+
+/*
+ * Some properties may be associated with particular vehicle areas. For
+ * example, VehicleProperty:DOOR_LOCK property must be associated with
+ * particular door, thus this property must be marked with
+ * VehicleArea:DOOR flag.
+ *
+ * Other properties may not be associated with particular vehicle area,
+ * these kind of properties must have VehicleArea:GLOBAL flag.
+ *
+ * This is a bitwise flag that supposed to be used in VehicleProperty enum.
+ */
+enum VehicleArea : int32_t {
+ GLOBAL = 0x01000000,
+ ZONE = 0x02000000,
+ WINDOW = 0x03000000,
+ MIRROR = 0x04000000,
+ SEAT = 0x05000000,
+ DOOR = 0x06000000,
+
+ MASK = 0x0f000000,
+};
+
+/*
+ * Enumerates property groups.
+ *
+ * This is a bitwise flag that supposed to be used in VehicleProperty enum.
+ */
+enum VehiclePropertyGroup : int32_t {
+ /*
+ * Properties declared in AOSP must have this flag.
+ */
+ SYSTEM = 0x10000000,
+
+ /*
+ * Properties declared by vendors must have this flag.
+ */
+ VENDOR = 0x20000000,
+
+ MASK = 0xf0000000,
+};
+
+/*
+ * Declares all vehicle properties. VehicleProperty has a bitwise structure.
+ * Each property must have:
+ * - an unique id from range 0x0100 - 0xffff
+ * - associated data type using VehiclePropertyType
+ * - property group (VehiclePropertyGroup)
+ * - vehicle area (VehicleArea)
+ *
+ * Vendors are allowed to extend this enum with their own properties. In this
+ * case they must use VehiclePropertyGroup:VENDOR flag when property is
+ * declared.
+ */
+enum VehicleProperty: int32_t {
+
+ /* Undefined property. */
+ INVALID = 0x00000000,
+
+ /*
+ * VIN of vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ */
+ INFO_VIN= (
+ 0x0100
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Maker name of vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ */
+ INFO_MAKE = (
+ 0x0101
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Model of vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ */
+ INFO_MODEL = (
+ 0x0102
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:STRING
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Model year of vehicle.
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:YEAR
+ */
+ INFO_MODEL_YEAR = (
+ 0x0103
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Fuel capacity of the vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:MILLILITER
+ */
+ INFO_FUEL_CAPACITY = (
+ 0x0104
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Current odometer value of the vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE | VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:KILOMETER
+ */
+ PERF_ODOMETER = (
+ 0x0204
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Speed of the vehicle
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:METER_PER_SEC
+ */
+ PERF_VEHICLE_SPEED = (
+ 0x0207
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Temperature of engine coolant
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:CELCIUS
+ */
+ ENGINE_COOLANT_TEMP = (
+ 0x0301
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Temperature of engine oil
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:CELCIUS
+ */
+ ENGINE_OIL_TEMP = (
+ 0x0304
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Engine rpm
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:RPM
+ */
+ ENGINE_RPM = (
+ 0x0305
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Currently selected gear
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum VehicleGear
+ */
+ GEAR_SELECTION = (
+ 0x0400
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Current gear. In non-manual case, selected gear does not necessarily
+ * match the current gear.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum VehicleGear
+ */
+ CURRENT_GEAR = (
+ 0x0401
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Parking brake state.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ PARKING_BRAKE_ON = (
+ 0x0402
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Driving status policy.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @data_enum VehicleDrivingStatus
+ */
+ DRIVING_STATUS = (
+ 0x0404
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Warning for fuel low level.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ FUEL_LEVEL_LOW = (
+ 0x0405
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Night mode or not.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ */
+ NIGHT_MODE = (
+ 0x0407
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Fan speed setting
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @data_enum TODO
+ * @allow_out_of_range_value : OFF
+ */
+ HVAC_FAN_SPEED = (
+ 0x0500
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:ZONE),
+
+ /*
+ * Fan direction setting
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @data_enum TODO
+ * @allow_out_of_range_value : OFF
+ */
+ HVAC_FAN_DIRECTION = (
+ 0x0501
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:ZONE),
+
+ /*
+ * HVAC current temperature.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_TEMPERATURE_CURRENT = (
+ 0x0502
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:ZONE),
+
+ /*
+ * HVAC, target temperature set.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @allow_out_of_range_value : MIN / MAX / OFF
+ */
+ HVAC_TEMPERATURE_SET = (
+ 0x0503
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off defrost
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_DEFROSTER = (
+ 0x0504
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:WINDOW),
+
+ /*
+ * On/off AC
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @config_flags Supported zones
+ */
+ HVAC_AC_ON = (
+ 0x0505
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off max AC
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_MAX_AC_ON = (
+ 0x0506
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off max defrost
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_MAX_DEFROST_ON = (
+ 0x0507
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off re-circulation
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_RECIRC_ON = (
+ 0x0508
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off dual. This must be defined per each row.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_DUAL_ON = (
+ 0x0509
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * On/off automatic mode
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ HVAC_AUTO_ON = (
+ 0x050A
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * Seat temperature
+ *
+ * Negative values indicate cooling.
+ * 0 indicates off.
+ * Positive values indicate heating.
+ *
+ * Some vehicles may have multiple levels of heating and cooling. The
+ * min/max range defines the allowable range and number of steps in each
+ * direction.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:WRITE
+ */
+ HVAC_SEAT_TEMPERATURE = (
+ 0x050B
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Represents power state for HVAC. Some HVAC properties must require
+ * matching power to be turned on to get out of OFF state. For non-zoned
+ * HVAC properties, VEHICLE_ALL_ZONE corresponds to global power state.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @config_string list of HVAC properties whose power is controlled by this
+ * property. Format is hexa-decimal number (0x...) separated
+ * by comma like "0x500,0x503". All zones defined in these
+ * affected properties must be available in the property.
+ */
+ HVAC_POWER_ON = (
+ 0x0510
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:ZONE),
+
+ /*
+ * Outside temperature
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:CELCIUS
+ */
+ ENV_OUTSIDE_TEMPERATURE = (
+ 0x0703
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Cabin temperature
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
+ * @access VehiclePropertyAccess:READ
+ * @unit VehicleUnit:CELCIUS
+ */
+ ENV_CABIN_TEMPERATURE = (
+ 0x0704
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:FLOAT
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Radio presets stored on the Car radio module. The data type used is int32
+ * array with the following fields:
+ * <ul>
+ * <li> int32Values[0]: Preset number </li>
+ * <li> int32Values[1]: Band type (see #RADIO_BAND_FM in
+ * system/core/include/system/radio.h).
+ * <li> int32Values[2]: Channel number </li>
+ * <li> int32Values[3]: Sub channel number </li>
+ * </ul>
+ *
+ * NOTE: When getting a current preset config ONLY set preset number (i.e.
+ * int32Values[0]). For setting a preset other fields are required.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @config_flags Number of presets supported
+ */
+ RADIO_PRESET = (
+ 0x801
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Represents audio focus state of Android side. Note that car's audio
+ * module must own audio focus and grant audio focus to Android side when
+ * requested by Android side. The focus has both per stream characteristics
+ * and global characteristics.
+ *
+ * Focus request (get of this property) must take the following form:
+ * int32Values[0]: VehicleAudioFocusRequest type
+ * int32Values[1]: bit flags of streams requested by this focus request.
+ * There can be up to 32 streams.
+ * int32Values[2]: External focus state flags. For request, only flag like
+ * VehicleAudioExtFocusFlag#PLAY_ONLY_FLAG or
+ * VehicleAudioExtFocusFlag#MUTE_MEDIA_FLAG can be
+ * used.
+ * VehicleAudioExtFocusFlag#PLAY_ONLY_FLAG is for case
+ * like radio where android side app still needs to hold
+ * focus but playback is done outside Android.
+ * VehicleAudioExtFocusFlag#MUTE_MEDIA_FLAG is for
+ * muting media channel including radio.
+ * VehicleAudioExtFocusFlag#PLAY_ONLY_FLAG can be set
+ * even if android side releases focus (request type
+ * REQUEST_RELEASE). In that case, audio module must
+ * maintain mute state until user's explicit action to
+ * play some media.
+ * int32Values[3]: Currently active audio contexts. Use combination of
+ * flags from VehicleAudioContextFlag.
+ * This can be used as a hint to adjust audio policy or
+ * other policy decision.
+ * Note that there can be multiple context active at the
+ * same time. And android can send the same focus request
+ * type gain due to change in audio contexts.
+ * Note that each focus request can request multiple streams that is
+ * expected to be used for the current request. But focus request itself
+ * is global behavior as GAIN or GAIN_TRANSIENT expects all sounds played
+ * by car's audio module to stop. Note that stream already allocated to
+ * android before this focus request must not be affected by focus
+ * request.
+ *
+ * Focus response (set and subscription callback for this property) must
+ * take the following form:
+ * int32Values[0]: VehicleAudioFocusState type
+ * int32Values[1]: bit flags of streams allowed.
+ * int32Values[2]: External focus state: bit flags of currently active
+ * audio focus in car side (outside Android). Active
+ * audio focus does not necessarily mean currently
+ * playing, but represents the state of having focus or
+ * waiting for focus (pause state).
+ * One or combination of flags from
+ * VehicleAudioExtFocusFlag.
+ * 0 means no active audio focus holder outside Android.
+ * The state must have following values for each
+ * VehicleAudioFocusState:
+ * GAIN: 0 or VehicleAudioExtFocusFlag#PLAY_ONLY_FLAG
+ * when radio is active in Android side.
+ * GAIN_TRANSIENT: 0. Can be
+ * VehicleAudioExtFocusFlag#PERMANENT_FLAG or
+ * VehicleAudioExtFocusFlag#TRANSIENT_FLAG if android
+ * side has requested
+ * REQUEST_GAIN_TRANSIENT_MAY_DUCK and car side is
+ * ducking.
+ * LOSS: 0 when no focus is audio is active in car side.
+ * VehicleAudioExtFocusFlag#PERMANENT_FLAG when car
+ * side is playing something permanent.
+ * LOSS_TRANSIENT: always must be
+ * VehicleAudioExtFocusFlag#PERMANENT_FLAG
+ * int32Values[3]: context requested by android side when responding to
+ * focus request. When car side is taking focus away,
+ * this must be zero.
+ *
+ * A focus response must be sent per each focus request even if there is
+ * no change in focus state. This can happen in case like focus request
+ * only involving context change where android side still needs matching
+ * focus response to confirm that audio module has made necessary changes.
+ *
+ * If car does not support AUDIO_FOCUS, focus is assumed to be granted
+ * always.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ AUDIO_FOCUS = (
+ 0x0900
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to control audio volume of each audio context.
+ *
+ * VehiclePropConfig
+ * configArray[0] : bit flags of all supported audio contexts. If this
+ * is 0, audio volume is controlled per physical stream
+ * configArray[1] : flags defined in VehicleAudioVolumeCapabilityFlag to
+ * represent audio module's capability.
+ *
+ * Data type looks like:
+ * int32Values[0] : stream context as defined in VehicleAudioContextFlag.
+ * If only physical stream is supported
+ * (configArray[0] == 0), this must represent physical
+ stream number.
+ * int32Values[1] : volume level, valid range is 0 to int32MaxValue
+ * defined in config.
+ * 0 must be mute state. int32MinValue config must be
+ * always 0.
+ * int32Values[2] : One of VehicleAudioVolumeState.
+ *
+ * This property requires per stream based get. HAL implementation must
+ * check stream number in get call to return the right volume.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @config_flags all audio contexts supported.
+ */
+ AUDIO_VOLUME = (
+ 0x0901
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property for handling volume limit set by user. This limits maximum
+ * volume that can be set per each context or physical stream.
+ *
+ * VehiclePropConfig
+ * configArray[0] : bit flags of all supported audio contexts. If this is
+ * 0, audio volume is controlled per physical stream.
+ * configArray[1] : flags defined in VehicleAudioVolumeCapabilityFlag
+ * to represent audio module's capability.
+ *
+ * Data type looks like:
+ * int32Values[0] : stream context as defined in VehicleAudioFocusFlag.
+ * If only physical stream is supported
+ * (configArray[0] == 0), this must represent physical
+ * stream number.
+ * int32Values[1] : maximum volume set to the stream. If there is no
+ * restriction, this value must be bigger than
+ * AUDIO_VOLUME's max value.
+ *
+ * If car does not support this feature, this property must not be
+ * populated by HAL.
+ * This property requires per stream based get. HAL implementation must
+ * check stream number in get call to return the right volume.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @config_flags all audio contexts supported.
+ */
+ AUDIO_VOLUME_LIMIT = (
+ 0x0902
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to share audio routing policy of android side. This property is
+ * set at the beginning to pass audio policy in android side down to
+ * vehicle HAL and car audio module.
+ * This can be used as a hint to adjust audio policy or other policy
+ * decision.
+ *
+ * int32Values[0] : audio stream where the audio for the application
+ * context must be routed by default. Note that this is
+ * the default setting from system, but each app may
+ * still use different audio stream for whatever reason.
+ * int32Values[1] : All audio contexts that must be sent through the
+ * physical stream. Flag is defined in
+ * VehicleAudioFocusFlag.
+
+ * Setting of this property must be done for all available physical streams
+ * based on audio H/W variant information acquired from AUDIO_HW_VARIANT
+ * property.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:WRITE
+ */
+ AUDIO_ROUTING_POLICY = (
+ 0x0903
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to return audio H/W variant type used in this car. This allows
+ * android side to support different audio policy based on H/W variant used.
+ * Note that other components like CarService may need overlay update to
+ * support additional variants. If this property does not
+ * exist, default audio policy must be used.
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ * @config_flags Additional info on audio H/W. Must use
+ * VehicleAudioHwVariantConfigFlag for this.
+ */
+ AUDIO_HW_VARIANT = (
+ 0x0904
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to pass hint on external audio routing. When android side
+ * request focus with VehicleAudioExtFocusflag, this
+ * property must be set before setting AUDIO_FOCUS property as a hint for
+ * external audio source routing.
+ * Note that setting this property alone must not trigger any change.
+ * Audio routing must be changed only when AUDIO_FOCUS property is set.
+ * Note that this property allows passing custom value as long as it is
+ * defined in VehiclePropConfig#configString. This allows supporting
+ * non-standard routing options through this property.
+ * It is recommended to use separate name space for custom property to
+ * prevent conflict in future android releases.
+ * Enabling each external routing option is done by enabling each bit flag
+ * for the routing.
+ * This property can support up to 128 external routings.
+ * To give full flexibility, there is no standard definition for each bit
+ * flag and assigning each big flag to specific routing type is decided by
+ * VehiclePropConfig#configString. VehiclePropConfig#configString has
+ * format of each entry separated by ',' and each entry has format of
+ * bitFlagPositon:typeString[:physicalStreamNumber].
+ * bitFlagPosition: represents which big flag will be set to enable this
+ * routing. 0 means
+ * LSB in int32Values[0]. 31 will be MSB in int32Values[0]. 127 will MSB
+ * in int32Values[3].
+ * typeString: string representation of external routing. Some types are
+ * already defined in AUDIO_EXT_ROUTING_SOURCE_* and use them first
+ * before adding something custom. Applications will find each routing
+ * using this string.
+ * physicalStreamNumber: This part is optional and represents physical
+ * stream to android which will be disabled when this routing is enabled.
+ * If not specified, this routing must not affect physical streams to
+ * android.
+ * As an example, let's assume a system with two physical streams, 0 for
+ * media and 1 for nav guidance. And let's assume external routing option
+ * of am fm radio, external navigation guidance, satellite radio, and one
+ * custom. Let's assume that radio and satellite replaces physical stream 0
+ * and external navigation replaces physical stream 1. And bit flag will be
+ * assigned in the order listed above. This configuration will look like
+ * this in config_string:
+ * "0:RADIO_AM_FM:0,1:EXT_NAV_GUIDANCE:1,2:RADIO_SATELLITE:0,3:com.test.SOMETHING_CUSTOM"
+ * When android requests RADIO_AM_FM, int32Values[0] will be set to 0x1.
+ * When android requests RADIO_SATELLITE + EXT_NAV_GUIDANCE, int32Values[0]
+ * will be set to 0x2|0x4.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:WRITE|VehiclePropertyAccess:READ_WRITE
+ * @config_string List of all avaiable external source in the system.
+ */
+ AUDIO_EXT_ROUTING_HINT = (
+ 0x0905
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Index in int32Values for AP_POWER_STATE property.
+ */
+ AP_POWER_STATE = (0x00000A00),
+
+ /*
+ * Property to represent brightness of the display. Some cars have single
+ * control for the brightness of all displays and this property is to share
+ * change in that control.
+ *
+ * If this is writable, android side can set this value when user changes
+ * display brightness from Settings. If this is read only, user may still
+ * change display brightness from Settings, but that will not be reflected
+ * to other displays.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ|VehiclePropertyAccess:READ_WRITE
+ */
+ DISPLAY_BRIGHTNESS = (
+ 0x0A01
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to report bootup reason for the current power on. This is a
+ * static property that will not change for the whole duration until power
+ * off. For example, even if user presses power on button after automatic
+ * power on with door unlock, bootup reason must stay with
+ * VehicleApPowerBootupReason#USER_UNLOCK.
+ *
+ * int32Values[0] must be VehicleApPowerBootupReason.
+ *
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
+ */
+ AP_POWER_BOOTUP_REASON = (
+ 0x0A02
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to feed H/W input events to android
+ *
+ * int32Values[0] : action defined by VehicleHwKeyInputAction
+ * int32Values[1] : key code, must use standard android key code
+ * int32Values[2] : target display defined in VehicleDisplay. Events not
+ * tied to specific display must be sent to
+ * VehicleDisplay#MAIN.
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
+ * @config_flags
+ */
+ HW_KEY_INPUT = (
+ 0x0A10
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Property to define instrument cluster information.
+ * For VehicleInstrumentClusterType:EXTERNAL_DISPLAY:
+ * READ:
+ * int32Values[0] : The current screen mode index. Screen mode is defined
+ * as a configuration in car service and represents
+ * which area of screen is renderable.
+ * int32Values[1] : Android can render to instrument cluster (=1) or
+ * not(=0). When this is 0, instrument cluster may be
+ * rendering some information in the area allocated for
+ * android and android side rendering is invisible.
+ * WRITE from android:
+ * int32Values[0] : Preferred mode for android side. Depending on the app
+ * rendering to instrument cluster, preferred mode can
+ * change. Instrument cluster still needs to send
+ * event with new mode to trigger actual mode change.
+ * int32Values[1] : The current app context relevant for instrument
+ * cluster. Use the same flag with VehicleAudioFocusFlag
+ * but this context represents active apps, not
+ * active audio. Instrument cluster side may change mode
+ * depending on the currently active contexts.
+ * When system boots up, Android side will write {0, 0, 0, 0} when it is
+ * ready to render to instrument cluster. Before this message, rendering
+ * from android must not be visible in the cluster.
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @configArray 0:VehicleInstrumentClusterType 1:hw type
+ */
+ INSTRUMENT_CLUSTER_INFO = (
+ 0x0A20
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32_VEC
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Current date and time, encoded as Unix time.
+ * This value denotes the number of seconds that have elapsed since
+ * 1/1/1970.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_SET
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @unit VehicleUnit:SECS
+ */
+ UNIX_TIME = (
+ 0x0A30
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT64
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Current time only.
+ * Some vehicles may not keep track of date. This property only affects
+ * the current time, in seconds during the day. Thus, the max value for
+ * this parameter is 86,400 (24 * 60 * 60)
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_SET
+ * @access VehiclePropertyAccess:READ_WRITE
+ * @unit VehicleUnit:SECS
+ */
+ CURRENT_TIME_IN_SECONDS = (
+ 0x0A31
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Door position
+ *
+ * This is an integer in case a door may be set to a particular position.
+ * Max value indicates fully open, min value (0) indicates fully closed.
+ *
+ * Some vehicles (minivans) can open the door electronically. Hence, the
+ * ability to write this property.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ|VehiclePropertyAccess:WRITE
+ */
+ DOOR_POS = (
+ 0x0B00
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:DOOR),
+
+ /*
+ * Door move
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ DOOR_MOVE = (
+ 0x0B01
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:DOOR),
+
+ /*
+ * Door lock
+ *
+ * 'true' indicates door is locked
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ DOOR_LOCK = (
+ 0x0B02
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:DOOR),
+
+ /*
+ * Mirror Z Position
+ *
+ * Positive value indicates tilt upwards, negative value is downwards
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ MIRROR_Z_POS = (
+ 0x0B40
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:MIRROR),
+
+ /*
+ * Mirror Z Move
+ *
+ * Positive value indicates tilt upwards, negative value is downwards
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ MIRROR_Z_MOVE = (
+ 0x0B41
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:MIRROR),
+
+ /*
+ * Mirror Y Position
+ *
+ * Positive value indicate tilt right, negative value is left
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ MIRROR_Y_POS = (
+ 0x0B42
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:MIRROR),
+
+ /*
+ * Mirror Y Move
+ *
+ * Positive value indicate tilt right, negative value is left
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ MIRROR_Y_MOVE = (
+ 0x0B43
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:MIRROR),
+
+ /*
+ * Mirror Lock
+ *
+ * True indicates mirror positions are locked and not changeable
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ MIRROR_LOCK = (
+ 0x0B44
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Mirror Heat
+ *
+ * Increase values denote higher heating levels.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ MIRROR_HEAT = (
+ 0x0B45
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Mirror Fold
+ *
+ * True indicates mirrors are folded
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ MIRROR_FOLD = (
+ 0x0B46
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Seat memory set
+ *
+ * This setting allows the user to save the current seat position settings
+ * into the selected preset slot. The maxValue for each seat position shall
+ * match the maxValue for SEAT_MEMORY_SELECT.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:WRITE
+ */
+ SEAT_MEMORY_SELECT = (
+ 0x0B80
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat memory set
+ *
+ * This setting allows the user to save the current seat position settings
+ * into the selected preset slot. The maxValue for each seat position
+ * shall match the maxValue for SEAT_MEMORY_SELECT.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:WRITE
+ */
+ SEAT_MEMORY_SET = (
+ 0x0B81
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seatbelt buckled
+ *
+ * True indicates belt is buckled.
+ *
+ * Write access indicates automatic seat buckling capabilities. There are
+ * no known cars at this time, but you never know...
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ|VehiclePropertyAccess:WRITE
+ */
+ SEAT_BELT_BUCKLED = (
+ 0x0B82
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:SEAT),
+
+ /*
+ * Seatbelt height position
+ *
+ * Adjusts the shoulder belt anchor point.
+ * Max value indicates highest position
+ * Min value indicates lowest position
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_BELT_HEIGHT_POS = (
+ 0x0B83
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seatbelt height move
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_BELT_HEIGHT_MOVE = (
+ 0x0B84
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat fore/aft position
+ *
+ * Sets the seat position forward (closer to steering wheel) and backwards.
+ * Max value indicates closest to wheel, min value indicates most rearward
+ * position.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_FORE_AFT_POS = (
+ 0x0B85
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat fore/aft move
+ *
+ * Moves the seat position forward and aft.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_FORE_AFT_MOVE = (
+ 0x0B86
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat backrest angle 1 position
+ *
+ * Backrest angle 1 is the actuator closest to the bottom of the seat.
+ * Max value indicates angling forward towards the steering wheel.
+ * Min value indicates full recline.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_BACKREST_ANGLE_1_POS = (
+ 0x0B87
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat backrest angle 1 move
+ *
+ * Moves the backrest forward or recline.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_BACKREST_ANGLE_1_MOVE = (
+ 0x0B88
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat backrest angle 2 position
+ *
+ * Backrest angle 2 is the next actuator up from the bottom of the seat.
+ * Max value indicates angling forward towards the steering wheel.
+ * Min value indicates full recline.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_BACKREST_ANGLE_2_POS = (
+ 0x0B89
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat backrest angle 2 move
+ *
+ * Moves the backrest forward or recline.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_BACKREST_ANGLE_2_MOVE = (
+ 0x0B8A
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat height position
+ *
+ * Sets the seat height.
+ * Max value indicates highest position.
+ * Min value indicates lowest position.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_HEIGHT_POS = (
+ 0x0B8B
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat height move
+ *
+ * Moves the seat height.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_HEIGHT_MOVE = (
+ 0x0B8C
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat depth position
+ *
+ * Sets the seat depth, distance from back rest to front edge of seat.
+ * Max value indicates longest depth position.
+ * Min value indicates shortest position.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_DEPTH_POS = (
+ 0x0B8D
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat depth move
+ *
+ * Adjusts the seat depth.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_DEPTH_MOVE = (
+ 0x0B8E
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat tilt position
+ *
+ * Sets the seat tilt.
+ * Max value indicates front edge of seat higher than back edge.
+ * Min value indicates front edge of seat lower than back edge.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_TILT_POS = (
+ 0x0B8F
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Seat tilt move
+ *
+ * Tilts the seat.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_TILT_MOVE = (
+ 0x0B90
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Lumber fore/aft position
+ *
+ * Pushes the lumbar support forward and backwards
+ * Max value indicates most forward position.
+ * Min value indicates most rearward position.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_LUMBAR_FORE_AFT_POS = (
+ 0x0B91
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Lumbar fore/aft move
+ *
+ * Adjusts the lumbar support.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_LUMBAR_FORE_AFT_MOVE = (
+ 0x0B92
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Lumbar side support position
+ *
+ * Sets the amount of lateral lumbar support.
+ * Max value indicates widest lumbar setting (i.e. least support)
+ * Min value indicates thinnest lumbar setting.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_LUMBAR_SIDE_SUPPORT_POS = (
+ 0x0B93
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Lumbar side support move
+ *
+ * Adjusts the amount of lateral lumbar support.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_LUMBAR_SIDE_SUPPORT_MOVE = (
+ 0x0B94
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Headrest height position
+ *
+ * Sets the headrest height.
+ * Max value indicates tallest setting.
+ * Min value indicates shortest setting.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_HEADREST_HEIGHT_POS = (
+ 0x0B95
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Headrest heigh move
+ *
+ * Moves the headrest up and down.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_HEADREST_HEIGHT_MOVE = (
+ 0x0B96
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Headrest angle position
+ *
+ * Sets the angle of the headrest.
+ * Max value indicates most upright angle.
+ * Min value indicates shallowest headrest angle.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_HEADREST_ANGLE_POS = (
+ 0x0B97
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Headrest angle move
+ *
+ * Adjusts the angle of the headrest
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_HEADREST_ANGLE_MOVE = (
+ 0x0B98
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ SEAT_HEADREST_FORE_AFT_POS = (
+ 0x0B99
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ SEAT_HEADREST_FORE_AFT_MOVE = (
+ 0x0B9A
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:SEAT),
+
+ /*
+ * Window Position
+ *
+ * Max = window up / closed
+ * Min = window down / open
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ WINDOW_POS = (
+ 0x0BC0
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Window Move
+ *
+ * Max = window up / closed
+ * Min = window down / open
+ * Magnitude denotes relative speed. I.e. +2 is faster than +1 in raising
+ * the window.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ WINDOW_MOVE = (
+ 0x0BC1
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Window Vent Position
+ *
+ * This feature is used to control the vent feature on a sunroof.
+ *
+ * Max = vent open
+ * Min = vent closed
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ WINDOW_VENT_POS = (
+ 0x0BC2
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Window Vent Move
+ *
+ * This feature is used to control the vent feature on a sunroof.
+ *
+ * Max = vent open
+ * Min = vent closed
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE|VehiclePropertyAccess:WRITE
+ */
+ WINDOW_VENT_MOVE = (
+ 0x0BC3
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:INT32
+ | VehicleArea:GLOBAL),
+
+ /*
+ * Window Lock
+ *
+ * True indicates windows are locked and can't be moved.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
+ */
+ WINDOW_LOCK = (
+ 0x0BC4
+ | VehiclePropertyGroup:SYSTEM
+ | VehiclePropertyType:BOOLEAN
+ | VehicleArea:GLOBAL),
+};
+
+/*
+ * Bit flags for fan direction
+ */
+enum VehicleHvacFanDirection : int32_t {
+ FACE = 0x1,
+ FLOOR = 0x2,
+ FACE_AND_FLOOR = 0x3,
+ DEFROST = 0x4,
+ DEFROST_AND_FLOOR = 0x5,
+};
+
+/*
+ * Constants relevant to radio.
+ */
+enum VehicleRadioConstants : int32_t {
+ /* Minimum value for the radio preset */
+ VEHICLE_RADIO_PRESET_MIN_VALUE = 1,
+};
+
+enum VehicleAudioFocusRequest : int32_t {
+ REQUEST_GAIN = 0x1,
+ REQUEST_GAIN_TRANSIENT = 0x2,
+ REQUEST_GAIN_TRANSIENT_MAY_DUCK = 0x3,
+ /*
+ * This is for the case where android side plays sound like UI feedback
+ * and car side does not need to duck existing playback as long as
+ * requested stream is available.
+ */
+ REQUEST_GAIN_TRANSIENT_NO_DUCK = 0x4,
+ REQUEST_RELEASE = 0x5,
+
+};
+
+enum VehicleAudioFocusState : int32_t {
+ /*
+ * Android side has permanent focus and can play allowed streams.
+ */
+ STATE_GAIN = 0x1,
+
+ /*
+ * Android side has transient focus and can play allowed streams.
+ */
+ STATE_GAIN_TRANSIENT = 0x2,
+
+ /*
+ * Car audio module is playing guidance kind of sound outside Android.
+ * Android side can still play through allowed streams with ducking.
+ */
+ STATE_LOSS_TRANSIENT_CAN_DUCK = 0x3,
+
+ /*
+ * Car audio module is playing transient sound outside Android. Android side
+ * must stop playing any sounds.
+ */
+ STATE_LOSS_TRANSIENT = 0x4,
+
+ /*
+ * Android side has lost focus and cannot play any sound.
+ */
+ STATE_LOSS = 0x5,
+
+ /*
+ * car audio module is playing safety critical sound, and Android side cannot
+ * request focus until the current state is finished. car audio module
+ * restore it to the previous state when it can allow Android to play.
+ */
+ STATE_LOSS_TRANSIENT_EXLCUSIVE = 0x6,
+
+};
+
+/*
+ * Flags to represent multiple streams by combining these.
+ */
+enum VehicleAudioStreamFlag : int32_t {
+ STREAM0_FLAG = (0x1 << 0),
+ STREAM1_FLAG = (0x1 << 1),
+ STREAM2_FLAG = (0x1 << 2),
+};
+
+/*
+ * Represents stream number (always 0 to N -1 where N is max number of streams).
+ * Can be used for audio related property expecting one stream.
+ */
+enum VehicleAudioStream : int32_t {
+ STREAM0 = 0,
+ STREAM1 = 1,
+};
+
+/*
+ * Flag to represent external focus state (outside Android).
+ */
+enum VehicleAudioExtFocusFlag : int32_t {
+ /*
+ * No external focus holder.
+ */
+ NONE_FLAG = 0x0,
+
+ /*
+ * Car side (outside Android) has component holding GAIN kind of focus state.
+ */
+ PERMANENT_FLAG = 0x1,
+
+ /*
+ * Car side (outside Android) has component holding GAIN_TRANSIENT kind of
+ * focus state.
+ */
+ TRANSIENT_FLAG = 0x2,
+
+ /*
+ * Car side is expected to play something while focus is held by Android side.
+ * One example can be radio attached in car side. But Android's radio app
+ * still must have focus, and Android side must be in GAIN state, but
+ * media stream will not be allocated to Android side and car side can play
+ * radio any time while this flag is active.
+ */
+ PLAY_ONLY_FLAG = 0x4,
+
+ /*
+ * Car side must mute any media including radio. This can be used with any
+ * focus request including GAIN* and RELEASE.
+ */
+ MUTE_MEDIA_FLAG = 0x8,
+};
+
+/*
+ * Index in int32Values for VehicleProperty#AUDIO_FOCUS property.
+ */
+enum VehicleAudioFocusIndex : int32_t {
+ FOCUS = 0,
+ STREAMS = 1,
+ EXTERNAL_FOCUS_STATE = 2,
+ AUDIO_CONTEXTS = 3,
+};
+
+/*
+ * Flags to tell the current audio context.
+ */
+enum VehicleAudioContextFlag : int32_t {
+ /* Music playback is currently active. */
+ MUSIC_FLAG = 0x1,
+
+ /* Navigation is currently running. */
+ NAVIGATION_FLAG = 0x2,
+
+ /* Voice command session is currently running. */
+ VOICE_COMMAND_FLAG = 0x4,
+
+ /* Voice call is currently active. */
+ CALL_FLAG = 0x8,
+
+ /*
+ * Alarm is active.
+ * This must be only used in VehicleProperty#AUDIO_ROUTING_POLICY.
+ */
+ ALARM_FLAG = 0x10,
+
+ /*
+ * Notification sound is active.
+ * This must be only used in VehicleProperty#AUDIO_ROUTING_POLICY.
+ */
+ NOTIFICATION_FLAG = 0x20,
+
+ /*
+ * Context unknown. Only used for VehicleProperty#AUDIO_ROUTING_POLICY to
+ * represent default stream for unknown contents.
+ */
+ UNKNOWN_FLAG = 0x40,
+
+ /* Safety alert / warning is played. */
+ SAFETY_ALERT_FLAG = 0x80,
+
+ /* CD / DVD kind of audio is played */
+ CD_ROM_FLAG = 0x100,
+
+ /* Aux audio input is played */
+ AUX_AUDIO_FLAG = 0x200,
+
+ /* system sound like UI feedback */
+ SYSTEM_SOUND_FLAG = 0x400,
+
+ /* Radio is played */
+ RADIO_FLAG = 0x800,
+
+ /* Ext source is played. This is for tagging generic ext sources. */
+ EXT_SOURCE_FLAG = 0x1000,
+};
+
+/*
+ * flags to represent capability of audio volume property.
+ * used in configArray[1] of VehiclePropConfig.
+ */
+enum VehicleAudioVolumeCapabilityFlag : int32_t {
+ /*
+ * External audio module or vehicle hal has persistent storage
+ * to keep the volume level. This must be set only when per context
+ * volume level is supproted. When this is set, audio volume level per
+ * each context will be retrieved from the property when systen starts up.
+ * And external audio module is also expected to adjust volume automatically
+ * whenever there is an audio context change.
+ * When this flag is not set, android side will assume that there is no
+ * persistent storage and stored value in android side will be used to
+ * initialize the volume level. And android side will set volume level
+ * of each physical streams whenever there is an audio context change.
+ */
+ PERSISTENT_STORAGE = 0x1,
+
+ /*
+ * When this flag is set, the H/W can support only single master volume for
+ * all streams.
+ * There is no way to set volume level differently per each stream or context.
+ */
+ MASTER_VOLUME_ONLY = 0x2,
+};
+
+/*
+ * enum to represent audio volume state.
+ */
+enum VehicleAudioVolumeState : int32_t {
+ STATE_OK = 0,
+
+ /*
+ * Audio volume has reached volume limit set in
+ * VehicleProperty#AUDIO_VOLUME_LIMIT and user's request to increase volume
+ * further is not allowed.
+ */
+ LIMIT_REACHED = 1,
+};
+
+/*
+ * Index in int32Values for VehicleProperty#AUDIO_VOLUME property.
+ */
+enum VehicleAudioVolumeIndex : int32_t {
+ INDEX_STREAM = 0,
+ INDEX_VOLUME = 1,
+ NDEX_STATE = 2,
+};
+
+/*
+ * Index in int32Values for VehicleProperty#AUDIO_VOLUME_LIMIT property.
+ */
+enum VehicleAudioVolumeLimitIndex : int32_t {
+ STREAM = 0,
+ MAX_VOLUME = 1,
+};
+
+/*
+ * Index in int32Values for VehicleProperty#AUDIO_ROUTING_POLICY property.
+ */
+enum VehicleAudioRoutingPolicyIndex : int32_t {
+ STREAM = 0,
+ CONTEXTS = 1,
+};
+
+/*
+ * Flag to be used in VehiclePropConfig#configFlags for
+ * VehicleProperty#AUDIO_HW_VARIANT.
+ */
+enum VehicleAudioHwVariantConfigFlag : int32_t {
+ /*
+ * Flag to tell that radio is internal to android and radio must
+ * be treated like other android stream like media.
+ * When this flag is not set or AUDIO_HW_VARIANT does not exist,
+ * radio is treated as external module. This brins some delta in audio focus
+ * handling as well.
+ */
+ INTERNAL_RADIO_FLAG = 0x1,
+};
+
+enum VehicleApPowerStateConfigFlag : int32_t /* NOTE: type is guessed */ {
+ /*
+ * AP can enter deep sleep state. If not set, AP will always shutdown from
+ * VehicleApPowerState#SHUTDOWN_PREPARE power state.
+ */
+ ENABLE_DEEP_SLEEP_FLAG = 0x1,
+
+ /*
+ * The power controller can power on AP from off state after timeout
+ * specified in VehicleApPowerSet VEHICLE_AP_POWER_SET_SHUTDOWN_READY message.
+ */
+ CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2,
+};
+
+enum VehicleApPowerState : int32_t /* NOTE: type is guessed */ {
+ /* vehicle HAL will never publish this state to AP */
+ OFF = 0,
+
+ /* vehicle HAL will never publish this state to AP */
+ DEEP_SLEEP = 1,
+
+ /* AP is on but display must be off. */
+ ON_DISP_OFF = 2,
+
+ /* AP is on with display on. This state allows full user interaction. */
+ ON_FULL = 3,
+
+ /*
+ * The power controller has requested AP to shutdown. AP can either enter
+ * sleep state or start full shutdown. AP can also request postponing
+ * shutdown by sending VehicleApPowerSetState#SHUTDOWN_POSTPONE message. The
+ * power controller must change power state to this state to shutdown
+ * system.
+ *
+ * int32Values[1] : one of enum_vehicle_ap_power_state_shutdown_param_type
+ */
+ SHUTDOWN_PREPARE = 4,
+};
+
+enum VehicleApPowerStateShutdownParam : int32_t {
+ /* AP must shutdown immediately. Postponing is not allowed. */
+ SHUTDOWN_IMMEDIATELY = 1,
+
+ /* AP can enter deep sleep instead of shutting down completely. */
+ CAN_SLEEP = 2,
+
+ /* AP can only shutdown with postponing allowed. */
+ SHUTDOWN_ONLY = 3,
+};
+
+enum VehicleApPowerSetState : int32_t /* NOTE: type is guessed */ {
+ /*
+ * AP has finished boot up, and can start shutdown if requested by power
+ * controller.
+ */
+ BOOT_COMPLETE = 0x1,
+
+ /*
+ * AP is entering deep sleep state. How this state is implemented may vary
+ * depending on each H/W, but AP's power must be kept in this state.
+ */
+ DEEP_SLEEP_ENTRY = 0x2,
+
+ /*
+ * AP is exiting from deep sleep state, and is in
+ * VehicleApPowerState#SHUTDOWN_PREPARE state.
+ * The power controller may change state to other ON states based on the
+ * current state.
+ */
+ DEEP_SLEEP_EXIT = 0x3,
+
+ /*
+ * int32Values[1]: Time to postpone shutdown in ms. Maximum value can be
+ * 5000 ms.
+ * If AP needs more time, it will send another POSTPONE
+ * message before the previous one expires.
+ */
+ SHUTDOWN_POSTPONE = 0x4,
+
+ /*
+ * AP is starting shutting down. When system completes shutdown, everything
+ * will stop in AP as kernel will stop all other contexts. It is
+ * responsibility of vehicle HAL or lower level to synchronize that state
+ * with external power controller. As an example, some kind of ping
+ * with timeout in power controller can be a solution.
+ *
+ * int32Values[1]: Time to turn on AP in secs. Power controller may turn on
+ * AP after specified time so that AP can run tasks like
+ * update. If it is set to 0, there is no wake up, and power
+ * controller may not necessarily support wake-up. If power
+ * controller turns on AP due to timer, it must start with
+ * VehicleApPowerState#ON_DISP_OFF state, and after
+ * receiving VehicleApPowerSetState#BOOT_COMPLETE, it shall
+ * do state transition to
+ * VehicleApPowerState#SHUTDOWN_PREPARE.
+ */
+ SHUTDOWN_START = 0x5,
+
+ /*
+ * User has requested to turn off headunit's display, which is detected in
+ * android side.
+ * The power controller may change the power state to
+ * VehicleApPowerState#ON_DISP_OFF.
+ */
+ DISPLAY_OFF = 0x6,
+
+ /*
+ * User has requested to turn on headunit's display, most probably from power
+ * key input which is attached to headunit. The power controller may change
+ * the power state to VehicleApPowerState#ON_FULL.
+ */
+ DISPLAY_ON = 0x7,
+};
+
+/*
+ * Index in int32Values for VehicleProperty#AP_POWER_STATE property.
+ */
+enum VehicleApPowerStateIndex : int32_t {
+ STATE = 0,
+ ADDITIONAL = 1,
+};
+
+/*
+ * Enum to represent bootup reason.
+ */
+enum VehicleApPowerBootupReason : int32_t {
+ /*
+ * Power on due to user's pressing of power key or rotating of ignition
+ * switch.
+ */
+ USER_POWER_ON = 0,
+
+ /*
+ * Automatic power on triggered by door unlock or any other kind of automatic
+ * user detection.
+ */
+ USER_UNLOCK = 1,
+
+ /*
+ * Automatic power on triggered by timer. This only happens when AP has asked
+ * wake-up after
+ * certain time through time specified in
+ * VehicleApPowerSetState#SHUTDOWN_START.
+ */
+ TIMER = 2,
+};
+
+enum VehicleHwKeyInputAction : int32_t {
+ /* Key down */
+ ACTION_DOWN = 0,
+
+ /* Key up */
+ ACTION_UP = 1,
+};
+
+enum VehicleDisplay : int32_t {
+ /* center console */
+ MAIN = 0,
+
+ INSTRUMENT_CLUSTER = 1,
+};
+
+/*
+ * Represents instrument cluster type available in system
+ */
+enum VehicleInstrumentClusterType : int32_t {
+ /* Android has no access to instument cluster */
+ NONE = 0,
+
+ /*
+ * Instrument cluster can communicate through vehicle hal with additional
+ * properties to exchange meta-data
+ */
+ HAL_INTERFACE = 1,
+
+ /*
+ * Instrument cluster is external display where android can render contents
+ */
+ EXTERNAL_DISPLAY = 2,
+};
+
+/*
+ * Units used for int or float type with no attached enum types.
+ */
+enum VehicleUnit : int32_t {
+ SHOULD_NOT_USE = 0x000,
+
+ METER_PER_SEC = 0x01,
+ RPM = 0x02,
+ HZ = 0x03,
+ PERCENTILE = 0x10,
+ MILLIMETER = 0x20,
+ METER = 0x21,
+ KILOMETER = 0x23,
+ CELCIUS = 0x30,
+ MILLILITER = 0x40,
+ NANO_SECS = 0x50,
+ SECS = 0x53,
+ YEAR = 0x59,
+};
+
+ /*
+ * This describes how value of property can change.
+ */
+enum VehiclePropertyChangeMode : int32_t {
+ /*
+ * Property of this type must never be changed. Subscription is not supported
+ * for these properties.
+ */
+ STATIC = 0x00,
+
+ /*
+ * Property of this type must be reported when there is a change.
+ * IVehicle#get call must return the current value.
+ * Set operation for this property is assumed to be asynchronous. When the
+ * property is read (using IVehicle#get) after IVehicle#set, it may still
+ * return old value until underlying H/W backing this property has actually
+ * changed the state. Once state is changed, the property must dispatch
+ * changed value as event.
+ */
+ ON_CHANGE = 0x01,
+
+ /*
+ * Property of this type change continuously and requires fixed rate of
+ * sampling to retrieve the data.
+ */
+ CONTINUOUS = 0x02,
+
+ /*
+ * Property of this type may be polled to get the current value.
+ */
+ POLL = 0x03,
+
+ /*
+ * This is for property where change event must be sent only when the
+ * value is set from external component. Normal value change must not trigger
+ * event. For example, clock property can send change event only when it is
+ * set, outside android, for case like user setting time or time getting
+ * update. There is no need to send it per every value change.
+ */
+ ON_SET = 0x04,
+};
+
+/*
+ * Property config defines the capabilities of it. User of the API
+ * must first get the property config to understand the output from get()
+ * commands and also to ensure that set() or events commands are in sync with
+ * the expected output.
+ */
+enum VehiclePropertyAccess : int32_t {
+ READ = 0x01,
+ WRITE = 0x02,
+ READ_WRITE = 0x03,
+};
+
+/*
+ * These permissions define how the OEMs want to distribute their information
+ * and security they want to apply. On top of these restrictions, android will
+ * have additional 'app-level' permissions that the apps will need to ask the
+ * user before the apps have the information.
+ * This information must be kept in VehiclePropConfig#permissionModel.
+ */
+enum VehiclePermissionModel : int32_t {
+ /*
+ * No special restriction, but each property can still require specific
+ * android app-level permission.
+ */
+ NO_RESTRICTION = 0,
+
+ /* Signature only. Only APKs signed with OEM keys are allowed. */
+ OEM_ONLY = 0x1,
+
+ /* System only. APKs built-in to system can access the property. */
+ SYSTEM_APP_ONLY = 0x2,
+
+ /* Equivalent to “system|signature” */
+ OEM_OR_SYSTEM_APP = 0x3,
+};
+
+/*
+ * Car states.
+ *
+ * The driving states determine what features of the UI will be accessible.
+ */
+enum VehicleDrivingStatus : int32_t {
+ UNRESTRICTED = 0x00,
+ NO_VIDEO = 0x01,
+ NO_KEYBOARD_INPUT = 0x02,
+ NO_VOICE_INPUT = 0x04,
+ NO_CONFIG = 0x08,
+ LIMIT_MESSAGE_LEN = 0x10,
+};
+
+/*
+ * Various gears which can be selected by user and chosen in system.
+ */
+enum VehicleGear: int32_t {
+ GEAR_NEUTRAL = 0x0001,
+ GEAR_REVERSE = 0x0002,
+ GEAR_PARK = 0x0004,
+ GEAR_DRIVE = 0x0008,
+ GEAR_LOW = 0x0010,
+ GEAR_1 = 0x0010,
+ GEAR_2 = 0x0020,
+ GEAR_3 = 0x0040,
+ GEAR_4 = 0x0080,
+ GEAR_5 = 0x0100,
+ GEAR_6 = 0x0200,
+ GEAR_7 = 0x0400,
+ GEAR_8 = 0x0800,
+ GEAR_9 = 0x1000,
+};
+
+/*
+ * Various zones in the car.
+ *
+ * Zones are used for Air Conditioning purposes and divide the car into physical
+ * area zones.
+ */
+enum VehicleAreaZone : int32_t {
+ ROW_1_LEFT = 0x00000001,
+ ROW_1_CENTER = 0x00000002,
+ ROW_1_RIGHT = 0x00000004,
+ ROW_1 = 0x00000008,
+ ROW_2_LEFT = 0x00000010,
+ ROW_2_CENTER = 0x00000020,
+ ROW_2_RIGHT = 0x00000040,
+ ROW_2 = 0x00000080,
+ ROW_3_LEFT = 0x00000100,
+ ROW_3_CENTER = 0x00000200,
+ ROW_3_RIGHT = 0x00000400,
+ ROW_3 = 0x00000800,
+ ROW_4_LEFT = 0x00001000,
+ ROW_4_CENTER = 0x00002000,
+ ROW_4_RIGHT = 0x00004000,
+ ROW_4 = 0x00008000,
+ WHOLE_CABIN = 0x80000000,
+};
+
+/*
+ * Various Seats in the car.
+ */
+enum VehicleAreaSeat : int32_t {
+ ROW_1_PASSENGER_LEFT = 0x0001,
+ ROW_1_PASSENGER_CENTER = 0x0002,
+ ROW_1_PASSENGER_RIGHT = 0x0004,
+ ROW_2_PASSENGER_LEFT = 0x0010,
+ ROW_2_PASSENGER_CENTER = 0x0020,
+ ROW_2_PASSENGER_RIGHT = 0x0040,
+ ROW_3_PASSENGER_LEFT = 0x0100,
+ ROW_3_PASSENGER_CENTER = 0x0200,
+ ROW_3_PASSENGER_RIGHT = 0x0400,
+};
+
+/*
+ * Various windshields/windows in the car.
+ */
+enum VehicleAreaWindow : int32_t {
+ FRONT_WINDSHIELD = 0x0001,
+ REAR_WINDSHIELD = 0x0002,
+ ROOF_TOP = 0x0004,
+ ROW_1_LEFT = 0x0010,
+ ROW_1_RIGHT = 0x0020,
+ ROW_2_LEFT = 0x0100,
+ ROW_2_RIGHT = 0x0200,
+ ROW_3_LEFT = 0x1000,
+ ROW_3_RIGHT = 0x2000,
+};
+
+enum VehicleAreaDoor : int32_t {
+ ROW_1_LEFT = 0x00000001,
+ ROW_1_RIGHT = 0x00000004,
+ ROW_2_LEFT = 0x00000010,
+ ROW_2_RIGHT = 0x00000040,
+ ROW_3_LEFT = 0x00000100,
+ ROW_3_RIGHT = 0x00000400,
+ HOOD = 0x10000000,
+ REAR = 0x20000000,
+};
+
+enum VehicleAreaMirror : int32_t {
+ DRIVER_LEFT = 0x00000001,
+ DRIVER_RIGHT = 0x00000002,
+ DRIVER_CENTER = 0x00000004,
+};
+
+enum VehicleTurnSignal : int32_t {
+ NONE = 0x00,
+ RIGHT = 0x01,
+ LEFT = 0x02,
+ EMERGENCY = 0x04,
+};
+
+struct VehicleAreaConfig {
+ /*
+ * Area id is ignored for VehiclePropertyGroup:GLOBAL properties.
+ */
+ int32_t areaId;
+
+ int32_t minInt32Value;
+ int32_t maxInt32Value;
+
+ int64_t minInt64Value;
+ int64_t maxInt64Value;
+
+ float minFloatValue;
+ float maxFloatValue;
+};
+
+struct VehiclePropConfig {
+ VehicleProperty prop;
+
+ /*
+ * Defines if the property is read or write or both.
+ */
+ VehiclePropertyAccess access;
+
+ /*
+ * Defines the change mode of the property.
+ */
+ VehiclePropertyChangeMode changeMode;
+
+ /*
+ * Defines permission model to access the data.
+ */
+ VehiclePermissionModel permissionModel;
+
+ /*
+ * Some of the properties may have associated areas (for example, some hvac
+ * properties are associated with VehicleAreaZone), in these
+ * cases the config may contain an ORed value for the associated areas.
+ */
+ int32_t supportedAreas;
+
+ /*
+ * Contains per-area configuration.
+ */
+ vec<VehicleAreaConfig> areaConfigs;
+
+ /*
+ * Configuration flags for this property.
+ *
+ * For example, it may store the number of presets that are stored by the
+ * radio module.
+ */
+ int32_t configFlags;
+
+ /* Contains additional configuration parameters */
+ vec<int32_t> configArray;
+
+ /*
+ * Some properties may require additional information passed over this
+ * string. Most properties do not need to set this.
+ */
+ string configString;
+
+ /*
+ * Min sample rate in Hz.
+ * Must be defined for VehiclePropertyChangeMode::CONTINUOUS
+ */
+ float minSampleRate;
+
+ /*
+ * Must be defined for VehiclePropertyChangeMode::CONTINUOUS
+ * Max sample rate in Hz.
+ */
+ float maxSampleRate;
+};
+
+/*
+ * Encapsulates the property name and the associated value. It
+ * is used across various API calls to set values, get values or to register for
+ * events.
+ */
+struct VehiclePropValue {
+ /* Property identifier */
+ VehicleProperty prop;
+
+ /* Time is elapsed nanoseconds since boot */
+ int64_t timestamp;
+
+ /*
+ * Area type(s) for non-global property it must be one of the value from
+ * VehicleArea* enums or 0 for global properties.
+ */
+ int32_t areaId;
+
+ /*
+ * Contains value for a single property. Depending on property data type of
+ * this property (VehiclePropetyType) one field of this structure must be filled in.
+ */
+ struct RawValue {
+ /*
+ * This is used for properties of types VehiclePropertyType#INT
+ * and VehiclePropertyType#INT_VEC
+ */
+ vec<int32_t> int32Values;
+
+ /*
+ * This is used for properties of types VehiclePropertyType#FLOAT
+ * and VehiclePropertyType#FLOAT_VEC
+ */
+ vec<float> floatValues;
+
+ /* This is used for properties of type VehiclePropertyType#INT64 */
+ vec<int64_t> int64Values;
+
+ /* This is used for properties of type VehiclePropertyType#BYTES */
+ vec<uint8_t> bytes;
+
+ /* This is used for properties of type VehiclePropertyType#STRING */
+ string stringValue;
+ };
+
+ RawValue value;
+};
+
+
+/*
+ * Represent the operation where the current error has happened.
+ */
+enum VehiclePropertyOperation : int32_t {
+ /*
+ * Generic error to this property which is not tied to any operation.
+ */
+ GENERIC = 0,
+
+ /*
+ * Error happened while handling property set.
+ */
+ SET = 1,
+
+ /*
+ * Error happened while handling property get.
+ */
+ GET = 2,
+
+ /*
+ * Error happened while handling property subscription.
+ */
+ SUBSCRIBE = 3,
+};
+
+
+enum SubscribeFlags {
+ UNDEFINED = 0x0,
+
+ /* Subscribe to event that was originated in vehicle HAL (most luckly this
+ * event came from vehicle itself). */
+ HAL_EVENT = 0x1,
+
+ /* Use this flag to subscribe on events when IVehicle#set(...) was called by
+ * vehicle HAL's client (e.g. Car Service). */
+ SET_CALL = 0x2,
+
+ DEFAULT = HAL_EVENT,
+};
+
+/*
+ * Encapsulates information about subscription to vehicle property events.
+ */
+struct SubscribeOptions {
+ /* Property to subscribe */
+
+ VehicleProperty propId;
+
+ /* Area ids - this must be a bit mask of areas to subscribe or 0 to subscribe to all areas. */
+ int32_t vehicleAreas;
+
+ /*
+ * Sample rate in Hz.
+ *
+ * Must be provided for properties with
+ * VehiclePropertyChangeMode::CONTINUOUS. The value must be within
+ * VehiclePropConfig#minSamplingRate .. VehiclePropConfig#maxSamplingRate
+ * for a given property.
+ * This value indicates how many updates per second client wants to receive.
+ */
+ float sampleRate;
+
+ /*
+ * Flags that indicates what kind of events listen to.
+ */
+ SubscribeFlags flags;
+};
+
+/* Error codes used in vehicle HAL interface. */
+enum StatusCode {
+ OK = 0,
+
+ /* Try again. */
+ TRY_AGAIN = -11,
+
+ /* Invalid argument provided. */
+ INVALID_ARG = -22,
+
+ /*
+ * This code must be returned when device that associated with the vehicle
+ * property is not available. For example, when client tries to set HVAC
+ * temperature when the whole HVAC unit is turned OFF.
+ */
+ NOT_AVAILABLE = -108,
+};
diff --git a/vibrator/1.0/default/Android.bp b/vibrator/1.0/default/Android.bp
new file mode 100644
index 0000000..4dd00dd
--- /dev/null
+++ b/vibrator/1.0/default/Android.bp
@@ -0,0 +1,27 @@
+//
+// 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.vibrator@1.0-impl",
+ relative_install_path: "hw",
+ srcs: ["Vibrator.cpp"],
+ shared_libs: [
+ "libhidl",
+ "liblog",
+ "libhwbinder",
+ "libutils",
+ "libhardware",
+ "android.hardware.vibrator@1.0",
+ ],
+}
diff --git a/vibrator/1.0/default/Android.mk b/vibrator/1.0/default/Android.mk
index 3bb6f79..2b168bb 100644
--- a/vibrator/1.0/default/Android.mk
+++ b/vibrator/1.0/default/Android.mk
@@ -17,10 +17,11 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vibrator@1.0-impl
+LOCAL_MODULE := android.hardware.vibrator@1.0-service
+LOCAL_INIT_RC := android.hardware.vibrator@1.0-service.rc
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
- Vibrator.cpp \
+ service.cpp \
LOCAL_SHARED_LIBRARIES := \
libhidl \
@@ -30,4 +31,4 @@
libhardware \
android.hardware.vibrator@1.0
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_EXECUTABLE)
diff --git a/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc b/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc
new file mode 100644
index 0000000..a7836b3
--- /dev/null
+++ b/vibrator/1.0/default/android.hardware.vibrator@1.0-service.rc
@@ -0,0 +1,4 @@
+service vibrator-1-0 /system/bin/hw/android.hardware.vibrator@1.0-service
+ class hal
+ user system
+ group system readproc
diff --git a/vibrator/1.0/default/service.cpp b/vibrator/1.0/default/service.cpp
new file mode 100644
index 0000000..a4a7132
--- /dev/null
+++ b/vibrator/1.0/default/service.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.vibrator@1.0-service"
+#include <utils/Log.h>
+
+#include <iostream>
+#include <unistd.h>
+
+#include <android/hardware/vibrator/1.0/IVibrator.h>
+
+#include <hidl/IServiceManager.h>
+#include <hwbinder/IPCThreadState.h>
+#include <hwbinder/ProcessState.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+
+using android::sp;
+
+// libhwbinder:
+using android::hardware::IPCThreadState;
+using android::hardware::ProcessState;
+
+// Generated HIDL files
+using android::hardware::vibrator::V1_0::IVibrator;
+
+int main() {
+ ALOGI("Service is starting.");
+ const char instance[] = "vibrator";
+ ALOGI("Retrieving default implementation of instance %s.",
+ instance);
+ android::sp<IVibrator> service = IVibrator::getService(instance, true);
+ if (service.get() == nullptr) {
+ ALOGE("IVibrator::getService returned NULL, exiting");
+ return -1;
+ }
+ ALOGI("Default implementation using %s is %s",
+ instance, (service->isRemote() ? "REMOTE" : "LOCAL"));
+ LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
+ ALOGI("Registering instance %s.", instance);
+ service->registerAsService(instance);
+ ALOGI("Ready.");
+
+ ProcessState::self()->setThreadPoolMaxThreadCount(0);
+ ProcessState::self()->startThreadPool();
+ IPCThreadState::self()->joinThreadPool();
+}
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 07e17ef..59ad2c5 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -7,16 +7,28 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.cpp",
"android/hardware/wifi/1.0/WifiAll.cpp",
+ "android/hardware/wifi/1.0/WifiApIfaceAll.cpp",
"android/hardware/wifi/1.0/WifiChipAll.cpp",
"android/hardware/wifi/1.0/WifiChipEventCallbackAll.cpp",
"android/hardware/wifi/1.0/WifiEventCallbackAll.cpp",
+ "android/hardware/wifi/1.0/WifiIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiNanIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp",
+ "android/hardware/wifi/1.0/WifiRttControllerAll.cpp",
+ "android/hardware/wifi/1.0/WifiStaIfaceAll.cpp",
],
}
@@ -27,9 +39,15 @@
srcs: [
"types.hal",
"IWifi.hal",
+ "IWifiApIface.hal",
"IWifiChip.hal",
"IWifiChipEventCallback.hal",
"IWifiEventCallback.hal",
+ "IWifiIface.hal",
+ "IWifiNanIface.hal",
+ "IWifiP2pIface.hal",
+ "IWifiRttController.hal",
+ "IWifiStaIface.hal",
],
out: [
"android/hardware/wifi/1.0/types.h",
@@ -38,6 +56,11 @@
"android/hardware/wifi/1.0/BnWifi.h",
"android/hardware/wifi/1.0/BpWifi.h",
"android/hardware/wifi/1.0/BsWifi.h",
+ "android/hardware/wifi/1.0/IWifiApIface.h",
+ "android/hardware/wifi/1.0/IHwWifiApIface.h",
+ "android/hardware/wifi/1.0/BnWifiApIface.h",
+ "android/hardware/wifi/1.0/BpWifiApIface.h",
+ "android/hardware/wifi/1.0/BsWifiApIface.h",
"android/hardware/wifi/1.0/IWifiChip.h",
"android/hardware/wifi/1.0/IHwWifiChip.h",
"android/hardware/wifi/1.0/BnWifiChip.h",
@@ -53,6 +76,31 @@
"android/hardware/wifi/1.0/BnWifiEventCallback.h",
"android/hardware/wifi/1.0/BpWifiEventCallback.h",
"android/hardware/wifi/1.0/BsWifiEventCallback.h",
+ "android/hardware/wifi/1.0/IWifiIface.h",
+ "android/hardware/wifi/1.0/IHwWifiIface.h",
+ "android/hardware/wifi/1.0/BnWifiIface.h",
+ "android/hardware/wifi/1.0/BpWifiIface.h",
+ "android/hardware/wifi/1.0/BsWifiIface.h",
+ "android/hardware/wifi/1.0/IWifiNanIface.h",
+ "android/hardware/wifi/1.0/IHwWifiNanIface.h",
+ "android/hardware/wifi/1.0/BnWifiNanIface.h",
+ "android/hardware/wifi/1.0/BpWifiNanIface.h",
+ "android/hardware/wifi/1.0/BsWifiNanIface.h",
+ "android/hardware/wifi/1.0/IWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IHwWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BnWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BpWifiP2pIface.h",
+ "android/hardware/wifi/1.0/BsWifiP2pIface.h",
+ "android/hardware/wifi/1.0/IWifiRttController.h",
+ "android/hardware/wifi/1.0/IHwWifiRttController.h",
+ "android/hardware/wifi/1.0/BnWifiRttController.h",
+ "android/hardware/wifi/1.0/BpWifiRttController.h",
+ "android/hardware/wifi/1.0/BsWifiRttController.h",
+ "android/hardware/wifi/1.0/IWifiStaIface.h",
+ "android/hardware/wifi/1.0/IHwWifiStaIface.h",
+ "android/hardware/wifi/1.0/BnWifiStaIface.h",
+ "android/hardware/wifi/1.0/BpWifiStaIface.h",
+ "android/hardware/wifi/1.0/BsWifiStaIface.h",
],
}
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index e211ca8..58c487b 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -47,6 +47,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.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.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -57,6 +74,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.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) \
@@ -68,14 +87,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -125,6 +175,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.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.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_JAVA_LIBRARY)
@@ -173,6 +318,23 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.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.wifi@1.0::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifi.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -183,6 +345,8 @@
$(GEN): $(LOCAL_PATH)/IWifiChip.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.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) \
@@ -194,14 +358,45 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build IWifiChip.hal
#
GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
$(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
$(GEN): $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -251,6 +446,101 @@
$(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.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.wifi@1.0::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.wifi@1.0::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/wifi/1.0/IWifi.hal b/wifi/1.0/IWifi.hal
index d1311f5..9e09348 100644
--- a/wifi/1.0/IWifi.hal
+++ b/wifi/1.0/IWifi.hal
@@ -70,10 +70,22 @@
@callflow(next={"registerEventCallback", "start", "stop"})
oneway stop();
- // TODO(b/30570663) return vec<IWifiChip> instead
/**
- * Get the configurable chip on the device.
+ * Retrieve the list of all chip Id's on the device.
+ * The corresponding |IWifiChip| object for any chip can be
+ * retrieved using |getChip| method.
+ *
+ * @return chipIds List of all chip Id's on the device.
*/
@callflow(next={"*"})
- getChip() generates (IWifiChip chip);
+ getChipIds() generates (vec<ChipId> chipIds);
+
+ /**
+ * Gets a HIDL interface object for the chip corresponding to the
+ * provided chipId.
+ *
+ * @return chip HIDL interface object representing the chip.
+ */
+ @callflow(next={"*"})
+ getChip(ChipId chipId) generates (IWifiChip chip);
};
diff --git a/wifi/1.0/IWifiApIface.hal b/wifi/1.0/IWifiApIface.hal
new file mode 100644
index 0000000..6bc3580
--- /dev/null
+++ b/wifi/1.0/IWifiApIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single AP iface.
+ */
+interface IWifiApIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 7a41ddf..cd4b219 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -17,6 +17,12 @@
package android.hardware.wifi@1.0;
import IWifiChipEventCallback;
+import IWifiIface;
+import IWifiApIface;
+import IWifiNanIface;
+import IWifiP2pIface;
+import IWifiStaIface;
+import IWifiRttController;
/**
* Interface that represents a chip that must be configured as a single unit.
@@ -24,15 +30,6 @@
* to perform operations like NAN, RTT, etc.
*/
interface IWifiChip {
- enum IfaceType : uint32_t {
- STA, AP, P2P,
- /**
- * NAN control interface. Datapath support may be queried and created
- * through this interface.
- */
- NAN,
- };
-
/**
* Set of interface types with the maximum number of interfaces that can have
* one of the specified type for a given ChipIfaceCombination. See
@@ -122,6 +119,13 @@
};
/**
+ * Get the id assigned to this chip.
+ *
+ * @return id Assigned chip Id.
+ */
+ getId() generates (ChipId id);
+
+ /**
* Requests notifications of significant events on this chip. Multiple calls
* to this will register multiple callbacks each of which will receive all
* events.
@@ -176,4 +180,142 @@
* success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
*/
oneway requestFirmwareDebugDump();
+
+ /**
+ * Create an AP iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the AP type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createApIface() generates (IWifiApIface iface);
+
+ /**
+ * List all the AP iface names configured on the chip.
+ * The corresponding |IWifiApIface| object for any iface are
+ * retrieved using |getApIface| method.
+ *
+ * @return ifnames List of all AP iface names on the chip.
+ */
+ getApIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the AP Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getApIface(string ifname) generates (IWifiApIface iface);
+
+ /**
+ * Create a NAN iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the NAN type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createNanIface() generates (IWifiNanIface iface);
+
+ /**
+ * List all the NAN iface names configured on the chip.
+ * The corresponding |IWifiNanIface| object for any iface are
+ * retrieved using |getNanIface| method.
+ *
+ * @return ifnames List of all NAN iface names on the chip.
+ */
+ getNanIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the NAN Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getNanIface(string ifname) generates (IWifiNanIface iface);
+
+ /**
+ * Create a P2P iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the P2P type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createP2pIface() generates (IWifiP2pIface iface);
+
+ /**
+ * List all the P2P iface names configured on the chip.
+ * The corresponding |IWifiP2pIface| object for any iface are
+ * retrieved using |getP2pIface| method.
+ *
+ * @return ifnames List of all P2P iface names on the chip.
+ */
+ getP2pIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the P2P Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getP2pIface(string ifname) generates (IWifiP2pIface iface);
+
+ /**
+ * Create an STA iface on the chip.
+ *
+ * Depending on the mode the chip is configured in, the interface creation
+ * may fail if we've already reached the maximum allowed
+ * (specified in |ChipIfaceCombination|) number of ifaces of the STA type.
+ *
+ * @return iface HIDL interface object representing the iface if
+ * successful, null otherwise.
+ */
+ createStaIface() generates (IWifiStaIface iface);
+
+ /**
+ * List all the STA iface names configured on the chip.
+ * The corresponding |IWifiStaIface| object for any iface are
+ * retrieved using |getStaIface| method.
+ *
+ * @return ifnames List of all STA iface names on the chip.
+ */
+ getStaIfaceNames() generates (vec<string> ifnames);
+
+ /**
+ * Gets a HIDL interface object for the STA Iface corresponding
+ * to the provided ifname.
+ *
+ * @param ifname Name of the iface.
+ * @return iface HIDL interface object representing the iface if
+ * it exists, null otherwise.
+ */
+ getStaIface(string ifname) generates (IWifiStaIface iface);
+
+ /**
+ * Create a RTTController instance.
+ *
+ * RTT controller can be either:
+ * a) Bound to a specific iface by passing in the corresponding |IWifiIface|
+ * object in |iface| param, OR
+ * b) Let the implementation decide the iface to use for RTT operations by
+ * passing null in |iface| param.
+ *
+ * @param boundIface HIDL interface object representing the iface if
+ * the responder must be bound to a specific iface, null otherwise.
+ */
+ createRttController(IWifiIface boundIface) generates (IWifiRttController rtt);
};
diff --git a/wifi/1.0/IWifiIface.hal b/wifi/1.0/IWifiIface.hal
new file mode 100644
index 0000000..f4150e7
--- /dev/null
+++ b/wifi/1.0/IWifiIface.hal
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+/**
+ * Interface used to represent a single iface.
+ */
+interface IWifiIface {
+ /**
+ * Get the type of this iface.
+ *
+ * @return type One of the supported iface types.
+ */
+ getType() generates (IfaceType type);
+
+ /**
+ * Get the name of this iface.
+ *
+ * @return name Name of the iface.
+ */
+ getName() generates (string name);
+};
diff --git a/wifi/1.0/IWifiNanIface.hal b/wifi/1.0/IWifiNanIface.hal
new file mode 100644
index 0000000..dade94c
--- /dev/null
+++ b/wifi/1.0/IWifiNanIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiNanIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiP2pIface.hal b/wifi/1.0/IWifiP2pIface.hal
new file mode 100644
index 0000000..243748f
--- /dev/null
+++ b/wifi/1.0/IWifiP2pIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single NAN iface.
+ */
+interface IWifiP2pIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiRttController.hal b/wifi/1.0/IWifiRttController.hal
new file mode 100644
index 0000000..d735da7
--- /dev/null
+++ b/wifi/1.0/IWifiRttController.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to perform RTT operations.
+ */
+interface IWifiRttController {
+ /**
+ * Get the iface on which the RTT operations will be performed.
+ *
+ * @return boundIface HIDL interface object representing the iface if bound
+ * to a specific iface, null otherwise
+ */
+ getBoundIface() generates (IWifiIface boundIface);
+};
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
new file mode 100644
index 0000000..5234c71
--- /dev/null
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to represent a single STA iface.
+ */
+interface IWifiStaIface extends IWifiIface {
+ /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/default/Android.mk b/wifi/1.0/default/Android.mk
index 07865a5..3fd5fba 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.0/default/Android.mk
@@ -19,9 +19,14 @@
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
LOCAL_SRC_FILES := \
failure_reason_util.cpp \
- wifi_chip.cpp \
wifi.cpp \
- wifi_legacy_hal.cpp
+ wifi_ap_iface.cpp \
+ wifi_chip.cpp \
+ wifi_legacy_hal.cpp \
+ wifi_nan_iface.cpp \
+ wifi_p2p_iface.cpp \
+ wifi_rtt_controller.cpp \
+ wifi_sta_iface.cpp
LOCAL_SHARED_LIBRARIES := \
android.hardware.wifi@1.0 \
libbase \
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index d5b69b8..ff2eb4c 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -21,6 +21,11 @@
#include "failure_reason_util.h"
#include "wifi_chip.h"
+namespace {
+// Chip ID to use for the only supported chip.
+static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0;
+} // namespace
+
namespace android {
namespace hardware {
namespace wifi {
@@ -33,7 +38,7 @@
Return<void> Wifi::registerEventCallback(
const sp<IWifiEventCallback>& callback) {
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
@@ -67,7 +72,7 @@
}
// Create the chip instance once the HAL is started.
- chip_ = new WifiChip(legacy_hal_);
+ chip_ = new WifiChip(kChipId, legacy_hal_);
run_state_ = RunState::STARTED;
for (const auto& callback : callbacks_) {
callback->onStart();
@@ -108,8 +113,23 @@
return Void();
}
-Return<void> Wifi::getChip(getChip_cb cb) {
- cb(chip_);
+Return<void> Wifi::getChipIds(getChipIds_cb cb) {
+ std::vector<ChipId> chip_ids;
+ if (chip_.get()) {
+ chip_ids.emplace_back(kChipId);
+ }
+ hidl_vec<ChipId> hidl_data;
+ hidl_data.setToExternal(chip_ids.data(), chip_ids.size());
+ cb(hidl_data);
+ return Void();
+}
+
+Return<void> Wifi::getChip(ChipId chip_id, getChip_cb cb) {
+ if (chip_.get() && chip_id == kChipId) {
+ cb(chip_);
+ } else {
+ cb(nullptr);
+ }
return Void();
}
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index e6cf1ac..55ba12b 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -18,7 +18,6 @@
#define WIFI_H_
#include <functional>
-#include <set>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifi.h>
@@ -46,7 +45,8 @@
Return<bool> isStarted() override;
Return<void> start() override;
Return<void> stop() override;
- Return<void> getChip(getChip_cb cb) override;
+ Return<void> getChipIds(getChipIds_cb cb) override;
+ Return<void> getChip(ChipId chip_id, getChip_cb cb) override;
private:
enum class RunState { STOPPED, STARTED, STOPPING };
@@ -55,7 +55,7 @@
// and shared with all the child HIDL interface objects.
std::shared_ptr<WifiLegacyHal> legacy_hal_;
RunState run_state_;
- std::set<sp<IWifiEventCallback>> callbacks_;
+ std::vector<sp<IWifiEventCallback>> callbacks_;
sp<WifiChip> chip_;
DISALLOW_COPY_AND_ASSIGN(Wifi);
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.0/default/wifi_ap_iface.cpp
new file mode 100644
index 0000000..aded04d
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wifi_ap_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiApIface::WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiApIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiApIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiApIface::getType() {
+ return IfaceType::AP;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.0/default/wifi_ap_iface.h
new file mode 100644
index 0000000..b95a3d8
--- /dev/null
+++ b/wifi/1.0/default/wifi_ap_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_AP_IFACE_H_
+#define WIFI_AP_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiApIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a AP Iface instance.
+ */
+class WifiApIface : public IWifiApIface {
+ public:
+ WifiApIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiApIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_AP_IFACE_H_
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index df321e2..4dd020b 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -20,31 +20,64 @@
#include "failure_reason_util.h"
+namespace {
+using android::sp;
+using android::hardware::hidl_vec;
+using android::hardware::hidl_string;
+
+hidl_vec<hidl_string> createHidlVecOfIfaceNames(const std::string& ifname) {
+ std::vector<hidl_string> ifnames;
+ if (!ifname.empty()) {
+ hidl_string hidl_ifname;
+ hidl_ifname = ifname.c_str();
+ ifnames.emplace_back(hidl_ifname);
+ }
+ hidl_vec<hidl_string> hidl_ifnames;
+ hidl_ifnames.setToExternal(ifnames.data(), ifnames.size());
+ return hidl_ifnames;
+}
+
+template <typename Iface>
+void invalidateAndClear(sp<Iface>& iface) {
+ if (iface.get()) {
+ iface->invalidate();
+ iface.clear();
+ }
+}
+} // namepsace
+
namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {
-WifiChip::WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal)
- : legacy_hal_(legacy_hal) {}
+WifiChip::WifiChip(ChipId chip_id,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : chip_id_(chip_id), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiChip::invalidate() {
+ invalidateAndRemoveAllIfaces();
legacy_hal_.reset();
callbacks_.clear();
+ is_valid_ = false;
+}
+
+Return<ChipId> WifiChip::getId() {
+ return chip_id_;
}
Return<void> WifiChip::registerEventCallback(
const sp<IWifiChipEventCallback>& callback) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
// TODO(b/31632518): remove the callback when the client is destroyed
- callbacks_.insert(callback);
+ callbacks_.emplace_back(callback);
return Void();
}
Return<void> WifiChip::getAvailableModes(getAvailableModes_cb cb) {
- if (!legacy_hal_.lock()) {
+ if (!is_valid_) {
cb(hidl_vec<ChipMode>());
return Void();
} else {
@@ -54,38 +87,50 @@
}
Return<void> WifiChip::configureChip(uint32_t /*mode_id*/) {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
+
+ invalidateAndRemoveAllIfaces();
// TODO add implementation
return Void();
}
Return<uint32_t> WifiChip::getMode() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return 0;
// TODO add implementation
return 0;
}
Return<void> WifiChip::requestChipDebugInfo() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
IWifiChipEventCallback::ChipDebugInfo result;
std::pair<wifi_error, std::string> ret =
- legacy_hal_.lock()->getWlanDriverVersion();
+ legacy_hal_.lock()->getDriverVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get driver version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.driverDescription = ret.second.c_str();
- ret = legacy_hal_.lock()->getWlanFirmwareVersion();
+ ret = legacy_hal_.lock()->getFirmwareVersion();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware version: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(
+ ret.first, " failed to get firmware version");
+ for (const auto& callback : callbacks_) {
+ callback->onChipDebugInfoFailure(reason);
+ }
return Void();
}
result.firmwareDescription = ret.second.c_str();
@@ -97,14 +142,18 @@
}
Return<void> WifiChip::requestDriverDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanDriverMemoryDump();
+ legacy_hal_.lock()->requestDriverMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onDriverDebugDumpFailure(reason);
+ }
return Void();
}
@@ -119,14 +168,18 @@
}
Return<void> WifiChip::requestFirmwareDebugDump() {
- if (!legacy_hal_.lock())
+ if (!is_valid_)
return Void();
std::pair<wifi_error, std::vector<char>> ret =
- legacy_hal_.lock()->requestWlanFirmwareMemoryDump();
+ legacy_hal_.lock()->requestFirmwareMemoryDump();
if (ret.first != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware debug dump: "
<< LegacyErrorToString(ret.first);
+ FailureReason reason = CreateFailureReasonLegacyError(ret.first, "");
+ for (const auto& callback : callbacks_) {
+ callback->onFirmwareDebugDumpFailure(reason);
+ }
return Void();
}
@@ -140,6 +193,203 @@
return Void();
}
+Return<void> WifiChip::createApIface(createApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getApIfaceName();
+ ap_iface_ = new WifiApIface(ifname, legacy_hal_);
+ cb(ap_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (ap_iface_.get()) {
+ ifname = legacy_hal_.lock()->getApIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getApIface(const hidl_string& ifname, getApIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (ap_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getApIfaceName())) {
+ cb(ap_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createNanIface(createNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getNanIfaceName();
+ nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
+ cb(nan_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (nan_iface_.get()) {
+ ifname = legacy_hal_.lock()->getNanIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (nan_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getNanIfaceName())) {
+ cb(nan_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createP2pIface(createP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
+ p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
+ cb(p2p_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (p2p_iface_.get()) {
+ ifname = legacy_hal_.lock()->getP2pIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (p2p_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getP2pIfaceName())) {
+ cb(p2p_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createStaIface(createStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ // TODO(b/31997422): Disallow this based on the chip combination.
+ std::string ifname = legacy_hal_.lock()->getStaIfaceName();
+ sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
+ cb(sta_iface_);
+ return Void();
+}
+
+Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb cb) {
+ if (!is_valid_) {
+ cb(hidl_vec<hidl_string>());
+ return Void();
+ }
+
+ std::string ifname;
+ if (sta_iface_.get()) {
+ ifname = legacy_hal_.lock()->getStaIfaceName().c_str();
+ }
+ cb(createHidlVecOfIfaceNames(ifname));
+ return Void();
+}
+
+Return<void> WifiChip::getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ if (sta_iface_.get() &&
+ (ifname.c_str() == legacy_hal_.lock()->getStaIfaceName())) {
+ cb(sta_iface_);
+ } else {
+ cb(nullptr);
+ }
+ return Void();
+}
+
+Return<void> WifiChip::createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) {
+ if (!is_valid_) {
+ cb(nullptr);
+ return Void();
+ }
+
+ sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
+ rtt_controllers_.emplace_back(rtt);
+ cb(rtt);
+ return Void();
+}
+
+void WifiChip::invalidateAndRemoveAllIfaces() {
+ invalidateAndClear(ap_iface_);
+ invalidateAndClear(nan_iface_);
+ invalidateAndClear(p2p_iface_);
+ invalidateAndClear(sta_iface_);
+ // Since all the ifaces are invalid now, all RTT controller objects
+ // using those ifaces also need to be invalidated.
+ for (const auto& rtt : rtt_controllers_) {
+ rtt->invalidate();
+ }
+ rtt_controllers_.clear();
+}
+
} // namespace implementation
} // namespace V1_0
} // namespace wifi
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 95fabe4..94ffa63 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -17,12 +17,17 @@
#ifndef WIFI_CHIP_H_
#define WIFI_CHIP_H_
-#include <set>
+#include <map>
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include "wifi_ap_iface.h"
#include "wifi_legacy_hal.h"
+#include "wifi_nan_iface.h"
+#include "wifi_p2p_iface.h"
+#include "wifi_rtt_controller.h"
+#include "wifi_sta_iface.h"
namespace android {
namespace hardware {
@@ -37,11 +42,24 @@
*/
class WifiChip : public IWifiChip {
public:
- WifiChip(std::weak_ptr<WifiLegacyHal> legacy_hal);
- // Invalidate this instance once the HAL is stopped.
+ WifiChip(ChipId chip_id, const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // HIDL does not provide a built-in mechanism to let the server invalidate
+ // a HIDL interface object after creation. If any client process holds onto
+ // a reference to the object in their context, any method calls on that
+ // reference will continue to be directed to the server.
+ //
+ // However Wifi HAL needs to control the lifetime of these objects. So, add
+ // a public |invalidate| method to |WifiChip| and it's child objects. This
+ // will be used to mark an object invalid when either:
+ // a) Wifi HAL is stopped, or
+ // b) Wifi Chip is reconfigured.
+ //
+ // All HIDL method implementations should check if the object is still marked
+ // valid before processing them.
void invalidate();
// HIDL methods exposed.
+ Return<ChipId> getId() override;
Return<void> registerEventCallback(
const sp<IWifiChipEventCallback>& callback) override;
Return<void> getAvailableModes(getAvailableModes_cb cb) override;
@@ -50,10 +68,36 @@
Return<void> requestChipDebugInfo() override;
Return<void> requestDriverDebugDump() override;
Return<void> requestFirmwareDebugDump() override;
+ Return<void> createApIface(createApIface_cb cb) override;
+ Return<void> getApIfaceNames(getApIfaceNames_cb cb) override;
+ Return<void> getApIface(const hidl_string& ifname, getApIface_cb cb) override;
+ Return<void> createNanIface(createNanIface_cb cb) override;
+ Return<void> getNanIfaceNames(getNanIfaceNames_cb cb) override;
+ Return<void> getNanIface(const hidl_string& ifname,
+ getNanIface_cb cb) override;
+ Return<void> createP2pIface(createP2pIface_cb cb) override;
+ Return<void> getP2pIfaceNames(getP2pIfaceNames_cb cb) override;
+ Return<void> getP2pIface(const hidl_string& ifname,
+ getP2pIface_cb cb) override;
+ Return<void> createStaIface(createStaIface_cb cb) override;
+ Return<void> getStaIfaceNames(getStaIfaceNames_cb cb) override;
+ Return<void> getStaIface(const hidl_string& ifname,
+ getStaIface_cb cb) override;
+ Return<void> createRttController(const sp<IWifiIface>& bound_iface,
+ createRttController_cb cb) override;
private:
+ void invalidateAndRemoveAllIfaces();
+
+ ChipId chip_id_;
std::weak_ptr<WifiLegacyHal> legacy_hal_;
- std::set<sp<IWifiChipEventCallback>> callbacks_;
+ std::vector<sp<IWifiChipEventCallback>> callbacks_;
+ sp<WifiApIface> ap_iface_;
+ sp<WifiNanIface> nan_iface_;
+ sp<WifiP2pIface> p2p_iface_;
+ sp<WifiStaIface> sta_iface_;
+ std::vector<sp<WifiRttController>> rtt_controllers_;
+ bool is_valid_;
DISALLOW_COPY_AND_ASSIGN(WifiChip);
};
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index a6df996..553a058 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -25,12 +25,6 @@
#include <wifi_system/interface_tool.h>
namespace {
-std::string getWlanInterfaceName() {
- char buffer[PROPERTY_VALUE_MAX];
- property_get("wifi.interface", buffer, "wlan0");
- return buffer;
-}
-
// Legacy HAL functions accept "C" style function pointers, so use global
// functions to pass to the legacy HAL function and store the corresponding
// std::function methods to be invoked.
@@ -120,7 +114,31 @@
return WIFI_SUCCESS;
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanDriverVersion() {
+std::string WifiLegacyHal::getApIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "ap0";
+}
+
+std::string WifiLegacyHal::getNanIfaceName() {
+ // Fake name. This interface does not exist in legacy HAL
+ // API's.
+ return "nan0";
+}
+
+std::string WifiLegacyHal::getP2pIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.direct.interface", buffer.data(), "p2p0");
+ return buffer.data();
+}
+
+std::string WifiLegacyHal::getStaIfaceName() {
+ std::array<char, PROPERTY_VALUE_MAX> buffer;
+ property_get("wifi.interface", buffer.data(), "wlan0");
+ return buffer.data();
+}
+
+std::pair<wifi_error, std::string> WifiLegacyHal::getDriverVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_driver_version(
@@ -128,7 +146,7 @@
return std::make_pair(status, buffer.data());
}
-std::pair<wifi_error, std::string> WifiLegacyHal::getWlanFirmwareVersion() {
+std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion() {
std::array<char, kMaxVersionStringLength> buffer;
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_firmware_version(
@@ -137,7 +155,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanDriverMemoryDump() {
+WifiLegacyHal::requestDriverMemoryDump() {
std::vector<char> driver_dump;
on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer,
int buffer_size) {
@@ -150,7 +168,7 @@
}
std::pair<wifi_error, std::vector<char>>
-WifiLegacyHal::requestWlanFirmwareMemoryDump() {
+WifiLegacyHal::requestFirmwareMemoryDump() {
std::vector<char> firmware_dump;
on_firmware_memory_dump_internal_callback = [&firmware_dump](
char* buffer, int buffer_size) {
@@ -163,8 +181,7 @@
}
wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
- const std::string& ifname_to_find = getWlanInterfaceName();
-
+ const std::string& ifname_to_find = getStaIfaceName();
wifi_interface_handle* iface_handles = nullptr;
int num_iface_handles = 0;
wifi_error status = global_func_table_.wifi_get_ifaces(
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index f691b9b..3585975 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -35,15 +35,21 @@
class WifiLegacyHal {
public:
WifiLegacyHal();
+ // Names to use for the different types of iface.
+ std::string getApIfaceName();
+ std::string getNanIfaceName();
+ std::string getP2pIfaceName();
+ std::string getStaIfaceName();
+
// Initialize the legacy HAL and start the event looper thread.
wifi_error start();
// Deinitialize the legacy HAL and stop the event looper thread.
wifi_error stop(const std::function<void()>& on_complete_callback);
// Wrappers for all the functions in the legacy HAL function table.
- std::pair<wifi_error, std::string> getWlanDriverVersion();
- std::pair<wifi_error, std::string> getWlanFirmwareVersion();
- std::pair<wifi_error, std::vector<char>> requestWlanDriverMemoryDump();
- std::pair<wifi_error, std::vector<char>> requestWlanFirmwareMemoryDump();
+ std::pair<wifi_error, std::string> getDriverVersion();
+ std::pair<wifi_error, std::string> getFirmwareVersion();
+ std::pair<wifi_error, std::vector<char>> requestDriverMemoryDump();
+ std::pair<wifi_error, std::vector<char>> requestFirmwareMemoryDump();
private:
static const uint32_t kMaxVersionStringLength;
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
new file mode 100644
index 0000000..3c7ae4b
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wifi_nan_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiNanIface::WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiNanIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiNanIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiNanIface::getType() {
+ return IfaceType::NAN;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
new file mode 100644
index 0000000..93e2e77
--- /dev/null
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_NAN_IFACE_H_
+#define WIFI_NAN_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiNanIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a NAN Iface instance.
+ */
+class WifiNanIface : public IWifiNanIface {
+ public:
+ WifiNanIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_NAN_IFACE_H_
diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.0/default/wifi_p2p_iface.cpp
new file mode 100644
index 0000000..349a158
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wifi_p2p_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiP2pIface::WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiP2pIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiP2pIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiP2pIface::getType() {
+ return IfaceType::P2P;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.0/default/wifi_p2p_iface.h
new file mode 100644
index 0000000..d70415d
--- /dev/null
+++ b/wifi/1.0/default/wifi_p2p_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_P2P_IFACE_H_
+#define WIFI_P2P_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiP2pIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a P2P Iface instance.
+ */
+class WifiP2pIface : public IWifiP2pIface {
+ public:
+ WifiP2pIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_P2P_IFACE_H_
diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.0/default/wifi_rtt_controller.cpp
new file mode 100644
index 0000000..e2df1a8
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.cpp
@@ -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.
+ */
+
+#include "wifi_rtt_controller.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiRttController::WifiRttController(
+ const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiRttController::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiRttController::getBoundIface(getBoundIface_cb cb) {
+ cb(bound_iface_);
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.0/default/wifi_rtt_controller.h
new file mode 100644
index 0000000..8d78b93
--- /dev/null
+++ b/wifi/1.0/default/wifi_rtt_controller.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_RTT_CONTROLLER_H_
+#define WIFI_RTT_CONTROLLER_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiIface.h>
+#include <android/hardware/wifi/1.0/IWifiRttController.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control all RTT operations.
+ */
+class WifiRttController : public IWifiRttController {
+ public:
+ WifiRttController(const sp<IWifiIface>& bound_iface,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getBoundIface(getBoundIface_cb cb) override;
+
+ private:
+ sp<IWifiIface> bound_iface_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiRttController);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_RTT_CONTROLLER_H_
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
new file mode 100644
index 0000000..225cec4
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wifi_sta_iface.h"
+
+#include <android-base/logging.h>
+
+#include "failure_reason_util.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+WifiStaIface::WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
+
+void WifiStaIface::invalidate() {
+ legacy_hal_.reset();
+ is_valid_ = false;
+}
+
+Return<void> WifiStaIface::getName(getName_cb cb) {
+ hidl_string hidl_ifname;
+ hidl_ifname.setToExternal(ifname_.c_str(), ifname_.size());
+ cb(hidl_ifname);
+ return Void();
+}
+
+Return<IfaceType> WifiStaIface::getType() {
+ return IfaceType::STA;
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
new file mode 100644
index 0000000..fc5efec
--- /dev/null
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFI_STA_IFACE_H_
+#define WIFI_STA_IFACE_H_
+
+#include <android-base/macros.h>
+#include <android/hardware/wifi/1.0/IWifiStaIface.h>
+
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+
+/**
+ * HIDL interface object used to control a STA Iface instance.
+ */
+class WifiStaIface : public IWifiStaIface {
+ public:
+ WifiStaIface(const std::string& ifname,
+ const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ // Refer to |WifiChip::invalidate()|.
+ void invalidate();
+
+ // HIDL methods exposed.
+ Return<void> getName(getName_cb cb) override;
+ Return<IfaceType> getType() override;
+
+ private:
+ std::string ifname_;
+ std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ bool is_valid_;
+
+ DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+
+#endif // WIFI_STA_IFACE_H_
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 49849ea..d9abaef 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -16,6 +16,9 @@
package android.hardware.wifi@1.0;
+/**
+ * List of failure reasons returned.
+ */
enum CommandFailureReason : uint32_t {
UNKNOWN,
DUPLICATE_COMMAND_ID,
@@ -41,6 +44,25 @@
};
/**
+ * List of Iface types supported.
+ */
+enum IfaceType : uint32_t {
+ STA,
+ AP,
+ P2P,
+ /**
+ * NAN control interface. Datapath support may be queried and created
+ * through this interface.
+ */
+ NAN,
+};
+
+/**
+ * An identifier assigned to every chip on the device.
+ */
+typedef uint32_t ChipId;
+
+/**
* An identifier for a mode that the chip can be put in.
*/
typedef uint32_t ChipModeId;