Merge "camera: Map between legacy gralloc0 usage, and HIDL gralloc1 usages" into oc-dev
diff --git a/audio/2.0/IDevice.hal b/audio/2.0/IDevice.hal
index 2b5329b..62c2081 100644
--- a/audio/2.0/IDevice.hal
+++ b/audio/2.0/IDevice.hal
@@ -23,14 +23,14 @@
 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.
@@ -40,7 +40,7 @@
      */
     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
@@ -52,7 +52,7 @@
      */
     getMasterVolume() generates (Result retval, float volume);
 
-    /*
+    /**
      * Sets microphone muting state.
      *
      * @param mute whether microphone is muted.
@@ -60,7 +60,7 @@
      */
     setMicMute(bool mute) generates (Result retval);
 
-    /*
+    /**
      * Gets whether microphone is muted.
      *
      * @return retval operation completion status.
@@ -68,7 +68,7 @@
      */
     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.
      *
@@ -89,7 +89,7 @@
      */
     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.
      *
@@ -100,7 +100,7 @@
     getInputBufferSize(AudioConfig config)
             generates (Result retval, uint64_t bufferSize);
 
-    /*
+    /**
      * This method creates and opens the audio hardware output stream.
      * If the stream can not be opened with the proposed audio config,
      * HAL must provide suggested values for the audio config.
@@ -122,7 +122,7 @@
                     IStreamOut outStream,
                     AudioConfig suggestedConfig);
 
-    /*
+    /**
      * This method creates and opens the audio hardware input stream.
      * If the stream can not be opened with the proposed audio config,
      * HAL must provide suggested values for the audio config.
@@ -146,14 +146,14 @@
                     IStreamIn inStream,
                     AudioConfig suggestedConfig);
 
-    /*
+    /**
      * Returns whether HAL supports audio patches.
      *
      * @return supports true if audio patches are supported.
      */
     supportsAudioPatches() generates (bool supports);
 
-    /*
+    /**
      * 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.
      *
@@ -165,7 +165,7 @@
     createAudioPatch(vec<AudioPortConfig> sources, vec<AudioPortConfig> sinks)
             generates (Result retval, AudioPatchHandle patch);
 
-    /*
+    /**
      * Release an audio patch.
      *
      * @param patch patch handle.
@@ -173,7 +173,7 @@
      */
     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...)
@@ -189,7 +189,7 @@
     getAudioPort(AudioPort port)
             generates (Result retval, AudioPort resultPort);
 
-    /*
+    /**
      * Set audio port configuration.
      *
      * @param config audio port configuration.
@@ -197,7 +197,7 @@
      */
     setAudioPortConfig(AudioPortConfig config) generates (Result retval);
 
-    /*
+    /**
      * Gets the HW synchronization source of the device. Calling this method is
      * equivalent to getting AUDIO_PARAMETER_HW_AV_SYNC on the legacy HAL.
      *
@@ -205,7 +205,7 @@
      */
     getHwAvSync() generates (AudioHwSync hwAvSync);
 
-    /*
+    /**
      * Sets whether the screen is on. Calling this method is equivalent to
      * setting AUDIO_PARAMETER_KEY_SCREEN_STATE on the legacy HAL.
      *
@@ -214,7 +214,7 @@
      */
     setScreenState(bool turnedOn) 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.
@@ -226,7 +226,7 @@
     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.
@@ -236,7 +236,7 @@
      */
     setParameters(vec<ParameterValue> parameters) generates (Result retval);
 
-    /*
+    /**
      * Dumps information about the stream into the provided file descriptor.
      * This is used for the dumpsys facility.
      *
diff --git a/audio/2.0/IDevicesFactory.hal b/audio/2.0/IDevicesFactory.hal
index 0ef6bc5..6bbe7a1 100644
--- a/audio/2.0/IDevicesFactory.hal
+++ b/audio/2.0/IDevicesFactory.hal
@@ -30,7 +30,7 @@
         STUB
     };
 
-    /*
+    /**
      * Opens an audio device. To close the device, it is necessary to release
      * references to the returned device object.
      *
diff --git a/audio/2.0/IPrimaryDevice.hal b/audio/2.0/IPrimaryDevice.hal
index f1dd56e..adeb366 100644
--- a/audio/2.0/IPrimaryDevice.hal
+++ b/audio/2.0/IPrimaryDevice.hal
@@ -22,7 +22,7 @@
 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.
@@ -30,7 +30,7 @@
      */
     setVoiceVolume(float volume) generates (Result retval);
 
-    /*
+    /**
      * This method is used to notify the HAL about audio mode changes.
      *
      * @param mode new mode.
@@ -38,7 +38,7 @@
      */
     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.
@@ -48,7 +48,7 @@
      */
     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.
@@ -58,7 +58,7 @@
      */
     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.
      *
@@ -67,7 +67,7 @@
      */
     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.
      *
@@ -83,7 +83,7 @@
         FULL
     };
 
-    /*
+    /**
      * Gets current TTY mode selection. Calling this method is equivalent to
      * getting AUDIO_PARAMETER_KEY_TTY_MODE on the legacy HAL.
      *
@@ -92,7 +92,7 @@
      */
     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.
      *
@@ -101,7 +101,7 @@
      */
     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.
@@ -111,7 +111,7 @@
      */
     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.
diff --git a/audio/2.0/IStream.hal b/audio/2.0/IStream.hal
index 8de7851..2b9cc06 100644
--- a/audio/2.0/IStream.hal
+++ b/audio/2.0/IStream.hal
@@ -22,14 +22,14 @@
 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.
      *
@@ -37,7 +37,7 @@
      */
     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.
      *
@@ -45,14 +45,14 @@
      */
     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.
@@ -61,7 +61,7 @@
      */
     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.
      *
@@ -70,14 +70,14 @@
      */
     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.
@@ -86,7 +86,7 @@
      */
     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.
      *
@@ -95,14 +95,14 @@
      */
     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.
@@ -111,7 +111,7 @@
      */
     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.
      *
@@ -120,7 +120,7 @@
      */
     setFormat(AudioFormat format) generates (Result retval);
 
-    /*
+    /**
      * Convenience method for retrieving several stream parameters in
      * one transaction.
      *
@@ -131,7 +131,7 @@
     getAudioProperties() generates (
             uint32_t sampleRateHz, AudioChannelMask mask, AudioFormat format);
 
-    /*
+    /**
      * Applies audio effect to the stream.
      *
      * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
@@ -140,7 +140,7 @@
      */
     addEffect(uint64_t effectId) generates (Result retval);
 
-    /*
+    /**
      * Stops application of the effect to the stream.
      *
      * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
@@ -149,7 +149,7 @@
      */
     removeEffect(uint64_t effectId) generates (Result retval);
 
-    /*
+    /**
      * Put the audio hardware input/output into standby mode.
      * Driver must exit from standby mode at the next I/O operation.
      *
@@ -157,14 +157,14 @@
      */
     standby() generates (Result retval);
 
-    /*
+    /**
      * Return the set of device(s) which this stream is connected to.
      *
      * @return device set of device(s) which this stream is connected to.
      */
     getDevice() generates (AudioDevice device);
 
-    /*
+    /**
      * Connects the stream to the device.
      *
      * This method must only be used for HALs that do not support
@@ -177,7 +177,7 @@
      */
     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.
@@ -189,7 +189,7 @@
     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.
      *
@@ -198,7 +198,7 @@
      */
     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.
@@ -210,7 +210,7 @@
     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.
@@ -220,7 +220,7 @@
      */
     setParameters(vec<ParameterValue> parameters) generates (Result retval);
 
-    /*
+    /**
      * Dumps information about the stream into the provided file descriptor.
      * This is used for the dumpsys facility.
      *
@@ -228,7 +228,7 @@
      */
     debugDump(handle fd);
 
-    /*
+    /**
      * Called by the framework to start a stream operating in mmap mode.
      * createMmapBuffer() must be called before calling start().
      * Function only implemented by streams operating in mmap mode.
@@ -249,7 +249,7 @@
      */
     stop() generates (Result retval) ;
 
-    /*
+    /**
      * Called by the framework to retrieve information on the mmap buffer used for audio
      * samples transfer.
      * Function only implemented by streams operating in mmap mode.
@@ -266,7 +266,7 @@
     createMmapBuffer(int32_t minSizeFrames)
             generates (Result retval, MmapBufferInfo info);
 
-    /*
+    /**
      * Called by the framework to read current read/write position in the mmap buffer
      * with associated time stamp.
      * Function only implemented by streams operating in mmap mode.
@@ -280,7 +280,7 @@
     getMmapPosition()
             generates (Result retval, MmapPosition position);
 
-    /*
+    /**
      * Called by the framework to deinitialize the stream and free up
      * all the currently allocated resources. It is recommended to close
      * the stream on the client side as soon as it is becomes unused.
diff --git a/audio/2.0/IStreamIn.hal b/audio/2.0/IStreamIn.hal
index 6f1f9df..6b79f48 100644
--- a/audio/2.0/IStreamIn.hal
+++ b/audio/2.0/IStreamIn.hal
@@ -22,7 +22,7 @@
 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.
@@ -32,7 +32,7 @@
      */
     getAudioSource() generates (Result retval, AudioSource source);
 
-    /*
+    /**
      * Set the input gain for the audio driver.
      *
      * @param gain 1.0f is unity, 0.0f is zero.
@@ -40,7 +40,7 @@
      */
     setGain(float gain) generates (Result retval);
 
-    /*
+    /**
      * Commands that can be executed on the driver reader thread.
      */
     enum ReadCommand : int32_t {
@@ -48,7 +48,7 @@
         GET_CAPTURE_POSITION
     };
 
-    /*
+    /**
      * Data structure passed to the driver for executing commands
      * on the driver reader thread.
      */
@@ -60,7 +60,7 @@
         } params;
     };
 
-    /*
+    /**
      * Data structure passed back to the client via status message queue
      * of 'read' operation.
      *
@@ -81,7 +81,7 @@
         } reply;
     };
 
-    /*
+    /**
      * Set up required transports for receiving audio buffers from the driver.
      *
      * The transport consists of three message queues:
@@ -119,7 +119,7 @@
             fmq_sync<ReadStatus> statusMQ,
             ThreadInfo threadInfo);
 
-    /*
+    /**
      * Return the amount of input frames lost in the audio driver since the last
      * call of this function.
      *
diff --git a/audio/2.0/IStreamOut.hal b/audio/2.0/IStreamOut.hal
index 9ee32c5..84b7447 100644
--- a/audio/2.0/IStreamOut.hal
+++ b/audio/2.0/IStreamOut.hal
@@ -23,14 +23,14 @@
 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.
@@ -43,7 +43,7 @@
      */
     setVolume(float left, float right) generates (Result retval);
 
-    /*
+    /**
      * Commands that can be executed on the driver writer thread.
      */
     enum WriteCommand : int32_t {
@@ -52,7 +52,7 @@
         GET_LATENCY
     };
 
-    /*
+    /**
      * Data structure passed back to the client via status message queue
      * of 'write' operation.
      *
@@ -75,7 +75,7 @@
         } reply;
     };
 
-    /*
+    /**
      * Set up required transports for passing audio buffers to the driver.
      *
      * The transport consists of three message queues:
@@ -112,7 +112,7 @@
             fmq_sync<WriteStatus> statusMQ,
             ThreadInfo threadInfo);
 
-    /*
+    /**
      * Return the number of audio frames written by the audio DSP to DAC since
      * the output has exited standby.
      *
@@ -121,7 +121,7 @@
      */
     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.
@@ -131,7 +131,7 @@
      */
     getNextWriteTimestamp() generates (Result retval, int64_t timestampUs);
 
-    /*
+    /**
      * Set the callback interface for notifying completion of non-blocking
      * write and drain.
      *
@@ -146,7 +146,7 @@
      */
     setCallback(IStreamOutCallback callback) generates (Result retval);
 
-    /*
+    /**
      * Clears the callback previously set via 'setCallback' method.
      *
      * Warning: failure to call this method results in callback implementation
@@ -156,7 +156,7 @@
      */
     clearCallback() generates (Result retval);
 
-    /*
+    /**
      * Returns whether HAL supports pausing and resuming of streams.
      *
      * @return supportsPause true if pausing is supported.
@@ -179,7 +179,7 @@
      */
     pause() generates (Result retval);
 
-    /*
+    /**
      * Notifies to the audio driver to resume playback following a pause.
      * Returns error INVALID_STATE if called without matching pause.
      *
@@ -189,7 +189,7 @@
      */
     resume() generates (Result retval);
 
-    /*
+    /**
      * Returns whether HAL supports draining of streams.
      *
      * @return supports true if draining is supported.
@@ -220,7 +220,7 @@
      */
     drain(AudioDrain type) generates (Result retval);
 
-    /*
+    /**
      * Notifies to the audio driver to flush the queued data. Stream must
      * already be paused before calling 'flush'.
      *
@@ -230,7 +230,7 @@
      */
     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
diff --git a/audio/2.0/IStreamOutCallback.hal b/audio/2.0/IStreamOutCallback.hal
index cdb38de..01e123c 100644
--- a/audio/2.0/IStreamOutCallback.hal
+++ b/audio/2.0/IStreamOutCallback.hal
@@ -16,21 +16,21 @@
 
 package android.hardware.audio@2.0;
 
-/*
+/**
  * Asynchronous write callback interface.
  */
 interface IStreamOutCallback {
-    /*
+    /**
      * Non blocking write completed.
      */
     oneway onWriteReady();
 
-    /*
+    /**
      * Drain completed.
      */
     oneway onDrainReady();
 
-    /*
+    /**
      * Stream hit an error.
      */
     oneway onError();
diff --git a/audio/2.0/default/Device.cpp b/audio/2.0/default/Device.cpp
index 8a51cd7..5ced0bc 100644
--- a/audio/2.0/default/Device.cpp
+++ b/audio/2.0/default/Device.cpp
@@ -59,6 +59,14 @@
     }
 }
 
+void Device::closeInputStream(audio_stream_in_t* stream) {
+    mDevice->close_input_stream(mDevice, stream);
+}
+
+void Device::closeOutputStream(audio_stream_out_t* stream) {
+    mDevice->close_output_stream(mDevice, stream);
+}
+
 char* Device::halGetParameters(const char* keys) {
     return mDevice->get_parameters(mDevice, keys);
 }
@@ -160,7 +168,7 @@
     ALOGV("open_output_stream status %d stream %p", status, halStream);
     sp<IStreamOut> streamOut;
     if (status == OK) {
-        streamOut = new StreamOut(mDevice, halStream);
+        streamOut = new StreamOut(this, halStream);
     }
     AudioConfig suggestedConfig;
     HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
@@ -196,7 +204,7 @@
     ALOGV("open_input_stream status %d stream %p", status, halStream);
     sp<IStreamIn> streamIn;
     if (status == OK) {
-        streamIn = new StreamIn(mDevice, halStream);
+        streamIn = new StreamIn(this, halStream);
     }
     AudioConfig suggestedConfig;
     HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
diff --git a/audio/2.0/default/Device.h b/audio/2.0/default/Device.h
index 46177fc..7738361 100644
--- a/audio/2.0/default/Device.h
+++ b/audio/2.0/default/Device.h
@@ -98,6 +98,8 @@
 
     // Utility methods for extending interfaces.
     Result analyzeStatus(const char* funcName, int status);
+    void closeInputStream(audio_stream_in_t* stream);
+    void closeOutputStream(audio_stream_out_t* stream);
     audio_hw_device_t* device() const { return mDevice; }
 
   private:
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index b641e82..2745607 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -135,7 +135,7 @@
 
 }  // namespace
 
-StreamIn::StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream)
+StreamIn::StreamIn(const sp<Device>& device, audio_stream_in_t* stream)
         : mIsClosed(false), mDevice(device), mStream(stream),
           mStreamCommon(new Stream(&stream->common)),
           mStreamMmap(new StreamMmap<audio_stream_in_t>(stream)),
@@ -154,9 +154,8 @@
         status_t status = EventFlag::deleteEventFlag(&mEfGroup);
         ALOGE_IF(status, "read MQ event flag deletion error: %s", strerror(-status));
     }
-    mDevice->close_input_stream(mDevice, mStream);
+    mDevice->closeInputStream(mStream);
     mStream = nullptr;
-    mDevice = nullptr;
 }
 
 // Methods from ::android::hardware::audio::V2_0::IStream follow.
diff --git a/audio/2.0/default/StreamIn.h b/audio/2.0/default/StreamIn.h
index b867387..950d68f 100644
--- a/audio/2.0/default/StreamIn.h
+++ b/audio/2.0/default/StreamIn.h
@@ -27,6 +27,7 @@
 #include <hidl/Status.h>
 #include <utils/Thread.h>
 
+#include "Device.h"
 #include "Stream.h"
 
 namespace android {
@@ -55,7 +56,7 @@
     typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
     typedef MessageQueue<ReadStatus, kSynchronizedReadWrite> StatusMQ;
 
-    StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream);
+    StreamIn(const sp<Device>& device, audio_stream_in_t* stream);
 
     // Methods from ::android::hardware::audio::V2_0::IStream follow.
     Return<uint64_t> getFrameSize()  override;
@@ -101,10 +102,10 @@
 
   private:
     bool mIsClosed;
-    audio_hw_device_t *mDevice;
+    const sp<Device> mDevice;
     audio_stream_in_t *mStream;
-    sp<Stream> mStreamCommon;
-    sp<StreamMmap<audio_stream_in_t>> mStreamMmap;
+    const sp<Stream> mStreamCommon;
+    const sp<StreamMmap<audio_stream_in_t>> mStreamMmap;
     std::unique_ptr<CommandMQ> mCommandMQ;
     std::unique_ptr<DataMQ> mDataMQ;
     std::unique_ptr<StatusMQ> mStatusMQ;
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index d820f3c..88045a0 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -135,7 +135,7 @@
 
 }  // namespace
 
-StreamOut::StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream)
+StreamOut::StreamOut(const sp<Device>& device, audio_stream_out_t* stream)
         : mIsClosed(false), mDevice(device), mStream(stream),
           mStreamCommon(new Stream(&stream->common)),
           mStreamMmap(new StreamMmap<audio_stream_out_t>(stream)),
@@ -155,9 +155,8 @@
         ALOGE_IF(status, "write MQ event flag deletion error: %s", strerror(-status));
     }
     mCallback.clear();
-    mDevice->close_output_stream(mDevice, mStream);
+    mDevice->closeOutputStream(mStream);
     mStream = nullptr;
-    mDevice = nullptr;
 }
 
 // Methods from ::android::hardware::audio::V2_0::IStream follow.
diff --git a/audio/2.0/default/StreamOut.h b/audio/2.0/default/StreamOut.h
index bbe64a1..99352bc 100644
--- a/audio/2.0/default/StreamOut.h
+++ b/audio/2.0/default/StreamOut.h
@@ -27,6 +27,7 @@
 #include <fmq/MessageQueue.h>
 #include <utils/Thread.h>
 
+#include "Device.h"
 #include "Stream.h"
 
 namespace android {
@@ -57,7 +58,7 @@
     typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
     typedef MessageQueue<WriteStatus, kSynchronizedReadWrite> StatusMQ;
 
-    StreamOut(audio_hw_device_t* device, audio_stream_out_t* stream);
+    StreamOut(const sp<Device>& device, audio_stream_out_t* stream);
 
     // Methods from ::android::hardware::audio::V2_0::IStream follow.
     Return<uint64_t> getFrameSize()  override;
@@ -112,10 +113,10 @@
 
   private:
     bool mIsClosed;
-    audio_hw_device_t *mDevice;
+    const sp<Device> mDevice;
     audio_stream_out_t *mStream;
-    sp<Stream> mStreamCommon;
-    sp<StreamMmap<audio_stream_out_t>> mStreamMmap;
+    const sp<Stream> mStreamCommon;
+    const sp<StreamMmap<audio_stream_out_t>> mStreamMmap;
     sp<IStreamOutCallback> mCallback;
     std::unique_ptr<CommandMQ> mCommandMQ;
     std::unique_ptr<DataMQ> mDataMQ;
diff --git a/audio/2.0/types.hal b/audio/2.0/types.hal
index 8e9ff14..93118c2 100644
--- a/audio/2.0/types.hal
+++ b/audio/2.0/types.hal
@@ -28,14 +28,16 @@
 
 @export(name="audio_drain_type_t", value_prefix="AUDIO_DRAIN_")
 enum AudioDrain : int32_t {
-    /* drain() returns when all data has been played. */
+    /** 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. */
+    /**
+     * 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 {
@@ -43,7 +45,7 @@
     uint64_t tvNSec;  // nanoseconds
 };
 
-/*
+/**
  * IEEE 802 MAC address.
  */
 typedef uint8_t[6] MacAddress;
@@ -53,7 +55,7 @@
     string value;
 };
 
-/*
+/**
  * Specifies a device in case when several devices of the same type
  * can be connected (e.g. BT A2DP, USB).
  */
@@ -71,7 +73,7 @@
     string rSubmixAddress;  // used for REMOTE_SUBMIX
 };
 
-/*
+/**
  * Mmap buffer descriptor returned by IStream.createMmapBuffer().
  * Used by streams opened in mmap mode.
  */
@@ -81,7 +83,7 @@
     int32_t burstSizeFrames;      // transfer size granularity in frames
 };
 
-/*
+/**
  * Mmap buffer read/write position returned by IStream.getMmapPosition().
  * Used by streams opened in mmap mode.
  */
@@ -90,7 +92,7 @@
     int32_t  positionFrames;  // increasing 32 bit frame count reset when IStream.stop() is called
 };
 
-/*
+/**
  * The message queue flags used to synchronize reads and writes from
  * message queues used by StreamIn and StreamOut.
  */
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
index dd7281d..7c49795 100644
--- a/audio/common/2.0/types.hal
+++ b/audio/common/2.0/types.hal
@@ -16,28 +16,28 @@
 
 package android.hardware.audio.common@2.0;
 
-/*
+/**
  *
  *  IDs and Handles
  *
  */
 
-/*
+/**
  * Handle type for identifying audio sources and sinks.
  */
 typedef int32_t AudioIoHandle;
 
-/*
+/**
  * Audio hw module handle functions or structures referencing a module.
  */
 typedef int32_t AudioModuleHandle;
 
-/*
+/**
  * Each port has a unique ID or handle allocated by policy manager.
  */
 typedef int32_t AudioPortHandle;
 
-/*
+/**
  * Each patch is identified by a handle at the interface used to create that
  * patch. For instance, when a patch is created by the audio HAL, the HAL
  * allocates and returns a handle.  This handle is unique to a given audio HAL
@@ -47,12 +47,12 @@
  */
 typedef int32_t AudioPatchHandle;
 
-/*
+/**
  * A HW synchronization source returned by the audio HAL.
  */
 typedef uint32_t AudioHwSync;
 
-/*
+/**
  * Each port has a unique ID or handle allocated by policy manager.
  */
 @export(name="")
@@ -63,7 +63,7 @@
     AUDIO_PATCH_HANDLE_NONE = 0,
 };
 
-/*
+/**
  * Commonly used structure for passing unique identifieds (UUID).
  * For the definition of UUID, refer to ITU-T X.667 spec.
  */
@@ -76,13 +76,13 @@
 };
 
 
-/*
+/**
  *
  *  Audio streams
  *
  */
 
-/*
+/**
  * Audio stream type describing the intented use case of a stream.
  */
 @export(name="audio_stream_type_t", value_prefix="AUDIO_STREAM_")
@@ -126,13 +126,13 @@
     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.
      */
     REMOTE_SUBMIX       = 8,
-    /*
+    /**
      * Source for unprocessed sound. Usage examples include level measurement
      * and raw signal analysis.
      */
@@ -141,7 +141,7 @@
     CNT,
     MAX                 = CNT - 1,
     FM_TUNER            = 1998,
-    /*
+    /**
      * A low-priority, preemptible audio source for for background software
      * hotword detection. Same tuning as VOICE_RECOGNITION.  Used only
      * internally by the framework.
@@ -150,30 +150,30 @@
 };
 
 typedef int32_t AudioSession;
-/*
+/**
  * Special audio session values.
  */
 @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)
      */
     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)
      */
     OUTPUT_MIX = 0,
-    /*
+    /**
      * Application does not specify an explicit session ID to be used, and
      * requests a new session ID to be allocated. Corresponds to
      * AudioManager.AUDIO_SESSION_ID_GENERATE and
      * AudioSystem.AUDIO_SESSION_ALLOCATE.
      */
     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.
@@ -181,7 +181,7 @@
     NONE = 0
 };
 
-/*
+/**
  * Audio format  is a 32-bit word that consists of:
  *   main format field (upper 8 bits)
  *   sub format field (lower 24 bits).
@@ -196,13 +196,13 @@
 enum AudioFormat : uint32_t {
     INVALID             = 0xFFFFFFFFUL,
     DEFAULT             = 0,
-    PCM                 = 0x00000000UL, /* DO NOT CHANGE */
+    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*/
+    HE_AAC_V1           = 0x05000000UL, /** Deprecated, Use AAC_HE_V1 */
+    HE_AAC_V2           = 0x06000000UL, /** Deprecated, Use AAC_HE_V2 */
     VORBIS              = 0x07000000UL,
     OPUS                = 0x08000000UL,
     AC3                 = 0x09000000UL,
@@ -232,10 +232,10 @@
     APTX_HD             = 0x21000000UL,
     AC4                 = 0x22000000UL,
     LDAC                = 0x23000000UL,
-    MAIN_MASK           = 0xFF000000UL, /* Deprecated */
+    MAIN_MASK           = 0xFF000000UL, /** Deprecated */
     SUB_MASK            = 0x00FFFFFFUL,
 
-    /* Subformats */
+    /** Subformats */
     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
@@ -260,10 +260,10 @@
 
     VORBIS_SUB_NONE       = 0x0,
 
-    /* Aliases */
-    /* note != AudioFormat.ENCODING_PCM_16BIT */
+    /** Aliases */
+    /** note != AudioFormat.ENCODING_PCM_16BIT */
     PCM_16_BIT          = (PCM | PCM_SUB_16_BIT),
-    /* note != AudioFormat.ENCODING_PCM_8BIT */
+    /** note != AudioFormat.ENCODING_PCM_8BIT */
     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),
@@ -291,7 +291,7 @@
     AAC_ADTS_ELD        = (AAC_ADTS | AAC_SUB_ELD)
 };
 
-/*
+/**
  * Usage of these values highlights places in the code that use 2- or 8- channel
  * assumptions.
  */
@@ -301,7 +301,7 @@
     FCC_8 = 8  // This is typically due to audio mixer and resampler limitations
 };
 
-/*
+/**
  * A channel mask per se only defines the presence or absence of a channel, not
  * the order.  See AUDIO_INTERLEAVE_* for the platform convention of order.
  *
@@ -335,21 +335,21 @@
  */
 @export(name="", value_prefix="AUDIO_CHANNEL_")
 enum AudioChannelMask : uint32_t {
-    REPRESENTATION_POSITION = 0, /* must be 0 for compatibility */
-    /* 1 is reserved for future use */
+    REPRESENTATION_POSITION = 0, /** must be 0 for compatibility */
+    /** 1 is reserved for future use */
     REPRESENTATION_INDEX    = 2,
-    /* 3 is reserved for future use */
+    /** 3 is reserved for future use */
 
-    /* These can be a complete value of AudioChannelMask */
+    /** These can be a complete value of AudioChannelMask */
     NONE                      = 0x0,
     INVALID                   = 0xC0000000,
 
-   /*
+   /**
     * These can be the bits portion of an AudioChannelMask
     * with representation REPRESENTATION_POSITION.
     */
 
-    /* output channels */
+    /** output channels */
     OUT_FRONT_LEFT            = 0x1,
     OUT_FRONT_RIGHT           = 0x2,
     OUT_FRONT_CENTER          = 0x4,
@@ -375,7 +375,7 @@
     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_* */
+    /** 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_SURROUND = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
@@ -385,7 +385,7 @@
             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_* */
+    /** 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),
@@ -393,7 +393,7 @@
             OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
             OUT_BACK_LEFT | OUT_BACK_RIGHT |
             OUT_BACK_CENTER),
-    /* matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND */
+    /** matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND */
     OUT_7POINT1  = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
             OUT_FRONT_CENTER | OUT_LOW_FREQUENCY |
             OUT_BACK_LEFT | OUT_BACK_RIGHT |
@@ -408,9 +408,9 @@
             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 */
+    /** These are bits only, not complete values */
 
-    /* input channels */
+    /** input channels */
     IN_LEFT            = 0x4,
     IN_RIGHT           = 0x8,
     IN_FRONT           = 0x10,
@@ -456,7 +456,7 @@
 };
 
 
-/*
+/**
  * 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].
@@ -472,7 +472,7 @@
     RIGHT  = 1,
 };
 
-/*
+/**
  * Major modes for a mobile device. The current mode setting affects audio
  * routing.
  */
@@ -492,10 +492,10 @@
 @export(name="", value_prefix="AUDIO_DEVICE_")
 enum AudioDevice : uint32_t {
     NONE                          = 0x0,
-    /* reserved bits */
+    /** reserved bits */
     BIT_IN                        = 0x80000000,
     BIT_DEFAULT                   = 0x40000000,
-    /* output devices */
+    /** output devices */
     OUT_EARPIECE                  = 0x1,
     OUT_SPEAKER                   = 0x2,
     OUT_WIRED_HEADSET             = 0x4,
@@ -508,30 +508,30 @@
     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) */
+    /** uses an analog connection (multiplexed over the USB pins for instance) */
     OUT_ANLG_DOCK_HEADSET         = 0x800,
     OUT_DGTL_DOCK_HEADSET         = 0x1000,
-    /* USB accessory mode: Android device is USB device and dock is USB host */
+    /** USB accessory mode: Android device is USB device and dock is USB host */
     OUT_USB_ACCESSORY             = 0x2000,
-    /* USB host mode: Android device is USB host and dock is USB device */
+    /** USB host mode: Android device is USB host and dock is USB device */
     OUT_USB_DEVICE                = 0x4000,
     OUT_REMOTE_SUBMIX             = 0x8000,
-    /* Telephony voice TX path */
+    /** Telephony voice TX path */
     OUT_TELEPHONY_TX              = 0x10000,
-    /* Analog jack with line impedance detected */
+    /** Analog jack with line impedance detected */
     OUT_LINE                      = 0x20000,
-    /* HDMI Audio Return Channel */
+    /** HDMI Audio Return Channel */
     OUT_HDMI_ARC                  = 0x40000,
-    /* S/PDIF out */
+    /** S/PDIF out */
     OUT_SPDIF                     = 0x80000,
-    /* FM transmitter out */
+    /** FM transmitter out */
     OUT_FM                        = 0x100000,
-    /* Line out for av devices */
+    /** Line out for av devices */
     OUT_AUX_LINE                  = 0x200000,
-    /* limited-output speaker device for acoustic safety */
+    /** limited-output speaker device for acoustic safety */
     OUT_SPEAKER_SAFE              = 0x400000,
     OUT_IP                        = 0x800000,
-    /* audio bus implemented by the audio system (e.g an MOST stereo channel) */
+    /** audio bus implemented by the audio system (e.g an MOST stereo channel) */
     OUT_BUS                       = 0x1000000,
     OUT_PROXY                     = 0x2000000,
     OUT_USB_HEADSET               = 0x4000000,
@@ -571,7 +571,7 @@
             OUT_BLUETOOTH_SCO_HEADSET |
             OUT_BLUETOOTH_SCO_CARKIT),
     OUT_ALL_USB  = (OUT_USB_ACCESSORY | OUT_USB_DEVICE | OUT_USB_HEADSET),
-    /* input devices */
+    /** input devices */
     IN_COMMUNICATION         = BIT_IN | 0x1,
     IN_AMBIENT               = BIT_IN | 0x2,
     IN_BUILTIN_MIC           = BIT_IN | 0x4,
@@ -579,7 +579,7 @@
     IN_WIRED_HEADSET         = BIT_IN | 0x10,
     IN_AUX_DIGITAL           = BIT_IN | 0x20,
     IN_HDMI                  = IN_AUX_DIGITAL,
-    /* Telephony voice RX path */
+    /** Telephony voice RX path */
     IN_VOICE_CALL            = BIT_IN | 0x40,
     IN_TELEPHONY_RX          = IN_VOICE_CALL,
     IN_BACK_MIC              = BIT_IN | 0x80,
@@ -588,18 +588,18 @@
     IN_DGTL_DOCK_HEADSET     = BIT_IN | 0x400,
     IN_USB_ACCESSORY         = BIT_IN | 0x800,
     IN_USB_DEVICE            = BIT_IN | 0x1000,
-    /* FM tuner input */
+    /** FM tuner input */
     IN_FM_TUNER              = BIT_IN | 0x2000,
-    /* TV tuner input */
+    /** TV tuner input */
     IN_TV_TUNER              = BIT_IN | 0x4000,
-    /* Analog jack with line impedance detected */
+    /** Analog jack with line impedance detected */
     IN_LINE                  = BIT_IN | 0x8000,
-    /* S/PDIF in */
+    /** S/PDIF in */
     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 bus implemented by the audio system (e.g an MOST stereo channel) */
     IN_BUS                   = BIT_IN | 0x100000,
     IN_PROXY                 = BIT_IN | 0x1000000,
     IN_USB_HEADSET           = BIT_IN | 0x2000000,
@@ -633,7 +633,7 @@
     IN_ALL_USB  = (IN_USB_ACCESSORY | IN_USB_DEVICE | IN_USB_HEADSET),
 };
 
-/*
+/**
  * The audio output flags serve two purposes:
  *
  *  - when an AudioTrack is created they indicate a "wish" to be connected to an
@@ -674,7 +674,7 @@
     VOIP_RX = 0x8000,    // preferred output for VoIP calls.
 };
 
-/*
+/**
  * The audio input flags are analogous to audio output flags.
  * Currently they are used only when an AudioRecord is created,
  * to indicate a preference to be connected to an input stream with
@@ -717,7 +717,7 @@
     MAX                                = CNT - 1,
 };
 
-/*
+/**
  * Additional information about the stream passed to hardware decoders.
  */
 struct AudioOffloadInfo {
@@ -734,7 +734,7 @@
     AudioUsage usage;
 };
 
-/*
+/**
  * Commonly used audio stream configuration parameters.
  */
 struct AudioConfig {
@@ -746,13 +746,13 @@
 };
 
 
-/*
+/**
  *
  *  Volume control
  *
  */
 
-/*
+/**
  * Type of gain control exposed by an audio port.
  */
 @export(name="", value_prefix="AUDIO_GAIN_MODE_")
@@ -762,7 +762,7 @@
     RAMP = 0x4      // supports gain ramps
 };
 
-/*
+/**
  * An audio_gain struct is a representation of a gain stage.
  * A gain stage is always attached to an audio port.
  */
@@ -777,7 +777,7 @@
     uint32_t maxRampMs;   // maximum ramp duration in ms
 };
 
-/*
+/**
  * The gain configuration structure is used to get or set the gain values of a
  * given port.
  */
@@ -785,7 +785,7 @@
     int32_t index;  // index of the corresponding AudioGain in AudioPort.gains
     AudioGainMode mode;
     AudioChannelMask channelMask;  // channels which gain value follows
-    /*
+    /**
      * 4 = sizeof(AudioChannelMask),
      * 8 is not "FCC_8", so it won't need to be changed for > 8 channels.
      * Gain values in millibels for each channel ordered from LSb to MSb in
@@ -797,13 +797,13 @@
 };
 
 
-/*
+/**
  *
  *  Routing control
  *
  */
 
-/*
+/**
  * Types defined here are used to describe an audio source or sink at internal
  * framework interfaces (audio policy, patch panel) or at the audio HAL.
  * Sink and sources are grouped in a concept of “audio port” representing an
@@ -811,7 +811,7 @@
  * the interface.
  */
 
-/* Audio port role: either source or sink */
+/** Audio port role: either source or sink */
 @export(name="audio_port_role_t", value_prefix="AUDIO_PORT_ROLE_")
 enum AudioPortRole : int32_t {
     NONE,
@@ -819,7 +819,7 @@
     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 OUT_SPEAKER)
  */
@@ -831,7 +831,7 @@
     SESSION,
 };
 
-/*
+/**
  * Extension for audio port configuration structure when the audio port is a
  * hardware device.
  */
@@ -841,7 +841,7 @@
     uint8_t[32] address;         // device address. "" if N/A
 };
 
-/*
+/**
  * Extension for audio port configuration structure when the audio port is an
  * audio session.
  */
@@ -849,7 +849,7 @@
     AudioSession session;
 };
 
-/*
+/**
  * Flags indicating which fields are to be considered in AudioPortConfig.
  */
 @export(name="", value_prefix="AUDIO_PORT_CONFIG_")
@@ -861,7 +861,7 @@
     ALL = SAMPLE_RATE | CHANNEL_MASK | FORMAT | GAIN
 };
 
-/*
+/**
  * Audio port configuration structure used to specify a particular configuration
  * of an audio port.
  */
@@ -888,7 +888,7 @@
     } ext;
 };
 
-/*
+/**
  * Extension for audio port structure when the audio port is a hardware device.
  */
 struct AudioPortDeviceExt {
@@ -897,7 +897,7 @@
     uint8_t[32] address;
 };
 
-/*
+/**
  * Latency class of the audio mix.
  */
 @export(name="audio_mix_latency_class_t", value_prefix="AUDIO_LATENCY_")
@@ -912,7 +912,7 @@
     AudioMixLatencyClass latencyClass;
 };
 
-/*
+/**
  * Extension for audio port structure when the audio port is an audio session.
  */
 struct AudioPortSessionExt {
diff --git a/audio/effect/2.0/IAcousticEchoCancelerEffect.hal b/audio/effect/2.0/IAcousticEchoCancelerEffect.hal
index 9e2e0c3..b5f94a5 100644
--- a/audio/effect/2.0/IAcousticEchoCancelerEffect.hal
+++ b/audio/effect/2.0/IAcousticEchoCancelerEffect.hal
@@ -20,12 +20,12 @@
 import IEffect;
 
 interface IAcousticEchoCancelerEffect extends IEffect {
-    /*
+    /**
      * Sets echo delay value in milliseconds.
      */
     setEchoDelay(uint32_t echoDelayMs) generates (Result retval);
 
-    /*
+    /**
      * Gets echo delay value in milliseconds.
      */
     getEchoDelay() generates (Result retval, uint32_t echoDelayMs);
diff --git a/audio/effect/2.0/IAutomaticGainControlEffect.hal b/audio/effect/2.0/IAutomaticGainControlEffect.hal
index a02002d..b8ca7e3 100644
--- a/audio/effect/2.0/IAutomaticGainControlEffect.hal
+++ b/audio/effect/2.0/IAutomaticGainControlEffect.hal
@@ -20,32 +20,32 @@
 import IEffect;
 
 interface IAutomaticGainControlEffect extends IEffect {
-    /*
+    /**
      * Sets target level in millibels.
      */
     setTargetLevel(int16_t targetLevelMb) generates (Result retval);
 
-    /*
+    /**
      * Gets target level.
      */
     getTargetLevel() generates (Result retval, int16_t targetLevelMb);
 
-    /*
+    /**
      * Sets gain in the compression range in millibels.
      */
     setCompGain(int16_t compGainMb) generates (Result retval);
 
-    /*
+    /**
      * Gets gain in the compression range.
      */
     getCompGain() generates (Result retval, int16_t compGainMb);
 
-    /*
+    /**
      * Enables or disables limiter.
      */
     setLimiterEnabled(bool enabled) generates (Result retval);
 
-    /*
+    /**
      * Returns whether limiter is enabled.
      */
     isLimiterEnabled() generates (Result retval, bool enabled);
@@ -56,12 +56,12 @@
         bool limiterEnabled;
     };
 
-    /*
+    /**
      * Sets all properties at once.
      */
     setAllProperties(AllProperties properties) generates (Result retval);
 
-    /*
+    /**
      * Gets all properties at once.
      */
     getAllProperties() generates (Result retval, AllProperties properties);
diff --git a/audio/effect/2.0/IBassBoostEffect.hal b/audio/effect/2.0/IBassBoostEffect.hal
index bcf7b7d..db6a297 100644
--- a/audio/effect/2.0/IBassBoostEffect.hal
+++ b/audio/effect/2.0/IBassBoostEffect.hal
@@ -20,7 +20,7 @@
 import IEffect;
 
 interface IBassBoostEffect extends IEffect {
-    /*
+    /**
      * Returns whether setting bass boost strength is supported.
      */
     isStrengthSupported() generates (Result retval, bool strengthSupported);
@@ -30,7 +30,7 @@
         MAX = 1000
     };
 
-    /*
+    /**
      * Sets bass boost strength.
      *
      * @param strength strength of the effect. The valid range for strength
@@ -41,7 +41,7 @@
      */
     setStrength(uint16_t strength) generates (Result retval);
 
-    /*
+    /**
      * Gets virtualization strength.
      */
     getStrength() generates (Result retval, uint16_t strength);
diff --git a/audio/effect/2.0/IEffect.hal b/audio/effect/2.0/IEffect.hal
index d254e8c..332e2df 100644
--- a/audio/effect/2.0/IEffect.hal
+++ b/audio/effect/2.0/IEffect.hal
@@ -20,7 +20,7 @@
 import IEffectBufferProviderCallback;
 
 interface IEffect {
-    /*
+    /**
      * Initialize effect engine--all configurations return to default.
      *
      * @return retval operation completion status.
@@ -29,7 +29,7 @@
     @callflow(next={"*"})
     init() generates (Result retval);
 
-    /*
+    /**
      * Apply new audio parameters configurations for input and output buffers.
      * The provider callbacks may be empty, but in this case the buffer
      * must be provided in the EffectConfig structure.
@@ -45,7 +45,7 @@
             IEffectBufferProviderCallback outputBufferProvider)
             generates (Result retval);
 
-    /*
+    /**
      * Reset the effect engine. Keep configuration but resets state and buffer
      * content.
      *
@@ -54,7 +54,7 @@
     @callflow(next={"*"})
     reset() generates (Result retval);
 
-    /*
+    /**
      * Enable processing.
      *
      * @return retval operation completion status.
@@ -62,7 +62,7 @@
     @callflow(next={"prepareForProcessing"})
     enable() generates (Result retval);
 
-    /*
+    /**
      * Disable processing.
      *
      * @return retval operation completion status.
@@ -70,7 +70,7 @@
     @callflow(next={"close"})
     disable() generates (Result retval);
 
-    /*
+    /**
      * Set the rendering device the audio output path is connected to.  The
      * effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its
      * descriptor to receive this command when the device changes.
@@ -84,7 +84,7 @@
     @callflow(next={"*"})
     setDevice(AudioDevice device) generates (Result retval);
 
-    /*
+    /**
      * Set and get volume. Used by audio framework to delegate volume control to
      * effect engine. The effect implementation must set EFFECT_FLAG_VOLUME_CTRL
      * flag in its descriptor to receive this command. The effect engine must
@@ -103,7 +103,7 @@
     setAndGetVolume(vec<uint32_t> volumes)
             generates (Result retval, vec<uint32_t> result);
 
-    /*
+    /**
      * Notify the effect of the volume change. The effect implementation must
      * set EFFECT_FLAG_VOLUME_IND flag in its descriptor to receive this
      * command.
@@ -116,7 +116,7 @@
     volumeChangeNotification(vec<uint32_t> volumes)
             generates (Result retval);
 
-    /*
+    /**
      * Set the audio mode. The effect implementation must set
      * EFFECT_FLAG_AUDIO_MODE_IND flag in its descriptor to receive this command
      * when the audio mode changes.
@@ -127,7 +127,7 @@
     @callflow(next={"*"})
     setAudioMode(AudioMode mode) generates (Result retval);
 
-    /*
+    /**
      * Apply new audio parameters configurations for input and output buffers of
      * reverse stream.  An example of reverse stream is the echo reference
      * supplied to an Acoustic Echo Canceler.
@@ -143,7 +143,7 @@
             IEffectBufferProviderCallback outputBufferProvider)
             generates (Result retval);
 
-    /*
+    /**
      * Set the capture device the audio input path is connected to. The effect
      * implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to
      * receive this command when the device changes.
@@ -157,7 +157,7 @@
     @callflow(next={"*"})
     setInputDevice(AudioDevice device) generates (Result retval);
 
-    /*
+    /**
      * Read audio parameters configurations for input and output buffers.
      *
      * @return retval operation completion status.
@@ -166,7 +166,7 @@
     @callflow(next={"*"})
     getConfig() generates (Result retval, EffectConfig config);
 
-    /*
+    /**
      * Read audio parameters configurations for input and output buffers of
      * reverse stream.
      *
@@ -176,7 +176,7 @@
     @callflow(next={"*"})
     getConfigReverse() generates (Result retval, EffectConfig config);
 
-    /*
+    /**
      * Queries for supported combinations of main and auxiliary channels
      * (e.g. for a multi-microphone noise suppressor).
      *
@@ -190,7 +190,7 @@
     getSupportedAuxChannelsConfigs(uint32_t maxConfigs)
             generates (Result retval, vec<EffectAuxChannelsConfig> result);
 
-    /*
+    /**
      * Retrieves the current configuration of main and auxiliary channels.
      *
      * @return retval absence of the feature support is indicated using
@@ -201,7 +201,7 @@
     getAuxChannelsConfig()
             generates (Result retval, EffectAuxChannelsConfig result);
 
-    /*
+    /**
      * Sets the current configuration of main and auxiliary channels.
      *
      * @return retval operation completion status; absence of the feature
@@ -211,7 +211,7 @@
     setAuxChannelsConfig(EffectAuxChannelsConfig config)
             generates (Result retval);
 
-    /*
+    /**
      * Set the audio source the capture path is configured for (Camcorder, voice
      * recognition...).
      *
@@ -224,7 +224,7 @@
     @callflow(next={"*"})
     setAudioSource(AudioSource source) generates (Result retval);
 
-    /*
+    /**
      * This command indicates if the playback thread the effect is attached to
      * is offloaded or not, and updates the I/O handle of the playback thread
      * the effect is attached to.
@@ -235,7 +235,7 @@
     @callflow(next={"*"})
     offload(EffectOffloadParameter param) generates (Result retval);
 
-    /*
+    /**
      * Returns the effect descriptor.
      *
      * @return retval operation completion status.
@@ -244,7 +244,7 @@
     @callflow(next={"*"})
     getDescriptor() generates (Result retval, EffectDescriptor descriptor);
 
-    /*
+    /**
      * Set up required transports for passing audio buffers to the effect.
      *
      * The transport consists of shared memory and a message queue for reporting
@@ -270,7 +270,7 @@
     @callflow(next={"setProcessBuffers"})
     prepareForProcessing() generates (Result retval, fmq_sync<Result> statusMQ);
 
-    /*
+    /**
      * Set up input and output buffers for processing audio data. The effect
      * may modify both the input and the output buffer during the operation.
      * Buffers may be set multiple times during effect lifetime.
@@ -289,7 +289,7 @@
     setProcessBuffers(AudioBuffer inBuffer, AudioBuffer outBuffer) generates (
             Result retval);
 
-    /*
+    /**
      * Execute a vendor specific command on the effect. The command code
      * and data, as well as result data are not interpreted by Android
      * Framework and are passed as-is between the application and the effect.
@@ -310,7 +310,7 @@
     command(uint32_t commandId, vec<uint8_t> data, uint32_t resultMaxSize)
             generates (int32_t status, vec<uint8_t> result);
 
-    /*
+    /**
      * Set a vendor-specific parameter and apply it immediately. The parameter
      * code and data are not interpreted by Android Framework and are passed
      * as-is between the application and the effect.
@@ -331,7 +331,7 @@
     setParameter(vec<uint8_t> parameter, vec<uint8_t> value)
             generates (Result retval);
 
-    /*
+    /**
      * Get a vendor-specific parameter value. The parameter code and returned
      * data are not interpreted by Android Framework and are passed as-is
      * between the application and the effect.
@@ -353,7 +353,7 @@
     getParameter(vec<uint8_t> parameter, uint32_t valueMaxSize)
             generates (Result retval, vec<uint8_t> value);
 
-    /*
+    /**
      * Get supported configs for a vendor-specific feature. The configs returned
      * are not interpreted by Android Framework and are passed as-is between the
      * application and the effect.
@@ -384,7 +384,7 @@
                     uint32_t configsCount,
                     vec<uint8_t> configsData);
 
-    /*
+    /**
      * Get the current config for a vendor-specific feature. The config returned
      * is not interpreted by Android Framework and is passed as-is between the
      * application and the effect.
@@ -406,7 +406,7 @@
     getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize)
             generates (Result retval, vec<uint8_t> configData);
 
-    /*
+    /**
      * Set the current config for a vendor-specific feature. The config data
      * is not interpreted by Android Framework and is passed as-is between the
      * application and the effect.
@@ -426,7 +426,7 @@
     setCurrentConfigForFeature(uint32_t featureId, vec<uint8_t> configData)
             generates (Result retval);
 
-    /*
+    /**
      * Called by the framework to deinitialize the effect and free up
      * all the currently allocated resources. It is recommended to close
      * the effect on the client side as soon as it is becomes unused.
diff --git a/audio/effect/2.0/IEffectBufferProviderCallback.hal b/audio/effect/2.0/IEffectBufferProviderCallback.hal
index 53f4d6e..6ab33c3 100644
--- a/audio/effect/2.0/IEffectBufferProviderCallback.hal
+++ b/audio/effect/2.0/IEffectBufferProviderCallback.hal
@@ -16,12 +16,12 @@
 
 package android.hardware.audio.effect@2.0;
 
-/*
+/**
  * This callback interface contains functions that can be used by the effect
  * engine 'process' function to exchange input and output audio buffers.
  */
 interface IEffectBufferProviderCallback {
-    /*
+    /**
      * Called to retrieve a buffer where data should read from by 'process'
      * function.
      *
@@ -29,7 +29,7 @@
      */
     getBuffer() generates (AudioBuffer buffer);
 
-    /*
+    /**
      * Called to provide a buffer with the data written by 'process' function.
      *
      * @param buffer audio buffer for processing
diff --git a/audio/effect/2.0/IEffectsFactory.hal b/audio/effect/2.0/IEffectsFactory.hal
index c82b4a2..3d300ec 100644
--- a/audio/effect/2.0/IEffectsFactory.hal
+++ b/audio/effect/2.0/IEffectsFactory.hal
@@ -20,7 +20,7 @@
 import IEffect;
 
 interface IEffectsFactory {
-    /*
+    /**
      * Returns descriptors of different effects in all loaded libraries.
      *
      * @return retval operation completion status.
@@ -28,7 +28,7 @@
      */
     getAllDescriptors() generates(Result retval, vec<EffectDescriptor> result);
 
-    /*
+    /**
      * Returns a descriptor of a particular effect.
      *
      * @return retval operation completion status.
@@ -36,7 +36,7 @@
      */
     getDescriptor(Uuid uid) generates(Result retval, EffectDescriptor result);
 
-    /*
+    /**
      * Creates an effect engine of the specified type.  To release the effect
      * engine, it is necessary to release references to the returned effect
      * object.
@@ -56,7 +56,7 @@
     createEffect(Uuid uid, AudioSession session, AudioIoHandle ioHandle)
         generates (Result retval, IEffect result, uint64_t effectId);
 
-    /*
+    /**
      * Dumps information about effects into the provided file descriptor.
      * This is used for the dumpsys facility.
      *
diff --git a/audio/effect/2.0/IEnvironmentalReverbEffect.hal b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
index d9b1ee6..dca89f9 100644
--- a/audio/effect/2.0/IEnvironmentalReverbEffect.hal
+++ b/audio/effect/2.0/IEnvironmentalReverbEffect.hal
@@ -20,12 +20,12 @@
 import IEffect;
 
 interface IEnvironmentalReverbEffect extends IEffect {
-    /*
+    /**
      * Sets whether the effect should be bypassed.
      */
     setBypass(bool bypass) generates (Result retval);
 
-    /*
+    /**
      * Gets whether the effect should be bypassed.
      */
     getBypass() generates (Result retval, bool bypass);
@@ -53,102 +53,102 @@
         DENSITY_MAX = 1000
     };
 
-    /*
+    /**
      * Sets the room level.
      */
     setRoomLevel(int16_t roomLevel) generates (Result retval);
 
-    /*
+    /**
      * Gets the room level.
      */
     getRoomLevel() generates (Result retval, int16_t roomLevel);
 
-    /*
+    /**
      * Sets the room high frequences level.
      */
     setRoomHfLevel(int16_t roomHfLevel) generates (Result retval);
 
-    /*
+    /**
      * Gets the room high frequences level.
      */
     getRoomHfLevel() generates (Result retval, int16_t roomHfLevel);
 
-    /*
+    /**
      * Sets the room decay time.
      */
     setDecayTime(uint32_t decayTime) generates (Result retval);
 
-    /*
+    /**
      * Gets the room decay time.
      */
     getDecayTime() generates (Result retval, uint32_t decayTime);
 
-    /*
+    /**
      * Sets the ratio of high frequences decay.
      */
     setDecayHfRatio(int16_t decayHfRatio) generates (Result retval);
 
-    /*
+    /**
      * Gets the ratio of high frequences decay.
      */
     getDecayHfRatio() generates (Result retval, int16_t decayHfRatio);
 
-    /*
+    /**
      * Sets the level of reflections in the room.
      */
     setReflectionsLevel(int16_t reflectionsLevel) generates (Result retval);
 
-    /*
+    /**
      * Gets the level of reflections in the room.
      */
     getReflectionsLevel() generates (Result retval, int16_t reflectionsLevel);
 
-    /*
+    /**
      * Sets the reflections delay in the room.
      */
     setReflectionsDelay(uint32_t reflectionsDelay) generates (Result retval);
 
-    /*
+    /**
      * Gets the reflections delay in the room.
      */
     getReflectionsDelay() generates (Result retval, uint32_t reflectionsDelay);
 
-    /*
+    /**
      * Sets the reverb level of the room.
      */
     setReverbLevel(int16_t reverbLevel) generates (Result retval);
 
-    /*
+    /**
      * Gets the reverb level of the room.
      */
     getReverbLevel() generates (Result retval, int16_t reverbLevel);
 
-    /*
+    /**
      * Sets the reverb delay of the room.
      */
     setReverbDelay(uint32_t reverDelay) generates (Result retval);
 
-    /*
+    /**
      * Gets the reverb delay of the room.
      */
     getReverbDelay() generates (Result retval, uint32_t reverbDelay);
 
-    /*
+    /**
      * Sets room diffusion.
      */
     setDiffusion(int16_t diffusion) generates (Result retval);
 
-    /*
+    /**
      * Gets room diffusion.
      */
     getDiffusion() generates (Result retval, int16_t diffusion);
 
-    /*
+    /**
      * Sets room wall density.
      */
     setDensity(int16_t density) generates (Result retval);
 
-    /*
+    /**
      * Gets room wall density.
      */
     getDensity() generates (Result retval, int16_t density);
@@ -166,12 +166,12 @@
         int16_t  density;           // in permilles,    range 0 to 1000
     };
 
-    /*
+    /**
      * Sets all properties at once.
      */
     setAllProperties(AllProperties properties) generates (Result retval);
 
-    /*
+    /**
      * Gets all properties at once.
      */
     getAllProperties() generates (Result retval, AllProperties properties);
diff --git a/audio/effect/2.0/IEqualizerEffect.hal b/audio/effect/2.0/IEqualizerEffect.hal
index b8fa177..1528e0d 100644
--- a/audio/effect/2.0/IEqualizerEffect.hal
+++ b/audio/effect/2.0/IEqualizerEffect.hal
@@ -20,58 +20,58 @@
 import IEffect;
 
 interface IEqualizerEffect extends IEffect {
-    /*
+    /**
      * Gets the number of frequency bands that the equalizer supports.
      */
     getNumBands() generates (Result retval, uint16_t numBands);
 
-    /*
+    /**
      * Returns the minimum and maximum band levels supported.
      */
     getLevelRange()
             generates (Result retval, int16_t minLevel, int16_t maxLevel);
 
-    /*
+    /**
      * Sets the gain for the given equalizer band.
      */
     setBandLevel(uint16_t band, int16_t level) generates (Result retval);
 
-    /*
+    /**
      * Gets the gain for the given equalizer band.
      */
     getBandLevel(uint16_t band) generates (Result retval, int16_t level);
 
-    /*
+    /**
      * Gets the center frequency of the given band, in milliHertz.
      */
     getBandCenterFrequency(uint16_t band)
             generates (Result retval, uint32_t centerFreqmHz);
 
-    /*
+    /**
      * Gets the frequency range of the given frequency band, in milliHertz.
      */
     getBandFrequencyRange(uint16_t band)
             generates (Result retval, uint32_t minFreqmHz, uint32_t maxFreqmHz);
 
-    /*
+    /**
      * Gets the band that has the most effect on the given frequency
      * in milliHertz.
      */
     getBandForFrequency(uint32_t freqmHz)
             generates (Result retval, uint16_t band);
 
-    /*
+    /**
      * Gets the names of all presets the equalizer supports.
      */
     getPresetNames() generates (Result retval, vec<string> names);
 
-    /*
+    /**
      * Sets the current preset using the index of the preset in the names
      * vector returned via 'getPresetNames'.
      */
     setCurrentPreset(uint16_t preset) generates (Result retval);
 
-    /*
+    /**
      * Gets the current preset.
      */
     getCurrentPreset() generates (Result retval, uint16_t preset);
@@ -81,12 +81,12 @@
         vec<int16_t> bandLevels;
     };
 
-    /*
+    /**
      * Sets all properties at once.
      */
     setAllProperties(AllProperties properties) generates (Result retval);
 
-    /*
+    /**
      * Gets all properties at once.
      */
     getAllProperties() generates (Result retval, AllProperties properties);
diff --git a/audio/effect/2.0/ILoudnessEnhancerEffect.hal b/audio/effect/2.0/ILoudnessEnhancerEffect.hal
index 3e1ee4e..adeb1c8 100644
--- a/audio/effect/2.0/ILoudnessEnhancerEffect.hal
+++ b/audio/effect/2.0/ILoudnessEnhancerEffect.hal
@@ -20,12 +20,12 @@
 import IEffect;
 
 interface ILoudnessEnhancerEffect extends IEffect {
-    /*
+    /**
      * Sets target gain expressed in millibels.
      */
     setTargetGain(int32_t targetGainMb) generates (Result retval);
 
-    /*
+    /**
      * Gets target gain expressed in millibels.
      */
     getTargetGain() generates (Result retval, int32_t targetGainMb);
diff --git a/audio/effect/2.0/INoiseSuppressionEffect.hal b/audio/effect/2.0/INoiseSuppressionEffect.hal
index ae2bfb5..6617a1e 100644
--- a/audio/effect/2.0/INoiseSuppressionEffect.hal
+++ b/audio/effect/2.0/INoiseSuppressionEffect.hal
@@ -26,12 +26,12 @@
         HIGH
     };
 
-    /*
+    /**
      * Sets suppression level.
      */
     setSuppressionLevel(Level level) generates (Result retval);
 
-    /*
+    /**
      * Gets suppression level.
      */
     getSuppressionLevel() generates (Result retval, Level level);
@@ -41,12 +41,12 @@
         MULTI_CHANNEL
     };
 
-    /*
+    /**
      * Set suppression type.
      */
     setSuppressionType(Type type) generates (Result retval);
 
-    /*
+    /**
      * Get suppression type.
      */
     getSuppressionType() generates (Result retval, Type type);
@@ -56,12 +56,12 @@
         Type type;
     };
 
-    /*
+    /**
      * Sets all properties at once.
      */
     setAllProperties(AllProperties properties) generates (Result retval);
 
-    /*
+    /**
      * Gets all properties at once.
      */
     getAllProperties() generates (Result retval, AllProperties properties);
diff --git a/audio/effect/2.0/IVirtualizerEffect.hal b/audio/effect/2.0/IVirtualizerEffect.hal
index 2b7116c..49b49a0 100644
--- a/audio/effect/2.0/IVirtualizerEffect.hal
+++ b/audio/effect/2.0/IVirtualizerEffect.hal
@@ -20,7 +20,7 @@
 import IEffect;
 
 interface IVirtualizerEffect extends IEffect {
-    /*
+    /**
      * Returns whether setting virtualization strength is supported.
      */
     isStrengthSupported() generates (bool strengthSupported);
@@ -30,7 +30,7 @@
         MAX = 1000
     };
 
-    /*
+    /**
      * Sets virtualization strength.
      *
      * @param strength strength of the effect. The valid range for strength
@@ -41,7 +41,7 @@
      */
     setStrength(uint16_t strength) generates (Result retval);
 
-    /*
+    /**
      * Gets virtualization strength.
      */
     getStrength() generates (Result retval, uint16_t strength);
@@ -56,19 +56,19 @@
         int16_t elevation; // 0 is the horizontal plane
                            // +90 is above the listener, -90 is below
     };
-    /*
+    /**
      * Retrieves virtual speaker angles for the given channel mask on the
      * specified device.
      */
     getVirtualSpeakerAngles(AudioChannelMask mask, AudioDevice device)
             generates (Result retval, vec<SpeakerAngle> speakerAngles);
 
-    /*
+    /**
      * Forces the virtualizer effect for the given output device.
      */
     forceVirtualizationMode(AudioDevice device) generates (Result retval);
 
-    /*
+    /**
      * Returns audio device reflecting the current virtualization mode,
      * AUDIO_DEVICE_NONE when not virtualizing.
      */
diff --git a/audio/effect/2.0/IVisualizerEffect.hal b/audio/effect/2.0/IVisualizerEffect.hal
index 79dc9ee..fd3edbd 100644
--- a/audio/effect/2.0/IVisualizerEffect.hal
+++ b/audio/effect/2.0/IVisualizerEffect.hal
@@ -25,12 +25,12 @@
         MIN = 128    // minimum capture size in samples
     };
 
-    /*
+    /**
      * Sets the number PCM samples in the capture.
      */
     setCaptureSize(uint16_t captureSize) generates (Result retval);
 
-    /*
+    /**
      * Gets the number PCM samples in the capture.
      */
     getCaptureSize() generates (Result retval, uint16_t captureSize);
@@ -42,22 +42,22 @@
         AS_PLAYED = 1
     };
 
-    /*
+    /**
      * Specifies the way the captured data is scaled.
      */
     setScalingMode(ScalingMode scalingMode) generates (Result retval);
 
-    /*
+    /**
      * Retrieves the way the captured data is scaled.
      */
     getScalingMode() generates (Result retval, ScalingMode scalingMode);
 
-    /*
+    /**
      * Informs the visualizer about the downstream latency.
      */
     setLatency(uint32_t latencyMs) generates (Result retval);
 
-    /*
+    /**
      * Gets the downstream latency.
      */
     getLatency() generates (Result retval, uint32_t latencyMs);
@@ -69,19 +69,19 @@
         PEAK_RMS = 0x1
     };
 
-    /*
+    /**
      * Specifies which measurements are to be made.
      */
     setMeasurementMode(MeasurementMode measurementMode)
             generates (Result retval);
 
-    /*
+    /**
      * Retrieves which measurements are to be made.
      */
     getMeasurementMode() generates (
             Result retval, MeasurementMode measurementMode);
 
-    /*
+    /**
      * Retrieves the latest PCM snapshot captured by the visualizer engine.  The
      * number of samples to capture is specified by 'setCaptureSize' parameter.
      *
@@ -99,7 +99,7 @@
             } peakAndRms;
         } value;
     };
-    /*
+    /**
      * Retrieves the lastest measurements. The measurements to be made
      * are specified by 'setMeasurementMode' parameter.
      *
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
index 0626ec5..2c5e4ef 100644
--- a/audio/effect/2.0/types.hal
+++ b/audio/effect/2.0/types.hal
@@ -27,7 +27,7 @@
     RESULT_TOO_BIG
 };
 
-/*
+/**
  * Effect engine capabilities/requirements flags.
  *
  * Definitions for flags field of effect descriptor.
@@ -195,7 +195,7 @@
     NO_PROCESS = 1 << NO_PROCESS_SHIFT
 };
 
-/*
+/**
  * The effect descriptor contains necessary information to facilitate the
  * enumeration of the effect engines present in a library.
  */
@@ -212,7 +212,7 @@
     uint8_t[64] implementor;  // human readable effect implementor name
 };
 
-/*
+/**
  * A buffer is a chunk of audio data for processing.  Multi-channel audio is
  * always interleaved. The channel order is from LSB to MSB with regard to the
  * channel mask definition in audio.h, audio_channel_mask_t, e.g.:
@@ -235,7 +235,7 @@
     ACCESS_ACCUMULATE
 };
 
-/*
+/**
  * Determines what fields of EffectBufferConfig need to be considered.
  */
 @export(name="", value_prefix="EFFECT_CONFIG_")
@@ -248,7 +248,7 @@
     ALL = BUFFER | SMP_RATE | CHANNELS | FORMAT | ACC_MODE
 };
 
-/*
+/**
  * The buffer config structure specifies the input or output audio format
  * to be used by the effect engine.
  */
@@ -285,7 +285,7 @@
                              // the effect is attached to
 };
 
-/*
+/**
  * The message queue flags used to synchronize reads and writes from
  * the status message queue used by effects.
  */
diff --git a/automotive/Android.bp b/automotive/Android.bp
index 9b24ded..aec8865 100644
--- a/automotive/Android.bp
+++ b/automotive/Android.bp
@@ -2,6 +2,7 @@
 subdirs = [
     "evs/1.0",
     "evs/1.0/default",
+    "evs/1.0/vts/functional",
     "vehicle/2.0",
     "vehicle/2.1",
 ]
diff --git a/automotive/evs/1.0/IEvsCamera.hal b/automotive/evs/1.0/IEvsCamera.hal
index 1b55d1f..dbcaf92 100644
--- a/automotive/evs/1.0/IEvsCamera.hal
+++ b/automotive/evs/1.0/IEvsCamera.hal
@@ -28,10 +28,10 @@
     /**
      * Returns the ID of this camera.
      *
-     * Returns the string id of this camera. This must be the same value as reported in
-     * the camera_id field of the CameraDesc structure by EvsEnumerator::getCamerList().
+     * Returns the description of this camera. This must be the same value as reported
+     * by EvsEnumerator::getCamerList().
      */
-    getId() generates (string cameraId);
+    getCameraInfo() generates (CameraDesc info);
 
     /**
      * Specifies the depth of the buffer chain the camera is asked to support.
diff --git a/automotive/evs/1.0/IEvsDisplay.hal b/automotive/evs/1.0/IEvsDisplay.hal
index bbad428..12541f3 100644
--- a/automotive/evs/1.0/IEvsDisplay.hal
+++ b/automotive/evs/1.0/IEvsDisplay.hal
@@ -27,7 +27,7 @@
     /**
      * Returns basic information about the EVS display provided by the system.
      *
-     * See the description of the DisplayDesc structure below for details.
+     * See the description of the DisplayDesc structure for details.
      */
      getDisplayInfo() generates (DisplayDesc info);
 
diff --git a/automotive/evs/1.0/IEvsEnumerator.hal b/automotive/evs/1.0/IEvsEnumerator.hal
index 334430b..98d117a 100644
--- a/automotive/evs/1.0/IEvsEnumerator.hal
+++ b/automotive/evs/1.0/IEvsEnumerator.hal
@@ -31,14 +31,14 @@
      */
     getCameraList() generates (vec<CameraDesc> cameras);
 
-
     /**
      * Get the IEvsCamera associated with a cameraId from a CameraDesc
      *
      * Given a camera's unique cameraId from ca CameraDesc, returns
-     * the ICamera interface assocaited with the specified camera.
-     * When done using the camera, it must be returned by calling
-     * closeCamera on the ICamera interface.
+     * the ICamera interface associated with the specified camera.
+     * When done using the camera, the caller may release it by calling closeCamera().
+     * TODO(b/36122635) Reliance on the sp<> going out of scope is not recommended because the
+     * resources may not be released right away due to asynchronos behavior in the hardware binder.
      */
     openCamera(string cameraId) generates (IEvsCamera carCamera);
 
@@ -57,6 +57,9 @@
      * There can be at most one EVS display object for the system and this function
      * requests access to it. If the EVS display is not available or is already in use,
      * a null pointer is returned.
+     * When done using the display, the caller may release it by calling closeDisplay().
+     * TODO(b/36122635) Reliance on the sp<> going out of scope is not recommended because the
+     * resources may not be released right away due to asynchronos behavior in the hardware binder.
      */
     openDisplay() generates (IEvsDisplay display);
 
@@ -64,7 +67,7 @@
      * Return the specified IEvsDisplay interface as no longer in use
      *
      * When the IEvsDisplay object is no longer required, it must be released.
-     * NOTE: All buffer must have been returned to the display before making this call.
+     * NOTE: All buffers must have been returned to the display before making this call.
      */
     closeDisplay(IEvsDisplay display);
 
diff --git a/automotive/evs/1.0/default/Android.bp b/automotive/evs/1.0/default/Android.bp
index 8b214e3..2574e86 100644
--- a/automotive/evs/1.0/default/Android.bp
+++ b/automotive/evs/1.0/default/Android.bp
@@ -23,4 +23,9 @@
         "liblog",
         "libutils",
     ],
+
+    cflags: [
+        "-O0",
+        "-g",
+    ],
 }
diff --git a/automotive/evs/1.0/default/EvsCamera.cpp b/automotive/evs/1.0/default/EvsCamera.cpp
index c4436ee..148b796 100644
--- a/automotive/evs/1.0/default/EvsCamera.cpp
+++ b/automotive/evs/1.0/default/EvsCamera.cpp
@@ -17,6 +17,7 @@
 #define LOG_TAG "android.hardware.automotive.evs@1.0-service"
 
 #include "EvsCamera.h"
+#include "EvsEnumerator.h"
 
 #include <ui/GraphicBufferAllocator.h>
 #include <ui/GraphicBufferMapper.h>
@@ -30,18 +31,15 @@
 namespace implementation {
 
 
-// These are the special camera names for which we'll initialize custom test data
+// Special camera names for which we'll initialize alternate test data
 const char EvsCamera::kCameraName_Backup[]    = "backup";
-const char EvsCamera::kCameraName_RightTurn[] = "Right Turn";
+
 
 // Arbitrary limit on number of graphics buffers allowed to be allocated
 // Safeguards against unreasonable resource consumption and provides a testable limit
 const unsigned MAX_BUFFERS_IN_FLIGHT = 100;
 
 
-// TODO(b/31632518):  Need to get notification when our client dies so we can close the camera.
-// As it stands, if the client dies suddenly, the buffer may be stranded.
-
 EvsCamera::EvsCamera(const char *id) :
         mFramesAllowed(0),
         mFramesInUse(0),
@@ -53,22 +51,14 @@
 
     // Set up dummy data for testing
     if (mDescription.cameraId == kCameraName_Backup) {
-        mDescription.hints                  = static_cast<uint32_t>(UsageHint::USAGE_HINT_REVERSE);
-        mDescription.vendorFlags            = 0xFFFFFFFF;   // Arbitrary value
-        mDescription.defaultHorResolution   = 320;          // 1/2 NTSC/VGA
-        mDescription.defaultVerResolution   = 240;          // 1/2 NTSC/VGA
-    } else if (mDescription.cameraId == kCameraName_RightTurn) {
-        // Nothing but the name and the usage hint
-        mDescription.hints                  = static_cast<uint32_t>(UsageHint::USAGE_HINT_RIGHT_TURN);
+        mWidth  = 640;          // full NTSC/VGA
+        mHeight = 480;          // full NTSC/VGA
+        mDescription.vendorFlags = 0xFFFFFFFF;   // Arbitrary value
     } else {
-        // Leave empty for a minimalist camera description without even a hint
+        mWidth  = 320;          // 1/2 NTSC/VGA
+        mHeight = 240;          // 1/2 NTSC/VGA
     }
 
-
-    // Set our buffer properties
-    mWidth  = (mDescription.defaultHorResolution) ? mDescription.defaultHorResolution : 640;
-    mHeight = (mDescription.defaultVerResolution) ? mDescription.defaultVerResolution : 480;
-
     mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
     mUsage  = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
               GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
@@ -77,32 +67,49 @@
 
 EvsCamera::~EvsCamera() {
     ALOGD("EvsCamera being destroyed");
-    std::lock_guard<std::mutex> lock(mAccessLock);
+    forceShutdown();
+}
+
+
+//
+// This gets called if another caller "steals" ownership of the camera
+//
+void EvsCamera::forceShutdown()
+{
+    ALOGD("EvsCamera forceShutdown");
 
     // Make sure our output stream is cleaned up
     // (It really should be already)
     stopVideoStream();
 
+    // Claim the lock while we work on internal state
+    std::lock_guard <std::mutex> lock(mAccessLock);
+
     // Drop all the graphics buffers we've been using
-    GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
-    for (auto&& rec : mBuffers) {
-        if (rec.inUse) {
-            ALOGE("Error - releasing buffer despite remote ownership");
+    if (mBuffers.size() > 0) {
+        GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
+        for (auto&& rec : mBuffers) {
+            if (rec.inUse) {
+                ALOGE("Error - releasing buffer despite remote ownership");
+            }
+            alloc.free(rec.handle);
+            rec.handle = nullptr;
         }
-        alloc.free(rec.handle);
-        rec.handle = nullptr;
+        mBuffers.clear();
     }
 
-    ALOGD("EvsCamera destroyed");
+    // Put this object into an unrecoverable error state since somebody else
+    // is going to own the underlying camera now
+    mStreamState = DEAD;
 }
 
 
 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow.
-Return<void> EvsCamera::getId(getId_cb id_cb) {
-    ALOGD("getId");
+Return<void> EvsCamera::getCameraInfo(getCameraInfo_cb _hidl_cb) {
+    ALOGD("getCameraInfo");
 
-    id_cb(mDescription.cameraId);
-
+    // Send back our self description
+    _hidl_cb(mDescription);
     return Void();
 }
 
@@ -111,6 +118,12 @@
     ALOGD("setMaxFramesInFlight");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
+    // If we've been displaced by another owner of the camera, then we can't do anything else
+    if (mStreamState == DEAD) {
+        ALOGE("ignoring setMaxFramesInFlight call when camera has been lost.");
+        return EvsResult::OWNERSHIP_LOST;
+    }
+
     // We cannot function without at least one video buffer to send data
     if (bufferCount < 1) {
         ALOGE("Ignoring setMaxFramesInFlight with less than one buffer requested");
@@ -130,6 +143,11 @@
     ALOGD("startVideoStream");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
+    // If we've been displaced by another owner of the camera, then we can't do anything else
+    if (mStreamState == DEAD) {
+        ALOGE("ignoring startVideoStream call when camera has been lost.");
+        return EvsResult::OWNERSHIP_LOST;
+    }
     if (mStreamState != STOPPED) {
         ALOGE("ignoring startVideoStream call when a stream is already running.");
         return EvsResult::STREAM_ALREADY_RUNNING;
@@ -207,6 +225,7 @@
         lock.lock();
 
         mStreamState = STOPPED;
+        mStream = nullptr;
         ALOGD("Stream marked STOPPED.");
     }
 
@@ -232,6 +251,12 @@
     ALOGD("setExtendedInfo");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
+    // If we've been displaced by another owner of the camera, then we can't do anything else
+    if (mStreamState == DEAD) {
+        ALOGE("ignoring setExtendedInfo call when camera has been lost.");
+        return EvsResult::OWNERSHIP_LOST;
+    }
+
     // We don't store any device specific information in this implementation
     return EvsResult::INVALID_ARG;
 }
@@ -358,7 +383,9 @@
 
     while (true) {
         bool timeForFrame = false;
-        // Lock scope
+        nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC);
+
+        // Lock scope for updating shared state
         {
             std::lock_guard<std::mutex> lock(mAccessLock);
 
@@ -427,8 +454,15 @@
             }
         }
 
-        // We arbitrarily choose to generate frames at 10 fps (1/10 * uSecPerSec)
-        usleep(100000);
+        // We arbitrarily choose to generate frames at 12 fps to ensure we pass the 10fps test requirement
+        static const int kTargetFrameRate = 12;
+        static const nsecs_t kTargetFrameTimeUs = 1000*1000 / kTargetFrameRate;
+        const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+        const nsecs_t workTimeUs = (now - startTime) / 1000;
+        const nsecs_t sleepDurationUs = kTargetFrameTimeUs - workTimeUs;
+        if (sleepDurationUs > 0) {
+            usleep(sleepDurationUs);
+        }
     }
 
     // If we've been asked to stop, send one last NULL frame to signal the actual end of stream
diff --git a/automotive/evs/1.0/default/EvsCamera.h b/automotive/evs/1.0/default/EvsCamera.h
index ee91ca4..ff6eb39 100644
--- a/automotive/evs/1.0/default/EvsCamera.h
+++ b/automotive/evs/1.0/default/EvsCamera.h
@@ -32,54 +32,50 @@
 namespace implementation {
 
 
+// From EvsEnumerator.h
+class EvsEnumerator;
+
+
 class EvsCamera : public IEvsCamera {
 public:
     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsCamera follow.
-    Return<void> getId(getId_cb id_cb) override;
-
+    Return<void> getCameraInfo(getCameraInfo_cb _hidl_cb)  override;
     Return <EvsResult> setMaxFramesInFlight(uint32_t bufferCount) override;
-
     Return <EvsResult> startVideoStream(const ::android::sp<IEvsCameraStream>& stream) override;
-
     Return<void> doneWithFrame(const BufferDesc& buffer) override;
-
     Return<void> stopVideoStream() override;
-
     Return <int32_t> getExtendedInfo(uint32_t opaqueIdentifier) override;
-
     Return <EvsResult> setExtendedInfo(uint32_t opaqueIdentifier, int32_t opaqueValue) override;
 
     // Implementation details
-    EvsCamera(const char* id);
-
+    EvsCamera(const char *id);
     virtual ~EvsCamera() override;
+    void forceShutdown();   // This gets called if another caller "steals" ownership of the camera
 
     const CameraDesc& getDesc() { return mDescription; };
 
     static const char kCameraName_Backup[];
-    static const char kCameraName_RightTurn[];
 
 private:
     // These three functions are expected to be called while mAccessLock is held
     bool setAvailableFrames_Locked(unsigned bufferCount);
-
     unsigned increaseAvailableFrames_Locked(unsigned numToAdd);
-
     unsigned decreaseAvailableFrames_Locked(unsigned numToRemove);
 
     void generateFrames();
-
     void fillTestFrame(const BufferDesc& buff);
 
-    CameraDesc mDescription = {};  // The properties of this camera
+    sp<EvsEnumerator> mEnumerator;  // The enumerator object that created this camera
+
+    CameraDesc mDescription = {};   // The properties of this camera
 
     std::thread mCaptureThread;     // The thread we'll use to synthesize frames
 
-    uint32_t mWidth = 0;        // Horizontal pixel count in the buffers
-    uint32_t mHeight = 0;        // Vertical pixel count in the buffers
-    uint32_t mFormat = 0;        // Values from android_pixel_format_t [TODO: YUV?  Leave opaque?]
-    uint32_t mUsage = 0;        // Values from from Gralloc.h
-    uint32_t mStride = 0;        // Bytes per line in the buffers
+    uint32_t mWidth  = 0;       // Horizontal pixel count in the buffers
+    uint32_t mHeight = 0;       // Vertical pixel count in the buffers
+    uint32_t mFormat = 0;       // Values from android_pixel_format_t [TODO: YUV?  Leave opaque?]
+    uint32_t mUsage  = 0;       // Values from from Gralloc.h
+    uint32_t mStride = 0;       // Bytes per line in the buffers
 
     sp <IEvsCameraStream> mStream = nullptr;  // The callback used to deliver each frame
 
@@ -98,10 +94,11 @@
         STOPPED,
         RUNNING,
         STOPPING,
+        DEAD,
     };
     StreamStateValues mStreamState;
 
-    // Syncrhonization necessary to deconflict mCaptureThread from the main service thread
+    // Synchronization necessary to deconflict mCaptureThread from the main service thread
     std::mutex mAccessLock;
 };
 
diff --git a/automotive/evs/1.0/default/EvsDisplay.cpp b/automotive/evs/1.0/default/EvsDisplay.cpp
index a1a76d0..9ad332a 100644
--- a/automotive/evs/1.0/default/EvsDisplay.cpp
+++ b/automotive/evs/1.0/default/EvsDisplay.cpp
@@ -30,12 +30,6 @@
 namespace implementation {
 
 
-// TODO(b/31632518):  Need to get notification when our client dies so we can close the camera.
-// As it stands, if the client dies suddently, the buffer may be stranded.
-// As possible work around would be to give the client a HIDL object to exclusively hold
-// and use it's destructor to perform some work in the server side.
-
-
 EvsDisplay::EvsDisplay() {
     ALOGD("EvsDisplay instantiated");
 
@@ -43,34 +37,55 @@
     // NOTE:  These are arbitrary values chosen for testing
     mInfo.displayId             = "Mock Display";
     mInfo.vendorFlags           = 3870;
-    mInfo.defaultHorResolution  = 320;
-    mInfo.defaultVerResolution  = 240;
+
+    // Assemble the buffer description we'll use for our render target
+    mBuffer.width       = 320;
+    mBuffer.height      = 240;
+    mBuffer.format      = HAL_PIXEL_FORMAT_RGBA_8888;
+    mBuffer.usage       = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
+    mBuffer.bufferId    = 0x3870;  // Arbitrary magic number for self recognition
+    mBuffer.pixelSize   = 4;
 }
 
 
 EvsDisplay::~EvsDisplay() {
     ALOGD("EvsDisplay being destroyed");
+    forceShutdown();
+}
+
+
+/**
+ * This gets called if another caller "steals" ownership of the display
+ */
+void EvsDisplay::forceShutdown()
+{
+    ALOGD("EvsDisplay forceShutdown");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
-    // Report if we're going away while a buffer is outstanding
-    if (mFrameBusy) {
-        ALOGE("EvsDisplay going down while client is holding a buffer");
-    }
-
-    // Make sure we release our frame buffer
+    // If the buffer isn't being held by a remote client, release it now as an
+    // optimization to release the resources more quickly than the destructor might
+    // get called.
     if (mBuffer.memHandle) {
+        // Report if we're going away while a buffer is outstanding
+        if (mFrameBusy) {
+            ALOGE("EvsDisplay going down while client is holding a buffer");
+        }
+
         // Drop the graphics buffer we've been using
         GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
         alloc.free(mBuffer.memHandle);
         mBuffer.memHandle = nullptr;
     }
-    ALOGD("EvsDisplay destroyed");
+
+    // Put this object into an unrecoverable error state since somebody else
+    // is going to own the display now.
+    mRequestedState = DisplayState::DEAD;
 }
 
 
 /**
  * Returns basic information about the EVS display provided by the system.
- * See the description of the DisplayDesc structure below for details.
+ * See the description of the DisplayDesc structure for details.
  */
 Return<void> EvsDisplay::getDisplayInfo(getDisplayInfo_cb _hidl_cb)  {
     ALOGD("getDisplayInfo");
@@ -94,6 +109,11 @@
     ALOGD("setDisplayState");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
+    if (mRequestedState == DisplayState::DEAD) {
+        // This object no longer owns the display -- it's been superceeded!
+        return EvsResult::OWNERSHIP_LOST;
+    }
+
     // Ensure we recognize the requested state so we don't go off the rails
     if (state < DisplayState::NUM_STATES) {
         // Record the requested state
@@ -119,10 +139,7 @@
     ALOGD("getDisplayState");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
-    // At the moment, we treat the requested state as immediately active
-    DisplayState currentState = mRequestedState;
-
-    return currentState;
+    return mRequestedState;
 }
 
 
@@ -137,15 +154,16 @@
     ALOGD("getTargetBuffer");
     std::lock_guard<std::mutex> lock(mAccessLock);
 
+    if (mRequestedState == DisplayState::DEAD) {
+        ALOGE("Rejecting buffer request from object that lost ownership of the display.");
+        BufferDesc nullBuff = {};
+        _hidl_cb(nullBuff);
+        return Void();
+    }
+
     // If we don't already have a buffer, allocate one now
     if (!mBuffer.memHandle) {
-        // Assemble the buffer description we'll use for our render target
-        mBuffer.width       = mInfo.defaultHorResolution;
-        mBuffer.height      = mInfo.defaultVerResolution;
-        mBuffer.format      = HAL_PIXEL_FORMAT_RGBA_8888;
-        mBuffer.usage       = GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER;
-        mBuffer.bufferId    = 0x3870;  // Arbitrary magic number for self recognition
-
+        // Allocate the buffer that will hold our displayable image
         buffer_handle_t handle = nullptr;
         GraphicBufferAllocator& alloc(GraphicBufferAllocator::get());
         status_t result = alloc.allocate(mBuffer.width, mBuffer.height,
@@ -220,6 +238,11 @@
 
     mFrameBusy = false;
 
+    // If we've been displaced by another owner of the display, then we can't do anything else
+    if (mRequestedState == DisplayState::DEAD) {
+        return EvsResult::OWNERSHIP_LOST;
+    }
+
     // If we were waiting for a new frame, this is it!
     if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) {
         mRequestedState = DisplayState::VISIBLE;
@@ -248,8 +271,8 @@
 
         // Check the test pixels
         bool frameLooksGood = true;
-        for (unsigned row = 0; row < mInfo.defaultVerResolution; row++) {
-            for (unsigned col = 0; col < mInfo.defaultHorResolution; col++) {
+        for (unsigned row = 0; row < mBuffer.height; row++) {
+            for (unsigned col = 0; col < mBuffer.width; col++) {
                 // Index into the row to check the pixel at this column.
                 // We expect 0xFF in the LSB channel, a vertical gradient in the
                 // second channel, a horitzontal gradient in the third channel, and
diff --git a/automotive/evs/1.0/default/EvsDisplay.h b/automotive/evs/1.0/default/EvsDisplay.h
index fcf4a06..ebd6446 100644
--- a/automotive/evs/1.0/default/EvsDisplay.h
+++ b/automotive/evs/1.0/default/EvsDisplay.h
@@ -27,6 +27,7 @@
 namespace V1_0 {
 namespace implementation {
 
+
 class EvsDisplay : public IEvsDisplay {
 public:
     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsDisplay follow.
@@ -40,6 +41,8 @@
     EvsDisplay();
     virtual ~EvsDisplay() override;
 
+    void forceShutdown();   // This gets called if another caller "steals" ownership of the display
+
 private:
     DisplayDesc     mInfo           = {};
     BufferDesc      mBuffer         = {};       // A graphics buffer into which we'll store images
diff --git a/automotive/evs/1.0/default/EvsEnumerator.cpp b/automotive/evs/1.0/default/EvsEnumerator.cpp
index e54f699..731e21b 100644
--- a/automotive/evs/1.0/default/EvsEnumerator.cpp
+++ b/automotive/evs/1.0/default/EvsEnumerator.cpp
@@ -28,33 +28,36 @@
 namespace implementation {
 
 
-// TODO(b/31632518):  Need to get notification when our client dies so we can close the camera.
-// As it stands, if the client dies suddenly, the camera will be stuck "open".
-// NOTE:  Display should already be safe by virtue of holding only a weak pointer.
+// NOTE:  All members values are static so that all clients operate on the same state
+//        That is to say, this is effectively a singleton despite the fact that HIDL
+//        constructs a new instance for each client.
+std::list<EvsEnumerator::CameraRecord>   EvsEnumerator::sCameraList;
+wp<EvsDisplay>                           EvsEnumerator::sActiveDisplay;
 
 
 EvsEnumerator::EvsEnumerator() {
     ALOGD("EvsEnumerator created");
 
     // Add sample camera data to our list of cameras
-    // NOTE:  The id strings trigger special initialization inside the EvsCamera constructor
-    mCameraList.emplace_back( new EvsCamera(EvsCamera::kCameraName_Backup),    false );
-    mCameraList.emplace_back( new EvsCamera("LaneView"),                       false );
-    mCameraList.emplace_back( new EvsCamera(EvsCamera::kCameraName_RightTurn), false );
+    // In a real driver, this would be expected to can the available hardware
+    sCameraList.emplace_back(EvsCamera::kCameraName_Backup);
+    sCameraList.emplace_back("LaneView");
+    sCameraList.emplace_back("right turn");
 }
 
+
 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow.
 Return<void> EvsEnumerator::getCameraList(getCameraList_cb _hidl_cb)  {
     ALOGD("getCameraList");
 
-    const unsigned numCameras = mCameraList.size();
+    const unsigned numCameras = sCameraList.size();
 
     // Build up a packed array of CameraDesc for return
     // NOTE:  Only has to live until the callback returns
     std::vector<CameraDesc> descriptions;
     descriptions.reserve(numCameras);
-    for (const auto& cam : mCameraList) {
-        descriptions.push_back( cam.pCamera->getDesc() );
+    for (const auto& cam : sCameraList) {
+        descriptions.push_back( cam.desc );
     }
 
     // Encapsulate our camera descriptions in the HIDL vec type
@@ -68,97 +71,137 @@
     return Void();
 }
 
+
 Return<sp<IEvsCamera>> EvsEnumerator::openCamera(const hidl_string& cameraId) {
     ALOGD("openCamera");
 
     // Find the named camera
     CameraRecord *pRecord = nullptr;
-    for (auto &&cam : mCameraList) {
-        if (cam.pCamera->getDesc().cameraId == cameraId) {
+    for (auto &&cam : sCameraList) {
+        if (cam.desc.cameraId == cameraId) {
             // Found a match!
             pRecord = &cam;
             break;
         }
     }
 
+    // Is this a recognized camera id?
     if (!pRecord) {
         ALOGE("Requested camera %s not found", cameraId.c_str());
         return nullptr;
-    } else if (pRecord->inUse) {
-        ALOGE("Cannot open camera %s which is already in use", cameraId.c_str());
-        return nullptr;
-    } else {
-        pRecord->inUse = true;
-        return(pRecord->pCamera);
     }
+
+    // Has this camera already been instantiated by another caller?
+    sp<EvsCamera> pActiveCamera = pRecord->activeInstance.promote();
+    if (pActiveCamera != nullptr) {
+        ALOGW("Killing previous camera because of new caller");
+        closeCamera(pActiveCamera);
+    }
+
+    // Construct a camera instance for the caller
+    pActiveCamera = new EvsCamera(cameraId);
+    pRecord->activeInstance = pActiveCamera;
+    if (pActiveCamera == nullptr) {
+        ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str());
+    }
+
+    return pActiveCamera;
 }
 
-Return<void> EvsEnumerator::closeCamera(const ::android::sp<IEvsCamera>& camera) {
+
+Return<void> EvsEnumerator::closeCamera(const ::android::sp<IEvsCamera>& pCamera) {
     ALOGD("closeCamera");
 
-    if (camera == nullptr) {
-        ALOGE("Ignoring call to closeCamera with null camera pointer");
-    } else {
-        // Find this camera in our list
-        auto it = std::find_if(mCameraList.begin(),
-                               mCameraList.end(),
-                               [camera](const CameraRecord& rec) {
-                                   return (rec.pCamera == camera);
-                               });
-        if (it == mCameraList.end()) {
-            ALOGE("Ignoring close on unrecognized camera");
-        } else {
-            // Make sure the camera has stopped streaming
-            camera->stopVideoStream();
+    if (pCamera == nullptr) {
+        ALOGE("Ignoring call to closeCamera with null camera ptr");
+        return Void();
+    }
 
-            it->inUse = false;
+    // Get the camera id so we can find it in our list
+    std::string cameraId;
+    pCamera->getCameraInfo([&cameraId](CameraDesc desc) {
+// TODO(b/36532780) Should we able to just use a simple assignment?
+//                             cameraId = desc.cameraId;
+                               cameraId.assign(desc.cameraId.c_str());
+                           }
+    );
+
+    // Find the named camera
+    CameraRecord *pRecord = nullptr;
+    for (auto &&cam : sCameraList) {
+        if (cam.desc.cameraId == cameraId) {
+            // Found a match!
+            pRecord = &cam;
+            break;
+        }
+    }
+
+    // Is the display being destroyed actually the one we think is active?
+    if (!pRecord) {
+        ALOGE("Asked to close a camera who's name isn't recognized");
+    } else {
+        sp<EvsCamera> pActiveCamera = pRecord->activeInstance.promote();
+
+        if (pActiveCamera == nullptr) {
+            ALOGE("Somehow a camera is being destroyed when the enumerator didn't know one existed");
+        } else if (pActiveCamera != pCamera) {
+            // This can happen if the camera was aggressively reopened, orphaning this previous instance
+            ALOGW("Ignoring close of previously orphaned camera - why did a client steal?");
+        } else {
+            // Drop the active camera
+            pActiveCamera->forceShutdown();
+            pRecord->activeInstance = nullptr;
         }
     }
 
     return Void();
 }
 
+
 Return<sp<IEvsDisplay>> EvsEnumerator::openDisplay() {
     ALOGD("openDisplay");
 
-    // If we already have a display active, then this request must be denied
-    sp<IEvsDisplay> pActiveDisplay = mActiveDisplay.promote();
+    // If we already have a display active, then we need to shut it down so we can
+    // give exclusive access to the new caller.
+    sp<EvsDisplay> pActiveDisplay = sActiveDisplay.promote();
     if (pActiveDisplay != nullptr) {
-        ALOGW("Rejecting openDisplay request the display is already in use.");
-        return nullptr;
-    } else {
-        // Create a new display interface and return it
-        pActiveDisplay = new EvsDisplay();
-        mActiveDisplay = pActiveDisplay;
-        ALOGD("Returning new EvsDisplay object %p", pActiveDisplay.get());
-        return pActiveDisplay;
+        ALOGW("Killing previous display because of new caller");
+        closeDisplay(pActiveDisplay);
     }
+
+    // Create a new display interface and return it
+    pActiveDisplay = new EvsDisplay();
+    sActiveDisplay = pActiveDisplay;
+
+    ALOGD("Returning new EvsDisplay object %p", pActiveDisplay.get());
+    return pActiveDisplay;
 }
 
-Return<void> EvsEnumerator::closeDisplay(const ::android::sp<IEvsDisplay>& display) {
+
+Return<void> EvsEnumerator::closeDisplay(const ::android::sp<IEvsDisplay>& pDisplay) {
     ALOGD("closeDisplay");
 
     // Do we still have a display object we think should be active?
-    sp<IEvsDisplay> pActiveDisplay = mActiveDisplay.promote();
-
+    sp<EvsDisplay> pActiveDisplay = sActiveDisplay.promote();
     if (pActiveDisplay == nullptr) {
-        ALOGE("Ignoring closeDisplay when there is no active display.");
-    } else if (display != pActiveDisplay) {
-        ALOGE("Ignoring closeDisplay on a display we didn't issue");
-        ALOGI("Got %p while active display is %p.", display.get(), pActiveDisplay.get());
+        ALOGE("Somehow a display is being destroyed when the enumerator didn't know one existed");
+    } else if (sActiveDisplay != pDisplay) {
+        ALOGW("Ignoring close of previously orphaned display - why did a client steal?");
     } else {
         // Drop the active display
-        mActiveDisplay = nullptr;
+        pActiveDisplay->forceShutdown();
+        sActiveDisplay = nullptr;
     }
 
     return Void();
 }
 
+
 Return<DisplayState> EvsEnumerator::getDisplayState()  {
     ALOGD("getDisplayState");
 
     // Do we still have a display object we think should be active?
-    sp<IEvsDisplay> pActiveDisplay = mActiveDisplay.promote();
+    sp<IEvsDisplay> pActiveDisplay = sActiveDisplay.promote();
     if (pActiveDisplay != nullptr) {
         return pActiveDisplay->getDisplayState();
     } else {
diff --git a/automotive/evs/1.0/default/EvsEnumerator.h b/automotive/evs/1.0/default/EvsEnumerator.h
index 3d6e264..6b70f9b 100644
--- a/automotive/evs/1.0/default/EvsEnumerator.h
+++ b/automotive/evs/1.0/default/EvsEnumerator.h
@@ -22,7 +22,6 @@
 
 #include <list>
 
-#include "EvsCamera.h"
 
 namespace android {
 namespace hardware {
@@ -31,6 +30,11 @@
 namespace V1_0 {
 namespace implementation {
 
+
+class EvsCamera;    // from EvsCamera.h
+class EvsDisplay;   // from EvsDisplay.h
+
+
 class EvsEnumerator : public IEvsEnumerator {
 public:
     // Methods from ::android::hardware::automotive::evs::V1_0::IEvsEnumerator follow.
@@ -45,14 +49,18 @@
     EvsEnumerator();
 
 private:
+    // NOTE:  All members values are static so that all clients operate on the same state
+    //        That is to say, this is effectively a singleton despite the fact that HIDL
+    //        constructs a new instance for each client.
     struct CameraRecord {
-        sp<EvsCamera>   pCamera;
-        bool            inUse;
-        CameraRecord(EvsCamera* p, bool b) : pCamera(p), inUse(b) {}
-    };
-    std::list<CameraRecord> mCameraList;
+        CameraDesc          desc;
+        wp<EvsCamera>       activeInstance;
 
-    wp<IEvsDisplay>         mActiveDisplay; // Weak pointer -> object destructs if client dies
+        CameraRecord(const char *cameraId) : desc() { desc.cameraId = cameraId; }
+    };
+    static std::list<CameraRecord> sCameraList;
+
+    static wp<EvsDisplay>          sActiveDisplay; // Weak pointer. Object destructs if client dies.
 };
 
 } // namespace implementation
diff --git a/automotive/evs/1.0/types.hal b/automotive/evs/1.0/types.hal
index 661c2a9..7cebf6d 100644
--- a/automotive/evs/1.0/types.hal
+++ b/automotive/evs/1.0/types.hal
@@ -17,45 +17,19 @@
 package android.hardware.automotive.evs@1.0;
 
 
-/*
- * Bit flags indicating suggested uses for a given EVS camera
- *
- * The values in the UsageHint bit field provide a generic expression of how a
- * given camera is intended to be used. The values for these flags support
- * existing use cases, and are used by the default EVS application to select
- * appropriate cameras for display based on observed vehicle state (such as
- * turn signal activation or selection of reverse gear). When implementing
- * their own specialized EVS Applications, OEMs are free to use these flags
- * and/or the opaque vendor_flags to drive their own vehicle specific logic.
- */
-enum UsageHint : uint32_t {
-    USAGE_HINT_REVERSE      = 0x00000001,
-    USAGE_HINT_LEFT_TURN    = 0x00000002,
-    USAGE_HINT_RIGHT_TURN   = 0x00000004,
-};
-
-
-/*
+/**
  * Structure describing the basic properties of an EVS camera
  *
  * The HAL is responsible for filling out this structure for each
- * EVS camera in the system. Attention should be given to the field
- * of view, direction of view, and location parameters as these may
- * be used to (if available) to project overlay graphics into the
- * scene by an EVS application.
- * Any of these values for which the HAL does not have reasonable values
- * should be set to ZERO.
+ * EVS camera in the system.
  */
 struct CameraDesc {
-    string              cameraId;
-    bitfield<UsageHint> hints;                  // Mask of usage hints
-    uint32_t            vendorFlags;            // Opaque value from driver
-    uint32_t            defaultHorResolution;   // Units of pixels
-    uint32_t            defaultVerResolution;   // Units of pixels
+    string      cameraId;
+    uint32_t    vendorFlags;    // Opaque value from driver
 };
 
 
-/*
+/**
  * Structure describing the basic properties of an EVS display
  *
  * The HAL is responsible for filling out this structure to describe
@@ -65,13 +39,11 @@
  */
 struct DisplayDesc {
     string      displayId;
-    uint32_t    vendorFlags;                // Opaque value from driver
-    uint32_t    defaultHorResolution;       // Units of pixels
-    uint32_t    defaultVerResolution;       // Units of pixels
+    uint32_t    vendorFlags;    // Opaque value from driver
 };
 
 
-/*
+/**
  * Structure representing an image buffer through our APIs
  *
  * In addition to the handle to the graphics memory, we need to retain
@@ -86,7 +58,8 @@
 struct BufferDesc {
     uint32_t    width;      // Units of pixels
     uint32_t    height;     // Units of pixels
-    uint32_t    stride;     // Units of bytes
+    uint32_t    stride;     // Units of pixels to match gralloc
+    uint32_t    pixelSize;  // Units of bytes
     uint32_t    format;     // May contain values from android_pixel_format_t
     uint32_t    usage;      // May contain values from from Gralloc.h
     uint32_t    bufferId;   // Opaque value from driver
@@ -94,7 +67,7 @@
 };
 
 
-/*
+/**
  * States for control of the EVS display
  *
  * The DisplayInfo structure describes the basic properties of an EVS display. Any EVS
@@ -108,15 +81,17 @@
     NOT_VISIBLE,            // Display is inhibited
     VISIBLE_ON_NEXT_FRAME,  // Will become visible with next frame
     VISIBLE,                // Display is currently active
+    DEAD,                   // Driver is in an undefined state.  Interface should be closed.
     NUM_STATES              // Must be last
 };
 
 
-/* Error codes used in EVS HAL interface. */
+/** Error codes used in EVS HAL interface. */
 enum EvsResult : uint32_t {
     OK = 0,
     INVALID_ARG,
     STREAM_ALREADY_RUNNING,
     BUFFER_NOT_AVAILABLE,
+    OWNERSHIP_LOST,
     UNDERLYING_SERVICE_ERROR,
-};
\ No newline at end of file
+};
diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..22ceff3
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/Android.bp
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+    name: "VtsEvsV1_0Target",
+
+    srcs: [
+        "VtsEvsV1_0TargetTest.cpp",
+        "FrameHandler.cpp"
+    ],
+
+    defaults: [
+        "hidl_defaults",
+    ],
+
+    shared_libs: [
+        "android.hardware.automotive.evs@1.0",
+        "liblog",
+        "libutils",
+        "libui",
+        "libhidlbase",
+        "libhidltransport",
+    ],
+
+    static_libs: ["VtsHalHidlTargetTestBase"],
+
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
+
diff --git a/automotive/evs/1.0/vts/functional/FrameHandler.cpp b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
new file mode 100644
index 0000000..01d9a0e
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2017 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 "VtsHalEvsTest"
+
+#include "FrameHandler.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <android/log.h>
+#include <cutils/native_handle.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/GraphicBuffer.h>
+
+#include <algorithm>    // std::min
+
+
+// For the moment, we're assuming that the underlying EVS driver we're working with
+// is providing 4 byte RGBx data.  This is fine for loopback testing, although
+// real hardware is expected to provide YUV data -- most likly formatted as YV12
+static const unsigned kBytesPerPixel = 4;   // assuming 4 byte RGBx pixels
+
+
+FrameHandler::FrameHandler(android::sp <IEvsCamera> pCamera, CameraDesc cameraInfo,
+                           android::sp <IEvsDisplay> pDisplay,
+                           BufferControlFlag mode) :
+    mCamera(pCamera),
+    mCameraInfo(cameraInfo),
+    mDisplay(pDisplay),
+    mReturnMode(mode) {
+    // Nothing but member initialization here...
+}
+
+
+void FrameHandler::shutdown()
+{
+    // Make sure we're not still streaming
+    blockingStopStream();
+
+    // At this point, the receiver thread is no longer running, so we can safely drop
+    // our remote object references so they can be freed
+    mCamera = nullptr;
+    mDisplay = nullptr;
+}
+
+
+bool FrameHandler::startStream() {
+    // Mark ourselves as running
+    mLock.lock();
+    mRunning = true;
+    mLock.unlock();
+
+    // Tell the camera to start streaming
+    Return<EvsResult> result = mCamera->startVideoStream(this);
+    return (result == EvsResult::OK);
+}
+
+
+void FrameHandler::asyncStopStream() {
+    // Tell the camera to stop streaming.
+    // This will result in a null frame being delivered when the stream actually stops.
+    mCamera->stopVideoStream();
+}
+
+
+void FrameHandler::blockingStopStream() {
+    // Tell the stream to stop
+    asyncStopStream();
+
+    // Wait until the stream has actually stopped
+    std::unique_lock<std::mutex> lock(mLock);
+    mSignal.wait(lock, [this](){ return !mRunning; });
+}
+
+
+bool FrameHandler::returnHeldBuffer() {
+    std::unique_lock<std::mutex> lock(mLock);
+
+    // Return the oldest buffer we're holding
+    if (mHeldBuffers.empty()) {
+        // No buffers are currently held
+        return false;
+    }
+
+    BufferDesc buffer = mHeldBuffers.front();
+    mHeldBuffers.pop();
+    mCamera->doneWithFrame(buffer);
+
+    return true;
+}
+
+
+bool FrameHandler::isRunning() {
+    std::unique_lock<std::mutex> lock(mLock);
+    return mRunning;
+}
+
+
+void FrameHandler::waitForFrameCount(unsigned frameCount) {
+    // Wait until we've seen at least the requested number of frames (could be more)
+    std::unique_lock<std::mutex> lock(mLock);
+    mSignal.wait(lock, [this, frameCount](){ return mFramesReceived >= frameCount; });
+}
+
+
+void FrameHandler::getFramesCounters(unsigned* received, unsigned* displayed) {
+    std::unique_lock<std::mutex> lock(mLock);
+
+    if (received) {
+        *received = mFramesReceived;
+    }
+    if (displayed) {
+        *displayed = mFramesDisplayed;
+    }
+}
+
+
+Return<void> FrameHandler::deliverFrame(const BufferDesc& bufferArg) {
+    ALOGD("Received a frame from the camera (%p)", bufferArg.memHandle.getNativeHandle());
+
+    // Local flag we use to keep track of when the stream is stopping
+    bool timeToStop = false;
+
+    // TODO:  Why do we get a gralloc crash if we don't clone the buffer here?
+    BufferDesc buffer(bufferArg);
+    ALOGD("Clone the received frame as %p", buffer.memHandle.getNativeHandle());
+
+    if (buffer.memHandle.getNativeHandle() == nullptr) {
+        // Signal that the last frame has been received and the stream is stopped
+        timeToStop = true;
+    } else {
+        // If we were given an opened display at construction time, then send the received
+        // image back down the camera.
+        if (mDisplay.get()) {
+            // Get the output buffer we'll use to display the imagery
+            BufferDesc tgtBuffer = {};
+            mDisplay->getTargetBuffer([&tgtBuffer](const BufferDesc& buff) {
+                                          tgtBuffer = buff;
+                                      }
+            );
+
+            if (tgtBuffer.memHandle == nullptr) {
+                printf("Didn't get target buffer - frame lost\n");
+                ALOGE("Didn't get requested output buffer -- skipping this frame.");
+            } else {
+                // In order for the handles passed through HIDL and stored in the BufferDesc to
+                // be lockable, we must register them with GraphicBufferMapper
+                registerBufferHelper(tgtBuffer);
+                registerBufferHelper(buffer);
+
+                // Copy the contents of the of buffer.memHandle into tgtBuffer
+                copyBufferContents(tgtBuffer, buffer);
+
+                // Send the target buffer back for display
+                Return <EvsResult> result = mDisplay->returnTargetBufferForDisplay(tgtBuffer);
+                if (!result.isOk()) {
+                    printf("HIDL error on display buffer (%s)- frame lost\n",
+                           result.description().c_str());
+                    ALOGE("Error making the remote function call.  HIDL said %s",
+                          result.description().c_str());
+                } else if (result != EvsResult::OK) {
+                    printf("Display reported error - frame lost\n");
+                    ALOGE("We encountered error %d when returning a buffer to the display!",
+                          (EvsResult) result);
+                } else {
+                    // Everything looks good!
+                    // Keep track so tests or watch dogs can monitor progress
+                    mLock.lock();
+                    mFramesDisplayed++;
+                    mLock.unlock();
+                }
+
+                // Now tell GraphicBufferMapper we won't be using these handles anymore
+                unregisterBufferHelper(tgtBuffer);
+                unregisterBufferHelper(buffer);
+            }
+        }
+
+
+        switch (mReturnMode) {
+        case eAutoReturn:
+            // Send the camera buffer back now that we're done with it
+            ALOGD("Calling doneWithFrame");
+            // TODO:  Why is it that we get a HIDL crash if we pass back the cloned buffer?
+            mCamera->doneWithFrame(bufferArg);
+            break;
+        case eNoAutoReturn:
+            // Hang onto the buffer handle for now -- we'll return it explicitly later
+            mHeldBuffers.push(bufferArg);
+        }
+
+
+        ALOGD("Frame handling complete");
+    }
+
+
+    // Update our received frame count and notify anybody who cares that things have changed
+    mLock.lock();
+    if (timeToStop) {
+        mRunning = false;
+    } else {
+        mFramesReceived++;
+    }
+    mLock.unlock();
+    mSignal.notify_all();
+
+
+    return Void();
+}
+
+
+bool FrameHandler::copyBufferContents(const BufferDesc& tgtBuffer,
+                                      const BufferDesc& srcBuffer) {
+    bool success = true;
+
+    // Make sure we don't run off the end of either buffer
+    const unsigned width     = std::min(tgtBuffer.width,
+                                        srcBuffer.width);
+    const unsigned height    = std::min(tgtBuffer.height,
+                                        srcBuffer.height);
+
+    android::GraphicBufferMapper &mapper = android::GraphicBufferMapper::get();
+
+
+    // Lock our source buffer for reading
+    unsigned char* srcPixels = nullptr;
+    mapper.registerBuffer(srcBuffer.memHandle);
+    mapper.lock(srcBuffer.memHandle,
+                GRALLOC_USAGE_SW_READ_OFTEN,
+                android::Rect(width, height),
+                (void **) &srcPixels);
+
+    // Lock our target buffer for writing
+    unsigned char* tgtPixels = nullptr;
+    mapper.registerBuffer(tgtBuffer.memHandle);
+    mapper.lock(tgtBuffer.memHandle,
+                GRALLOC_USAGE_SW_WRITE_OFTEN,
+                android::Rect(width, height),
+                (void **) &tgtPixels);
+
+    if (srcPixels && tgtPixels) {
+        for (unsigned row = 0; row < height; row++) {
+            // Copy the entire row of pixel data
+            memcpy(tgtPixels, srcPixels, width * kBytesPerPixel);
+
+            // Advance to the next row (keeping in mind that stride here is in units of pixels)
+            tgtPixels += tgtBuffer.stride * kBytesPerPixel;
+            srcPixels += srcBuffer.stride * kBytesPerPixel;
+        }
+    } else {
+        ALOGE("Failed to copy buffer contents");
+        success = false;
+    }
+
+    if (srcPixels) {
+        mapper.unlock(srcBuffer.memHandle);
+    }
+    if (tgtPixels) {
+        mapper.unlock(tgtBuffer.memHandle);
+    }
+    mapper.unregisterBuffer(srcBuffer.memHandle);
+    mapper.unregisterBuffer(tgtBuffer.memHandle);
+
+    return success;
+}
+
+
+void FrameHandler::registerBufferHelper(const BufferDesc& buffer)
+{
+    // In order for the handles passed through HIDL and stored in the BufferDesc to
+    // be lockable, we must register them with GraphicBufferMapper.
+    // If the device upon which we're running supports gralloc1, we could just call
+    // registerBuffer directly with the handle.  But that call  is broken for gralloc0 devices
+    // (which we care about, at least for now).  As a result, we have to synthesize a GraphicBuffer
+    // object around the buffer handle in order to make a call to the overloaded alternate
+    // version of the registerBuffer call that does happen to work on gralloc0 devices.
+#if REGISTER_BUFFER_ALWAYS_WORKS
+    android::GraphicBufferMapper::get().registerBuffer(buffer.memHandle);
+#else
+    android::sp<android::GraphicBuffer> pGfxBuff = new android::GraphicBuffer(
+            buffer.width, buffer.height, buffer.format,
+            1, /* we always use exactly one layer */
+            buffer.usage, buffer.stride,
+            const_cast<native_handle_t*>(buffer.memHandle.getNativeHandle()),
+            false /* GraphicBuffer should not try to free the handle */
+    );
+
+    android::GraphicBufferMapper::get().registerBuffer(pGfxBuff.get());
+#endif
+}
+
+
+void FrameHandler::unregisterBufferHelper(const BufferDesc& buffer)
+{
+    // Now tell GraphicBufferMapper we won't be using these handles anymore
+    android::GraphicBufferMapper::get().unregisterBuffer(buffer.memHandle);
+}
diff --git a/automotive/evs/1.0/vts/functional/FrameHandler.h b/automotive/evs/1.0/vts/functional/FrameHandler.h
new file mode 100644
index 0000000..d5c3f6b
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/FrameHandler.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2017 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 EVS_VTS_FRAMEHANDLER_H
+#define EVS_VTS_FRAMEHANDLER_H
+
+#include <queue>
+
+#include <android/hardware/automotive/evs/1.0/IEvsCameraStream.h>
+#include <android/hardware/automotive/evs/1.0/IEvsCamera.h>
+#include <android/hardware/automotive/evs/1.0/IEvsDisplay.h>
+
+using namespace ::android::hardware::automotive::evs::V1_0;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_handle;
+using ::android::sp;
+
+
+/*
+ * FrameHandler:
+ * This class can be used to receive camera imagery from an IEvsCamera implementation.  Given an
+ * IEvsDisplay instance at startup, it will forward the received imagery to the display,
+ * providing a trivial implementation of a rear vew camera type application.
+ * Note that the video frames are delivered on a background thread, while the control interface
+ * is actuated from the applications foreground thread.
+ */
+class FrameHandler : public IEvsCameraStream {
+public:
+    enum BufferControlFlag {
+        eAutoReturn,
+        eNoAutoReturn,
+    };
+
+    FrameHandler(android::sp <IEvsCamera> pCamera, CameraDesc cameraInfo,
+                 android::sp <IEvsDisplay> pDisplay = nullptr,
+                 BufferControlFlag mode = eAutoReturn);
+    void shutdown();
+
+    bool startStream();
+    void asyncStopStream();
+    void blockingStopStream();
+
+    bool returnHeldBuffer();
+
+    bool isRunning();
+
+    void waitForFrameCount(unsigned frameCount);
+    void getFramesCounters(unsigned* received, unsigned* displayed);
+
+private:
+    // Implementation for ::android::hardware::automotive::evs::V1_0::ICarCameraStream
+    Return<void> deliverFrame(const BufferDesc& buffer)  override;
+
+    // Local implementation details
+    bool copyBufferContents(const BufferDesc& tgtBuffer, const BufferDesc& srcBuffer);
+    void registerBufferHelper(const BufferDesc& buffer);
+    void unregisterBufferHelper(const BufferDesc& buffer);
+
+    // Values initialized as startup
+    android::sp <IEvsCamera>    mCamera;
+    CameraDesc                  mCameraInfo;
+    android::sp <IEvsDisplay>   mDisplay;
+    BufferControlFlag           mReturnMode;
+
+    // Since we get frames delivered to us asnchronously via the ICarCameraStream interface,
+    // we need to protect all member variables that may be modified while we're streaming
+    // (ie: those below)
+    std::mutex                  mLock;
+    std::condition_variable     mSignal;
+
+    std::queue<BufferDesc>      mHeldBuffers;
+    bool                        mRunning = false;
+    unsigned                    mFramesReceived = 0;    // Simple counter -- rolls over eventually!
+    unsigned                    mFramesDisplayed = 0;   // Simple counter -- rolls over eventually!
+};
+
+
+#endif //EVS_VTS_FRAMEHANDLER_H
diff --git a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
new file mode 100644
index 0000000..6a0ae48
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
@@ -0,0 +1,464 @@
+/*
+ * Copyright (C) 2017 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 "VtsHalEvsTest"
+
+
+// TODO:  How should we configure these values to target appropriate hardware?
+const static char kEnumeratorName[]  = "EvsEnumeratorHw-Mock";
+
+
+// These values are called out in the EVS design doc (as of Mar 8, 2017)
+static const int kMaxStreamStartMilliseconds = 500;
+static const int kMinimumFramesPerSecond = 10;
+
+static const int kSecondsToMilliseconds = 1000;
+static const int kMillisecondsToMicroseconds = 1000;
+static const float kNanoToMilliseconds = 0.000001f;
+static const float kNanoToSeconds = 0.000000001f;
+
+
+#include "FrameHandler.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <hidl/HidlTransportSupport.h>
+#include <utils/Errors.h>
+#include <utils/StrongPointer.h>
+#include <utils/Log.h>
+#include <hwbinder/ProcessState.h>
+
+#include <android/log.h>
+#include <android/hardware/automotive/evs/1.0/IEvsCamera.h>
+#include <android/hardware/automotive/evs/1.0/IEvsEnumerator.h>
+#include <android/hardware/automotive/evs/1.0/IEvsCameraStream.h>
+#include <android/hardware/automotive/evs/1.0/IEvsDisplay.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+
+using namespace ::android::hardware::automotive::evs::V1_0;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+
+// The main test class for EVS
+class EvsHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+public:
+    virtual void SetUp() override {
+        // Make sure we can connect to the enumerator
+        pEnumerator = IEvsEnumerator::getService(kEnumeratorName);
+        ASSERT_NE(pEnumerator.get(), nullptr);
+    }
+
+    virtual void TearDown() override {}
+
+protected:
+    void loadCameraList() {
+        // SetUp() must run first!
+        assert(pEnumerator != nullptr);
+
+        // Get the camera list
+        pEnumerator->getCameraList([this](hidl_vec <CameraDesc> cameraList) {
+                                       ALOGI("Camera list callback received %zu cameras",
+                                             cameraList.size());
+                                       cameraInfo.reserve(cameraList.size());
+                                       for (auto&& cam: cameraList) {
+                                           ALOGI("Found camera %s", cam.cameraId.c_str());
+                                           cameraInfo.push_back(cam);
+                                       }
+                                   }
+        );
+
+        // We insist on at least one camera for EVS to pass any camera tests
+        ASSERT_GE(cameraInfo.size(), 1u);
+    }
+
+    sp<IEvsEnumerator>          pEnumerator;    // Every test needs access to the service
+    std::vector <CameraDesc>    cameraInfo;     // Empty unless/until loadCameraList() is called
+};
+
+
+//
+// Tests start here...
+//
+
+/*
+ * CameraOpenClean:
+ * Opens each camera reported by the enumerator and then explicitly closes it via a
+ * call to closeCamera.  Then repeats the test to ensure all cameras can be reopened.
+ */
+TEST_F(EvsHidlTest, CameraOpenClean) {
+    // Get the camera list
+    loadCameraList();
+
+    // Open and close each camera twice
+    for (auto&& cam: cameraInfo) {
+        for (int pass = 0; pass < 2; pass++) {
+            sp<IEvsCamera> pCam = pEnumerator->openCamera(cam.cameraId);
+            ASSERT_NE(pCam, nullptr);
+
+            // Verify that this camera self-identifies correctly
+            pCam->getCameraInfo([&cam](CameraDesc desc) {
+                                    ALOGD("Found camera %s", desc.cameraId.c_str());
+                                    EXPECT_EQ(cam.cameraId, desc.cameraId);
+                                }
+            );
+
+            // Explicitly close the camera so resources are released right away
+            pEnumerator->closeCamera(pCam);
+        }
+    }
+}
+
+
+/*
+ * CameraOpenAggressive:
+ * Opens each camera reported by the enumerator twice in a row without an intervening closeCamera
+ * call.  This ensures that the intended "aggressive open" behavior works.  This is necessary for
+ * the system to be tolerant of shutdown/restart race conditions.
+ */
+TEST_F(EvsHidlTest, CameraOpenAggressive) {
+    // Get the camera list
+    loadCameraList();
+
+    // Open and close each camera twice
+    for (auto&& cam: cameraInfo) {
+        sp<IEvsCamera> pCam = pEnumerator->openCamera(cam.cameraId);
+        ASSERT_NE(pCam, nullptr);
+
+        // Verify that this camera self-identifies correctly
+        pCam->getCameraInfo([&cam](CameraDesc desc) {
+                                ALOGD("Found camera %s", desc.cameraId.c_str());
+                                EXPECT_EQ(cam.cameraId, desc.cameraId);
+                            }
+        );
+
+        sp<IEvsCamera> pCam2 = pEnumerator->openCamera(cam.cameraId);
+        ASSERT_NE(pCam, pCam2);
+        ASSERT_NE(pCam2, nullptr);
+
+        // Verify that the old camera rejects calls
+        Return<EvsResult> badResult = pCam->setMaxFramesInFlight(2);
+        EXPECT_EQ(EvsResult::OWNERSHIP_LOST, EvsResult(badResult));
+
+        // Close the superceded camera
+        pEnumerator->closeCamera(pCam);
+
+        // Verify that the second camera instance self-identifies correctly
+        pCam2->getCameraInfo([&cam](CameraDesc desc) {
+                                 ALOGD("Found camera %s", desc.cameraId.c_str());
+                                 EXPECT_EQ(cam.cameraId, desc.cameraId);
+                             }
+        );
+
+        // Leave the second camera dangling so it gets cleaned up by the destructor path
+    }
+
+    // Sleep here to ensure the destructor cleanup has time to run so we don't break follow on tests
+    sleep(1);   // I hate that this is an arbitrary time to wait.  :(  b/36122635
+}
+
+
+/*
+ * DisplayOpen:
+ * Test both clean shut down and "aggressive open" device stealing behavior.
+ */
+TEST_F(EvsHidlTest, DisplayOpen) {
+    // Request exclusive access to the EVS display, then let it go
+    {
+        sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
+        ASSERT_NE(pDisplay, nullptr);
+
+        // Ask the display what it's name is
+        pDisplay->getDisplayInfo([](DisplayDesc desc) {
+                                     ALOGD("Found display %s", desc.displayId.c_str());
+                                 }
+        );
+
+        pEnumerator->closeDisplay(pDisplay);
+    }
+
+    // Ensure we can reopen the display after it has been closed
+    {
+        // Reopen the display
+        sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
+        ASSERT_NE(pDisplay, nullptr);
+
+        // Open the display while its already open -- ownership should be transferred
+        sp<IEvsDisplay> pDisplay2 = pEnumerator->openDisplay();
+        ASSERT_NE(pDisplay2, nullptr);
+
+        // Ensure the old display properly reports its assassination
+        Return<DisplayState> badResult = pDisplay->getDisplayState();
+        EXPECT_EQ(badResult, DisplayState::DEAD);
+
+        // Close only the newest display instance -- the other should already be a zombie
+        pEnumerator->closeDisplay(pDisplay2);
+    }
+
+    // Finally, validate that we can open the display after the provoked failure above
+    sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
+    ASSERT_NE(pDisplay, nullptr);
+
+    pEnumerator->closeDisplay(pDisplay);
+}
+
+
+/*
+ * DisplayStates:
+ * Validate that display states transition as expected and can be queried from either the display
+ * object itself or the owning enumerator.
+ */
+TEST_F(EvsHidlTest, DisplayStates) {
+    // Ensure the display starts in the expected state
+    EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_OPEN);
+
+    // Scope to limit the lifetime of the pDisplay pointer, and thus the IEvsDisplay object
+    {
+        // Request exclusive access to the EVS display
+        sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
+        ASSERT_NE(pDisplay, nullptr);
+        EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_VISIBLE);
+
+        // Activate the display
+        pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME);
+        EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::VISIBLE_ON_NEXT_FRAME);
+        EXPECT_EQ((DisplayState)pDisplay->getDisplayState(), DisplayState::VISIBLE_ON_NEXT_FRAME);
+
+        // Get the output buffer we'd use to display the imagery
+        BufferDesc tgtBuffer = {};
+        pDisplay->getTargetBuffer([&tgtBuffer](const BufferDesc& buff) {
+                                      tgtBuffer = buff;
+                                  }
+        );
+        EXPECT_NE(tgtBuffer.memHandle, nullptr);
+
+        // Send the target buffer back for display (we didn't actually fill anything)
+        pDisplay->returnTargetBufferForDisplay(tgtBuffer);
+
+        // Sleep for a tenth of a second to ensure the driver has time to get the image displayed
+        usleep(100 * kMillisecondsToMicroseconds);
+        EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::VISIBLE);
+        EXPECT_EQ((DisplayState)pDisplay->getDisplayState(), DisplayState::VISIBLE);
+
+        // Turn off the display
+        pDisplay->setDisplayState(DisplayState::NOT_VISIBLE);
+        usleep(100 * kMillisecondsToMicroseconds);
+        EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_VISIBLE);
+
+        // Close the display
+        pEnumerator->closeDisplay(pDisplay);
+    }
+
+    // TODO:  This hack shouldn't be necessary.  b/36122635
+// NOTE:  Calling flushCommand here did not avoid the race.  Going back to sleep...  :(
+//    android::hardware::IPCThreadState::self()->flushCommands();
+    sleep(1);
+
+    // Now that the display pointer has gone out of scope, causing the IEvsDisplay interface
+    // object to be destroyed, we should be back to the "not open" state.
+    // NOTE:  If we want this to pass without the sleep above, we'd have to add the
+    //        (now recommended) closeDisplay() call instead of relying on the smarter pointer
+    //        going out of scope.
+    EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_OPEN);
+}
+
+
+/*
+ * CameraStreamPerformance:
+ * Measure and qualify the stream start up time and streaming frame rate of each reported camera
+ */
+TEST_F(EvsHidlTest, CameraStreamPerformance) {
+    // Get the camera list
+    loadCameraList();
+
+    // Test each reported camera
+    for (auto&& cam: cameraInfo) {
+        sp <IEvsCamera> pCam = pEnumerator->openCamera(cam.cameraId);
+        ASSERT_NE(pCam, nullptr);
+
+        // Set up a frame receiver object which will fire up its own thread
+        sp<FrameHandler> frameHandler = new FrameHandler(pCam, cam,
+                                                         nullptr,
+                                                         FrameHandler::eAutoReturn);
+
+        // Start the camera's video stream
+        nsecs_t start = systemTime(SYSTEM_TIME_MONOTONIC);
+        bool startResult = frameHandler->startStream();
+        EXPECT_EQ(startResult, true);
+
+        // Ensure the first frame arrived within the expected time
+        frameHandler->waitForFrameCount(1);
+        nsecs_t firstFrame = systemTime(SYSTEM_TIME_MONOTONIC);
+        nsecs_t timeToFirstFrame = systemTime(SYSTEM_TIME_MONOTONIC) - start;
+        EXPECT_LE(nanoseconds_to_milliseconds(timeToFirstFrame), kMaxStreamStartMilliseconds);
+        printf("Measured time to first frame %0.2f ms\n", timeToFirstFrame * kNanoToMilliseconds);
+        ALOGI("Measured time to first frame %0.2f ms", timeToFirstFrame * kNanoToMilliseconds);
+
+        // Wait a bit, then ensure we get at least the required minimum number of frames
+        sleep(5);
+        nsecs_t end = systemTime(SYSTEM_TIME_MONOTONIC);
+        unsigned framesReceived = 0;
+        frameHandler->getFramesCounters(&framesReceived, nullptr);
+        framesReceived = framesReceived - 1;    // Back out the first frame we already waited for
+        nsecs_t runTime = end - firstFrame;
+        float framesPerSecond = framesReceived / (runTime * kNanoToSeconds);
+        printf("Measured camera rate %3.2f fps\n", framesPerSecond);
+        ALOGI("Measured camera rate %3.2f fps", framesPerSecond);
+        EXPECT_GE(framesPerSecond, kMinimumFramesPerSecond);
+
+        // Even when the camera pointer goes out of scope, the FrameHandler object will
+        // keep the stream alive unless we tell it to shutdown.
+        // Also note that the FrameHandle and the Camera have a mutual circular reference, so
+        // we have to break that cycle in order for either of them to get cleaned up.
+        frameHandler->shutdown();
+
+        // Explicitly release the camera
+        pEnumerator->closeCamera(pCam);
+    }
+}
+
+
+/*
+ * CameraStreamBuffering:
+ * Ensure the camera implementation behaves properly when the client holds onto buffers for more
+ * than one frame time.  The camera must cleanly skip frames until the client is ready again.
+ */
+TEST_F(EvsHidlTest, CameraStreamBuffering) {
+    // Arbitrary constant (should be > 1 and less than crazy)
+    static const unsigned int kBuffersToHold = 6;
+
+    // Get the camera list
+    loadCameraList();
+
+    // Test each reported camera
+    for (auto&& cam: cameraInfo) {
+
+        sp<IEvsCamera> pCam = pEnumerator->openCamera(cam.cameraId);
+        ASSERT_NE(pCam, nullptr);
+
+        // Ask for a crazy number of buffers in flight to ensure it errors correctly
+        Return<EvsResult> badResult = pCam->setMaxFramesInFlight(0xFFFFFFFF);
+        EXPECT_EQ(EvsResult::BUFFER_NOT_AVAILABLE, badResult);
+
+        // Now ask for exactly two buffers in flight as we'll test behavior in that case
+        Return<EvsResult> goodResult = pCam->setMaxFramesInFlight(kBuffersToHold);
+        EXPECT_EQ(EvsResult::OK, goodResult);
+
+
+        // Set up a frame receiver object which will fire up its own thread.
+        sp<FrameHandler> frameHandler = new FrameHandler(pCam, cam,
+                                                         nullptr,
+                                                         FrameHandler::eNoAutoReturn);
+
+        // Start the camera's video stream
+        bool startResult = frameHandler->startStream();
+        EXPECT_TRUE(startResult);
+
+        // Check that the video stream stalls once we've gotten exactly the number of buffers
+        // we requested since we told the frameHandler not to return them.
+        sleep(1);   // 1 second would be enough for at least 5 frames to be delivered worst case
+        unsigned framesReceived = 0;
+        frameHandler->getFramesCounters(&framesReceived, nullptr);
+        EXPECT_EQ(kBuffersToHold, framesReceived);
+
+
+        // Give back one buffer
+        bool didReturnBuffer = frameHandler->returnHeldBuffer();
+        EXPECT_TRUE(didReturnBuffer);
+
+        // Once we return a buffer, it shouldn't take more than 1/10 second to get a new one
+        // filled since we require 10fps minimum -- but give a 10% allowance just in case.
+        usleep(110 * kMillisecondsToMicroseconds);
+        frameHandler->getFramesCounters(&framesReceived, nullptr);
+        EXPECT_EQ(kBuffersToHold+1, framesReceived);
+
+        // Even when the camera pointer goes out of scope, the FrameHandler object will
+        // keep the stream alive unless we tell it to shutdown.
+        // Also note that the FrameHandle and the Camera have a mutual circular reference, so
+        // we have to break that cycle in order for either of them to get cleaned up.
+        frameHandler->shutdown();
+
+        // Explicitly release the camera
+        pEnumerator->closeCamera(pCam);
+    }
+}
+
+
+/*
+ * CameraToDisplayRoundTrip:
+ * End to end test of data flowing from the camera to the display.  Each delivered frame of camera
+ * imagery is simply copied to the display buffer and presented on screen.  This is the one test
+ * which a human could observe to see the operation of the system on the physical display.
+ */
+TEST_F(EvsHidlTest, CameraToDisplayRoundTrip) {
+    // Get the camera list
+    loadCameraList();
+
+    // Request exclusive access to the EVS display
+    sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
+    ASSERT_NE(pDisplay, nullptr);
+
+    // Test each reported camera
+    for (auto&& cam: cameraInfo) {
+        sp <IEvsCamera> pCam = pEnumerator->openCamera(cam.cameraId);
+        ASSERT_NE(pCam, nullptr);
+
+        // Set up a frame receiver object which will fire up its own thread.
+        sp<FrameHandler> frameHandler = new FrameHandler(pCam, cam,
+                                                         pDisplay,
+                                                         FrameHandler::eAutoReturn);
+
+
+        // Activate the display
+        pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME);
+
+        // Start the camera's video stream
+        bool startResult = frameHandler->startStream();
+        EXPECT_EQ(startResult, true);
+
+        // Wait a while to let the data flow
+        static const int kSecondsToWait = 5;
+        const int streamTimeMs = kSecondsToWait * kSecondsToMilliseconds -
+                                 kMaxStreamStartMilliseconds;
+        const unsigned minimumFramesExpected = streamTimeMs * kMinimumFramesPerSecond /
+                                               kSecondsToMilliseconds;
+        sleep(kSecondsToWait);
+        unsigned framesReceived = 0;
+        unsigned framesDisplayed = 0;
+        frameHandler->getFramesCounters(&framesReceived, &framesDisplayed);
+        EXPECT_EQ(framesReceived, framesDisplayed);
+        EXPECT_GE(framesDisplayed, minimumFramesExpected);
+
+        // Turn off the display (yes, before the stream stops -- it should be handled)
+        pDisplay->setDisplayState(DisplayState::NOT_VISIBLE);
+
+        // Shut down the streamer
+        frameHandler->shutdown();
+
+        // Explicitly release the camera
+        pEnumerator->closeCamera(pCam);
+    }
+
+    // Explicitly release the display
+    pEnumerator->closeDisplay(pDisplay);
+}
\ No newline at end of file
diff --git a/automotive/vehicle/2.0/IVehicle.hal b/automotive/vehicle/2.0/IVehicle.hal
index 5de416f..d962de0 100644
--- a/automotive/vehicle/2.0/IVehicle.hal
+++ b/automotive/vehicle/2.0/IVehicle.hal
@@ -25,7 +25,7 @@
    */
   getAllPropConfigs() generates (vec<VehiclePropConfig> propConfigs);
 
-  /*
+  /**
    * Returns a list of property configurations for given properties.
    *
    * If requested VehicleProperty wasn't found it must return
diff --git a/automotive/vehicle/2.0/IVehicleCallback.hal b/automotive/vehicle/2.0/IVehicleCallback.hal
index 167e5e1..7060418 100644
--- a/automotive/vehicle/2.0/IVehicleCallback.hal
+++ b/automotive/vehicle/2.0/IVehicleCallback.hal
@@ -18,7 +18,7 @@
 
 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
@@ -31,7 +31,7 @@
      */
     oneway onPropertyEvent(vec<VehiclePropValue> propValues);
 
-    /*
+    /**
      * This method gets called if the client was subscribed to a property using
      * SubscribeFlags::SET_CALL flag and IVehicle#set(...) method was called.
      *
@@ -42,7 +42,7 @@
      */
     oneway onPropertySet(VehiclePropValue propValue);
 
-    /*
+    /**
      * Set property value is usually asynchronous operation. Thus even if
      * client received StatusCode::OK from the IVehicle::set(...) this
      * doesn't guarantee that the value was successfully propagated to the
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index a998d33..f1fb6bf 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.automotive.vehicle@2.0;
 
-/*
+/**
  * Enumerates supported data types for VehicleProperty.
  *
  * This is a bitwise flag that supposed to be used in VehicleProperty enum.
@@ -31,7 +31,7 @@
     FLOAT_VEC      = 0x00610000,
     BYTES          = 0x00700000,
 
-    /*
+    /**
      * Any combination of scalar or vector types. The exact format must be
      * provided in the description of the property.
      */
@@ -40,7 +40,7 @@
     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
@@ -62,18 +62,18 @@
       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,
@@ -81,7 +81,7 @@
     MASK           = 0xf0000000,
 };
 
-/*
+/**
  * Declares all vehicle properties. VehicleProperty has a bitwise structure.
  * Each property must have:
  *   - an unique id from range 0x0100 - 0xffff
@@ -95,10 +95,10 @@
  */
 enum VehicleProperty: int32_t {
 
-    /* Undefined property. */
+    /** Undefined property. */
     INVALID = 0x00000000,
 
-    /*
+    /**
      * VIN of vehicle
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
@@ -110,7 +110,7 @@
         | VehiclePropertyType:STRING
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Maker name of vehicle
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
@@ -122,7 +122,7 @@
         | VehiclePropertyType:STRING
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Model of vehicle
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
@@ -134,7 +134,7 @@
         | VehiclePropertyType:STRING
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Model year of vehicle.
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
@@ -147,7 +147,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Fuel capacity of the vehicle
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
@@ -160,7 +160,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Current odometer value of the vehicle
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE | VehiclePropertyChangeMode:CONTINUOUS
@@ -173,7 +173,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Speed of the vehicle
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -186,7 +186,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Temperature of engine coolant
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -199,7 +199,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Temperature of engine oil
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -212,7 +212,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Engine rpm
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -225,7 +225,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Currently selected gear
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -238,7 +238,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Current gear. In non-manual case, selected gear does not necessarily
      * match the current gear.
      *
@@ -252,7 +252,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Parking brake state.
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -264,7 +264,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Driving status policy.
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -277,7 +277,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Warning for fuel low level.
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -289,7 +289,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Night mode or not.
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -301,7 +301,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * State of the vehicles turn signals
      *
      * Values from VehicleTurnSignal
@@ -315,7 +315,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Represents ignition state
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -327,7 +327,7 @@
             | VehiclePropertyType:INT32
             | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Fan speed setting
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -343,7 +343,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * Fan direction setting
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -360,7 +360,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * HVAC current temperature.
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -376,7 +376,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * HVAC, target temperature set.
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -392,7 +392,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off defrost
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -408,7 +408,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:WINDOW),
 
-    /*
+    /**
      * On/off AC
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -425,7 +425,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off max AC
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -441,7 +441,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off max defrost
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -457,7 +457,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off re-circulation
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -473,7 +473,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off dual. This must be defined per each row.
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -489,7 +489,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * On/off automatic mode
      *
      * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
@@ -505,7 +505,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * Seat temperature
      *
      * Negative values indicate cooling.
@@ -622,7 +622,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * 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.
@@ -640,7 +640,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:ZONE),
 
-    /*
+    /**
      * Outside temperature
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -653,7 +653,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Cabin temperature
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -666,7 +666,7 @@
         | VehiclePropertyType:FLOAT
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Radio presets stored on the Car radio module. The data type used is int32
      * array with the following fields:
      * <ul>
@@ -690,7 +690,7 @@
         | 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
@@ -776,7 +776,7 @@
         | VehiclePropertyType:INT32_VEC
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * A property to allow external component to control audio focus. Depending on
      * H/W architecture, audio HAL may need to control audio focus while vehicle
      * HAL is still interacting with upper layer. In such case, audio HAL may set
@@ -793,7 +793,7 @@
         | VehiclePropertyType:INT32_VEC
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Property to control audio volume of each audio context.
      *
      * VehiclePropConfig
@@ -830,7 +830,7 @@
         | VehiclePropertyType:INT32_VEC
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Property to allow audio volume sync from external components like audio HAL.
      * Some vehicle HAL implementation may get volume control from audio HAL and in such
      * case, setting AUDIO_VOLUME_EXT_SYNC property may trigger event in AUDIO_VOLUME property.
@@ -846,7 +846,7 @@
         | 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.
      *
@@ -880,7 +880,7 @@
         | 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.
@@ -908,7 +908,7 @@
         | 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
@@ -926,7 +926,7 @@
         | 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
@@ -1028,7 +1028,7 @@
         | VehiclePropertyType:STRING
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Property to control power state of application processor
      *
      * It is assumed that AP's power state is controller by separate power
@@ -1054,7 +1054,7 @@
         | VehiclePropertyType:INT32_VEC
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * 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.
@@ -1073,7 +1073,7 @@
         | 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
@@ -1091,7 +1091,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Property to feed H/W input events to android
      *
      * int32Values[0] : action defined by VehicleHwKeyInputAction
@@ -1109,7 +1109,7 @@
         | VehiclePropertyType:INT32_VEC
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Property to define instrument cluster information.
      * For VehicleInstrumentClusterType:EXTERNAL_DISPLAY:
      *  READ:
@@ -1143,7 +1143,7 @@
         | 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.
@@ -1158,7 +1158,7 @@
         | 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
@@ -1174,7 +1174,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Door position
      *
      * This is an integer in case a door may be set to a particular position.
@@ -1192,7 +1192,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:DOOR),
 
-    /*
+    /**
      * Door move
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -1204,7 +1204,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:DOOR),
 
-    /*
+    /**
      * Door lock
      *
      * 'true' indicates door is locked
@@ -1218,7 +1218,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:DOOR),
 
-    /*
+    /**
      * Mirror Z Position
      *
      * Positive value indicates tilt upwards, negative value is downwards
@@ -1232,7 +1232,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:MIRROR),
 
-    /*
+    /**
      * Mirror Z Move
      *
      * Positive value indicates tilt upwards, negative value is downwards
@@ -1246,7 +1246,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:MIRROR),
 
-    /*
+    /**
      * Mirror Y Position
      *
      * Positive value indicate tilt right, negative value is left
@@ -1260,7 +1260,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:MIRROR),
 
-    /*
+    /**
      * Mirror Y Move
      *
      * Positive value indicate tilt right, negative value is left
@@ -1274,7 +1274,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:MIRROR),
 
-    /*
+    /**
      * Mirror Lock
      *
      * True indicates mirror positions are locked and not changeable
@@ -1288,7 +1288,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Mirror Fold
      *
      * True indicates mirrors are folded
@@ -1302,7 +1302,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Seat memory select
      *
      * This parameter selects the memory preset to use to select the seat
@@ -1322,7 +1322,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat memory set
      *
      * This setting allows the user to save the current seat position settings
@@ -1338,7 +1338,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seatbelt buckled
      *
      * True indicates belt is buckled.
@@ -1355,7 +1355,7 @@
         | VehiclePropertyType:BOOLEAN
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seatbelt height position
      *
      * Adjusts the shoulder belt anchor point.
@@ -1371,7 +1371,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seatbelt height move
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -1383,7 +1383,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat fore/aft position
      *
      * Sets the seat position forward (closer to steering wheel) and backwards.
@@ -1399,7 +1399,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat fore/aft move
      *
      * Moves the seat position forward and aft.
@@ -1413,7 +1413,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat backrest angle 1 position
      *
      * Backrest angle 1 is the actuator closest to the bottom of the seat.
@@ -1429,7 +1429,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat backrest angle 1 move
      *
      * Moves the backrest forward or recline.
@@ -1443,7 +1443,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat backrest angle 2 position
      *
      * Backrest angle 2 is the next actuator up from the bottom of the seat.
@@ -1459,7 +1459,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat backrest angle 2 move
      *
      * Moves the backrest forward or recline.
@@ -1473,7 +1473,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat height position
      *
      * Sets the seat height.
@@ -1489,7 +1489,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat height move
      *
      * Moves the seat height.
@@ -1503,7 +1503,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat depth position
      *
      * Sets the seat depth, distance from back rest to front edge of seat.
@@ -1519,7 +1519,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat depth move
      *
      * Adjusts the seat depth.
@@ -1533,7 +1533,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat tilt position
      *
      * Sets the seat tilt.
@@ -1549,7 +1549,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Seat tilt move
      *
      * Tilts the seat.
@@ -1563,7 +1563,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Lumber fore/aft position
      *
      * Pushes the lumbar support forward and backwards
@@ -1579,7 +1579,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Lumbar fore/aft move
      *
      * Adjusts the lumbar support.
@@ -1593,7 +1593,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Lumbar side support position
      *
      * Sets the amount of lateral lumbar support.
@@ -1609,7 +1609,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Lumbar side support move
      *
      * Adjusts the amount of lateral lumbar support.
@@ -1623,7 +1623,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Headrest height position
      *
      * Sets the headrest height.
@@ -1639,7 +1639,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Headrest height move
      *
      * Moves the headrest up and down.
@@ -1653,7 +1653,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Headrest angle position
      *
      * Sets the angle of the headrest.
@@ -1669,7 +1669,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Headrest angle move
      *
      * Adjusts the angle of the headrest
@@ -1683,7 +1683,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Headrest fore/aft position
      *
      * Adjusts the headrest forwards and backwards.
@@ -1699,7 +1699,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Headrest fore/aft move
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -1711,7 +1711,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:SEAT),
 
-    /*
+    /**
      * Window Position
      *
      * Max = window up / closed
@@ -1726,7 +1726,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Window Move
      *
      * Max = window up / closed
@@ -1743,7 +1743,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Window Vent Position
      *
      * This feature is used to control the vent feature on a sunroof.
@@ -1760,7 +1760,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Window Vent Move
      *
      * This feature is used to control the vent feature on a sunroof.
@@ -1777,7 +1777,7 @@
         | VehiclePropertyType:INT32
         | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Window Lock
      *
      * True indicates windows are locked and can't be moved.
@@ -1792,7 +1792,7 @@
         | VehicleArea:GLOBAL),
 };
 
-/*
+/**
  * Bit flags for fan direction
  */
 enum VehicleHvacFanDirection : int32_t {
@@ -1803,11 +1803,11 @@
   DEFROST_AND_FLOOR = 0x5,
 };
 
-/*
+/**
  * Constants relevant to radio.
  */
 enum VehicleRadioConstants : int32_t {
-  /* Minimum value for the radio preset */
+  /** Minimum value for the radio preset */
   VEHICLE_RADIO_PRESET_MIN_VALUE = 1,
 };
 
@@ -1815,7 +1815,7 @@
   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.
@@ -1826,34 +1826,34 @@
 };
 
 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.
@@ -1862,7 +1862,7 @@
 
 };
 
-/*
+/**
  * Flags to represent multiple streams by combining these.
  */
 enum VehicleAudioStreamFlag : int32_t {
@@ -1871,7 +1871,7 @@
   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.
  */
@@ -1880,27 +1880,27 @@
   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
@@ -1909,14 +1909,14 @@
    */
   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 {
@@ -1926,65 +1926,65 @@
   AUDIO_CONTEXTS = 3,
 };
 
-/*
+/**
  * Flags to tell the current audio context.
  */
 enum VehicleAudioContextFlag : int32_t {
-  /* Music playback is currently active. */
+  /** Music playback is currently active. */
   MUSIC_FLAG = 0x1,
 
-  /* Navigation is currently running. */
+  /** Navigation is currently running. */
   NAVIGATION_FLAG = 0x2,
 
-  /* Voice command session is currently running. */
+  /** Voice command session is currently running. */
   VOICE_COMMAND_FLAG = 0x4,
 
-  /* Voice call is currently active. */
+  /** 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 / warning is played. */
   SAFETY_ALERT_FLAG = 0x80,
 
-  /* CD / DVD kind of audio is played */
+  /** CD / DVD kind of audio is played */
   CD_ROM_FLAG = 0x100,
 
-  /* Aux audio input is played */
+  /** Aux audio input is played */
   AUX_AUDIO_FLAG = 0x200,
 
-  /* system sound like UI feedback */
+  /** system sound like UI feedback */
   SYSTEM_SOUND_FLAG = 0x400,
 
-  /* Radio is played */
+  /** Radio is played */
   RADIO_FLAG = 0x800,
 
-  /* Ext source is played. This is for tagging generic ext sources. */
+  /** 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 supported. When this is set, audio volume level per
@@ -1998,7 +1998,7 @@
    */
   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.
@@ -2006,13 +2006,13 @@
   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.
@@ -2020,7 +2020,7 @@
   LIMIT_REACHED = 1,
 };
 
-/*
+/**
  * Index in int32Values for VehicleProperty#AUDIO_VOLUME property.
  */
 enum VehicleAudioVolumeIndex : int32_t {
@@ -2029,7 +2029,7 @@
   INDEX_STATE = 2,
 };
 
-/*
+/**
  * Index in int32Values for VehicleProperty#AUDIO_VOLUME_LIMIT property.
  */
 enum VehicleAudioVolumeLimitIndex : int32_t {
@@ -2037,7 +2037,7 @@
   MAX_VOLUME = 1,
 };
 
-/*
+/**
  * Index in int32Values for VehicleProperty#AUDIO_ROUTING_POLICY property.
  */
 enum VehicleAudioRoutingPolicyIndex : int32_t {
@@ -2045,12 +2045,12 @@
   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,
@@ -2061,13 +2061,13 @@
 };
 
 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.
    */
@@ -2075,19 +2075,19 @@
 };
 
 enum VehicleApPowerState : int32_t /* NOTE: type is guessed */ {
-  /* vehicle HAL will never publish this state to AP */
+  /** vehicle HAL will never publish this state to AP */
   OFF = 0,
 
-  /* vehicle HAL will never publish this state to AP */
+  /** vehicle HAL will never publish this state to AP */
   DEEP_SLEEP = 1,
 
-  /* AP is on but display must be off. */
+  /** AP is on but display must be off. */
   ON_DISP_OFF = 2,
 
-  /* AP is on with display on. This state allows full user interaction. */
+  /** 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
@@ -2100,30 +2100,30 @@
 };
 
 enum VehicleApPowerStateShutdownParam : int32_t {
-  /* AP must shutdown immediately. Postponing is not allowed. */
+  /** AP must shutdown immediately. Postponing is not allowed. */
   SHUTDOWN_IMMEDIATELY = 1,
 
-  /* AP can enter deep sleep instead of shutting down completely. */
+  /** AP can enter deep sleep instead of shutting down completely. */
   CAN_SLEEP = 2,
 
-  /* AP can only shutdown with postponing allowed. */
+  /** 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
@@ -2131,7 +2131,7 @@
    */
   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
@@ -2139,7 +2139,7 @@
    */
   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
@@ -2158,7 +2158,7 @@
    */
   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
@@ -2166,7 +2166,7 @@
    */
   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.
@@ -2174,7 +2174,7 @@
   DISPLAY_ON = 0x7,
 };
 
-/*
+/**
  * Index in int32Values for VehicleProperty#AP_POWER_STATE property.
  */
 enum VehicleApPowerStateIndex : int32_t {
@@ -2182,23 +2182,23 @@
   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
@@ -2208,40 +2208,40 @@
 };
 
 enum VehicleHwKeyInputAction : int32_t {
-  /* Key down */
+  /** Key down */
   ACTION_DOWN = 0,
 
-  /* Key up */
+  /** Key up */
   ACTION_UP = 1,
 };
 
 enum VehicleDisplay : int32_t {
-  /* center console */
+  /** 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 */
+  /** 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 {
@@ -2263,17 +2263,17 @@
     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
@@ -2284,18 +2284,18 @@
    */
   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
@@ -2305,7 +2305,7 @@
   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
@@ -2319,7 +2319,7 @@
   READ_WRITE = 0x03,
 };
 
-/*
+/**
  * Car states.
  *
  * The driving states determine what features of the UI will be accessible.
@@ -2333,7 +2333,7 @@
   LIMIT_MESSAGE_LEN = 0x10,
 };
 
-/*
+/**
  * Various gears which can be selected by user and chosen in system.
  */
 enum VehicleGear: int32_t {
@@ -2353,7 +2353,7 @@
   GEAR_9 = 0x1000,
 };
 
-/*
+/**
  * Various zones in the car.
  *
  * Zones are used for Air Conditioning purposes and divide the car into physical
@@ -2379,7 +2379,7 @@
   WHOLE_CABIN = 0x80000000,
 };
 
-/*
+/**
  * Various Seats in the car.
  */
 enum VehicleAreaSeat : int32_t {
@@ -2394,7 +2394,7 @@
     ROW_3_RIGHT  = 0x0400
 };
 
-/*
+/**
  * Various windshields/windows in the car.
  */
 enum VehicleAreaWindow : int32_t {
@@ -2434,7 +2434,7 @@
 };
 
 struct VehicleAreaConfig {
-    /*
+    /**
      * Area id is ignored for VehiclePropertyGroup:GLOBAL properties.
      */
     int32_t areaId;
@@ -2450,32 +2450,32 @@
 };
 
 struct VehiclePropConfig {
-    /* Property identifier */
+    /** Property identifier */
     int32_t prop;
 
-    /*
+    /**
      * Defines if the property is read or write or both.
      */
     VehiclePropertyAccess access;
 
-    /*
+    /**
      * Defines the change mode of the property.
      */
     VehiclePropertyChangeMode changeMode;
 
-    /*
+    /**
      * 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
@@ -2483,70 +2483,70 @@
      */
     int32_t configFlags;
 
-    /* Contains additional configuration parameters */
+    /** 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 */
+    /** Property identifier */
     int32_t prop;
 
-    /* Time is elapsed nanoseconds since boot */
+    /** 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 */
+        /** This is used for properties of type VehiclePropertyType#INT64 */
         vec<int64_t> int64Values;
 
-        /* This is used for properties of type VehiclePropertyType#BYTES */
+        /** This is used for properties of type VehiclePropertyType#BYTES */
         vec<uint8_t> bytes;
 
-        /* This is used for properties of type VehiclePropertyType#STRING */
+        /** This is used for properties of type VehiclePropertyType#STRING */
         string stringValue;
     };
 
@@ -2556,53 +2556,53 @@
 enum VehicleIgnitionState : int32_t {
     UNDEFINED = 0,
 
-    /* Steering wheel is locked */
+    /** Steering wheel is locked */
     LOCK = 1,
 
-     /*
+     /**
       * Steering wheel is not locked, engine and all accessories are OFF. If
       * car can be in LOCK and OFF state at the same time than HAL must report
       * LOCK state.
       */
     OFF,
 
-    /*
+    /**
      * Typically in this state accessories become available (e.g. radio).
      * Instrument cluster and engine are turned off
      */
     ACC,
 
-    /*
+    /**
      * Ignition is in state ON. Accessories and instrument cluster available,
      * engine might be running or ready to be started.
      */
     ON,
 
-    /* Typically in this state engine is starting (cranking). */
+    /** Typically in this state engine is starting (cranking). */
     START
 };
 
 
-/*
+/**
  * 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,
@@ -2612,13 +2612,13 @@
 enum SubscribeFlags : int32_t {
   UNDEFINED = 0x0,
 
-  /*
+  /**
    * Subscribe to event that was originated in vehicle HAL
    * (most likely this event came from the 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).
    */
@@ -2627,20 +2627,20 @@
   DEFAULT = HAL_EVENT,
 };
 
-/*
+/**
  * Encapsulates information about subscription to vehicle property events.
  */
 struct SubscribeOptions {
-  /* Property to subscribe */
+  /** Property to subscribe */
   int32_t 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
@@ -2651,31 +2651,31 @@
    */
   float sampleRate;
 
-  /* Flags that indicate what kind of events listen to. */
+  /** Flags that indicate what kind of events listen to. */
   SubscribeFlags flags;
 };
 
-/* Error codes used in vehicle HAL interface. */
+/** Error codes used in vehicle HAL interface. */
 enum StatusCode : int32_t {
   OK = 0,
 
-  /* Try again. */
+  /** Try again. */
   TRY_AGAIN = 1,
 
-  /* Invalid argument provided. */
+  /** Invalid argument provided. */
   INVALID_ARG = 2,
 
-  /*
+  /**
    * 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 = 3,
 
-  /* Access denied */
+  /** Access denied */
   ACCESS_DENIED = 4,
 
-  /* Something unexpected has happened in Vehicle HAL */
+  /** Something unexpected has happened in Vehicle HAL */
   INTERNAL_ERROR = 5,
 };
 
diff --git a/automotive/vehicle/2.1/IVehicle.hal b/automotive/vehicle/2.1/IVehicle.hal
index 5b6a23f..a22d1e6 100644
--- a/automotive/vehicle/2.1/IVehicle.hal
+++ b/automotive/vehicle/2.1/IVehicle.hal
@@ -18,7 +18,7 @@
 
 import android.hardware.automotive.vehicle@2.0;
 
-/*
+/**
  * New revision of IVehicle interface that supports properties defined in
  * VehicleProperty enum version 2.1.
  *
diff --git a/automotive/vehicle/2.1/types.hal b/automotive/vehicle/2.1/types.hal
index 9b219b2..08dc144 100644
--- a/automotive/vehicle/2.1/types.hal
+++ b/automotive/vehicle/2.1/types.hal
@@ -18,11 +18,11 @@
 
 import android.hardware.automotive.vehicle@2.0;
 
-/*
+/**
  * Extension of VehicleProperty enum declared in Vehicle HAL 2.0
  */
 enum VehicleProperty: @2.0::VehicleProperty {
-    /*
+    /**
      * Reports wheel rotational distance in meters since last wheel tick
      * event
      *
@@ -44,7 +44,7 @@
       | VehiclePropertyType:FLOAT_VEC
       | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * OBD2 Live Sensor Data
      *
      * This property uses COMPLEX data to send a snapshot of the current (live)
@@ -84,7 +84,7 @@
       | VehiclePropertyType:COMPLEX
       | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * OBD2 Freeze Frame Sensor Data
      *
      * This property uses COMPLEX data to send a snapshot of the values of the
@@ -132,7 +132,7 @@
       | VehiclePropertyType:COMPLEX
       | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * OBD2 Freeze Frame Information
      *
      * This property describes the current freeze frames stored in vehicle
@@ -153,7 +153,7 @@
       | VehiclePropertyType:COMPLEX
       | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * OBD2 Freeze Frame Clear
      *
      * This property allows deletion of any of the freeze frames stored in
@@ -175,7 +175,7 @@
       | VehiclePropertyType:COMPLEX
       | VehicleArea:GLOBAL),
 
-    /*
+    /**
      * Vehicle Maps Service (VMS) message
      *
      * This property uses COMPLEX data to communicate vms messages.
@@ -196,7 +196,7 @@
         | VehicleArea:GLOBAL),
 };
 
-/* The status of a fuel system as described by the OBD2 specification. */
+/** The status of a fuel system as described by the OBD2 specification. */
 enum FuelSystemStatus : int32_t {
   OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1,
 
@@ -209,14 +209,14 @@
   CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16,
 };
 
-/* Defines which ignition monitors are available to be read. */
+/** Defines which ignition monitors are available to be read. */
 enum IgnitionMonitorKind : int32_t {
   SPARK = 0,
 
   COMPRESSION = 1,
 };
 
-/* These ignition monitors are common to both SPARK and COMPRESSION. */
+/** These ignition monitors are common to both SPARK and COMPRESSION. */
 enum CommonIgnitionMonitors : int32_t {
   COMPONENTS_AVAILABLE = 0x1 << 0,
   COMPONENTS_INCOMPLETE = 0x1 << 1,
@@ -228,7 +228,7 @@
   MISFIRE_INCOMPLETE = 0x1 << 5,
 };
 
-/* Ignition monitors available for SPARK vehicles. */
+/** Ignition monitors available for SPARK vehicles. */
 enum SparkIgnitionMonitors : CommonIgnitionMonitors {
   EGR_AVAILABLE = 0x1 << 6,
   EGR_INCOMPLETE = 0x1 << 7,
@@ -255,7 +255,7 @@
   CATALYST_INCOMPLETE = 0x1 << 21,
 };
 
-/* Ignition monitors only available for COMPRESSION vehicles. */
+/** Ignition monitors only available for COMPRESSION vehicles. */
 enum CompressionIgnitionMonitors : CommonIgnitionMonitors {
   EGR_OR_VVT_AVAILABLE = 0x1 << 6,
   EGR_OR_VVT_INCOMPLETE = 0x1 << 7,
@@ -336,7 +336,7 @@
   BIFUEL_RUNNING_DIESEL = 23,
 };
 
-/*
+/**
  * This enum provides the canonical mapping for sensor properties that have an integer value.
  * The ordering of the values is taken from the OBD2 specification.
  * Some of the properties are represented as an integer mapping to another enum. In those cases
@@ -344,15 +344,15 @@
  * Any value greater than the last reserved index is available to vendors to map their extensions.
  */
 enum Obd2IntegerSensorIndex : int32_t {
-  /* refer to FuelSystemStatus for a description of this value. */
+  /** refer to FuelSystemStatus for a description of this value. */
   FUEL_SYSTEM_STATUS = 0,
 
   MALFUNCTION_INDICATOR_LIGHT_ON = 1,
 
-  /* refer to IgnitionMonitorKind for a description of this value. */
+  /** refer to IgnitionMonitorKind for a description of this value. */
   IGNITION_MONITORS_SUPPORTED = 2,
 
-  /*
+  /**
    * The value of this sensor is a bitmask that specifies whether ignition-specific
    * tests are available and whether they are complete. The semantics of the individual
    * bits in this value are given by, respectively, SparkIgnitionMonitors and
@@ -362,7 +362,7 @@
 
   INTAKE_AIR_TEMPERATURE = 4,
 
-  /* refer to SecondaryAirStatus for a description of this value. */
+  /** refer to SecondaryAirStatus for a description of this value. */
   COMMANDED_SECONDARY_AIR_STATUS = 5,
 
   NUM_OXYGEN_SENSORS_PRESENT = 6,
@@ -395,7 +395,7 @@
 
   MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20,
 
-  /* refer to FuelType for a description of this value. */
+  /** refer to FuelType for a description of this value. */
   FUEL_TYPE = 21,
 
   FUEL_RAIL_ABSOLUTE_PRESSURE = 22,
@@ -421,7 +421,7 @@
   LAST_SYSTEM_INDEX = ENGINE_PERCENT_TORQUE_DATA_POINT4,
 };
 
-/*
+/**
  * This enum provides the canonical mapping for sensor properties that have a floating-point value.
  * The ordering of the values is taken from the OBD2 specification.
  * Any value greater than the last reserved index is available to vendors to map their extensions.
@@ -572,34 +572,34 @@
   LAST_SYSTEM_INDEX = ENGINE_FUEL_RATE,
 };
 
-/*
+/**
  * This enum lists the types of supported VMS messages.
  */
 enum VmsMessageType : int32_t {
-  /* A client subscribes to a layer. */
+  /** A client subscribes to a layer. */
   SUBSCRIBE = 1,
 
-  /* A client unsubscribes from a layer. */
+  /** A client unsubscribes from a layer. */
   UNSUBSCRIBE = 2,
 
-  /* A client publishes a data packet. */
+  /** A client publishes a data packet. */
   DATA = 3,
 };
 
-/*
+/**
  * This enum provides the canonical mapping for VMS properties that have an
  * integer value.
  */
 enum VmsMessageIntegerValuesIndex : int32_t {
-  /* The message type as enumerated by VmsMessageType enum. */
+  /** The message type as enumerated by VmsMessageType enum. */
   VMS_MESSAGE_TYPE = 0,
 
-  /* The layer ID as defined in the vms protocol. */
+  /** The layer ID as defined in the vms protocol. */
   VMS_LAYER_ID = 1,
 
-  /* The version of the VMS layer. */
+  /** The version of the VMS layer. */
   VMS_LAYER_VERSION = 2,
 
-  /* The number of bytes in the payload */
+  /** The number of bytes in the payload */
   VMS_PAYLOAD_SIZE_BYTES = 3,
 };
diff --git a/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal b/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
index 0b92848..14f3005 100644
--- a/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
+++ b/biometrics/fingerprint/2.1/IBiometricsFingerprint.hal
@@ -19,7 +19,7 @@
 import IBiometricsFingerprintClientCallback;
 
 interface IBiometricsFingerprint {
-  /*
+  /**
    * Set notification callback:
    * Registers a user function that must receive notifications from the HAL
    * This call must block if the HAL state machine is in busy state until HAL
@@ -32,7 +32,7 @@
   setNotify(IBiometricsFingerprintClientCallback clientCallback)
       generates (uint64_t deviceId);
 
-  /*
+  /**
    * Fingerprint pre-enroll enroll request:
    * Generates a unique token to upper layers to indicate the start of
    * an enrollment transaction. pre-enroll and post-enroll specify
@@ -47,7 +47,7 @@
   @callflow(next={"enroll", "postEnroll"})
   preEnroll() generates (uint64_t authChallenge);
 
-  /*
+  /**
    * Fingerprint enroll request:
    * Switches the HAL state machine to collect and store a new fingerprint
    * template. Switches back as soon as enroll is complete, signalled by
@@ -69,7 +69,7 @@
   enroll(uint8_t[69] hat, uint32_t gid, uint32_t timeoutSec)
       generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * Finishes the enroll operation and invalidates the preEnroll() generated
    * challenge. This must be called at the end of a multi-finger enrollment
    * session to indicate that no more fingers may be added.
@@ -79,7 +79,7 @@
   @callflow(next={"authenticate", "setActiveGroup", "enumerate", "remove"})
   postEnroll() generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * getAuthenticatorId:
    * Returns a token associated with the current fingerprint set. This value
    * must change whenever a new fingerprint is enrolled, thus creating a new
@@ -91,7 +91,7 @@
   @callflow(next={"authenticate"})
   getAuthenticatorId() generates (uint64_t AuthenticatorId);
 
-  /*
+  /**
    * Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED
    * to all running clients. Switches the HAL state machine back to the idle
    * state. Unlike enrollDone() doesn't invalidate the preEnroll() challenge.
@@ -102,7 +102,7 @@
     "setActiveGroup"})
   cancel() generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * Enumerate all the fingerprint templates found in the directory set by
    * setActiveGroup():
    * For each template found a notify() must be called with:
@@ -116,7 +116,7 @@
   @callflow(next={"remove", "enroll", "authenticate", "setActiveGroup"})
   enumerate() generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * Fingerprint remove request:
    * Deletes fingerprint template(s).
    * Works only within the path set by setActiveGroup().
@@ -136,7 +136,7 @@
     "setActiveGroup"})
   remove(uint32_t gid, uint32_t fid) generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * Restricts the HAL operation to a set of fingerprints belonging to a group
    * provided. The caller must provide a path to a storage location within the
    * user's data directory.
@@ -150,7 +150,7 @@
   setActiveGroup(uint32_t gid, string storePath)
       generates (RequestStatus debugErrno);
 
-  /*
+  /**
    * Authenticates an operation identified by operationId
    *
    * @param operationId operation id.
diff --git a/biometrics/fingerprint/2.1/types.hal b/biometrics/fingerprint/2.1/types.hal
index e389773..7402085 100644
--- a/biometrics/fingerprint/2.1/types.hal
+++ b/biometrics/fingerprint/2.1/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.biometrics.fingerprint@2.1;
 
-/*
+/**
  * Request status indicates whether the request is accepted by the vendor
  * implementation or not. These values are taken from the errno set,
  * except for the SYS_UNKNOWN
@@ -37,7 +37,7 @@
   SYS_ETIMEDOUT = -110,
 };
 
-/*
+/**
  * Fingerprint errors are meant to tell the framework to terminate the current
  * operation and ask for the user to correct the situation. These will almost
  * always result in messaging and user interaction to correct the problem.
@@ -49,27 +49,27 @@
  * followed by ERROR_CANCELED.
  */
 enum FingerprintError : int32_t {
-  /* Used for testing, no error returned */
+  /** Used for testing, no error returned */
   ERROR_NO_ERROR = 0,
-  /* The hardware has an error that can't be resolved. */
+  /** The hardware has an error that can't be resolved. */
   ERROR_HW_UNAVAILABLE = 1,
-  /* Bad data; operation can't continue */
+  /** Bad data; operation can't continue */
   ERROR_UNABLE_TO_PROCESS = 2,
-  /* The operation has timed out waiting for user input. */
+  /** The operation has timed out waiting for user input. */
   ERROR_TIMEOUT = 3,
-  /* No space available to store a template */
+  /** No space available to store a template */
   ERROR_NO_SPACE = 4,
-  /* The current operation has been canceled */
+  /** The current operation has been canceled */
   ERROR_CANCELED = 5,
-  /* Unable to remove a template */
+  /** Unable to remove a template */
   ERROR_UNABLE_TO_REMOVE = 6,
-  /* The hardware is in lockout due to too many attempts */
+  /** The hardware is in lockout due to too many attempts */
   ERROR_LOCKOUT = 7,
-  /* Vendor-specific error message */
+  /** Vendor-specific error message */
   ERROR_VENDOR = 8
 };
 
-/*
+/**
  * Fingerprint acquisition info is meant as feedback for the current operation.
  * Anything but ACQUIRED_GOOD must be shown to the user as feedback on how to
  * take action on the current operation. For example, ACQUIRED_IMAGER_DIRTY may
@@ -80,41 +80,43 @@
  */
 enum FingerprintAcquiredInfo : int32_t {
   ACQUIRED_GOOD = 0,
-  /* sensor needs more data, i.e. longer swipe. */
+  /** sensor needs more data, i.e. longer swipe. */
   ACQUIRED_PARTIAL = 1,
-  /* image doesn't contain enough detail for recognition*/
+  /**
+   * image doesn't contain enough detail for recognition*/
   ACQUIRED_INSUFFICIENT = 2,
-  /* sensor needs to be cleaned */
+  /** sensor needs to be cleaned */
   ACQUIRED_IMAGER_DIRTY = 3,
-  /* mostly swipe-type sensors; not enough data collected */
+  /** mostly swipe-type sensors; not enough data collected */
   ACQUIRED_TOO_SLOW = 4,
-  /* vendor-specific acquisition messages start here */
+  /** vendor-specific acquisition messages start here */
   ACQUIRED_TOO_FAST = 5,
-  /* vendor-specific acquisition messages */
+  /** vendor-specific acquisition messages */
   ACQUIRED_VENDOR = 6
 };
 
 struct FingerprintFingerId {
-  /* Group ID */
+  /** Group ID */
   uint32_t gid;
-  /* Fingerprint template ID */
+  /** Fingerprint template ID */
   uint32_t fid;
 };
 
 struct FingerprintEnroll {
-  /* Template ID */
+  /** Template ID */
   FingerprintFingerId finger;
-  /* samplesRemaining goes from N (no data collected, but N scans needed)
+  /**
+   * samplesRemaining goes from N (no data collected, but N scans needed)
    * to 0 (no more data is needed to build a template). */
   uint32_t samplesRemaining;
-  /* Vendor specific message. Used for user guidance */
+  /** Vendor specific message. Used for user guidance */
   uint64_t msg;
 };
 
 struct FingerprintIterator {
-  /* Template ID */
+  /** Template ID */
   FingerprintFingerId finger;
-  /* How many templates remain to iterate through */
+  /** How many templates remain to iterate through */
   uint32_t remainingTemplates;
 };
 
@@ -122,18 +124,18 @@
 typedef FingerprintIterator FingerprintRemoved;
 
 struct FingerprintAcquired {
-  /* information about the image */
+  /** information about the image */
   FingerprintAcquiredInfo acquiredInfo;
 };
 
 struct FingerprintAuthenticated {
-  /* Matched template ID */
+  /** Matched template ID */
   FingerprintFingerId finger;
-  /* Authentication result from the keymaster */
+  /** Authentication result from the keymaster */
   uint8_t[69] hat;
 };
 
-/* Run time type identification for the notify() call payload. */
+/** Run time type identification for the notify() call payload. */
 enum FingerprintMsgType : int32_t {
   ERROR = -1,
   ACQUIRED = 1,
diff --git a/bluetooth/1.0/IBluetoothHci.hal b/bluetooth/1.0/IBluetoothHci.hal
index 8722616..7996ac3 100644
--- a/bluetooth/1.0/IBluetoothHci.hal
+++ b/bluetooth/1.0/IBluetoothHci.hal
@@ -18,7 +18,7 @@
 
 import IBluetoothHciCallbacks;
 
-/*
+/**
  * The Host Controller Interface (HCI) is the layer defined by the Bluetooth
  * specification between the software that runs on the host and the Bluetooth
  * controller chip. This boundary is the natural choice for a Hardware
diff --git a/bluetooth/1.0/IBluetoothHciCallbacks.hal b/bluetooth/1.0/IBluetoothHciCallbacks.hal
index 15db1ce..b22fa34 100644
--- a/bluetooth/1.0/IBluetoothHciCallbacks.hal
+++ b/bluetooth/1.0/IBluetoothHciCallbacks.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.bluetooth@1.0;
 
-/* The interface from the Bluetooth Controller to the stack. */
+/** The interface from the Bluetooth Controller to the stack. */
 interface IBluetoothHciCallbacks {
     /**
      * Invoked when the Bluetooth controller initialization has been
diff --git a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
index 9a4efae..d699f21 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
@@ -23,9 +23,8 @@
 #include <hardware/bluetooth.h>
 #include <utils/Log.h>
 
+#include <VtsHalHidlTargetCallbackBase.h>
 #include <VtsHalHidlTargetTestBase.h>
-#include <condition_variable>
-#include <mutex>
 #include <queue>
 
 using ::android::hardware::bluetooth::V1_0::IBluetoothHci;
@@ -92,6 +91,11 @@
 #define ACL_BROADCAST_ACTIVE_SLAVE (0x1 << 4)
 #define ACL_PACKET_BOUNDARY_COMPLETE (0x3 << 6)
 
+constexpr char kCallbackNameAclEventReceived[] = "aclDataReceived";
+constexpr char kCallbackNameHciEventReceived[] = "hciEventReceived";
+constexpr char kCallbackNameInitializationComplete[] = "initializationComplete";
+constexpr char kCallbackNameScoEventReceived[] = "scoDataReceived";
+
 class ThroughputLogger {
  public:
   ThroughputLogger(std::string task)
@@ -121,7 +125,8 @@
  public:
   virtual void SetUp() override {
     // currently test passthrough mode only
-    bluetooth = ::testing::VtsHalHidlTargetTestBase::getService<IBluetoothHci>();
+    bluetooth =
+        ::testing::VtsHalHidlTargetTestBase::getService<IBluetoothHci>();
     ASSERT_NE(bluetooth, nullptr);
     ALOGI("%s: getService() for bluetooth is %s", __func__,
           bluetooth->isRemote() ? "remote" : "local");
@@ -135,10 +140,6 @@
     max_sco_data_packets = 0;
 
     initialized = false;
-    initialized_count = 0;
-    event_count = 0;
-    acl_count = 0;
-    sco_count = 0;
     event_cb_count = 0;
     acl_cb_count = 0;
     sco_cb_count = 0;
@@ -146,7 +147,18 @@
     ASSERT_EQ(initialized, false);
     bluetooth->initialize(bluetooth_cb);
 
-    wait_for_init_callback();
+    bluetooth_cb->SetWaitTimeout(kCallbackNameInitializationComplete,
+                                 WAIT_FOR_INIT_TIMEOUT);
+    bluetooth_cb->SetWaitTimeout(kCallbackNameHciEventReceived,
+                                 WAIT_FOR_HCI_EVENT_TIMEOUT);
+    bluetooth_cb->SetWaitTimeout(kCallbackNameAclEventReceived,
+                                 WAIT_FOR_ACL_DATA_TIMEOUT);
+    bluetooth_cb->SetWaitTimeout(kCallbackNameScoEventReceived,
+                                 WAIT_FOR_SCO_DATA_TIMEOUT);
+
+    EXPECT_TRUE(
+        bluetooth_cb->WaitForCallback(kCallbackNameInitializationComplete)
+            .no_timeout);
 
     ASSERT_EQ(initialized, true);
   }
@@ -171,82 +183,10 @@
   void wait_for_command_complete_event(hidl_vec<uint8_t> cmd);
   int wait_for_completed_packets_event(uint16_t handle);
 
-  // Inform the test about the initialization callback
-  inline void notify_initialized() {
-    std::unique_lock<std::mutex> lock(initialized_mutex);
-    initialized_count++;
-    initialized_condition.notify_one();
-  }
-
-  // Test code calls this function to wait for the init callback
-  inline void wait_for_init_callback() {
-    std::unique_lock<std::mutex> lock(initialized_mutex);
-
-    auto start_time = std::chrono::steady_clock::now();
-    while (initialized_count == 0)
-      if (initialized_condition.wait_until(lock,
-                                     start_time + WAIT_FOR_INIT_TIMEOUT) ==
-          std::cv_status::timeout)
-        return;
-    initialized_count--;
-  }
-
-  // Inform the test about an event callback
-  inline void notify_event_received() {
-    std::unique_lock<std::mutex> lock(event_mutex);
-    event_count++;
-    event_condition.notify_one();
-  }
-
-  // Test code calls this function to wait for an event callback
-  inline void wait_for_event() {
-    std::unique_lock<std::mutex> lock(event_mutex);
-
-    auto start_time = std::chrono::steady_clock::now();
-    while (event_count == 0)
-      if (event_condition.wait_until(lock,
-                                     start_time + WAIT_FOR_HCI_EVENT_TIMEOUT) ==
-          std::cv_status::timeout)
-        return;
-    event_count--;
-  }
-
-  // Inform the test about an acl data callback
-  inline void notify_acl_data_received() {
-    std::unique_lock<std::mutex> lock(acl_mutex);
-    acl_count++;
-    acl_condition.notify_one();
-  }
-
-  // Test code calls this function to wait for an acl data callback
-  inline void wait_for_acl() {
-    std::unique_lock<std::mutex> lock(acl_mutex);
-
-    while (acl_count == 0)
-      acl_condition.wait_until(
-          lock, std::chrono::steady_clock::now() + WAIT_FOR_ACL_DATA_TIMEOUT);
-    acl_count--;
-  }
-
-  // Inform the test about a sco data callback
-  inline void notify_sco_data_received() {
-    std::unique_lock<std::mutex> lock(sco_mutex);
-    sco_count++;
-    sco_condition.notify_one();
-  }
-
-  // Test code calls this function to wait for a sco data callback
-  inline void wait_for_sco() {
-    std::unique_lock<std::mutex> lock(sco_mutex);
-
-    while (sco_count == 0)
-      sco_condition.wait_until(
-          lock, std::chrono::steady_clock::now() + WAIT_FOR_SCO_DATA_TIMEOUT);
-    sco_count--;
-  }
-
   // A simple test implementation of BluetoothHciCallbacks.
-  class BluetoothHciCallbacks : public IBluetoothHciCallbacks {
+  class BluetoothHciCallbacks
+      : public ::testing::VtsHalHidlTargetCallbackBase<BluetoothHidlTest>,
+        public IBluetoothHciCallbacks {
     BluetoothHidlTest& parent_;
 
    public:
@@ -256,7 +196,7 @@
 
     Return<void> initializationComplete(Status status) override {
       parent_.initialized = (status == Status::SUCCESS);
-      parent_.notify_initialized();
+      NotifyFromCallback(kCallbackNameInitializationComplete);
       ALOGV("%s (status = %d)", __func__, static_cast<int>(status));
       return Void();
     };
@@ -265,7 +205,7 @@
         const ::android::hardware::hidl_vec<uint8_t>& event) override {
       parent_.event_cb_count++;
       parent_.event_queue.push(event);
-      parent_.notify_event_received();
+      NotifyFromCallback(kCallbackNameHciEventReceived);
       ALOGV("Event received (length = %d)", static_cast<int>(event.size()));
       return Void();
     };
@@ -274,7 +214,7 @@
         const ::android::hardware::hidl_vec<uint8_t>& data) override {
       parent_.acl_cb_count++;
       parent_.acl_queue.push(data);
-      parent_.notify_acl_data_received();
+      NotifyFromCallback(kCallbackNameAclEventReceived);
       return Void();
     };
 
@@ -282,13 +222,13 @@
         const ::android::hardware::hidl_vec<uint8_t>& data) override {
       parent_.sco_cb_count++;
       parent_.sco_queue.push(data);
-      parent_.notify_sco_data_received();
+      NotifyFromCallback(kCallbackNameScoEventReceived);
       return Void();
     };
   };
 
   sp<IBluetoothHci> bluetooth;
-  sp<IBluetoothHciCallbacks> bluetooth_cb;
+  sp<BluetoothHciCallbacks> bluetooth_cb;
   std::queue<hidl_vec<uint8_t>> event_queue;
   std::queue<hidl_vec<uint8_t>> acl_queue;
   std::queue<hidl_vec<uint8_t>> sco_queue;
@@ -303,20 +243,6 @@
   int max_sco_data_packet_length;
   int max_acl_data_packets;
   int max_sco_data_packets;
-
- private:
-  std::mutex initialized_mutex;
-  std::mutex event_mutex;
-  std::mutex sco_mutex;
-  std::mutex acl_mutex;
-  std::condition_variable initialized_condition;
-  std::condition_variable event_condition;
-  std::condition_variable sco_condition;
-  std::condition_variable acl_condition;
-  int initialized_count;
-  int event_count;
-  int sco_count;
-  int acl_count;
 };
 
 // A class for test environment setup (kept since this file is a template).
@@ -334,11 +260,12 @@
   int status_event_count = 0;
   hidl_vec<uint8_t> event;
   do {
-    wait_for_event();
-    EXPECT_LT(static_cast<size_t>(0), event_queue.size());
-    if (event_queue.size() == 0) {
-      event.resize(0);
-      break;
+      EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+                      .no_timeout);
+      EXPECT_LT(static_cast<size_t>(0), event_queue.size());
+      if (event_queue.size() == 0) {
+          event.resize(0);
+          break;
     }
     event = event_queue.front();
     event_queue.pop();
@@ -366,7 +293,8 @@
   hidl_vec<uint8_t> cmd = COMMAND_HCI_READ_BUFFER_SIZE;
   bluetooth->sendHciCommand(cmd);
 
-  wait_for_event();
+  EXPECT_TRUE(
+      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
 
   EXPECT_LT(static_cast<size_t>(0), event_queue.size());
   if (event_queue.size() == 0) return;
@@ -420,7 +348,8 @@
     bluetooth->sendHciCommand(cmd);
 
     // Check the loopback of the HCI packet
-    wait_for_event();
+    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+                    .no_timeout);
     hidl_vec<uint8_t> event = event_queue.front();
     event_queue.pop();
     size_t compare_length =
@@ -456,7 +385,8 @@
     bluetooth->sendScoData(sco_vector);
 
     // Check the loopback of the SCO packet
-    wait_for_sco();
+    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameScoEventReceived)
+                    .no_timeout);
     hidl_vec<uint8_t> sco_loopback = sco_queue.front();
     sco_queue.pop();
 
@@ -501,7 +431,8 @@
     bluetooth->sendAclData(acl_vector);
 
     // Check the loopback of the ACL packet
-    wait_for_acl();
+    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameAclEventReceived)
+                    .no_timeout);
     hidl_vec<uint8_t> acl_loopback = acl_queue.front();
     acl_queue.pop();
 
@@ -527,19 +458,20 @@
 
 // Return the number of completed packets reported by the controller.
 int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
-  wait_for_event();
-  int packets_processed = 0;
-  while (event_queue.size() > 0) {
-    hidl_vec<uint8_t> event = event_queue.front();
-    event_queue.pop();
+    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+                    .no_timeout);
+    int packets_processed = 0;
+    while (event_queue.size() > 0) {
+        hidl_vec<uint8_t> event = event_queue.front();
+        event_queue.pop();
 
-    EXPECT_EQ(EVENT_NUMBER_OF_COMPLETED_PACKETS, event[EVENT_CODE_BYTE]);
-    EXPECT_EQ(1, event[EVENT_NUMBER_OF_COMPLETED_PACKETS_NUM_HANDLES]);
+        EXPECT_EQ(EVENT_NUMBER_OF_COMPLETED_PACKETS, event[EVENT_CODE_BYTE]);
+        EXPECT_EQ(1, event[EVENT_NUMBER_OF_COMPLETED_PACKETS_NUM_HANDLES]);
 
-    uint16_t event_handle = event[3] + (event[4] << 8);
-    EXPECT_EQ(handle, event_handle);
+        uint16_t event_handle = event[3] + (event[4] << 8);
+        EXPECT_EQ(handle, event_handle);
 
-    packets_processed += event[5] + (event[6] << 8);
+        packets_processed += event[5] + (event[6] << 8);
   }
   return packets_processed;
 }
@@ -554,32 +486,34 @@
   int connection_event_count = 0;
   hidl_vec<uint8_t> event;
   do {
-    wait_for_event();
-    event = event_queue.front();
-    event_queue.pop();
-    EXPECT_GT(event.size(),
-              static_cast<size_t>(EVENT_COMMAND_COMPLETE_STATUS_BYTE));
-    if (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE) {
+      EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
+                      .no_timeout);
+      event = event_queue.front();
+      event_queue.pop();
       EXPECT_GT(event.size(),
-                static_cast<size_t>(EVENT_CONNECTION_COMPLETE_TYPE));
-      EXPECT_EQ(event[EVENT_LENGTH_BYTE],
-                EVENT_CONNECTION_COMPLETE_PARAM_LENGTH);
-      uint8_t connection_type = event[EVENT_CONNECTION_COMPLETE_TYPE];
+                static_cast<size_t>(EVENT_COMMAND_COMPLETE_STATUS_BYTE));
+      if (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE) {
+          EXPECT_GT(event.size(),
+                    static_cast<size_t>(EVENT_CONNECTION_COMPLETE_TYPE));
+          EXPECT_EQ(event[EVENT_LENGTH_BYTE],
+                    EVENT_CONNECTION_COMPLETE_PARAM_LENGTH);
+          uint8_t connection_type = event[EVENT_CONNECTION_COMPLETE_TYPE];
 
-      EXPECT_TRUE(connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO ||
-                  connection_type == EVENT_CONNECTION_COMPLETE_TYPE_ACL);
+          EXPECT_TRUE(connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO ||
+                      connection_type == EVENT_CONNECTION_COMPLETE_TYPE_ACL);
 
-      // Save handles
-      uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
-                        event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1] << 8;
-      if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
-        sco_handles.push_back(handle);
-      else
-        acl_handles.push_back(handle);
+          // Save handles
+          uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
+                            event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1]
+                                << 8;
+          if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
+              sco_handles.push_back(handle);
+          else
+              acl_handles.push_back(handle);
 
-      ALOGD("Connect complete type = %d handle = %d",
-            event[EVENT_CONNECTION_COMPLETE_TYPE], handle);
-      connection_event_count++;
+          ALOGD("Connect complete type = %d handle = %d",
+                event[EVENT_CONNECTION_COMPLETE_TYPE], handle);
+          connection_event_count++;
     }
   } while (event[EVENT_CODE_BYTE] == EVENT_CONNECTION_COMPLETE);
 
@@ -592,7 +526,7 @@
 }
 
 // Empty test: Initialize()/Close() are called in SetUp()/TearDown().
-TEST_F(BluetoothHidlTest, InitializeAndClose) { }
+TEST_F(BluetoothHidlTest, InitializeAndClose) {}
 
 // Send an HCI Reset with sendHciCommand and wait for a command complete event.
 TEST_F(BluetoothHidlTest, HciReset) {
@@ -607,7 +541,8 @@
   hidl_vec<uint8_t> cmd = COMMAND_HCI_READ_LOCAL_VERSION_INFORMATION;
   bluetooth->sendHciCommand(cmd);
 
-  wait_for_event();
+  EXPECT_TRUE(
+      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
 
   hidl_vec<uint8_t> event = event_queue.front();
   event_queue.pop();
@@ -627,7 +562,8 @@
   hidl_vec<uint8_t> cmd = COMMAND_HCI_SHOULD_BE_UNKNOWN;
   bluetooth->sendHciCommand(cmd);
 
-  wait_for_event();
+  EXPECT_TRUE(
+      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);
 
   hidl_vec<uint8_t> event = event_queue.front();
   event_queue.pop();
diff --git a/broadcastradio/1.0/IBroadcastRadio.hal b/broadcastradio/1.0/IBroadcastRadio.hal
index c7fe62d..f599b10 100644
--- a/broadcastradio/1.0/IBroadcastRadio.hal
+++ b/broadcastradio/1.0/IBroadcastRadio.hal
@@ -21,7 +21,7 @@
 
 interface IBroadcastRadio {
 
-    /*
+    /**
      * Retrieve implementation properties.
      * @return result Operation completion status: OK in case of success,
      *                NOT_INITIALIZED in case of initialization error.
@@ -30,7 +30,7 @@
      */
     getProperties() generates (Result result, Properties properties);
 
-    /*
+    /**
      * Open a tuner interface for the requested configuration.
      * If no other tuner is opened, this will power on the radio hardware.
      * The hardware must be powered down when all tuner interface are released.
diff --git a/broadcastradio/1.0/IBroadcastRadioFactory.hal b/broadcastradio/1.0/IBroadcastRadioFactory.hal
index 82a97c4..ae82b07 100644
--- a/broadcastradio/1.0/IBroadcastRadioFactory.hal
+++ b/broadcastradio/1.0/IBroadcastRadioFactory.hal
@@ -20,7 +20,7 @@
 
 interface IBroadcastRadioFactory {
 
-    /*
+    /**
      * Connects to a broadcast radio HAL module for a given class
      * (AM/FM, Satellite, DAB).
      *
diff --git a/broadcastradio/1.0/ITuner.hal b/broadcastradio/1.0/ITuner.hal
index ae4b284..abbbd7a 100644
--- a/broadcastradio/1.0/ITuner.hal
+++ b/broadcastradio/1.0/ITuner.hal
@@ -20,7 +20,7 @@
 
 interface ITuner {
 
-    /*
+    /**
      * Apply current radio band configuration (band, range, channel spacing...).
      * Automatically cancels pending scan, step or tune.
      * ITunerCallback.configChange() method MUST be called once the
@@ -33,7 +33,7 @@
      */
     setConfiguration(BandConfig config) generates(Result result);
 
-    /*
+    /**
      * Retrieve current radio band configuration.
      * @return result OK if valid configuration is returned,
      *                NOT_INITIALIZED in case of initialization error.
@@ -41,7 +41,7 @@
      */
     getConfiguration() generates(Result result, BandConfig config);
 
-    /*
+    /**
      * Start scanning up to next valid station.
      * Shall be called only when a valid configuration has been applied.
      * Automatically cancels pending scan, step or tune.
@@ -57,7 +57,7 @@
      */
     scan(Direction direction, bool skipSubChannel) generates(Result result);
 
-    /*
+    /**
      * Move one channel spacing up or down.
      * Must be called when a valid configuration has been applied.
      * Automatically cancels pending scan, step or tune.
@@ -73,7 +73,7 @@
      */
     step(Direction direction, bool skipSubChannel) generates(Result result);
 
-    /*
+    /**
      * Tune to specified channel.
      * Must be called when a valid configuration has been applied.
      * Automatically cancels pending scan, step or tune.
@@ -91,7 +91,7 @@
      */
     tune(uint32_t channel, uint32_t subChannel) generates(Result result);
 
-    /*
+    /**
      * Cancel a scan, step or tune operation.
      * Shall be called only while a scan, step or tune operation is pending.
      * ITunerCallback.tuneComplete() MUST NOT be sent by the HAL.
@@ -101,7 +101,7 @@
      */
     cancel() generates(Result result);
 
-    /*
+    /**
      * Retrieve current station information.
      * @return result OK if scan successfully started
      *                NOT_INITIALIZED if another error occurs
diff --git a/broadcastradio/1.0/ITunerCallback.hal b/broadcastradio/1.0/ITunerCallback.hal
index a7e1260..0966ff4 100644
--- a/broadcastradio/1.0/ITunerCallback.hal
+++ b/broadcastradio/1.0/ITunerCallback.hal
@@ -19,13 +19,13 @@
 
 interface ITunerCallback {
 
-    /*
+    /**
      * Method called by the HAL when a HW failure occurs.
      * The framework MUST close the ITuner interface and open a new one.
      */
     oneway hardwareFailure();
 
-    /*
+    /**
      * Method called by the HAL when a new configuration is applied
      * in response to IDevice.openTuner() or ITuner.setConfiguration().
      * @param result OK if the configuration has been applied,
@@ -35,7 +35,7 @@
      */
     oneway configChange(Result result, BandConfig config);
 
-    /*
+    /**
      * Method called by the HAL when a tuning operation completes
      * following a step(), scan() or tune() command.
      * @param result OK if tune succeeded or TIMEOUT in case of time out.
@@ -43,33 +43,33 @@
      */
     oneway tuneComplete(Result result, ProgramInfo info);
 
-    /*
+    /**
      * Method called by the HAL when a frequency switch occurs.
      * @param info A ProgramInfo structure describing the new tuned station.
      */
     oneway afSwitch(ProgramInfo info);
 
-    /*
+    /**
      * Method called by the HAL when the antenna connection state changes.
      * @param connected True if the antenna is connected, false otherwise.
      */
     oneway antennaStateChange(bool connected);
 
-    /*
+    /**
      * Method called by the HAL when a traffic announcement starts or
      * stops.
      * @param active True if the announcement starts, false if it stops.
      */
     oneway trafficAnnouncement(bool active);
 
-    /*
+    /**
      * Method called by the HAL when an emergency announcement starts
      * or stops.
      * @param active True if the announcement starts, false if it stops.
      */
     oneway emergencyAnnouncement(bool active);
 
-    /*
+    /**
      * Method called by the HAL when metadata for current station
      * are updated.
      * @param channel The channel the metadata is associated with.
@@ -77,4 +77,4 @@
      * @param metadata A list of all updated metada.
      */
     oneway newMetadata(uint32_t channel, uint32_t subChannel, vec<MetaData>  metadata);
-};
\ No newline at end of file
+};
diff --git a/broadcastradio/1.0/types.hal b/broadcastradio/1.0/types.hal
index d8b2da3..045231d 100644
--- a/broadcastradio/1.0/types.hal
+++ b/broadcastradio/1.0/types.hal
@@ -24,33 +24,33 @@
     TIMEOUT,
 };
 
-/*
+/**
  * Radio hardware module class. A given radio hardware module HAL is of one
  * class only. The platform can not have more than one hardware module of
  * each class. Current version of the framework only supports RADIO_CLASS_AM_FM.
  */
 enum Class : uint32_t {
-    /* FM (including HD radio) and AM */
+    /** FM (including HD radio) and AM */
     AM_FM = 0,
-    /* Satellite Radio */
+    /** Satellite Radio */
     SAT   = 1,
-    /* Digital Radio (DAB) */
+    /** Digital Radio (DAB) */
     DT    = 2,
 };
 
-/* value for field "type" of radio band described in struct radio_hal_band_config */
+/** value for field "type" of radio band described in struct radio_hal_band_config */
 enum Band : uint32_t {
-    /* Amplitude Modulation band: LW, MW, SW */
+    /** Amplitude Modulation band: LW, MW, SW */
     AM     = 0,
-    /* Frequency Modulation band: FM */
+    /** Frequency Modulation band: FM */
     FM     = 1,
-    /* FM HD Radio / DRM (IBOC) */
+    /** FM HD Radio / DRM (IBOC) */
     FM_HD  = 2,
-    /* AM HD Radio / DRM (IBOC) */
+    /** AM HD Radio / DRM (IBOC) */
     AM_HD  = 3,
 };
 
-/* RDS variant implemented. A struct FmBandConfig can list none or several. */
+/** RDS variant implemented. A struct FmBandConfig can list none or several. */
 enum Rds : uint32_t {
     NONE   = 0,
     WORLD  = (1<<0),
@@ -65,35 +65,35 @@
     D75   = (1<<1),
 };
 
-/* Scanning direction for scan() and step() tuner APIs */
+/** Scanning direction for scan() and step() tuner APIs */
 enum Direction : uint32_t {
     UP,
     DOWN
 };
 
-/* Unique handle allocated to a radio module */
+/** Unique handle allocated to a radio module */
 typedef uint32_t Handle;
 
 
-/* Additional attributes for an FM band configuration */
+/** Additional attributes for an FM band configuration */
 struct FmBandConfig {
-    /* deemphasis variant */
+    /** deemphasis variant */
     Deemphasis deemphasis;
-    /* stereo supported */
+    /** stereo supported */
     bool       stereo;
-    /* RDS variants supported */
+    /** RDS variants supported */
     Rds        rds;
-    /* Traffic Announcement supported */
+    /** Traffic Announcement supported */
     bool       ta;
-    /* Alternate Frequency supported */
+    /** Alternate Frequency supported */
     bool       af;
-    /* Emergency announcements supported */
+    /** Emergency announcements supported */
     bool       ea;
 };
 
-/* Additional attributes for an AM band configuration */
+/** Additional attributes for an AM band configuration */
 struct AmBandConfig {
-    /* Stereo supported */
+    /** Stereo supported */
     bool       stereo;
 };
 
@@ -120,83 +120,84 @@
  * If more than one tuner is supported (num_tuners > 1), only one can be
  * connected to the audio source. */
 struct Properties {
-    /* Class of this module. E.g AM_FM */
+    /** Class of this module. E.g AM_FM */
     Class           classId;
-    /* implementor name */
+    /** implementor name */
     string          implementor;
-    /* product name */
+    /** product name */
     string          product;
-    /* product version */
+    /** product version */
     string          version;
-    /* serial number (for subscription services) */
+    /** serial number (for subscription services) */
     string          serial;
-    /* number of tuners controllable independently */
+    /** number of tuners controllable independently */
     uint32_t        numTuners;
-    /* number of audio sources driven simultaneously */
+    /** number of audio sources driven simultaneously */
     uint32_t        numAudioSources;
-    /* the hardware supports capture of audio source from audio HAL */
+    /** the hardware supports capture of audio source from audio HAL */
     bool            supportsCapture;
-    vec<BandConfig> bands; /* band descriptors */
+    vec<BandConfig> bands; /** band descriptors */
 };
 
 enum MetadataType : int32_t {
     INVALID    = -1,
-    /* Signed 32 bit integer  */
+    /** Signed 32 bit integer  */
     INT        = 0,
-    /* String */
+    /** String */
     TEXT       = 1,
-    /* Raw binary data (icon or art)
+    /**
+     * Raw binary data (icon or art)
        This data must be transparent to the android framework */
     RAW        = 2,
-    /* clock data, see MetaDataClock */
+    /** clock data, see MetaDataClock */
     CLOCK      = 3,
 };
 
 enum MetadataKey : int32_t {
     INVALID      = -1,
-    /* RDS PI                 - string  */
+    /** RDS PI                 - string  */
     RDS_PI       = 0,
-    /* RDS PS                 - string */
+    /** RDS PS                 - string */
     RDS_PS       = 1,
-    /* RDS PTY                - int32_t  */
+    /** RDS PTY                - int32_t  */
     RDS_PTY      = 2,
-    /* RBDS PTY               - int32_t  */
+    /** RBDS PTY               - int32_t  */
     RBDS_PTY     = 3,
-    /* RDS RT                 - string  */
+    /** RDS RT                 - string  */
     RDS_RT       = 4,
-    /* Song title             - string  */
+    /** Song title             - string  */
     TITLE        = 5,
-    /* Artist name            - string  */
+    /** Artist name            - string  */
     ARTIST       = 6,
-    /* Album name             - string  */
+    /** Album name             - string  */
     ALBUM        = 7,
-    /* Musical genre          - string  */
+    /** Musical genre          - string  */
     GENRE        = 8,
-    /* Station icon           - raw  */
+    /** Station icon           - raw  */
     ICON         = 9,
-    /* Album art              - raw  */
+    /** Album art              - raw  */
     ART          = 10,
-    /* Clock                  - MetaDataClock */
+    /** Clock                  - MetaDataClock */
     CLOCK        = 11,
 };
 
 struct MetaDataClock {
-     /* Seconds since epoch at GMT + 0. */
+     /** Seconds since epoch at GMT + 0. */
     uint64_t utcSecondsSinceEpoch;
-    /* Minutes offset from the GMT. */
+    /** Minutes offset from the GMT. */
     int32_t timezoneOffsetInMinutes;
 };
 
 struct MetaData {
     MetadataType type;
     MetadataKey key;
-    /* Value used for type MetadataType.INT */
+    /** Value used for type MetadataType.INT */
     int32_t intValue;
-    /* Value used for type MetadataType.CLOCK */
+    /** Value used for type MetadataType.CLOCK */
     MetaDataClock  clockValue;
-    /* Value used for type MetadataType.TEXT */
+    /** Value used for type MetadataType.TEXT */
     string  stringValue;
-    /* Value used for type MetadataType.RAW */
+    /** Value used for type MetadataType.RAW */
     vec<uint8_t> rawValue;
 };
 
@@ -205,12 +206,12 @@
  * Contains information on currently tuned channel.
  */
 struct ProgramInfo {
-    uint32_t     channel;   /* current channel. (e.g kHz for band type AM_FM) */
-    uint32_t     subChannel; /* current sub channel. (FM_HD) */
-    bool         tuned;     /* tuned to a program or not */
-    bool         stereo;    /* program is stereo or not */
-    bool         digital;   /* digital program or not (e.g HD Radio program) */
-    uint32_t     signalStrength; /* signal strength from 0 to 100 */
-    vec<MetaData> metadata; /* non empty if meta data are present (e.g PTY, song title ...) */
+    uint32_t     channel;   /** current channel. (e.g kHz for band type AM_FM) */
+    uint32_t     subChannel; /** current sub channel. (FM_HD) */
+    bool         tuned;     /** tuned to a program or not */
+    bool         stereo;    /** program is stereo or not */
+    bool         digital;   /** digital program or not (e.g HD Radio program) */
+    uint32_t     signalStrength; /** signal strength from 0 to 100 */
+    vec<MetaData> metadata; /** non empty if meta data are present (e.g PTY, song title ...) */
 };
 
diff --git a/broadcastradio/1.1/IBroadcastRadio.hal b/broadcastradio/1.1/IBroadcastRadio.hal
index a6347c7..dd37d49 100644
--- a/broadcastradio/1.1/IBroadcastRadio.hal
+++ b/broadcastradio/1.1/IBroadcastRadio.hal
@@ -20,7 +20,7 @@
 
 interface IBroadcastRadio extends @1.0::IBroadcastRadio {
 
-    /*
+    /**
      * Retrieve implementation properties.
      * @return properties A Properties structure containing implementation
      *                    description and capabilities.
diff --git a/broadcastradio/1.1/ITunerCallback.hal b/broadcastradio/1.1/ITunerCallback.hal
index 1ea57e9..07ce984 100644
--- a/broadcastradio/1.1/ITunerCallback.hal
+++ b/broadcastradio/1.1/ITunerCallback.hal
@@ -25,7 +25,7 @@
  * ones, to avoid receiving a callback twice.
  */
 interface ITunerCallback extends @1.0::ITunerCallback {
-    /*
+    /**
      * Method called by the HAL when a tuning operation completes
      * following a step(), scan() or tune() command.
      * @param result OK if tune succeeded or TIMEOUT in case of time out.
@@ -33,7 +33,7 @@
      */
     oneway tuneComplete_1_1(Result result, ProgramInfo info);
 
-    /*
+    /**
      * Method called by the HAL when a frequency switch occurs.
      * @param info A ProgramInfo structure describing the new tuned station.
      */
diff --git a/camera/device/1.0/ICameraDevice.hal b/camera/device/1.0/ICameraDevice.hal
index 52d6cf0..d4aa8cc 100644
--- a/camera/device/1.0/ICameraDevice.hal
+++ b/camera/device/1.0/ICameraDevice.hal
@@ -328,6 +328,20 @@
     releaseRecordingFrameHandle(MemoryId memId, uint32_t bufferIndex, handle frame);
 
     /**
+     * Release a batch of record frames previously returned by CAMERA_MSG_VIDEO_FRAME
+     * in handleCallbackTimestampBatch.
+     *
+     * It is camera HAL client's responsibility to release video recording
+     * frames sent out by the camera HAL before the camera HAL receives a call
+     * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to
+     * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's
+     * responsibility to manage the life-cycle of the video recording frames.
+     *
+     * @param batch A batch of recording frames to be released by camera HAL.
+     */
+    releaseRecordingFrameHandleBatch(vec<VideoFrameMessage> batch);
+
+    /**
      * Start auto focus.
      *
      * The notification callback routine is called with
diff --git a/camera/device/1.0/ICameraDeviceCallback.hal b/camera/device/1.0/ICameraDeviceCallback.hal
index 1b0db24..1dfcd80 100644
--- a/camera/device/1.0/ICameraDeviceCallback.hal
+++ b/camera/device/1.0/ICameraDeviceCallback.hal
@@ -92,10 +92,24 @@
      * @param timestamp The time this buffer was captured by the camera, in
      *     nanoseconds.
      *
-     * @return frameId a frame ID to be used with releaseRecordingFrameId later
-     *
      */
     handleCallbackTimestamp(DataCallbackMsg msgType, handle frameData, MemoryId data,
             uint32_t bufferIndex, int64_t timestamp);
 
+    /**
+     * Send a batch of image data buffer to the camera service, with timestamps
+     *
+     * This callback can be used to send multiple frames to camera framework in one callback, which
+     * reduce number of callbacks in performance intensive use cases, such as high speed video
+     * recording. The HAL must not mix use of this method with handleCallbackTimestamp in one
+     * recording session (between startRecording and stopRecording)
+     *
+     * @param msgType The kind of image buffer data this call represents.
+     * @param batch a vector messages. Each message contains a image buffer and a timestamp. The
+     *     messages must be ordered in time from lower index to higher index, so that timestamp of
+     *     i-th message is always smaller than i+1-th message.
+     *
+     */
+    handleCallbackTimestampBatch(DataCallbackMsg msgType, vec<HandleTimestampMessage> batch);
+
 };
diff --git a/camera/device/1.0/default/CameraDevice.cpp b/camera/device/1.0/default/CameraDevice.cpp
index 0cc70a1..5e3fcf2 100644
--- a/camera/device/1.0/default/CameraDevice.cpp
+++ b/camera/device/1.0/default/CameraDevice.cpp
@@ -424,6 +424,39 @@
     }
 }
 
+void CameraDevice::handleCallbackTimestamp(
+        nsecs_t timestamp, int32_t msg_type,
+        MemoryId memId , unsigned index, native_handle_t* handle) {
+    uint32_t batchSize = 0;
+    {
+        Mutex::Autolock _l(mBatchLock);
+        batchSize = mBatchSize;
+    }
+
+    if (batchSize == 0) { // non-batch mode
+        mDeviceCallback->handleCallbackTimestamp(
+                (DataCallbackMsg) msg_type, handle, memId, index, timestamp);
+    } else { // batch mode
+        Mutex::Autolock _l(mBatchLock);
+        size_t inflightSize = mInflightBatch.size();
+        if (inflightSize == 0) {
+            mBatchMsgType = msg_type;
+        } else if (mBatchMsgType != msg_type) {
+            ALOGE("%s: msg_type change (from %d to %d) is not supported!",
+                    __FUNCTION__, mBatchMsgType, msg_type);
+            return;
+        }
+        mInflightBatch.push_back({handle, memId, index, timestamp});
+
+        // Send batched frames to camera framework
+        if (mInflightBatch.size() >= batchSize) {
+            mDeviceCallback->handleCallbackTimestampBatch(
+                    (DataCallbackMsg) mBatchMsgType, mInflightBatch);
+            mInflightBatch.clear();
+        }
+    }
+}
+
 void CameraDevice::sDataCbTimestamp(nsecs_t timestamp, int32_t msg_type,
         const camera_memory_t *data, unsigned index, void *user) {
     ALOGV("%s", __FUNCTION__);
@@ -454,8 +487,7 @@
             object->mDeviceCallback->dataCallbackTimestamp(
                     (DataCallbackMsg) msg_type, mem->handle.mId, index, timestamp);
         } else {
-            object->mDeviceCallback->handleCallbackTimestamp(
-                    (DataCallbackMsg) msg_type, handle, mem->handle.mId, index, timestamp);
+            object->handleCallbackTimestamp(timestamp, msg_type, mem->handle.mId, index, handle);
         }
     }
 }
@@ -831,6 +863,17 @@
     return Void();
 }
 
+Return<void> CameraDevice::releaseRecordingFrameHandleBatch(
+        const hidl_vec<VideoFrameMessage>& msgs) {
+    ALOGV("%s(%s)", __FUNCTION__, mCameraId.c_str());
+    Mutex::Autolock _l(mLock);
+    for (auto& msg : msgs) {
+        releaseRecordingFrameLocked(
+                msg.data, msg.bufferIndex, msg.frameData.getNativeHandle());
+    }
+    return Void();
+}
+
 Return<Status> CameraDevice::autoFocus() {
     ALOGV("%s(%s)", __FUNCTION__, mCameraId.c_str());
     Mutex::Autolock _l(mLock);
diff --git a/camera/device/1.0/default/CameraDevice_1_0.h b/camera/device/1.0/default/CameraDevice_1_0.h
index 2568f86..ad5f582 100644
--- a/camera/device/1.0/default/CameraDevice_1_0.h
+++ b/camera/device/1.0/default/CameraDevice_1_0.h
@@ -93,6 +93,8 @@
     Return<void> releaseRecordingFrame(uint32_t memId, uint32_t bufferIndex) override;
     Return<void> releaseRecordingFrameHandle(
             uint32_t memId, uint32_t bufferIndex, const hidl_handle& frame) override;
+    Return<void> releaseRecordingFrameHandleBatch(
+            const hidl_vec<VideoFrameMessage>&) override;
     Return<Status> autoFocus() override;
     Return<Status> cancelAutoFocus() override;
     Return<Status> takePicture() override;
@@ -169,6 +171,16 @@
 
     bool mMetadataMode = false;
 
+    mutable Mutex mBatchLock;
+    // Start of protection scope for mBatchLock
+    uint32_t mBatchSize = 0; // 0 for non-batch mode, set to other value to start batching
+    int32_t mBatchMsgType;   // Maybe only allow DataCallbackMsg::VIDEO_FRAME?
+    std::vector<HandleTimestampMessage> mInflightBatch;
+    // End of protection scope for mBatchLock
+
+    void handleCallbackTimestamp(
+            nsecs_t timestamp, int32_t msg_type,
+            MemoryId memId , unsigned index, native_handle_t* handle);
     void releaseRecordingFrameLocked(uint32_t memId, uint32_t bufferIndex, const native_handle_t*);
 
     // shared memory methods
@@ -178,13 +190,13 @@
     // Device callback forwarding methods
     static void sNotifyCb(int32_t msg_type, int32_t ext1, int32_t ext2, void *user);
     static void sDataCb(int32_t msg_type, const camera_memory_t *data, unsigned int index,
-                          camera_frame_metadata_t *metadata, void *user);
+                        camera_frame_metadata_t *metadata, void *user);
     static void sDataCbTimestamp(nsecs_t timestamp, int32_t msg_type,
                                     const camera_memory_t *data, unsigned index, void *user);
 
     // Preview window callback forwarding methods
     static int sDequeueBuffer(struct preview_stream_ops* w,
-                                buffer_handle_t** buffer, int *stride);
+                              buffer_handle_t** buffer, int *stride);
 
     static int sLockBuffer(struct preview_stream_ops* w, buffer_handle_t* buffer);
 
@@ -195,7 +207,7 @@
     static int sSetBufferCount(struct preview_stream_ops* w, int count);
 
     static int sSetBuffersGeometry(struct preview_stream_ops* w,
-                                     int width, int height, int format);
+                                   int width, int height, int format);
 
     static int sSetCrop(struct preview_stream_ops *w, int left, int top, int right, int bottom);
 
diff --git a/camera/device/1.0/types.hal b/camera/device/1.0/types.hal
index 1a90fe0..0b3445f 100644
--- a/camera/device/1.0/types.hal
+++ b/camera/device/1.0/types.hal
@@ -253,8 +253,41 @@
     vec<CameraFace> faces;
 };
 
-/*
+/**
  * A simple integer handle to use to reference a particular memory buffer
  * between the HAL and the framework.
  */
 typedef uint32_t MemoryId;
+
+/*
+ * Struct containing arguments of ICameraDeviceCallback::handleCallbackTimestamp.
+ * Used to send a batch of messages in ICameraDeviceCallback::handleCallbackTimestampBatch.
+ */
+struct HandleTimestampMessage {
+    // The handle of image buffer data.
+    handle frameData;
+
+    // A memory handle to the buffer containing the data
+    MemoryId data;
+
+    // The offset into the memory handle where the buffer starts.
+    uint32_t bufferIndex;
+
+    // The time this buffer was captured by the camera, in nanoseconds
+    int64_t timestamp;
+};
+
+/*
+ * Struct containing arguments of ICameraDevice::releaseRecordingFrameHandle.
+ * Used by camera framework to send a batch of recording frames back to camera HAL.
+ */
+struct VideoFrameMessage {
+    // The handle of image buffer data.
+    handle frameData;
+
+    // A memory handle to the buffer containing the data
+    MemoryId data;
+
+    // The offset into the memory handle where the buffer starts.
+    uint32_t bufferIndex;
+};
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index ba5bbe0..fd75528 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -68,16 +68,16 @@
  * The required counterclockwise rotation of camera stream.
  */
 enum StreamRotation : uint32_t  {
-    /* No rotation */
+    /** No rotation */
     ROTATION_0 = 0,
 
-    /* Rotate by 90 degree counterclockwise */
+    /** Rotate by 90 degree counterclockwise */
     ROTATION_90 = 1,
 
-    /* Rotate by 180 degree counterclockwise */
+    /** Rotate by 180 degree counterclockwise */
     ROTATION_180 = 2,
 
-    /* Rotate by 270 degree counterclockwise */
+    /** Rotate by 270 degree counterclockwise */
     ROTATION_270 = 3
 
 };
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 80a8165..af7e3bf 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -91,6 +91,7 @@
 using ::android::hardware::camera::device::V1_0::CameraFrameMetadata;
 using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
 using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
+using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
 
 const char kCameraPassthroughServiceName[] = "legacy/0";
 const uint32_t kMaxPreviewWidth = 1920;
@@ -516,6 +517,10 @@
                 const hidl_handle& frameData,uint32_t data,
                 uint32_t bufferIndex, int64_t timestamp) override;
 
+        Return<void> handleCallbackTimestampBatch(DataCallbackMsg msgType,
+                const ::android::hardware::hidl_vec<HandleTimestampMessage>& batch) override;
+
+
      private:
         CameraHidlTest *mParent;               // Parent object
     };
@@ -672,6 +677,23 @@
     return Void();
 }
 
+Return<void> CameraHidlTest::Camera1DeviceCb::handleCallbackTimestampBatch(
+        DataCallbackMsg msgType,
+        const hidl_vec<HandleTimestampMessage>& batch) {
+    std::unique_lock<std::mutex> l(mParent->mLock);
+    for (auto& msg : batch) {
+        mParent->mDataMessageTypeReceived = msgType;
+        mParent->mVideoBufferIndex = msg.bufferIndex;
+        if (mParent->mMemoryPool.count(msg.data) == 0) {
+            ADD_FAILURE() << "memory pool ID " << msg.data << " not found";
+        }
+        mParent->mVideoData = msg.data;
+        mParent->mVideoNativeHandle = msg.frameData;
+        mParent->mResultCondition.notify_one();
+    }
+    return Void();
+}
+
 Return<void> CameraHidlTest::DeviceCb::processCaptureResult(
         const hidl_vec<CaptureResult>& results) {
     if (nullptr == mParent) {
diff --git a/configstore/1.0/ISurfaceFlingerConfigs.hal b/configstore/1.0/ISurfaceFlingerConfigs.hal
index 3b5c1b0..dcc9bbb 100644
--- a/configstore/1.0/ISurfaceFlingerConfigs.hal
+++ b/configstore/1.0/ISurfaceFlingerConfigs.hal
@@ -16,7 +16,7 @@
 package android.hardware.configstore@1.0;
 
 interface ISurfaceFlingerConfigs {
-    /*
+    /**
      * The following two methods define (respectively):
      *
      * - The phase offset between hardware vsync and when apps are woken up by the
@@ -40,13 +40,13 @@
     vsyncEventPhaseOffsetNs() generates (OptionalInt64 value);
     vsyncSfEventPhaseOffsetNs() generates (OptionalInt64 value);
 
-    /*
+    /**
      * Instruct the Render Engine to use EGL_IMG_context_priority hint if
      * availabe.
      */
     useContextPriority() generates(OptionalBool value);
 
-    /*
+    /**
      * hasWideColorDisplay indicates that the device has
      * or can support a wide-color display, e.g. color space
      * greater than sRGB. Typical display may have same
@@ -60,7 +60,7 @@
      */
     hasWideColorDisplay() generates (OptionalBool value);
 
-    /*
+    /**
      * hwHdrDisplay indicates that the device has
      * or can support an HDR (High Dynamic Range) display.
      * Typically an HDR display is also wide-color.
@@ -69,13 +69,13 @@
      */
     hasHDRDisplay() generates (OptionalBool value);
 
-    /*
+    /**
      * Specify the offset in nanoseconds to add to vsync time when timestamping
      * present fences.
      */
     presentTimeOffsetFromVSyncNs() generates(OptionalInt64 value);
 
-    /*
+    /**
      * Some hardware can do RGB->YUV conversion more efficiently in hardware
      * controlled by HWC than in hardware controlled by the video encoder.
      * This instruct VirtualDisplaySurface to use HWC for such conversion on
@@ -83,19 +83,19 @@
      */
     useHwcForRGBtoYUV() generates(OptionalBool value);
 
-    /*
+    /**
      *  Maximum dimension supported by HWC for virtual display.
      *  Must be equals to min(max_width, max_height).
      */
     maxVirtualDisplaySize() generates (OptionalUInt64 value);
 
-    /*
+    /**
      * Indicates if Sync framework is available. Sync framework provides fence
      * mechanism which significantly reduces buffer processing latency.
      */
     hasSyncFramework() generates(OptionalBool value);
 
-    /*
+    /**
      * Return true if surface flinger should use vr flinger for compatible vr
      * apps, false otherwise. Devices that will never be running vr apps should
      * return false to avoid extra resource usage. Daydream ready devices must
@@ -103,7 +103,7 @@
      */
     useVrFlinger() generates (OptionalBool value);
 
-    /*
+    /**
      * Controls the number of buffers SurfaceFlinger will allocate for use in
      * FramebufferSurface.
      */
diff --git a/contexthub/1.0/IContexthub.hal b/contexthub/1.0/IContexthub.hal
index c0928d5..8dccd67 100644
--- a/contexthub/1.0/IContexthub.hal
+++ b/contexthub/1.0/IContexthub.hal
@@ -18,7 +18,7 @@
 
 import IContexthubCallback;
 
-/*
+/**
  * The Context Hub HAL provides an interface to a separate low-power processing
  * domain that has direct access to contextual information, such as sensors.
  * Native applications that run within a context hub are known as nanoapps, and
@@ -26,14 +26,14 @@
  * standardized via the CHRE API, defined elsewhere.
  */
 interface IContexthub {
-    /*
+    /**
      * Enumerate all available context hubs on the system.
      *
      * @return hubs list of hubs on this system.
      */
     getHubs() generates (vec<ContextHub> hubs);
 
-    /*
+    /**
      * Register a callback for the HAL implementation to send asynchronous
      * messages to the service from a context hub. There can be a maximum of
      * one callback registered with the HAL. A call to this function when a
diff --git a/contexthub/1.0/IContexthubCallback.hal b/contexthub/1.0/IContexthubCallback.hal
index 9a6db4c..264f84c 100644
--- a/contexthub/1.0/IContexthubCallback.hal
+++ b/contexthub/1.0/IContexthubCallback.hal
@@ -17,7 +17,7 @@
 package android.hardware.contexthub@1.0;
 
 interface IContexthubCallback {
-    /*
+    /**
      * This callback is passed by the Contexthub service to the HAL
      * implementation to allow the HAL to send asynchronous messages back
      * to the service and registered clients of the ContextHub service.
@@ -27,7 +27,7 @@
      */
      handleClientMsg(ContextHubMsg msg);
 
-    /*
+    /**
      * This callback is passed by the Contexthub service to the HAL
      * implementation to allow the HAL to send the response for a
      * transaction.
@@ -39,7 +39,7 @@
      */
      handleTxnResult(uint32_t txnId, TransactionResult result);
 
-    /*
+    /**
      * This callback is passed by the Contexthub service to the HAL
      * implementation to allow the HAL to send an asynchronous event
      * to the ContextHub service.
@@ -49,7 +49,7 @@
      */
      handleHubEvent(AsyncEventType evt);
 
-    /*
+    /**
      * This callback is passed by the Contexthub service to the HAL
      * implementation to allow the HAL to send a notification to the service
      * that a nanp-app has aborted.
@@ -63,7 +63,7 @@
      */
      handleAppAbort(uint64_t appId, uint32_t abortCode);
 
-     /*
+     /**
       * This callback is passed by the Contexthub service to the HAL
       * implementation to allow the HAL to send information about the
       * currently loaded and active nanoapps on the hub.
diff --git a/drm/1.0/default/DrmPlugin.cpp b/drm/1.0/default/DrmPlugin.cpp
index 6f51e0e..c7428a5 100644
--- a/drm/1.0/default/DrmPlugin.cpp
+++ b/drm/1.0/default/DrmPlugin.cpp
@@ -77,7 +77,7 @@
             android::DrmPlugin::KeyRequestType legacyRequestType =
                     android::DrmPlugin::kKeyRequestType_Unknown;
 
-            status_t status = mLegacyPlugin->getKeyRequest(toVector(scope),
+            status = mLegacyPlugin->getKeyRequest(toVector(scope),
                     toVector(initData), String8(mimeType), legacyKeyType,
                     legacyOptionalParameters, legacyRequest, defaultUrl,
                     &legacyRequestType);
@@ -93,7 +93,7 @@
                 requestType = KeyRequestType::RELEASE;
                 break;
             case android::DrmPlugin::kKeyRequestType_Unknown:
-                status = android::BAD_VALUE;
+                requestType = KeyRequestType::UNKNOWN;
                 break;
             }
         }
diff --git a/drm/1.0/vts/doc/Drm_Vendor_Modules_v1.pdf b/drm/1.0/vts/doc/Drm_Vendor_Modules_v1.pdf
new file mode 100644
index 0000000..1b44e4f
--- /dev/null
+++ b/drm/1.0/vts/doc/Drm_Vendor_Modules_v1.pdf
Binary files differ
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..36d7d1c
--- /dev/null
+++ b/drm/1.0/vts/functional/Android.bp
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+    name: "VtsHalDrmV1_0TargetTest",
+    srcs: [
+        "drm_hal_clearkey_test.cpp",
+        "drm_hal_vendor_test.cpp",
+        "shared_library.cpp",
+        "vendor_modules.cpp"
+        ],
+    shared_libs: [
+        "android.hardware.drm@1.0",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "libbase",
+        "libcutils",
+        "libhidlbase",
+        "libhidlmemory",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libnativehelper",
+        "libutils",
+    ],
+    static_libs: [
+        "VtsHalHidlTargetTestBase"
+    ],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
new file mode 100644
index 0000000..2296d2d
--- /dev/null
+++ b/drm/1.0/vts/functional/drm_hal_clearkey_test.cpp
@@ -0,0 +1,904 @@
+/*
+ * Copyright (C) 2017 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 "drm_hal_clearkey_test@1.0"
+
+#include <android-base/logging.h>
+#include <android/hardware/drm/1.0/ICryptoFactory.h>
+#include <android/hardware/drm/1.0/ICryptoPlugin.h>
+#include <android/hardware/drm/1.0/IDrmFactory.h>
+#include <android/hardware/drm/1.0/IDrmPlugin.h>
+#include <android/hardware/drm/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <gtest/gtest.h>
+#include <hidl/HidlSupport.h>
+#include <hidlmemory/mapping.h>
+#include <memory>
+#include <random>
+
+#include "VtsHalHidlTargetTestBase.h"
+
+using ::android::hardware::drm::V1_0::BufferType;
+using ::android::hardware::drm::V1_0::DestinationBuffer;
+using ::android::hardware::drm::V1_0::ICryptoFactory;
+using ::android::hardware::drm::V1_0::ICryptoPlugin;
+using ::android::hardware::drm::V1_0::IDrmFactory;
+using ::android::hardware::drm::V1_0::IDrmPlugin;
+using ::android::hardware::drm::V1_0::KeyedVector;
+using ::android::hardware::drm::V1_0::KeyValue;
+using ::android::hardware::drm::V1_0::KeyRequestType;
+using ::android::hardware::drm::V1_0::KeyType;
+using ::android::hardware::drm::V1_0::Mode;
+using ::android::hardware::drm::V1_0::Pattern;
+using ::android::hardware::drm::V1_0::SecureStop;
+using ::android::hardware::drm::V1_0::SecureStopId;
+using ::android::hardware::drm::V1_0::SessionId;
+using ::android::hardware::drm::V1_0::SharedBuffer;
+using ::android::hardware::drm::V1_0::Status;
+using ::android::hardware::drm::V1_0::SubSample;
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::sp;
+
+using std::string;
+using std::unique_ptr;
+using std::random_device;
+using std::map;
+using std::mt19937;
+using std::vector;
+
+/**
+ * These clearkey tests use white box knowledge of the legacy clearkey
+ * plugin to verify that the HIDL HAL services and interfaces are working.
+ * It is not intended to verify any vendor's HAL implementation. If you
+ * are looking for vendor HAL tests, see drm_hal_vendor_test.cpp
+ */
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+
+static const uint8_t kClearKeyUUID[16] = {
+    0x10, 0x77, 0xEF, 0xEC, 0xC0, 0xB2, 0x4D, 0x02,
+    0xAC, 0xE3, 0x3C, 0x1E, 0x52, 0xE2, 0xFB, 0x4B};
+
+static const uint8_t kInvalidUUID[16] = {
+    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
+    0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80};
+
+class DrmHalClearkeyFactoryTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        const ::testing::TestInfo* const test_info =
+                ::testing::UnitTest::GetInstance()->current_test_info();
+        ALOGD("Running test %s.%s", test_info->test_case_name(),
+              test_info->name());
+
+        drmFactory =
+                ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>(
+                        "drm");
+        ASSERT_NE(drmFactory, nullptr);
+        cryptoFactory =
+                ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>(
+                        "crypto");
+        ASSERT_NE(cryptoFactory, nullptr);
+    }
+
+    virtual void TearDown() override {}
+
+   protected:
+    sp<IDrmFactory> drmFactory;
+    sp<ICryptoFactory> cryptoFactory;
+};
+
+/**
+ * Ensure the factory supports the clearkey scheme UUID
+ */
+TEST_F(DrmHalClearkeyFactoryTest, ClearKeyPluginSupported) {
+    EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(kClearKeyUUID));
+    EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(kClearKeyUUID));
+}
+
+/**
+ * Ensure the factory doesn't support an invalid scheme UUID
+ */
+TEST_F(DrmHalClearkeyFactoryTest, InvalidPluginNotSupported) {
+    EXPECT_FALSE(drmFactory->isCryptoSchemeSupported(kInvalidUUID));
+    EXPECT_FALSE(cryptoFactory->isCryptoSchemeSupported(kInvalidUUID));
+}
+
+/**
+ * Ensure clearkey drm plugin can be created
+ */
+TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyDrmPlugin) {
+    hidl_string packageName("android.hardware.drm.test");
+    auto res = drmFactory->createPlugin(
+            kClearKeyUUID, packageName,
+            [&](Status status, const sp<IDrmPlugin>& plugin) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure clearkey crypto plugin can be created
+ */
+TEST_F(DrmHalClearkeyFactoryTest, CreateClearKeyCryptoPlugin) {
+    hidl_vec<uint8_t> initVec;
+    auto res = cryptoFactory->createPlugin(
+            kClearKeyUUID, initVec,
+            [&](Status status, const sp<ICryptoPlugin>& plugin) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure invalid drm plugin can't be created
+ */
+TEST_F(DrmHalClearkeyFactoryTest, CreateInvalidDrmPlugin) {
+    hidl_string packageName("android.hardware.drm.test");
+    auto res = drmFactory->createPlugin(
+            kInvalidUUID, packageName,
+            [&](Status status, const sp<IDrmPlugin>& plugin) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                EXPECT_EQ(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure invalid crypto plugin can't be created
+ */
+TEST_F(DrmHalClearkeyFactoryTest, CreateInvalidCryptoPlugin) {
+    hidl_vec<uint8_t> initVec;
+    auto res = cryptoFactory->createPlugin(
+            kInvalidUUID, initVec,
+            [&](Status status, const sp<ICryptoPlugin>& plugin) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                EXPECT_EQ(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+class DrmHalClearkeyPluginTest : public DrmHalClearkeyFactoryTest {
+   public:
+    virtual void SetUp() override {
+        // Create factories
+        DrmHalClearkeyFactoryTest::SetUp();
+
+        ASSERT_NE(drmFactory, nullptr);
+        hidl_string packageName("android.hardware.drm.test");
+        auto res = drmFactory->createPlugin(
+                kClearKeyUUID, packageName,
+                [this](Status status, const sp<IDrmPlugin>& plugin) {
+                    EXPECT_EQ(Status::OK, status);
+                    ASSERT_NE(plugin, nullptr);
+                    drmPlugin = plugin;
+                });
+        ASSERT_OK(res);
+
+        hidl_vec<uint8_t> initVec;
+        res = cryptoFactory->createPlugin(
+                kClearKeyUUID, initVec,
+                [this](Status status, const sp<ICryptoPlugin>& plugin) {
+                    EXPECT_EQ(Status::OK, status);
+                    ASSERT_NE(plugin, nullptr);
+                    cryptoPlugin = plugin;
+                });
+        ASSERT_OK(res);
+    }
+
+    virtual void TearDown() override {}
+
+    SessionId openSession();
+    void closeSession(const SessionId& sessionId);
+    sp<IMemory> getDecryptMemory(size_t size, size_t index);
+
+   protected:
+    sp<IDrmPlugin> drmPlugin;
+    sp<ICryptoPlugin> cryptoPlugin;
+};
+
+/**
+ *  DrmPlugin tests
+ */
+
+/**
+ * Test that the plugin can return a provision request.  Since
+ * the clearkey plugin doesn't support provisioning, it is
+ * expected to return Status::ERROR_DRM_CANNOT_HANDLE.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetProvisionRequest) {
+    hidl_string certificateType;
+    hidl_string certificateAuthority;
+    auto res = drmPlugin->getProvisionRequest(
+            certificateType, certificateAuthority,
+            [&](Status status, const hidl_vec<uint8_t>&, const hidl_string&) {
+                // clearkey doesn't require provisioning
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * The DRM HAL should return BAD_VALUE if an empty provisioning
+ * response is provided.
+ */
+TEST_F(DrmHalClearkeyPluginTest, ProvideEmptyProvisionResponse) {
+    hidl_vec<uint8_t> response;
+    auto res = drmPlugin->provideProvisionResponse(
+            response, [&](Status status, const hidl_vec<uint8_t>&,
+                          const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Helper method to open a session and verify that a non-empty
+ * session ID is returned
+ */
+SessionId DrmHalClearkeyPluginTest::openSession() {
+    SessionId sessionId;
+
+    auto res = drmPlugin->openSession(
+            [&sessionId](Status status, const SessionId& id) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(0u, id.size());
+                sessionId = id;
+            });
+    EXPECT_OK(res);
+    return sessionId;
+}
+
+/**
+ * Helper method to close a session
+ */
+void DrmHalClearkeyPluginTest::closeSession(const SessionId& sessionId) {
+    auto result = drmPlugin->closeSession(sessionId);
+    EXPECT_EQ(Status::OK, result);
+}
+
+/**
+ * Test that a session can be opened and closed
+ */
+TEST_F(DrmHalClearkeyPluginTest, OpenCloseSession) {
+    auto sessionId = openSession();
+    closeSession(sessionId);
+}
+
+/**
+ * Test that attempting to close an invalid (empty) sessionId
+ * is prohibited with the documented error code.
+ */
+TEST_F(DrmHalClearkeyPluginTest, CloseInvalidSession) {
+    SessionId invalidSessionId;
+    Status result = drmPlugin->closeSession(invalidSessionId);
+    EXPECT_EQ(Status::BAD_VALUE, result);
+}
+
+/**
+ * Test that attempting to close a session that is already closed
+ * is prohibited with the documented error code.
+ */
+TEST_F(DrmHalClearkeyPluginTest, CloseClosedSession) {
+    SessionId sessionId = openSession();
+    closeSession(sessionId);
+    Status result = drmPlugin->closeSession(sessionId);
+    EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, result);
+}
+
+/**
+ * A get key request should fail if no sessionId is provided
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetKeyRequestNoSession) {
+    SessionId invalidSessionId;
+    hidl_vec<uint8_t> initData;
+    hidl_string mimeType = "video/mp4";
+    KeyedVector optionalParameters;
+    auto res = drmPlugin->getKeyRequest(
+            invalidSessionId, initData, mimeType, KeyType::STREAMING,
+            optionalParameters,
+            [&](Status status, const hidl_vec<uint8_t>&, KeyRequestType,
+                const hidl_string&) { EXPECT_EQ(Status::BAD_VALUE, status); });
+    EXPECT_OK(res);
+}
+
+/**
+ * The clearkey plugin doesn't support offline key requests.
+ * Test that the plugin returns the expected error code in
+ * this case.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetKeyRequestOfflineKeyTypeNotSupported) {
+    auto sessionId = openSession();
+    hidl_vec<uint8_t> initData;
+    hidl_string mimeType = "video/mp4";
+    KeyedVector optionalParameters;
+
+    auto res = drmPlugin->getKeyRequest(
+            sessionId, initData, mimeType, KeyType::OFFLINE, optionalParameters,
+            [&](Status status, const hidl_vec<uint8_t>&, KeyRequestType,
+                const hidl_string&) {
+                // Clearkey plugin doesn't support offline key type
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+    closeSession(sessionId);
+}
+
+/**
+ * Test that the plugin returns the documented error for the
+ * case of attempting to generate a key request using an
+ * invalid mime type
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetKeyRequestBadMime) {
+    auto sessionId = openSession();
+    hidl_vec<uint8_t> initData;
+    hidl_string mimeType = "video/unknown";
+    KeyedVector optionalParameters;
+    auto res = drmPlugin->getKeyRequest(
+            sessionId, initData, mimeType, KeyType::STREAMING,
+            optionalParameters, [&](Status status, const hidl_vec<uint8_t>&,
+                                    KeyRequestType, const hidl_string&) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+    closeSession(sessionId);
+}
+
+/**
+ * Test that a closed sessionID returns SESSION_NOT_OPENED
+ */
+TEST_F(DrmHalClearkeyPluginTest, ProvideKeyResponseClosedSession) {
+    SessionId session = openSession();
+    closeSession(session);
+
+    hidl_vec<uint8_t> keyResponse = {0x7b, 0x22, 0x6b, 0x65,
+                                     0x79, 0x73, 0x22, 0x3a};
+    auto res = drmPlugin->provideKeyResponse(
+            session, keyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+                EXPECT_EQ(0u, keySetId.size());
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that an empty sessionID returns BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, ProvideKeyResponseInvalidSessionId) {
+    SessionId session;
+
+    hidl_vec<uint8_t> keyResponse = {0x7b, 0x22, 0x6b, 0x65,
+                                     0x79, 0x73, 0x22, 0x3a};
+    auto res = drmPlugin->provideKeyResponse(
+            session, keyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+                EXPECT_EQ(0u, keySetId.size());
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that an empty key response returns BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, ProvideKeyResponseEmptyResponse) {
+    SessionId session = openSession();
+    hidl_vec<uint8_t> emptyResponse;
+    auto res = drmPlugin->provideKeyResponse(
+            session, emptyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+                EXPECT_EQ(0u, keySetId.size());
+            });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+/**
+ * Test that the clearkey plugin doesn't support getting
+ * secure stops.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetSecureStops) {
+    auto res = drmPlugin->getSecureStops(
+            [&](Status status, const hidl_vec<SecureStop>&) {
+                // Clearkey plugin doesn't support secure stops
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that the clearkey plugin returns BAD_VALUE if
+ * an empty ssid is provided.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetSecureStopEmptySSID) {
+    SecureStopId ssid;
+    auto res = drmPlugin->getSecureStop(
+            ssid, [&](Status status, const SecureStop&) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that releasing all secure stops isn't handled by
+ * clearkey.
+ */
+TEST_F(DrmHalClearkeyPluginTest, ReleaseAllSecureStops) {
+    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE,
+              drmPlugin->releaseAllSecureStops());
+}
+
+/**
+ * Test that releasing a specific secure stop with an empty
+ * SSID returns BAD_VALUE.
+ */
+TEST_F(DrmHalClearkeyPluginTest, ReleaseSecureStopEmptySSID) {
+    SecureStopId ssid;
+    Status status = drmPlugin->releaseSecureStop(ssid);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * The following four tests verify that the properties
+ * defined in the MediaDrm API are supported by
+ * the plugin.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetVendorProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "vendor", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ("Google", value);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GetVersionProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "version", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ("1.0", value);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GetDescriptionProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "description", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ("ClearKey CDM", value);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GetAlgorithmsProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "algorithms", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ("", value);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that attempting to read invalid string and byte array
+ * properties returns the documented error code.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GetInvalidStringProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "invalid", [&](Status status, const hidl_string&) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GetByteArrayPropertyNotSupported) {
+    auto res = drmPlugin->getPropertyByteArray(
+            "deviceUniqueId", [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Clearkey doesn't support setting string or byte array properties,
+ * particularly an undefined one.
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetStringPropertyNotSupported) {
+    Status status = drmPlugin->setPropertyString("property", "value");
+    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, SetByteArrayPropertyNotSupported) {
+    hidl_vec<uint8_t> value;
+    Status status = drmPlugin->setPropertyByteArray("property", value);
+    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+}
+
+/**
+ * Clearkey doesn't support setting cipher algorithms, verify it
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetCipherAlgorithmNotSupported) {
+    SessionId session = openSession();
+    hidl_string algorithm = "AES/CBC/NoPadding";
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+    closeSession(session);
+}
+
+/**
+ * Setting an empty algorithm should return BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetCipherEmptyAlgorithm) {
+    SessionId session = openSession();
+    hidl_string algorithm;
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+    closeSession(session);
+}
+
+/**
+ * Setting a cipher algorithm with no session returns BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetCipherAlgorithmNoSession) {
+    SessionId session;
+    hidl_string algorithm = "AES/CBC/NoPadding";
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * Clearkey doesn't support setting mac algorithms, verify it
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetMacAlgorithmNotSupported) {
+    SessionId session = openSession();
+    hidl_string algorithm = "HmacSHA256";
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+    closeSession(session);
+}
+
+/**
+ * Setting an empty algorithm should return BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetMacEmptyAlgorithm) {
+    SessionId session = openSession();
+    hidl_string algorithm;
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+    closeSession(session);
+}
+
+/**
+ * Setting a mac algorithm with no session should return BAD_VALUE
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetMacAlgorithmNoSession) {
+    SessionId session;
+    hidl_string algorithm = "HmacSHA256";
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * The Generic* methods provide general purpose crypto operations
+ * that may be used for applications other than DRM. They leverage
+ * the hardware root of trust and secure key distribution mechanisms
+ * of a DRM system to enable app-specific crypto functionality where
+ * the crypto keys are not exposed outside of the trusted execution
+ * environment.
+ *
+ * Clearkey doesn't support generic encrypt/decrypt/sign/verify.
+ */
+TEST_F(DrmHalClearkeyPluginTest, GenericEncryptNotSupported) {
+    SessionId session = openSession();
+    ;
+    hidl_vec<uint8_t> keyId = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+    hidl_vec<uint8_t> input = {1, 2, 3, 4, 5};
+    hidl_vec<uint8_t> iv = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+    auto res = drmPlugin->encrypt(session, keyId, input, iv,
+                                  [&](Status status, const hidl_vec<uint8_t>&) {
+                                      EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE,
+                                                status);
+                                  });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GenericDecryptNotSupported) {
+    SessionId session = openSession();
+    ;
+    hidl_vec<uint8_t> keyId = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+    hidl_vec<uint8_t> input = {1, 2, 3, 4, 5};
+    hidl_vec<uint8_t> iv = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+    auto res = drmPlugin->decrypt(session, keyId, input, iv,
+                                  [&](Status status, const hidl_vec<uint8_t>&) {
+                                      EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE,
+                                                status);
+                                  });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GenericSignNotSupported) {
+    SessionId session = openSession();
+    ;
+    hidl_vec<uint8_t> keyId = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+    hidl_vec<uint8_t> message = {1, 2, 3, 4, 5};
+    auto res = drmPlugin->sign(session, keyId, message,
+                               [&](Status status, const hidl_vec<uint8_t>&) {
+                                   EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE,
+                                             status);
+                               });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GenericVerifyNotSupported) {
+    SessionId session = openSession();
+    ;
+    hidl_vec<uint8_t> keyId = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+    hidl_vec<uint8_t> message = {1, 2, 3, 4, 5};
+    hidl_vec<uint8_t> signature = {0, 0, 0, 0, 0, 0, 0, 0,
+                                   0, 0, 0, 0, 0, 0, 0, 0};
+    auto res = drmPlugin->verify(
+            session, keyId, message, signature, [&](Status status, bool) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+TEST_F(DrmHalClearkeyPluginTest, GenericSignRSANotSupported) {
+    SessionId session = openSession();
+    hidl_string algorithm = "RSASSA-PSS-SHA1";
+    hidl_vec<uint8_t> message = {1, 2, 3, 4, 5};
+    hidl_vec<uint8_t> wrappedKey = {0, 0, 0, 0, 0, 0, 0, 0,
+                                    0, 0, 0, 0, 0, 0, 0, 0};
+    auto res = drmPlugin->signRSA(session, algorithm, message, wrappedKey,
+                                  [&](Status status, const hidl_vec<uint8_t>&) {
+                                      EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE,
+                                                status);
+                                  });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+/**
+ *  CryptoPlugin tests
+ */
+
+/**
+ * Clearkey doesn't support secure decoder and is expected to
+ * return false.
+ */
+TEST_F(DrmHalClearkeyPluginTest, RequiresSecureDecoder) {
+    EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent("cenc"));
+}
+
+/**
+ * Verify that requiresSecureDecoderComponent handles empty mimetype
+ */
+TEST_F(DrmHalClearkeyPluginTest, RequiresSecureDecoderEmptyMimeType) {
+    EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent(""));
+}
+
+/**
+ * Exercise the NotifyResolution API. There is no observable result,
+ * just call the method for coverage.
+ */
+TEST_F(DrmHalClearkeyPluginTest, NotifyResolution) {
+    cryptoPlugin->notifyResolution(1920, 1080);
+}
+
+/**
+ * getDecryptMemory allocates memory for decryption, then sets it
+ * as a shared buffer base in the crypto hal.  The allocated and
+ * mapped IMemory is returned.
+ *
+ * @param size the size of the memory segment to allocate
+ * @param the index of the memory segment which will be used
+ * to refer to it for decryption.
+ */
+sp<IMemory> DrmHalClearkeyPluginTest::getDecryptMemory(size_t size,
+                                                       size_t index) {
+    sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
+    EXPECT_NE(ashmemAllocator, nullptr);
+
+    hidl_memory hidlMemory;
+    auto res = ashmemAllocator->allocate(
+            size, [&](bool success, const hidl_memory& memory) {
+                EXPECT_EQ(true, success);
+                EXPECT_OK(cryptoPlugin->setSharedBufferBase(memory, index));
+                hidlMemory = memory;
+            });
+    EXPECT_OK(res);
+
+    sp<IMemory> mappedMemory = mapMemory(hidlMemory);
+    EXPECT_OK(cryptoPlugin->setSharedBufferBase(hidlMemory, index));
+    return mappedMemory;
+}
+
+/**
+ * Exercise the setMediaDrmSession method. setMediaDrmSession
+ * is used to associate a drm session with a crypto session.
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetMediaDrmSession) {
+    auto sessionId = openSession();
+    Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+    EXPECT_EQ(Status::OK, status);
+    closeSession(sessionId);
+}
+
+/**
+ * setMediaDrmSession with a closed session id
+ */
+TEST_F(DrmHalClearkeyPluginTest, SetMediaDrmSessionClosedSession) {
+    auto sessionId = openSession();
+    closeSession(sessionId);
+    Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+    EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+}
+
+/**
+ * Decrypt tests
+ */
+
+class DrmHalClearkeyDecryptTest : public DrmHalClearkeyPluginTest {
+   public:
+    void loadKeys(const SessionId& sessionId);
+    void fillRandom(const sp<IMemory>& memory);
+    hidl_array<uint8_t, 16> toHidlArray(const vector<uint8_t>& vec) {
+        EXPECT_EQ(vec.size(), 16u);
+        return hidl_array<uint8_t, 16>(&vec[0]);
+    }
+};
+
+/**
+ * Helper method to load keys for subsequent decrypt tests.
+ * These tests use predetermined key request/response to
+ * avoid requiring a round trip to a license server.
+ */
+void DrmHalClearkeyDecryptTest::loadKeys(const SessionId& sessionId) {
+    hidl_vec<uint8_t> initData = {
+            // BMFF box header (4 bytes size + 'pssh')
+            0x00, 0x00, 0x00, 0x34, 0x70, 0x73, 0x73, 0x68,
+            // full box header (version = 1 flags = 0)
+            0x01, 0x00, 0x00, 0x00,
+            // system id
+            0x10, 0x77, 0xef, 0xec, 0xc0, 0xb2, 0x4d, 0x02, 0xac, 0xe3, 0x3c,
+            0x1e, 0x52, 0xe2, 0xfb, 0x4b,
+            // number of key ids
+            0x00, 0x00, 0x00, 0x01,
+            // key id
+            0x60, 0x06, 0x1e, 0x01, 0x7e, 0x47, 0x7e, 0x87, 0x7e, 0x57, 0xd0,
+            0x0d, 0x1e, 0xd0, 0x0d, 0x1e,
+            // size of data, must be zero
+            0x00, 0x00, 0x00, 0x00};
+
+    hidl_vec<uint8_t> expectedKeyRequest = {
+            0x7b, 0x22, 0x6b, 0x69, 0x64, 0x73, 0x22, 0x3a, 0x5b, 0x22, 0x59,
+            0x41, 0x59, 0x65, 0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2b,
+            0x56, 0x39, 0x41, 0x4e, 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22,
+            0x5d, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x74,
+            0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x22, 0x7d};
+
+    hidl_vec<uint8_t> knownKeyResponse = {
+            0x7b, 0x22, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x3a, 0x5b, 0x7b, 0x22,
+            0x6b, 0x74, 0x79, 0x22, 0x3a, 0x22, 0x6f, 0x63, 0x74, 0x22, 0x2c,
+            0x22, 0x6b, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x59, 0x41, 0x59, 0x65,
+            0x41, 0x58, 0x35, 0x48, 0x66, 0x6f, 0x64, 0x2b, 0x56, 0x39, 0x41,
+            0x4e, 0x48, 0x74, 0x41, 0x4e, 0x48, 0x67, 0x22, 0x2c, 0x22, 0x6b,
+            0x22, 0x3a, 0x22, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x54, 0x65,
+            0x73, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x61, 0x73, 0x65, 0x36, 0x34,
+            0x67, 0x67, 0x67, 0x22, 0x7d, 0x5d, 0x7d, 0x0a};
+
+    hidl_string mimeType = "video/mp4";
+    KeyedVector optionalParameters;
+    auto res = drmPlugin->getKeyRequest(
+            sessionId, initData, mimeType, KeyType::STREAMING,
+            optionalParameters,
+            [&](Status status, const hidl_vec<uint8_t>& request,
+                KeyRequestType requestType, const hidl_string&) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ(KeyRequestType::INITIAL, requestType);
+                EXPECT_EQ(request, expectedKeyRequest);
+            });
+    EXPECT_OK(res);
+
+    res = drmPlugin->provideKeyResponse(
+            sessionId, knownKeyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_EQ(0u, keySetId.size());
+            });
+    EXPECT_OK(res);
+}
+
+void DrmHalClearkeyDecryptTest::fillRandom(const sp<IMemory>& memory) {
+    random_device rd;
+    mt19937 rand(rd());
+    for (size_t i = 0; i < memory->getSize() / sizeof(uint32_t); i++) {
+        auto p = static_cast<uint32_t*>(
+                static_cast<void*>(memory->getPointer()));
+        p[i] = rand();
+    }
+}
+
+/**
+ * Positive decrypt test.  "Decrypt" a single clear
+ * segment.  Verify data matches.
+ */
+TEST_F(DrmHalClearkeyDecryptTest, ClearSegmentTest) {
+    const size_t kSegmentSize = 1024;
+    const size_t kSegmentIndex = 0;
+    const vector<uint8_t> keyId = {0x60, 0x06, 0x1e, 0x01, 0x7e, 0x47,
+                                   0x7e, 0x87, 0x7e, 0x57, 0xd0, 0x0d,
+                                   0x1e, 0xd0, 0x0d, 0x1e};
+    uint8_t iv[16] = {0};
+
+    sp<IMemory> sharedMemory =
+            getDecryptMemory(kSegmentSize * 2, kSegmentIndex);
+
+    SharedBuffer sourceBuffer = {
+            .bufferId = kSegmentIndex, .offset = 0, .size = kSegmentSize};
+    fillRandom(sharedMemory);
+
+    DestinationBuffer destBuffer = {.type = BufferType::SHARED_MEMORY,
+                                    {.bufferId = kSegmentIndex,
+                                     .offset = kSegmentSize,
+                                     .size = kSegmentSize},
+                                    .secureMemory = nullptr};
+
+    Pattern noPattern = {0, 0};
+    vector<SubSample> subSamples = {{.numBytesOfClearData = kSegmentSize,
+                                     .numBytesOfEncryptedData = 0}};
+    uint64_t offset = 0;
+
+    auto sessionId = openSession();
+    loadKeys(sessionId);
+
+    Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+    EXPECT_EQ(Status::OK, status);
+
+    const bool kNotSecure = false;
+    auto res = cryptoPlugin->decrypt(
+            kNotSecure, toHidlArray(keyId), iv, Mode::UNENCRYPTED, noPattern,
+            subSamples, sourceBuffer, offset, destBuffer,
+            [&](Status status, uint32_t bytesWritten, string detailedError) {
+                EXPECT_EQ(Status::OK, status) << "Failure in decryption:"
+                                              << detailedError;
+                EXPECT_EQ(bytesWritten, kSegmentSize);
+            });
+    EXPECT_OK(res);
+
+    uint8_t* base = static_cast<uint8_t*>(
+            static_cast<void*>(sharedMemory->getPointer()));
+
+    EXPECT_EQ(0, memcmp(static_cast<void*>(base),
+                        static_cast<void*>(base + kSegmentSize), kSegmentSize))
+            << "decrypt data mismatch";
+    closeSession(sessionId);
+}
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_module_api.h b/drm/1.0/vts/functional/drm_hal_vendor_module_api.h
new file mode 100644
index 0000000..db19719
--- /dev/null
+++ b/drm/1.0/vts/functional/drm_hal_vendor_module_api.h
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2017 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 DRM_HAL_VENDOR_MODULE_API_H
+#define DRM_HAL_VENDOR_MODULE_API_H
+
+#include <stdint.h>
+#include <map>
+#include <string>
+#include <vector>
+
+/**
+ * The DRM and Crypto HALs interact with vendor-provided HAL implementations
+ * that have DRM-specific capabilities. Since the VTS tests cannot contain
+ * DRM-specific functionality, supporting modules are required to enable VTS
+ * to validate HAL implementations in a generic way.  If the vendor-specific
+ * VTS module is not provided for a given drm HAL implementation, only very
+ * small subset of functionality can be verified.
+ *
+ * As an example, a DRM HAL implementation interacts with a DRM-specific
+ * license server to obtain licenses for decrypting content.  The DRM HAL
+ * implementation generates a key request message, delivers it to the server
+ * and receives a key response message which is then loaded into the HAL. Once
+ * the keys are loaded, the Crypto HAL decryption functionality and performance
+ * and other associated APIs can be tested by the common VTS test suite.
+ *
+ * Vendor-specific VTS modules are shared libraries used by the DRM VTS test.
+ * They provide a set of functions to support VTS testing of the DRM HAL module.
+ *
+ * The modules are placed in a common location on the file system. The VTS test
+ * scans through all vendor-provided support libraries and runs the VTS test
+ * suite on each library that is found.
+ *
+ * The vendor-specific module exposes an extern “C” vendorModuleFactory()
+ * function that returns a DrmHalVTSVendorModule instance. DrmHalVTSVendorModule
+ * instances are versioned, where each version is represented by subclass of
+ * DrmHalVTSVendorModule that corresponds to the API version. For example, a
+ * vendor-specific module that implements version 1 of the API would return a
+ * DrmHalVTSVendorModule_V1 from the vendorModuleFactory() function.
+ */
+
+class DrmHalVTSVendorModule;
+
+extern "C" {
+/**
+ * The factory method for creating DrmHalVTSVendorModule instances. The returned
+ * instance will be a subclass of DrmHalVTSVendorModule that corresponds to the
+ * supported API version.
+ */
+DrmHalVTSVendorModule* vendorModuleFactory();
+};
+
+class DrmHalVTSVendorModule {
+   public:
+    DrmHalVTSVendorModule() {}
+    virtual ~DrmHalVTSVendorModule() {}
+
+    /**
+     * Return the vendor-specific module API version. The version is an integer
+     * value with initial version 1. The API version indicates which subclass
+     * version DrmHalVTSVendorModule this instance is.
+     */
+    virtual uint32_t getAPIVersion() = 0;
+
+    /**
+     * Return the UUID for the DRM HAL implementation. Protection System
+     * Specific
+     * UUID (see http://dashif.org/identifiers/protection/)
+     */
+    virtual std::vector<uint8_t> getUUID() = 0;
+
+    /**
+     * Return the service name for the DRM HAL implementation. If the hal is a
+     * legacy
+     * drm plugin, i.e. not running as a HIDL service, return the empty string.
+     */
+    virtual std::string getServiceName() = 0;
+
+   private:
+    DrmHalVTSVendorModule(const DrmHalVTSVendorModule&) = delete;
+    void operator=(const DrmHalVTSVendorModule&) = delete;
+};
+
+/**
+ * API Version 1.  This is the baseline version that supports a minimal set
+ * of VTS tests.
+ */
+class DrmHalVTSVendorModule_V1 : public DrmHalVTSVendorModule {
+   public:
+    DrmHalVTSVendorModule_V1() {}
+    virtual ~DrmHalVTSVendorModule_V1() {}
+
+    virtual uint32_t getAPIVersion() { return 1; }
+
+    /**
+     * Handle a provisioning request. This function will be called if the HAL
+     * module's getProvisionRequest returns a provision request.  The vendor
+     * module should process the provisioning request, either by sending it
+     * to a provisioning server, or generating a mock response.  The resulting
+     * provisioning response is returned to the VTS test.
+     *
+     * @param provisioningRequest the provisioning request recieved from
+     * the DRM HAL
+     * @param url the default url the HAL implementation provided with the
+     * provisioning request
+     * @return the generated provisioning response
+     */
+    virtual std::vector<uint8_t> handleProvisioningRequest(
+            const std::vector<uint8_t>& provisioningRequest,
+            const std::string& url) = 0;
+
+    /**
+     * Content configuration specifies content-specific parameters associated
+     * with a key request/response transaction. It allows the VTS test to
+     * request keys and use them to perform decryption.
+     */
+    struct ContentConfiguration {
+        /**
+         * Assign a name for this configuration that will be referred to
+         * in log messages.
+         */
+        const std::string name;
+
+        /**
+         * Server to use when requesting a key response.  This url will be
+         * passed as a parameter to the vendor vts module along with the
+         * key request to perform the key request transaction.
+         */
+        const std::string serverUrl;
+
+        /**
+         * Initialization data provided to getKeyRequest, e.g. PSSH for CENC
+         * content
+         */
+        const std::vector<uint8_t> initData;
+
+        /**
+         *  Mime type provided to getKeyRequest, e.g. "video/mp4", or "cenc"
+         */
+        const std::string mimeType;
+
+        /**
+         * Optional parameters to be associated with the key request
+         */
+        const std::map<std::string, std::string> optionalParameters;
+
+        /**
+         * The keys that will be available once the keys are loaded
+         */
+        struct Key {
+            /**
+             * Indicate if the key content is configured to require secure
+             * buffers,
+             * where the output buffers are protected and cannot be accessed.
+             * A vendor module should provide some content configurations where
+             * isSecure is false, to allow decrypt result verification tests to
+             * be
+             * run.
+             */
+            bool isSecure;
+
+            /**
+             * A key ID identifies a key to use for decryption
+             */
+            const std::vector<uint8_t> keyId;
+
+            /**
+             * The key value is provided to generate expected values for
+             * validating
+             * decryption.  If isSecure is false, no key value is required.
+             */
+            const std::vector<uint8_t> keyValue;
+        };
+        std::vector<Key> keys;
+    };
+
+    /**
+     * Return a list of content configurations that can be exercised by the
+     * VTS test.
+     */
+    virtual std::vector<ContentConfiguration> getContentConfigurations() = 0;
+
+    /**
+     * Handle a key request. This function will be called if the HAL
+     * module's getKeyRequest returns a key request.  The vendor
+     * module should process the key request, either by sending it
+     * to a license server, or by generating a mock response.  The resulting
+     * key response is returned to the VTS test.
+     *
+     * @param keyRequest the key request recieved from the DRM HAL
+     * @param serverUrl the url of the key server that was supplied
+     * by the ContentConfiguration
+     * @return the generated key response
+     */
+    virtual std::vector<uint8_t> handleKeyRequest(
+            const std::vector<uint8_t>& keyRequest,
+            const std::string& serverUrl) = 0;
+};
+
+#endif  // DRM_HAL_VENDOR_MODULE_API_H
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
new file mode 100644
index 0000000..dcfee4e
--- /dev/null
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -0,0 +1,980 @@
+/*
+ * Copyright (C) 2017 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 "drm_hal_vendor_test@1.0"
+
+#include <android-base/logging.h>
+#include <android/hardware/drm/1.0/ICryptoFactory.h>
+#include <android/hardware/drm/1.0/ICryptoPlugin.h>
+#include <android/hardware/drm/1.0/IDrmFactory.h>
+#include <android/hardware/drm/1.0/IDrmPlugin.h>
+#include <android/hardware/drm/1.0/types.h>
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <gtest/gtest.h>
+#include <hidlmemory/mapping.h>
+#include <memory>
+#include <random>
+
+#include "VtsHalHidlTargetTestBase.h"
+#include "drm_hal_vendor_module_api.h"
+#include "vendor_modules.h"
+
+using ::android::hardware::drm::V1_0::BufferType;
+using ::android::hardware::drm::V1_0::DestinationBuffer;
+using ::android::hardware::drm::V1_0::ICryptoFactory;
+using ::android::hardware::drm::V1_0::ICryptoPlugin;
+using ::android::hardware::drm::V1_0::IDrmFactory;
+using ::android::hardware::drm::V1_0::IDrmPlugin;
+using ::android::hardware::drm::V1_0::KeyedVector;
+using ::android::hardware::drm::V1_0::KeyValue;
+using ::android::hardware::drm::V1_0::KeyRequestType;
+using ::android::hardware::drm::V1_0::KeyType;
+using ::android::hardware::drm::V1_0::Mode;
+using ::android::hardware::drm::V1_0::Pattern;
+using ::android::hardware::drm::V1_0::SecureStop;
+using ::android::hardware::drm::V1_0::SecureStopId;
+using ::android::hardware::drm::V1_0::SessionId;
+using ::android::hardware::drm::V1_0::SharedBuffer;
+using ::android::hardware::drm::V1_0::Status;
+using ::android::hardware::drm::V1_0::SubSample;
+
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hidl::allocator::V1_0::IAllocator;
+using ::android::hidl::memory::V1_0::IMemory;
+using ::android::sp;
+
+using std::string;
+using std::unique_ptr;
+using std::random_device;
+using std::map;
+using std::mt19937;
+using std::vector;
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+
+static const uint8_t kInvalidUUID[16] = {
+        0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
+        0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
+};
+
+static drm_vts::VendorModules* gVendorModules = nullptr;
+
+class DrmHalVendorFactoryTest : public testing::TestWithParam<std::string> {
+   public:
+    DrmHalVendorFactoryTest()
+        : vendorModule(gVendorModules ? static_cast<DrmHalVTSVendorModule_V1*>(
+                                                gVendorModules->getVendorModule(
+                                                        GetParam()))
+                                      : nullptr) {}
+
+    virtual ~DrmHalVendorFactoryTest() {}
+
+    virtual void SetUp() {
+        const ::testing::TestInfo* const test_info =
+                ::testing::UnitTest::GetInstance()->current_test_info();
+        ALOGD("Running test %s.%s from vendor module %s",
+              test_info->test_case_name(), test_info->name(),
+              GetParam().c_str());
+
+        ASSERT_NE(vendorModule, nullptr);
+        string name = vendorModule->getServiceName();
+        drmFactory =
+                ::testing::VtsHalHidlTargetTestBase::getService<IDrmFactory>(
+                        name != "default" ? name : "drm");
+        ASSERT_NE(drmFactory, nullptr);
+        cryptoFactory =
+                ::testing::VtsHalHidlTargetTestBase::getService<ICryptoFactory>(
+                        name != "default" ? name : "crypto");
+        ASSERT_NE(cryptoFactory, nullptr);
+    }
+
+    virtual void TearDown() override {}
+
+   protected:
+    hidl_array<uint8_t, 16> getVendorUUID() {
+        vector<uint8_t> uuid = vendorModule->getUUID();
+        return hidl_array<uint8_t, 16>(&uuid[0]);
+    }
+
+    sp<IDrmFactory> drmFactory;
+    sp<ICryptoFactory> cryptoFactory;
+    unique_ptr<DrmHalVTSVendorModule_V1> vendorModule;
+};
+
+/**
+ * Ensure the factory supports its scheme UUID
+ */
+TEST_P(DrmHalVendorFactoryTest, VendorPluginSupported) {
+    EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(getVendorUUID()));
+    EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(getVendorUUID()));
+}
+
+/**
+ * Ensure the factory doesn't support an invalid scheme UUID
+ */
+TEST_P(DrmHalVendorFactoryTest, InvalidPluginNotSupported) {
+    EXPECT_FALSE(drmFactory->isCryptoSchemeSupported(kInvalidUUID));
+    EXPECT_FALSE(cryptoFactory->isCryptoSchemeSupported(kInvalidUUID));
+}
+
+/**
+ * Ensure vendor drm plugin can be created
+ */
+TEST_P(DrmHalVendorFactoryTest, CreateVendorDrmPlugin) {
+    hidl_string packageName("android.hardware.drm.test");
+    auto res = drmFactory->createPlugin(
+            getVendorUUID(), packageName,
+            [&](Status status, const sp<IDrmPlugin>& plugin) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure vendor crypto plugin can be created
+ */
+TEST_P(DrmHalVendorFactoryTest, CreateVendorCryptoPlugin) {
+    hidl_vec<uint8_t> initVec;
+    auto res = cryptoFactory->createPlugin(
+            getVendorUUID(), initVec,
+            [&](Status status, const sp<ICryptoPlugin>& plugin) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure invalid drm plugin can't be created
+ */
+TEST_P(DrmHalVendorFactoryTest, CreateInvalidDrmPlugin) {
+    hidl_string packageName("android.hardware.drm.test");
+    auto res = drmFactory->createPlugin(
+            kInvalidUUID, packageName,
+            [&](Status status, const sp<IDrmPlugin>& plugin) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                EXPECT_EQ(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Ensure invalid crypto plugin can't be created
+ */
+TEST_P(DrmHalVendorFactoryTest, CreateInvalidCryptoPlugin) {
+    hidl_vec<uint8_t> initVec;
+    auto res = cryptoFactory->createPlugin(
+            kInvalidUUID, initVec,
+            [&](Status status, const sp<ICryptoPlugin>& plugin) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                EXPECT_EQ(plugin, nullptr);
+            });
+    EXPECT_OK(res);
+}
+
+class DrmHalVendorPluginTest : public DrmHalVendorFactoryTest {
+   public:
+    virtual ~DrmHalVendorPluginTest() {}
+    virtual void SetUp() override {
+        // Create factories
+        DrmHalVendorFactoryTest::SetUp();
+
+        hidl_string packageName("android.hardware.drm.test");
+        auto res = drmFactory->createPlugin(
+                getVendorUUID(), packageName,
+                [this](Status status, const sp<IDrmPlugin>& plugin) {
+                    EXPECT_EQ(Status::OK, status);
+                    ASSERT_NE(plugin, nullptr);
+                    drmPlugin = plugin;
+                });
+        ASSERT_OK(res);
+
+        hidl_vec<uint8_t> initVec;
+        res = cryptoFactory->createPlugin(
+                getVendorUUID(), initVec,
+                [this](Status status, const sp<ICryptoPlugin>& plugin) {
+                    EXPECT_EQ(Status::OK, status);
+                    ASSERT_NE(plugin, nullptr);
+                    cryptoPlugin = plugin;
+                });
+        ASSERT_OK(res);
+    }
+
+    virtual void TearDown() override {}
+
+    SessionId openSession();
+    void closeSession(const SessionId& sessionId);
+    sp<IMemory> getDecryptMemory(size_t size, size_t index);
+
+   protected:
+    sp<IDrmPlugin> drmPlugin;
+    sp<ICryptoPlugin> cryptoPlugin;
+};
+
+/**
+ *  DrmPlugin tests
+ */
+
+/**
+ * Test that a DRM plugin can handle provisioning.  While
+ * it is not required that a DRM scheme require provisioning,
+ * it should at least return appropriate status values. If
+ * a provisioning request is returned, it is passed to the
+ * vendor module which should provide a provisioning response
+ * that is delivered back to the HAL.
+ */
+
+TEST_P(DrmHalVendorPluginTest, DoProvisioning) {
+    hidl_string certificateType;
+    hidl_string certificateAuthority;
+    hidl_vec<uint8_t> provisionRequest;
+    hidl_string defaultUrl;
+    auto res = drmPlugin->getProvisionRequest(
+            certificateType, certificateAuthority,
+            [&](Status status, const hidl_vec<uint8_t>& request,
+                const hidl_string& url) {
+                if (status == Status::OK) {
+                    EXPECT_NE(request.size(), 0u);
+                    provisionRequest = request;
+                    defaultUrl = url;
+                } else if (status == Status::ERROR_DRM_CANNOT_HANDLE) {
+                    EXPECT_EQ(0u, request.size());
+                }
+            });
+    EXPECT_OK(res);
+
+    if (provisionRequest.size() > 0) {
+        vector<uint8_t> response = vendorModule->handleProvisioningRequest(
+                provisionRequest, defaultUrl);
+        ASSERT_NE(0u, response.size());
+
+        auto res = drmPlugin->provideProvisionResponse(
+                response, [&](Status status, const hidl_vec<uint8_t>&,
+                              const hidl_vec<uint8_t>&) {
+                    EXPECT_EQ(Status::OK, status);
+                });
+        EXPECT_OK(res);
+    }
+}
+
+/**
+ * The DRM HAL should return BAD_VALUE if an empty provisioning
+ * response is provided.
+ */
+TEST_P(DrmHalVendorPluginTest, ProvideEmptyProvisionResponse) {
+    hidl_vec<uint8_t> response;
+    auto res = drmPlugin->provideProvisionResponse(
+            response, [&](Status status, const hidl_vec<uint8_t>&,
+                          const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Helper method to open a session and verify that a non-empty
+ * session ID is returned
+ */
+SessionId DrmHalVendorPluginTest::openSession() {
+    SessionId sessionId;
+
+    auto res = drmPlugin->openSession([&](Status status, const SessionId& id) {
+        EXPECT_EQ(Status::OK, status);
+        EXPECT_NE(id.size(), 0u);
+        sessionId = id;
+    });
+    EXPECT_OK(res);
+    return sessionId;
+}
+
+/**
+ * Helper method to close a session
+ */
+void DrmHalVendorPluginTest::closeSession(const SessionId& sessionId) {
+    Status status = drmPlugin->closeSession(sessionId);
+    EXPECT_EQ(Status::OK, status);
+}
+
+/**
+ * Test that a session can be opened and closed
+ */
+TEST_P(DrmHalVendorPluginTest, OpenCloseSession) {
+    auto sessionId = openSession();
+    closeSession(sessionId);
+}
+
+/**
+ * Test that attempting to close an invalid (empty) sessionId
+ * is prohibited with the documented error code.
+ */
+TEST_P(DrmHalVendorPluginTest, CloseInvalidSession) {
+    SessionId invalidSessionId;
+    Status status = drmPlugin->closeSession(invalidSessionId);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * Test that attempting to close a valid session twice
+ * is prohibited with the documented error code.
+ */
+TEST_P(DrmHalVendorPluginTest, CloseClosedSession) {
+    auto sessionId = openSession();
+    closeSession(sessionId);
+    Status status = drmPlugin->closeSession(sessionId);
+    EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+}
+
+/**
+ * A get key request should fail if no sessionId is provided
+ */
+TEST_P(DrmHalVendorPluginTest, GetKeyRequestNoSession) {
+    SessionId invalidSessionId;
+    hidl_vec<uint8_t> initData;
+    hidl_string mimeType = "video/mp4";
+    KeyedVector optionalParameters;
+    auto res = drmPlugin->getKeyRequest(
+            invalidSessionId, initData, mimeType, KeyType::STREAMING,
+            optionalParameters,
+            [&](Status status, const hidl_vec<uint8_t>&, KeyRequestType,
+                const hidl_string&) { EXPECT_EQ(Status::BAD_VALUE, status); });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that an empty sessionID returns BAD_VALUE
+ */
+TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptySessionId) {
+    SessionId session;
+
+    hidl_vec<uint8_t> keyResponse = {0x7b, 0x22, 0x6b, 0x65,
+                                     0x79, 0x73, 0x22, 0x3a};
+    auto res = drmPlugin->provideKeyResponse(
+            session, keyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+                EXPECT_EQ(keySetId.size(), 0u);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that an empty key response returns BAD_VALUE
+ */
+TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptyResponse) {
+    SessionId session = openSession();
+    hidl_vec<uint8_t> emptyResponse;
+    auto res = drmPlugin->provideKeyResponse(
+            session, emptyResponse,
+            [&](Status status, const hidl_vec<uint8_t>& keySetId) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+                EXPECT_EQ(keySetId.size(), 0u);
+            });
+    EXPECT_OK(res);
+    closeSession(session);
+}
+
+/**
+ * Test that the plugin either doesn't support getting
+ * secure stops, or has no secure stops available after
+ * clearing them.
+ */
+TEST_P(DrmHalVendorPluginTest, GetSecureStops) {
+    // There may be secure stops, depending on if there were keys
+    // loaded and unloaded previously. Clear them to get to a known
+    // state, then make sure there are none.
+    auto res = drmPlugin->getSecureStops(
+            [&](Status status, const hidl_vec<SecureStop>&) {
+                if (status != Status::OK) {
+                    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                }
+            });
+    EXPECT_OK(res);
+
+    res = drmPlugin->getSecureStops(
+            [&](Status status, const hidl_vec<SecureStop>& secureStops) {
+                if (status == Status::OK) {
+                    EXPECT_EQ(secureStops.size(), 0u);
+                } else {
+                    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                }
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that the clearkey plugin returns BAD_VALUE if
+ * an empty ssid is provided.
+ */
+TEST_P(DrmHalVendorPluginTest, GetSecureStopEmptySSID) {
+    SecureStopId ssid;
+    auto res = drmPlugin->getSecureStop(
+            ssid, [&](Status status, const SecureStop&) {
+                EXPECT_EQ(Status::BAD_VALUE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that releasing all secure stops either isn't supported
+ * or is completed successfully
+ */
+TEST_P(DrmHalVendorPluginTest, ReleaseAllSecureStops) {
+    Status status = drmPlugin->releaseAllSecureStops();
+    EXPECT_TRUE(status == Status::OK ||
+                status == Status::ERROR_DRM_CANNOT_HANDLE);
+}
+
+/**
+ * Releasing a secure stop without first getting one and sending it to the
+ * server to get a valid SSID should return ERROR_DRM_INVALID_STATE.
+ * This is an optional API so it can also return CANNOT_HANDLE.
+ */
+TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopSequenceError) {
+    SecureStopId ssid = {1, 2, 3, 4};
+    Status status = drmPlugin->releaseSecureStop(ssid);
+    EXPECT_TRUE(status == Status::ERROR_DRM_INVALID_STATE ||
+                status == Status::ERROR_DRM_CANNOT_HANDLE);
+}
+
+/**
+ * Test that releasing a specific secure stop with an empty ssid
+ * return BAD_VALUE. This is an optional API so it can also return
+ * CANNOT_HANDLE.
+ */
+TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopEmptySSID) {
+    SecureStopId ssid;
+    Status status = drmPlugin->releaseSecureStop(ssid);
+    EXPECT_TRUE(status == Status::BAD_VALUE ||
+                status == Status::ERROR_DRM_CANNOT_HANDLE);
+}
+
+/**
+ * The following five tests verify that the properties
+ * defined in the MediaDrm API are supported by
+ * the plugin.
+ */
+TEST_P(DrmHalVendorPluginTest, GetVendorProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "vendor", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(value.size(), 0u);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GetVersionProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "version", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(value.size(), 0u);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GetDescriptionProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "description", [&](Status status, const hidl_string& value) {
+                EXPECT_EQ(Status::OK, status);
+                EXPECT_NE(value.size(), 0u);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GetAlgorithmsProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "algorithms", [&](Status status, const hidl_string& value) {
+                if (status == Status::OK) {
+                    EXPECT_NE(value.size(), 0u);
+                } else {
+                    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                }
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GetPropertyUniqueDeviceID) {
+    auto res = drmPlugin->getPropertyByteArray(
+            "deviceUniqueId",
+            [&](Status status, const hidl_vec<uint8_t>& value) {
+                if (status == Status::OK) {
+                    EXPECT_NE(value.size(), 0u);
+                } else {
+                    EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+                }
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that attempting to read invalid string and byte array
+ * properties returns the documented error code.
+ */
+TEST_P(DrmHalVendorPluginTest, GetInvalidStringProperty) {
+    auto res = drmPlugin->getPropertyString(
+            "invalid", [&](Status status, const hidl_string&) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GetInvalidByteArrayProperty) {
+    auto res = drmPlugin->getPropertyByteArray(
+            "invalid", [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
+            });
+    EXPECT_OK(res);
+}
+
+/**
+ * Test that setting invalid string and byte array properties returns
+ * the expected status value.
+ */
+TEST_P(DrmHalVendorPluginTest, SetStringPropertyNotSupported) {
+    EXPECT_EQ(drmPlugin->setPropertyString("awefijaeflijwef", "value"),
+              Status::ERROR_DRM_CANNOT_HANDLE);
+}
+
+TEST_P(DrmHalVendorPluginTest, SetByteArrayPropertyNotSupported) {
+    hidl_vec<uint8_t> value;
+    EXPECT_EQ(drmPlugin->setPropertyByteArray("awefijaeflijwef", value),
+              Status::ERROR_DRM_CANNOT_HANDLE);
+}
+
+/**
+ * Test that setting an invalid cipher algorithm returns
+ * the expected status value.
+ */
+TEST_P(DrmHalVendorPluginTest, SetCipherInvalidAlgorithm) {
+    SessionId session = openSession();
+    hidl_string algorithm;
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+    closeSession(session);
+}
+
+/**
+ * Test that setting a cipher algorithm with no session returns
+ * the expected status value.
+ */
+TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithmNoSession) {
+    SessionId session;
+    hidl_string algorithm = "AES/CBC/NoPadding";
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * Test that setting a valid cipher algorithm returns
+ * the expected status value. It is not required that all
+ * vendor modules support this algorithm, but they must
+ * either accept it or return ERROR_DRM_CANNOT_HANDLE
+ */
+TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithm) {
+    SessionId session = openSession();
+    ;
+    hidl_string algorithm = "AES/CBC/NoPadding";
+    Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
+    EXPECT_TRUE(status == Status::OK ||
+                status == Status::ERROR_DRM_CANNOT_HANDLE);
+    closeSession(session);
+}
+
+/**
+ * Test that setting an invalid mac algorithm returns
+ * the expected status value.
+ */
+TEST_P(DrmHalVendorPluginTest, SetMacInvalidAlgorithm) {
+    SessionId session = openSession();
+    hidl_string algorithm;
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+    closeSession(session);
+}
+
+/**
+ * Test that setting a mac algorithm with no session returns
+ * the expected status value.
+ */
+TEST_P(DrmHalVendorPluginTest, SetMacNullAlgorithmNoSession) {
+    SessionId session;
+    hidl_string algorithm = "HmacSHA256";
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_EQ(Status::BAD_VALUE, status);
+}
+
+/**
+ * Test that setting a valid mac algorithm returns
+ * the expected status value. It is not required that all
+ * vendor modules support this algorithm, but they must
+ * either accept it or return ERROR_DRM_CANNOT_HANDLE
+ */
+TEST_P(DrmHalVendorPluginTest, SetMacAlgorithm) {
+    SessionId session = openSession();
+    hidl_string algorithm = "HmacSHA256";
+    Status status = drmPlugin->setMacAlgorithm(session, algorithm);
+    EXPECT_TRUE(status == Status::OK ||
+                status == Status::ERROR_DRM_CANNOT_HANDLE);
+    closeSession(session);
+}
+
+/**
+ * The Generic* methods provide general purpose crypto operations
+ * that may be used for applications other than DRM. They leverage
+ * the hardware root of trust and secure key distribution mechanisms
+ * of a DRM system to enable app-specific crypto functionality where
+ * the crypto keys are not exposed outside of the trusted execution
+ * environment.
+ *
+ * Generic encrypt/decrypt/sign/verify should fail on invalid
+ * inputs, e.g. empty sessionId
+ */
+TEST_P(DrmHalVendorPluginTest, GenericEncryptNoSession) {
+    SessionId session;
+    hidl_vec<uint8_t> keyId, input, iv;
+    auto res = drmPlugin->encrypt(
+            session, keyId, input, iv,
+            [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GenericDecryptNoSession) {
+    SessionId session;
+    hidl_vec<uint8_t> keyId, input, iv;
+    auto res = drmPlugin->decrypt(
+            session, keyId, input, iv,
+            [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GenericSignNoSession) {
+    SessionId session;
+    hidl_vec<uint8_t> keyId, message;
+    auto res = drmPlugin->sign(
+            session, keyId, message,
+            [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GenericVerifyNoSession) {
+    SessionId session;
+    hidl_vec<uint8_t> keyId, message, signature;
+    auto res = drmPlugin->verify(
+            session, keyId, message, signature, [&](Status status, bool) {
+                EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+            });
+    EXPECT_OK(res);
+}
+
+TEST_P(DrmHalVendorPluginTest, GenericSignRSANoSession) {
+    SessionId session;
+    hidl_string algorithm;
+    hidl_vec<uint8_t> message, wrappedKey;
+    auto res = drmPlugin->signRSA(session, algorithm, message, wrappedKey,
+                                  [&](Status status, const hidl_vec<uint8_t>&) {
+                                      EXPECT_EQ(Status::BAD_VALUE, status);
+                                  });
+    EXPECT_OK(res);
+}
+
+/**
+ * Exercise the requiresSecureDecoderComponent method. Additional tests
+ * will verify positive cases with specific vendor content configurations.
+ * Below we just test the negative cases.
+ */
+
+/**
+ * Verify that requiresSecureDecoderComponent handles empty mimetype.
+ */
+TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderEmptyMimeType) {
+    EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent(""));
+}
+
+/**
+ * Verify that requiresSecureDecoderComponent handles invalid mimetype.
+ */
+TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
+    EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent("bad"));
+}
+
+/**
+ *  CryptoPlugin tests
+ */
+
+/**
+ * Exercise the NotifyResolution API. There is no observable result,
+ * just call the method for coverage.
+ */
+TEST_P(DrmHalVendorPluginTest, NotifyResolution) {
+    cryptoPlugin->notifyResolution(1920, 1080);
+}
+
+/**
+ * getDecryptMemory allocates memory for decryption, then sets it
+ * as a shared buffer base in the crypto hal.  The allocated and
+ * mapped IMemory is returned.
+ *
+ * @param size the size of the memory segment to allocate
+ * @param the index of the memory segment which will be used
+ * to refer to it for decryption.
+ */
+sp<IMemory> DrmHalVendorPluginTest::getDecryptMemory(size_t size,
+                                                     size_t index) {
+    sp<IAllocator> ashmemAllocator = IAllocator::getService("ashmem");
+    EXPECT_NE(ashmemAllocator, nullptr);
+
+    hidl_memory hidlMemory;
+    auto res = ashmemAllocator->allocate(
+            size, [&](bool success, const hidl_memory& memory) {
+                EXPECT_EQ(success, true);
+                EXPECT_EQ(memory.size(), size);
+                hidlMemory = memory;
+            });
+
+    EXPECT_OK(res);
+
+    sp<IMemory> mappedMemory = mapMemory(hidlMemory);
+    EXPECT_NE(mappedMemory, nullptr);
+    res = cryptoPlugin->setSharedBufferBase(hidlMemory, index);
+    EXPECT_OK(res);
+    return mappedMemory;
+}
+
+/**
+ * Exercise the setMediaDrmSession method. setMediaDrmSession
+ * is used to associate a drm session with a crypto session.
+ */
+TEST_P(DrmHalVendorPluginTest, SetMediaDrmSession) {
+    auto sessionId = openSession();
+    Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+    EXPECT_EQ(Status::OK, status);
+    closeSession(sessionId);
+}
+
+/**
+ * setMediaDrmSession with a closed session id
+ */
+TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionClosedSession) {
+    auto sessionId = openSession();
+    closeSession(sessionId);
+    Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+    EXPECT_EQ(Status::ERROR_DRM_SESSION_NOT_OPENED, status);
+}
+
+/**
+ * Decrypt tests
+ */
+
+class DrmHalVendorDecryptTest : public DrmHalVendorPluginTest {
+   public:
+    DrmHalVendorDecryptTest() = default;
+    virtual ~DrmHalVendorDecryptTest() {}
+
+   protected:
+    void loadKeys(const SessionId& sessionId,
+                  const DrmHalVTSVendorModule_V1::ContentConfiguration&
+                          configuration);
+    void fillRandom(const sp<IMemory>& memory);
+    KeyedVector toHidlKeyedVector(const map<string, string>& params);
+    hidl_array<uint8_t, 16> toHidlArray(const vector<uint8_t>& vec) {
+        EXPECT_EQ(vec.size(), 16u);
+        return hidl_array<uint8_t, 16>(&vec[0]);
+    }
+};
+
+KeyedVector DrmHalVendorDecryptTest::toHidlKeyedVector(
+        const map<string, string>& params) {
+    std::vector<KeyValue> stdKeyedVector;
+    for (auto it = params.begin(); it != params.end(); ++it) {
+        KeyValue keyValue;
+        keyValue.key = it->first;
+        keyValue.value = it->second;
+        stdKeyedVector.push_back(keyValue);
+    }
+    return KeyedVector(stdKeyedVector);
+}
+
+/**
+ * Helper method to load keys for subsequent decrypt tests.
+ * These tests use predetermined key request/response to
+ * avoid requiring a round trip to a license server.
+ */
+void DrmHalVendorDecryptTest::loadKeys(
+        const SessionId& sessionId,
+        const DrmHalVTSVendorModule_V1::ContentConfiguration& configuration) {
+    hidl_vec<uint8_t> keyRequest;
+    auto res = drmPlugin->getKeyRequest(
+            sessionId, configuration.initData, configuration.mimeType,
+            KeyType::STREAMING,
+            toHidlKeyedVector(configuration.optionalParameters),
+            [&](Status status, const hidl_vec<uint8_t>& request,
+                KeyRequestType type, const hidl_string&) {
+                EXPECT_EQ(Status::OK, status)
+                        << "Failed to get "
+                           "key request for configuration "
+                        << configuration.name;
+                EXPECT_EQ(type, KeyRequestType::INITIAL);
+                EXPECT_NE(request.size(), 0u) << "Expected key request size"
+                                                 " to have length > 0 bytes";
+                keyRequest = request;
+            });
+    EXPECT_OK(res);
+
+    /**
+     * Get key response from vendor module
+     */
+    hidl_vec<uint8_t> keyResponse =
+            vendorModule->handleKeyRequest(keyRequest, configuration.serverUrl);
+
+    EXPECT_NE(keyResponse.size(), 0u) << "Expected key response size "
+                                         "to have length > 0 bytes";
+
+    res = drmPlugin->provideKeyResponse(
+            sessionId, keyResponse,
+            [&](Status status, const hidl_vec<uint8_t>&) {
+                EXPECT_EQ(Status::OK, status)
+                        << "Failure providing "
+                           "key response for configuration "
+                        << configuration.name;
+            });
+    EXPECT_OK(res);
+}
+
+void DrmHalVendorDecryptTest::fillRandom(const sp<IMemory>& memory) {
+    random_device rd;
+    mt19937 rand(rd());
+    for (size_t i = 0; i < memory->getSize() / sizeof(uint32_t); i++) {
+        auto p = static_cast<uint32_t*>(
+                static_cast<void*>(memory->getPointer()));
+        p[i] = rand();
+    }
+}
+
+TEST_P(DrmHalVendorDecryptTest, ValidateConfigurations) {
+    vector<DrmHalVTSVendorModule_V1::ContentConfiguration> configurations =
+            vendorModule->getContentConfigurations();
+    const char* kVendorStr = "Vendor module ";
+    for (auto config : configurations) {
+        ASSERT_TRUE(config.name.size() > 0) << kVendorStr << "has no name";
+        ASSERT_TRUE(config.serverUrl.size() > 0) << kVendorStr
+                                                 << "has no serverUrl";
+        ASSERT_TRUE(config.initData.size() > 0) << kVendorStr
+                                                << "has no init data";
+        ASSERT_TRUE(config.mimeType.size() > 0) << kVendorStr
+                                                << "has no mime type";
+        ASSERT_TRUE(config.keys.size() >= 1) << kVendorStr << "has no keys";
+        for (auto key : config.keys) {
+            ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
+                                              << " has zero length keyId";
+            ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr
+                                              << " has zero length key value";
+        }
+    }
+}
+
+/**
+ * Positive decrypt test.  "Decrypt" a single clear
+ * segment.  Verify data matches.
+ */
+TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
+    vector<DrmHalVTSVendorModule_V1::ContentConfiguration> configurations =
+            vendorModule->getContentConfigurations();
+    for (auto config : configurations) {
+        const size_t kSegmentSize = 1024;
+        const size_t kSegmentIndex = 0;
+        uint8_t iv[16] = {0};
+
+        sp<IMemory> sharedMemory =
+                getDecryptMemory(kSegmentSize * 2, kSegmentIndex);
+
+        SharedBuffer sourceBuffer = {
+                .bufferId = kSegmentIndex, .offset = 0, .size = kSegmentSize};
+        fillRandom(sharedMemory);
+
+        DestinationBuffer destBuffer = {.type = BufferType::SHARED_MEMORY,
+                                        {.bufferId = kSegmentIndex,
+                                         .offset = kSegmentSize,
+                                         .size = kSegmentSize},
+                                        .secureMemory = nullptr};
+
+        Pattern noPattern = {0, 0};
+        vector<SubSample> subSamples = {{.numBytesOfClearData = kSegmentSize,
+                                         .numBytesOfEncryptedData = 0}};
+        uint64_t offset = 0;
+
+        auto sessionId = openSession();
+        loadKeys(sessionId, config);
+
+        Status status = cryptoPlugin->setMediaDrmSession(sessionId);
+        EXPECT_EQ(Status::OK, status);
+
+        const bool kNotSecure = false;
+        auto res = cryptoPlugin->decrypt(
+                kNotSecure, toHidlArray(config.keys[0].keyId), iv,
+                Mode::UNENCRYPTED, noPattern, subSamples, sourceBuffer, offset,
+                destBuffer, [&](Status status, uint32_t bytesWritten,
+                                string detailedError) {
+                    EXPECT_EQ(Status::OK, status) << "Failure in decryption "
+                                                     "for configuration "
+                                                  << config.name << ": "
+                                                  << detailedError;
+                    EXPECT_EQ(bytesWritten, kSegmentSize);
+                });
+        EXPECT_OK(res);
+        uint8_t* base = static_cast<uint8_t*>(
+                static_cast<void*>(sharedMemory->getPointer()));
+
+        EXPECT_EQ(0,
+                  memcmp(static_cast<void*>(base),
+                         static_cast<void*>(base + kSegmentSize), kSegmentSize))
+                << "decrypt data mismatch";
+        closeSession(sessionId);
+    }
+}
+
+/**
+ * Instantiate the set of test cases for each vendor module
+ */
+
+INSTANTIATE_TEST_CASE_P(
+        DrmHalVendorFactoryTestCases, DrmHalVendorFactoryTest,
+        testing::ValuesIn(gVendorModules->getVendorModulePaths()));
+
+INSTANTIATE_TEST_CASE_P(
+        DrmHalVendorPluginTestCases, DrmHalVendorPluginTest,
+        testing::ValuesIn(gVendorModules->getVendorModulePaths()));
+
+INSTANTIATE_TEST_CASE_P(
+        DrmHalVendorDecryptTestCases, DrmHalVendorDecryptTest,
+        testing::ValuesIn(gVendorModules->getVendorModulePaths()));
+
+int main(int argc, char** argv) {
+    gVendorModules =
+            new drm_vts::VendorModules("/data/nativetest/drm_hidl_test/vendor");
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/drm/1.0/vts/functional/shared_library.cpp b/drm/1.0/vts/functional/shared_library.cpp
new file mode 100644
index 0000000..6658150
--- /dev/null
+++ b/drm/1.0/vts/functional/shared_library.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 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 "drm-vts-shared-library"
+
+#include <dlfcn.h>
+#include <shared_library.h>
+
+using std::string;
+
+namespace drm_vts {
+
+SharedLibrary::SharedLibrary(const string& path) {
+    mLibHandle = dlopen(path.c_str(), RTLD_NOW);
+}
+
+SharedLibrary::~SharedLibrary() {
+    if (mLibHandle != NULL) {
+        dlclose(mLibHandle);
+        mLibHandle = NULL;
+    }
+}
+
+bool SharedLibrary::operator!() const {
+    return mLibHandle == NULL;
+}
+
+void* SharedLibrary::lookup(const char* symbol) const {
+    if (!mLibHandle) {
+        return NULL;
+    }
+
+    // Clear last error before we load the symbol again,
+    // in case the caller didn't retrieve it.
+    (void)dlerror();
+    return dlsym(mLibHandle, symbol);
+}
+
+const char* SharedLibrary::lastError() const {
+    const char* error = dlerror();
+    return error ? error : "No errors or unknown error";
+}
+};
diff --git a/drm/1.0/vts/functional/shared_library.h b/drm/1.0/vts/functional/shared_library.h
new file mode 100644
index 0000000..1f32243
--- /dev/null
+++ b/drm/1.0/vts/functional/shared_library.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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 SHARED_LIBRARY_H_
+#define SHARED_LIBRARY_H_
+
+#include <string>
+#include <vector>
+
+namespace drm_vts {
+class SharedLibrary {
+   public:
+    explicit SharedLibrary(const std::string& path);
+    ~SharedLibrary();
+
+    bool operator!() const;
+    void* lookup(const char* symbol) const;
+    const char* lastError() const;
+
+   private:
+    void* mLibHandle;
+
+    SharedLibrary(const SharedLibrary&) = delete;
+    void operator=(const SharedLibrary&) = delete;
+};
+};
+
+#endif  // SHARED_LIBRARY_H_
diff --git a/drm/1.0/vts/functional/vendor/lib/libvtswidevine.so b/drm/1.0/vts/functional/vendor/lib/libvtswidevine.so
new file mode 100755
index 0000000..d365b34
--- /dev/null
+++ b/drm/1.0/vts/functional/vendor/lib/libvtswidevine.so
Binary files differ
diff --git a/drm/1.0/vts/functional/vendor_modules.cpp b/drm/1.0/vts/functional/vendor_modules.cpp
new file mode 100644
index 0000000..34af6f8
--- /dev/null
+++ b/drm/1.0/vts/functional/vendor_modules.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2017 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 "drm-vts-vendor-modules"
+
+#include <dirent.h>
+#include <dlfcn.h>
+#include <utils/Log.h>
+#include <memory>
+
+#include "shared_library.h"
+#include "vendor_modules.h"
+
+using std::string;
+using std::vector;
+using std::unique_ptr;
+
+namespace drm_vts {
+vector<string> VendorModules::getVendorModulePaths() {
+    if (mModuleList.size() > 0) {
+        return mModuleList;
+    }
+
+    DIR* dir = opendir(mModulesPath.c_str());
+    if (dir == NULL) {
+        ALOGE("Unable to open drm VTS vendor directory %s",
+              mModulesPath.c_str());
+        return mModuleList;
+    }
+
+    struct dirent* entry;
+    while ((entry = readdir(dir))) {
+        string fullpath = mModulesPath + "/" + entry->d_name;
+        if (endsWith(fullpath, ".so")) {
+            mModuleList.push_back(fullpath);
+        }
+    }
+
+    closedir(dir);
+    return mModuleList;
+}
+
+DrmHalVTSVendorModule* VendorModules::getVendorModule(const string& path) {
+    unique_ptr<SharedLibrary>& library = mOpenLibraries[path];
+    if (!library) {
+        library = unique_ptr<SharedLibrary>(new SharedLibrary(path));
+        if (!library) {
+            ALOGE("failed to map shared library %s", path.c_str());
+            return NULL;
+        }
+    }
+    void* symbol = library->lookup("vendorModuleFactory");
+    if (symbol == NULL) {
+        ALOGE("getVendorModule failed to lookup 'vendorModuleFactory' in %s: "
+              "%s",
+              path.c_str(), library->lastError());
+        return NULL;
+    }
+    typedef DrmHalVTSVendorModule* (*ModuleFactory)();
+    ModuleFactory moduleFactory = reinterpret_cast<ModuleFactory>(symbol);
+    return (*moduleFactory)();
+}
+};
diff --git a/drm/1.0/vts/functional/vendor_modules.h b/drm/1.0/vts/functional/vendor_modules.h
new file mode 100644
index 0000000..5371a0d
--- /dev/null
+++ b/drm/1.0/vts/functional/vendor_modules.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 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 VENDOR_MODULES_H
+#define VENDOR_MODULES_H
+
+#include <map>
+
+#include "shared_library.h"
+
+class DrmHalVTSVendorModule;
+
+namespace drm_vts {
+class VendorModules {
+   public:
+    /**
+     * Initialize with a file system path where the shared libraries
+     * are to be found.
+     */
+    explicit VendorModules(const std::string& path) : mModulesPath(path) {}
+    ~VendorModules() {}
+
+    /**
+     * Return a list of paths to available vendor modules.
+     */
+    std::vector<std::string> getVendorModulePaths();
+
+    /**
+     * Retrieve a DrmHalVTSVendorModule given its full path.  The
+     * getAPIVersion method can be used to determine the versioned
+     * subclass type.
+     */
+    DrmHalVTSVendorModule* getVendorModule(const std::string& path);
+
+   private:
+    std::string mModulesPath;
+    std::vector<std::string> mModuleList;
+    std::map<std::string, std::unique_ptr<SharedLibrary>> mOpenLibraries;
+
+    inline bool endsWith(const std::string& str, const std::string& suffix) {
+        if (suffix.size() > str.size()) return false;
+        return std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
+    }
+
+    VendorModules(const VendorModules&) = delete;
+    void operator=(const VendorModules&) = delete;
+};
+};
+
+#endif  // VENDOR_MODULES_H
diff --git a/drm/Android.bp b/drm/Android.bp
index bbb3e4b..33f70eb 100644
--- a/drm/Android.bp
+++ b/drm/Android.bp
@@ -1,4 +1,5 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
     "1.0",
+    "1.0/vts/functional",
 ]
diff --git a/dumpstate/1.0/IDumpstateDevice.hal b/dumpstate/1.0/IDumpstateDevice.hal
index fec3eb4..206c139 100644
--- a/dumpstate/1.0/IDumpstateDevice.hal
+++ b/dumpstate/1.0/IDumpstateDevice.hal
@@ -17,7 +17,7 @@
 package android.hardware.dumpstate@1.0;
 
 interface IDumpstateDevice {
-    /*
+    /**
      * Dumps device-specific state into the given file descriptor.
      */
     dumpstateBoard(handle h);
diff --git a/dumpstate/1.0/default/service.cpp b/dumpstate/1.0/default/service.cpp
index 85bea12..4f276b7 100644
--- a/dumpstate/1.0/default/service.cpp
+++ b/dumpstate/1.0/default/service.cpp
@@ -24,11 +24,18 @@
 using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
 using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
 using ::android::hardware::joinRpcThreadpool;
+using ::android::OK;
 using ::android::sp;
 
-int main (int /* argc */, char * /* argv */ []) {
+int main(int /* argc */, char* /* argv */ []) {
     sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
-    configureRpcThreadpool(1, true);
-    dumpstate->registerAsService();
+    configureRpcThreadpool(1, true /* will join */);
+    if (dumpstate->registerAsService() != OK) {
+        ALOGE("Could not register service.");
+        return 1;
+    }
     joinRpcThreadpool();
+
+    ALOGE("Service exited!");
+    return 1;
 }
diff --git a/gatekeeper/1.0/IGatekeeper.hal b/gatekeeper/1.0/IGatekeeper.hal
index c193477..59dd7d1 100644
--- a/gatekeeper/1.0/IGatekeeper.hal
+++ b/gatekeeper/1.0/IGatekeeper.hal
@@ -91,7 +91,7 @@
        vec<uint8_t> providedPassword)
     generates (GatekeeperResponse response);
 
-/*
+/**
  * Deletes the enrolledPasswordHandle associated with the uid. Once deleted
  * the user cannot be verified anymore.
  * This is an optional method.
@@ -107,7 +107,7 @@
  */
 deleteUser(uint32_t uid) generates (GatekeeperResponse response);
 
-/*
+/**
  * Deletes all the enrolled_password_handles for all uid's. Once called,
  * no users must be enrolled on the device.
  * This is an optional method.
diff --git a/gatekeeper/1.0/types.hal b/gatekeeper/1.0/types.hal
index 59076e0..f243675 100644
--- a/gatekeeper/1.0/types.hal
+++ b/gatekeeper/1.0/types.hal
@@ -31,12 +31,13 @@
  * Gatekeeper response to any/all requests has this structure as mandatory part
  */
 struct GatekeeperResponse {
-    /* request completion status */
+    /** request completion status */
     GatekeeperStatusCode code;
-    /* retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+    /**
+     * retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
      * otherwise unused (0)
      */
     uint32_t timeout;
-    /* optional crypto blob. Opaque to Android system. */
+    /** optional crypto blob. Opaque to Android system. */
     vec<uint8_t> data;
 };
diff --git a/gnss/1.0/IAGnss.hal b/gnss/1.0/IAGnss.hal
index b8f5746..fb0f606 100644
--- a/gnss/1.0/IAGnss.hal
+++ b/gnss/1.0/IAGnss.hal
@@ -18,7 +18,7 @@
 
 import IAGnssCallback;
 
-/*
+/**
  * Extended interface for AGNSS support.
  */
 interface IAGnss {
@@ -30,7 +30,7 @@
         IPV4V6   = 3
     };
 
-    /*
+    /**
      * Opens the AGNSS interface and provides the callback routines to the
      * implementation of this interface.
      *
@@ -38,21 +38,21 @@
      */
     setCallback(IAGnssCallback callback);
 
-    /*
+    /**
      * Notifies that the AGNSS data connection has been closed.
      *
      * @return success True if the operation is successful.
      */
     dataConnClosed() generates (bool success);
 
-    /*
+    /**
      * Notifies that a data connection is not available for AGNSS.
      *
      * @return success True if the operation is successful.
      */
     dataConnFailed() generates (bool success);
 
-    /*
+    /**
      * Sets the hostname and port for the AGNSS server.
      *
      * @param type Specifies if SUPL or C2K.
@@ -64,7 +64,7 @@
     setServer(AGnssType type, string hostname, int32_t port)
         generates (bool success);
 
-    /*
+    /**
      * Notifies that a data connection is available and sets the name of the
      * APN, and its IP type, to be used for SUPL connections.
      *
diff --git a/gnss/1.0/IAGnssCallback.hal b/gnss/1.0/IAGnssCallback.hal
index fe2e101..81f1689 100644
--- a/gnss/1.0/IAGnssCallback.hal
+++ b/gnss/1.0/IAGnssCallback.hal
@@ -39,39 +39,39 @@
         AGNSS_DATA_CONN_FAILED   = 5
     };
 
-    /*
+    /**
      * Represents the status of AGNSS augmented to support IPv4.
      */
     @export(name="", value_prefix="GPS_")
     struct AGnssStatusIpV4 {
         AGnssType type;
         AGnssStatusValue status;
-        /*
+        /**
          * 32-bit IPv4 address.
          */
         uint32_t ipV4Addr;
     };
 
-    /*
+    /**
      * Represents the status of AGNSS augmented to support IPv6.
      */
     struct AGnssStatusIpV6 {
         AGnssType type;
         AGnssStatusValue status;
-        /*
+        /**
          * 128-bit IPv6 address.
          */
         uint8_t[16] ipV6Addr;
     };
 
-    /*
+    /**
      * Callback with AGNSS(IpV4) status information.
      *
      * @param status Will be of type AGnssStatusIpV4.
      */
     agnssStatusIpV4Cb(AGnssStatusIpV4 status);
 
-    /*
+    /**
      * Callback with AGNSS(IpV6) status information.
      *
      * @param status Will be of type AGnssStatusIpV6.
diff --git a/gnss/1.0/IAGnssRil.hal b/gnss/1.0/IAGnssRil.hal
index 6292273..6f91f7f 100644
--- a/gnss/1.0/IAGnssRil.hal
+++ b/gnss/1.0/IAGnssRil.hal
@@ -18,7 +18,7 @@
 
 import IAGnssRilCallback;
 
-/*
+/**
  * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
  * Layer interface allows the GNSS chipset to request radio interface layer
  * information from Android platform. Examples of such information are reference
@@ -50,41 +50,42 @@
         LTE_CELLID   = 4,
     };
 
-    /* CellID for 2G, 3G and LTE, used in AGNSS. */
+    /** CellID for 2G, 3G and LTE, used in AGNSS. */
     struct AGnssRefLocationCellID {
         AGnssRefLocationType type;
 
-        /* Mobile Country Code. */
+        /** Mobile Country Code. */
         uint16_t mcc;
 
-        /* Mobile Network Code .*/
+        /**
+         * Mobile Network Code .*/
         uint16_t mnc;
 
-        /*
+        /**
          * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
          * lac is populated with tac, to ensure that we don't break old clients that
          * might rely in the old (wrong) behavior.
          */
         uint16_t lac;
 
-        /* Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
+        /** Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
         uint32_t cid;
 
-        /* Tracking Area Code in LTE. */
+        /** Tracking Area Code in LTE. */
         uint16_t tac;
 
-        /* Physical Cell id in LTE (not used in 2G and 3G) */
+        /** Physical Cell id in LTE (not used in 2G and 3G) */
         uint16_t pcid;
     };
 
-    /* Represents ref locations */
+    /** Represents ref locations */
     struct AGnssRefLocation {
         AGnssRefLocationType type;
 
         AGnssRefLocationCellID cellID;
     };
 
-    /*
+    /**
      * Opens the AGNSS interface and provides the callback routines
      * to the implementation of this interface.
      *
@@ -92,14 +93,14 @@
      */
     setCallback(IAGnssRilCallback callback);
 
-    /*
+    /**
      * Sets the reference location.
      *
      * @param agnssReflocation AGNSS reference location CellID.
      */
     setRefLocation(AGnssRefLocation agnssReflocation);
 
-    /*
+    /**
      * Sets the SET ID.
      *
      * @param type Must be populated with either IMSI or MSISDN or NONE.
@@ -114,7 +115,7 @@
      */
     setSetId(SetIDType type, string setid) generates (bool success);
 
-    /*
+    /**
      * Notify GNSS of network status changes.
      *
      * @param connected Indicates whether network connectivity exists and
@@ -129,7 +130,7 @@
     updateNetworkState(bool connected, NetworkType type, bool roaming)
         generates (bool success);
 
-    /*
+    /**
      * Notify GNSS of network status changes.
      *
      * @param available Indicates whether network connectivity is available.
diff --git a/gnss/1.0/IAGnssRilCallback.hal b/gnss/1.0/IAGnssRilCallback.hal
index 2d64e54..d2a1a3f 100644
--- a/gnss/1.0/IAGnssRilCallback.hal
+++ b/gnss/1.0/IAGnssRilCallback.hal
@@ -16,26 +16,26 @@
 
 package android.hardware.gnss@1.0;
 
-/*
+/**
  * Callback for IAGnssRil interface. Used to request SET ID and
  * Reference Location.
  */
 interface IAGnssRilCallback {
-    /* Kinds of SET ID that can be requested */
+    /** Kinds of SET ID that can be requested */
     @export(name="", value_prefix="AGPS_RIL_REQUEST_SETID_")
     enum ID : uint32_t {
         IMSI    = 1 << 0L,
         MSISDN  = 1 << 1L,
     };
 
-    /*
+    /**
      * The Hal uses this API to request a SET ID.
      *
      * @param setIdflag Specifies the kind of SET ID that is required by the HAL.
      */
     requestSetIdCb(bitfield<ID> setIdflag);
 
-    /*
+    /**
      * The Hal uses this API to request a reference location.
      *
      */
diff --git a/gnss/1.0/IGnss.hal b/gnss/1.0/IGnss.hal
index 5cde79e..602c615 100644
--- a/gnss/1.0/IGnss.hal
+++ b/gnss/1.0/IGnss.hal
@@ -28,23 +28,23 @@
 import IGnssNi;
 import IGnssXtra;
 
-/* Represents the standard GNSS (Global Navigation Satellite System) interface. */
+/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
 interface IGnss {
-    /* Requested operational mode for GNSS operation. */
+    /** Requested operational mode for GNSS operation. */
     @export(name="", value_prefix="GPS_POSITION_MODE_")
     enum GnssPositionMode : uint8_t {
         /** Mode for running GNSS standalone (no assistance). */
         STANDALONE  = 0,
         /** AGNSS MS-Based mode. */
         MS_BASED    = 1,
-        /*
+        /**
          * AGNSS MS-Assisted mode. This mode is not maintained by the platform anymore.
          * It is strongly recommended to use MS_BASED instead.
          */
         MS_ASSISTED = 2,
     };
 
-    /* Requested recurrence mode for GNSS operation. */
+    /** Requested recurrence mode for GNSS operation. */
     @export(name="", value_prefix="GPS_POSITION_")
     enum GnssPositionRecurrence : uint32_t {
         /** Receive GNSS fixes on a recurring basis at a specified period. */
@@ -53,7 +53,7 @@
         RECURRENCE_SINGLE    = 1
     };
 
-    /*
+    /**
      * Flags used to specify which aiding data to delete when calling
      * deleteAidingData().
      */
@@ -74,7 +74,7 @@
         DELETE_ALL          = 0xFFFF
     };
 
-    /*
+    /**
      * Opens the interface and provides the callback routines
      * to the implementation of this interface.
      *
@@ -84,7 +84,7 @@
      */
     setCallback(IGnssCallback callback) generates (bool success);
 
-    /*
+    /**
      * Starts a location output stream using the IGnssCallback
      * gnssLocationCb(), following the settings from the most recent call to
      * setPositionMode().
@@ -96,19 +96,19 @@
      */
     start() generates (bool success);
 
-    /*
+    /**
      * Stops the location output stream.
      *
      * @return success Returns true on success.
      */
     stop() generates (bool success);
 
-    /*
+    /**
      * Closes the interface.
      */
     cleanup();
 
-    /*
+    /**
      * Injects the current time.
      *
      * @param timeMs This is the UTC time received from the NTP server, its value
@@ -124,7 +124,7 @@
     injectTime(GnssUtcTime timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs)
         generates (bool success);
 
-    /*
+    /**
      * Injects current location from another location provider (typically cell
      * ID).
      *
@@ -137,7 +137,7 @@
     injectLocation(double latitudeDegrees, double longitudeDegrees, float accuracyMeters)
         generates (bool success);
 
-    /*
+    /**
      * Specifies that the next call to start will not use the
      * information defined in the flags. GnssAidingData value of DELETE_ALL is
      * passed for a cold start.
@@ -146,7 +146,7 @@
      */
     deleteAidingData(GnssAidingData aidingDataFlags);
 
-    /*
+    /**
      * Sets the GnssPositionMode parameter,its associated recurrence value,
      * the time between fixes,requested fix accuracy and time to first fix.
      *
@@ -165,70 +165,70 @@
                     uint32_t preferredTimeMs)
         generates (bool success);
 
-    /*
+    /**
      * This method returns the IAGnssRil Interface.
      *
      * @return aGnssRilIface Handle to the IAGnssRil interface.
      */
     getExtensionAGnssRil() generates (IAGnssRil aGnssRilIface);
 
-    /*
+    /**
      * This method returns the IGnssGeofencing Interface.
      *
      * @return gnssGeofencingIface Handle to the IGnssGeofencing interface.
      */
     getExtensionGnssGeofencing() generates(IGnssGeofencing gnssGeofencingIface);
 
-    /*
+    /**
      * This method returns the IAGnss Interface.
      *
      * @return aGnssIface Handle to the IAGnss interface.
      */
     getExtensionAGnss() generates (IAGnss aGnssIface);
 
-    /*
+    /**
      * This method returns the IGnssNi interface.
      *
      * @return gnssNiIface Handle to the IGnssNi interface.
      */
     getExtensionGnssNi() generates (IGnssNi gnssNiIface);
 
-    /*
+    /**
      * This method returns the IGnssMeasurement interface.
      *
      * @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
      */
     getExtensionGnssMeasurement() generates (IGnssMeasurement gnssMeasurementIface);
 
-    /*
+    /**
      * This method returns the IGnssNavigationMessage interface.
      *
      * @return gnssNavigationIface gnssNavigationIface to the IGnssNavigationMessage interface.
      */
     getExtensionGnssNavigationMessage() generates (IGnssNavigationMessage gnssNavigationIface);
 
-    /*
+    /**
      * This method returns the IGnssXtra interface.
      *
      * @return xtraIface Handle to the IGnssXtra interface.
      */
     getExtensionXtra() generates (IGnssXtra xtraIface);
 
-    /*
+    /**
      * This method returns the IGnssConfiguration interface.
      *
      * @return gnssConfigIface Handle to the IGnssConfiguration interface.
      */
     getExtensionGnssConfiguration() generates (IGnssConfiguration gnssConfigIface);
 
-    /*
+    /**
      * This method returns the IGnssDebug interface.
      *
      * @return debugIface Handle to the IGnssDebug interface.
      */
     getExtensionGnssDebug() generates (IGnssDebug debugIface);
 
-    /*
+    /**
      * This method returns the IGnssBatching interface.
      *
      * @return batchingIface Handle to the IGnssBatching interface.
diff --git a/gnss/1.0/IGnssBatching.hal b/gnss/1.0/IGnssBatching.hal
index 6f2dde6..a5e01e3 100644
--- a/gnss/1.0/IGnssBatching.hal
+++ b/gnss/1.0/IGnssBatching.hal
@@ -18,7 +18,7 @@
 
 import IGnssBatchingCallback;
 
-/*
+/**
  * Extended interface for GNSS Batching support.
  *
  * If this interface is supported, this batching request must be able to run in
@@ -39,12 +39,12 @@
  */
 
 interface IGnssBatching {
-    /*
+    /**
      * Enum which holds the bit masks for batching control.
      */
     @export(name="", value_prefix="FLP_BATCH_")
     enum Flag : uint8_t {
-        /*
+        /**
          * If this flag is set, the hardware implementation
          * must wake up the application processor when the FIFO is full, and
          * call IGnssBatchingCallback to return the locations.
@@ -56,19 +56,19 @@
     };
 
     struct Options {
-        /*
+        /**
          * Time interval between samples in the location batch, in nano
          * seconds.
          */
         int64_t periodNanos;
 
-        /*
+        /**
          * Flags controlling how batching should behave.
          */
         bitfield<Flag> flags;
     };
 
-    /*
+    /**
      * Opens the interface and provides the callback routines
      * to the implementation of this interface.
      *
@@ -78,7 +78,7 @@
      */
     init(IGnssBatchingCallback callback) generates (bool success);
 
-    /*
+    /**
      * Return the batch size (in number of GnssLocation objects)
      * available in this hardware implementation.
      *
@@ -93,7 +93,7 @@
      */
     getBatchSize() generates (uint16_t batchSize);
 
-    /*
+    /**
      * Start batching locations. This API is primarily used when the AP is
      * asleep and the device can batch locations in the hardware.
      *
diff --git a/gnss/1.0/IGnssBatchingCallback.hal b/gnss/1.0/IGnssBatchingCallback.hal
index a8f4b88..5697cc4 100644
--- a/gnss/1.0/IGnssBatchingCallback.hal
+++ b/gnss/1.0/IGnssBatchingCallback.hal
@@ -16,9 +16,9 @@
 
 package android.hardware.gnss@1.0;
 
-/* The callback interface to report measurements from the HAL. */
+/** The callback interface to report measurements from the HAL. */
 interface IGnssBatchingCallback {
-    /*
+    /**
      * Called when a batch of locations is output, by various means, including
      * a flush request, as well as the buffer becoming full (if appropriate option
      * is set.)
diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal
index 0c3b9f0..89e5e0e 100644
--- a/gnss/1.0/IGnssCallback.hal
+++ b/gnss/1.0/IGnssCallback.hal
@@ -16,16 +16,16 @@
 
 package android.hardware.gnss@1.0;
 
-/*
+/**
  * The interface is required for the HAL to communicate certain information
  * like status and location info back to the platform, the platform implements
  * the interfaces and passes a handle to the HAL.
  */
 interface IGnssCallback {
-    /* Flags for the gnssSetCapabilities callback. */
+    /** Flags for the gnssSetCapabilities callback. */
     @export(name="", value_prefix="GPS_CAPABILITY_")
     enum Capabilities : uint32_t {
-        /*
+        /**
          * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
          * If this is not set, then the framework will use 1000ms for
          * minInterval and will call start() and stop() to schedule the GNSS.
@@ -47,7 +47,7 @@
         NAV_MESSAGES                    = 1 << 7
     };
 
-    /* GNSS status event values. */
+    /** GNSS status event values. */
     @export(name="", value_prefix="GPS_STATUS_")
     enum GnssStatusValue : uint8_t {
         /** GNSS status unknown. */
@@ -62,7 +62,7 @@
         ENGINE_OFF     = 4
     };
 
-    /*
+    /**
      * Flags that indicate information about the satellite
      */
     @export(name="", value_prefix="GNSS_SV_FLAGS_")
@@ -75,7 +75,7 @@
     };
 
     struct GnssSvInfo {
-        /*
+        /**
          * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The
          * distinction is made by looking at constellation field. Values must be
          * in the range of:
@@ -93,12 +93,12 @@
          */
         int16_t svid;
 
-        /*
+        /**
          * Defines the constellation of the given SV.
          */
         GnssConstellationType constellation;
 
-        /*
+        /**
          * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
          * It contains the measured C/N0 value for the signal at the antenna port.
          *
@@ -112,7 +112,7 @@
         /** Azimuth of SV in degrees. */
         float azimuthDegrees;
 
-        /*
+        /**
          * Carrier frequency of the signal tracked, for example it can be the
          * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
          * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
@@ -130,22 +130,22 @@
          */
         float carrierFrequencyHz;
 
-        /*
+        /**
          * Contains additional data about the given SV.
          */
         bitfield<GnssSvFlags> svFlag;
     };
 
-    /*
+    /**
      * Represents SV status.
      */
     struct GnssSvStatus {
-        /*
+        /**
          * Number of GNSS SVs currently visible, refers to the SVs stored in sv_list
          */
         uint32_t numSvs;
 
-        /*
+        /**
          * Pointer to an array of SVs information for all GNSS constellations,
          * except GNSS, which is reported using svList
          */
@@ -153,26 +153,26 @@
 
     };
 
-    /*
+    /**
      * Called when a GNSS location is available.
      *
      * @param location Location information from HAL.
      */
     gnssLocationCb(GnssLocation location);
 
-    /*
+    /**
      * Called to communicate the status of the GNSS engine.
      *
      * @param status Status information from HAL.
      */
     gnssStatusCb(GnssStatusValue status);
 
-    /*
+    /**
      * @param svInfo SV status information from HAL.
      */
     gnssSvStatusCb(GnssSvStatus svInfo);
 
-    /*
+    /**
      * Called when NMEA data is available.
      * Callback for reporting NMEA sentences.
      *
@@ -195,7 +195,7 @@
      */
     gnssNmeaCb(GnssUtcTime timestamp, string nmea);
 
-    /*
+    /**
      * Callback to inform framework of the GNSS engine's capabilities.
      *
      * @param capabilities Capability parameter is a bit field of
@@ -203,7 +203,7 @@
      */
     gnssSetCapabilitesCb(bitfield<Capabilities> capabilities);
 
-    /*
+    /**
      * Callback utility for acquiring the GNSS wakelock. This can be used to prevent
      * the CPU from suspending while handling GNSS events.
      */
@@ -215,7 +215,7 @@
     /** Callback for requesting NTP time */
     gnssRequestTimeCb();
 
-    /*
+    /**
      * Provides information about how new the underlying GPS/GNSS hardware and
      * software is.
      *
@@ -228,14 +228,14 @@
      * GnssMeasurement support will be verified.
      */
     struct GnssSystemInfo{
-        /*
+        /**
          * year in which the last update was made to the underlying hardware/firmware
          * used to capture GNSS signals, e.g. 2016
          */
         uint16_t yearOfHw;
     };
 
-    /*
+    /**
      * Callback to inform framework of the engine's hardware version information.
      *
      * @param info GnssSystemInfo about the GPS/GNSS hardware.
diff --git a/gnss/1.0/IGnssConfiguration.hal b/gnss/1.0/IGnssConfiguration.hal
index 2fb6e4e..e315286 100644
--- a/gnss/1.0/IGnssConfiguration.hal
+++ b/gnss/1.0/IGnssConfiguration.hal
@@ -16,68 +16,68 @@
 
 package android.hardware.gnss@1.0;
 
-/*
+/**
  * Interface for passing GNSS configuration info from platform to HAL.
  */
 interface IGnssConfiguration {
-    /*
+    /**
      * Enum which holds the bit masks for SUPL_MODE configuration parameter.
      */
     enum SuplMode : uint8_t {
-        /* Mobile Station Based */
+        /** Mobile Station Based */
         MSB = 0x01,
 
-        /* Mobile Station Assisted */
+        /** Mobile Station Assisted */
         MSA = 0x02
     };
 
-    /*
+    /**
      * Enum which holds the bit masks for GPS_LOCK configuration parameter.
      */
     enum GpsLock : uint8_t {
-        /* Lock Mobile Originated GPS functionalitues. */
+        /** Lock Mobile Originated GPS functionalitues. */
         MO    =  0x01,
 
-        /* Lock Network initiated GPS functionalities. */
+        /** Lock Network initiated GPS functionalities. */
         NI    =  0x02
     };
 
-    /*
+    /**
      * Enum that hold the bit masks for various LTE Positioning Profile settings (LPP_PROFILE
      * configuration parameter). If none of the bits in the enum are set, the default setting is
      * Radio Resource Location Protocol(RRLP).
      */
     enum LppProfile : uint8_t {
-        /* Enable LTE Positioning Protocol user plane */
+        /** Enable LTE Positioning Protocol user plane */
         USER_PLANE          = 0x01,
 
-        /* Enable LTE Positioning Protocol Control plane */
+        /** Enable LTE Positioning Protocol Control plane */
         CONTROL_PLANE       = 0x02
     };
 
-    /*
+    /**
      * Enum which holds the bit masks for A_GLONASS_POS_PROTOCOL_SELECT
      * configuration parameter.
      */
     enum GlonassPosProtocol : uint8_t {
-        /* Radio Resource Control(RRC) control-plane. */
+        /** Radio Resource Control(RRC) control-plane. */
         RRC_CPLANE                  = 0x01,
 
-        /* Radio Resource Location user-plane. */
+        /** Radio Resource Location user-plane. */
         RRLP_CPLANE                 = 0x02,
 
-        /* LTE Positioning Protocol User plane */
+        /** LTE Positioning Protocol User plane */
         LPP_UPLANE                  = 0x04
     };
 
-    /*
+    /**
      * IMPORTANT: GNSS HAL must expect the below methods to be called multiple
      * times. They can be called even when GnssLocationProvider is already
      * constructed and enabled. GNSS HAL must maintain the existing requests
      * for various callbacks regardless the change in configuration data.
      */
 
-     /*
+     /**
       * This method enables or disables emergency SUPL.
       *
       * @param enabled True if emergency SUPL is to be enabled.
@@ -86,7 +86,7 @@
       */
      setSuplEs(bool enabled) generates (bool success);
 
-     /*
+     /**
       * This method sets the SUPL version requested by Carrier. The GNSS HAL
       * must use this version of the SUPL protocol if supported.
       *
@@ -99,7 +99,7 @@
       */
      setSuplVersion(uint32_t version) generates (bool success);
 
-     /*
+     /**
       * This method sets the SUPL mode.
       *
       * @param mode Bit mask that specifies the SUPL mode which is set with the SuplMode enum.
@@ -108,7 +108,7 @@
       */
      setSuplMode(bitfield<SuplMode> mode) generates (bool success);
 
-     /*
+     /**
       * This setting configures how GPS functionalities should be locked when
       * user turns off GPS On setting.
       *
@@ -119,7 +119,7 @@
       */
      setGpsLock(bitfield<GpsLock> lock) generates (bool success);
 
-     /*
+     /**
       * This method sets the LTE Positioning Profile configuration.
       *
       * @param lppProfile Bitmask that specifies the LTE Positioning Profile
@@ -129,7 +129,7 @@
       */
      setLppProfile(bitfield<LppProfile> lppProfile) generates (bool success);
 
-     /*
+     /**
       * This method selects positioning protocol on A-Glonass system.
       *
       * @param protocol Bitmask that specifies the positioning protocol to be
@@ -139,7 +139,7 @@
       */
      setGlonassPositioningProtocol(bitfield<GlonassPosProtocol> protocol) generates (bool success);
 
-     /*
+     /**
       * This method configures which PDN to use.
       *
       * @param enable Use emergency PDN if true and regular PDN if false.
diff --git a/gnss/1.0/IGnssDebug.hal b/gnss/1.0/IGnssDebug.hal
index 8784d1a..716ba88 100644
--- a/gnss/1.0/IGnssDebug.hal
+++ b/gnss/1.0/IGnssDebug.hal
@@ -1,133 +1,178 @@
 package android.hardware.gnss@1.0;
 
-/* Extended interface for DEBUG support. */
+/** Extended interface for DEBUG support. */
 interface IGnssDebug {
     enum SatelliteEphemerisType : uint8_t {
-        /* no information is known to the gnss hardware, about this satellite */
-        UNKNOWN,
-        /*  this satellite is known to exist */
-        KNOWN,
-        /*  this satellite is not known to exist */
-        NONEXISTENT,
-        /* Only Almanac (approximate) location known for this satellite */
+        /** Ephemeris is known for this satellite. */
+        EPHEMERIS,
+        /**
+         * Ephemeris is not known, but Almanac (approximate location) is known.
+         */
         ALMANAC_ONLY,
-        /* Ephemeris is known from demodulating the signal on device */
-        DEMODULATED,
-        /* Ephemeris has been provided by SUPL */
-        SUPL_PROVIDED,
-        /* Ephemeris has been provided by another server */
-        OTHER_SERVER_PROVIDED,
-        /*
-         * Predicted ephemeris has been provided by a server
-         * (e.g. Xtra, Extended Ephemeris, etc...)
+        /**
+         * Both ephemeris & almanac are not known (e.g. during a cold start
+         * blind search.)
          */
-        SERVER_PREDICTED,
-        /*
-         * Predicted ephemeris in use, generated locally on the device (e.g. from prior
-         * ephemeris)
-         */
-        LOCALLY_PREDICTED
+        NOT_AVAILABLE
     };
 
-    /*
+    enum SatelliteEphemerisSource : uint8_t {
+        /**
+         * The ephemeris (or almanac only) information was demodulated from the
+         * signal received on the device
+         */
+        DEMODULATED,
+        /**
+         * The ephemeris (or almanac only) information was received from a SUPL
+         * server.
+         */
+        SUPL_PROVIDED,
+        /**
+         * The ephemeris (or almanac only) information was provided by another
+         * server.
+         */
+        OTHER_SERVER_PROVIDED,
+        /**
+         * The ephemeris (or almanac only) information was provided by another
+         * method, e.g. injected via a local debug tool, from build defaults
+         * (e.g. almanac), or is from a satellite
+         * with SatelliteEphemerisType::NOT_AVAILABLE.
+         */
+        OTHER
+    };
+
+    enum SatelliteEphemerisHealth : uint8_t {
+        /** The ephemeris is known good. */
+        GOOD,
+        /** The ephemeris is known bad. */
+        BAD,
+        /** The ephemeris is unknown to be good or bad. */
+        UNKNOWN
+    };
+
+    /**
      * Provides the current best known position from any
      * source (GNSS or injected assistance).
      */
     struct PositionDebug {
-        /*
+        /**
          * Validity of the data in this struct. False only if no
          * latitude/longitude information is known.
          */
         bool valid;
-        /* Latitude expressed in degrees */
+        /** Latitude expressed in degrees */
         double latitudeDegrees;
-        /* Longitude expressed in degrees */
+        /** Longitude expressed in degrees */
         double longitudeDegrees;
-        /* Altitude above ellipsoid expressed in meters */
+        /** Altitude above ellipsoid expressed in meters */
         float altitudeMeters;
-        /* Represents speed in meters per second. */
+        /** Represents horizontal speed in meters per second. */
         float speedMetersPerSec;
-        /* Represents heading in degrees. */
+        /** Represents heading in degrees. */
         float bearingDegrees;
-        /*
-         * estimated horizontal accuracy of position expressed in meters, radial,
+        /**
+         * Estimated horizontal accuracy of position expressed in meters, radial,
          * 68% confidence.
          */
         double horizontalAccuracyMeters;
-        /*
-         * estimated vertical accuracy of position expressed in meters, with
+        /**
+         * Estimated vertical accuracy of position expressed in meters, with
          * 68% confidence.
          */
         double verticalAccuracyMeters;
-        /*
-         * estimated speed accuracy in meters per second with 68% confidence.
+        /**
+         * Estimated speed accuracy in meters per second with 68% confidence.
          */
         double speedAccuracyMetersPerSecond;
-        /*
+        /**
          * estimated bearing accuracy degrees with 68% confidence.
          */
         double bearingAccuracyDegrees;
-        /*
+        /**
          * Time duration before this report that this position information was
-         * valid.
+         * valid.  This can, for example, be a previous injected location with
+         * an age potentially thousands of seconds old, or
+         * extrapolated to the current time (with appropriately increased
+         * accuracy estimates), with a (near) zero age.
          */
         float ageSeconds;
     };
 
-    /*
+    /**
      * Provides the current best known UTC time estimate.
+     * If no fresh information is available, e.g. after a delete all,
+     * then whatever the effective defaults are on the device must be
+     * provided (e.g. Jan. 1, 2017, with an uncertainty of 5 years) expressed
+     * in the specified units.
      */
     struct TimeDebug {
-        /*
-         * Validity of the data in the struct.
-         * False if current time is unknown.
-         */
-        bool valid;
-        /*
-         * UTC time estimate.
-         */
+        /** UTC time estimate. */
         GnssUtcTime timeEstimate;
-        /* 68% error estimate in time. */
+        /** 68% error estimate in time. */
         float timeUncertaintyNs;
+        /**
+         * 68% error estimate in local clock drift,
+         * in nanoseconds per second (also known as parts per billion - ppb.)
+         */
+        float frequencyUncertaintyNsPerSec;
     };
 
-    /*
+    /**
      * Provides a single satellite info that has decoded navigation data.
      */
     struct SatelliteData {
-        /* Satellite vehicle ID number */
+        /** Satellite vehicle ID number */
         int16_t svid;
-        /* Defines the constellation type of the given SV. */
+        /** Defines the constellation type of the given SV. */
         GnssConstellationType constellation;
-        /* Defines the ephemeris type of the satellite. */
+
+        /** Defines the ephemeris type of the satellite. */
         SatelliteEphemerisType ephemerisType;
-        /*
-         * Time duration before this report, that the ephemeris source was last
-         * updated, e.g. latest demodulation, or latest server download.
-         * Set to 0 when ephemerisType is UNKNOWN.
+        /** Defines the ephemeris source of the satellite. */
+        SatelliteEphemerisSource ephemerisSource;
+        /**
+         * Defines whether the satellite is known healthy
+         * (safe for use in location calculation.)
+         */
+        SatelliteEphemerisHealth ephemerisHealth;
+        /**
+         * Time duration from this report (current time), minus the
+         * effective time of the ephemeris source (e.g. TOE, TOA.)
+         * Set to 0 when ephemerisType is NOT_AVAILABLE.
          */
         float ephemerisAgeSeconds;
+
+        /**
+         * True if a server has provided a predicted orbit (& clock) for
+         * this satellite.
+         */
+        bool serverPredictionIsAvailable;
+        /**
+         * Time duration from this report (current time) minus the time of the
+         * start of the server predicted information.  For example, a 1 day
+         * old prediction would be reported as 86400 seconds here.
+         */
+        float serverPredictionAgeSeconds;
     };
 
-    /*
+    /**
      * Provides a set of debug information that is filled by the GNSS chipset
      * when the method getDebugData() is invoked.
      */
     struct DebugData {
-        /* Current best known position. */
+        /** Current best known position. */
         PositionDebug position;
-        /* Current best know time estimate */
+        /** Current best know time estimate */
         TimeDebug time;
-        /*
-         * Provides a list of the decoded satellite ephemeris.
-         * Must provide a complete list for all constellations device can track,
+        /**
+         * Provides a list of the available satellite data, for all
+         * satellites and constellations the device can track,
          * including GnssConstellationType UNKNOWN.
          */
         vec<SatelliteData> satelliteDataArray;
-
     };
 
-    /*
+    /**
      * This methods requests position, time and satellite ephemeris debug information
      * from the HAL.
      *
diff --git a/gnss/1.0/IGnssGeofenceCallback.hal b/gnss/1.0/IGnssGeofenceCallback.hal
index 722317e..a73790a 100644
--- a/gnss/1.0/IGnssGeofenceCallback.hal
+++ b/gnss/1.0/IGnssGeofenceCallback.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.gnss@1.0;
 
-/*
+/**
  * GNSS Geofence.
  * There are 3 states associated with a Geofence: Inside, Outside, Unknown.
  * There are 3 transitions: ENTERED, EXITED, UNCERTAIN.
@@ -114,7 +114,7 @@
         ERROR_GENERIC            = -149
     };
 
-    /*
+    /**
      * The callback associated with the geofence transition.
      * The callback must only be called when the caller is interested in that
      * particular transition. For instance, if the caller is interested only in
@@ -134,7 +134,7 @@
     gnssGeofenceTransitionCb(int32_t geofenceId, GnssLocation location,
         GeofenceTransition transition, GnssUtcTime timestamp);
 
-    /*
+    /**
      * The callback associated with the availability of the GNSS system for
      * geofencing monitoring. If the GNSS system determines that it cannot monitor
      * geofences because of lack of reliability or unavailability of the GNSS
@@ -145,7 +145,7 @@
      */
     gnssGeofenceStatusCb(GeofenceAvailability status, GnssLocation lastLocation);
 
-    /*
+    /**
      * The callback associated with the addGeofence call.
      *
      * @param geofenceId Id of the geofence.
@@ -159,7 +159,7 @@
      */
     gnssGeofenceAddCb(int32_t geofenceId, GeofenceStatus status);
 
-    /*
+    /**
      * The callback associated with the removeGeofence call.
      *
      * @param geofenceId Id of the geofence.
@@ -169,7 +169,7 @@
      */
     gnssGeofenceRemoveCb(int32_t geofenceId, GeofenceStatus status);
 
-    /*
+    /**
      * The callback associated with the pauseGeofence call.
      *
      * @param geofenceId Id of the geofence.
@@ -180,7 +180,7 @@
      */
     gnssGeofencePauseCb(int32_t geofenceId, GeofenceStatus status);
 
-    /*
+    /**
      * The callback associated with the resumeGeofence call.
      *
      * @param geofenceId - Id of the geofence.
diff --git a/gnss/1.0/IGnssGeofencing.hal b/gnss/1.0/IGnssGeofencing.hal
index b8348b3..562355a 100644
--- a/gnss/1.0/IGnssGeofencing.hal
+++ b/gnss/1.0/IGnssGeofencing.hal
@@ -18,9 +18,9 @@
 
 import IGnssGeofenceCallback;
 
-/* Extended interface for GNSS Geofencing support */
+/** Extended interface for GNSS Geofencing support */
 interface IGnssGeofencing {
-    /*
+    /**
      * Opens the geofence interface and provides the callback routines
      * to the HAL.
      *
@@ -28,7 +28,7 @@
      */
     setCallback(IGnssGeofenceCallback callback);
 
-    /*
+    /**
      * Add a geofence area. This api currently supports circular geofences.
      *
      * @param geofenceId The id for the geofence. If a geofence with this id
@@ -59,14 +59,14 @@
             uint32_t notificationResponsivenessMs,
             uint32_t unknownTimerMs);
 
-    /*
+    /**
      * Pause monitoring a particular geofence.
      *
      * @param geofenceId The id for the geofence.
      */
     pauseGeofence(int32_t geofenceId);
 
-    /*
+    /**
      * Resume monitoring a particular geofence.
      *
      * @param geofenceId - The id for the geofence.
@@ -78,7 +78,7 @@
     resumeGeofence(int32_t geofenceId,
             bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions);
 
-    /*
+    /**
      * Remove a geofence area. After the function returns, no notifications
      * must be sent.
      *
diff --git a/gnss/1.0/IGnssMeasurement.hal b/gnss/1.0/IGnssMeasurement.hal
index 8329442..fad83d2 100644
--- a/gnss/1.0/IGnssMeasurement.hal
+++ b/gnss/1.0/IGnssMeasurement.hal
@@ -18,7 +18,7 @@
 
 import IGnssMeasurementCallback;
 
-/*
+/**
  * Extended interface for GNSS Measurements support.
  */
 interface IGnssMeasurement {
@@ -29,7 +29,7 @@
         ERROR_GENERIC = -101
     };
 
-    /*
+    /**
      * Initializes the interface and registers the callback routines with the HAL.
      * After a successful call to 'setCallback' the HAL must begin to provide updates at
      * an average output rate of 1Hz (occasional
@@ -46,7 +46,7 @@
      */
     setCallback(IGnssMeasurementCallback callback) generates (GnssMeasurementStatus initRet);
 
-    /*
+    /**
      * Stops updates from the HAL, and unregisters the callback routines.
      * After a call to close(), the previously registered callbacks must be
      * considered invalid by the HAL.
diff --git a/gnss/1.0/IGnssMeasurementCallback.hal b/gnss/1.0/IGnssMeasurementCallback.hal
index 5789621..467bf19 100644
--- a/gnss/1.0/IGnssMeasurementCallback.hal
+++ b/gnss/1.0/IGnssMeasurementCallback.hal
@@ -16,9 +16,9 @@
 
 package android.hardware.gnss@1.0;
 
-/* The callback interface to report measurements from the HAL. */
+/** The callback interface to report measurements from the HAL. */
 interface IGnssMeasurementCallback {
-    /*
+    /**
      * Flags to indicate what fields in GnssClock are valid.
      */
     @export(name="", value_prefix="GNSS_CLOCK_")
@@ -39,7 +39,7 @@
         HAS_DRIFT_UNCERTAINTY  = 1 << 6
     };
 
-    /*
+    /**
      * Flags to indicate what fields in GnssMeasurement are valid.
      */
     @export(name="", value_prefix="GNSS_MEASUREMENT_")
@@ -58,7 +58,7 @@
         HAS_AUTOMATIC_GAIN_CONTROL     = 1 << 13
     };
 
-    /*
+    /**
      * Enumeration of available values for the GNSS Measurement's multipath
      * indicator.
      */
@@ -72,7 +72,7 @@
         INDICATIOR_NOT_PRESENT = 2
     };
 
-    /*
+    /**
      * Flags indicating the GNSS measurement state.
      *
      * The expected behavior here is for GNSS HAL to set all the flags that applies.
@@ -106,7 +106,7 @@
         STATE_GLO_TOD_KNOWN          = 1 << 15,
     };
 
-    /*
+    /**
      * Flags indicating the Accumulated Delta Range's states.
      */
     @export(name="", value_prefix="GNSS_")
@@ -117,17 +117,17 @@
         ADR_STATE_CYCLE_SLIP = 1 << 2,
     };
 
-    /*
+    /**
      * Represents an estimate of the GNSS clock time.
      */
     struct GnssClock {
-        /*
+        /**
          * A set of flags indicating the validity of the fields in this data
          * structure.
          */
         bitfield<GnssClockFlags> gnssClockFlags;
 
-        /*
+        /**
          * Leap second data.
          * The sign of the value is defined by the following equation:
          *      utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
@@ -138,7 +138,7 @@
          */
         int16_t leapSecond;
 
-        /*
+        /**
          * The GNSS receiver internal clock value. This is the local hardware clock
          * value.
          *
@@ -159,7 +159,7 @@
          */
         int64_t timeNs;
 
-        /*
+        /**
          * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
          * The uncertainty is represented as an absolute (single sided) value.
          *
@@ -170,7 +170,7 @@
          */
         double timeUncertaintyNs;
 
-        /*
+        /**
          * The difference between hardware clock ('time' field) inside GNSS receiver
          * and the true GNSS time since 0000Z, January 6, 1980, in nanoseconds.
          *
@@ -187,7 +187,7 @@
          */
         int64_t fullBiasNs;
 
-        /*
+        /**
          * Sub-nanosecond bias.
          * The error estimate for the sum of this and the fullBiasNs is the
          * biasUncertaintyNs.
@@ -198,7 +198,7 @@
          */
         double biasNs;
 
-        /*
+        /**
          * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
          * bias) in nanoseconds. The uncertainty is represented as an absolute
          * (single sided) value.
@@ -209,7 +209,7 @@
          */
         double biasUncertaintyNs;
 
-        /*
+        /**
          * The clock's drift in nanoseconds (per second).
          *
          * A positive value means that the frequency is higher than the nominal
@@ -223,7 +223,7 @@
          */
         double driftNsps;
 
-        /*
+        /**
          * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
          * second).
          * The uncertainty is represented as an absolute (single sided) value.
@@ -234,7 +234,7 @@
          */
         double driftUncertaintyNsps;
 
-        /*
+        /**
          * When there are any discontinuities in the HW clock, this field is
          * mandatory.
          *
@@ -267,7 +267,7 @@
 
     };
 
-    /*
+    /**
      * Represents a GNSS Measurement, it contains raw and computed information.
      *
      * All signal measurement information (e.g. svTime,
@@ -277,24 +277,24 @@
      * position, velocity, or time.
      */
     struct GnssMeasurement{
-        /*
+        /**
          * A set of flags indicating the validity of the fields in this data
          * structure.
          */
         bitfield<GnssMeasurementFlags> flags;
 
-        /*
+        /**
          * Satellite vehicle ID number, as defined in GnssSvInfo::svid
          * This is a mandatory value.
          */
         int16_t svid;
 
-        /*
+        /**
          * Defines the constellation of the given SV.
          */
         GnssConstellationType constellation;
 
-        /*
+        /**
          * Time offset at which the measurement was taken in nanoseconds.
          * The reference receiver's time is specified by GnssData::clock::timeNs.
          *
@@ -307,7 +307,7 @@
          */
         double timeOffsetNs;
 
-        /*
+        /**
          * Per satellite sync state. It represents the current sync state for the
          * associated satellite.
          * Based on the sync state, the 'received GNSS tow' field must be interpreted
@@ -317,7 +317,7 @@
          */
         bitfield<GnssMeasurementState> state;
 
-        /*
+        /**
          * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
          * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
          * measurement time, in nanoseconds. The value is relative to the
@@ -402,14 +402,14 @@
          */
         int64_t receivedSvTimeInNs;
 
-        /*
+        /**
          * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
          *
          * This value must be populated if 'state' != STATE_UNKNOWN.
          */
         int64_t receivedSvTimeUncertaintyInNs;
 
-        /*
+        /**
          * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
          * It contains the measured C/N0 value for the signal at the antenna port.
          *
@@ -417,7 +417,7 @@
          */
         double cN0DbHz;
 
-        /*
+        /**
          * Pseudorange rate at the timestamp in m/s. The correction of a given
          * Pseudorange Rate value includes corrections for receiver and satellite
          * clock frequency errors. Ensure that this field is independent (see
@@ -445,7 +445,7 @@
          */
         double pseudorangeRateMps;
 
-        /*
+        /**
          * 1-Sigma uncertainty of the pseudorangeRateMps.
          * The uncertainty is represented as an absolute (single sided) value.
          *
@@ -453,7 +453,7 @@
          */
         double pseudorangeRateUncertaintyMps;
 
-        /*
+        /**
          * Accumulated delta range's state. It indicates whether ADR is reset or
          * there is a cycle slip(indicating loss of lock).
          *
@@ -461,7 +461,7 @@
          */
         bitfield<GnssAccumulatedDeltaRangeState> accumulatedDeltaRangeState;
 
-        /*
+        /**
          * Accumulated delta range since the last channel reset in meters.
          * A positive value indicates that the SV is moving away from the receiver.
          *
@@ -476,14 +476,14 @@
          */
         double accumulatedDeltaRangeM;
 
-        /*
+        /**
          * 1-Sigma uncertainty of the accumulated delta range in meters.
          * This value must be populated if 'accumulated delta range state' !=
          * ADR_STATE_UNKNOWN.
          */
         double accumulatedDeltaRangeUncertaintyM;
 
-        /*
+        /**
          * Carrier frequency of the signal tracked, for example it can be the
          * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
          * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
@@ -501,7 +501,7 @@
          */
         float carrierFrequencyHz;
 
-        /*
+        /**
          * The number of full carrier cycles between the satellite and the
          * receiver. The reference frequency is given by the field
          * 'carrierFrequencyHz'. Indications of possible cycle slips and
@@ -513,7 +513,7 @@
          */
         int64_t carrierCycles;
 
-        /*
+        /**
          * The RF phase detected by the receiver, in the range [0.0, 1.0].
          * This is usually the fractional part of the complete carrier phase
          * measurement.
@@ -526,14 +526,14 @@
          */
         double carrierPhase;
 
-        /*
+        /**
          * 1-Sigma uncertainty of the carrier-phase.
          * If the data is available, gnssClockFlags must contain
          * HAS_CARRIER_PHASE_UNCERTAINTY.
          */
         double carrierPhaseUncertainty;
 
-        /*
+        /**
          * An enumeration that indicates the 'multipath' state of the event.
          *
          * The multipath Indicator is intended to report the presence of overlapping
@@ -554,7 +554,7 @@
          */
         GnssMultipathIndicator multipathIndicator;
 
-        /*
+        /**
          * Signal-to-noise ratio at correlator output in dB.
          * If the data is available, gnssClockFlags must contain MEASUREMENT_HAS_SNR.
          * This is the power ratio of the "correlation peak height above the
@@ -562,7 +562,7 @@
          */
         double snrDb;
 
-        /*
+        /**
          * Automatic gain control (AGC) level. AGC acts as a variable gain
          * amplifier adjusting the power of the incoming signal. The AGC level
          * may be used to indicate potential interference. When AGC is at a
@@ -581,7 +581,7 @@
         double agcLevelDb;
     };
 
-    /*
+    /**
      * Represents a reading of GNSS measurements. For devices where GnssSystemInfo's
      * yearOfHw is set to 2016+, it is mandatory that these be provided, on
      * request, when the GNSS receiver is searching/tracking signals.
@@ -590,17 +590,17 @@
      * - Reporting of all tracked constellations are encouraged.
      */
     struct GnssData {
-        /* Number of GnssMeasurement elements. */
+        /** Number of GnssMeasurement elements. */
         uint32_t measurementCount;
 
-        /* The array of measurements. */
+        /** The array of measurements. */
         GnssMeasurement[GnssMax:SVS_COUNT] measurements;
 
         /** The GNSS clock time reading. */
         GnssClock clock;
     };
 
-    /*
+    /**
      * Callback for the hal to pass a GnssData structure back to the client.
      *
      * @param data Contains a reading of GNSS measurements.
diff --git a/gnss/1.0/IGnssNavigationMessage.hal b/gnss/1.0/IGnssNavigationMessage.hal
index ddd9169..db46d11 100644
--- a/gnss/1.0/IGnssNavigationMessage.hal
+++ b/gnss/1.0/IGnssNavigationMessage.hal
@@ -18,7 +18,7 @@
 
 import IGnssNavigationMessageCallback;
 
-/*
+/**
  * Extended interface for GNSS navigation message reporting support.
  */
 interface IGnssNavigationMessage {
@@ -29,7 +29,7 @@
         ERROR_GENERIC = -101
     };
 
-    /*
+    /**
      * Initializes the interface and registers the callback routines with the HAL.
      * After a successful call to 'setCallback' the HAL must begin to provide updates as
      * they become available.
@@ -45,7 +45,7 @@
      */
      setCallback(IGnssNavigationMessageCallback callback) generates (GnssNavigationMessageStatus initRet);
 
-    /*
+    /**
      * Stops updates from the HAL, and unregisters the callback routines.
      * After a call to close(), the previously registered callbacks must be
      * considered invalid by the HAL.
diff --git a/gnss/1.0/IGnssNavigationMessageCallback.hal b/gnss/1.0/IGnssNavigationMessageCallback.hal
index 2e6b853..714351b 100644
--- a/gnss/1.0/IGnssNavigationMessageCallback.hal
+++ b/gnss/1.0/IGnssNavigationMessageCallback.hal
@@ -18,7 +18,7 @@
 
 /** Represents a GNSS navigation message (or a fragment of it). */
 interface IGnssNavigationMessageCallback {
-    /*
+    /**
      * Enumeration of available values to indicate the GNSS Navigation message
      * types.
      *
@@ -48,7 +48,7 @@
         GAL_F           = 0x0602
     };
 
-    /*
+    /**
      * Status of Navigation Message
      * When a message is received properly without any parity error in its
      * navigation words, the status must be set to PARITY_PASSED. But if a message is
@@ -65,26 +65,26 @@
     };
 
     struct GnssNavigationMessage {
-        /*
+        /**
          * Satellite vehicle ID number, as defined in GnssSvInfo::svid
          * This is a mandatory value.
          */
         int16_t svid;
 
-        /*
+        /**
          * The type of message contained in the structure.
          * This is a mandatory value.
          */
         GnssNavigationMessageType type;
 
-        /*
+        /**
          * The status of the received navigation message.
          * No need to send any navigation message that contains words with parity
          * error and cannot be corrected.
          */
         bitfield<NavigationMessageStatus> status;
 
-        /*
+        /**
          * Message identifier. It provides an index so the complete Navigation
          * Message can be assembled.
          *
@@ -106,7 +106,7 @@
          */
         int16_t messageId;
 
-        /*
+        /**
          * Sub-message identifier. If required by the message 'type', this value
          * contains a sub-index within the current message (or frame) that is being
          * transmitted.
@@ -123,7 +123,7 @@
          */
         int16_t submessageId;
 
-        /*
+        /**
          * The data of the reported GNSS message. The bytes (or words) are specified
          * using big endian format (MSB first). The data is stored and decoded
          * in a server for research purposes.
@@ -158,7 +158,7 @@
         vec<uint8_t> data;
     };
 
-    /*
+    /**
      * The callback to report an available fragment of a GNSS navigation messages
      * from the HAL.
      *
diff --git a/gnss/1.0/IGnssNi.hal b/gnss/1.0/IGnssNi.hal
index c823bf0..fa98ab0 100644
--- a/gnss/1.0/IGnssNi.hal
+++ b/gnss/1.0/IGnssNi.hal
@@ -17,19 +17,19 @@
 package android.hardware.gnss@1.0;
 import IGnssNiCallback;
 
-/*
+/**
  * Extended interface for Network-initiated (NI) support. This interface is used
  * to respond to NI notifications originating from the HAL.
  */
 interface IGnssNi {
-    /*
+    /**
      * Registers the callbacks for HAL to use.
      *
      * @param callback handle to IGnssNiCallback interface.
      */
     setCallback(IGnssNiCallback callback);
 
-    /*
+    /**
      * Sends a response to HAL.
      *
      * @param notifId An ID generated by HAL to associate NI notifications and
diff --git a/gnss/1.0/IGnssNiCallback.hal b/gnss/1.0/IGnssNiCallback.hal
index c5fb223..163ba25 100644
--- a/gnss/1.0/IGnssNiCallback.hal
+++ b/gnss/1.0/IGnssNiCallback.hal
@@ -16,9 +16,9 @@
 
 package android.hardware.gnss@1.0;
 
-/* GNSS Network Initiated callback interface. */
+/** GNSS Network Initiated callback interface. */
 interface IGnssNiCallback {
-    /*
+    /**
      * GnssNiType constants
      */
     @export(name="", value_prefix="GPS_NI_TYPE_")
@@ -28,7 +28,7 @@
         UMTS_CTRL_PLANE = 3
     };
 
-    /*
+    /**
      * GnssNiNotifyFlags constants
      */
     @export(name="", value_prefix="GPS_NI_")
@@ -41,7 +41,7 @@
         PRIVACY_OVERRIDE = 0x0004,
     };
 
-    /*
+    /**
      * GNSS NI responses, used to define the response in
      * NI structures
      */
@@ -52,7 +52,7 @@
         RESPONSE_NORESP  = 3,
     };
 
-    /*
+    /**
      * NI data encoding scheme
      */
     @export(name="", value_prefix="GPS_")
@@ -66,59 +66,59 @@
 
     /** Represents an NI request */
     struct GnssNiNotification{
-        /*
+        /**
          * An ID generated by HAL to associate NI notifications and UI
          * responses.
          */
         int32_t notificationId;
 
-        /*
+        /**
          * A type used to distinguish different categories of NI
          * events, such as VOICE, UMTS_SUPL etc.
          */
         GnssNiType niType;
 
-        /*
+        /**
          * Notification/verification options, combinations of GnssNiNotifyFlags
          * constants.
          */
         bitfield<GnssNiNotifyFlags> notifyFlags;
 
-        /*
+        /**
          * Timeout period to wait for user response.
          * Set to 0 for no timeout limit. Specified in seconds.
          */
         uint32_t timeoutSec;
 
-        /*
+        /**
          * Default response when timeout.
          */
         GnssUserResponseType defaultResponse;
 
-        /*
+        /**
          * String representing the requester of the network inititated location
          * request.
          */
         string requestorId;
 
-        /*
+        /**
          * Notification message. String representing the service(for eg. SUPL-service)
          * who sent the network initiated location request.
          */
         string notificationMessage;
 
-        /*
+        /**
          * requestorId decoding scheme.
          */
         GnssNiEncodingType requestorIdEncoding;
 
-        /*
+        /**
          * notificationId decoding scheme
          */
         GnssNiEncodingType notificationIdEncoding;
     };
 
-    /*
+    /**
      * Callback with a network initiated request.
      *
      * @param notification network initiated request.
diff --git a/gnss/1.0/IGnssXtra.hal b/gnss/1.0/IGnssXtra.hal
index 5222fde..a2c8f39 100644
--- a/gnss/1.0/IGnssXtra.hal
+++ b/gnss/1.0/IGnssXtra.hal
@@ -1,12 +1,12 @@
 package android.hardware.gnss@1.0;
 import IGnssXtraCallback;
 
-/*
+/**
  * This interface is used by the GNSS HAL to request the framework
  * to download XTRA data.
  */
 interface IGnssXtra {
-    /*
+    /**
      * Opens the XTRA interface and provides the callback routines
      * to the implementation of this interface.
      *
@@ -16,7 +16,7 @@
      */
     setCallback(IGnssXtraCallback callback) generates (bool success);
 
-    /*
+    /**
      * Inject the downloaded XTRA data into the GNSS receiver.
      *
      * @param xtraData GNSS XTRA data.
diff --git a/gnss/1.0/IGnssXtraCallback.hal b/gnss/1.0/IGnssXtraCallback.hal
index 42df082..838f1ad 100644
--- a/gnss/1.0/IGnssXtraCallback.hal
+++ b/gnss/1.0/IGnssXtraCallback.hal
@@ -1,10 +1,10 @@
 package android.hardware.gnss@1.0;
 
-/*
+/**
  * This interface is used by the GNSS HAL to request download of XTRA data.
  */
 interface IGnssXtraCallback {
-   /*
+   /**
     * Callback to request the client to download XTRA data. The client should
     * download XTRA data and inject it by calling injectXtraData().
     */
diff --git a/gnss/1.0/types.hal b/gnss/1.0/types.hal
index d5e0e9b..ea2c756 100644
--- a/gnss/1.0/types.hal
+++ b/gnss/1.0/types.hal
@@ -22,10 +22,10 @@
     SVS_COUNT = 64,
 };
 
-/* Milliseconds since January 1, 1970 */
+/** Milliseconds since January 1, 1970 */
 typedef int64_t GnssUtcTime;
 
-/*
+/**
  * Constellation type of GnssSvInfo
  */
 
@@ -61,52 +61,52 @@
     HAS_BEARING_ACCURACY      = 0x0080
 };
 
-/* Represents a location. */
+/** Represents a location. */
 struct GnssLocation {
-    /* Contains GnssLocationFlags bits. */
+    /** Contains GnssLocationFlags bits. */
     bitfield<GnssLocationFlags> gnssLocationFlags;
 
-    /* Represents latitude in degrees. */
+    /** Represents latitude in degrees. */
     double latitudeDegrees;
 
-    /* Represents longitude in degrees. */
+    /** Represents longitude in degrees. */
     double longitudeDegrees;
 
-    /*
+    /**
      * Represents altitude in meters above the WGS 84 reference ellipsoid.
      */
     double altitudeMeters;
 
-    /* Represents speed in meters per second. */
+    /** Represents speed in meters per second. */
     float speedMetersPerSec;
 
-    /* Represents heading in degrees. */
+    /** Represents heading in degrees. */
     float bearingDegrees;
 
-    /*
+    /**
     * Represents expected horizontal position accuracy, radial, in meters
     * (68% confidence).
     */
     float horizontalAccuracyMeters;
 
-    /*
+    /**
     * Represents expected vertical position accuracy in meters
     * (68% confidence).
     */
     float verticalAccuracyMeters;
 
-    /*
+    /**
     * Represents expected speed accuracy in meter per seconds
     * (68% confidence).
     */
     float speedAccuracyMetersPerSecond;
 
-    /*
+    /**
     * Represents expected bearing accuracy in degrees
     * (68% confidence).
     */
     float bearingAccuracyDegrees;
 
-    /* Timestamp for the location fix. */
+    /** Timestamp for the location fix. */
     GnssUtcTime timestamp;
 };
diff --git a/graphics/allocator/2.0/IAllocator.hal b/graphics/allocator/2.0/IAllocator.hal
index 00d07d5..bf0e141 100644
--- a/graphics/allocator/2.0/IAllocator.hal
+++ b/graphics/allocator/2.0/IAllocator.hal
@@ -20,23 +20,23 @@
 
 interface IAllocator {
     enum Capability : int32_t {
-        /* reserved */
+        /** reserved */
         INVALID = 0,
 
-        /*
+        /**
          * IAllocatorClient::testAllocate must always return UNDEFINED unless
          * this capability is supported.
          */
         TEST_ALLOCATE = 1,
 
-        /*
+        /**
          * IAllocatorClient::BufferDescriptorInfo::layerCount must be 1 unless
          * this capability is supported.
          */
         LAYERED_BUFFERS = 2,
     };
 
-    /*
+    /**
      * Provides a list of supported capabilities (as described in the
      * definition of Capability above). This list must not change after
      * initialization.
@@ -48,7 +48,7 @@
     @callflow(next="*")
     getCapabilities() generates (vec<Capability> capabilities);
 
-    /*
+    /**
      * Retrieves implementation-defined debug information, which will be
      * displayed during, for example, `dumpsys SurfaceFlinger`.
      *
@@ -59,7 +59,7 @@
     @callflow(next="*")
     dumpDebugInfo() generates (string debugInfo);
 
-    /*
+    /**
      * Creates a client of the allocator. All resources created by the client
      * are owned by the client and are only visible to the client, unless they
      * are exported by exportHandle.
diff --git a/graphics/allocator/2.0/IAllocatorClient.hal b/graphics/allocator/2.0/IAllocatorClient.hal
index 080e3ea..8ca568f 100644
--- a/graphics/allocator/2.0/IAllocatorClient.hal
+++ b/graphics/allocator/2.0/IAllocatorClient.hal
@@ -20,7 +20,7 @@
 
 interface IAllocatorClient {
     struct BufferDescriptorInfo {
-        /*
+        /**
          * The width specifies how many columns of pixels must be in the
          * allocated buffer, but does not necessarily represent the offset in
          * columns between the same column in adjacent rows. The rows may be
@@ -28,34 +28,34 @@
          */
         uint32_t width;
 
-       /*
+       /**
         * The height specifies how many rows of pixels must be in the
         * allocated buffer.
         */
         uint32_t height;
 
-       /*
+       /**
         * The number of image layers that must be in the allocated buffer.
         */
         uint32_t layerCount;
 
-        /* Buffer pixel format. */
+        /** 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;
     };
 
-    /*
+    /**
      * Creates a new, opaque buffer descriptor.
      *
      * @param descriptorInfo specifies the attributes of the buffer
@@ -71,7 +71,7 @@
           generates (Error error,
                      BufferDescriptor descriptor);
 
-    /*
+    /**
      * Destroys an existing buffer descriptor.
      *
      * @param descriptor is the descriptor to destroy.
@@ -81,7 +81,7 @@
     @callflow(next="*")
     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.
      *
@@ -98,7 +98,7 @@
     @callflow(next="allocate")
     testAllocate(vec<BufferDescriptor> descriptors) generates (Error error);
 
-    /*
+    /**
      * Attempts to allocate a list of buffers sharing a backing store.
      *
      * Each buffer must correspond to one of the descriptors passed into the
@@ -124,7 +124,7 @@
         generates (Error error,
                    vec<Buffer> buffers);
 
-    /*
+    /**
      * Frees a buffer.
      *
      * @param buffer is the buffer to be freed.
@@ -135,7 +135,7 @@
     @callflow(next="*")
     free(Buffer buffer) generates (Error error);
 
-    /*
+    /**
      * Exports a buffer for use in other client libraries or for cross-process
      * sharing.
      *
diff --git a/graphics/allocator/2.0/types.hal b/graphics/allocator/2.0/types.hal
index f9d1e1b..d9b184b 100644
--- a/graphics/allocator/2.0/types.hal
+++ b/graphics/allocator/2.0/types.hal
@@ -17,130 +17,131 @@
 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 */
+    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 */
+    /** bit 0 is reserved */
 
-    /* buffer is read by CPU occasionally */
+    /** buffer is read by CPU occasionally */
     CPU_READ        = 1ULL << 1,
-    /* buffer is read by CPU frequently */
+    /** buffer is read by CPU frequently */
     CPU_READ_OFTEN  = 1ULL << 2,
 
-    /* bit 3 is reserved */
-    /* bit 4 is reserved */
+    /** bit 3 is reserved */
+    /** bit 4 is reserved */
 
-    /* buffer is written by CPU occasionally */
+    /** buffer is written by CPU occasionally */
     CPU_WRITE       = 1ULL << 5,
-    /* buffer is written by CPU frequently */
+    /** buffer is written by CPU frequently */
     CPU_WRITE_OFTEN = 1ULL << 6,
 
-    /* bit 7 is reserved */
-    /* bit 8 is reserved */
+    /** bit 7 is reserved */
+    /** bit 8 is reserved */
 
-    /* buffer is used as a GPU render target */
+    /** buffer is 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 */
+    /** 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 */
+    /** bit 15 is reserved */
+    /** bit 16 is reserved */
 
-    /* buffer is used as a camera HAL output */
+    /** buffer is 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 */
+    /** bit 18 is reserved */
+    /** bit 19 is reserved */
+    /** bit 20 is reserved */
+    /** bit 21 is reserved */
 
-    /* buffer is used as a video decoder output */
+    /** buffer is used as a video decoder output */
     VIDEO_DECODER     = 1ULL << 22,
 
-    /* buffer is used as a sensor direct report output */
+    /** buffer is used as a sensor direct report output */
     SENSOR_DIRECT_DATA = 1ULL << 23,
 
-    /* bits 24-27 are reserved for future versions */
-    /* bits 28-31 are reserved for vendor extensions */
+    /** bits 24-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 */
+    /** bits 32-47 are reserved for future versions */
+    /** bits 48-63 are reserved for vendor extensions */
 };
 
 enum ConsumerUsage : uint64_t {
-    /* bit 0 is reserved */
+    /** bit 0 is reserved */
 
-    /* buffer is read by CPU occasionally */
+    /** buffer is read by CPU occasionally */
     CPU_READ          = 1ULL << 1,
-    /* buffer is read by CPU frequently */
+    /** buffer is 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 */
+    /** bit 3 is reserved */
+    /** bit 4 is reserved */
+    /** bit 5 is reserved */
+    /** bit 6 is reserved */
+    /** bit 7 is reserved */
 
-    /* buffer is used as a GPU texture */
+    /** buffer is used as a GPU texture */
     GPU_TEXTURE       = 1ULL << 8,
 
-    /* bit 9 is reserved */
-    /* bit 10 is reserved */
+    /** bit 9 is reserved */
+    /** bit 10 is reserved */
 
-    /* buffer is used by hwcomposer HAL */
+    /** buffer is used by hwcomposer HAL */
     HWCOMPOSER        = 1ULL << 11,
-    /* buffer is a hwcomposer HAL client target */
+    /** buffer is a hwcomposer HAL client target */
     CLIENT_TARGET     = 1ULL << 12,
 
-    /* bit 13 is reserved */
-    /* bit 14 is reserved */
+    /** bit 13 is reserved */
+    /** bit 14 is reserved */
 
-    /* buffer is used as a hwcomposer HAL cursor */
+    /** buffer is used as a hwcomposer HAL cursor */
     CURSOR            = 1ULL << 15,
 
-    /* buffer is used as a video encoder input */
+    /** buffer is used as a video encoder input */
     VIDEO_ENCODER     = 1ULL << 16,
 
-    /* bit 17 is reserved */
+    /** bit 17 is reserved */
 
-    /* buffer is used as a camera HAL input */
+    /** buffer is used as a camera HAL input */
     CAMERA            = 1ULL << 18,
 
-    /* bit 19 is reserved */
+    /** bit 19 is reserved */
 
-    /* buffer is used as a renderscript allocation */
+    /** buffer is used as a renderscript allocation */
     RENDERSCRIPT      = 1ULL << 20,
 
-    /* bit 21 is reserved */
-    /* bit 22 is reserved */
+    /** bit 21 is reserved */
+    /** bit 22 is reserved */
 
-    /* buffer is used as as an OpenGL shader storage or uniform
+    /**
+     * buffer is used as as an OpenGL shader storage or uniform
        buffer object */
     GPU_DATA_BUFFER    = 1ULL << 23,
 
-    /* bits 24-27 are reserved for future versions */
-    /* bits 28-31 are reserved for vendor extensions */
+    /** bits 24-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 */
+    /** bits 32-47 are reserved for future versions */
+    /** bits 48-63 are reserved for vendor extensions */
 };
 
 typedef uint64_t BufferDescriptor;
diff --git a/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
index c59a16c..87bb814 100644
--- a/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
+++ b/graphics/bufferqueue/1.0/IGraphicBufferProducer.hal
@@ -546,7 +546,7 @@
      */
     disconnect(
             int32_t api,
-            DisconnectMode mode /* = DisconnectMode::API */
+            DisconnectMode mode /** = DisconnectMode::API */
         ) generates (
             Status status
         );
diff --git a/graphics/common/1.0/types.hal b/graphics/common/1.0/types.hal
index dfecec1..979e4c4 100644
--- a/graphics/common/1.0/types.hal
+++ b/graphics/common/1.0/types.hal
@@ -21,7 +21,7 @@
  */
 @export(name="android_pixel_format_t", value_prefix="HAL_PIXEL_FORMAT_")
 enum PixelFormat : int32_t {
-    /*
+    /**
      * "linear" color pixel formats:
      *
      * When used with ANativeWindow, the dataSpace field describes the color
@@ -37,7 +37,7 @@
     RGB_565            = 4,
     BGRA_8888          = 5,
 
-    /*
+    /**
      * The following formats use 10bit integers for R, G, and B and
      * 2 bits for alpha. This is used to improve color precision on
      * wide-color devices, e.g. Display-P3 or scRGB.
@@ -47,7 +47,7 @@
      */
     RGBA_1010102       = 0x2B,
 
-    /*
+    /**
      * The following formats use a 16bit float per color component.
      *
      * When used with ANativeWindow, the dataSpace field describes the color
@@ -55,7 +55,7 @@
      */
     RGBA_FP16          = 0x16,
 
-    /*
+    /**
      * 0x101 - 0x1FF
      *
      * This range is reserved for pixel formats that are specific to the HAL
@@ -66,7 +66,7 @@
      * GL_OES_EGL_image_external OpenGL ES extension.
      */
 
-    /*
+    /**
      * Android YUV format:
      *
      * This format is exposed outside of the HAL to software decoders and
@@ -95,7 +95,7 @@
     YV12   = 0x32315659, // YCrCb 4:2:0 Planar
 
 
-    /*
+    /**
      * Android Y8 format:
      *
      * This format is exposed outside of the HAL to the framework.
@@ -120,7 +120,7 @@
      */
     Y8     = 0x20203859,
 
-    /*
+    /**
      * Android Y16 format:
      *
      * This format is exposed outside of the HAL to the framework.
@@ -149,7 +149,7 @@
      */
     Y16    = 0x20363159,
 
-    /*
+    /**
      * Android RAW sensor format:
      *
      * This format is exposed outside of the camera HAL to applications.
@@ -187,7 +187,7 @@
      */
     RAW16 = 0x20,
 
-    /*
+    /**
      * Android RAW10 format:
      *
      * This format is exposed outside of the camera HAL to applications.
@@ -241,7 +241,7 @@
      */
     RAW10 = 0x25,
 
-    /*
+    /**
      * Android RAW12 format:
      *
      * This format is exposed outside of camera HAL to applications.
@@ -291,7 +291,7 @@
      */
     RAW12 = 0x26,
 
-    /*
+    /**
      * Android opaque RAW format:
      *
      * This format is exposed outside of the camera HAL to applications.
@@ -312,7 +312,7 @@
      */
     RAW_OPAQUE = 0x24,
 
-    /*
+    /**
      * Android binary blob graphics buffer format:
      *
      * This format is used to carry task-specific data which does not have a
@@ -338,7 +338,7 @@
      */
     BLOB = 0x21,
 
-    /*
+    /**
      * Android format indicating that the choice of format is entirely up to the
      * device-specific Gralloc implementation.
      *
@@ -356,7 +356,7 @@
      */
     IMPLEMENTATION_DEFINED = 0x22,
 
-    /*
+    /**
      * Android flexible YCbCr 4:2:0 formats
      *
      * This format allows platforms to use an efficient YCbCr/YCrCb 4:2:0
@@ -378,7 +378,7 @@
      */
     YCBCR_420_888 = 0x23,
 
-    /*
+    /**
      * Android flexible YCbCr 4:2:2 formats
      *
      * This format allows platforms to use an efficient YCbCr/YCrCb 4:2:2
@@ -392,7 +392,7 @@
      */
     YCBCR_422_888 = 0x27,
 
-    /*
+    /**
      * Android flexible YCbCr 4:4:4 formats
      *
      * This format allows platforms to use an efficient YCbCr/YCrCb 4:4:4
@@ -406,7 +406,7 @@
      */
     YCBCR_444_888 = 0x28,
 
-    /*
+    /**
      * Android flexible RGB 888 formats
      *
      * This format allows platforms to use an efficient RGB/BGR/RGBX/BGRX
@@ -420,7 +420,7 @@
      */
     FLEX_RGB_888 = 0x29,
 
-    /*
+    /**
      * Android flexible RGBA 8888 formats
      *
      * This format allows platforms to use an efficient RGBA/BGRA/ARGB/ABGR
@@ -434,7 +434,7 @@
      */
     FLEX_RGBA_8888 = 0x2A,
 
-    /* Legacy formats (deprecated), used by ImageFormat.java */
+    /** Legacy formats (deprecated), used by ImageFormat.java */
     YCBCR_422_SP       = 0x10,  // NV16
     YCRCB_420_SP       = 0x11,  // NV21
     YCBCR_422_I        = 0x14,  // YUY2
@@ -450,18 +450,19 @@
  */
 @export(name="android_transform_t", value_prefix="HAL_TRANSFORM_")
 enum Transform : int32_t {
-    /* flip source image horizontally (around the vertical axis) */
+    /** flip source image horizontally (around the vertical axis) */
     FLIP_H    = 0x01,
-    /* flip source image vertically (around the horizontal axis)*/
+    /**
+     * flip source image vertically (around the horizontal axis)*/
     FLIP_V    = 0x02,
-    /* rotate source image 90 degrees clockwise */
+    /** rotate source image 90 degrees clockwise */
     ROT_90    = 0x04,
-    /* rotate source image 180 degrees */
+    /** rotate source image 180 degrees */
     ROT_180   = 0x03,
-    /* rotate source image 270 degrees clockwise */
+    /** rotate source image 270 degrees clockwise */
     ROT_270   = 0x07,
 
-    /* 0x08 is reserved */
+    /** 0x08 is reserved */
 };
 
 /**
@@ -509,7 +510,7 @@
  */
 @export(name="android_dataspace_t", value_prefix="HAL_DATASPACE_")
 enum Dataspace : int32_t {
-    /*
+    /**
      * Default-assumption data space, when not explicitly specified.
      *
      * It is safest to assume the buffer is an image with sRGB primaries and
@@ -520,7 +521,7 @@
      */
     UNKNOWN = 0x0,
 
-    /*
+    /**
      * Arbitrary dataspace with manually defined characteristics.  Definition
      * for colorspaces or other meaning must be communicated separately.
      *
@@ -533,7 +534,7 @@
      */
     ARBITRARY = 0x1,
 
-    /*
+    /**
      * Color-description aspects
      *
      * The following aspects define various characteristics of the color
@@ -543,7 +544,7 @@
 
     STANDARD_SHIFT = 16,
 
-    /*
+    /**
      * Standard aspect
      *
      * Defines the chromaticity coordinates of the source primaries in terms of
@@ -551,7 +552,7 @@
      */
     STANDARD_MASK = 63 << STANDARD_SHIFT,  // 0x3F
 
-    /*
+    /**
      * Chromacity coordinates are unknown or are determined by the application.
      * Implementations shall use the following suggested standards:
      *
@@ -566,7 +567,7 @@
      */
     STANDARD_UNSPECIFIED = 0 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.300   0.600
      *  blue            0.150   0.060
@@ -578,7 +579,7 @@
      */
     STANDARD_BT709 = 1 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.290   0.600
      *  blue            0.150   0.060
@@ -592,7 +593,7 @@
      */
     STANDARD_BT601_625 = 2 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.290   0.600
      *  blue            0.150   0.060
@@ -604,7 +605,7 @@
      */
     STANDARD_BT601_625_UNADJUSTED = 3 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.310   0.595
      *  blue            0.155   0.070
@@ -618,7 +619,7 @@
      */
     STANDARD_BT601_525 = 4 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.310   0.595
      *  blue            0.155   0.070
@@ -630,7 +631,7 @@
      */
     STANDARD_BT601_525_UNADJUSTED = 5 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.170   0.797
      *  blue            0.131   0.046
@@ -642,7 +643,7 @@
      */
     STANDARD_BT2020 = 6 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.170   0.797
      *  blue            0.131   0.046
@@ -654,7 +655,7 @@
      */
     STANDARD_BT2020_CONSTANT_LUMINANCE = 7 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x      y
      *  green           0.21   0.71
      *  blue            0.14   0.08
@@ -666,7 +667,7 @@
      */
     STANDARD_BT470M = 8 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Primaries:       x       y
      *  green           0.243   0.692
      *  blue            0.145   0.049
@@ -678,7 +679,7 @@
      */
     STANDARD_FILM = 9 << STANDARD_SHIFT,
 
-    /*
+    /**
      * SMPTE EG 432-1 and SMPTE RP 431-2. (DCI-P3)
      * Primaries:       x       y
      *  green           0.265   0.690
@@ -688,7 +689,7 @@
      */
     STANDARD_DCI_P3 = 10 << STANDARD_SHIFT,
 
-    /*
+    /**
      * Adobe RGB
      * Primaries:       x       y
      *  green           0.210   0.710
@@ -702,7 +703,7 @@
 
     TRANSFER_SHIFT = 22,
 
-    /*
+    /**
      * Transfer aspect
      *
      * Transfer characteristics are the opto-electronic transfer characteristic
@@ -718,7 +719,7 @@
 
     TRANSFER_MASK = 31 << TRANSFER_SHIFT,  // 0x1F
 
-    /*
+    /**
      * Transfer characteristics are unknown or are determined by the
      * application.
      *
@@ -732,7 +733,7 @@
      */
     TRANSFER_UNSPECIFIED = 0 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * Transfer characteristic curve:
      *  E = L
      *      L - luminance of image 0 <= L <= 1 for conventional colorimetry
@@ -740,7 +741,7 @@
      */
     TRANSFER_LINEAR = 1 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * Transfer characteristic curve:
      *
      * E = 1.055 * L^(1/2.4) - 0.055  for 0.0031308 <= L <= 1
@@ -750,7 +751,7 @@
      */
     TRANSFER_SRGB = 2 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * BT.601 525, BT.601 625, BT.709, BT.2020
      *
      * Transfer characteristic curve:
@@ -761,7 +762,7 @@
      */
     TRANSFER_SMPTE_170M = 3 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * Assumed display gamma 2.2.
      *
      * Transfer characteristic curve:
@@ -771,7 +772,7 @@
      */
     TRANSFER_GAMMA2_2 = 4 << TRANSFER_SHIFT,
 
-    /*
+    /**
      *  display gamma 2.6.
      *
      * Transfer characteristic curve:
@@ -781,7 +782,7 @@
      */
     TRANSFER_GAMMA2_6 = 5 << TRANSFER_SHIFT,
 
-    /*
+    /**
      *  display gamma 2.8.
      *
      * Transfer characteristic curve:
@@ -791,7 +792,7 @@
      */
     TRANSFER_GAMMA2_8 = 6 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * SMPTE ST 2084 (Dolby Perceptual Quantizer)
      *
      * Transfer characteristic curve:
@@ -807,7 +808,7 @@
      */
     TRANSFER_ST2084 = 7 << TRANSFER_SHIFT,
 
-    /*
+    /**
      * ARIB STD-B67 Hybrid Log Gamma
      *
      * Transfer characteristic curve:
@@ -825,7 +826,7 @@
 
     RANGE_SHIFT = 27,
 
-    /*
+    /**
      * Range aspect
      *
      * Defines the range of values corresponding to the unit range of 0-1.
@@ -833,7 +834,7 @@
      */
     RANGE_MASK = 7 << RANGE_SHIFT,  // 0x7
 
-    /*
+    /**
      * Range is unknown or are determined by the application.  Implementations
      * shall use the following suggested ranges:
      *
@@ -846,13 +847,13 @@
      */
     RANGE_UNSPECIFIED = 0 << RANGE_SHIFT,
 
-    /*
+    /**
      * Full range uses all values for Y, Cb and Cr from
      * 0 to 2^b-1, where b is the bit depth of the color format.
      */
     RANGE_FULL = 1 << RANGE_SHIFT,
 
-    /*
+    /**
      * Limited range uses values 16/256*2^b to 235/256*2^b for Y, and
      * 1/16*2^b to 15/16*2^b for Cb, Cr, R, G and B, where b is the bit depth of
      * the color format.
@@ -867,7 +868,7 @@
      */
     RANGE_LIMITED = 2 << RANGE_SHIFT,
 
-    /*
+    /**
      * Extended range is used for scRGB. Intended for use with
      * floating point pixel formats. [0.0 - 1.0] is the standard
      * sRGB space. Values outside the range 0.0 - 1.0 can encode
@@ -876,11 +877,11 @@
      */
     RANGE_EXTENDED = 3 << RANGE_SHIFT,
 
-    /*
+    /**
      * Legacy dataspaces
      */
 
-    /*
+    /**
      * sRGB linear encoding:
      *
      * The red, green, and blue components are stored in sRGB space, but
@@ -895,7 +896,7 @@
     V0_SRGB_LINEAR = STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL,
 
 
-    /*
+    /**
      * scRGB linear encoding:
      *
      * The red, green, and blue components are stored in extended sRGB space,
@@ -910,7 +911,7 @@
     V0_SCRGB_LINEAR = STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED,
 
 
-    /*
+    /**
      * sRGB gamma encoding:
      *
      * The red, green and blue components are stored in sRGB space, and
@@ -928,7 +929,7 @@
     V0_SRGB = STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL,
 
 
-    /*
+    /**
      * scRGB:
      *
      * The red, green, and blue components are stored in extended sRGB space,
@@ -942,7 +943,7 @@
      */
     V0_SCRGB = STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED,
 
-    /*
+    /**
      * YCbCr Colorspaces
      * -----------------
      *
@@ -953,7 +954,7 @@
      * at the source as a function of linear optical intensity (luminance).
      */
 
-    /*
+    /**
      * JPEG File Interchange Format (JFIF)
      *
      * Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255
@@ -964,7 +965,7 @@
 
     V0_JFIF = STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_FULL,
 
-    /*
+    /**
      * ITU-R Recommendation 601 (BT.601) - 625-line
      *
      * Standard-definition television, 625 Lines (PAL)
@@ -976,7 +977,7 @@
     V0_BT601_625 = STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_LIMITED,
 
 
-    /*
+    /**
      * ITU-R Recommendation 601 (BT.601) - 525-line
      *
      * Standard-definition television, 525 Lines (NTSC)
@@ -987,7 +988,7 @@
 
     V0_BT601_525 = STANDARD_BT601_525 | TRANSFER_SMPTE_170M | RANGE_LIMITED,
 
-    /*
+    /**
      * ITU-R Recommendation 709 (BT.709)
      *
      * High-definition television
@@ -999,7 +1000,7 @@
     V0_BT709 = STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED,
 
 
-    /*
+    /**
      * SMPTE EG 432-1 and SMPTE RP 431-2.
      *
      * Digital Cinema DCI-P3
@@ -1009,7 +1010,7 @@
     DCI_P3_LINEAR = STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL,
 
 
-    /*
+    /**
      * SMPTE EG 432-1 and SMPTE RP 431-2.
      *
      * Digital Cinema DCI-P3
@@ -1021,7 +1022,7 @@
     DCI_P3 = STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL,
 
 
-    /*
+    /**
      * Display P3
      *
      * Display P3 uses same primaries and white-point as DCI-P3
@@ -1030,7 +1031,7 @@
     DISPLAY_P3_LINEAR = STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL,
 
 
-    /*
+    /**
      * Display P3
      *
      * Use same primaries and white-point as DCI-P3
@@ -1039,7 +1040,7 @@
     DISPLAY_P3 = STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL,
 
 
-    /*
+    /**
      * Adobe RGB
      *
      * Use full range, gamma 2.2 transfer and Adobe RGB primaries
@@ -1049,7 +1050,7 @@
     ADOBE_RGB = STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL,
 
 
-    /*
+    /**
      * ITU-R Recommendation 2020 (BT.2020)
      *
      * Ultra High-definition television
@@ -1059,7 +1060,7 @@
     BT2020_LINEAR = STANDARD_BT2020 | TRANSFER_LINEAR | RANGE_FULL,
 
 
-    /*
+    /**
      * ITU-R Recommendation 2020 (BT.2020)
      *
      * Ultra High-definition television
@@ -1068,7 +1069,7 @@
      */
     BT2020 = STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL,
 
-    /*
+    /**
      * ITU-R Recommendation 2020 (BT.2020)
      *
      * Ultra High-definition television
@@ -1078,11 +1079,11 @@
     BT2020_PQ = STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL,
 
 
-    /*
+    /**
      * Data spaces for non-color formats
      */
 
-    /*
+    /**
      * The buffer contains depth ranging measurements from a depth camera.
      * This value is valid with formats:
      *    HAL_PIXEL_FORMAT_Y16: 16-bit samples, consisting of a depth measurement
@@ -1103,7 +1104,7 @@
     DEPTH = 0x1000,
 
 
-    /*
+    /**
      * The buffer contains sensor events from sensor direct report.
      * This value is valid with formats:
      *    HAL_PIXEL_FORMAT_BLOB: an array of sensor event structure that forms
@@ -1113,7 +1114,7 @@
     SENSOR = 0x1001
 };
 
-/*
+/**
  * Color modes that may be supported by a display.
  *
  * Definitions:
@@ -1159,7 +1160,7 @@
  */
 @export(name="android_color_mode_t", value_prefix="HAL_COLOR_MODE_")
 enum ColorMode : int32_t {
-  /*
+  /**
    * DEFAULT is the "native" gamut of the display.
    * White Point: Vendor/OEM defined
    * Panel Gamma: Vendor/OEM defined (typically 2.2)
@@ -1167,7 +1168,7 @@
    */
   NATIVE = 0,
 
-  /*
+  /**
    * STANDARD_BT601_625 corresponds with display
    * settings that implement the ITU-R Recommendation BT.601
    * or Rec 601. Using 625 line version
@@ -1193,7 +1194,7 @@
    */
   STANDARD_BT601_625 = 1,
 
-  /*
+  /**
    * Primaries:
    *                  x       y
    *  green           0.290   0.600
@@ -1213,7 +1214,7 @@
    */
   STANDARD_BT601_625_UNADJUSTED = 2,
 
-  /*
+  /**
    * Primaries:
    *                  x       y
    *  green           0.310   0.595
@@ -1235,7 +1236,7 @@
    */
   STANDARD_BT601_525 = 3,
 
-  /*
+  /**
    * Primaries:
    *                  x       y
    *  green           0.310   0.595
@@ -1255,7 +1256,7 @@
    */
   STANDARD_BT601_525_UNADJUSTED = 4,
 
-  /*
+  /**
    * REC709 corresponds with display settings that implement
    * the ITU-R Recommendation BT.709 / Rec. 709 for high-definition television.
    * Rendering Intent: Colorimetric
@@ -1283,7 +1284,7 @@
    */
   STANDARD_BT709 = 5,
 
-  /*
+  /**
    * DCI_P3 corresponds with display settings that implement
    * SMPTE EG 432-1 and SMPTE RP 431-2
    * Rendering Intent: Colorimetric
@@ -1298,7 +1299,7 @@
    */
   DCI_P3 = 6,
 
-  /*
+  /**
    * SRGB corresponds with display settings that implement
    * the sRGB color space. Uses the same primaries as ITU-R Recommendation
    * BT.709
@@ -1326,7 +1327,7 @@
    */
   SRGB = 7,
 
-  /*
+  /**
    * ADOBE_RGB corresponds with the RGB color space developed
    * by Adobe Systems, Inc. in 1998.
    * Rendering Intent: Colorimetric
@@ -1341,7 +1342,7 @@
    */
   ADOBE_RGB = 8,
 
-  /*
+  /**
    * DISPLAY_P3 is a color space that uses the DCI_P3 primaries,
    * the D65 white point and the SRGB transfer functions.
    * Rendering Intent: Colorimetric
@@ -1364,46 +1365,47 @@
   DISPLAY_P3 = 9
 };
 
-/*
+/**
  * Color transforms that may be applied by hardware composer to the whole
  * display.
  */
 @export(name="android_color_transform_t", value_prefix="HAL_COLOR_TRANSFORM_")
 enum ColorTransform : int32_t {
-    /* Applies no transform to the output color */
+    /** Applies no transform to the output color */
     IDENTITY = 0,
 
-    /* Applies an arbitrary transform defined by a 4x4 affine matrix */
+    /** Applies an arbitrary transform defined by a 4x4 affine matrix */
     ARBITRARY_MATRIX = 1,
 
-    /* Applies a transform that inverts the value or luminance of the color, but
+    /**
+     * Applies a transform that inverts the value or luminance of the color, but
      * does not modify hue or saturation */
     VALUE_INVERSE = 2,
 
-    /* Applies a transform that maps all colors to shades of gray */
+    /** Applies a transform that maps all colors to shades of gray */
     GRAYSCALE = 3,
 
-    /* Applies a transform which corrects for protanopic color blindness */
+    /** Applies a transform which corrects for protanopic color blindness */
     CORRECT_PROTANOPIA = 4,
 
-    /* Applies a transform which corrects for deuteranopic color blindness */
+    /** Applies a transform which corrects for deuteranopic color blindness */
     CORRECT_DEUTERANOPIA = 5,
 
-    /* Applies a transform which corrects for tritanopic color blindness */
+    /** Applies a transform which corrects for tritanopic color blindness */
     CORRECT_TRITANOPIA = 6
 };
 
-/*
+/**
  * Supported HDR formats. Must be kept in sync with equivalents in Display.java.
  */
 @export(name="android_hdr_t", value_prefix="HAL_HDR_")
 enum Hdr : int32_t {
-    /* Device supports Dolby Vision HDR */
+    /** Device supports Dolby Vision HDR */
     DOLBY_VISION = 1,
 
-    /* Device supports HDR10 */
+    /** Device supports HDR10 */
     HDR10 = 2,
 
-    /* Device supports hybrid log-gamma HDR */
+    /** Device supports hybrid log-gamma HDR */
     HLG = 3
 };
diff --git a/graphics/composer/2.1/IComposer.hal b/graphics/composer/2.1/IComposer.hal
index 553a537..b3ac761 100644
--- a/graphics/composer/2.1/IComposer.hal
+++ b/graphics/composer/2.1/IComposer.hal
@@ -19,7 +19,7 @@
 import IComposerClient;
 
 interface IComposer {
-    /*
+    /**
      * Optional capabilities which may be supported by some devices. The
      * particular set of supported capabilities for a given device may be
      * retrieved using getCapabilities.
@@ -27,7 +27,7 @@
     enum Capability : int32_t {
         INVALID = 0,
 
-        /*
+        /**
          * Specifies that the device supports sideband stream layers, for
          * which buffer content updates and other synchronization will not be
          * provided through the usual validate/present cycle and must be
@@ -37,7 +37,7 @@
          */
         SIDEBAND_STREAM = 1,
 
-        /*
+        /**
          * Specifies that the device will apply a color transform even when
          * either the client or the device has chosen that all layers should
          * be composed by the client. This will prevent the client from
@@ -46,7 +46,7 @@
         SKIP_CLIENT_COLOR_TRANSFORM = 2,
     };
 
-    /*
+    /**
      * Provides a list of supported capabilities (as described in the
      * definition of Capability above). This list must not change after
      * initialization.
@@ -58,7 +58,7 @@
     @callflow(next="*")
     getCapabilities() generates (vec<Capability> capabilities);
 
-    /*
+    /**
      * Retrieves implementation-defined debug information, which will be
      * displayed during, for example, `dumpsys SurfaceFlinger`.
      *
@@ -69,7 +69,7 @@
     @callflow(next="*")
     dumpDebugInfo() generates (string debugInfo);
 
-    /*
+    /**
      * Creates a client of the composer. All resources created by the client
      * are owned by the client and are only visible to the client.
      *
diff --git a/graphics/composer/2.1/IComposerCallback.hal b/graphics/composer/2.1/IComposerCallback.hal
index 541d7eb..ab74c30 100644
--- a/graphics/composer/2.1/IComposerCallback.hal
+++ b/graphics/composer/2.1/IComposerCallback.hal
@@ -20,13 +20,13 @@
     enum Connection : int32_t {
         INVALID = 0,
 
-        /* The display has been connected */
+        /** The display has been connected */
         CONNECTED = 1,
-        /* The display has been disconnected */
+        /** The display has been disconnected */
         DISCONNECTED = 2,
     };
 
-    /*
+    /**
      * Notifies the client that the given display has either been connected or
      * disconnected. Every active display (even a built-in physical display)
      * must trigger at least one hotplug notification, even if it only occurs
@@ -47,7 +47,7 @@
     @callflow(next="*")
     onHotplug(Display display, Connection connected);
 
-    /*
+    /**
      * Notifies the client to trigger a screen refresh. This forces all layer
      * state for this display to be resent, and the display to be validated
      * and presented, even if there have been no changes.
@@ -61,7 +61,7 @@
     @callflow(next="*")
     oneway onRefresh(Display display);
 
-    /*
+    /**
      * Notifies the client that a vsync event has occurred. This callback must
      * only be triggered when vsync is enabled for this display (through
      * setVsyncEnabled).
diff --git a/graphics/composer/2.1/IComposerClient.hal b/graphics/composer/2.1/IComposerClient.hal
index 107ac5e..85572d4 100644
--- a/graphics/composer/2.1/IComposerClient.hal
+++ b/graphics/composer/2.1/IComposerClient.hal
@@ -20,18 +20,18 @@
 import IComposerCallback;
 
 interface IComposerClient {
-    /* Display attributes queryable through getDisplayAttribute. */
+    /** Display attributes queryable through getDisplayAttribute. */
     enum Attribute : int32_t {
         INVALID = 0,
 
-        /* Dimensions in pixels */
+        /** Dimensions in pixels */
         WIDTH = 1,
         HEIGHT = 2,
 
-        /* Vsync period in nanoseconds */
+        /** Vsync period in nanoseconds */
         VSYNC_PERIOD = 3,
 
-        /*
+        /**
          * Dots per thousand inches (DPI * 1000). Scaling by 1000 allows these
          * numbers to be stored in an int32_t without losing too much
          * precision. If the DPI for a configuration is unavailable or is
@@ -41,15 +41,15 @@
         DPI_Y = 5,
     };
 
-    /* Display requests returned by getDisplayRequests. */
+    /** Display requests returned by getDisplayRequests. */
     enum DisplayRequest : uint32_t {
-        /*
+        /**
          * Instructs the client to provide a new client target buffer, even if
          * no layers are marked for client composition.
          */
         FLIP_CLIENT_TARGET = 1 << 0,
 
-        /*
+        /**
          * Instructs the client to write the result of client composition
          * directly into the virtual display output buffer. If any of the
          * layers are not marked as Composition::CLIENT or the given display
@@ -58,9 +58,9 @@
         WRITE_CLIENT_TARGET_TO_OUTPUT = 1 << 1,
     };
 
-    /* Layer requests returned from getDisplayRequests. */
+    /** Layer requests returned from getDisplayRequests. */
     enum LayerRequest : uint32_t {
-        /*
+        /**
          * The client must clear its target with transparent pixels where
          * this layer would be. The client may ignore this request if the
          * layer must be blended.
@@ -68,24 +68,24 @@
         CLEAR_CLIENT_TARGET = 1 << 0,
     };
 
-    /* Power modes for use with setPowerMode. */
+    /** Power modes for use with setPowerMode. */
     enum PowerMode : int32_t {
-        /* The display is fully off (blanked). */
+        /** The display is fully off (blanked). */
         OFF = 0,
 
-        /*
+        /**
          * These are optional low power modes. getDozeSupport may be called to
          * determine whether a given display supports these modes.
          */
 
-        /*
+        /**
          * The display is turned on and configured in a low power state that
          * is suitable for presenting ambient information to the user,
          * possibly with lower fidelity than ON, but with greater efficiency.
          */
         DOZE = 1,
 
-        /*
+        /**
          * The display is configured as in DOZE but may stop applying display
          * updates from the client. This is effectively a hint to the device
          * that drawing to the display has been suspended and that the the
@@ -100,40 +100,40 @@
          */
         DOZE_SUSPEND = 3,
 
-        /* The display is fully on. */
+        /** The display is fully on. */
         ON = 2,
     };
 
-    /* Vsync values passed to setVsyncEnabled. */
+    /** Vsync values passed to setVsyncEnabled. */
     enum Vsync : int32_t {
         INVALID = 0,
 
-        /* Enable vsync. */
+        /** Enable vsync. */
         ENABLE = 1,
 
-        /* Disable vsync. */
+        /** Disable vsync. */
         DISABLE = 2,
     };
 
-    /* Blend modes, settable per layer. */
+    /** Blend modes, settable per layer. */
     enum BlendMode : int32_t {
         INVALID = 0,
 
-        /* colorOut = colorSrc */
+        /** colorOut = colorSrc */
         NONE = 1,
 
-        /* colorOut = colorSrc + colorDst * (1 - alphaSrc) */
+        /** colorOut = colorSrc + colorDst * (1 - alphaSrc) */
         PREMULTIPLIED = 2,
 
-        /* colorOut = colorSrc * alphaSrc + colorDst * (1 - alphaSrc) */
+        /** colorOut = colorSrc * alphaSrc + colorDst * (1 - alphaSrc) */
         COVERAGE = 3,
     };
 
-    /* Possible composition types for a given layer. */
+    /** Possible composition types for a given layer. */
     enum Composition : int32_t {
         INVALID = 0,
 
-        /*
+        /**
          * The client must composite this layer into the client target buffer
          * (provided to the device through setClientTarget).
          *
@@ -142,7 +142,7 @@
          */
         CLIENT = 1,
 
-        /*
+        /**
          * The device must handle the composition of this layer through a
          * hardware overlay or other similar means.
          *
@@ -151,7 +151,7 @@
          */
         DEVICE = 2,
 
-        /*
+        /**
          * The device must render this layer using the color set through
          * setLayerColor. If this functionality is not supported on a layer
          * that the client sets to SOLID_COLOR, the device must request that
@@ -163,7 +163,7 @@
          */
         SOLID_COLOR = 3,
 
-        /*
+        /**
          * Similar to DEVICE, but the position of this layer may also be set
          * asynchronously through setCursorPosition. If this functionality is
          * not supported on a layer that the client sets to CURSOR, the device
@@ -177,7 +177,7 @@
          */
         CURSOR = 4,
 
-        /*
+        /**
          * The device must handle the composition of this layer, as well as
          * its buffer updates and content synchronization. Only supported on
          * devices which provide Capability::SIDEBAND_STREAM.
@@ -189,26 +189,26 @@
         SIDEBAND = 5,
     };
 
-    /* Display types returned by getDisplayType. */
+    /** Display types returned by getDisplayType. */
     enum DisplayType : int32_t {
         INVALID = 0,
 
-        /*
+        /**
          * All physical displays, including both internal displays and
          * hotpluggable external displays.
          */
         PHYSICAL = 1,
 
-        /* Virtual displays created by createVirtualDisplay. */
+        /** Virtual displays created by createVirtualDisplay. */
         VIRTUAL = 2,
     };
 
-    /* Special index values (always negative) for command queue commands. */
+    /** Special index values (always negative) for command queue commands. */
     enum HandleIndex : int32_t {
-        /* No handle */
+        /** No handle */
         EMPTY = -1,
 
-        /* Use cached handle */
+        /** Use cached handle */
         CACHED = -2,
     };
 
@@ -233,7 +233,7 @@
         uint8_t a;
     };
 
-    /*
+    /**
      * Provides a IComposerCallback object for the device to call.
      *
      * This function must be called only once.
@@ -244,7 +244,7 @@
     @callflow(next="*")
     registerCallback(IComposerCallback callback);
 
-    /*
+    /**
      * Returns the maximum number of virtual displays supported by this device
      * (which may be 0). The client must not attempt to create more than this
      * many virtual displays on this device. This number must not change for
@@ -255,7 +255,7 @@
     @callflow(next="*")
     getMaxVirtualDisplayCount() generates (uint32_t count);
 
-    /*
+    /**
      * Creates a new virtual display with the given width and height. The
      * format passed into this function is the default format requested by the
      * consumer of the virtual display output buffers.
@@ -286,7 +286,7 @@
                          Display display,
                          PixelFormat format);
 
-    /*
+    /**
      * Destroys a virtual display. After this call all resources consumed by
      * this display may be freed by the device and any operations performed on
      * this display must fail.
@@ -300,7 +300,7 @@
     @callflow(next="*")
     destroyVirtualDisplay(Display display) generates (Error error);
 
-    /*
+    /**
      * Creates a new layer on the given display.
      *
      * @param display is the display on which to create the layer.
@@ -317,7 +317,7 @@
      generates (Error error,
                 Layer layer);
 
-    /*
+    /**
      * Destroys the given layer.
      *
      * @param display is the display on which the layer was created.
@@ -329,7 +329,7 @@
     @callflow(next="*")
     destroyLayer(Display display, Layer layer) generates (Error error);
 
-    /*
+    /**
      * Retrieves which display configuration is currently active.
      *
      * If no display configuration is currently active, this function must
@@ -346,7 +346,7 @@
     @callflow(next="*")
     getActiveConfig(Display display) generates (Error error, Config config);
 
-    /*
+    /**
      * Returns whether a client target with the given properties can be
      * handled by the device.
      *
@@ -373,7 +373,7 @@
                            Dataspace dataspace)
                 generates (Error error);
 
-    /*
+    /**
      * Returns the color modes supported on this display.
      *
      * All devices must support at least ColorMode::NATIVE.
@@ -388,7 +388,7 @@
        generates (Error error,
                   vec<ColorMode> modes);
 
-    /*
+    /**
      * Returns a display attribute value for a particular display
      * configuration.
      *
@@ -410,7 +410,7 @@
              generates (Error error,
                         int32_t value);
 
-    /*
+    /**
      * Returns handles for all of the valid display configurations on this
      * display.
      *
@@ -424,7 +424,7 @@
            generates (Error error,
                       vec<Config> configs);
 
-    /*
+    /**
      * Returns a human-readable version of the display's name.
      *
      * @return error is NONE upon success. Otherwise,
@@ -434,7 +434,7 @@
     @callflow(next="*")
     getDisplayName(Display display) generates (Error error, string name);
 
-    /*
+    /**
      * Returns whether the given display is a physical or virtual display.
      *
      * @param display is the display to query.
@@ -445,7 +445,7 @@
     @callflow(next="*")
     getDisplayType(Display display) generates (Error error, DisplayType type);
 
-    /*
+    /**
      * Returns whether the given display supports PowerMode::DOZE and
      * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit over
      * DOZE (see the definition of PowerMode for more information), but if
@@ -460,7 +460,7 @@
     @callflow(next="*")
     getDozeSupport(Display display) generates (Error error, bool support);
 
-    /*
+    /**
      * Returns the high dynamic range (HDR) capabilities of the given display,
      * which are invariant with regard to the active configuration.
      *
@@ -486,7 +486,7 @@
                        float maxAverageLuminance,
                        float minLuminance);
 
-    /*
+    /**
      * Set the number of client target slots to be reserved.
      *
      * @param display is the display to which the slots are reserved.
@@ -500,7 +500,7 @@
                              uint32_t clientTargetSlotCount)
                   generates (Error error);
 
-    /*
+    /**
      * Sets the active configuration for this display. Upon returning, the
      * given display configuration must be active and remain so until either
      * this function is called again or the display is disconnected.
@@ -515,7 +515,7 @@
     @callflow(next="*")
     setActiveConfig(Display display, Config config) generates (Error error);
 
-    /*
+    /**
      * Sets the color mode of the given display.
      *
      * Upon returning from this function, the color mode change must have
@@ -534,7 +534,7 @@
     @callflow(next="*")
     setColorMode(Display display, ColorMode mode) generates (Error error);
 
-    /*
+    /**
      * Sets the power mode of the given display. The transition must be
      * complete when this function returns. It is valid to call this function
      * multiple times with the same power mode.
@@ -553,7 +553,7 @@
     @callflow(next="*")
     setPowerMode(Display display, PowerMode mode) generates (Error error);
 
-    /*
+    /**
      * Enables or disables the vsync signal for the given display. Virtual
      * displays never generate vsync callbacks, and any attempt to enable
      * vsync for a virtual display though this function must succeed and have
@@ -568,7 +568,7 @@
     @callflow(next="*")
     setVsyncEnabled(Display display, Vsync enabled) generates (Error error);
 
-    /*
+    /**
      * Sets the input command message queue.
      *
      * @param descriptor is the descriptor of the input command message queue.
@@ -579,7 +579,7 @@
     setInputCommandQueue(fmq_sync<uint32_t> descriptor)
               generates (Error error);
 
-    /*
+    /**
      * Gets the output command message queue.
      *
      * This function must only be called inside executeCommands closure.
@@ -593,7 +593,7 @@
               generates (Error error,
                          fmq_sync<uint32_t> descriptor);
 
-    /*
+    /**
      * Executes commands from the input command message queue. Return values
      * generated by the input commands are written to the output command
      * message queue in the form of value commands.
@@ -620,7 +620,7 @@
                     uint32_t outLength,
                     vec<handle> outHandles);
 
-    /*
+    /**
      * SELECT_DISPLAY has this pseudo prototype
      *
      *   selectDisplay(Display display);
@@ -1099,18 +1099,18 @@
         OPCODE_SHIFT                       = 16,
         OPCODE_MASK                        = 0xffff << OPCODE_SHIFT,
 
-        /* special commands */
+        /** special commands */
         SELECT_DISPLAY                     = 0x000 << OPCODE_SHIFT,
         SELECT_LAYER                       = 0x001 << OPCODE_SHIFT,
 
-        /* value commands (for return values) */
+        /** value commands (for return values) */
         SET_ERROR                          = 0x100 << OPCODE_SHIFT,
         SET_CHANGED_COMPOSITION_TYPES      = 0x101 << OPCODE_SHIFT,
         SET_DISPLAY_REQUESTS               = 0x102 << OPCODE_SHIFT,
         SET_PRESENT_FENCE                  = 0x103 << OPCODE_SHIFT,
         SET_RELEASE_FENCES                 = 0x104 << OPCODE_SHIFT,
 
-        /* display commands */
+        /** display commands */
         SET_COLOR_TRANSFORM                = 0x200 << OPCODE_SHIFT,
         SET_CLIENT_TARGET                  = 0x201 << OPCODE_SHIFT,
         SET_OUTPUT_BUFFER                  = 0x202 << OPCODE_SHIFT,
@@ -1118,12 +1118,12 @@
         ACCEPT_DISPLAY_CHANGES             = 0x204 << OPCODE_SHIFT,
         PRESENT_DISPLAY                    = 0x205 << OPCODE_SHIFT,
 
-        /* layer commands (VALIDATE_DISPLAY not required) */
+        /** layer commands (VALIDATE_DISPLAY not required) */
         SET_LAYER_CURSOR_POSITION          = 0x300 << OPCODE_SHIFT,
         SET_LAYER_BUFFER                   = 0x301 << OPCODE_SHIFT,
         SET_LAYER_SURFACE_DAMAGE           = 0x302 << OPCODE_SHIFT,
 
-        /* layer state commands (VALIDATE_DISPLAY required) */
+        /** layer state commands (VALIDATE_DISPLAY required) */
         SET_LAYER_BLEND_MODE               = 0x400 << OPCODE_SHIFT,
         SET_LAYER_COLOR                    = 0x401 << OPCODE_SHIFT,
         SET_LAYER_COMPOSITION_TYPE         = 0x402 << OPCODE_SHIFT,
@@ -1136,7 +1136,7 @@
         SET_LAYER_VISIBLE_REGION           = 0x409 << OPCODE_SHIFT,
         SET_LAYER_Z_ORDER                  = 0x40a << OPCODE_SHIFT,
 
-        /* 0x800 - 0xfff are reserved for vendor extensions */
-        /* 0x1000 - 0xffff are reserved */
+        /** 0x800 - 0xfff are reserved for vendor extensions */
+        /** 0x1000 - 0xffff are reserved */
     };
 };
diff --git a/graphics/composer/2.1/types.hal b/graphics/composer/2.1/types.hal
index e54031e..9f0dd8b 100644
--- a/graphics/composer/2.1/types.hal
+++ b/graphics/composer/2.1/types.hal
@@ -16,17 +16,17 @@
 
 package android.hardware.graphics.composer@2.1;
 
-/* Return codes from all functions. */
+/** Return codes from all functions. */
 enum Error : int32_t {
-    NONE            = 0, /* no error */
-    BAD_CONFIG      = 1, /* invalid Config */
-    BAD_DISPLAY     = 2, /* invalid Display */
-    BAD_LAYER       = 3, /* invalid Layer */
-    BAD_PARAMETER   = 4, /* invalid width, height, etc. */
-    /* 5 is reserved */
-    NO_RESOURCES    = 6, /* temporary failure due to resource contention */
-    NOT_VALIDATED   = 7, /* validateDisplay has not been called */
-    UNSUPPORTED     = 8, /* permanent failure */
+    NONE            = 0, /** no error */
+    BAD_CONFIG      = 1, /** invalid Config */
+    BAD_DISPLAY     = 2, /** invalid Display */
+    BAD_LAYER       = 3, /** invalid Layer */
+    BAD_PARAMETER   = 4, /** invalid width, height, etc. */
+    /** 5 is reserved */
+    NO_RESOURCES    = 6, /** temporary failure due to resource contention */
+    NOT_VALIDATED   = 7, /** validateDisplay has not been called */
+    UNSUPPORTED     = 8, /** permanent failure */
 };
 
 typedef uint32_t Config;
diff --git a/graphics/mapper/2.0/IMapper.hal b/graphics/mapper/2.0/IMapper.hal
index 21a6dfa..573dcd0 100644
--- a/graphics/mapper/2.0/IMapper.hal
+++ b/graphics/mapper/2.0/IMapper.hal
@@ -27,7 +27,7 @@
         int32_t height;
     };
 
-    /*
+    /**
      * Adds a reference to the given buffer handle.
      *
      * A buffer handle received from a remote process or exported by
@@ -49,7 +49,7 @@
     @callflow(next="*")
     retain(handle bufferHandle) generates (Error error);
 
-    /*
+    /**
      * Removes a reference from the given buffer buffer.
      *
      * If no references remain, the buffer handle must be freed with
@@ -65,7 +65,7 @@
     @exit
     release(handle bufferHandle) generates (Error error);
 
-    /*
+    /**
      * Gets the width and height of the buffer in pixels.
      *
      * See IAllocator::BufferDescriptorInfo for more information.
@@ -82,7 +82,7 @@
                   uint32_t width,
                   uint32_t height);
 
-    /*
+    /**
      * Gets the format of the buffer.
      *
      * See IAllocator::BufferDescriptorInfo for more information.
@@ -97,7 +97,7 @@
         generates (Error error,
                    PixelFormat format);
 
-    /*
+    /**
      * Gets the number of layers of the buffer.
      *
      * See IAllocator::BufferDescriptorInfo for more information.
@@ -112,7 +112,7 @@
        generates (Error error,
                   uint32_t layerCount);
 
-    /*
+    /**
      * Gets the producer usage flags which were used to allocate this buffer.
      *
      * See IAllocator::BufferDescriptorInfo for more information.
@@ -128,7 +128,7 @@
               generates (Error error,
                          uint64_t usageMask);
 
-    /*
+    /**
      * Gets the consumer usage flags which were used to allocate this buffer.
      *
      * See IAllocator::BufferDescriptorInfo for more information.
@@ -144,7 +144,7 @@
               generates (Error error,
                          uint64_t usageMask);
 
-    /*
+    /**
      * Gets a value that uniquely identifies the backing store of the given
      * buffer.
      *
@@ -165,7 +165,7 @@
          generates (Error error,
                     BackingStore store);
 
-    /*
+    /**
      * Gets the stride of the buffer in pixels.
      *
      * The stride is the offset in pixel-sized elements between the same
@@ -185,7 +185,7 @@
         generates (Error error,
                    uint32_t stride);
 
-    /*
+    /**
      * Locks the given buffer for the specified CPU usage.
      *
      * Exactly one of producerUsageMask and consumerUsageMask must be 0. The
@@ -247,7 +247,7 @@
         generates (Error error,
                    pointer data);
 
-    /*
+    /**
      * 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.
@@ -296,7 +296,7 @@
         generates (Error error,
                    FlexLayout layout);
 
-    /*
+    /**
      * This function indicates to the device that the client will be done with
      * the buffer when releaseFence signals.
      *
diff --git a/graphics/mapper/2.0/types.hal b/graphics/mapper/2.0/types.hal
index aa33141..2946e85 100644
--- a/graphics/mapper/2.0/types.hal
+++ b/graphics/mapper/2.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.graphics.mapper@2.0;
 
-/*
+/**
  * 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
@@ -49,19 +49,19 @@
  */
 
 enum FlexComponent : int32_t {
-    Y  = 1 << 0, /* luma */
-    CB = 1 << 1, /* chroma blue */
-    CR = 1 << 2, /* chroma red */
+    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 */
+    R  = 1 << 10, /** red */
+    G  = 1 << 11, /** green */
+    B  = 1 << 12, /** blue */
 
-    A  = 1 << 30, /* alpha */
+    A  = 1 << 30, /** alpha */
 };
 
 enum FlexFormat : int32_t {
-    /* not a flexible format */
+    /** not a flexible format */
     INVALID = 0x0,
 
     Y       = FlexComponent:Y,
@@ -73,38 +73,38 @@
 };
 
 struct FlexPlane {
-    /* Pointer to the first byte of the top-left pixel of the plane. */
+    /** Pointer to the first byte of the top-left pixel of the plane. */
     pointer 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 bitsPerComponent, inclusive.
      */
     int32_t bitsUsed;
 
-    /* Horizontal increment. */
+    /** Horizontal increment. */
     int32_t hIncrement;
-    /* Vertical increment. */
+    /** Vertical increment. */
     int32_t vIncrement;
-    /* Horizontal subsampling. Must be a positive power of 2. */
+    /** Horizontal subsampling. Must be a positive power of 2. */
     int32_t hSubsampling;
-    /* Vertical subsampling. Must be a positive power of 2. */
+    /** Vertical subsampling. Must be a positive power of 2. */
     int32_t vSubsampling;
 };
 
 struct FlexLayout {
-    /* The kind of flexible format. */
+    /** The kind of flexible format. */
     FlexFormat format;
 
-    /*
+    /**
      * A plane for each component; ordered in increasing component value
      * order. E.g. FlexFormat::RGBA maps 0 -> R, 1 -> G, etc.  Can have size 0
      * for FlexFormat::INVALID.
@@ -112,5 +112,5 @@
     vec<FlexPlane> planes;
 };
 
-/* Backing store ID of a buffer. See IMapper::getBackingStore. */
+/** Backing store ID of a buffer. See IMapper::getBackingStore. */
 typedef uint64_t BackingStore;
diff --git a/health/1.0/types.hal b/health/1.0/types.hal
index c5b5cc1..377d1bd 100644
--- a/health/1.0/types.hal
+++ b/health/1.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.health@1.0;
 
-/*
+/**
  * Possible return values for optional HAL method(s) like
  * IHealth::energyCounter()
  */
@@ -26,7 +26,7 @@
     UNKNOWN,
 };
 
-/*
+/**
  * Possible values for Battery Status.
  * Note: These are currently in sync with BatteryManager and must not
  * be extended / altered.
@@ -36,7 +36,7 @@
     UNKNOWN = 1,
     CHARGING = 2,
     DISCHARGING = 3,
-    /*
+    /**
      * Battery is *not* charging - special case when charger is present
      * but battery isn't charging
      */
@@ -44,7 +44,7 @@
     FULL = 5,
 };
 
-/*
+/**
  * Possible values for Battery Health.
  * Note: These are currently in sync with BatteryManager and must not
  * be extended / altered.
@@ -56,7 +56,7 @@
     OVERHEAT = 3,
     DEAD = 4,
     OVER_VOLTAGE = 5,
-    /*
+    /**
      * Battery experienced an unknown/unspecifid failure.
      */
     UNSPECIFIED_FAILURE = 6,
@@ -65,149 +65,149 @@
 
 struct HealthConfig {
 
-    /*
+    /**
      * periodicChoresIntervalFast is used while the device is not in
      * suspend, or in suspend and connected to a charger (to watch for battery
      * overheat due to charging)
      */
     int32_t periodicChoresIntervalFast;
 
-    /*
+    /**
      * periodicChoresIntervalSlow is used when the device is in suspend and
      * not connected to a charger (to watch for a battery drained to zero
      * remaining capacity).
      */
     int32_t periodicChoresIntervalSlow;
 
-    /*
+    /**
      * power_supply sysfs attribute file paths. Set these to specific paths
      * to use for the associated battery parameters. Clients must search
      * for appropriate power_supply attribute files to use, for any paths
      * left empty after the HAL is initialized.
      */
 
-    /*
+    /**
      * batteryStatusPath - file path to read battery charging status.
      * (POWER_SUPPLY_PROP_STATUS)
      */
     string batteryStatusPath;
 
 
-    /*
+    /**
      * batteryHealthPath - file path to read battery health.
      * (POWER_SUPPLY_PROP_HEALTH)
      */
     string batteryHealthPath;
 
-    /*
+    /**
      * batteryPresentPath - file path to read battery present status.
      * (POWER_SUPPLY_PROP_PRESENT)
      */
     string batteryPresentPath;
 
 
-    /*
+    /**
      * batteryCapacityPath - file path to read remaining battery capacity.
      * (POWER_SUPPLY_PROP_CAPACITY)
      */
     string batteryCapacityPath;
 
-    /*
+    /**
      * batteryVoltagePath - file path to read battery voltage.
      * (POWER_SUPPLY_PROP_VOLTAGE_NOW)
      */
     string batteryVoltagePath;
 
-    /*
+    /**
      * batteryTemperaturePath - file path to read battery temperature in tenths
      * of degree celcius. (POWER_SUPPLY_PROP_TEMP)
      */
     string batteryTemperaturePath;
 
-    /*
+    /**
      * batteryTechnologyPath - file path to read battery technology.
      * (POWER_SUPPLY_PROP_TECHNOLOGY)
      */
     string batteryTechnologyPath;
 
-    /*
+    /**
      * batteryCurrentNowPath - file path to read battery instantaneous current.
      * (POWER_SUPPLY_PROP_CURRENT_NOW)
      */
     string batteryCurrentNowPath;
 
-    /*
+    /**
      * batteryCurrentAvgPath - file path to read battery average current.
      * (POWER_SUPPLY_PROP_CURRENT_AVG)
      */
     string batteryCurrentAvgPath;
 
-    /*
+    /**
      * batteryChargeCounterPath - file path to read battery accumulated charge.
      * (POWER_SUPPLY_PROP_CHARGE_COUNTER)
      */
     string batteryChargeCounterPath;
 
-    /*
+    /**
      * batteryFullChargerPath - file path to read battery charge value when it
      * is considered to be full. (POWER_SUPPLY_PROP_CHARGE_FULL)
      */
     string batteryFullChargePath;
 
-    /*
+    /**
      * batteryCycleCountPath - file path to read battery charge cycle count.
      * (POWER_SUPPLY_PROP_CYCLE_COUNT)
      */
     string batteryCycleCountPath;
 };
 
-/*
+/**
  * The parameter to healthd mainloop update calls
  */
 struct HealthInfo {
-    /* AC charger state - 'true' if online */
+    /** AC charger state - 'true' if online */
     bool chargerAcOnline;
 
-    /* USB charger state - 'true' if online */
+    /** USB charger state - 'true' if online */
     bool chargerUsbOnline;
 
-    /* Wireless charger state - 'true' if online */
+    /** Wireless charger state - 'true' if online */
     bool chargerWirelessOnline;
 
-    /* Maximum charging current supported by charger in uA */
+    /** Maximum charging current supported by charger in uA */
     int32_t maxChargingCurrent;
 
-    /* Maximum charging voltage supported by charger in uV */
+    /** Maximum charging voltage supported by charger in uV */
     int32_t maxChargingVoltage;
 
     BatteryStatus batteryStatus;
 
     BatteryHealth batteryHealth;
 
-    /* 'true' if battery is present */
+    /** 'true' if battery is present */
     bool batteryPresent;
 
-    /* Remaining battery capacity in percent */
+    /** Remaining battery capacity in percent */
     int32_t batteryLevel;
 
-    /* Instantaneous battery voltage in uV */
+    /** Instantaneous battery voltage in uV */
     int32_t batteryVoltage;
 
-    /* Instantaneous battery temperature in tenths of degree celcius */
+    /** Instantaneous battery temperature in tenths of degree celcius */
     int32_t batteryTemperature;
 
-    /* Instantaneous battery current in uA */
+    /** Instantaneous battery current in uA */
     int32_t batteryCurrent;
 
-    /* Battery charge cycle count */
+    /** Battery charge cycle count */
     int32_t batteryCycleCount;
 
-    /* Battery charge value when it is considered to be "full" in uA-h */
+    /** Battery charge value when it is considered to be "full" in uA-h */
     int32_t batteryFullCharge;
 
-    /* Instantaneous battery capacity in uA-h */
+    /** Instantaneous battery capacity in uA-h */
     int32_t batteryChargeCounter;
 
-    /* Battery technology, e.g. "Li-ion, Li-Poly" etc. */
+    /** Battery technology, e.g. "Li-ion, Li-Poly" etc. */
     string batteryTechnology;
 };
diff --git a/ir/1.0/IConsumerIr.hal b/ir/1.0/IConsumerIr.hal
index f9e6316..0881dfb 100644
--- a/ir/1.0/IConsumerIr.hal
+++ b/ir/1.0/IConsumerIr.hal
@@ -17,7 +17,7 @@
 package android.hardware.ir@1.0;
 
 interface IConsumerIr {
-    /*
+    /**
      * transmit() sends an IR pattern at a given carrierFreq.
      *
      * The pattern is alternating series of carrier on and off periods measured in
@@ -30,7 +30,7 @@
      */
     transmit(int32_t carrierFreq, vec<int32_t> pattern) generates (bool success);
 
-    /*
+    /**
      * getCarrierFreqs() enumerates which frequencies the IR transmitter supports.
      *
      * returns: On success, true and a vector of all supported frequency
diff --git a/keymaster/3.0/default/KeymasterDevice.cpp b/keymaster/3.0/default/KeymasterDevice.cpp
index 720b946..6b4524b 100644
--- a/keymaster/3.0/default/KeymasterDevice.cpp
+++ b/keymaster/3.0/default/KeymasterDevice.cpp
@@ -698,14 +698,21 @@
     return legacy_enum_conversion(keymaster_device_->abort(keymaster_device_, operationHandle));
 }
 
-IKeymasterDevice* HIDL_FETCH_IKeymasterDevice(const char* /* name */) {
+IKeymasterDevice* HIDL_FETCH_IKeymasterDevice(const char* name) {
     keymaster2_device_t* dev = nullptr;
 
-    uint32_t version;
-    bool supports_ec;
-    bool supports_all_digests;
-    auto rc = keymaster_device_initialize(&dev, &version, &supports_ec, &supports_all_digests);
-    if (rc) return nullptr;
+    ALOGI("Fetching keymaster device name %s", name);
+
+    uint32_t version = -1;
+    bool supports_ec = false;
+    bool supports_all_digests = false;
+
+    if (name && strcmp(name, "softwareonly") == 0) {
+        dev = (new SoftKeymasterDevice(new SoftwareOnlyHidlKeymasterContext))->keymaster2_device();
+    } else if (name && strcmp(name, "default") == 0) {
+        auto rc = keymaster_device_initialize(&dev, &version, &supports_ec, &supports_all_digests);
+        if (rc) return nullptr;
+    }
 
     auto kmrc = ::keymaster::ConfigureDevice(dev);
     if (kmrc != KM_ERROR_OK) {
diff --git a/keymaster/3.0/types.hal b/keymaster/3.0/types.hal
index 1f4a0cc..6dad23e 100644
--- a/keymaster/3.0/types.hal
+++ b/keymaster/3.0/types.hal
@@ -17,40 +17,40 @@
 package android.hardware.keymaster@3.0;
 
 enum TagType : uint32_t {
-    INVALID = 0 << 28, /* Invalid type, used to designate a tag as uninitialized */
+    INVALID = 0 << 28, /** Invalid type, used to designate a tag as uninitialized */
     ENUM = 1 << 28,
-    ENUM_REP = 2 << 28, /* Repeatable enumeration value. */
+    ENUM_REP = 2 << 28, /** Repeatable enumeration value. */
     UINT = 3 << 28,
-    UINT_REP = 4 << 28, /* Repeatable integer value */
+    UINT_REP = 4 << 28, /** Repeatable integer value */
     ULONG = 5 << 28,
     DATE = 6 << 28,
     BOOL = 7 << 28,
     BIGNUM = 8 << 28,
     BYTES = 9 << 28,
-    ULONG_REP = 10 << 28, /* Repeatable long value */
+    ULONG_REP = 10 << 28, /** Repeatable long value */
 };
 
 enum Tag : uint32_t {
     INVALID = TagType:INVALID | 0,
 
-    /*
+    /**
      * Tags that must be semantically enforced by hardware and software implementations.
      */
 
-    /* Crypto parameters */
-    PURPOSE = TagType:ENUM_REP | 1,    /* KeyPurpose. */
-    ALGORITHM = TagType:ENUM | 2,      /* Algorithm. */
-    KEY_SIZE = TagType:UINT | 3,       /* Key size in bits. */
-    BLOCK_MODE = TagType:ENUM_REP | 4, /* BlockMode. */
-    DIGEST = TagType:ENUM_REP | 5,     /* Digest. */
-    PADDING = TagType:ENUM_REP | 6,    /* PaddingMode. */
-    CALLER_NONCE = TagType:BOOL | 7,   /* Allow caller to specify nonce or IV. */
+    /** Crypto parameters */
+    PURPOSE = TagType:ENUM_REP | 1,    /** KeyPurpose. */
+    ALGORITHM = TagType:ENUM | 2,      /** Algorithm. */
+    KEY_SIZE = TagType:UINT | 3,       /** Key size in bits. */
+    BLOCK_MODE = TagType:ENUM_REP | 4, /** BlockMode. */
+    DIGEST = TagType:ENUM_REP | 5,     /** Digest. */
+    PADDING = TagType:ENUM_REP | 6,    /** PaddingMode. */
+    CALLER_NONCE = TagType:BOOL | 7,   /** Allow caller to specify nonce or IV. */
     MIN_MAC_LENGTH = TagType:UINT | 8, /* Minimum length of MAC or AEAD authentication tag in
                                         * bits. */
-    KDF = TagType:ENUM_REP | 9,        /* KeyDerivationFunction. */
-    EC_CURVE = TagType:ENUM | 10,      /* EcCurve. */
+    KDF = TagType:ENUM_REP | 9,        /** KeyDerivationFunction. */
+    EC_CURVE = TagType:ENUM | 10,      /** EcCurve. */
 
-    /* Algorithm-specific. */
+    /** Algorithm-specific. */
     RSA_PUBLIC_EXPONENT = TagType:ULONG | 200,
     ECIES_SINGLE_HASH_MODE = TagType:BOOL | 201, /* Whether the ephemeral public key is fed into the
                                                   * KDF. */
@@ -58,17 +58,17 @@
                                                   * will contain an application-scoped and
                                                   * time-bounded device-unique ID.*/
 
-    /* Other hardware-enforced. */
-    BLOB_USAGE_REQUIREMENTS = TagType:ENUM | 301, /* KeyBlobUsageRequirements. */
-    BOOTLOADER_ONLY = TagType:BOOL | 302,         /* Usable only by bootloader. */
+    /** Other hardware-enforced. */
+    BLOB_USAGE_REQUIREMENTS = TagType:ENUM | 301, /** KeyBlobUsageRequirements. */
+    BOOTLOADER_ONLY = TagType:BOOL | 302,         /** Usable only by bootloader. */
 
-    /*
+    /**
      * Tags that should be semantically enforced by hardware if possible and will otherwise be
      * enforced by software (keystore).
      */
 
-    /* Key validity period */
-    ACTIVE_DATETIME = TagType:DATE | 400,             /* Start of validity. */
+    /** Key validity period */
+    ACTIVE_DATETIME = TagType:DATE | 400,             /** Start of validity. */
     ORIGINATION_EXPIRE_DATETIME = TagType:DATE | 401, /* Date when new "messages" should no longer
                                                        * be created. */
     USAGE_EXPIRE_DATETIME = TagType:DATE | 402,       /* Date when existing "messages" should no
@@ -78,13 +78,13 @@
     MAX_USES_PER_BOOT = TagType:UINT | 404,           /* Number of times the key can be used per
                                                        * boot. */
 
-    /* User authentication */
-    ALL_USERS = TagType:BOOL | 500,           /* Reserved for future use -- ignore. */
-    USER_ID = TagType:UINT | 501,             /* Reserved for future use -- ignore. */
+    /** User authentication */
+    ALL_USERS = TagType:BOOL | 500,           /** Reserved for future use -- ignore. */
+    USER_ID = TagType:UINT | 501,             /** Reserved for future use -- ignore. */
     USER_SECURE_ID = TagType:ULONG_REP | 502, /* Secure ID of authorized user or authenticator(s).
                                                * Disallowed if ALL_USERS or NO_AUTH_REQUIRED is
                                                * present. */
-    NO_AUTH_REQUIRED = TagType:BOOL | 503,    /* If key is usable without authentication. */
+    NO_AUTH_REQUIRED = TagType:BOOL | 503,    /** If key is usable without authentication. */
     USER_AUTH_TYPE = TagType:ENUM | 504,      /* Bitmask of authenticator types allowed when
                                                * USER_SECURE_ID contains a secure user ID, rather
                                                * than a secure authenticator ID.  Defined in
@@ -99,27 +99,27 @@
                                                * if device is still on-body (requires secure on-body
                                                * sensor. */
 
-    /* Application access control */
+    /** Application access control */
     ALL_APPLICATIONS = TagType:BOOL | 600, /* Specified to indicate key is usable by all
                                             * applications. */
-    APPLICATION_ID = TagType:BYTES | 601,  /* Byte string identifying the authorized application. */
+    APPLICATION_ID = TagType:BYTES | 601,  /** Byte string identifying the authorized application. */
     EXPORTABLE = TagType:BOOL | 602,       /* If true, private/secret key can be exported, but only
                                             * if all access control requirements for use are
                                             * met. (keymaster2) */
 
-    /*
+    /**
      * Semantically unenforceable tags, either because they have no specific meaning or because
      * they're informational only.
      */
-    APPLICATION_DATA = TagType:BYTES | 700,      /* Data provided by authorized application. */
-    CREATION_DATETIME = TagType:DATE | 701,      /* Key creation time */
-    ORIGIN = TagType:ENUM | 702,                 /* keymaster_key_origin_t. */
-    ROLLBACK_RESISTANT = TagType:BOOL | 703,     /* Whether key is rollback-resistant. */
-    ROOT_OF_TRUST = TagType:BYTES | 704,         /* Root of trust ID. */
-    OS_VERSION = TagType:UINT | 705,             /* Version of system (keymaster2) */
-    OS_PATCHLEVEL = TagType:UINT | 706,          /* Patch level of system (keymaster2) */
-    UNIQUE_ID = TagType:BYTES | 707,             /* Used to provide unique ID in attestation */
-    ATTESTATION_CHALLENGE = TagType:BYTES | 708, /* Used to provide challenge in attestation */
+    APPLICATION_DATA = TagType:BYTES | 700,      /** Data provided by authorized application. */
+    CREATION_DATETIME = TagType:DATE | 701,      /** Key creation time */
+    ORIGIN = TagType:ENUM | 702,                 /** keymaster_key_origin_t. */
+    ROLLBACK_RESISTANT = TagType:BOOL | 703,     /** Whether key is rollback-resistant. */
+    ROOT_OF_TRUST = TagType:BYTES | 704,         /** Root of trust ID. */
+    OS_VERSION = TagType:UINT | 705,             /** Version of system (keymaster2) */
+    OS_PATCHLEVEL = TagType:UINT | 706,          /** Patch level of system (keymaster2) */
+    UNIQUE_ID = TagType:BYTES | 707,             /** Used to provide unique ID in attestation */
+    ATTESTATION_CHALLENGE = TagType:BYTES | 708, /** Used to provide challenge in attestation */
     ATTESTATION_APPLICATION_ID = TagType:BYTES | 709, /* Used to identify the set of possible
                                                        * applications of which one has initiated a
                                                        * key attestation */
@@ -140,13 +140,13 @@
     ATTESTATION_ID_MODEL = TagType:BYTES | 717,  /* Used to provide the device's model name to be
                                                     included in attestation */
 
-    /* Tags used only to provide data to or receive data from operations */
-    ASSOCIATED_DATA = TagType:BYTES | 1000, /* Used to provide associated data for AEAD modes. */
-    NONCE = TagType:BYTES | 1001,           /* Nonce or Initialization Vector */
+    /** Tags used only to provide data to or receive data from operations */
+    ASSOCIATED_DATA = TagType:BYTES | 1000, /** Used to provide associated data for AEAD modes. */
+    NONCE = TagType:BYTES | 1001,           /** Nonce or Initialization Vector */
     AUTH_TOKEN = TagType:BYTES | 1002,      /* Authentication token that proves secure user
                                              * authentication has been performed.  Structure defined
                                              * in hw_auth_token_t in hw_auth_token.h. */
-    MAC_LENGTH = TagType:UINT | 1003,       /* MAC or AEAD authentication tag length in bits. */
+    MAC_LENGTH = TagType:UINT | 1003,       /** MAC or AEAD authentication tag length in bits. */
 
     RESET_SINCE_ID_ROTATION = TagType:BOOL | 1004, /* Whether the device has beeen factory reset
                                                     * since the last unique ID rotation.  Used for
@@ -154,15 +154,15 @@
 };
 
 enum Algorithm : uint32_t {
-    /* Asymmetric algorithms. */
+    /** Asymmetric algorithms. */
     RSA = 1,
     // DSA = 2, -- Removed, do not re-use value 2.
     EC = 3,
 
-    /* Block ciphers algorithms */
+    /** Block ciphers algorithms */
     AES = 32,
 
-    /* MAC algorithms */
+    /** MAC algorithms */
     HMAC = 128,
 };
 
@@ -170,13 +170,15 @@
  * Symmetric block cipher modes provided by keymaster implementations.
  */
 enum BlockMode : uint32_t {
-    /* Unauthenticated modes, usable only for encryption/decryption and not generally recommended
+    /**
+     * Unauthenticated modes, usable only for encryption/decryption and not generally recommended
      * except for compatibility with existing other protocols. */
     ECB = 1,
     CBC = 2,
     CTR = 3,
 
-    /* Authenticated modes, usable for encryption/decryption and signing/verification.  Recommended
+    /**
+     * Authenticated modes, usable for encryption/decryption and signing/verification.  Recommended
      * over unauthenticated modes for all purposes. */
     GCM = 32,
 };
@@ -188,7 +190,7 @@
  * cryptographically-appropriate pairs.
  */
 enum PaddingMode : uint32_t {
-    NONE = 1, /* deprecated */
+    NONE = 1, /** deprecated */
     RSA_OAEP = 2,
     RSA_PSS = 3,
     RSA_PKCS1_1_5_ENCRYPT = 4,
@@ -227,9 +229,9 @@
  * guaranteed never to have existed outide the secure hardware.
  */
 enum KeyOrigin : uint32_t {
-    GENERATED = 0, /* Generated in keymaster.  Should not exist outside the TEE. */
-    DERIVED = 1,   /* Derived inside keymaster.  Likely exists off-device. */
-    IMPORTED = 2,  /* Imported into keymaster.  Existed as cleartext in Android. */
+    GENERATED = 0, /** Generated in keymaster.  Should not exist outside the TEE. */
+    DERIVED = 1,   /** Derived inside keymaster.  Likely exists off-device. */
+    IMPORTED = 2,  /** Imported into keymaster.  Existed as cleartext in Android. */
     UNKNOWN = 3,   /* Keymaster did not record origin.  This value can only be seen on keys in a
                     * keymaster0 implementation.  The keymaster0 adapter uses this value to document
                     * the fact that it is unkown whether the key was generated inside or imported
@@ -252,12 +254,12 @@
  * Possible purposes of a key (or pair).
  */
 enum KeyPurpose : uint32_t {
-    ENCRYPT = 0,    /* Usable with RSA, EC and AES keys. */
-    DECRYPT = 1,    /* Usable with RSA, EC and AES keys. */
-    SIGN = 2,       /* Usable with RSA, EC and HMAC keys. */
-    VERIFY = 3,     /* Usable with RSA, EC and HMAC keys. */
-    DERIVE_KEY = 4, /* Usable with EC keys. */
-    WRAP_KEY = 5,   /* Usable with wrapping keys. */
+    ENCRYPT = 0,    /** Usable with RSA, EC and AES keys. */
+    DECRYPT = 1,    /** Usable with RSA, EC and AES keys. */
+    SIGN = 2,       /** Usable with RSA, EC and HMAC keys. */
+    VERIFY = 3,     /** Usable with RSA, EC and HMAC keys. */
+    DERIVE_KEY = 4, /** Usable with EC keys. */
+    WRAP_KEY = 5,   /** Usable with wrapping keys. */
 };
 
 /**
@@ -283,8 +285,8 @@
     INVALID_AUTHORIZATION_TIMEOUT = -16,
     UNSUPPORTED_KEY_FORMAT = -17,
     INCOMPATIBLE_KEY_FORMAT = -18,
-    UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = -19,   /* For PKCS8 & PKCS12 */
-    UNSUPPORTED_KEY_VERIFICATION_ALGORITHM = -20, /* For PKCS8 & PKCS12 */
+    UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = -19,   /** For PKCS8 & PKCS12 */
+    UNSUPPORTED_KEY_VERIFICATION_ALGORITHM = -20, /** For PKCS8 & PKCS12 */
     INVALID_INPUT_LENGTH = -21,
     KEY_EXPORT_OPTIONS_INVALID = -22,
     DELEGATION_NOT_ALLOWED = -23,
@@ -340,17 +342,17 @@
  * Key derivation functions, mostly used in ECIES.
  */
 enum KeyDerivationFunction : uint32_t {
-    /* Do not apply a key derivation function; use the raw agreed key */
+    /** Do not apply a key derivation function; use the raw agreed key */
     NONE = 0,
-    /* HKDF defined in RFC 5869 with SHA256 */
+    /** HKDF defined in RFC 5869 with SHA256 */
     RFC5869_SHA256 = 1,
-    /* KDF1 defined in ISO 18033-2 with SHA1 */
+    /** KDF1 defined in ISO 18033-2 with SHA1 */
     ISO18033_2_KDF1_SHA1 = 2,
-    /* KDF1 defined in ISO 18033-2 with SHA256 */
+    /** KDF1 defined in ISO 18033-2 with SHA256 */
     ISO18033_2_KDF1_SHA256 = 3,
-    /* KDF2 defined in ISO 18033-2 with SHA1 */
+    /** KDF2 defined in ISO 18033-2 with SHA1 */
     ISO18033_2_KDF2_SHA1 = 4,
-    /* KDF2 defined in ISO 18033-2 with SHA256 */
+    /** KDF2 defined in ISO 18033-2 with SHA256 */
     ISO18033_2_KDF2_SHA256 = 5,
 };
 
@@ -368,11 +370,12 @@
 };
 
 struct KeyParameter {
-    /* Discriminates the uinon/blob field used.  The blob cannot be coincided with the union, but
+    /**
+     * Discriminates the uinon/blob field used.  The blob cannot be coincided with the union, but
      * only one of "f" and "blob" is ever used at a time. */
     Tag tag;
     union IntegerParams {
-        /* Enum types */
+        /** Enum types */
         Algorithm algorithm;
         BlockMode blockMode;
         PaddingMode paddingMode;
@@ -384,7 +387,7 @@
         KeyDerivationFunction keyDerivationFunction;
         HardwareAuthenticatorType hardwareAuthenticatorType;
 
-        /* Other types */
+        /** Other types */
         bool boolValue;  // Always true, if a boolean tag is present.
         uint32_t integer;
         uint64_t longInteger;
@@ -424,8 +427,8 @@
  * Formats for key import and export.
  */
 enum KeyFormat : uint32_t {
-    X509 = 0,  /* for public key export */
-    PKCS8 = 1, /* for asymmetric key pair import */
+    X509 = 0,  /** for public key export */
+    PKCS8 = 1, /** for asymmetric key pair import */
     RAW = 3,   /* for symmetric key import and export*/
 };
 
diff --git a/keymaster/3.0/vts/functional/Android.mk b/keymaster/3.0/vts/functional/Android.mk
new file mode 100644
index 0000000..4265b9f
--- /dev/null
+++ b/keymaster/3.0/vts/functional/Android.mk
@@ -0,0 +1,39 @@
+# Copyright (C) 2017 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 := keymaster_hidl_hal_test
+LOCAL_SRC_FILES := \
+        authorization_set.cpp \
+        attestation_record.cpp \
+        key_param_output.cpp \
+        keymaster_hidl_hal_test.cpp \
+        keystore_tags_utils.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+        android.hardware.keymaster@3.0 \
+        libcrypto \
+        libhidlbase \
+        liblog \
+        libsoftkeymasterdevice \
+        libutils \
+
+LOCAL_STATIC_LIBRARIES := \
+        VtsHalHidlTargetTestBase \
+
+LOCAL_CFLAGS := -Wall -Werror
+
+include $(BUILD_NATIVE_TEST)
diff --git a/keymaster/3.0/vts/functional/attestation_record.cpp b/keymaster/3.0/vts/functional/attestation_record.cpp
new file mode 100644
index 0000000..6cdd44c
--- /dev/null
+++ b/keymaster/3.0/vts/functional/attestation_record.cpp
@@ -0,0 +1,289 @@
+/*
+ * 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.
+ */
+
+#include "attestation_record.h"
+
+#include <assert.h>
+
+#include <openssl/asn1t.h>
+#include <openssl/bn.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+
+#include "openssl_utils.h"
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+struct stack_st_ASN1_TYPE_Delete {
+    void operator()(stack_st_ASN1_TYPE* p) { sk_ASN1_TYPE_free(p); }
+};
+
+struct ASN1_STRING_Delete {
+    void operator()(ASN1_STRING* p) { ASN1_STRING_free(p); }
+};
+
+struct ASN1_TYPE_Delete {
+    void operator()(ASN1_TYPE* p) { ASN1_TYPE_free(p); }
+};
+
+#define ASN1_INTEGER_SET STACK_OF(ASN1_INTEGER)
+
+typedef struct km_root_of_trust {
+    ASN1_OCTET_STRING* verified_boot_key;
+    ASN1_BOOLEAN* device_locked;
+    ASN1_ENUMERATED* verified_boot_state;
+} KM_ROOT_OF_TRUST;
+
+ASN1_SEQUENCE(KM_ROOT_OF_TRUST) = {
+    ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_key, ASN1_OCTET_STRING),
+    ASN1_SIMPLE(KM_ROOT_OF_TRUST, device_locked, ASN1_BOOLEAN),
+    ASN1_SIMPLE(KM_ROOT_OF_TRUST, verified_boot_state, ASN1_ENUMERATED),
+} ASN1_SEQUENCE_END(KM_ROOT_OF_TRUST);
+IMPLEMENT_ASN1_FUNCTIONS(KM_ROOT_OF_TRUST);
+
+typedef struct km_auth_list {
+    ASN1_INTEGER_SET* purpose;
+    ASN1_INTEGER* algorithm;
+    ASN1_INTEGER* key_size;
+    ASN1_INTEGER_SET* digest;
+    ASN1_INTEGER_SET* padding;
+    ASN1_INTEGER_SET* kdf;
+    ASN1_INTEGER* ec_curve;
+    ASN1_INTEGER* rsa_public_exponent;
+    ASN1_INTEGER* active_date_time;
+    ASN1_INTEGER* origination_expire_date_time;
+    ASN1_INTEGER* usage_expire_date_time;
+    ASN1_NULL* no_auth_required;
+    ASN1_INTEGER* user_auth_type;
+    ASN1_INTEGER* auth_timeout;
+    ASN1_NULL* allow_while_on_body;
+    ASN1_NULL* all_applications;
+    ASN1_OCTET_STRING* application_id;
+    ASN1_INTEGER* creation_date_time;
+    ASN1_INTEGER* origin;
+    ASN1_NULL* rollback_resistant;
+    KM_ROOT_OF_TRUST* root_of_trust;
+    ASN1_INTEGER* os_version;
+    ASN1_INTEGER* os_patchlevel;
+    ASN1_OCTET_STRING* attestation_application_id;
+} KM_AUTH_LIST;
+
+ASN1_SEQUENCE(KM_AUTH_LIST) = {
+    ASN1_EXP_SET_OF_OPT(KM_AUTH_LIST, purpose, ASN1_INTEGER, TAG_PURPOSE.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, algorithm, ASN1_INTEGER, TAG_ALGORITHM.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, key_size, ASN1_INTEGER, TAG_KEY_SIZE.maskedTag()),
+    ASN1_EXP_SET_OF_OPT(KM_AUTH_LIST, digest, ASN1_INTEGER, TAG_DIGEST.maskedTag()),
+    ASN1_EXP_SET_OF_OPT(KM_AUTH_LIST, padding, ASN1_INTEGER, TAG_PADDING.maskedTag()),
+    ASN1_EXP_SET_OF_OPT(KM_AUTH_LIST, kdf, ASN1_INTEGER, TAG_KDF.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, ec_curve, ASN1_INTEGER, TAG_EC_CURVE.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, rsa_public_exponent, ASN1_INTEGER,
+                 TAG_RSA_PUBLIC_EXPONENT.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, active_date_time, ASN1_INTEGER, TAG_ACTIVE_DATETIME.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, origination_expire_date_time, ASN1_INTEGER,
+                 TAG_ORIGINATION_EXPIRE_DATETIME.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, usage_expire_date_time, ASN1_INTEGER,
+                 TAG_USAGE_EXPIRE_DATETIME.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, no_auth_required, ASN1_NULL, TAG_NO_AUTH_REQUIRED.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, user_auth_type, ASN1_INTEGER, TAG_USER_AUTH_TYPE.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, auth_timeout, ASN1_INTEGER, TAG_AUTH_TIMEOUT.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, allow_while_on_body, ASN1_NULL, TAG_ALLOW_WHILE_ON_BODY.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, all_applications, ASN1_NULL, TAG_ALL_APPLICATIONS.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, application_id, ASN1_OCTET_STRING, TAG_APPLICATION_ID.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, creation_date_time, ASN1_INTEGER, TAG_CREATION_DATETIME.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, origin, ASN1_INTEGER, TAG_ORIGIN.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, rollback_resistant, ASN1_NULL, TAG_ROLLBACK_RESISTANT.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, root_of_trust, KM_ROOT_OF_TRUST, TAG_ROOT_OF_TRUST.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, os_version, ASN1_INTEGER, TAG_OS_VERSION.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, os_patchlevel, ASN1_INTEGER, TAG_OS_PATCHLEVEL.maskedTag()),
+    ASN1_EXP_OPT(KM_AUTH_LIST, attestation_application_id, ASN1_OCTET_STRING,
+                 TAG_ATTESTATION_APPLICATION_ID.maskedTag()),
+} ASN1_SEQUENCE_END(KM_AUTH_LIST);
+IMPLEMENT_ASN1_FUNCTIONS(KM_AUTH_LIST);
+
+typedef struct km_key_description {
+    ASN1_INTEGER* attestation_version;
+    ASN1_ENUMERATED* attestation_security_level;
+    ASN1_INTEGER* keymaster_version;
+    ASN1_ENUMERATED* keymaster_security_level;
+    ASN1_OCTET_STRING* attestation_challenge;
+    KM_AUTH_LIST* software_enforced;
+    KM_AUTH_LIST* tee_enforced;
+    ASN1_INTEGER* unique_id;
+} KM_KEY_DESCRIPTION;
+
+ASN1_SEQUENCE(KM_KEY_DESCRIPTION) = {
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, attestation_version, ASN1_INTEGER),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, attestation_security_level, ASN1_ENUMERATED),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, keymaster_version, ASN1_INTEGER),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, keymaster_security_level, ASN1_ENUMERATED),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, attestation_challenge, ASN1_OCTET_STRING),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, unique_id, ASN1_OCTET_STRING),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, software_enforced, KM_AUTH_LIST),
+    ASN1_SIMPLE(KM_KEY_DESCRIPTION, tee_enforced, KM_AUTH_LIST),
+} ASN1_SEQUENCE_END(KM_KEY_DESCRIPTION);
+IMPLEMENT_ASN1_FUNCTIONS(KM_KEY_DESCRIPTION);
+
+template <Tag tag>
+void copyAuthTag(const stack_st_ASN1_INTEGER* stack, TypedTag<TagType::ENUM_REP, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    typedef typename TypedTag2ValueType<decltype(ttag)>::type ValueT;
+    for (size_t i = 0; i < sk_ASN1_INTEGER_num(stack); ++i) {
+        auth_list->push_back(
+            ttag, static_cast<ValueT>(ASN1_INTEGER_get(sk_ASN1_INTEGER_value(stack, i))));
+    }
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_INTEGER* asn1_int, TypedTag<TagType::ENUM, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    typedef typename TypedTag2ValueType<decltype(ttag)>::type ValueT;
+    if (!asn1_int) return;
+    auth_list->push_back(ttag, static_cast<ValueT>(ASN1_INTEGER_get(asn1_int)));
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_INTEGER* asn1_int, TypedTag<TagType::UINT, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    if (!asn1_int) return;
+    auth_list->push_back(ttag, ASN1_INTEGER_get(asn1_int));
+}
+
+BIGNUM* construct_uint_max() {
+    BIGNUM* value = BN_new();
+    BIGNUM_Ptr one(BN_new());
+    BN_one(one.get());
+    BN_lshift(value, one.get(), 32);
+    return value;
+}
+
+uint64_t BignumToUint64(BIGNUM* num) {
+    static_assert((sizeof(BN_ULONG) == sizeof(uint32_t)) || (sizeof(BN_ULONG) == sizeof(uint64_t)),
+                  "This implementation only supports 32 and 64-bit BN_ULONG");
+    if (sizeof(BN_ULONG) == sizeof(uint32_t)) {
+        BIGNUM_Ptr uint_max(construct_uint_max());
+        BIGNUM_Ptr hi(BN_new()), lo(BN_new());
+        BN_CTX_Ptr ctx(BN_CTX_new());
+        BN_div(hi.get(), lo.get(), num, uint_max.get(), ctx.get());
+        return static_cast<uint64_t>(BN_get_word(hi.get())) << 32 | BN_get_word(lo.get());
+    } else if (sizeof(BN_ULONG) == sizeof(uint64_t)) {
+        return BN_get_word(num);
+    } else {
+        return 0;
+    }
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_INTEGER* asn1_int, TypedTag<TagType::ULONG, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    if (!asn1_int) return;
+    BIGNUM_Ptr num(ASN1_INTEGER_to_BN(asn1_int, nullptr));
+    auth_list->push_back(ttag, BignumToUint64(num.get()));
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_INTEGER* asn1_int, TypedTag<TagType::DATE, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    if (!asn1_int) return;
+    BIGNUM_Ptr num(ASN1_INTEGER_to_BN(asn1_int, nullptr));
+    auth_list->push_back(ttag, BignumToUint64(num.get()));
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_NULL* asn1_null, TypedTag<TagType::BOOL, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    if (!asn1_null) return;
+    auth_list->push_back(ttag);
+}
+
+template <Tag tag>
+void copyAuthTag(const ASN1_OCTET_STRING* asn1_string, TypedTag<TagType::BYTES, tag> ttag,
+                 AuthorizationSet* auth_list) {
+    if (!asn1_string) return;
+    hidl_vec<uint8_t> buf;
+    buf.setToExternal(asn1_string->data, asn1_string->length);
+    auth_list->push_back(ttag, buf);
+}
+
+// Extract the values from the specified ASN.1 record and place them in auth_list.
+static ErrorCode extract_auth_list(const KM_AUTH_LIST* record, AuthorizationSet* auth_list) {
+    if (!record) return ErrorCode::OK;
+
+    copyAuthTag(record->active_date_time, TAG_ACTIVE_DATETIME, auth_list);
+    copyAuthTag(record->algorithm, TAG_ALGORITHM, auth_list);
+    copyAuthTag(record->all_applications, TAG_ALL_APPLICATIONS, auth_list);
+    copyAuthTag(record->application_id, TAG_APPLICATION_ID, auth_list);
+    copyAuthTag(record->auth_timeout, TAG_AUTH_TIMEOUT, auth_list);
+    copyAuthTag(record->creation_date_time, TAG_CREATION_DATETIME, auth_list);
+    copyAuthTag(record->digest, TAG_DIGEST, auth_list);
+    copyAuthTag(record->ec_curve, TAG_EC_CURVE, auth_list);
+    copyAuthTag(record->key_size, TAG_KEY_SIZE, auth_list);
+    copyAuthTag(record->no_auth_required, TAG_NO_AUTH_REQUIRED, auth_list);
+    copyAuthTag(record->origin, TAG_ORIGIN, auth_list);
+    copyAuthTag(record->origination_expire_date_time, TAG_ORIGINATION_EXPIRE_DATETIME, auth_list);
+    copyAuthTag(record->os_patchlevel, TAG_OS_PATCHLEVEL, auth_list);
+    copyAuthTag(record->os_version, TAG_OS_VERSION, auth_list);
+    copyAuthTag(record->padding, TAG_PADDING, auth_list);
+    copyAuthTag(record->purpose, TAG_PURPOSE, auth_list);
+    copyAuthTag(record->rollback_resistant, TAG_ROLLBACK_RESISTANT, auth_list);
+    copyAuthTag(record->rsa_public_exponent, TAG_RSA_PUBLIC_EXPONENT, auth_list);
+    copyAuthTag(record->usage_expire_date_time, TAG_USAGE_EXPIRE_DATETIME, auth_list);
+    copyAuthTag(record->user_auth_type, TAG_USER_AUTH_TYPE, auth_list);
+
+    return ErrorCode::OK;
+}
+
+MAKE_OPENSSL_PTR_TYPE(KM_KEY_DESCRIPTION)
+
+// Parse the DER-encoded attestation record, placing the results in keymaster_version,
+// attestation_challenge, software_enforced, tee_enforced and unique_id.
+ErrorCode parse_attestation_record(const uint8_t* asn1_key_desc, size_t asn1_key_desc_len,
+                                   uint32_t* attestation_version,  //
+                                   SecurityLevel* attestation_security_level,
+                                   uint32_t* keymaster_version,
+                                   SecurityLevel* keymaster_security_level,
+                                   hidl_vec<uint8_t>* attestation_challenge,
+                                   AuthorizationSet* software_enforced,
+                                   AuthorizationSet* tee_enforced,  //
+                                   hidl_vec<uint8_t>* unique_id) {
+    const uint8_t* p = asn1_key_desc;
+    KM_KEY_DESCRIPTION_Ptr record(d2i_KM_KEY_DESCRIPTION(nullptr, &p, asn1_key_desc_len));
+    if (!record.get()) return ErrorCode::UNKNOWN_ERROR;
+
+    *attestation_version = ASN1_INTEGER_get(record->attestation_version);
+    *attestation_security_level =
+        static_cast<SecurityLevel>(ASN1_ENUMERATED_get(record->attestation_security_level));
+    *keymaster_version = ASN1_INTEGER_get(record->keymaster_version);
+    *keymaster_security_level =
+        static_cast<SecurityLevel>(ASN1_ENUMERATED_get(record->keymaster_security_level));
+
+    attestation_challenge->setToExternal(record->attestation_challenge->data,
+                                         record->attestation_challenge->length);
+
+    unique_id->setToExternal(record->unique_id->data, record->unique_id->length);
+
+    ErrorCode error = extract_auth_list(record->software_enforced, software_enforced);
+    if (error != ErrorCode::OK) return error;
+
+    return extract_auth_list(record->tee_enforced, tee_enforced);
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
diff --git a/keymaster/3.0/vts/functional/attestation_record.h b/keymaster/3.0/vts/functional/attestation_record.h
new file mode 100644
index 0000000..a042055
--- /dev/null
+++ b/keymaster/3.0/vts/functional/attestation_record.h
@@ -0,0 +1,57 @@
+/*
+ * 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 HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_ATTESTATION_RECORD_H_
+#define HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_ATTESTATION_RECORD_H_
+
+#include "authorization_set.h"
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+/**
+ * The OID for Android attestation records.  For the curious, it breaks down as follows:
+ *
+ * 1 = ISO
+ * 3 = org
+ * 6 = DoD (Huh? OIDs are weird.)
+ * 1 = IANA
+ * 4 = Private
+ * 1 = Enterprises
+ * 11129 = Google
+ * 2 = Google security
+ * 1 = certificate extension
+ * 17 = Android attestation extension.
+ */
+static const char kAttestionRecordOid[] = "1.3.6.1.4.1.11129.2.1.17";
+
+ErrorCode parse_attestation_record(const uint8_t* asn1_key_desc, size_t asn1_key_desc_len,
+                                   uint32_t* attestation_version,  //
+                                   SecurityLevel* attestation_security_level,
+                                   uint32_t* keymaster_version,
+                                   SecurityLevel* keymaster_security_level,
+                                   hidl_vec<uint8_t>* attestation_challenge,
+                                   AuthorizationSet* software_enforced,
+                                   AuthorizationSet* tee_enforced,  //
+                                   hidl_vec<uint8_t>* unique_id);
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_ATTESTATION_RECORD_H_
diff --git a/keymaster/3.0/vts/functional/authorization_set.cpp b/keymaster/3.0/vts/functional/authorization_set.cpp
new file mode 100644
index 0000000..303f7e7
--- /dev/null
+++ b/keymaster/3.0/vts/functional/authorization_set.cpp
@@ -0,0 +1,422 @@
+/*
+ * Copyright (C) 2014 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 "authorization_set.h"
+
+#include <assert.h>
+#include <istream>
+#include <limits>
+#include <ostream>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <new>
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+inline bool keyParamLess(const KeyParameter& a, const KeyParameter& b) {
+    if (a.tag != b.tag) return a.tag < b.tag;
+    int retval;
+    switch (typeFromTag(a.tag)) {
+    case TagType::INVALID:
+    case TagType::BOOL:
+        return false;
+    case TagType::ENUM:
+    case TagType::ENUM_REP:
+    case TagType::UINT:
+    case TagType::UINT_REP:
+        return a.f.integer < b.f.integer;
+    case TagType::ULONG:
+    case TagType::ULONG_REP:
+        return a.f.longInteger < b.f.longInteger;
+    case TagType::DATE:
+        return a.f.dateTime < b.f.dateTime;
+    case TagType::BIGNUM:
+    case TagType::BYTES:
+        // Handle the empty cases.
+        if (a.blob.size() == 0) return b.blob.size() != 0;
+        if (b.blob.size() == 0) return false;
+
+        retval = memcmp(&a.blob[0], &b.blob[0], std::min(a.blob.size(), b.blob.size()));
+        if (retval == 0) {
+            // One is the prefix of the other, so the longer wins
+            return a.blob.size() < b.blob.size();
+        } else {
+            return retval < 0;
+        }
+    }
+    return false;
+}
+
+inline bool keyParamEqual(const KeyParameter& a, const KeyParameter& b) {
+    if (a.tag != b.tag) return false;
+
+    switch (typeFromTag(a.tag)) {
+    case TagType::INVALID:
+    case TagType::BOOL:
+        return true;
+    case TagType::ENUM:
+    case TagType::ENUM_REP:
+    case TagType::UINT:
+    case TagType::UINT_REP:
+        return a.f.integer == b.f.integer;
+    case TagType::ULONG:
+    case TagType::ULONG_REP:
+        return a.f.longInteger == b.f.longInteger;
+    case TagType::DATE:
+        return a.f.dateTime == b.f.dateTime;
+    case TagType::BIGNUM:
+    case TagType::BYTES:
+        if (a.blob.size() != b.blob.size()) return false;
+        return a.blob.size() == 0 || memcmp(&a.blob[0], &b.blob[0], a.blob.size()) == 0;
+    }
+    return false;
+}
+
+void AuthorizationSet::Sort() {
+    std::sort(data_.begin(), data_.end(), keyParamLess);
+}
+
+void AuthorizationSet::Deduplicate() {
+    if (data_.empty()) return;
+
+    Sort();
+    std::vector<KeyParameter> result;
+
+    auto curr = data_.begin();
+    auto prev = curr++;
+    for (; curr != data_.end(); ++prev, ++curr) {
+        if (prev->tag == Tag::INVALID) continue;
+
+        if (!keyParamEqual(*prev, *curr)) {
+            result.emplace_back(std::move(*prev));
+        }
+    }
+    result.emplace_back(std::move(*prev));
+
+    std::swap(data_, result);
+}
+
+void AuthorizationSet::Union(const AuthorizationSet& other) {
+    data_.insert(data_.end(), other.data_.begin(), other.data_.end());
+    Deduplicate();
+}
+
+void AuthorizationSet::Subtract(const AuthorizationSet& other) {
+    Deduplicate();
+
+    auto i = other.begin();
+    while (i != other.end()) {
+        int pos = -1;
+        do {
+            pos = find(i->tag, pos);
+            if (pos != -1 && keyParamEqual(*i, data_[pos])) {
+                data_.erase(data_.begin() + pos);
+                break;
+            }
+        } while (pos != -1);
+        ++i;
+    }
+}
+
+int AuthorizationSet::find(Tag tag, int begin) const {
+    auto iter = data_.begin() + (1 + begin);
+
+    while (iter != data_.end() && iter->tag != tag)
+        ++iter;
+
+    if (iter != data_.end()) return iter - data_.begin();
+    return -1;
+}
+
+bool AuthorizationSet::erase(int index) {
+    auto pos = data_.begin() + index;
+    if (pos != data_.end()) {
+        data_.erase(pos);
+        return true;
+    }
+    return false;
+}
+
+KeyParameter& AuthorizationSet::operator[](int at) {
+    return data_[at];
+}
+
+const KeyParameter& AuthorizationSet::operator[](int at) const {
+    return data_[at];
+}
+
+void AuthorizationSet::Clear() {
+    data_.clear();
+}
+
+size_t AuthorizationSet::GetTagCount(Tag tag) const {
+    size_t count = 0;
+    for (int pos = -1; (pos = find(tag, pos)) != -1;)
+        ++count;
+    return count;
+}
+
+NullOr<const KeyParameter&> AuthorizationSet::GetEntry(Tag tag) const {
+    int pos = find(tag);
+    if (pos == -1) return {};
+    return data_[pos];
+}
+
+/**
+ * Persistent format is:
+ * | 32 bit indirect_size         |
+ * --------------------------------
+ * | indirect_size bytes of data  | this is where the blob data is stored
+ * --------------------------------
+ * | 32 bit element_count         | number of entries
+ * | 32 bit elements_size         | total bytes used by entries (entries have variable length)
+ * --------------------------------
+ * | elementes_size bytes of data | where the elements are stored
+ */
+
+/**
+ * Persistent format of blobs and bignums:
+ * | 32 bit tag             |
+ * | 32 bit blob_length     |
+ * | 32 bit indirect_offset |
+ */
+
+struct OutStreams {
+    std::ostream& indirect;
+    std::ostream& elements;
+};
+
+OutStreams& serializeParamValue(OutStreams& out, const hidl_vec<uint8_t>& blob) {
+    uint32_t buffer;
+
+    // write blob_length
+    auto blob_length = blob.size();
+    if (blob_length > std::numeric_limits<uint32_t>::max()) {
+        out.elements.setstate(std::ios_base::badbit);
+        return out;
+    }
+    buffer = blob_length;
+    out.elements.write(reinterpret_cast<const char*>(&buffer), sizeof(uint32_t));
+
+    // write indirect_offset
+    auto offset = out.indirect.tellp();
+    if (offset < 0 || offset > std::numeric_limits<uint32_t>::max() ||
+        static_cast<uint32_t>((std::numeric_limits<uint32_t>::max() - offset)) <
+            blob_length) {  // overflow check
+        out.elements.setstate(std::ios_base::badbit);
+        return out;
+    }
+    buffer = offset;
+    out.elements.write(reinterpret_cast<const char*>(&buffer), sizeof(uint32_t));
+
+    // write blob to indirect stream
+    if (blob_length) out.indirect.write(reinterpret_cast<const char*>(&blob[0]), blob_length);
+
+    return out;
+}
+
+template <typename T> OutStreams& serializeParamValue(OutStreams& out, const T& value) {
+    out.elements.write(reinterpret_cast<const char*>(&value), sizeof(T));
+    return out;
+}
+
+OutStreams& serialize(TAG_INVALID_t&&, OutStreams& out, const KeyParameter&) {
+    // skip invalid entries.
+    return out;
+}
+template <typename T> OutStreams& serialize(T ttag, OutStreams& out, const KeyParameter& param) {
+    out.elements.write(reinterpret_cast<const char*>(&param.tag), sizeof(int32_t));
+    return serializeParamValue(out, accessTagValue(ttag, param));
+}
+
+template <typename... T> struct choose_serializer;
+template <typename... Tags> struct choose_serializer<MetaList<Tags...>> {
+    static OutStreams& serialize(OutStreams& out, const KeyParameter& param) {
+        return choose_serializer<Tags...>::serialize(out, param);
+    }
+};
+template <> struct choose_serializer<> {
+    static OutStreams& serialize(OutStreams& out, const KeyParameter&) { return out; }
+};
+template <TagType tag_type, Tag tag, typename... Tail>
+struct choose_serializer<TypedTag<tag_type, tag>, Tail...> {
+    static OutStreams& serialize(OutStreams& out, const KeyParameter& param) {
+        if (param.tag == tag) {
+            return V3_0::serialize(TypedTag<tag_type, tag>(), out, param);
+        } else {
+            return choose_serializer<Tail...>::serialize(out, param);
+        }
+    }
+};
+
+OutStreams& serialize(OutStreams& out, const KeyParameter& param) {
+    return choose_serializer<all_tags_t>::serialize(out, param);
+}
+
+std::ostream& serialize(std::ostream& out, const std::vector<KeyParameter>& params) {
+    std::stringstream indirect;
+    std::stringstream elements;
+    OutStreams streams = {indirect, elements};
+    for (const auto& param : params) {
+        serialize(streams, param);
+    }
+    if (indirect.bad() || elements.bad()) {
+        out.setstate(std::ios_base::badbit);
+        return out;
+    }
+    auto pos = indirect.tellp();
+    if (pos < 0 || pos > std::numeric_limits<uint32_t>::max()) {
+        out.setstate(std::ios_base::badbit);
+        return out;
+    }
+    uint32_t indirect_size = pos;
+    pos = elements.tellp();
+    if (pos < 0 || pos > std::numeric_limits<uint32_t>::max()) {
+        out.setstate(std::ios_base::badbit);
+        return out;
+    }
+    uint32_t elements_size = pos;
+    uint32_t element_count = params.size();
+
+    out.write(reinterpret_cast<const char*>(&indirect_size), sizeof(uint32_t));
+
+    pos = out.tellp();
+    if (indirect_size) out << indirect.rdbuf();
+    assert(out.tellp() - pos == indirect_size);
+
+    out.write(reinterpret_cast<const char*>(&element_count), sizeof(uint32_t));
+    out.write(reinterpret_cast<const char*>(&elements_size), sizeof(uint32_t));
+
+    pos = out.tellp();
+    if (elements_size) out << elements.rdbuf();
+    assert(out.tellp() - pos == elements_size);
+
+    return out;
+}
+
+struct InStreams {
+    std::istream& indirect;
+    std::istream& elements;
+};
+
+InStreams& deserializeParamValue(InStreams& in, hidl_vec<uint8_t>* blob) {
+    uint32_t blob_length = 0;
+    uint32_t offset = 0;
+    in.elements.read(reinterpret_cast<char*>(&blob_length), sizeof(uint32_t));
+    blob->resize(blob_length);
+    in.elements.read(reinterpret_cast<char*>(&offset), sizeof(uint32_t));
+    in.indirect.seekg(offset);
+    in.indirect.read(reinterpret_cast<char*>(&(*blob)[0]), blob->size());
+    return in;
+}
+
+template <typename T> InStreams& deserializeParamValue(InStreams& in, T* value) {
+    in.elements.read(reinterpret_cast<char*>(value), sizeof(T));
+    return in;
+}
+
+InStreams& deserialize(TAG_INVALID_t&&, InStreams& in, KeyParameter*) {
+    // there should be no invalid KeyParamaters but if handle them as zero sized.
+    return in;
+}
+
+template <typename T> InStreams& deserialize(T&& ttag, InStreams& in, KeyParameter* param) {
+    return deserializeParamValue(in, &accessTagValue(ttag, *param));
+}
+
+template <typename... T> struct choose_deserializer;
+template <typename... Tags> struct choose_deserializer<MetaList<Tags...>> {
+    static InStreams& deserialize(InStreams& in, KeyParameter* param) {
+        return choose_deserializer<Tags...>::deserialize(in, param);
+    }
+};
+template <> struct choose_deserializer<> {
+    static InStreams& deserialize(InStreams& in, KeyParameter*) {
+        // encountered an unknown tag -> fail parsing
+        in.elements.setstate(std::ios_base::badbit);
+        return in;
+    }
+};
+template <TagType tag_type, Tag tag, typename... Tail>
+struct choose_deserializer<TypedTag<tag_type, tag>, Tail...> {
+    static InStreams& deserialize(InStreams& in, KeyParameter* param) {
+        if (param->tag == tag) {
+            return V3_0::deserialize(TypedTag<tag_type, tag>(), in, param);
+        } else {
+            return choose_deserializer<Tail...>::deserialize(in, param);
+        }
+    }
+};
+
+InStreams& deserialize(InStreams& in, KeyParameter* param) {
+    in.elements.read(reinterpret_cast<char*>(&param->tag), sizeof(Tag));
+    return choose_deserializer<all_tags_t>::deserialize(in, param);
+}
+
+std::istream& deserialize(std::istream& in, std::vector<KeyParameter>* params) {
+    uint32_t indirect_size = 0;
+    in.read(reinterpret_cast<char*>(&indirect_size), sizeof(uint32_t));
+    std::string indirect_buffer(indirect_size, '\0');
+    if (indirect_buffer.size() != indirect_size) {
+        in.setstate(std::ios_base::badbit);
+        return in;
+    }
+    in.read(&indirect_buffer[0], indirect_buffer.size());
+
+    uint32_t element_count = 0;
+    in.read(reinterpret_cast<char*>(&element_count), sizeof(uint32_t));
+    uint32_t elements_size = 0;
+    in.read(reinterpret_cast<char*>(&elements_size), sizeof(uint32_t));
+
+    std::string elements_buffer(elements_size, '\0');
+    if (elements_buffer.size() != elements_size) {
+        in.setstate(std::ios_base::badbit);
+        return in;
+    }
+    in.read(&elements_buffer[0], elements_buffer.size());
+
+    if (in.bad()) return in;
+
+    // TODO write one-shot stream buffer to avoid copying here
+    std::stringstream indirect(indirect_buffer);
+    std::stringstream elements(elements_buffer);
+    InStreams streams = {indirect, elements};
+
+    params->resize(element_count);
+
+    for (uint32_t i = 0; i < element_count; ++i) {
+        deserialize(streams, &(*params)[i]);
+    }
+    return in;
+}
+
+void AuthorizationSet::Serialize(std::ostream* out) const {
+    serialize(*out, data_);
+}
+
+void AuthorizationSet::Deserialize(std::istream* in) {
+    deserialize(*in, &data_);
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
diff --git a/keymaster/3.0/vts/functional/authorization_set.h b/keymaster/3.0/vts/functional/authorization_set.h
new file mode 100644
index 0000000..5f92d81
--- /dev/null
+++ b/keymaster/3.0/vts/functional/authorization_set.h
@@ -0,0 +1,420 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_AUTHORIZATION_SET_H_
+#define HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_AUTHORIZATION_SET_H_
+
+#include "keymaster_tags.h"
+
+#include <utility>
+#include <vector>
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+class AuthorizationSetBuilder;
+
+/**
+ * An ordered collection of KeyParameters. It provides memory ownership and some convenient
+ * functionality for sorting, deduplicating, joining, and subtracting sets of KeyParameters.
+ * For serialization, wrap the backing store of this structure in a hidl_vec<KeyParameter>.
+ */
+class AuthorizationSet {
+  public:
+    typedef KeyParameter value_type;
+
+    /**
+     * Construct an empty, dynamically-allocated, growable AuthorizationSet.
+     */
+    AuthorizationSet(){};
+
+    // Copy constructor.
+    AuthorizationSet(const AuthorizationSet& other) : data_(other.data_) {}
+
+    // Move constructor.
+    AuthorizationSet(AuthorizationSet&& other) : data_(std::move(other.data_)) {}
+
+    // Constructor from hidl_vec<KeyParameter>
+    AuthorizationSet(const hidl_vec<KeyParameter>& other) { *this = other; }
+
+    // Copy assignment.
+    AuthorizationSet& operator=(const AuthorizationSet& other) {
+        data_ = other.data_;
+        return *this;
+    }
+
+    // Move assignment.
+    AuthorizationSet& operator=(AuthorizationSet&& other) {
+        data_ = std::move(other.data_);
+        return *this;
+    }
+
+    AuthorizationSet& operator=(const hidl_vec<KeyParameter>& other) {
+        if (other.size() > 0) {
+            data_.resize(other.size());
+            for (size_t i = 0; i < data_.size(); ++i) {
+                /* This makes a deep copy even of embedded blobs.
+                 * See assignment operator/copy constructor of hidl_vec.*/
+                data_[i] = other[i];
+            }
+        }
+        return *this;
+    }
+
+    /**
+     * Clear existing authorization set data
+     */
+    void Clear();
+
+    ~AuthorizationSet() = default;
+
+    /**
+     * Returns the size of the set.
+     */
+    size_t size() const { return data_.size(); }
+
+    /**
+     * Returns true if the set is empty.
+     */
+    bool empty() const { return size() == 0; }
+
+    /**
+     * Returns the data in the set, directly. Be careful with this.
+     */
+    const KeyParameter* data() const { return data_.data(); }
+
+    /**
+     * Sorts the set
+     */
+    void Sort();
+
+    /**
+     * Sorts the set and removes duplicates (inadvertently duplicating tags is easy to do with the
+     * AuthorizationSetBuilder).
+     */
+    void Deduplicate();
+
+    /**
+     * Adds all elements from \p set that are not already present in this AuthorizationSet.  As a
+     * side-effect, if \p set is not null this AuthorizationSet will end up sorted.
+     */
+    void Union(const AuthorizationSet& set);
+
+    /**
+     * Removes all elements in \p set from this AuthorizationSet.
+     */
+    void Subtract(const AuthorizationSet& set);
+
+    /**
+     * Returns the offset of the next entry that matches \p tag, starting from the element after \p
+     * begin.  If not found, returns -1.
+     */
+    int find(Tag tag, int begin = -1) const;
+
+    /**
+     * Removes the entry at the specified index. Returns true if successful, false if the index was
+     * out of bounds.
+     */
+    bool erase(int index);
+
+    /**
+     * Returns iterator (pointer) to beginning of elems array, to enable STL-style iteration
+     */
+    std::vector<KeyParameter>::const_iterator begin() const { return data_.begin(); }
+
+    /**
+     * Returns iterator (pointer) one past end of elems array, to enable STL-style iteration
+     */
+    std::vector<KeyParameter>::const_iterator end() const { return data_.end(); }
+
+    /**
+     * Returns the nth element of the set.
+     * Like for std::vector::operator[] there is no range check performed. Use of out of range
+     * indices is undefined.
+     */
+    KeyParameter& operator[](int n);
+
+    /**
+     * Returns the nth element of the set.
+     * Like for std::vector::operator[] there is no range check performed. Use of out of range
+     * indices is undefined.
+     */
+    const KeyParameter& operator[](int n) const;
+
+    /**
+     * Returns true if the set contains at least one instance of \p tag
+     */
+    bool Contains(Tag tag) const { return find(tag) != -1; }
+
+    template <typename T> bool Contains(T tag) const { return find(tag) != -1; }
+
+    template <TagType tag_type, Tag tag, typename ValueT>
+    bool Contains(TypedTag<tag_type, tag> ttag, const ValueT& value) const {
+        for (const auto& param : data_) {
+            auto entry = authorizationValue(ttag, param);
+            if (entry.isOk() && static_cast<ValueT>(entry.value()) == value) return true;
+        }
+        return false;
+    }
+    /**
+     * Returns the number of \p tag entries.
+     */
+    size_t GetTagCount(Tag tag) const;
+
+    template <typename T>
+    inline NullOr<const typename TypedTag2ValueType<T>::type&> GetTagValue(T tag) const {
+        auto entry = GetEntry(tag);
+        if (entry.isOk()) return authorizationValue(tag, entry.value());
+        return {};
+    }
+
+    void push_back(const KeyParameter& param) { data_.push_back(param); }
+    void push_back(KeyParameter&& param) { data_.push_back(std::move(param)); }
+
+    void push_back(const AuthorizationSet& set) {
+        for (auto& entry : set) {
+            push_back(entry);
+        }
+    }
+
+    void push_back(AuthorizationSet&& set) {
+        move(set.begin(), set.end());
+        set.Clear();
+    }
+
+    template <Tag tag>
+    void push_back(TypedTag<TagType::BYTES, tag> ttag, const uint8_t* data, size_t data_length) {
+        hidl_vec<uint8_t> new_blob;
+        new_blob.setToExternal(const_cast<uint8_t*>(data), data_length);
+        push_back(ttag, std::move(new_blob));
+    }
+
+    /**
+     * Append the tag and enumerated value to the set.
+     * "val" may be exactly one parameter unless a boolean parameter is added.
+     * In this case "val" is omitted. This condition is checked at compile time by Authorization()
+     */
+    template <typename TypedTagT, typename... Value> void push_back(TypedTagT tag, Value&&... val) {
+        push_back(Authorization(tag, std::forward<Value>(val)...));
+    }
+
+    template <typename Iterator> void push_back(Iterator begin, Iterator end) {
+        while (begin != end) {
+            push_back(*begin);
+            ++begin;
+        }
+    }
+
+    template <typename Iterator> void move(Iterator begin, Iterator end) {
+        std::move(begin, end, std::back_inserter(data_));
+    }
+
+    hidl_vec<KeyParameter> hidl_data() const {
+        hidl_vec<KeyParameter> result;
+        result.setToExternal(const_cast<KeyParameter*>(data()), size());
+        return result;
+    }
+
+    void Serialize(std::ostream* out) const;
+    void Deserialize(std::istream* in);
+
+  private:
+    NullOr<const KeyParameter&> GetEntry(Tag tag) const;
+
+    std::vector<KeyParameter> data_;
+};
+
+class AuthorizationSetBuilder : public AuthorizationSet {
+  public:
+    template <typename TagType, typename... ValueType>
+    AuthorizationSetBuilder& Authorization(TagType ttag, ValueType&&... value) {
+        push_back(ttag, std::forward<ValueType>(value)...);
+        return *this;
+    }
+
+    template <Tag tag>
+    AuthorizationSetBuilder& Authorization(TypedTag<TagType::BYTES, tag> ttag, const uint8_t* data,
+                                           size_t data_length) {
+        hidl_vec<uint8_t> new_blob;
+        new_blob.setToExternal(const_cast<uint8_t*>(data), data_length);
+        push_back(ttag, std::move(new_blob));
+        return *this;
+    }
+
+    template <Tag tag>
+    AuthorizationSetBuilder& Authorization(TypedTag<TagType::BYTES, tag> ttag, const char* data,
+                                           size_t data_length) {
+        return Authorization(ttag, reinterpret_cast<const uint8_t*>(data), data_length);
+    }
+
+    AuthorizationSetBuilder& Authorizations(AuthorizationSet&& set);
+    AuthorizationSetBuilder& Authorizations(const AuthorizationSet& set);
+
+    AuthorizationSetBuilder& RsaKey(uint32_t key_size, uint64_t public_exponent);
+    AuthorizationSetBuilder& EcdsaKey(uint32_t key_size);
+    AuthorizationSetBuilder& EcdsaKey(EcCurve curve);
+    AuthorizationSetBuilder& AesKey(uint32_t key_size);
+    AuthorizationSetBuilder& HmacKey(uint32_t key_size);
+
+    AuthorizationSetBuilder& RsaSigningKey(uint32_t key_size, uint64_t public_exponent);
+    AuthorizationSetBuilder& RsaEncryptionKey(uint32_t key_size, uint64_t public_exponent);
+    AuthorizationSetBuilder& EcdsaSigningKey(uint32_t key_size);
+    AuthorizationSetBuilder& EcdsaSigningKey(EcCurve curve);
+    AuthorizationSetBuilder& AesEncryptionKey(uint32_t key_size);
+
+    AuthorizationSetBuilder& SigningKey();
+    AuthorizationSetBuilder& EncryptionKey();
+    AuthorizationSetBuilder& NoDigestOrPadding();
+    AuthorizationSetBuilder& EcbMode();
+
+    AuthorizationSetBuilder& BlockMode(std::initializer_list<BlockMode> block_modes);
+    AuthorizationSetBuilder& Digest(std::initializer_list<Digest> digests);
+    AuthorizationSetBuilder& Padding(std::initializer_list<PaddingMode> padding_modes);
+
+    // The following forwarding templates enable BlockMode,Digest and Padding to be called with a
+    // variable number of arguments; no need to wrap them in braces to make them an initalizer_list.
+    template <typename... T> AuthorizationSetBuilder& BlockMode(T&&... a) {
+        return BlockMode({std::forward<T>(a)...});
+    }
+    template <typename... T> AuthorizationSetBuilder& Digest(T&&... a) {
+        return Digest({std::forward<T>(a)...});
+    }
+    template <typename... T> AuthorizationSetBuilder& Padding(T&&... a) {
+        return Padding({std::forward<T>(a)...});
+    }
+};
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::Authorizations(AuthorizationSet&& set) {
+    move(set.begin(), set.end());
+    set.Clear();
+    return *this;
+}
+
+inline AuthorizationSetBuilder&
+AuthorizationSetBuilder::Authorizations(const AuthorizationSet& set) {
+    push_back(set.begin(), set.end());
+    return *this;
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::RsaKey(uint32_t key_size,
+                                                                uint64_t public_exponent) {
+    Authorization(TAG_ALGORITHM, Algorithm::RSA);
+    Authorization(TAG_KEY_SIZE, key_size);
+    Authorization(TAG_RSA_PUBLIC_EXPONENT, public_exponent);
+    return *this;
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EcdsaKey(uint32_t key_size) {
+    Authorization(TAG_ALGORITHM, Algorithm::EC);
+    Authorization(TAG_KEY_SIZE, key_size);
+    return *this;
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EcdsaKey(EcCurve curve) {
+    Authorization(TAG_ALGORITHM, Algorithm::EC);
+    Authorization(TAG_EC_CURVE, curve);
+    return *this;
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::AesKey(uint32_t key_size) {
+    Authorization(TAG_ALGORITHM, Algorithm::AES);
+    return Authorization(TAG_KEY_SIZE, key_size);
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::HmacKey(uint32_t key_size) {
+    Authorization(TAG_ALGORITHM, Algorithm::HMAC);
+    Authorization(TAG_KEY_SIZE, key_size);
+    return SigningKey();
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::RsaSigningKey(uint32_t key_size,
+                                                                       uint64_t public_exponent) {
+    RsaKey(key_size, public_exponent);
+    return SigningKey();
+}
+
+inline AuthorizationSetBuilder&
+AuthorizationSetBuilder::RsaEncryptionKey(uint32_t key_size, uint64_t public_exponent) {
+    RsaKey(key_size, public_exponent);
+    return EncryptionKey();
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EcdsaSigningKey(uint32_t key_size) {
+    EcdsaKey(key_size);
+    return SigningKey();
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EcdsaSigningKey(EcCurve curve) {
+    EcdsaKey(curve);
+    return SigningKey();
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::AesEncryptionKey(uint32_t key_size) {
+    AesKey(key_size);
+    return EncryptionKey();
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::SigningKey() {
+    Authorization(TAG_PURPOSE, KeyPurpose::SIGN);
+    return Authorization(TAG_PURPOSE, KeyPurpose::VERIFY);
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EncryptionKey() {
+    Authorization(TAG_PURPOSE, KeyPurpose::ENCRYPT);
+    return Authorization(TAG_PURPOSE, KeyPurpose::DECRYPT);
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::NoDigestOrPadding() {
+    Authorization(TAG_DIGEST, Digest::NONE);
+    return Authorization(TAG_PADDING, PaddingMode::NONE);
+}
+
+inline AuthorizationSetBuilder& AuthorizationSetBuilder::EcbMode() {
+    return BlockMode(BlockMode::ECB);
+}
+
+inline AuthorizationSetBuilder&
+AuthorizationSetBuilder::BlockMode(std::initializer_list<V3_0::BlockMode> block_modes) {
+    for (auto block_mode : block_modes) {
+        Authorization(TAG_BLOCK_MODE, block_mode);
+    }
+    return *this;
+}
+
+inline AuthorizationSetBuilder&
+AuthorizationSetBuilder::Digest(std::initializer_list<V3_0::Digest> digests) {
+    for (auto digest : digests) {
+        Authorization(TAG_DIGEST, digest);
+    }
+    return *this;
+}
+
+inline AuthorizationSetBuilder&
+AuthorizationSetBuilder::Padding(std::initializer_list<V3_0::PaddingMode> padding_modes) {
+    for (auto padding : padding_modes) {
+        Authorization(TAG_PADDING, padding);
+    }
+    return *this;
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
+
+#endif  // HARDWARE_INTERFACES_KEYMASTER_30_VTS_FUNCTIONAL_AUTHORIZATION_SET_H_
diff --git a/keymaster/3.0/vts/functional/key_param_output.cpp b/keymaster/3.0/vts/functional/key_param_output.cpp
new file mode 100644
index 0000000..fc9f685
--- /dev/null
+++ b/keymaster/3.0/vts/functional/key_param_output.cpp
@@ -0,0 +1,131 @@
+/*
+ * 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 "key_param_output.h"
+
+#include <iomanip>
+
+namespace android {
+namespace hardware {
+
+namespace keymaster {
+namespace V3_0 {
+
+::std::ostream& operator<<(::std::ostream& os, const hidl_vec<KeyParameter>& set) {
+    if (set.size() == 0) {
+        os << "(Empty)" << ::std::endl;
+    } else {
+        os << "\n";
+        for (size_t i = 0; i < set.size(); ++i)
+            os << set[i] << ::std::endl;
+    }
+    return os;
+}
+
+::std::ostream& operator<<(::std::ostream& os, ErrorCode value) {
+    return os << (int)value;
+}
+
+::std::ostream& operator<<(::std::ostream& os, Digest value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, Algorithm value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, BlockMode value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, PaddingMode value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, KeyOrigin value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, KeyPurpose value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, EcCurve value) {
+    return os << stringify(value);
+}
+
+::std::ostream& operator<<(::std::ostream& os, const KeyParameter& param) {
+    os << stringifyTag(param.tag) << ": ";
+    switch (typeFromTag(param.tag)) {
+    case TagType::INVALID:
+        return os << " Invalid";
+    case TagType::UINT_REP:
+    case TagType::UINT:
+        return os << param.f.integer;
+    case TagType::ENUM_REP:
+    case TagType::ENUM:
+        switch (param.tag) {
+        case Tag::ALGORITHM:
+            return os << param.f.algorithm;
+        case Tag::BLOCK_MODE:
+            return os << param.f.blockMode;
+        case Tag::PADDING:
+            return os << param.f.paddingMode;
+        case Tag::DIGEST:
+            return os << param.f.digest;
+        case Tag::EC_CURVE:
+            return os << (int)param.f.ecCurve;
+        case Tag::ORIGIN:
+            return os << param.f.origin;
+        case Tag::BLOB_USAGE_REQUIREMENTS:
+            return os << (int)param.f.keyBlobUsageRequirements;
+        case Tag::PURPOSE:
+            return os << param.f.purpose;
+        default:
+            return os << " UNKNOWN ENUM " << param.f.integer;
+        }
+    case TagType::ULONG_REP:
+    case TagType::ULONG:
+        return os << param.f.longInteger;
+    case TagType::DATE:
+        return os << param.f.dateTime;
+    case TagType::BOOL:
+        return os << "true";
+    case TagType::BIGNUM:
+        os << " Bignum: ";
+        for (size_t i = 0; i < param.blob.size(); ++i) {
+            os << ::std::hex << ::std::setw(2) << static_cast<int>(param.blob[i]) << ::std::dec;
+        }
+        return os;
+    case TagType::BYTES:
+        os << " Bytes: ";
+        for (size_t i = 0; i < param.blob.size(); ++i) {
+            os << ::std::hex << ::std::setw(2) << static_cast<int>(param.blob[i]) << ::std::dec;
+        }
+        return os;
+    }
+    return os << "UNKNOWN TAG TYPE!";
+}
+
+::std::ostream& operator<<(::std::ostream& os, const KeyCharacteristics& chars) {
+    return os << "SW: " << chars.softwareEnforced << ::std::endl
+              << "TEE: " << chars.teeEnforced << ::std::endl;
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
diff --git a/keymaster/3.0/vts/functional/key_param_output.h b/keymaster/3.0/vts/functional/key_param_output.h
new file mode 100644
index 0000000..5edec2d
--- /dev/null
+++ b/keymaster/3.0/vts/functional/key_param_output.h
@@ -0,0 +1,50 @@
+/*
+ * 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 <iostream>
+
+#include <android/hardware/keymaster/3.0/types.h>
+
+#include "keymaster_tags.h"
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+template <typename ValueT>
+::std::ostream& operator<<(::std::ostream& os, const NullOr<ValueT>& value) {
+    if (!value.isOk()) {
+        os << "(value not present)";
+    } else {
+        os << value.value();
+    }
+    return os;
+}
+
+::std::ostream& operator<<(::std::ostream& os, const hidl_vec<KeyParameter>& set);
+::std::ostream& operator<<(::std::ostream& os, BlockMode value);
+::std::ostream& operator<<(::std::ostream& os, Digest value);
+::std::ostream& operator<<(::std::ostream& os, EcCurve value);
+::std::ostream& operator<<(::std::ostream& os, ErrorCode value);
+::std::ostream& operator<<(::std::ostream& os, PaddingMode value);
+::std::ostream& operator<<(::std::ostream& os, const KeyCharacteristics& value);
+::std::ostream& operator<<(::std::ostream& os, const KeyParameter& value);
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
new file mode 100644
index 0000000..2382f0b
--- /dev/null
+++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -0,0 +1,3911 @@
+/*
+ * 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 "keymaster_hidl_hal_test"
+#include <cutils/log.h>
+
+#include <iostream>
+
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+
+#include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
+#include <android/hardware/keymaster/3.0/types.h>
+
+#include <cutils/properties.h>
+
+#include <keymaster/keymaster_configuration.h>
+
+#include "authorization_set.h"
+#include "key_param_output.h"
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "attestation_record.h"
+#include "openssl_utils.h"
+
+using ::android::sp;
+
+using ::std::string;
+
+// This service_name will be passed to getService when retrieving the keymaster service to test.  To
+// change it from "default" specify the selected service name on the command line.  The first
+// non-gtest argument will be used as the service name.
+string service_name = "default";
+
+namespace android {
+namespace hardware {
+
+template <typename T> bool operator==(const hidl_vec<T>& a, const hidl_vec<T>& b) {
+    if (a.size() != b.size()) {
+        return false;
+    }
+    for (size_t i = 0; i < a.size(); ++i) {
+        if (a[i] != b[i]) {
+            return false;
+        }
+    }
+    return true;
+}
+
+namespace keymaster {
+namespace V3_0 {
+
+bool operator==(const KeyParameter& a, const KeyParameter& b) {
+    if (a.tag != b.tag) {
+        return false;
+    }
+
+    switch (a.tag) {
+
+    /* Boolean tags */
+    case Tag::INVALID:
+    case Tag::CALLER_NONCE:
+    case Tag::INCLUDE_UNIQUE_ID:
+    case Tag::ECIES_SINGLE_HASH_MODE:
+    case Tag::BOOTLOADER_ONLY:
+    case Tag::NO_AUTH_REQUIRED:
+    case Tag::ALLOW_WHILE_ON_BODY:
+    case Tag::EXPORTABLE:
+    case Tag::ALL_APPLICATIONS:
+    case Tag::ROLLBACK_RESISTANT:
+    case Tag::RESET_SINCE_ID_ROTATION:
+        return true;
+
+    /* Integer tags */
+    case Tag::KEY_SIZE:
+    case Tag::MIN_MAC_LENGTH:
+    case Tag::MIN_SECONDS_BETWEEN_OPS:
+    case Tag::MAX_USES_PER_BOOT:
+    case Tag::ALL_USERS:
+    case Tag::USER_ID:
+    case Tag::OS_VERSION:
+    case Tag::OS_PATCHLEVEL:
+    case Tag::MAC_LENGTH:
+    case Tag::AUTH_TIMEOUT:
+        return a.f.integer == b.f.integer;
+
+    /* Long integer tags */
+    case Tag::RSA_PUBLIC_EXPONENT:
+    case Tag::USER_SECURE_ID:
+        return a.f.longInteger == b.f.longInteger;
+
+    /* Date-time tags */
+    case Tag::ACTIVE_DATETIME:
+    case Tag::ORIGINATION_EXPIRE_DATETIME:
+    case Tag::USAGE_EXPIRE_DATETIME:
+    case Tag::CREATION_DATETIME:
+        return a.f.dateTime == b.f.dateTime;
+
+    /* Bytes tags */
+    case Tag::APPLICATION_ID:
+    case Tag::APPLICATION_DATA:
+    case Tag::ROOT_OF_TRUST:
+    case Tag::UNIQUE_ID:
+    case Tag::ATTESTATION_CHALLENGE:
+    case Tag::ATTESTATION_APPLICATION_ID:
+    case Tag::ATTESTATION_ID_BRAND:
+    case Tag::ATTESTATION_ID_DEVICE:
+    case Tag::ATTESTATION_ID_PRODUCT:
+    case Tag::ATTESTATION_ID_SERIAL:
+    case Tag::ATTESTATION_ID_IMEI:
+    case Tag::ATTESTATION_ID_MEID:
+    case Tag::ATTESTATION_ID_MANUFACTURER:
+    case Tag::ATTESTATION_ID_MODEL:
+    case Tag::ASSOCIATED_DATA:
+    case Tag::NONCE:
+    case Tag::AUTH_TOKEN:
+        return a.blob == b.blob;
+
+    /* Enum tags */
+    case Tag::PURPOSE:
+        return a.f.purpose == b.f.purpose;
+    case Tag::ALGORITHM:
+        return a.f.algorithm == b.f.algorithm;
+    case Tag::BLOCK_MODE:
+        return a.f.blockMode == b.f.blockMode;
+    case Tag::DIGEST:
+        return a.f.digest == b.f.digest;
+    case Tag::PADDING:
+        return a.f.paddingMode == b.f.paddingMode;
+    case Tag::EC_CURVE:
+        return a.f.ecCurve == b.f.ecCurve;
+    case Tag::BLOB_USAGE_REQUIREMENTS:
+        return a.f.keyBlobUsageRequirements == b.f.keyBlobUsageRequirements;
+    case Tag::USER_AUTH_TYPE:
+        return a.f.integer == b.f.integer;
+    case Tag::ORIGIN:
+        return a.f.origin == b.f.origin;
+
+    /* Unsupported tags */
+    case Tag::KDF:
+        return false;
+    }
+}
+
+bool operator==(const AuthorizationSet& a, const AuthorizationSet& b) {
+    return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
+}
+
+bool operator==(const KeyCharacteristics& a, const KeyCharacteristics& b) {
+    // This isn't very efficient. Oh, well.
+    AuthorizationSet a_sw(a.softwareEnforced);
+    AuthorizationSet b_sw(b.softwareEnforced);
+    AuthorizationSet a_tee(b.teeEnforced);
+    AuthorizationSet b_tee(b.teeEnforced);
+
+    a_sw.Sort();
+    b_sw.Sort();
+    a_tee.Sort();
+    b_tee.Sort();
+
+    return a_sw == b_sw && a_tee == b_sw;
+}
+
+::std::ostream& operator<<(::std::ostream& os, const AuthorizationSet& set) {
+    if (set.size() == 0)
+        os << "(Empty)" << ::std::endl;
+    else {
+        os << "\n";
+        for (size_t i = 0; i < set.size(); ++i)
+            os << set[i] << ::std::endl;
+    }
+    return os;
+}
+
+namespace test {
+namespace {
+
+template <TagType tag_type, Tag tag, typename ValueT>
+bool contains(hidl_vec<KeyParameter>& set, TypedTag<tag_type, tag> ttag, ValueT expected_value) {
+    size_t count = std::count_if(set.begin(), set.end(), [&](const KeyParameter& param) {
+        return param.tag == tag && accessTagValue(ttag, param) == expected_value;
+    });
+    return count == 1;
+}
+
+template <TagType tag_type, Tag tag>
+bool contains(hidl_vec<KeyParameter>& set, TypedTag<tag_type, tag>) {
+    size_t count = std::count_if(set.begin(), set.end(),
+                                 [&](const KeyParameter& param) { return param.tag == tag; });
+    return count > 0;
+}
+
+constexpr char hex_value[256] = {0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 1,  2,  3,  4,  5,  6,  7, 8, 9, 0, 0, 0, 0, 0, 0,  // '0'..'9'
+                                 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 'A'..'F'
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,  // 'a'..'f'
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  //
+                                 0, 0,  0,  0,  0,  0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+string hex2str(string a) {
+    string b;
+    size_t num = a.size() / 2;
+    b.resize(num);
+    for (size_t i = 0; i < num; i++) {
+        b[i] = (hex_value[a[i * 2] & 0xFF] << 4) + (hex_value[a[i * 2 + 1] & 0xFF]);
+    }
+    return b;
+}
+
+string rsa_key = hex2str("30820275020100300d06092a864886f70d01010105000482025f3082025b"
+                         "02010002818100c6095409047d8634812d5a218176e45c41d60a75b13901"
+                         "f234226cffe776521c5a77b9e389417b71c0b6a44d13afe4e4a2805d46c9"
+                         "da2935adb1ff0c1f24ea06e62b20d776430a4d435157233c6f916783c30e"
+                         "310fcbd89b85c2d56771169785ac12bca244abda72bfb19fc44d27c81e1d"
+                         "92de284f4061edfd99280745ea6d2502030100010281801be0f04d9cae37"
+                         "18691f035338308e91564b55899ffb5084d2460e6630257e05b3ceab0297"
+                         "2dfabcd6ce5f6ee2589eb67911ed0fac16e43a444b8c861e544a05933657"
+                         "72f8baf6b22fc9e3c5f1024b063ac080a7b2234cf8aee8f6c47bbf4fd3ac"
+                         "e7240290bef16c0b3f7f3cdd64ce3ab5912cf6e32f39ab188358afcccd80"
+                         "81024100e4b49ef50f765d3b24dde01aceaaf130f2c76670a91a61ae08af"
+                         "497b4a82be6dee8fcdd5e3f7ba1cfb1f0c926b88f88c92bfab137fba2285"
+                         "227b83c342ff7c55024100ddabb5839c4c7f6bf3d4183231f005b31aa58a"
+                         "ffdda5c79e4cce217f6bc930dbe563d480706c24e9ebfcab28a6cdefd324"
+                         "b77e1bf7251b709092c24ff501fd91024023d4340eda3445d8cd26c14411"
+                         "da6fdca63c1ccd4b80a98ad52b78cc8ad8beb2842c1d280405bc2f6c1bea"
+                         "214a1d742ab996b35b63a82a5e470fa88dbf823cdd02401b7b57449ad30d"
+                         "1518249a5f56bb98294d4b6ac12ffc86940497a5a5837a6cf946262b4945"
+                         "26d328c11e1126380fde04c24f916dec250892db09a6d77cdba351024077"
+                         "62cd8f4d050da56bd591adb515d24d7ccd32cca0d05f866d583514bd7324"
+                         "d5f33645e8ed8b4a1cb3cc4a1d67987399f2a09f5b3fb68c88d5e5d90ac3"
+                         "3492d6");
+
+string ec_key = hex2str("308187020100301306072a8648ce3d020106082a8648ce3d030107046d30"
+                        "6b0201010420737c2ecd7b8d1940bf2930aa9b4ed3ff941eed09366bc032"
+                        "99986481f3a4d859a14403420004bf85d7720d07c25461683bc648b4778a"
+                        "9a14dd8a024e3bdd8c7ddd9ab2b528bbc7aa1b51f14ebbbb0bd0ce21bcc4"
+                        "1c6eb00083cf3376d11fd44949e0b2183bfe");
+
+struct RSA_Delete {
+    void operator()(RSA* p) { RSA_free(p); }
+};
+
+X509* parse_cert_blob(const hidl_vec<uint8_t>& blob) {
+    const uint8_t* p = blob.data();
+    return d2i_X509(nullptr, &p, blob.size());
+}
+
+bool verify_chain(const hidl_vec<hidl_vec<uint8_t>>& chain) {
+    for (size_t i = 0; i < chain.size() - 1; ++i) {
+        auto& key_cert_blob = chain[i];
+        auto& signing_cert_blob = chain[i + 1];
+
+        X509_Ptr key_cert(parse_cert_blob(key_cert_blob));
+        X509_Ptr signing_cert(parse_cert_blob(signing_cert_blob));
+        EXPECT_TRUE(!!key_cert.get() && !!signing_cert.get());
+        if (!key_cert.get() || !signing_cert.get()) return false;
+
+        EVP_PKEY_Ptr signing_pubkey(X509_get_pubkey(signing_cert.get()));
+        EXPECT_TRUE(!!signing_pubkey.get());
+        if (!signing_pubkey.get()) return false;
+
+        EXPECT_EQ(1, X509_verify(key_cert.get(), signing_pubkey.get()))
+            << "Verification of certificate " << i << " failed";
+    }
+
+    return true;
+}
+
+// Extract attestation record from cert. Returned object is still part of cert; don't free it
+// separately.
+ASN1_OCTET_STRING* get_attestation_record(X509* certificate) {
+    ASN1_OBJECT_Ptr oid(OBJ_txt2obj(kAttestionRecordOid, 1 /* dotted string format */));
+    EXPECT_TRUE(!!oid.get());
+    if (!oid.get()) return nullptr;
+
+    int location = X509_get_ext_by_OBJ(certificate, oid.get(), -1 /* search from beginning */);
+    EXPECT_NE(-1, location);
+    if (location == -1) return nullptr;
+
+    X509_EXTENSION* attest_rec_ext = X509_get_ext(certificate, location);
+    EXPECT_TRUE(!!attest_rec_ext);
+    if (!attest_rec_ext) return nullptr;
+
+    ASN1_OCTET_STRING* attest_rec = X509_EXTENSION_get_data(attest_rec_ext);
+    EXPECT_TRUE(!!attest_rec);
+    return attest_rec;
+}
+
+bool tag_in_list(const KeyParameter& entry) {
+    // Attestations don't contain everything in key authorization lists, so we need to filter
+    // the key lists to produce the lists that we expect to match the attestations.
+    auto tag_list = {
+        Tag::USER_ID, Tag::INCLUDE_UNIQUE_ID, Tag::BLOB_USAGE_REQUIREMENTS,
+        Tag::EC_CURVE /* Tag::EC_CURVE will be included by KM2 implementations */,
+    };
+    return std::find(tag_list.begin(), tag_list.end(), entry.tag) != tag_list.end();
+}
+
+AuthorizationSet filter_tags(const AuthorizationSet& set) {
+    AuthorizationSet filtered;
+    std::remove_copy_if(set.begin(), set.end(), std::back_inserter(filtered), tag_in_list);
+    return filtered;
+}
+
+std::string make_string(const uint8_t* data, size_t length) {
+    return std::string(reinterpret_cast<const char*>(data), length);
+}
+
+template <size_t N> std::string make_string(const uint8_t (&a)[N]) {
+    return make_string(a, N);
+}
+
+class HidlBuf : public hidl_vec<uint8_t> {
+    typedef hidl_vec<uint8_t> super;
+
+  public:
+    HidlBuf() {}
+    HidlBuf(const super& other) : super(other) {}
+    HidlBuf(super&& other) : super(std::move(other)) {}
+    explicit HidlBuf(const std::string& other) : HidlBuf() { *this = other; }
+
+    HidlBuf& operator=(const super& other) {
+        super::operator=(other);
+        return *this;
+    }
+
+    HidlBuf& operator=(super&& other) {
+        super::operator=(std::move(other));
+        return *this;
+    }
+
+    HidlBuf& operator=(const string& other) {
+        resize(other.size());
+        for (size_t i = 0; i < other.size(); ++i) {
+            (*this)[i] = static_cast<uint8_t>(other[i]);
+        }
+        return *this;
+    }
+
+    string to_string() const { return string(reinterpret_cast<const char*>(data()), size()); }
+};
+
+constexpr uint64_t kOpHandleSentinel = 0xFFFFFFFFFFFFFFFF;
+
+}  // namespace
+
+class KeymasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+  public:
+    void TearDown() override {
+        if (key_blob_.size()) {
+            EXPECT_EQ(ErrorCode::OK, DeleteKey());
+        }
+        AbortIfNeeded();
+    }
+
+    // SetUpTestCase runs only once per test case, not once per test.
+    static void SetUpTestCase() {
+        keymaster_ = IKeymasterDevice::getService(service_name);
+        ASSERT_NE(keymaster_, nullptr);
+
+        ASSERT_TRUE(
+            keymaster_
+                ->getHardwareFeatures([&](bool isSecure, bool supportsEc, bool supportsSymmetric,
+                                          bool supportsAttestation, bool supportsAllDigests,
+                                          const hidl_string& name, const hidl_string& author) {
+                    is_secure_ = isSecure;
+                    supports_ec_ = supportsEc;
+                    supports_symmetric_ = supportsSymmetric;
+                    supports_attestation_ = supportsAttestation;
+                    supports_all_digests_ = supportsAllDigests;
+                    name_ = name;
+                    author_ = author;
+                })
+                .isOk());
+
+        os_version_ = ::keymaster::GetOsVersion();
+        os_patch_level_ = ::keymaster::GetOsPatchlevel();
+    }
+
+    static void TearDownTestCase() { keymaster_.clear(); }
+
+    static IKeymasterDevice& keymaster() { return *keymaster_; }
+    static uint32_t os_version() { return os_version_; }
+    static uint32_t os_patch_level() { return os_patch_level_; }
+
+    AuthorizationSet UserAuths() { return AuthorizationSetBuilder().Authorization(TAG_USER_ID, 7); }
+
+    ErrorCode GenerateKey(const AuthorizationSet& key_desc, HidlBuf* key_blob,
+                          KeyCharacteristics* key_characteristics) {
+        EXPECT_NE(key_blob, nullptr);
+        EXPECT_NE(key_characteristics, nullptr);
+        EXPECT_EQ(0U, key_blob->size());
+
+        ErrorCode error;
+        EXPECT_TRUE(keymaster_
+                        ->generateKey(key_desc.hidl_data(),
+                                      [&](ErrorCode hidl_error, const HidlBuf& hidl_key_blob,
+                                          const KeyCharacteristics& hidl_key_characteristics) {
+                                          error = hidl_error;
+                                          *key_blob = hidl_key_blob;
+                                          *key_characteristics = hidl_key_characteristics;
+                                      })
+                        .isOk());
+        // On error, blob & characteristics should be empty.
+        if (error != ErrorCode::OK) {
+            EXPECT_EQ(0U, key_blob->size());
+            EXPECT_EQ(0U, (key_characteristics->softwareEnforced.size() +
+                           key_characteristics->teeEnforced.size()));
+        }
+        return error;
+    }
+
+    ErrorCode GenerateKey(const AuthorizationSet& key_desc) {
+        return GenerateKey(key_desc, &key_blob_, &key_characteristics_);
+    }
+
+    ErrorCode ImportKey(const AuthorizationSet& key_desc, KeyFormat format,
+                        const string& key_material, HidlBuf* key_blob,
+                        KeyCharacteristics* key_characteristics) {
+        ErrorCode error;
+        EXPECT_TRUE(keymaster_
+                        ->importKey(key_desc.hidl_data(), format, HidlBuf(key_material),
+                                    [&](ErrorCode hidl_error, const HidlBuf& hidl_key_blob,
+                                        const KeyCharacteristics& hidl_key_characteristics) {
+                                        error = hidl_error;
+                                        *key_blob = hidl_key_blob;
+                                        *key_characteristics = hidl_key_characteristics;
+                                    })
+                        .isOk());
+        // On error, blob & characteristics should be empty.
+        if (error != ErrorCode::OK) {
+            EXPECT_EQ(0U, key_blob->size());
+            EXPECT_EQ(0U, (key_characteristics->softwareEnforced.size() +
+                           key_characteristics->teeEnforced.size()));
+        }
+        return error;
+    }
+
+    ErrorCode ImportKey(const AuthorizationSet& key_desc, KeyFormat format,
+                        const string& key_material) {
+        return ImportKey(key_desc, format, key_material, &key_blob_, &key_characteristics_);
+    }
+
+    ErrorCode ExportKey(KeyFormat format, const HidlBuf& key_blob, const HidlBuf& client_id,
+                        const HidlBuf& app_data, HidlBuf* key_material) {
+        ErrorCode error;
+        EXPECT_TRUE(
+            keymaster_
+                ->exportKey(format, key_blob, client_id, app_data,
+                            [&](ErrorCode hidl_error_code, const HidlBuf& hidl_key_material) {
+                                error = hidl_error_code;
+                                *key_material = hidl_key_material;
+                            })
+                .isOk());
+        // On error, blob should be empty.
+        if (error != ErrorCode::OK) {
+            EXPECT_EQ(0U, key_material->size());
+        }
+        return error;
+    }
+
+    ErrorCode ExportKey(KeyFormat format, HidlBuf* key_material) {
+        HidlBuf client_id, app_data;
+        return ExportKey(format, key_blob_, client_id, app_data, key_material);
+    }
+
+    ErrorCode DeleteKey(HidlBuf* key_blob) {
+        ErrorCode error = keymaster_->deleteKey(*key_blob);
+        *key_blob = HidlBuf();
+        return error;
+    }
+
+    ErrorCode DeleteKey() { return DeleteKey(&key_blob_); }
+
+    ErrorCode GetCharacteristics(const HidlBuf& key_blob, const HidlBuf& client_id,
+                                 const HidlBuf& app_data, KeyCharacteristics* key_characteristics) {
+        ErrorCode error;
+        keymaster_->getKeyCharacteristics(
+            key_blob, client_id, app_data,
+            [&](ErrorCode hidl_error, const KeyCharacteristics& hidl_key_characteristics) {
+                error = hidl_error, *key_characteristics = hidl_key_characteristics;
+            });
+        return error;
+    }
+
+    ErrorCode GetCharacteristics(const HidlBuf& key_blob, KeyCharacteristics* key_characteristics) {
+        HidlBuf client_id, app_data;
+        return GetCharacteristics(key_blob, client_id, app_data, key_characteristics);
+    }
+
+    ErrorCode Begin(KeyPurpose purpose, const HidlBuf& key_blob, const AuthorizationSet& in_params,
+                    AuthorizationSet* out_params, OperationHandle* op_handle) {
+        SCOPED_TRACE("Begin");
+        ErrorCode error;
+        OperationHandle saved_handle = *op_handle;
+        EXPECT_TRUE(
+            keymaster_
+                ->begin(purpose, key_blob, in_params.hidl_data(),
+                        [&](ErrorCode hidl_error, const hidl_vec<KeyParameter>& hidl_out_params,
+                            uint64_t hidl_op_handle) {
+                            error = hidl_error;
+                            *out_params = hidl_out_params;
+                            *op_handle = hidl_op_handle;
+                        })
+                .isOk());
+        if (error != ErrorCode::OK) {
+            // Some implementations may modify *op_handle on error.
+            *op_handle = saved_handle;
+        }
+        return error;
+    }
+
+    ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params,
+                    AuthorizationSet* out_params) {
+        SCOPED_TRACE("Begin");
+        EXPECT_EQ(kOpHandleSentinel, op_handle_);
+        return Begin(purpose, key_blob_, in_params, out_params, &op_handle_);
+    }
+
+    ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params) {
+        SCOPED_TRACE("Begin");
+        AuthorizationSet out_params;
+        ErrorCode error = Begin(purpose, in_params, &out_params);
+        EXPECT_TRUE(out_params.empty());
+        return error;
+    }
+
+    ErrorCode Update(OperationHandle op_handle, const AuthorizationSet& in_params,
+                     const string& input, AuthorizationSet* out_params, string* output,
+                     size_t* input_consumed) {
+        SCOPED_TRACE("Update");
+        ErrorCode error;
+        EXPECT_TRUE(keymaster_
+                        ->update(op_handle, in_params.hidl_data(), HidlBuf(input),
+                                 [&](ErrorCode hidl_error, uint32_t hidl_input_consumed,
+                                     const hidl_vec<KeyParameter>& hidl_out_params,
+                                     const HidlBuf& hidl_output) {
+                                     error = hidl_error;
+                                     out_params->push_back(AuthorizationSet(hidl_out_params));
+                                     output->append(hidl_output.to_string());
+                                     *input_consumed = hidl_input_consumed;
+                                 })
+                        .isOk());
+        return error;
+    }
+
+    ErrorCode Update(const string& input, string* out, size_t* input_consumed) {
+        SCOPED_TRACE("Update");
+        AuthorizationSet out_params;
+        ErrorCode error = Update(op_handle_, AuthorizationSet() /* in_params */, input, &out_params,
+                                 out, input_consumed);
+        EXPECT_TRUE(out_params.empty());
+        return error;
+    }
+
+    ErrorCode Finish(OperationHandle op_handle, const AuthorizationSet& in_params,
+                     const string& input, const string& signature, AuthorizationSet* out_params,
+                     string* output) {
+        SCOPED_TRACE("Finish");
+        ErrorCode error;
+        EXPECT_TRUE(
+            keymaster_
+                ->finish(op_handle, in_params.hidl_data(), HidlBuf(input), HidlBuf(signature),
+                         [&](ErrorCode hidl_error, const hidl_vec<KeyParameter>& hidl_out_params,
+                             const HidlBuf& hidl_output) {
+                             error = hidl_error;
+                             *out_params = hidl_out_params;
+                             output->append(hidl_output.to_string());
+                         })
+                .isOk());
+        op_handle_ = kOpHandleSentinel;  // So dtor doesn't Abort().
+        return error;
+    }
+
+    ErrorCode Finish(const string& message, string* output) {
+        SCOPED_TRACE("Finish");
+        AuthorizationSet out_params;
+        string finish_output;
+        ErrorCode error = Finish(op_handle_, AuthorizationSet() /* in_params */, message,
+                                 "" /* signature */, &out_params, output);
+        if (error != ErrorCode::OK) {
+            return error;
+        }
+        EXPECT_EQ(0U, out_params.size());
+        return error;
+    }
+
+    ErrorCode Finish(const string& message, const string& signature, string* output) {
+        SCOPED_TRACE("Finish");
+        AuthorizationSet out_params;
+        ErrorCode error = Finish(op_handle_, AuthorizationSet() /* in_params */, message, signature,
+                                 &out_params, output);
+        op_handle_ = kOpHandleSentinel;  // So dtor doesn't Abort().
+        if (error != ErrorCode::OK) {
+            return error;
+        }
+        EXPECT_EQ(0U, out_params.size());
+        return error;
+    }
+
+    ErrorCode Abort(OperationHandle op_handle) {
+        SCOPED_TRACE("Abort");
+        auto retval = keymaster_->abort(op_handle);
+        EXPECT_TRUE(retval.isOk());
+        return retval;
+    }
+
+    void AbortIfNeeded() {
+        SCOPED_TRACE("AbortIfNeeded");
+        if (op_handle_ != kOpHandleSentinel) {
+            EXPECT_EQ(ErrorCode::OK, Abort(op_handle_));
+            op_handle_ = kOpHandleSentinel;
+        }
+    }
+
+    ErrorCode AttestKey(const HidlBuf& key_blob, const AuthorizationSet& attest_params,
+                        hidl_vec<hidl_vec<uint8_t>>* cert_chain) {
+        SCOPED_TRACE("AttestKey");
+        ErrorCode error;
+        keymaster_->attestKey(
+            key_blob, attest_params.hidl_data(),
+            [&](ErrorCode hidl_error, const hidl_vec<hidl_vec<uint8_t>>& hidl_cert_chain) {
+                error = hidl_error;
+                *cert_chain = hidl_cert_chain;
+            });
+        return error;
+    }
+
+    ErrorCode AttestKey(const AuthorizationSet& attest_params,
+                        hidl_vec<hidl_vec<uint8_t>>* cert_chain) {
+        SCOPED_TRACE("AttestKey");
+        return AttestKey(key_blob_, attest_params, cert_chain);
+    }
+
+    string ProcessMessage(const HidlBuf& key_blob, KeyPurpose operation, const string& message,
+                          const AuthorizationSet& in_params, AuthorizationSet* out_params) {
+        SCOPED_TRACE("ProcessMessage");
+        AuthorizationSet begin_out_params;
+        EXPECT_EQ(ErrorCode::OK,
+                  Begin(operation, key_blob, in_params, &begin_out_params, &op_handle_));
+
+        string unused;
+        AuthorizationSet finish_params;
+        AuthorizationSet finish_out_params;
+        string output;
+        EXPECT_EQ(ErrorCode::OK,
+                  Finish(op_handle_, finish_params, message, unused, &finish_out_params, &output));
+        op_handle_ = kOpHandleSentinel;
+
+        out_params->push_back(begin_out_params);
+        out_params->push_back(finish_out_params);
+        return output;
+    }
+
+    string SignMessage(const HidlBuf& key_blob, const string& message,
+                       const AuthorizationSet& params) {
+        SCOPED_TRACE("SignMessage");
+        AuthorizationSet out_params;
+        string signature = ProcessMessage(key_blob, KeyPurpose::SIGN, message, params, &out_params);
+        EXPECT_TRUE(out_params.empty());
+        return signature;
+    }
+
+    string SignMessage(const string& message, const AuthorizationSet& params) {
+        SCOPED_TRACE("SignMessage");
+        return SignMessage(key_blob_, message, params);
+    }
+
+    string MacMessage(const string& message, Digest digest, size_t mac_length) {
+        SCOPED_TRACE("MacMessage");
+        return SignMessage(
+            key_blob_, message,
+            AuthorizationSetBuilder().Digest(digest).Authorization(TAG_MAC_LENGTH, mac_length));
+    }
+
+    void CheckHmacTestVector(const string& key, const string& message, Digest digest,
+                             const string& expected_mac) {
+        SCOPED_TRACE("CheckHmacTestVector");
+        ASSERT_EQ(ErrorCode::OK,
+                  ImportKey(AuthorizationSetBuilder()
+                                .Authorization(TAG_NO_AUTH_REQUIRED)
+                                .HmacKey(key.size() * 8)
+                                .Authorization(TAG_MIN_MAC_LENGTH, expected_mac.size() * 8)
+                                .Digest(digest),
+                            KeyFormat::RAW, key));
+        string signature = MacMessage(message, digest, expected_mac.size() * 8);
+        EXPECT_EQ(expected_mac, signature) << "Test vector didn't match for digest " << (int)digest;
+        DeleteKey();
+    }
+
+    void CheckAesCtrTestVector(const string& key, const string& nonce, const string& message,
+                               const string& expected_ciphertext) {
+        SCOPED_TRACE("CheckAesCtrTestVector");
+        ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                               .Authorization(TAG_NO_AUTH_REQUIRED)
+                                               .AesEncryptionKey(key.size() * 8)
+                                               .BlockMode(BlockMode::CTR)
+                                               .Authorization(TAG_CALLER_NONCE)
+                                               .Padding(PaddingMode::NONE),
+                                           KeyFormat::RAW, key));
+
+        auto params = AuthorizationSetBuilder()
+                          .Authorization(TAG_NONCE, nonce.data(), nonce.size())
+                          .BlockMode(BlockMode::CTR)
+                          .Padding(PaddingMode::NONE);
+        AuthorizationSet out_params;
+        string ciphertext = EncryptMessage(key_blob_, message, params, &out_params);
+        EXPECT_EQ(expected_ciphertext, ciphertext);
+    }
+
+    void VerifyMessage(const HidlBuf& key_blob, const string& message, const string& signature,
+                       const AuthorizationSet& params) {
+        SCOPED_TRACE("VerifyMessage");
+        AuthorizationSet begin_out_params;
+        ASSERT_EQ(ErrorCode::OK,
+                  Begin(KeyPurpose::VERIFY, key_blob, params, &begin_out_params, &op_handle_));
+
+        string unused;
+        AuthorizationSet finish_params;
+        AuthorizationSet finish_out_params;
+        string output;
+        EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message, signature,
+                                        &finish_out_params, &output));
+        op_handle_ = kOpHandleSentinel;
+        EXPECT_TRUE(output.empty());
+    }
+
+    void VerifyMessage(const string& message, const string& signature,
+                       const AuthorizationSet& params) {
+        SCOPED_TRACE("VerifyMessage");
+        VerifyMessage(key_blob_, message, signature, params);
+    }
+
+    string EncryptMessage(const HidlBuf& key_blob, const string& message,
+                          const AuthorizationSet& in_params, AuthorizationSet* out_params) {
+        SCOPED_TRACE("EncryptMessage");
+        return ProcessMessage(key_blob, KeyPurpose::ENCRYPT, message, in_params, out_params);
+    }
+
+    string EncryptMessage(const string& message, const AuthorizationSet& params,
+                          AuthorizationSet* out_params) {
+        SCOPED_TRACE("EncryptMessage");
+        return EncryptMessage(key_blob_, message, params, out_params);
+    }
+
+    string EncryptMessage(const string& message, const AuthorizationSet& params) {
+        SCOPED_TRACE("EncryptMessage");
+        AuthorizationSet out_params;
+        string ciphertext = EncryptMessage(message, params, &out_params);
+        EXPECT_TRUE(out_params.empty())
+            << "Output params should be empty. Contained: " << out_params;
+        return ciphertext;
+    }
+
+    string DecryptMessage(const HidlBuf& key_blob, const string& ciphertext,
+                          const AuthorizationSet& params) {
+        SCOPED_TRACE("DecryptMessage");
+        AuthorizationSet out_params;
+        string plaintext =
+            ProcessMessage(key_blob, KeyPurpose::DECRYPT, ciphertext, params, &out_params);
+        EXPECT_TRUE(out_params.empty());
+        return plaintext;
+    }
+
+    string DecryptMessage(const string& ciphertext, const AuthorizationSet& params) {
+        SCOPED_TRACE("DecryptMessage");
+        return DecryptMessage(key_blob_, ciphertext, params);
+    }
+
+    template <TagType tag_type, Tag tag, typename ValueT>
+    void CheckKm0CryptoParam(TypedTag<tag_type, tag> ttag, ValueT expected) {
+        SCOPED_TRACE("CheckKm0CryptoParam");
+        if (is_secure_) {
+            EXPECT_TRUE(contains(key_characteristics_.teeEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.softwareEnforced, ttag));
+        } else {
+            EXPECT_TRUE(contains(key_characteristics_.softwareEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.teeEnforced, ttag));
+        }
+    }
+
+    template <TagType tag_type, Tag tag, typename ValueT>
+    void CheckKm1CryptoParam(TypedTag<tag_type, tag> ttag, ValueT expected) {
+        SCOPED_TRACE("CheckKm1CryptoParam");
+        if (is_secure_ && supports_symmetric_) {
+            EXPECT_TRUE(contains(key_characteristics_.teeEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.softwareEnforced, ttag));
+        } else {
+            EXPECT_TRUE(contains(key_characteristics_.softwareEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.teeEnforced, ttag));
+        }
+    }
+
+    template <TagType tag_type, Tag tag, typename ValueT>
+    void CheckKm2CryptoParam(TypedTag<tag_type, tag> ttag, ValueT expected) {
+        SCOPED_TRACE("CheckKm2CryptoParam");
+        if (supports_attestation_) {
+            EXPECT_TRUE(contains(key_characteristics_.teeEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.softwareEnforced, ttag));
+        } else if (!supports_symmetric_ /* KM version < 1 or SW */) {
+            EXPECT_TRUE(contains(key_characteristics_.softwareEnforced, ttag, expected));
+            EXPECT_FALSE(contains(key_characteristics_.teeEnforced, ttag));
+        }
+    }
+
+    void CheckOrigin() {
+        SCOPED_TRACE("CheckOrigin");
+        if (is_secure_ && supports_symmetric_) {
+            EXPECT_TRUE(
+                contains(key_characteristics_.teeEnforced, TAG_ORIGIN, KeyOrigin::IMPORTED));
+        } else if (is_secure_) {
+            EXPECT_TRUE(contains(key_characteristics_.teeEnforced, TAG_ORIGIN, KeyOrigin::UNKNOWN));
+        } else {
+            EXPECT_TRUE(
+                contains(key_characteristics_.softwareEnforced, TAG_ORIGIN, KeyOrigin::IMPORTED));
+        }
+    }
+
+    static bool IsSecure() { return is_secure_; }
+    static bool SupportsEc() { return supports_ec_; }
+    static bool SupportsSymmetric() { return supports_symmetric_; }
+    static bool SupportsAllDigests() { return supports_all_digests_; }
+    static bool SupportsAttestation() { return supports_attestation_; }
+
+    static bool Km2Profile() {
+        return SupportsAttestation() && SupportsAllDigests() && SupportsSymmetric() &&
+               SupportsEc() && IsSecure();
+    }
+
+    static bool Km1Profile() {
+        return !SupportsAttestation() && SupportsSymmetric() && SupportsEc() && IsSecure();
+    }
+
+    static bool Km0Profile() {
+        return !SupportsAttestation() && !SupportsAllDigests() && !SupportsSymmetric() &&
+               IsSecure();
+    }
+
+    static bool SwOnlyProfile() {
+        return !SupportsAttestation() && !SupportsAllDigests() && !SupportsSymmetric() &&
+               !SupportsEc() && !IsSecure();
+    }
+
+    HidlBuf key_blob_;
+    KeyCharacteristics key_characteristics_;
+    OperationHandle op_handle_ = kOpHandleSentinel;
+
+  private:
+    static sp<IKeymasterDevice> keymaster_;
+    static uint32_t os_version_;
+    static uint32_t os_patch_level_;
+
+    static bool is_secure_;
+    static bool supports_ec_;
+    static bool supports_symmetric_;
+    static bool supports_attestation_;
+    static bool supports_all_digests_;
+    static hidl_string name_;
+    static hidl_string author_;
+};
+
+uint32_t expected_keymaster_version() {
+    if (!KeymasterHidlTest::IsSecure()) return 2;  // SW is KM2
+
+    uint32_t keymaster_version = 0;
+    if (KeymasterHidlTest::SupportsSymmetric()) keymaster_version = 1;
+    if (KeymasterHidlTest::SupportsAttestation()) keymaster_version = 2;
+    return keymaster_version;
+}
+
+bool verify_attestation_record(const string& challenge, AuthorizationSet expected_sw_enforced,
+                               AuthorizationSet expected_tee_enforced,
+                               const hidl_vec<uint8_t>& attestation_cert) {
+
+    X509_Ptr cert(parse_cert_blob(attestation_cert));
+    EXPECT_TRUE(!!cert.get());
+    if (!cert.get()) return false;
+
+    ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get());
+    EXPECT_TRUE(!!attest_rec);
+    if (!attest_rec) return false;
+
+    AuthorizationSet att_sw_enforced;
+    AuthorizationSet att_tee_enforced;
+    uint32_t att_attestation_version;
+    uint32_t att_keymaster_version;
+    SecurityLevel att_attestation_security_level;
+    SecurityLevel att_keymaster_security_level;
+    HidlBuf att_challenge;
+    HidlBuf att_unique_id;
+    EXPECT_EQ(ErrorCode::OK,
+              parse_attestation_record(attest_rec->data,                 //
+                                       attest_rec->length,               //
+                                       &att_attestation_version,         //
+                                       &att_attestation_security_level,  //
+                                       &att_keymaster_version,           //
+                                       &att_keymaster_security_level,    //
+                                       &att_challenge,                   //
+                                       &att_sw_enforced,                 //
+                                       &att_tee_enforced,                //
+                                       &att_unique_id));
+
+    EXPECT_EQ(1U, att_attestation_version);
+    EXPECT_EQ(expected_keymaster_version(), att_keymaster_version);
+    EXPECT_EQ(KeymasterHidlTest::IsSecure() ? SecurityLevel::TRUSTED_ENVIRONMENT
+                                            : SecurityLevel::SOFTWARE,
+              att_keymaster_security_level);
+    EXPECT_EQ(KeymasterHidlTest::SupportsAttestation() ? SecurityLevel::TRUSTED_ENVIRONMENT
+                                                       : SecurityLevel::SOFTWARE,
+              att_attestation_security_level);
+
+    EXPECT_EQ(challenge.length(), att_challenge.size());
+    EXPECT_EQ(0, memcmp(challenge.data(), att_challenge.data(), challenge.length()));
+
+    att_sw_enforced.Sort();
+    expected_sw_enforced.Sort();
+    EXPECT_EQ(filter_tags(expected_sw_enforced), filter_tags(att_sw_enforced));
+
+    att_tee_enforced.Sort();
+    expected_tee_enforced.Sort();
+    EXPECT_EQ(filter_tags(expected_tee_enforced), filter_tags(att_tee_enforced));
+
+    return true;
+}
+
+sp<IKeymasterDevice> KeymasterHidlTest::keymaster_;
+uint32_t KeymasterHidlTest::os_version_;
+uint32_t KeymasterHidlTest::os_patch_level_;
+bool KeymasterHidlTest::is_secure_;
+bool KeymasterHidlTest::supports_ec_;
+bool KeymasterHidlTest::supports_symmetric_;
+bool KeymasterHidlTest::supports_all_digests_;
+bool KeymasterHidlTest::supports_attestation_;
+hidl_string KeymasterHidlTest::name_;
+hidl_string KeymasterHidlTest::author_;
+
+typedef KeymasterHidlTest KeymasterVersionTest;
+
+/*
+ * KeymasterVersionTest.SensibleFeatures:
+ *
+ * Queries keymaster to find the set of features it supports. Fails if the combination doesn't
+ * correspond to any well-defined keymaster version.
+ */
+TEST_F(KeymasterVersionTest, SensibleFeatures) {
+    EXPECT_TRUE(Km2Profile() || Km1Profile() || Km0Profile() || SwOnlyProfile())
+        << "Keymaster feature set doesn't fit any reasonable profile.  Reported features:"
+        << "SupportsAttestation [" << SupportsAttestation() << "], "
+        << "SupportsSymmetric [" << SupportsSymmetric() << "], "
+        << "SupportsAllDigests [" << SupportsAllDigests() << "], "
+        << "SupportsEc [" << SupportsEc() << "], "
+        << "IsSecure [" << IsSecure() << "]";
+}
+
+class NewKeyGenerationTest : public KeymasterHidlTest {
+  protected:
+    void CheckBaseParams(const KeyCharacteristics& keyCharacteristics) {
+        // TODO(swillden): Distinguish which params should be in which auth list.
+
+        AuthorizationSet auths(keyCharacteristics.teeEnforced);
+        auths.push_back(AuthorizationSet(keyCharacteristics.softwareEnforced));
+
+        EXPECT_TRUE(auths.Contains(TAG_ORIGIN, KeyOrigin::GENERATED));
+
+        EXPECT_TRUE(auths.Contains(TAG_PURPOSE, KeyPurpose::SIGN));
+        EXPECT_TRUE(auths.Contains(TAG_PURPOSE, KeyPurpose::VERIFY));
+        EXPECT_TRUE(auths.Contains(TAG_USER_ID, 7))
+            << "User ID should be 7, was " << auths.GetTagValue(TAG_USER_ID);
+
+        // Verify that App ID, App data and ROT are NOT included.
+        EXPECT_FALSE(auths.Contains(TAG_ROOT_OF_TRUST));
+        EXPECT_FALSE(auths.Contains(TAG_APPLICATION_ID));
+        EXPECT_FALSE(auths.Contains(TAG_APPLICATION_DATA));
+
+        // Check that some unexpected tags/values are NOT present.
+        EXPECT_FALSE(auths.Contains(TAG_PURPOSE, KeyPurpose::ENCRYPT));
+        EXPECT_FALSE(auths.Contains(TAG_PURPOSE, KeyPurpose::DECRYPT));
+        EXPECT_FALSE(auths.Contains(TAG_AUTH_TIMEOUT, 301));
+
+        // Now check that unspecified, defaulted tags are correct.
+        EXPECT_TRUE(auths.Contains(TAG_CREATION_DATETIME));
+
+        if (SupportsAttestation()) {
+            EXPECT_TRUE(auths.Contains(TAG_OS_VERSION, os_version()))
+                << "OS version is " << os_version() << " key reported "
+                << auths.GetTagValue(TAG_OS_VERSION);
+            EXPECT_TRUE(auths.Contains(TAG_OS_PATCHLEVEL, os_patch_level()))
+                << "OS patch level is " << os_patch_level() << " key reported "
+                << auths.GetTagValue(TAG_OS_PATCHLEVEL);
+        }
+    }
+};
+
+/*
+ * NewKeyGenerationTest.Rsa
+ *
+ * Verifies that keymaster can generate all required RSA key sizes, and that the resulting keys have
+ * correct characteristics.
+ */
+TEST_F(NewKeyGenerationTest, Rsa) {
+    for (auto key_size : {1024, 2048, 3072, 4096}) {
+        HidlBuf key_blob;
+        KeyCharacteristics key_characteristics;
+        ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                                 .RsaSigningKey(key_size, 3)
+                                                 .Digest(Digest::NONE)
+                                                 .Padding(PaddingMode::NONE)
+                                                 .Authorizations(UserAuths()),
+                                             &key_blob, &key_characteristics));
+
+        ASSERT_GT(key_blob.size(), 0U);
+        CheckBaseParams(key_characteristics);
+
+        AuthorizationSet crypto_params;
+        if (IsSecure()) {
+            crypto_params = key_characteristics.teeEnforced;
+        } else {
+            crypto_params = key_characteristics.softwareEnforced;
+        }
+
+        EXPECT_TRUE(crypto_params.Contains(TAG_ALGORITHM, KM_ALGORITHM_RSA));
+        EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
+        EXPECT_TRUE(crypto_params.Contains(TAG_RSA_PUBLIC_EXPONENT, 3));
+
+        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+    }
+}
+
+/*
+ * NewKeyGenerationTest.RsaNoDefaultSize
+ *
+ * Verifies that failing to specify a key size for RSA key generation returns UNSUPPORTED_KEY_SIZE.
+ */
+TEST_F(NewKeyGenerationTest, RsaNoDefaultSize) {
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
+              GenerateKey(AuthorizationSetBuilder()
+                              .Authorization(TAG_ALGORITHM, Algorithm::RSA)
+                              .Authorization(TAG_RSA_PUBLIC_EXPONENT, 3)
+                              .SigningKey()));
+}
+
+/*
+ * NewKeyGenerationTest.Ecdsa
+ *
+ * Verifies that keymaster can generate all required EC key sizes, and that the resulting keys have
+ * correct characteristics.
+ */
+TEST_F(NewKeyGenerationTest, Ecdsa) {
+    for (auto key_size : {224, 256, 384, 521}) {
+        HidlBuf key_blob;
+        KeyCharacteristics key_characteristics;
+        ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                                 .EcdsaSigningKey(key_size)
+                                                 .Digest(Digest::NONE)
+                                                 .Authorizations(UserAuths()),
+                                             &key_blob, &key_characteristics));
+        ASSERT_GT(key_blob.size(), 0U);
+        CheckBaseParams(key_characteristics);
+
+        AuthorizationSet crypto_params;
+        if (IsSecure()) {
+            crypto_params = key_characteristics.teeEnforced;
+        } else {
+            crypto_params = key_characteristics.softwareEnforced;
+        }
+
+        EXPECT_TRUE(crypto_params.Contains(TAG_ALGORITHM, Algorithm::EC));
+        EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
+
+        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+    }
+}
+
+/*
+ * NewKeyGenerationTest.EcdsaDefaultSize
+ *
+ * Verifies that failing to specify a key size for EC key generation returns UNSUPPORTED_KEY_SIZE.
+ */
+TEST_F(NewKeyGenerationTest, EcdsaDefaultSize) {
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
+              GenerateKey(AuthorizationSetBuilder()
+                              .Authorization(TAG_ALGORITHM, Algorithm::EC)
+                              .SigningKey()
+                              .Digest(Digest::NONE)));
+}
+
+/*
+ * NewKeyGenerationTest.EcdsaInvalidSize
+ *
+ * Verifies that failing to specify an invalid key size for EC key generation returns
+ * UNSUPPORTED_KEY_SIZE.
+ */
+TEST_F(NewKeyGenerationTest, EcdsaInvalidSize) {
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
+              GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(190).Digest(Digest::NONE)));
+}
+
+/*
+ * NewKeyGenerationTest.EcdsaMismatchKeySize
+ *
+ * Verifies that specifying mismatched key size and curve for EC key generation returns
+ * INVALID_ARGUMENT.
+ */
+TEST_F(NewKeyGenerationTest, EcdsaMismatchKeySize) {
+    ASSERT_EQ(ErrorCode::INVALID_ARGUMENT,
+              GenerateKey(AuthorizationSetBuilder()
+                              .EcdsaSigningKey(224)
+                              .Authorization(TAG_EC_CURVE, EcCurve::P_256)
+                              .Digest(Digest::NONE)))
+        << "(Possibly b/36233343)";
+}
+
+TEST_F(NewKeyGenerationTest, EcdsaAllValidSizes) {
+    size_t valid_sizes[] = {224, 256, 384, 521};
+    for (size_t size : valid_sizes) {
+        EXPECT_EQ(ErrorCode::OK,
+                  GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(size).Digest(Digest::NONE)))
+            << "Failed to generate size: " << size;
+        DeleteKey();
+    }
+}
+
+/*
+ * NewKeyGenerationTest.EcdsaAllValidCurves
+ *
+ * Verifies that keymaster supports all required EC curves.
+ */
+TEST_F(NewKeyGenerationTest, EcdsaAllValidCurves) {
+    EcCurve curves[] = {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521};
+    for (auto curve : curves) {
+        EXPECT_EQ(
+            ErrorCode::OK,
+            GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(Digest::SHA_2_512)))
+            << "Failed to generate key on curve: " << curve;
+        DeleteKey();
+    }
+}
+
+/*
+ * NewKeyGenerationTest.Hmac
+ *
+ * Verifies that keymaster supports all required digests, and that the resulting keys have correct
+ * characteristics.
+ */
+TEST_F(NewKeyGenerationTest, Hmac) {
+    for (auto digest : {Digest::MD5, Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256,
+                        Digest::SHA_2_384, Digest::SHA_2_512}) {
+        HidlBuf key_blob;
+        KeyCharacteristics key_characteristics;
+        constexpr size_t key_size = 128;
+        ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                                 .HmacKey(key_size)
+                                                 .Digest(digest)
+                                                 .Authorization(TAG_MIN_MAC_LENGTH, 128)
+                                                 .Authorizations(UserAuths()),
+                                             &key_blob, &key_characteristics));
+
+        ASSERT_GT(key_blob.size(), 0U);
+        CheckBaseParams(key_characteristics);
+
+        AuthorizationSet teeEnforced = key_characteristics.teeEnforced;
+        AuthorizationSet softwareEnforced = key_characteristics.softwareEnforced;
+        if (SupportsAttestation() || SupportsAllDigests()) {
+            // Either KM2, which must support all, or KM1 that claims full support
+            EXPECT_TRUE(teeEnforced.Contains(TAG_ALGORITHM, Algorithm::HMAC));
+            EXPECT_TRUE(teeEnforced.Contains(TAG_KEY_SIZE, key_size));
+        } else if (SupportsSymmetric()) {
+            if (digest == Digest::SHA1 || digest == Digest::SHA_2_256) {
+                // KM1 must support SHA1 and SHA256 in hardware
+                EXPECT_TRUE(teeEnforced.Contains(TAG_ALGORITHM, Algorithm::HMAC));
+                EXPECT_TRUE(teeEnforced.Contains(TAG_KEY_SIZE, key_size));
+            } else {
+                // Othere digests may or may not be supported
+                EXPECT_TRUE(teeEnforced.Contains(TAG_ALGORITHM, Algorithm::HMAC) ||
+                            softwareEnforced.Contains(TAG_ALGORITHM, Algorithm::HMAC));
+                EXPECT_TRUE(teeEnforced.Contains(TAG_KEY_SIZE, key_size) ||
+                            softwareEnforced.Contains(TAG_KEY_SIZE, key_size));
+            }
+        } else {
+            // KM0 and SW KM do all digests in SW.
+            EXPECT_TRUE(softwareEnforced.Contains(TAG_ALGORITHM, Algorithm::HMAC));
+            EXPECT_TRUE(softwareEnforced.Contains(TAG_KEY_SIZE, key_size));
+        }
+
+        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+    }
+}
+
+/*
+ * NewKeyGenerationTest.HmacCheckKeySizes
+ *
+ * Verifies that keymaster supports all key sizes, and rejects all invalid key sizes.
+ */
+TEST_F(NewKeyGenerationTest, HmacCheckKeySizes) {
+    for (size_t key_size = 0; key_size <= 512; ++key_size) {
+        if (key_size < 64 || key_size % 8 != 0) {
+            // To keep this test from being very slow, we only test a random fraction of non-byte
+            // key sizes.  We test only ~10% of such cases. Since there are 392 of them, we expect
+            // to run ~40 of them in each run.
+            if (key_size % 8 == 0 || random() % 10 == 0) {
+                EXPECT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
+                          GenerateKey(AuthorizationSetBuilder()
+                                          .HmacKey(key_size)
+                                          .Digest(Digest::SHA_2_256)
+                                          .Authorization(TAG_MIN_MAC_LENGTH, 256)))
+                    << "HMAC key size " << key_size << " invalid (Possibly b/33462346)";
+            }
+        } else {
+            EXPECT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                                     .HmacKey(key_size)
+                                                     .Digest(Digest::SHA_2_256)
+                                                     .Authorization(TAG_MIN_MAC_LENGTH, 256)));
+            DeleteKey();
+        }
+    }
+}
+
+/*
+ * NewKeyGenerationTest.HmacCheckMinMacLengths
+ *
+ * Verifies that keymaster supports all required MAC lengths and rejects all invalid lengths.  This
+ * test is probabilistic in order to keep the runtime down, but any failure prints out the specific
+ * MAC length that failed, so reproducing a failed run will be easy.
+ */
+TEST_F(NewKeyGenerationTest, HmacCheckMinMacLengths) {
+    for (size_t min_mac_length = 0; min_mac_length <= 256; ++min_mac_length) {
+        if (min_mac_length < 64 || min_mac_length % 8 != 0) {
+            // To keep this test from being very long, we only test a random fraction of non-byte
+            // lengths.  We test only ~10% of such cases. Since there are 172 of them, we expect to
+            // run ~17 of them in each run.
+            if (min_mac_length % 8 == 0 || random() % 10 == 0) {
+                EXPECT_EQ(ErrorCode::UNSUPPORTED_MIN_MAC_LENGTH,
+                          GenerateKey(AuthorizationSetBuilder()
+                                          .HmacKey(128)
+                                          .Digest(Digest::SHA_2_256)
+                                          .Authorization(TAG_MIN_MAC_LENGTH, min_mac_length)))
+                    << "HMAC min mac length " << min_mac_length << " invalid.";
+            }
+        } else {
+            EXPECT_EQ(ErrorCode::OK,
+                      GenerateKey(AuthorizationSetBuilder()
+                                      .HmacKey(128)
+                                      .Digest(Digest::SHA_2_256)
+                                      .Authorization(TAG_MIN_MAC_LENGTH, min_mac_length)));
+            DeleteKey();
+        }
+    }
+}
+
+/*
+ * NewKeyGenerationTest.HmacMultipleDigests
+ *
+ * Verifies that keymaster rejects HMAC key generation with multiple specified digest algorithms.
+ */
+TEST_F(NewKeyGenerationTest, HmacMultipleDigests) {
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_DIGEST,
+              GenerateKey(AuthorizationSetBuilder()
+                              .HmacKey(128)
+                              .Digest(Digest::SHA1)
+                              .Digest(Digest::SHA_2_256)
+                              .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+}
+
+/*
+ * NewKeyGenerationTest.HmacDigestNone
+ *
+ * Verifies that keymaster rejects HMAC key generation with no digest or Digest::NONE
+ */
+TEST_F(NewKeyGenerationTest, HmacDigestNone) {
+    ASSERT_EQ(
+        ErrorCode::UNSUPPORTED_DIGEST,
+        GenerateKey(AuthorizationSetBuilder().HmacKey(128).Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_DIGEST,
+              GenerateKey(AuthorizationSetBuilder()
+                              .HmacKey(128)
+                              .Digest(Digest::NONE)
+                              .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+}
+
+typedef KeymasterHidlTest GetKeyCharacteristicsTest;
+
+/*
+ * GetKeyCharacteristicsTest.HmacDigestNone
+ *
+ * Verifies that getKeyCharacteristics functions, and that generated and retrieved key
+ * characteristics match.
+ */
+TEST_F(GetKeyCharacteristicsTest, SimpleRsa) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(256, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+
+    KeyCharacteristics retrieved_chars;
+    ASSERT_EQ(ErrorCode::OK, GetCharacteristics(key_blob_, &retrieved_chars));
+
+    AuthorizationSet gen_sw = key_characteristics_.softwareEnforced;
+    AuthorizationSet gen_tee = key_characteristics_.teeEnforced;
+    AuthorizationSet retrieved_sw = retrieved_chars.softwareEnforced;
+    AuthorizationSet retrieved_tee = retrieved_chars.teeEnforced;
+
+    EXPECT_EQ(gen_sw, retrieved_sw);
+    EXPECT_EQ(gen_tee, retrieved_tee);
+}
+
+typedef KeymasterHidlTest SigningOperationsTest;
+
+/*
+ * SigningOperationsTest.RsaSuccess
+ *
+ * Verifies that raw RSA signature operations succeed.
+ */
+TEST_F(SigningOperationsTest, RsaSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)));
+    string message = "12345678901234567890123456789012";
+    string signature = SignMessage(
+        message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
+}
+
+/*
+ * SigningOperationsTest.RsaPssSha256Success
+ *
+ * Verifies that RSA-PSS signature operations succeed.
+ */
+TEST_F(SigningOperationsTest, RsaPssSha256Success) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Padding(PaddingMode::RSA_PSS)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)));
+    // Use large message, which won't work without digesting.
+    string message(1024, 'a');
+    string signature = SignMessage(
+        message, AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Padding(PaddingMode::RSA_PSS));
+}
+
+/*
+ * SigningOperationsTest.RsaPaddingNoneDoesNotAllowOther
+ *
+ * Verifies that keymaster rejects signature operations that specify a padding mode when the key
+ * supports only unpadded operations.
+ */
+TEST_F(SigningOperationsTest, RsaPaddingNoneDoesNotAllowOther) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::NONE)));
+    string message = "12345678901234567890123456789012";
+    string signature;
+
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_PADDING_MODE,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
+                                          .Digest(Digest::NONE)
+                                          .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+}
+
+/*
+ * SigningOperationsTest.RsaPkcs1Sha256Success
+ *
+ * Verifies that digested RSA-PKCS1 signature operations succeed.
+ */
+TEST_F(SigningOperationsTest, RsaPkcs1Sha256Success) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    string message(1024, 'a');
+    string signature = SignMessage(message, AuthorizationSetBuilder()
+                                                .Digest(Digest::SHA_2_256)
+                                                .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN));
+}
+
+/*
+ * SigningOperationsTest.RsaPkcs1NoDigestSuccess
+ *
+ * Verifies that undigested RSA-PKCS1 signature operations succeed.
+ */
+TEST_F(SigningOperationsTest, RsaPkcs1NoDigestSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    string message(53, 'a');
+    string signature = SignMessage(
+        message,
+        AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::RSA_PKCS1_1_5_SIGN));
+}
+
+/*
+ * SigningOperationsTest.RsaPkcs1NoDigestTooLarge
+ *
+ * Verifies that undigested RSA-PKCS1 signature operations fail with the correct error code when
+ * given a too-long message.
+ */
+TEST_F(SigningOperationsTest, RsaPkcs1NoDigestTooLong) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    string message(129, 'a');
+
+    EXPECT_EQ(ErrorCode::OK,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
+                                          .Digest(Digest::NONE)
+                                          .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    string signature;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &signature));
+}
+
+/*
+ * SigningOperationsTest.RsaPssSha512TooSmallKey
+ *
+ * Verifies that undigested RSA-PSS signature operations fail with the correct error code when
+ * used with a key that is too small for the message.
+ *
+ * A PSS-padded message is of length salt_size + digest_size + 16 (sizes in bits), and the keymaster
+ * specification requires that salt_size == digest_size, so the message will be digest_size * 2 +
+ * 16. Such a message can only be signed by a given key if the key is at least that size. This test
+ * uses SHA512, which has a digest_size == 512, so the message size is 1040 bits, too large for a
+ * 1024-bit key.
+ */
+TEST_F(SigningOperationsTest, RsaPssSha512TooSmallKey) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::SHA_2_512)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::RSA_PSS)));
+    EXPECT_EQ(
+        ErrorCode::INCOMPATIBLE_DIGEST,
+        Begin(KeyPurpose::SIGN,
+              AuthorizationSetBuilder().Digest(Digest::SHA_2_512).Padding(PaddingMode::RSA_PSS)))
+        << "(Possibly b/33346750)";
+}
+
+/*
+ * SigningOperationsTest.RsaNoPaddingTooLong
+ *
+ * Verifies that raw RSA signature operations fail with the correct error code when
+ * given a too-long message.
+ */
+TEST_F(SigningOperationsTest, RsaNoPaddingTooLong) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    // One byte too long
+    string message(1024 / 8 + 1, 'a');
+    ASSERT_EQ(ErrorCode::OK,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
+                                          .Digest(Digest::NONE)
+                                          .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    string result;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &result));
+
+    // Very large message that should exceed the transfer buffer size of any reasonable TEE.
+    message = string(128 * 1024, 'a');
+    ASSERT_EQ(ErrorCode::OK,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
+                                          .Digest(Digest::NONE)
+                                          .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &result));
+}
+
+/*
+ * SigningOperationsTest.RsaAbort
+ *
+ * Verifies that operations can be aborted correctly.  Uses an RSA signing operation for the test,
+ * but the behavior should be algorithm and purpose-independent.
+ */
+TEST_F(SigningOperationsTest, RsaAbort) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Padding(PaddingMode::NONE)));
+
+    ASSERT_EQ(ErrorCode::OK,
+              Begin(KeyPurpose::SIGN,
+                    AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE)));
+    EXPECT_EQ(ErrorCode::OK, Abort(op_handle_));
+
+    // Another abort should fail
+    EXPECT_EQ(ErrorCode::INVALID_OPERATION_HANDLE, Abort(op_handle_));
+
+    // Set to sentinel, so TearDown() doesn't try to abort again.
+    op_handle_ = kOpHandleSentinel;
+}
+
+/*
+ * SigningOperationsTest.RsaUnsupportedPadding
+ *
+ * Verifies that RSA operations fail with the correct error (but key gen succeeds) when used with a
+ * padding mode inappropriate for RSA.
+ */
+TEST_F(SigningOperationsTest, RsaUnsupportedPadding) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Digest(Digest::SHA_2_256 /* supported digest */)
+                                             .Padding(PaddingMode::PKCS7)));
+    ASSERT_EQ(
+        ErrorCode::UNSUPPORTED_PADDING_MODE,
+        Begin(KeyPurpose::SIGN,
+              AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Padding(PaddingMode::PKCS7)));
+}
+
+/*
+ * SigningOperationsTest.RsaPssNoDigest
+ *
+ * Verifies that RSA PSS operations fail when no digest is used.  PSS requires a digest.
+ */
+TEST_F(SigningOperationsTest, RsaNoDigest) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(1024, 3)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::RSA_PSS)));
+    ASSERT_EQ(ErrorCode::INCOMPATIBLE_DIGEST,
+              Begin(KeyPurpose::SIGN,
+                    AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::RSA_PSS)));
+
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_DIGEST,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder().Padding(PaddingMode::RSA_PSS)));
+}
+
+/*
+ * SigningOperationsTest.RsaPssNoDigest
+ *
+ * Verifies that RSA operations fail when no padding mode is specified.  PaddingMode::NONE is
+ * supported in some cases (as validated in other tests), but a mode must be specified.
+ */
+TEST_F(SigningOperationsTest, RsaNoPadding) {
+    // Padding must be specified
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaKey(1024, 3)
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .SigningKey()
+                                             .Digest(Digest::NONE)));
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_PADDING_MODE,
+              Begin(KeyPurpose::SIGN, AuthorizationSetBuilder().Digest(Digest::NONE)));
+}
+
+/*
+ * SigningOperationsTest.RsaShortMessage
+ *
+ * Verifies that raw RSA signatures succeed with a message shorter than the key size.
+ */
+TEST_F(SigningOperationsTest, RsaTooShortMessage) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+
+    // Barely shorter
+    string message(1024 / 8 - 1, 'a');
+    SignMessage(message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
+
+    // Much shorter
+    message = "a";
+    SignMessage(message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
+}
+
+/*
+ * SigningOperationsTest.RsaSignWithEncryptionKey
+ *
+ * Verifies that RSA encryption keys cannot be used to sign.
+ */
+TEST_F(SigningOperationsTest, RsaSignWithEncryptionKey) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+    ASSERT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE,
+              Begin(KeyPurpose::SIGN,
+                    AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE)));
+}
+
+/*
+ * SigningOperationsTest.RsaSignTooLargeMessage
+ *
+ * Verifies that attempting a raw signature of a message which is the same length as the key, but
+ * numerically larger than the public modulus, fails with the correct error.
+ */
+TEST_F(SigningOperationsTest, RsaSignTooLargeMessage) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+
+    // Largest possible message will always be larger than the public modulus.
+    string message(1024 / 8, static_cast<char>(0xff));
+    ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::SIGN, AuthorizationSetBuilder()
+                                                         .Authorization(TAG_NO_AUTH_REQUIRED)
+                                                         .Digest(Digest::NONE)
+                                                         .Padding(PaddingMode::NONE)));
+    string signature;
+    ASSERT_EQ(ErrorCode::INVALID_ARGUMENT, Finish(message, &signature));
+}
+
+/*
+ * SigningOperationsTest.EcdsaAllSizesAndHashes
+ *
+ * Verifies that ECDSA operations succeed with all possible key sizes and hashes.
+ */
+TEST_F(SigningOperationsTest, EcdsaAllSizesAndHashes) {
+    for (auto key_size : {224, 256, 384, 521}) {
+        for (auto digest : {
+                 Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384,
+                 Digest::SHA_2_512,
+             }) {
+            ErrorCode error = GenerateKey(AuthorizationSetBuilder()
+                                              .Authorization(TAG_NO_AUTH_REQUIRED)
+                                              .EcdsaSigningKey(key_size)
+                                              .Digest(digest));
+            EXPECT_EQ(ErrorCode::OK, error) << "Failed to generate ECDSA key with size " << key_size
+                                            << " and digest " << digest;
+            if (error != ErrorCode::OK) continue;
+
+            string message(1024, 'a');
+            if (digest == Digest::NONE) message.resize(key_size / 8);
+            SignMessage(message, AuthorizationSetBuilder().Digest(digest));
+            DeleteKey();
+        }
+    }
+}
+
+/*
+ * SigningOperationsTest.EcdsaAllCurves
+ *
+ * Verifies that ECDSA operations succeed with all possible curves.
+ */
+TEST_F(SigningOperationsTest, EcdsaAllCurves) {
+    for (auto curve : {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}) {
+        ErrorCode error = GenerateKey(AuthorizationSetBuilder()
+                                          .Authorization(TAG_NO_AUTH_REQUIRED)
+                                          .EcdsaSigningKey(curve)
+                                          .Digest(Digest::SHA_2_256));
+        EXPECT_EQ(ErrorCode::OK, error) << "Failed to generate ECDSA key with curve " << curve;
+        if (error != ErrorCode::OK) continue;
+
+        string message(1024, 'a');
+        SignMessage(message, AuthorizationSetBuilder().Digest(Digest::SHA_2_256));
+        DeleteKey();
+    }
+}
+
+/*
+ * SigningOperationsTest.EcdsaNoDigestHugeData
+ *
+ * Verifies that ECDSA operations support very large messages, even without digesting.  This should
+ * work because ECDSA actually only signs the leftmost L_n bits of the message, however large it may
+ * be.  Not using digesting is a bad idea, but in some cases digesting is done by the framework.
+ */
+TEST_F(SigningOperationsTest, EcdsaNoDigestHugeData) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .EcdsaSigningKey(224)
+                                             .Digest(Digest::NONE)));
+    string message(64 * 1024, 'a');
+    SignMessage(message, AuthorizationSetBuilder().Digest(Digest::NONE));
+}
+
+/*
+ * SigningOperationsTest.AesEcbSign
+ *
+ * Verifies that attempts to use AES keys to sign fail in the correct way.
+ */
+TEST_F(SigningOperationsTest, AesEcbSign) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .SigningKey()
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)))
+        << "(Possibly b/36252957)";
+
+    AuthorizationSet out_params;
+    EXPECT_EQ(ErrorCode::UNSUPPORTED_PURPOSE,
+              Begin(KeyPurpose::SIGN, AuthorizationSet() /* in_params */, &out_params))
+        << "(Possibly b/36233187)";
+
+    EXPECT_EQ(ErrorCode::UNSUPPORTED_PURPOSE,
+              Begin(KeyPurpose::VERIFY, AuthorizationSet() /* in_params */, &out_params))
+        << "(Possibly b/36233187)";
+}
+
+/*
+ * SigningOperationsTest.HmacAllDigests
+ *
+ * Verifies that HMAC works with all digests.
+ */
+TEST_F(SigningOperationsTest, HmacAllDigests) {
+    for (auto digest : {Digest::SHA1, Digest::SHA_2_224, Digest::SHA_2_256, Digest::SHA_2_384,
+                        Digest::SHA_2_512}) {
+        ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                                 .Authorization(TAG_NO_AUTH_REQUIRED)
+                                                 .HmacKey(128)
+                                                 .Digest(digest)
+                                                 .Authorization(TAG_MIN_MAC_LENGTH, 160)))
+            << "Failed to create HMAC key with digest " << digest;
+        string message = "12345678901234567890123456789012";
+        string signature = MacMessage(message, digest, 160);
+        EXPECT_EQ(160U / 8U, signature.size())
+            << "Failed to sign with HMAC key with digest " << digest;
+        DeleteKey();
+    }
+}
+
+/*
+ * SigningOperationsTest.HmacSha256TooLargeMacLength
+ *
+ * Verifies that HMAC fails in the correct way when asked to generate a MAC larger than the digest
+ * size.
+ */
+TEST_F(SigningOperationsTest, HmacSha256TooLargeMacLength) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .HmacKey(128)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 256)));
+    AuthorizationSet output_params;
+    EXPECT_EQ(
+        ErrorCode::UNSUPPORTED_MAC_LENGTH,
+        Begin(
+            KeyPurpose::SIGN, key_blob_,
+            AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Authorization(TAG_MAC_LENGTH, 264),
+            &output_params, &op_handle_));
+}
+
+/*
+ * SigningOperationsTest.HmacSha256TooSmallMacLength
+ *
+ * Verifies that HMAC fails in the correct way when asked to generate a MAC smaller than the
+ * specified minimum MAC length.
+ */
+TEST_F(SigningOperationsTest, HmacSha256TooSmallMacLength) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .HmacKey(128)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+    AuthorizationSet output_params;
+    EXPECT_EQ(
+        ErrorCode::INVALID_MAC_LENGTH,
+        Begin(
+            KeyPurpose::SIGN, key_blob_,
+            AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Authorization(TAG_MAC_LENGTH, 120),
+            &output_params, &op_handle_));
+}
+
+/*
+ * SigningOperationsTest.HmacRfc4231TestCase3
+ *
+ * Validates against the test vectors from RFC 4231 test case 3.
+ */
+TEST_F(SigningOperationsTest, HmacRfc4231TestCase3) {
+    string key(20, 0xaa);
+    string message(50, 0xdd);
+    uint8_t sha_224_expected[] = {
+        0x7f, 0xb3, 0xcb, 0x35, 0x88, 0xc6, 0xc1, 0xf6, 0xff, 0xa9, 0x69, 0x4d, 0x7d, 0x6a,
+        0xd2, 0x64, 0x93, 0x65, 0xb0, 0xc1, 0xf6, 0x5d, 0x69, 0xd1, 0xec, 0x83, 0x33, 0xea,
+    };
+    uint8_t sha_256_expected[] = {
+        0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, 0x85, 0x4d, 0xb8,
+        0xeb, 0xd0, 0x91, 0x81, 0xa7, 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8,
+        0xc1, 0x22, 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe,
+    };
+    uint8_t sha_384_expected[] = {
+        0x88, 0x06, 0x26, 0x08, 0xd3, 0xe6, 0xad, 0x8a, 0x0a, 0xa2, 0xac, 0xe0,
+        0x14, 0xc8, 0xa8, 0x6f, 0x0a, 0xa6, 0x35, 0xd9, 0x47, 0xac, 0x9f, 0xeb,
+        0xe8, 0x3e, 0xf4, 0xe5, 0x59, 0x66, 0x14, 0x4b, 0x2a, 0x5a, 0xb3, 0x9d,
+        0xc1, 0x38, 0x14, 0xb9, 0x4e, 0x3a, 0xb6, 0xe1, 0x01, 0xa3, 0x4f, 0x27,
+    };
+    uint8_t sha_512_expected[] = {
+        0xfa, 0x73, 0xb0, 0x08, 0x9d, 0x56, 0xa2, 0x84, 0xef, 0xb0, 0xf0, 0x75, 0x6c,
+        0x89, 0x0b, 0xe9, 0xb1, 0xb5, 0xdb, 0xdd, 0x8e, 0xe8, 0x1a, 0x36, 0x55, 0xf8,
+        0x3e, 0x33, 0xb2, 0x27, 0x9d, 0x39, 0xbf, 0x3e, 0x84, 0x82, 0x79, 0xa7, 0x22,
+        0xc8, 0x06, 0xb4, 0x85, 0xa4, 0x7e, 0x67, 0xc8, 0x07, 0xb9, 0x46, 0xa3, 0x37,
+        0xbe, 0xe8, 0x94, 0x26, 0x74, 0x27, 0x88, 0x59, 0xe1, 0x32, 0x92, 0xfb,
+    };
+
+    CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
+}
+
+/*
+ * SigningOperationsTest.HmacRfc4231TestCase5
+ *
+ * Validates against the test vectors from RFC 4231 test case 5.
+ */
+TEST_F(SigningOperationsTest, HmacRfc4231TestCase5) {
+    string key(20, 0x0c);
+    string message = "Test With Truncation";
+
+    uint8_t sha_224_expected[] = {
+        0x0e, 0x2a, 0xea, 0x68, 0xa9, 0x0c, 0x8d, 0x37,
+        0xc9, 0x88, 0xbc, 0xdb, 0x9f, 0xca, 0x6f, 0xa8,
+    };
+    uint8_t sha_256_expected[] = {
+        0xa3, 0xb6, 0x16, 0x74, 0x73, 0x10, 0x0e, 0xe0,
+        0x6e, 0x0c, 0x79, 0x6c, 0x29, 0x55, 0x55, 0x2b,
+    };
+    uint8_t sha_384_expected[] = {
+        0x3a, 0xbf, 0x34, 0xc3, 0x50, 0x3b, 0x2a, 0x23,
+        0xa4, 0x6e, 0xfc, 0x61, 0x9b, 0xae, 0xf8, 0x97,
+    };
+    uint8_t sha_512_expected[] = {
+        0x41, 0x5f, 0xad, 0x62, 0x71, 0x58, 0x0a, 0x53,
+        0x1d, 0x41, 0x79, 0xbc, 0x89, 0x1d, 0x87, 0xa6,
+    };
+
+    CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
+}
+
+/*
+ * SigningOperationsTest.HmacRfc4231TestCase6
+ *
+ * Validates against the test vectors from RFC 4231 test case 6.
+ */
+TEST_F(SigningOperationsTest, HmacRfc4231TestCase6) {
+    string key(131, 0xaa);
+    string message = "Test Using Larger Than Block-Size Key - Hash Key First";
+
+    uint8_t sha_224_expected[] = {
+        0x95, 0xe9, 0xa0, 0xdb, 0x96, 0x20, 0x95, 0xad, 0xae, 0xbe, 0x9b, 0x2d, 0x6f, 0x0d,
+        0xbc, 0xe2, 0xd4, 0x99, 0xf1, 0x12, 0xf2, 0xd2, 0xb7, 0x27, 0x3f, 0xa6, 0x87, 0x0e,
+    };
+    uint8_t sha_256_expected[] = {
+        0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, 0x0d, 0x8a, 0x26,
+        0xaa, 0xcb, 0xf5, 0xb7, 0x7f, 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28,
+        0xc5, 0x14, 0x05, 0x46, 0x04, 0x0f, 0x0e, 0xe3, 0x7f, 0x54,
+    };
+    uint8_t sha_384_expected[] = {
+        0x4e, 0xce, 0x08, 0x44, 0x85, 0x81, 0x3e, 0x90, 0x88, 0xd2, 0xc6, 0x3a,
+        0x04, 0x1b, 0xc5, 0xb4, 0x4f, 0x9e, 0xf1, 0x01, 0x2a, 0x2b, 0x58, 0x8f,
+        0x3c, 0xd1, 0x1f, 0x05, 0x03, 0x3a, 0xc4, 0xc6, 0x0c, 0x2e, 0xf6, 0xab,
+        0x40, 0x30, 0xfe, 0x82, 0x96, 0x24, 0x8d, 0xf1, 0x63, 0xf4, 0x49, 0x52,
+    };
+    uint8_t sha_512_expected[] = {
+        0x80, 0xb2, 0x42, 0x63, 0xc7, 0xc1, 0xa3, 0xeb, 0xb7, 0x14, 0x93, 0xc1, 0xdd,
+        0x7b, 0xe8, 0xb4, 0x9b, 0x46, 0xd1, 0xf4, 0x1b, 0x4a, 0xee, 0xc1, 0x12, 0x1b,
+        0x01, 0x37, 0x83, 0xf8, 0xf3, 0x52, 0x6b, 0x56, 0xd0, 0x37, 0xe0, 0x5f, 0x25,
+        0x98, 0xbd, 0x0f, 0xd2, 0x21, 0x5d, 0x6a, 0x1e, 0x52, 0x95, 0xe6, 0x4f, 0x73,
+        0xf6, 0x3f, 0x0a, 0xec, 0x8b, 0x91, 0x5a, 0x98, 0x5d, 0x78, 0x65, 0x98,
+    };
+
+    CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
+}
+
+/*
+ * SigningOperationsTest.HmacRfc4231TestCase7
+ *
+ * Validates against the test vectors from RFC 4231 test case 7.
+ */
+TEST_F(SigningOperationsTest, HmacRfc4231TestCase7) {
+    string key(131, 0xaa);
+    string message = "This is a test using a larger than block-size key and a larger than "
+                     "block-size data. The key needs to be hashed before being used by the HMAC "
+                     "algorithm.";
+
+    uint8_t sha_224_expected[] = {
+        0x3a, 0x85, 0x41, 0x66, 0xac, 0x5d, 0x9f, 0x02, 0x3f, 0x54, 0xd5, 0x17, 0xd0, 0xb3,
+        0x9d, 0xbd, 0x94, 0x67, 0x70, 0xdb, 0x9c, 0x2b, 0x95, 0xc9, 0xf6, 0xf5, 0x65, 0xd1,
+    };
+    uint8_t sha_256_expected[] = {
+        0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, 0x27, 0x63, 0x5f,
+        0xbc, 0xd5, 0xb0, 0xe9, 0x44, 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07,
+        0x13, 0x93, 0x8a, 0x7f, 0x51, 0x53, 0x5c, 0x3a, 0x35, 0xe2,
+    };
+    uint8_t sha_384_expected[] = {
+        0x66, 0x17, 0x17, 0x8e, 0x94, 0x1f, 0x02, 0x0d, 0x35, 0x1e, 0x2f, 0x25,
+        0x4e, 0x8f, 0xd3, 0x2c, 0x60, 0x24, 0x20, 0xfe, 0xb0, 0xb8, 0xfb, 0x9a,
+        0xdc, 0xce, 0xbb, 0x82, 0x46, 0x1e, 0x99, 0xc5, 0xa6, 0x78, 0xcc, 0x31,
+        0xe7, 0x99, 0x17, 0x6d, 0x38, 0x60, 0xe6, 0x11, 0x0c, 0x46, 0x52, 0x3e,
+    };
+    uint8_t sha_512_expected[] = {
+        0xe3, 0x7b, 0x6a, 0x77, 0x5d, 0xc8, 0x7d, 0xba, 0xa4, 0xdf, 0xa9, 0xf9, 0x6e,
+        0x5e, 0x3f, 0xfd, 0xde, 0xbd, 0x71, 0xf8, 0x86, 0x72, 0x89, 0x86, 0x5d, 0xf5,
+        0xa3, 0x2d, 0x20, 0xcd, 0xc9, 0x44, 0xb6, 0x02, 0x2c, 0xac, 0x3c, 0x49, 0x82,
+        0xb1, 0x0d, 0x5e, 0xeb, 0x55, 0xc3, 0xe4, 0xde, 0x15, 0x13, 0x46, 0x76, 0xfb,
+        0x6d, 0xe0, 0x44, 0x60, 0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58,
+    };
+
+    CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
+    CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
+}
+
+typedef KeymasterHidlTest VerificationOperationsTest;
+
+/*
+ * VerificationOperationsTest.RsaSuccess
+ *
+ * Verifies that a simple RSA signature/verification sequence succeeds.
+ */
+TEST_F(VerificationOperationsTest, RsaSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+    string message = "12345678901234567890123456789012";
+    string signature = SignMessage(
+        message, AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
+    VerifyMessage(message, signature,
+                  AuthorizationSetBuilder().Digest(Digest::NONE).Padding(PaddingMode::NONE));
+}
+
+/*
+ * VerificationOperationsTest.RsaSuccess
+ *
+ * Verifies RSA signature/verification for all padding modes and digests.
+ */
+TEST_F(VerificationOperationsTest, RsaAllPaddingsAndDigests) {
+    ASSERT_EQ(ErrorCode::OK,
+              GenerateKey(AuthorizationSetBuilder()
+                              .Authorization(TAG_NO_AUTH_REQUIRED)
+                              .RsaSigningKey(2048, 3)
+                              .Digest(Digest::NONE, Digest::MD5, Digest::SHA1, Digest::SHA_2_224,
+                                      Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512)
+                              .Padding(PaddingMode::NONE)
+                              .Padding(PaddingMode::RSA_PSS)
+                              .Padding(PaddingMode::RSA_PKCS1_1_5_SIGN)));
+
+    string message(128, 'a');
+    string corrupt_message(message);
+    ++corrupt_message[corrupt_message.size() / 2];
+
+    for (auto padding :
+         {PaddingMode::NONE, PaddingMode::RSA_PSS, PaddingMode::RSA_PKCS1_1_5_SIGN}) {
+
+        for (auto digest : {Digest::NONE, Digest::MD5, Digest::SHA1, Digest::SHA_2_224,
+                            Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512}) {
+            if (padding == PaddingMode::NONE && digest != Digest::NONE) {
+                // Digesting only makes sense with padding.
+                continue;
+            }
+
+            if (padding == PaddingMode::RSA_PSS && digest == Digest::NONE) {
+                // PSS requires digesting.
+                continue;
+            }
+
+            string signature =
+                SignMessage(message, AuthorizationSetBuilder().Digest(digest).Padding(padding));
+            VerifyMessage(message, signature,
+                          AuthorizationSetBuilder().Digest(digest).Padding(padding));
+
+            if (digest != Digest::NONE) {
+                // Verify with OpenSSL.
+                HidlBuf pubkey;
+                ASSERT_EQ(ErrorCode::OK, ExportKey(KeyFormat::X509, &pubkey));
+
+                const uint8_t* p = pubkey.data();
+                EVP_PKEY_Ptr pkey(d2i_PUBKEY(nullptr /* alloc new */, &p, pubkey.size()));
+                ASSERT_TRUE(pkey.get());
+
+                EVP_MD_CTX digest_ctx;
+                EVP_MD_CTX_init(&digest_ctx);
+                EVP_PKEY_CTX* pkey_ctx;
+                const EVP_MD* md = openssl_digest(digest);
+                ASSERT_NE(md, nullptr);
+                EXPECT_EQ(1, EVP_DigestVerifyInit(&digest_ctx, &pkey_ctx, md, nullptr /* engine */,
+                                                  pkey.get()));
+
+                switch (padding) {
+                case PaddingMode::RSA_PSS:
+                    EXPECT_GT(EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, RSA_PKCS1_PSS_PADDING), 0);
+                    EXPECT_GT(EVP_PKEY_CTX_set_rsa_pss_saltlen(pkey_ctx, EVP_MD_size(md)), 0);
+                    break;
+                case PaddingMode::RSA_PKCS1_1_5_SIGN:
+                    // PKCS1 is the default; don't need to set anything.
+                    break;
+                default:
+                    FAIL();
+                    break;
+                }
+
+                EXPECT_EQ(1, EVP_DigestVerifyUpdate(&digest_ctx, message.data(), message.size()));
+                EXPECT_EQ(1, EVP_DigestVerifyFinal(
+                                 &digest_ctx, reinterpret_cast<const uint8_t*>(signature.data()),
+                                 signature.size()));
+                EVP_MD_CTX_cleanup(&digest_ctx);
+            }
+
+            // Corrupt signature shouldn't verify.
+            string corrupt_signature(signature);
+            ++corrupt_signature[corrupt_signature.size() / 2];
+
+            EXPECT_EQ(ErrorCode::OK,
+                      Begin(KeyPurpose::VERIFY,
+                            AuthorizationSetBuilder().Digest(digest).Padding(padding)));
+            string result;
+            EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(message, corrupt_signature, &result));
+
+            // Corrupt message shouldn't verify
+            EXPECT_EQ(ErrorCode::OK,
+                      Begin(KeyPurpose::VERIFY,
+                            AuthorizationSetBuilder().Digest(digest).Padding(padding)));
+            EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(corrupt_message, signature, &result));
+        }
+    }
+}
+
+/*
+ * VerificationOperationsTest.RsaSuccess
+ *
+ * Verifies ECDSA signature/verification for all digests and curves.
+ */
+TEST_F(VerificationOperationsTest, EcdsaAllDigestsAndCurves) {
+    auto digests = {
+        Digest::NONE,      Digest::SHA1,      Digest::SHA_2_224,
+        Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512,
+    };
+
+    string message = "1234567890";
+    string corrupt_message = "2234567890";
+    for (auto curve : {EcCurve::P_224, EcCurve::P_256, EcCurve::P_384, EcCurve::P_521}) {
+        ErrorCode error = GenerateKey(AuthorizationSetBuilder()
+                                          .Authorization(TAG_NO_AUTH_REQUIRED)
+                                          .EcdsaSigningKey(curve)
+                                          .Digest(digests));
+        EXPECT_EQ(ErrorCode::OK, error) << "Failed to generate key for EC curve " << curve;
+        if (error != ErrorCode::OK) {
+            continue;
+        }
+
+        for (auto digest : digests) {
+            string signature = SignMessage(message, AuthorizationSetBuilder().Digest(digest));
+            VerifyMessage(message, signature, AuthorizationSetBuilder().Digest(digest));
+
+            // Verify with OpenSSL
+            if (digest != Digest::NONE) {
+                HidlBuf pubkey;
+                ASSERT_EQ(ErrorCode::OK, ExportKey(KeyFormat::X509, &pubkey))
+                    << curve << ' ' << digest;
+
+                const uint8_t* p = pubkey.data();
+                EVP_PKEY_Ptr pkey(d2i_PUBKEY(nullptr /* alloc new */, &p, pubkey.size()));
+                ASSERT_TRUE(pkey.get());
+
+                EVP_MD_CTX digest_ctx;
+                EVP_MD_CTX_init(&digest_ctx);
+                EVP_PKEY_CTX* pkey_ctx;
+                const EVP_MD* md = openssl_digest(digest);
+
+                EXPECT_EQ(1, EVP_DigestVerifyInit(&digest_ctx, &pkey_ctx, md, nullptr /* engine */,
+                                                  pkey.get()))
+                    << curve << ' ' << digest;
+
+                EXPECT_EQ(1, EVP_DigestVerifyUpdate(&digest_ctx, message.data(), message.size()))
+                    << curve << ' ' << digest;
+
+                EXPECT_EQ(1, EVP_DigestVerifyFinal(
+                                 &digest_ctx, reinterpret_cast<const uint8_t*>(signature.data()),
+                                 signature.size()))
+                    << curve << ' ' << digest;
+
+                EVP_MD_CTX_cleanup(&digest_ctx);
+            }
+
+            // Corrupt signature shouldn't verify.
+            string corrupt_signature(signature);
+            ++corrupt_signature[corrupt_signature.size() / 2];
+
+            EXPECT_EQ(ErrorCode::OK,
+                      Begin(KeyPurpose::VERIFY, AuthorizationSetBuilder().Digest(digest)))
+                << curve << ' ' << digest;
+
+            string result;
+            EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(message, corrupt_signature, &result))
+                << curve << ' ' << digest;
+
+            // Corrupt message shouldn't verify
+            EXPECT_EQ(ErrorCode::OK,
+                      Begin(KeyPurpose::VERIFY, AuthorizationSetBuilder().Digest(digest)))
+                << curve << ' ' << digest;
+
+            EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(corrupt_message, signature, &result))
+                << curve << ' ' << digest;
+        }
+
+        ASSERT_EQ(ErrorCode::OK, DeleteKey());
+    }
+}
+
+/*
+ * VerificationOperationsTest.HmacSigningKeyCannotVerify
+ *
+ * Verifies HMAC signing and verification, but that a signing key cannot be used to verify.
+ */
+TEST_F(VerificationOperationsTest, HmacSigningKeyCannotVerify) {
+    string key_material = "HelloThisIsAKey";
+
+    HidlBuf signing_key, verification_key;
+    KeyCharacteristics signing_key_chars, verification_key_chars;
+    EXPECT_EQ(ErrorCode::OK,
+              ImportKey(AuthorizationSetBuilder()
+                            .Authorization(TAG_NO_AUTH_REQUIRED)
+                            .Authorization(TAG_ALGORITHM, Algorithm::HMAC)
+                            .Authorization(TAG_PURPOSE, KeyPurpose::SIGN)
+                            .Digest(Digest::SHA1)
+                            .Authorization(TAG_MIN_MAC_LENGTH, 160),
+                        KeyFormat::RAW, key_material, &signing_key, &signing_key_chars));
+    EXPECT_EQ(ErrorCode::OK,
+              ImportKey(AuthorizationSetBuilder()
+                            .Authorization(TAG_NO_AUTH_REQUIRED)
+                            .Authorization(TAG_ALGORITHM, Algorithm::HMAC)
+                            .Authorization(TAG_PURPOSE, KeyPurpose::VERIFY)
+                            .Digest(Digest::SHA1)
+                            .Authorization(TAG_MIN_MAC_LENGTH, 160),
+                        KeyFormat::RAW, key_material, &verification_key, &verification_key_chars));
+
+    string message = "This is a message.";
+    string signature = SignMessage(
+        signing_key, message,
+        AuthorizationSetBuilder().Digest(Digest::SHA1).Authorization(TAG_MAC_LENGTH, 160));
+
+    // Signing key should not work.
+    AuthorizationSet out_params;
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE,
+              Begin(KeyPurpose::VERIFY, signing_key, AuthorizationSetBuilder().Digest(Digest::SHA1),
+                    &out_params, &op_handle_));
+
+    // Verification key should work.
+    VerifyMessage(verification_key, message, signature,
+                  AuthorizationSetBuilder().Digest(Digest::SHA1));
+
+    EXPECT_EQ(ErrorCode::OK, DeleteKey(&signing_key));
+    EXPECT_EQ(ErrorCode::OK, DeleteKey(&verification_key));
+}
+
+typedef KeymasterHidlTest ExportKeyTest;
+
+/*
+ * ExportKeyTest.RsaUnsupportedKeyFormat
+ *
+ * Verifies that attempting to export RSA keys in PKCS#8 format fails with the correct error.
+ */
+TEST_F(ExportKeyTest, RsaUnsupportedKeyFormat) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .RsaSigningKey(256, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+    HidlBuf export_data;
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_FORMAT, ExportKey(KeyFormat::PKCS8, &export_data));
+}
+
+/*
+ * ExportKeyTest.RsaCorruptedKeyBlob
+ *
+ * Verifies that attempting to export RSA keys from corrupted key blobs fails.  This is essentially
+ * a poor-man's key blob fuzzer.
+ */
+// Disabled due to b/33385206
+TEST_F(ExportKeyTest, DISABLED_RsaCorruptedKeyBlob) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(256, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)));
+    for (size_t i = 0; i < key_blob_.size(); ++i) {
+        HidlBuf corrupted(key_blob_);
+        ++corrupted[i];
+
+        HidlBuf export_data;
+        EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
+                  ExportKey(KeyFormat::X509, corrupted, HidlBuf(), HidlBuf(), &export_data))
+            << "Blob corrupted at offset " << i << " erroneously accepted as valid";
+    }
+}
+
+/*
+ * ExportKeyTest.RsaCorruptedKeyBlob
+ *
+ * Verifies that attempting to export ECDSA keys from corrupted key blobs fails.  This is
+ * essentially a poor-man's key blob fuzzer.
+ */
+// Disabled due to b/33385206
+TEST_F(ExportKeyTest, DISABLED_EcCorruptedKeyBlob) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .EcdsaSigningKey(EcCurve::P_256)
+                                             .Digest(Digest::NONE)));
+    for (size_t i = 0; i < key_blob_.size(); ++i) {
+        HidlBuf corrupted(key_blob_);
+        ++corrupted[i];
+
+        HidlBuf export_data;
+        EXPECT_EQ(ErrorCode::INVALID_KEY_BLOB,
+                  ExportKey(KeyFormat::X509, corrupted, HidlBuf(), HidlBuf(), &export_data))
+            << "Blob corrupted at offset " << i << " erroneously accepted as valid";
+    }
+}
+
+/*
+ * ExportKeyTest.AesKeyUnexportable
+ *
+ * Verifies that attempting to export AES keys fails in the expected way.
+ */
+TEST_F(ExportKeyTest, AesKeyUnexportable) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .EcbMode()
+                                             .Padding(PaddingMode::NONE)));
+
+    HidlBuf export_data;
+    EXPECT_EQ(ErrorCode::UNSUPPORTED_KEY_FORMAT, ExportKey(KeyFormat::X509, &export_data));
+    EXPECT_EQ(ErrorCode::UNSUPPORTED_KEY_FORMAT, ExportKey(KeyFormat::PKCS8, &export_data));
+    EXPECT_EQ(ErrorCode::UNSUPPORTED_KEY_FORMAT, ExportKey(KeyFormat::RAW, &export_data));
+}
+typedef KeymasterHidlTest ImportKeyTest;
+
+/*
+ * ImportKeyTest.RsaSuccess
+ *
+ * Verifies that importing and using an RSA key pair works correctly.
+ */
+TEST_F(ImportKeyTest, RsaSuccess) {
+    ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                           .Authorization(TAG_NO_AUTH_REQUIRED)
+                                           .RsaSigningKey(1024, 65537)
+                                           .Digest(Digest::SHA_2_256)
+                                           .Padding(PaddingMode::RSA_PSS),
+                                       KeyFormat::PKCS8, rsa_key));
+
+    CheckKm0CryptoParam(TAG_ALGORITHM, Algorithm::RSA);
+    CheckKm0CryptoParam(TAG_KEY_SIZE, 1024U);
+    CheckKm0CryptoParam(TAG_RSA_PUBLIC_EXPONENT, 65537U);
+    CheckKm1CryptoParam(TAG_DIGEST, Digest::SHA_2_256);
+    CheckKm1CryptoParam(TAG_PADDING, PaddingMode::RSA_PSS);
+    CheckOrigin();
+
+    string message(1024 / 8, 'a');
+    auto params = AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Padding(PaddingMode::RSA_PSS);
+    string signature = SignMessage(message, params);
+    VerifyMessage(message, signature, params);
+}
+
+/*
+ * ImportKeyTest.RsaKeySizeMismatch
+ *
+ * Verifies that importing an RSA key pair with a size that doesn't match the key fails in the
+ * correct way.
+ */
+TEST_F(ImportKeyTest, RsaKeySizeMismatch) {
+    ASSERT_EQ(ErrorCode::IMPORT_PARAMETER_MISMATCH,
+              ImportKey(AuthorizationSetBuilder()
+                            .RsaSigningKey(2048 /* Doesn't match key */, 65537)
+                            .Digest(Digest::NONE)
+                            .Padding(PaddingMode::NONE),
+                        KeyFormat::PKCS8, rsa_key));
+}
+
+/*
+ * ImportKeyTest.RsaPublicExponentMismatch
+ *
+ * Verifies that importing an RSA key pair with a public exponent that doesn't match the key fails
+ * in the correct way.
+ */
+TEST_F(ImportKeyTest, RsaPublicExponentMismatch) {
+    ASSERT_EQ(ErrorCode::IMPORT_PARAMETER_MISMATCH,
+              ImportKey(AuthorizationSetBuilder()
+                            .RsaSigningKey(1024, 3 /* Doesn't match key */)
+                            .Digest(Digest::NONE)
+                            .Padding(PaddingMode::NONE),
+                        KeyFormat::PKCS8, rsa_key));
+}
+
+/*
+ * ImportKeyTest.EcdsaSuccess
+ *
+ * Verifies that importing and using an ECDSA key pair works correctly.
+ */
+TEST_F(ImportKeyTest, EcdsaSuccess) {
+    ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                           .Authorization(TAG_NO_AUTH_REQUIRED)
+                                           .EcdsaSigningKey(256)
+                                           .Digest(Digest::SHA_2_256),
+                                       KeyFormat::PKCS8, ec_key))
+        << "(Possibly b/33945114)";
+
+    CheckKm0CryptoParam(TAG_ALGORITHM, Algorithm::EC);
+    CheckKm0CryptoParam(TAG_KEY_SIZE, 256U);
+    CheckKm1CryptoParam(TAG_DIGEST, Digest::SHA_2_256);
+    CheckKm2CryptoParam(TAG_EC_CURVE, EcCurve::P_256);
+
+    CheckOrigin();
+
+    string message(32, 'a');
+    auto params = AuthorizationSetBuilder().Digest(Digest::SHA_2_256);
+    string signature = SignMessage(message, params);
+    VerifyMessage(message, signature, params);
+}
+
+/*
+ * ImportKeyTest.EcdsaSizeMismatch
+ *
+ * Verifies that importing an ECDSA key pair with a size that doesn't match the key fails in the
+ * correct way.
+ */
+TEST_F(ImportKeyTest, EcdsaSizeMismatch) {
+    ASSERT_EQ(ErrorCode::IMPORT_PARAMETER_MISMATCH,
+              ImportKey(AuthorizationSetBuilder()
+                            .EcdsaSigningKey(224 /* Doesn't match key */)
+                            .Digest(Digest::NONE),
+                        KeyFormat::PKCS8, ec_key));
+}
+
+/*
+ * ImportKeyTest.EcdsaCurveMismatch
+ *
+ * Verifies that importing an ECDSA key pair with a curve that doesn't match the key fails in the
+ * correct way.
+ */
+TEST_F(ImportKeyTest, EcdsaCurveMismatch) {
+    if (SupportsSymmetric() && !SupportsAttestation()) {
+        // KM1 hardware doesn't know about curves
+        return;
+    }
+
+    ASSERT_EQ(ErrorCode::IMPORT_PARAMETER_MISMATCH,
+              ImportKey(AuthorizationSetBuilder()
+                            .EcdsaSigningKey(EcCurve::P_224 /* Doesn't match key */)
+                            .Digest(Digest::NONE),
+                        KeyFormat::PKCS8, ec_key))
+        << "(Possibly b/36233241)";
+}
+
+/*
+ * ImportKeyTest.AesSuccess
+ *
+ * Verifies that importing and using an AES key works.
+ */
+TEST_F(ImportKeyTest, AesSuccess) {
+    string key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+    ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                           .Authorization(TAG_NO_AUTH_REQUIRED)
+                                           .AesEncryptionKey(key.size() * 8)
+                                           .EcbMode()
+                                           .Padding(PaddingMode::PKCS7),
+                                       KeyFormat::RAW, key));
+
+    CheckKm1CryptoParam(TAG_ALGORITHM, Algorithm::AES);
+    CheckKm1CryptoParam(TAG_KEY_SIZE, 128U);
+    CheckKm1CryptoParam(TAG_PADDING, PaddingMode::PKCS7);
+    CheckKm1CryptoParam(TAG_BLOCK_MODE, BlockMode::ECB);
+    CheckOrigin();
+
+    string message = "Hello World!";
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::PKCS7);
+    string ciphertext = EncryptMessage(message, params);
+    string plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_EQ(message, plaintext);
+}
+
+/*
+ * ImportKeyTest.AesSuccess
+ *
+ * Verifies that importing and using an HMAC key works.
+ */
+TEST_F(ImportKeyTest, HmacKeySuccess) {
+    string key = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+    ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                           .Authorization(TAG_NO_AUTH_REQUIRED)
+                                           .HmacKey(key.size() * 8)
+                                           .Digest(Digest::SHA_2_256)
+                                           .Authorization(TAG_MIN_MAC_LENGTH, 256),
+                                       KeyFormat::RAW, key));
+
+    CheckKm1CryptoParam(TAG_ALGORITHM, Algorithm::HMAC);
+    CheckKm1CryptoParam(TAG_KEY_SIZE, 128U);
+    CheckKm1CryptoParam(TAG_DIGEST, Digest::SHA_2_256);
+    CheckOrigin();
+
+    string message = "Hello World!";
+    string signature = MacMessage(message, Digest::SHA_2_256, 256);
+    VerifyMessage(message, signature, AuthorizationSetBuilder().Digest(Digest::SHA_2_256));
+}
+
+typedef KeymasterHidlTest EncryptionOperationsTest;
+
+/*
+ * EncryptionOperationsTest.RsaNoPaddingSuccess
+ *
+ * Verifies that raw RSA encryption works.
+ */
+TEST_F(EncryptionOperationsTest, RsaNoPaddingSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::NONE)));
+
+    string message = string(1024 / 8, 'a');
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
+    string ciphertext1 = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext1.size());
+
+    string ciphertext2 = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext2.size());
+
+    // Unpadded RSA is deterministic
+    EXPECT_EQ(ciphertext1, ciphertext2);
+}
+
+/*
+ * EncryptionOperationsTest.RsaNoPaddingShortMessage
+ *
+ * Verifies that raw RSA encryption of short messages works.
+ */
+TEST_F(EncryptionOperationsTest, RsaNoPaddingShortMessage) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::NONE)));
+
+    string message = "1";
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
+
+    string ciphertext = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext.size());
+
+    string expected_plaintext = string(1024 / 8 - 1, 0) + message;
+    string plaintext = DecryptMessage(ciphertext, params);
+
+    EXPECT_EQ(expected_plaintext, plaintext);
+
+    // Degenerate case, encrypting a numeric 1 yields 0x00..01 as the ciphertext.
+    message = static_cast<char>(1);
+    ciphertext = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext.size());
+    EXPECT_EQ(ciphertext, string(1024 / 8 - 1, 0) + message);
+}
+
+/*
+ * EncryptionOperationsTest.RsaNoPaddingTooLong
+ *
+ * Verifies that raw RSA encryption of too-long messages fails in the expected way.
+ */
+TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLong) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::NONE)));
+
+    string message(1024 / 8 + 1, 'a');
+
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+
+    string result;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &result));
+}
+
+/*
+ * EncryptionOperationsTest.RsaNoPaddingTooLong
+ *
+ * Verifies that raw RSA encryption of too-large (numerically) messages fails in the expected way.
+ */
+TEST_F(EncryptionOperationsTest, RsaNoPaddingTooLarge) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::NONE)));
+
+    HidlBuf exported;
+    ASSERT_EQ(ErrorCode::OK, ExportKey(KeyFormat::X509, &exported));
+
+    const uint8_t* p = exported.data();
+    EVP_PKEY_Ptr pkey(d2i_PUBKEY(nullptr /* alloc new */, &p, exported.size()));
+    RSA_Ptr rsa(EVP_PKEY_get1_RSA(pkey.get()));
+
+    size_t modulus_len = BN_num_bytes(rsa->n);
+    ASSERT_EQ(1024U / 8, modulus_len);
+    std::unique_ptr<uint8_t[]> modulus_buf(new uint8_t[modulus_len]);
+    BN_bn2bin(rsa->n, modulus_buf.get());
+
+    // The modulus is too big to encrypt.
+    string message(reinterpret_cast<const char*>(modulus_buf.get()), modulus_len);
+
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+
+    string result;
+    EXPECT_EQ(ErrorCode::INVALID_ARGUMENT, Finish(message, &result));
+
+    // One smaller than the modulus is okay.
+    BN_sub(rsa->n, rsa->n, BN_value_one());
+    modulus_len = BN_num_bytes(rsa->n);
+    ASSERT_EQ(1024U / 8, modulus_len);
+    BN_bn2bin(rsa->n, modulus_buf.get());
+    message = string(reinterpret_cast<const char*>(modulus_buf.get()), modulus_len);
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+    EXPECT_EQ(ErrorCode::OK, Finish(message, &result));
+}
+
+/*
+ * EncryptionOperationsTest.RsaOaepSuccess
+ *
+ * Verifies that RSA-OAEP encryption operations work, with all digests.
+ */
+TEST_F(EncryptionOperationsTest, RsaOaepSuccess) {
+    auto digests = {Digest::MD5,       Digest::SHA1,      Digest::SHA_2_224,
+                    Digest::SHA_2_256, Digest::SHA_2_384, Digest::SHA_2_512};
+
+    size_t key_size = 2048;  // Need largish key for SHA-512 test.
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(key_size, 3)
+                                             .Padding(PaddingMode::RSA_OAEP)
+                                             .Digest(digests)));
+
+    string message = "Hello";
+
+    for (auto digest : digests) {
+        auto params = AuthorizationSetBuilder().Digest(digest).Padding(PaddingMode::RSA_OAEP);
+        string ciphertext1 = EncryptMessage(message, params);
+        if (HasNonfatalFailure()) std::cout << "-->" << digest << std::endl;
+        EXPECT_EQ(key_size / 8, ciphertext1.size());
+
+        string ciphertext2 = EncryptMessage(message, params);
+        EXPECT_EQ(key_size / 8, ciphertext2.size());
+
+        // OAEP randomizes padding so every result should be different (with astronomically high
+        // probability).
+        EXPECT_NE(ciphertext1, ciphertext2);
+
+        string plaintext1 = DecryptMessage(ciphertext1, params);
+        EXPECT_EQ(message, plaintext1) << "RSA-OAEP failed with digest " << digest;
+        string plaintext2 = DecryptMessage(ciphertext2, params);
+        EXPECT_EQ(message, plaintext2) << "RSA-OAEP failed with digest " << digest;
+
+        // Decrypting corrupted ciphertext should fail.
+        size_t offset_to_corrupt = random() % ciphertext1.size();
+        char corrupt_byte;
+        do {
+            corrupt_byte = static_cast<char>(random() % 256);
+        } while (corrupt_byte == ciphertext1[offset_to_corrupt]);
+        ciphertext1[offset_to_corrupt] = corrupt_byte;
+
+        EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+        string result;
+        EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+        EXPECT_EQ(0U, result.size());
+    }
+}
+
+/*
+ * EncryptionOperationsTest.RsaOaepInvalidDigest
+ *
+ * Verifies that RSA-OAEP encryption operations fail in the correct way when asked to operate
+ * without a digest.
+ */
+TEST_F(EncryptionOperationsTest, RsaOaepInvalidDigest) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::RSA_OAEP)
+                                             .Digest(Digest::NONE)));
+    string message = "Hello World!";
+
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_OAEP).Digest(Digest::NONE);
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_DIGEST, Begin(KeyPurpose::ENCRYPT, params));
+}
+
+/*
+ * EncryptionOperationsTest.RsaOaepInvalidDigest
+ *
+ * Verifies that RSA-OAEP encryption operations fail in the correct way when asked to decrypt with a
+ * different digest than was used to encrypt.
+ */
+TEST_F(EncryptionOperationsTest, RsaOaepDecryptWithWrongDigest) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::RSA_OAEP)
+                                             .Digest(Digest::SHA_2_256, Digest::SHA_2_224)));
+    string message = "Hello World!";
+    string ciphertext = EncryptMessage(
+        message,
+        AuthorizationSetBuilder().Digest(Digest::SHA_2_224).Padding(PaddingMode::RSA_OAEP));
+
+    EXPECT_EQ(
+        ErrorCode::OK,
+        Begin(KeyPurpose::DECRYPT,
+              AuthorizationSetBuilder().Digest(Digest::SHA_2_256).Padding(PaddingMode::RSA_OAEP)));
+    string result;
+    EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext, &result));
+    EXPECT_EQ(0U, result.size());
+}
+
+/*
+ * EncryptionOperationsTest.RsaOaepTooLarge
+ *
+ * Verifies that RSA-OAEP encryption operations fail in the correct way when asked to encrypt a
+ * too-large message.
+ */
+TEST_F(EncryptionOperationsTest, RsaOaepTooLarge) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::RSA_OAEP)
+                                             .Digest(Digest::SHA1)));
+    constexpr size_t digest_size = 160 /* SHA1 */ / 8;
+    constexpr size_t oaep_overhead = 2 * digest_size + 2;
+    string message(1024 / 8 - oaep_overhead + 1, 'a');
+    EXPECT_EQ(ErrorCode::OK,
+              Begin(KeyPurpose::ENCRYPT,
+                    AuthorizationSetBuilder().Padding(PaddingMode::RSA_OAEP).Digest(Digest::SHA1)));
+    string result;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &result));
+    EXPECT_EQ(0U, result.size());
+}
+
+/*
+ * EncryptionOperationsTest.RsaPkcs1Success
+ *
+ * Verifies that RSA PKCS encryption/decrypts works.
+ */
+TEST_F(EncryptionOperationsTest, RsaPkcs1Success) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT)));
+
+    string message = "Hello World!";
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT);
+    string ciphertext1 = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext1.size());
+
+    string ciphertext2 = EncryptMessage(message, params);
+    EXPECT_EQ(1024U / 8, ciphertext2.size());
+
+    // PKCS1 v1.5 randomizes padding so every result should be different.
+    EXPECT_NE(ciphertext1, ciphertext2);
+
+    string plaintext = DecryptMessage(ciphertext1, params);
+    EXPECT_EQ(message, plaintext);
+
+    // Decrypting corrupted ciphertext should fail.
+    size_t offset_to_corrupt = random() % ciphertext1.size();
+    char corrupt_byte;
+    do {
+        corrupt_byte = static_cast<char>(random() % 256);
+    } while (corrupt_byte == ciphertext1[offset_to_corrupt]);
+    ciphertext1[offset_to_corrupt] = corrupt_byte;
+
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+    string result;
+    EXPECT_EQ(ErrorCode::UNKNOWN_ERROR, Finish(ciphertext1, &result));
+    EXPECT_EQ(0U, result.size());
+}
+
+/*
+ * EncryptionOperationsTest.RsaPkcs1TooLarge
+ *
+ * Verifies that RSA PKCS encryption fails in the correct way when the mssage is too large.
+ */
+TEST_F(EncryptionOperationsTest, RsaPkcs1TooLarge) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaEncryptionKey(1024, 3)
+                                             .Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT)));
+    string message(1024 / 8 - 10, 'a');
+
+    auto params = AuthorizationSetBuilder().Padding(PaddingMode::RSA_PKCS1_1_5_ENCRYPT);
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+    string result;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &result));
+    EXPECT_EQ(0U, result.size());
+}
+
+/*
+ * EncryptionOperationsTest.EcdsaEncrypt
+ *
+ * Verifies that attempting to use ECDSA keys to encrypt fails in the correct way.
+ */
+TEST_F(EncryptionOperationsTest, EcdsaEncrypt) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .EcdsaSigningKey(224)
+                                             .Digest(Digest::NONE)));
+    auto params = AuthorizationSetBuilder().Digest(Digest::NONE);
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_PURPOSE, Begin(KeyPurpose::ENCRYPT, params))
+        << "(Possibly b/33543625)";
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_PURPOSE, Begin(KeyPurpose::DECRYPT, params))
+        << "(Possibly b/33543625)";
+}
+
+/*
+ * EncryptionOperationsTest.HmacEncrypt
+ *
+ * Verifies that attempting to use HMAC keys to encrypt fails in the correct way.
+ */
+TEST_F(EncryptionOperationsTest, HmacEncrypt) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .HmacKey(128)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+    auto params = AuthorizationSetBuilder()
+                      .Digest(Digest::SHA_2_256)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 128);
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_PURPOSE, Begin(KeyPurpose::ENCRYPT, params))
+        << "(Possibly b/33543625)";
+    ASSERT_EQ(ErrorCode::UNSUPPORTED_PURPOSE, Begin(KeyPurpose::DECRYPT, params))
+        << "(Possibly b/33543625)";
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbRoundTripSuccess
+ *
+ * Verifies that AES ECB mode works.
+ */
+TEST_F(EncryptionOperationsTest, AesEcbRoundTripSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+                                             .Padding(PaddingMode::NONE)));
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::NONE);
+
+    // Two-block message.
+    string message = "12345678901234567890123456789012";
+    string ciphertext1 = EncryptMessage(message, params);
+    EXPECT_EQ(message.size(), ciphertext1.size());
+
+    string ciphertext2 = EncryptMessage(string(message), params);
+    EXPECT_EQ(message.size(), ciphertext2.size());
+
+    // ECB is deterministic.
+    EXPECT_EQ(ciphertext1, ciphertext2);
+
+    string plaintext = DecryptMessage(ciphertext1, params);
+    EXPECT_EQ(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbRoundTripSuccess
+ *
+ * Verifies that AES encryption fails in the correct way when an unauthorized mode is specified.
+ */
+TEST_F(EncryptionOperationsTest, AesWrongMode) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CBC)
+                                             .Padding(PaddingMode::NONE)));
+    // Two-block message.
+    string message = "12345678901234567890123456789012";
+    EXPECT_EQ(
+        ErrorCode::INCOMPATIBLE_BLOCK_MODE,
+        Begin(KeyPurpose::ENCRYPT,
+              AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::NONE)));
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbNoPaddingWrongInputSize
+ *
+ * Verifies that AES encryption fails in the correct way when provided an input that is not a
+ * multiple of the block size and no padding is specified.
+ */
+TEST_F(EncryptionOperationsTest, AesEcbNoPaddingWrongInputSize) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+                                             .Padding(PaddingMode::NONE)));
+    // Message is slightly shorter than two blocks.
+    string message(16 * 2 - 1, 'a');
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::NONE);
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params));
+    string ciphertext;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &ciphertext));
+    EXPECT_EQ(0U, ciphertext.size());
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbPkcs7Padding
+ *
+ * Verifies that AES PKCS7 padding works for any message length.
+ */
+TEST_F(EncryptionOperationsTest, AesEcbPkcs7Padding) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+                                             .Padding(PaddingMode::PKCS7)));
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::PKCS7);
+
+    // Try various message lengths; all should work.
+    for (size_t i = 0; i < 32; ++i) {
+        string message(i, 'a');
+        string ciphertext = EncryptMessage(message, params);
+        EXPECT_EQ(i + 16 - (i % 16), ciphertext.size());
+        string plaintext = DecryptMessage(ciphertext, params);
+        EXPECT_EQ(message, plaintext);
+    }
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbWrongPadding
+ *
+ * Verifies that AES enryption fails in the correct way when an unauthorized padding mode is
+ * specified.
+ */
+TEST_F(EncryptionOperationsTest, AesEcbWrongPadding) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+                                             .Padding(PaddingMode::NONE)));
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::PKCS7);
+
+    // Try various message lengths; all should fail
+    for (size_t i = 0; i < 32; ++i) {
+        string message(i, 'a');
+        EXPECT_EQ(ErrorCode::INCOMPATIBLE_PADDING_MODE, Begin(KeyPurpose::ENCRYPT, params));
+    }
+}
+
+/*
+ * EncryptionOperationsTest.AesEcbPkcs7PaddingCorrupted
+ *
+ * Verifies that AES decryption fails in the correct way when the padding is corrupted.
+ */
+TEST_F(EncryptionOperationsTest, AesEcbPkcs7PaddingCorrupted) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+                                             .Padding(PaddingMode::PKCS7)));
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::PKCS7);
+
+    string message = "a";
+    string ciphertext = EncryptMessage(message, params);
+    EXPECT_EQ(16U, ciphertext.size());
+    EXPECT_NE(ciphertext, message);
+    ++ciphertext[ciphertext.size() / 2];
+
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(message, &plaintext));
+}
+
+HidlBuf CopyIv(const AuthorizationSet& set) {
+    auto iv = set.GetTagValue(TAG_NONCE);
+    EXPECT_TRUE(iv.isOk());
+    return iv.value();
+}
+
+/*
+ * EncryptionOperationsTest.AesCtrRoundTripSuccess
+ *
+ * Verifies that AES CTR mode works.
+ */
+TEST_F(EncryptionOperationsTest, AesCtrRoundTripSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CTR)
+                                             .Padding(PaddingMode::NONE)));
+
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::CTR).Padding(PaddingMode::NONE);
+
+    string message = "123";
+    AuthorizationSet out_params;
+    string ciphertext1 = EncryptMessage(message, params, &out_params);
+    HidlBuf iv1 = CopyIv(out_params);
+    EXPECT_EQ(16U, iv1.size());
+
+    EXPECT_EQ(message.size(), ciphertext1.size());
+
+    out_params.Clear();
+    string ciphertext2 = EncryptMessage(message, params, &out_params);
+    HidlBuf iv2 = CopyIv(out_params);
+    EXPECT_EQ(16U, iv2.size());
+
+    // IVs should be random, so ciphertexts should differ.
+    EXPECT_NE(ciphertext1, ciphertext2);
+
+    auto params_iv1 =
+        AuthorizationSetBuilder().Authorizations(params).Authorization(TAG_NONCE, iv1);
+    auto params_iv2 =
+        AuthorizationSetBuilder().Authorizations(params).Authorization(TAG_NONCE, iv2);
+
+    string plaintext = DecryptMessage(ciphertext1, params_iv1);
+    EXPECT_EQ(message, plaintext);
+    plaintext = DecryptMessage(ciphertext2, params_iv2);
+    EXPECT_EQ(message, plaintext);
+
+    // Using the wrong IV will result in a "valid" decryption, but the data will be garbage.
+    plaintext = DecryptMessage(ciphertext1, params_iv2);
+    EXPECT_NE(message, plaintext);
+    plaintext = DecryptMessage(ciphertext2, params_iv1);
+    EXPECT_NE(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesIncremental
+ *
+ * Verifies that AES works, all modes, when provided data in various size increments.
+ */
+TEST_F(EncryptionOperationsTest, AesIncremental) {
+    auto block_modes = {
+        BlockMode::ECB, BlockMode::CBC, BlockMode::CTR, BlockMode::GCM,
+    };
+
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(block_modes)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    for (int increment = 1; increment <= 240; ++increment) {
+        for (auto block_mode : block_modes) {
+            string message(240, 'a');
+            auto params = AuthorizationSetBuilder()
+                              .BlockMode(block_mode)
+                              .Padding(PaddingMode::NONE)
+                              .Authorization(TAG_MAC_LENGTH, 128) /* for GCM */;
+
+            AuthorizationSet output_params;
+            EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &output_params));
+
+            string ciphertext;
+            size_t input_consumed;
+            string to_send;
+            for (size_t i = 0; i < message.size(); i += increment) {
+                to_send.append(message.substr(i, increment));
+                EXPECT_EQ(ErrorCode::OK, Update(to_send, &ciphertext, &input_consumed));
+                to_send = to_send.substr(input_consumed);
+
+                switch (block_mode) {
+                case BlockMode::ECB:
+                case BlockMode::CBC:
+                    // Implementations must take as many blocks as possible, leaving less than
+                    // a block.
+                    EXPECT_LE(to_send.length(), 16U);
+                    break;
+                case BlockMode::GCM:
+                case BlockMode::CTR:
+                    // Implementations must always take all the data.
+                    EXPECT_EQ(0U, to_send.length());
+                    break;
+                }
+            }
+            EXPECT_EQ(ErrorCode::OK, Finish(to_send, &ciphertext)) << "Error sending " << to_send;
+
+            switch (block_mode) {
+            case BlockMode::GCM:
+                EXPECT_EQ(message.size() + 16, ciphertext.size());
+                break;
+            case BlockMode::CTR:
+                EXPECT_EQ(message.size(), ciphertext.size());
+                break;
+            case BlockMode::CBC:
+            case BlockMode::ECB:
+                EXPECT_EQ(message.size() + message.size() % 16, ciphertext.size());
+                break;
+            }
+
+            auto iv = output_params.GetTagValue(TAG_NONCE);
+            switch (block_mode) {
+            case BlockMode::CBC:
+            case BlockMode::GCM:
+            case BlockMode::CTR:
+                ASSERT_TRUE(iv.isOk()) << "No IV for block mode " << block_mode;
+                EXPECT_EQ(block_mode == BlockMode::GCM ? 12U : 16U, iv.value().size());
+                params.push_back(TAG_NONCE, iv.value());
+                break;
+
+            case BlockMode::ECB:
+                EXPECT_FALSE(iv.isOk()) << "ECB mode should not generate IV";
+                break;
+            }
+
+            EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params))
+                << "Decrypt begin() failed for block mode " << block_mode;
+
+            string plaintext;
+            for (size_t i = 0; i < ciphertext.size(); i += increment) {
+                to_send.append(ciphertext.substr(i, increment));
+                EXPECT_EQ(ErrorCode::OK, Update(to_send, &plaintext, &input_consumed));
+                to_send = to_send.substr(input_consumed);
+            }
+            ErrorCode error = Finish(to_send, &plaintext);
+            ASSERT_EQ(ErrorCode::OK, error)
+                << "Decryption failed for block mode " << block_mode << " and increment "
+                << increment << " (Possibly b/33584622)";
+            if (error == ErrorCode::OK) {
+                ASSERT_EQ(message, plaintext) << "Decryption didn't match for block mode "
+                                              << block_mode << " and increment " << increment;
+            }
+        }
+    }
+}
+
+struct AesCtrSp80038aTestVector {
+    const char* key;
+    const char* nonce;
+    const char* plaintext;
+    const char* ciphertext;
+};
+
+// These test vectors are taken from
+// http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, section F.5.
+static const AesCtrSp80038aTestVector kAesCtrSp80038aTestVectors[] = {
+    // AES-128
+    {
+        "2b7e151628aed2a6abf7158809cf4f3c", "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
+        "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51"
+        "30c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
+        "874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff"
+        "5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee",
+    },
+    // AES-192
+    {
+        "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b", "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
+        "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51"
+        "30c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
+        "1abc932417521ca24f2b0459fe7e6e0b090339ec0aa6faefd5ccc2c6f4ce8e94"
+        "1e36b26bd1ebc670d1bd1d665620abf74f78a7f6d29809585a97daec58c6b050",
+    },
+    // AES-256
+    {
+        "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
+        "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
+        "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51"
+        "30c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
+        "601ec313775789a5b7a7f504bbf3d228f443e3ca4d62b59aca84e990cacaf5c5"
+        "2b0930daa23de94ce87017ba2d84988ddfc9c58db67aada613c2dd08457941a6",
+    },
+};
+
+/*
+ * EncryptionOperationsTest.AesCtrSp80038aTestVector
+ *
+ * Verifies AES CTR implementation against SP800-38A test vectors.
+ */
+TEST_F(EncryptionOperationsTest, AesCtrSp80038aTestVector) {
+    for (size_t i = 0; i < 3; i++) {
+        const AesCtrSp80038aTestVector& test(kAesCtrSp80038aTestVectors[i]);
+        const string key = hex2str(test.key);
+        const string nonce = hex2str(test.nonce);
+        const string plaintext = hex2str(test.plaintext);
+        const string ciphertext = hex2str(test.ciphertext);
+        CheckAesCtrTestVector(key, nonce, plaintext, ciphertext);
+    }
+}
+
+/*
+ * EncryptionOperationsTest.AesCtrIncompatiblePaddingMode
+ *
+ * Verifies that keymaster rejects use of CTR mode with PKCS7 padding in the correct way.
+ */
+TEST_F(EncryptionOperationsTest, AesCtrIncompatiblePaddingMode) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CTR)
+                                             .Padding(PaddingMode::PKCS7)));
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::CTR).Padding(PaddingMode::NONE);
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_PADDING_MODE, Begin(KeyPurpose::ENCRYPT, params));
+}
+
+/*
+ * EncryptionOperationsTest.AesCtrInvalidCallerNonce
+ *
+ * Verifies that keymaster fails correctly when the user supplies an incorrect-size nonce.
+ */
+TEST_F(EncryptionOperationsTest, AesCtrInvalidCallerNonce) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CTR)
+                                             .Authorization(TAG_CALLER_NONCE)
+                                             .Padding(PaddingMode::NONE)));
+
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::CTR)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_NONCE, HidlBuf(string(1, 'a')));
+    EXPECT_EQ(ErrorCode::INVALID_NONCE, Begin(KeyPurpose::ENCRYPT, params));
+
+    params = AuthorizationSetBuilder()
+                 .BlockMode(BlockMode::CTR)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_NONCE, HidlBuf(string(15, 'a')));
+    EXPECT_EQ(ErrorCode::INVALID_NONCE, Begin(KeyPurpose::ENCRYPT, params));
+
+    params = AuthorizationSetBuilder()
+                 .BlockMode(BlockMode::CTR)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_NONCE, HidlBuf(string(17, 'a')));
+    EXPECT_EQ(ErrorCode::INVALID_NONCE, Begin(KeyPurpose::ENCRYPT, params));
+}
+
+/*
+ * EncryptionOperationsTest.AesCtrInvalidCallerNonce
+ *
+ * Verifies that keymaster fails correctly when the user supplies an incorrect-size nonce.
+ */
+TEST_F(EncryptionOperationsTest, AesCbcRoundTripSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CBC)
+                                             .Padding(PaddingMode::NONE)));
+    // Two-block message.
+    string message = "12345678901234567890123456789012";
+    auto params = AuthorizationSetBuilder().BlockMode(BlockMode::CBC).Padding(PaddingMode::NONE);
+    AuthorizationSet out_params;
+    string ciphertext1 = EncryptMessage(message, params, &out_params);
+    HidlBuf iv1 = CopyIv(out_params);
+    EXPECT_EQ(message.size(), ciphertext1.size());
+
+    out_params.Clear();
+
+    string ciphertext2 = EncryptMessage(message, params, &out_params);
+    HidlBuf iv2 = CopyIv(out_params);
+    EXPECT_EQ(message.size(), ciphertext2.size());
+
+    // IVs should be random, so ciphertexts should differ.
+    EXPECT_NE(ciphertext1, ciphertext2);
+
+    params.push_back(TAG_NONCE, iv1);
+    string plaintext = DecryptMessage(ciphertext1, params);
+    EXPECT_EQ(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesCallerNonce
+ *
+ * Verifies that AES caller-provided nonces work correctly.
+ */
+TEST_F(EncryptionOperationsTest, AesCallerNonce) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CBC)
+                                             .Authorization(TAG_CALLER_NONCE)
+                                             .Padding(PaddingMode::NONE)));
+
+    string message = "12345678901234567890123456789012";
+
+    // Don't specify nonce, should get a random one.
+    AuthorizationSetBuilder params =
+        AuthorizationSetBuilder().BlockMode(BlockMode::CBC).Padding(PaddingMode::NONE);
+    AuthorizationSet out_params;
+    string ciphertext = EncryptMessage(message, params, &out_params);
+    EXPECT_EQ(message.size(), ciphertext.size());
+    EXPECT_EQ(16U, out_params.GetTagValue(TAG_NONCE).value().size());
+
+    params.push_back(TAG_NONCE, out_params.GetTagValue(TAG_NONCE).value());
+    string plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_EQ(message, plaintext);
+
+    // Now specify a nonce, should also work.
+    params = AuthorizationSetBuilder()
+                 .BlockMode(BlockMode::CBC)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_NONCE, HidlBuf("abcdefghijklmnop"));
+    out_params.Clear();
+    ciphertext = EncryptMessage(message, params, &out_params);
+
+    // Decrypt with correct nonce.
+    plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_EQ(message, plaintext);
+
+    // Try with wrong nonce.
+    params = AuthorizationSetBuilder()
+                 .BlockMode(BlockMode::CBC)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_NONCE, HidlBuf("aaaaaaaaaaaaaaaa"));
+    plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_NE(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesCallerNonceProhibited
+ *
+ * Verifies that caller-provided nonces are not permitted when not specified in the key
+ * authorizations.
+ */
+TEST_F(EncryptionOperationsTest, AesCallerNonceProhibited) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::CBC)
+                                             .Padding(PaddingMode::NONE)));
+
+    string message = "12345678901234567890123456789012";
+
+    // Don't specify nonce, should get a random one.
+    AuthorizationSetBuilder params =
+        AuthorizationSetBuilder().BlockMode(BlockMode::CBC).Padding(PaddingMode::NONE);
+    AuthorizationSet out_params;
+    string ciphertext = EncryptMessage(message, params, &out_params);
+    EXPECT_EQ(message.size(), ciphertext.size());
+    EXPECT_EQ(16U, out_params.GetTagValue(TAG_NONCE).value().size());
+
+    params.push_back(TAG_NONCE, out_params.GetTagValue(TAG_NONCE).value());
+    string plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_EQ(message, plaintext);
+
+    // Now specify a nonce, should fail
+    params = AuthorizationSetBuilder()
+                 .BlockMode(BlockMode::CBC)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_NONCE, HidlBuf("abcdefghijklmnop"));
+    out_params.Clear();
+    EXPECT_EQ(ErrorCode::CALLER_NONCE_PROHIBITED, Begin(KeyPurpose::ENCRYPT, params, &out_params));
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmRoundTripSuccess
+ *
+ * Verifies that AES GCM mode works.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmRoundTripSuccess) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .Authorization(TAG_BLOCK_MODE, BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string aad = "foobar";
+    string message = "123456789012345678901234567890123456";
+
+    auto begin_params = AuthorizationSetBuilder()
+                            .BlockMode(BlockMode::GCM)
+                            .Padding(PaddingMode::NONE)
+                            .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto update_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size());
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params))
+        << "Begin encrypt";
+    string ciphertext;
+    AuthorizationSet update_out_params;
+    ASSERT_EQ(ErrorCode::OK,
+              Finish(op_handle_, update_params, message, "", &update_out_params, &ciphertext));
+
+    // Grab nonce
+    begin_params.push_back(begin_out_params);
+
+    // Decrypt.
+    ASSERT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params)) << "Begin decrypt";
+    string plaintext;
+    size_t input_consumed;
+    ASSERT_EQ(ErrorCode::OK, Update(op_handle_, update_params, ciphertext, &update_out_params,
+                                    &plaintext, &input_consumed));
+    EXPECT_EQ(ciphertext.size(), input_consumed);
+    EXPECT_EQ(ErrorCode::OK, Finish("", &plaintext));
+
+    EXPECT_EQ(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmTooShortTag
+ *
+ * Verifies that AES GCM mode fails correctly when a too-short tag length is specified.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmTooShortTag) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+    string message = "123456789012345678901234567890123456";
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::GCM)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 96);
+
+    EXPECT_EQ(ErrorCode::INVALID_MAC_LENGTH, Begin(KeyPurpose::ENCRYPT, params));
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmTooShortTagOnDecrypt
+ *
+ * Verifies that AES GCM mode fails correctly when a too-short tag is provided to decryption.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmTooShortTagOnDecrypt) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+    string aad = "foobar";
+    string message = "123456789012345678901234567890123456";
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::GCM)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto finish_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size());
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params));
+    EXPECT_EQ(1U, begin_out_params.size());
+    ASSERT_TRUE(begin_out_params.GetTagValue(TAG_NONCE).isOk());
+
+    AuthorizationSet finish_out_params;
+    string ciphertext;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message, "" /* signature */,
+                                    &finish_out_params, &ciphertext));
+
+    params = AuthorizationSetBuilder()
+                 .Authorizations(begin_out_params)
+                 .BlockMode(BlockMode::GCM)
+                 .Padding(PaddingMode::NONE)
+                 .Authorization(TAG_MAC_LENGTH, 96);
+
+    // Decrypt.
+    EXPECT_EQ(ErrorCode::INVALID_MAC_LENGTH, Begin(KeyPurpose::DECRYPT, params));
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmCorruptKey
+ *
+ * Verifies that AES GCM mode fails correctly when the decryption key is incorrect.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmCorruptKey) {
+    const uint8_t nonce_bytes[] = {
+        0xb7, 0x94, 0x37, 0xae, 0x08, 0xff, 0x35, 0x5d, 0x7d, 0x8a, 0x4d, 0x0f,
+    };
+    string nonce = make_string(nonce_bytes);
+    const uint8_t ciphertext_bytes[] = {
+        0xb3, 0xf6, 0x79, 0x9e, 0x8f, 0x93, 0x26, 0xf2, 0xdf, 0x1e, 0x80, 0xfc, 0xd2, 0xcb, 0x16,
+        0xd7, 0x8c, 0x9d, 0xc7, 0xcc, 0x14, 0xbb, 0x67, 0x78, 0x62, 0xdc, 0x6c, 0x63, 0x9b, 0x3a,
+        0x63, 0x38, 0xd2, 0x4b, 0x31, 0x2d, 0x39, 0x89, 0xe5, 0x92, 0x0b, 0x5d, 0xbf, 0xc9, 0x76,
+        0x76, 0x5e, 0xfb, 0xfe, 0x57, 0xbb, 0x38, 0x59, 0x40, 0xa7, 0xa4, 0x3b, 0xdf, 0x05, 0xbd,
+        0xda, 0xe3, 0xc9, 0xd6, 0xa2, 0xfb, 0xbd, 0xfc, 0xc0, 0xcb, 0xa0,
+    };
+    string ciphertext = make_string(ciphertext_bytes);
+
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::GCM)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 128)
+                      .Authorization(TAG_NONCE, nonce.data(), nonce.size());
+
+    auto import_params = AuthorizationSetBuilder()
+                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                             .AesEncryptionKey(128)
+                             .BlockMode(BlockMode::GCM)
+                             .Padding(PaddingMode::NONE)
+                             .Authorization(TAG_CALLER_NONCE)
+                             .Authorization(TAG_MIN_MAC_LENGTH, 128);
+
+    // Import correct key and decrypt
+    const uint8_t key_bytes[] = {
+        0xba, 0x76, 0x35, 0x4f, 0x0a, 0xed, 0x6e, 0x8d,
+        0x91, 0xf4, 0x5c, 0x4f, 0xf5, 0xa0, 0x62, 0xdb,
+    };
+    string key = make_string(key_bytes);
+    ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
+    string plaintext = DecryptMessage(ciphertext, params);
+    EXPECT_EQ(ErrorCode::OK, DeleteKey());
+
+    // Corrupt key and attempt to decrypt
+    key[0] = 0;
+    ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+    EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext));
+    EXPECT_EQ(ErrorCode::OK, DeleteKey());
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmAadNoData
+ *
+ * Verifies that AES GCM mode works when provided additional authenticated data, but no data to
+ * encrypt.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmAadNoData) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string aad = "1234567890123456";
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::GCM)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto finish_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size());
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params));
+    string ciphertext;
+    AuthorizationSet finish_out_params;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, "" /* input */, "" /* signature */,
+                                    &finish_out_params, &ciphertext));
+    EXPECT_TRUE(finish_out_params.empty());
+
+    // Grab nonce
+    params.push_back(begin_out_params);
+
+    // Decrypt.
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, ciphertext, "" /* signature */,
+                                    &finish_out_params, &plaintext))
+        << "(Possibly b/33615032)";
+
+    EXPECT_TRUE(finish_out_params.empty());
+
+    EXPECT_EQ("", plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmMultiPartAad
+ *
+ * Verifies that AES GCM mode works when provided additional authenticated data in multiple chunks.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmMultiPartAad) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string message = "123456789012345678901234567890123456";
+    auto begin_params = AuthorizationSetBuilder()
+                            .BlockMode(BlockMode::GCM)
+                            .Padding(PaddingMode::NONE)
+                            .Authorization(TAG_MAC_LENGTH, 128);
+    AuthorizationSet begin_out_params;
+
+    auto update_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foo", (size_t)3);
+
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params));
+
+    // No data, AAD only.
+    string ciphertext;
+    size_t input_consumed;
+    AuthorizationSet update_out_params;
+    EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, "" /* input */, &update_out_params,
+                                    &ciphertext, &input_consumed));
+    EXPECT_EQ(0U, input_consumed);
+    EXPECT_EQ(0U, ciphertext.size());
+    EXPECT_TRUE(update_out_params.empty());
+
+    // AAD and data.
+    EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params,
+                                    &ciphertext, &input_consumed));
+    EXPECT_EQ(message.size(), input_consumed);
+    EXPECT_EQ(message.size(), ciphertext.size());
+    EXPECT_TRUE(update_out_params.empty());
+
+    EXPECT_EQ(ErrorCode::OK, Finish("" /* input */, &ciphertext));
+
+    // Grab nonce.
+    begin_params.push_back(begin_out_params);
+
+    // Decrypt
+    update_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foofoo", (size_t)6);
+
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, update_params, ciphertext, "" /* signature */,
+                                    &update_out_params, &plaintext));
+    EXPECT_TRUE(update_out_params.empty());
+    EXPECT_EQ(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmAadOutOfOrder
+ *
+ * Verifies that AES GCM mode fails correctly when given AAD after data to encipher.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmAadOutOfOrder) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string message = "123456789012345678901234567890123456";
+    auto begin_params = AuthorizationSetBuilder()
+                            .BlockMode(BlockMode::GCM)
+                            .Padding(PaddingMode::NONE)
+                            .Authorization(TAG_MAC_LENGTH, 128);
+    AuthorizationSet begin_out_params;
+
+    auto update_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foo", (size_t)3);
+
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params));
+
+    // No data, AAD only.
+    string ciphertext;
+    size_t input_consumed;
+    AuthorizationSet update_out_params;
+    EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, "" /* input */, &update_out_params,
+                                    &ciphertext, &input_consumed));
+    EXPECT_EQ(0U, input_consumed);
+    EXPECT_EQ(0U, ciphertext.size());
+    EXPECT_TRUE(update_out_params.empty());
+
+    // AAD and data.
+    EXPECT_EQ(ErrorCode::OK, Update(op_handle_, update_params, message, &update_out_params,
+                                    &ciphertext, &input_consumed));
+    EXPECT_EQ(message.size(), input_consumed);
+    EXPECT_EQ(message.size(), ciphertext.size());
+    EXPECT_TRUE(update_out_params.empty());
+
+    // More AAD
+    EXPECT_EQ(ErrorCode::INVALID_TAG, Update(op_handle_, update_params, "", &update_out_params,
+                                             &ciphertext, &input_consumed));
+
+    op_handle_ = kOpHandleSentinel;
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmBadAad
+ *
+ * Verifies that AES GCM decryption fails correctly when additional authenticated date is wrong.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmBadAad) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string message = "12345678901234567890123456789012";
+    auto begin_params = AuthorizationSetBuilder()
+                            .BlockMode(BlockMode::GCM)
+                            .Padding(PaddingMode::NONE)
+                            .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto finish_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foobar", (size_t)6);
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params));
+    string ciphertext;
+    AuthorizationSet finish_out_params;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message, "" /* signature */,
+                                    &finish_out_params, &ciphertext));
+
+    // Grab nonce
+    begin_params.push_back(begin_out_params);
+
+    finish_params = AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA,
+                                                            "barfoo" /* Wrong AAD */, (size_t)6);
+
+    // Decrypt.
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params, &begin_out_params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::VERIFICATION_FAILED,
+              Finish(op_handle_, finish_params, ciphertext, "" /* signature */, &finish_out_params,
+                     &plaintext));
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmWrongNonce
+ *
+ * Verifies that AES GCM decryption fails correctly when the nonce is incorrect.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmWrongNonce) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string message = "12345678901234567890123456789012";
+    auto begin_params = AuthorizationSetBuilder()
+                            .BlockMode(BlockMode::GCM)
+                            .Padding(PaddingMode::NONE)
+                            .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto finish_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, "foobar", (size_t)6);
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, begin_params, &begin_out_params));
+    string ciphertext;
+    AuthorizationSet finish_out_params;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message, "" /* signature */,
+                                    &finish_out_params, &ciphertext));
+
+    // Wrong nonce
+    begin_params.push_back(TAG_NONCE, HidlBuf("123456789012"));
+
+    // Decrypt.
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, begin_params, &begin_out_params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::VERIFICATION_FAILED,
+              Finish(op_handle_, finish_params, ciphertext, "" /* signature */, &finish_out_params,
+                     &plaintext));
+
+    // With wrong nonce, should have gotten garbage plaintext (or none).
+    EXPECT_NE(message, plaintext);
+}
+
+/*
+ * EncryptionOperationsTest.AesGcmCorruptTag
+ *
+ * Verifies that AES GCM decryption fails correctly when the tag is wrong.
+ */
+TEST_F(EncryptionOperationsTest, AesGcmCorruptTag) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .BlockMode(BlockMode::GCM)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    string aad = "1234567890123456";
+    string message = "123456789012345678901234567890123456";
+
+    auto params = AuthorizationSetBuilder()
+                      .BlockMode(BlockMode::GCM)
+                      .Padding(PaddingMode::NONE)
+                      .Authorization(TAG_MAC_LENGTH, 128);
+
+    auto finish_params =
+        AuthorizationSetBuilder().Authorization(TAG_ASSOCIATED_DATA, aad.data(), aad.size());
+
+    // Encrypt
+    AuthorizationSet begin_out_params;
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::ENCRYPT, params, &begin_out_params));
+    string ciphertext;
+    AuthorizationSet finish_out_params;
+    EXPECT_EQ(ErrorCode::OK, Finish(op_handle_, finish_params, message, "" /* signature */,
+                                    &finish_out_params, &ciphertext));
+    EXPECT_TRUE(finish_out_params.empty());
+
+    // Corrupt tag
+    ++(*ciphertext.rbegin());
+
+    // Grab nonce
+    params.push_back(begin_out_params);
+
+    // Decrypt.
+    EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+    string plaintext;
+    EXPECT_EQ(ErrorCode::VERIFICATION_FAILED,
+              Finish(op_handle_, finish_params, ciphertext, "" /* signature */, &finish_out_params,
+                     &plaintext));
+    EXPECT_TRUE(finish_out_params.empty());
+}
+
+typedef KeymasterHidlTest MaxOperationsTest;
+
+/*
+ * MaxOperationsTest.TestLimitAes
+ *
+ * Verifies that the max uses per boot tag works correctly with AES keys.
+ */
+TEST_F(MaxOperationsTest, TestLimitAes) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .EcbMode()
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_MAX_USES_PER_BOOT, 3)));
+
+    string message = "1234567890123456";
+
+    auto params = AuthorizationSetBuilder().EcbMode().Padding(PaddingMode::NONE);
+
+    EncryptMessage(message, params);
+    EncryptMessage(message, params);
+    EncryptMessage(message, params);
+
+    // Fourth time should fail.
+    EXPECT_EQ(ErrorCode::KEY_MAX_OPS_EXCEEDED, Begin(KeyPurpose::ENCRYPT, params));
+}
+
+/*
+ * MaxOperationsTest.TestLimitAes
+ *
+ * Verifies that the max uses per boot tag works correctly with RSA keys.
+ */
+TEST_F(MaxOperationsTest, TestLimitRsa) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(1024, 3)
+                                             .NoDigestOrPadding()
+                                             .Authorization(TAG_MAX_USES_PER_BOOT, 3)));
+
+    string message = "1234567890123456";
+
+    auto params = AuthorizationSetBuilder().NoDigestOrPadding();
+
+    SignMessage(message, params);
+    SignMessage(message, params);
+    SignMessage(message, params);
+
+    // Fourth time should fail.
+    EXPECT_EQ(ErrorCode::KEY_MAX_OPS_EXCEEDED, Begin(KeyPurpose::SIGN, params));
+}
+
+typedef KeymasterHidlTest AddEntropyTest;
+
+/*
+ * AddEntropyTest.AddEntropy
+ *
+ * Verifies that the addRngEntropy method doesn't blow up.  There's no way to test that entropy is
+ * actually added.
+ */
+TEST_F(AddEntropyTest, AddEntropy) {
+    EXPECT_EQ(ErrorCode::OK, keymaster().addRngEntropy(HidlBuf("foo")));
+}
+
+/*
+ * AddEntropyTest.AddEmptyEntropy
+ *
+ * Verifies that the addRngEntropy method doesn't blow up when given an empty buffer.
+ */
+TEST_F(AddEntropyTest, AddEmptyEntropy) {
+    EXPECT_EQ(ErrorCode::OK, keymaster().addRngEntropy(HidlBuf()));
+}
+
+/*
+ * AddEntropyTest.AddLargeEntropy
+ *
+ * Verifies that the addRngEntropy method doesn't blow up when given a largish amount of data.
+ */
+TEST_F(AddEntropyTest, AddLargeEntropy) {
+    EXPECT_EQ(ErrorCode::OK, keymaster().addRngEntropy(HidlBuf(string(16 * 1024, 'a'))));
+}
+
+typedef KeymasterHidlTest AttestationTest;
+
+/*
+ * AttestationTest.RsaAttestation
+ *
+ * Verifies that attesting to RSA keys works and generates the expected output.
+ */
+TEST_F(AttestationTest, RsaAttestation) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .RsaSigningKey(1024, 3)
+                                             .Digest(Digest::NONE)
+                                             .Padding(PaddingMode::NONE)
+                                             .Authorization(TAG_INCLUDE_UNIQUE_ID)));
+
+    hidl_vec<hidl_vec<uint8_t>> cert_chain;
+    EXPECT_EQ(ErrorCode::OK, AttestKey(AuthorizationSetBuilder().Authorization(
+                                           TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge")),
+                                       &cert_chain));
+    EXPECT_GE(cert_chain.size(), 2U);
+    EXPECT_TRUE(verify_chain(cert_chain));
+    EXPECT_TRUE(verify_attestation_record("challenge",                            //
+                                          key_characteristics_.softwareEnforced,  //
+                                          key_characteristics_.teeEnforced,       //
+                                          cert_chain[0]));
+}
+
+/*
+ * AttestationTest.EcAttestation
+ *
+ * Verifies that attesting to EC keys works and generates the expected output.
+ */
+TEST_F(AttestationTest, EcAttestation) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .EcdsaSigningKey(EcCurve::P_256)
+                                             .Digest(Digest::SHA_2_256)
+                                             .Authorization(TAG_INCLUDE_UNIQUE_ID)));
+
+    hidl_vec<hidl_vec<uint8_t>> cert_chain;
+    EXPECT_EQ(ErrorCode::OK, AttestKey(AuthorizationSetBuilder().Authorization(
+                                           TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge")),
+                                       &cert_chain));
+    EXPECT_GE(cert_chain.size(), 2U);
+    EXPECT_TRUE(verify_chain(cert_chain));
+
+    EXPECT_TRUE(verify_attestation_record("challenge",                            //
+                                          key_characteristics_.softwareEnforced,  //
+                                          key_characteristics_.teeEnforced,       //
+                                          cert_chain[0]));
+}
+
+/*
+ * AttestationTest.AesAttestation
+ *
+ * Verifies that attesting to AES keys fails in the expected way.
+ */
+TEST_F(AttestationTest, AesAttestation) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .AesEncryptionKey(128)
+                                             .EcbMode()
+                                             .Padding(PaddingMode::PKCS7)));
+
+    hidl_vec<hidl_vec<uint8_t>> cert_chain;
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_ALGORITHM,
+              AttestKey(AuthorizationSetBuilder().Authorization(TAG_ATTESTATION_CHALLENGE,
+                                                                HidlBuf("challenge")),
+                        &cert_chain));
+}
+
+/*
+ * AttestationTest.HmacAttestation
+ *
+ * Verifies that attesting to HMAC keys fails in the expected way.
+ */
+TEST_F(AttestationTest, HmacAttestation) {
+    ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+                                             .Authorization(TAG_NO_AUTH_REQUIRED)
+                                             .HmacKey(128)
+                                             .EcbMode()
+                                             .Digest(Digest::SHA_2_256)
+                                             .Authorization(TAG_MIN_MAC_LENGTH, 128)));
+
+    hidl_vec<hidl_vec<uint8_t>> cert_chain;
+    EXPECT_EQ(ErrorCode::INCOMPATIBLE_ALGORITHM,
+              AttestKey(AuthorizationSetBuilder().Authorization(TAG_ATTESTATION_CHALLENGE,
+                                                                HidlBuf("challenge")),
+                        &cert_chain));
+}
+
+}  // namespace test
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    if (argc == 2) {
+        ALOGI("Running keymaster VTS against service \"%s\"", argv[1]);
+        service_name = argv[1];
+    }
+    int status = RUN_ALL_TESTS();
+    ALOGI("Test result = %d", status);
+    return status;
+}
diff --git a/keymaster/3.0/vts/functional/keymaster_tags.h b/keymaster/3.0/vts/functional/keymaster_tags.h
new file mode 100644
index 0000000..f241ef1
--- /dev/null
+++ b/keymaster/3.0/vts/functional/keymaster_tags.h
@@ -0,0 +1,450 @@
+/*
+ * Copyright 2014 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 SYSTEM_SECURITY_KEYSTORE_KEYMASTER_TAGS_H_
+#define SYSTEM_SECURITY_KEYSTORE_KEYMASTER_TAGS_H_
+
+/**
+ * This header contains various definitions that make working with keymaster tags safer and easier.
+ *
+ * It makes use of a fair amount of template metaprogramming. The metaprogramming serves the purpose
+ * of making it impossible to make certain classes of mistakes when operating on keymaster
+ * authorizations.  For example, it's an error to create a KeyParameter with tag == Tag::PURPOSE
+ * and then to assign Algorithm::RSA to algorithm element of its union. But because the user
+ * must choose the union field, there could be a mismatch which the compiler has now way to
+ * diagnose.
+ *
+ * The machinery in this header solves these problems by describing which union field corresponds
+ * to which Tag. Central to this mechanism is the template TypedTag. It has zero size and binds a
+ * numeric Tag to a type that the compiler understands. By means of the macro DECLARE_TYPED_TAG,
+ * we declare types for each of the tags defined in hardware/interfaces/keymaster/2.0/types.hal.
+ *
+ * The macro DECLARE_TYPED_TAG(name) generates a typename TAG_name_t and a zero sized instance
+ * TAG_name. Once these typed tags have been declared we define metafunctions mapping the each tag
+ * to its value c++ type and the correct union element of KeyParameter. This is done by means of
+ * the macros MAKE_TAG_*VALUE_ACCESSOR, which generates TypedTag2ValueType, a metafunction mapping
+ * a typed tag to the corresponding c++ type, and access function, accessTagValue returning a
+ * reference to the correct element of KeyParameter.
+ * E.g.:
+ *      given "KeyParameter param;" then "accessTagValue(TAG_PURPOSE, param)"
+ *      yields a reference to param.f.purpose
+ * If used in an assignment the compiler can now check the compatibility of the assigned value.
+ *
+ * For convenience we also provide the constructor like function Authorization().
+ * Authorization takes a typed tag and a value and checks at compile time whether the value given
+ * is suitable for the given tag. At runtime it creates a new KeyParameter initialized with the
+ * given tag and value and returns it by value.
+ *
+ * The second convenience function, authorizationValue, allows access to the KeyParameter value in
+ * a safe way. It takes a typed tag and a KeyParameter and returns a reference to the value wrapped
+ * by NullOr. NullOr has out-of-band information about whether it is save to access the wrapped
+ * reference.
+ * E.g.:
+ *      auto param = Authorization(TAG_ALGORITM, Algorithm::RSA);
+ *      auto value1 = authorizationValue(TAG_PURPOSE, param);
+ *      auto value2 = authorizationValue(TAG_ALGORITM, param);
+ * value1.isOk() yields false, but value2.isOk() yields true, thus value2.value() is save to access.
+ */
+
+#include <android/hardware/keymaster/3.0/IHwKeymasterDevice.h>
+#include <hardware/hw_auth_token.h>
+#include <type_traits>
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+// The following create the numeric values that KM_TAG_PADDING and KM_TAG_DIGEST used to have.  We
+// need these old values to be able to support old keys that use them.
+static const int32_t KM_TAG_DIGEST_OLD = static_cast<int32_t>(TagType::ENUM) | 5;
+static const int32_t KM_TAG_PADDING_OLD = static_cast<int32_t>(TagType::ENUM) | 7;
+
+constexpr TagType typeFromTag(Tag tag) {
+    return static_cast<TagType>(static_cast<uint32_t>(tag) & static_cast<uint32_t>(0xf0000000));
+}
+
+/**
+ * TypedTag is a templatized version of Tag, which provides compile-time checking of keymaster tag
+ * types. Instances are convertible to Tag, so they can be used wherever Tag is expected, and
+ * because they encode the tag type it's possible to create function overloads that only operate on
+ * tags with a particular type.
+ */
+template <TagType tag_type, Tag tag> struct TypedTag {
+    inline TypedTag() {
+        // Ensure that it's impossible to create a TypedTag instance whose 'tag' doesn't have type
+        // 'tag_type'.  Attempting to instantiate a tag with the wrong type will result in a compile
+        // error (no match for template specialization StaticAssert<false>), with no run-time cost.
+        static_assert(typeFromTag(tag) == tag_type, "mismatch between tag and tag_type");
+    }
+    constexpr operator Tag() { return tag; }
+    constexpr long maskedTag() {
+        return static_cast<long>(static_cast<uint32_t>(tag) & static_cast<uint32_t>(0x0fffffff));
+    }
+};
+
+template <Tag tag> struct Tag2TypedTag { typedef TypedTag<typeFromTag(tag), tag> type; };
+
+template <Tag tag> struct Tag2String;
+
+#define _TAGS_STRINGIFY(x) #x
+#define TAGS_STRINGIFY(x) _TAGS_STRINGIFY(x)
+
+#define DECLARE_TYPED_TAG(name)                                                                    \
+    typedef typename Tag2TypedTag<Tag::name>::type TAG_##name##_t;                                 \
+    extern TAG_##name##_t TAG_##name;                                                              \
+    template <> struct Tag2String<Tag::name> {                                                     \
+        static const char* value() { return "Tag::" TAGS_STRINGIFY(name); }                        \
+    }
+
+DECLARE_TYPED_TAG(INVALID);
+DECLARE_TYPED_TAG(KEY_SIZE);
+DECLARE_TYPED_TAG(MAC_LENGTH);
+DECLARE_TYPED_TAG(CALLER_NONCE);
+DECLARE_TYPED_TAG(MIN_MAC_LENGTH);
+DECLARE_TYPED_TAG(RSA_PUBLIC_EXPONENT);
+DECLARE_TYPED_TAG(ECIES_SINGLE_HASH_MODE);
+DECLARE_TYPED_TAG(INCLUDE_UNIQUE_ID);
+DECLARE_TYPED_TAG(ACTIVE_DATETIME);
+DECLARE_TYPED_TAG(ORIGINATION_EXPIRE_DATETIME);
+DECLARE_TYPED_TAG(USAGE_EXPIRE_DATETIME);
+DECLARE_TYPED_TAG(MIN_SECONDS_BETWEEN_OPS);
+DECLARE_TYPED_TAG(MAX_USES_PER_BOOT);
+DECLARE_TYPED_TAG(ALL_USERS);
+DECLARE_TYPED_TAG(USER_ID);
+DECLARE_TYPED_TAG(USER_SECURE_ID);
+DECLARE_TYPED_TAG(NO_AUTH_REQUIRED);
+DECLARE_TYPED_TAG(AUTH_TIMEOUT);
+DECLARE_TYPED_TAG(ALLOW_WHILE_ON_BODY);
+DECLARE_TYPED_TAG(ALL_APPLICATIONS);
+DECLARE_TYPED_TAG(APPLICATION_ID);
+DECLARE_TYPED_TAG(APPLICATION_DATA);
+DECLARE_TYPED_TAG(CREATION_DATETIME);
+DECLARE_TYPED_TAG(ROLLBACK_RESISTANT);
+DECLARE_TYPED_TAG(ROOT_OF_TRUST);
+DECLARE_TYPED_TAG(ASSOCIATED_DATA);
+DECLARE_TYPED_TAG(NONCE);
+DECLARE_TYPED_TAG(AUTH_TOKEN);
+DECLARE_TYPED_TAG(BOOTLOADER_ONLY);
+DECLARE_TYPED_TAG(OS_VERSION);
+DECLARE_TYPED_TAG(OS_PATCHLEVEL);
+DECLARE_TYPED_TAG(UNIQUE_ID);
+DECLARE_TYPED_TAG(ATTESTATION_CHALLENGE);
+DECLARE_TYPED_TAG(ATTESTATION_APPLICATION_ID);
+DECLARE_TYPED_TAG(RESET_SINCE_ID_ROTATION);
+
+DECLARE_TYPED_TAG(PURPOSE);
+DECLARE_TYPED_TAG(ALGORITHM);
+DECLARE_TYPED_TAG(BLOCK_MODE);
+DECLARE_TYPED_TAG(DIGEST);
+DECLARE_TYPED_TAG(PADDING);
+DECLARE_TYPED_TAG(BLOB_USAGE_REQUIREMENTS);
+DECLARE_TYPED_TAG(ORIGIN);
+DECLARE_TYPED_TAG(USER_AUTH_TYPE);
+DECLARE_TYPED_TAG(KDF);
+DECLARE_TYPED_TAG(EC_CURVE);
+
+template <typename... Elems> struct MetaList {};
+
+using all_tags_t = MetaList<
+    TAG_INVALID_t, TAG_KEY_SIZE_t, TAG_MAC_LENGTH_t, TAG_CALLER_NONCE_t, TAG_MIN_MAC_LENGTH_t,
+    TAG_RSA_PUBLIC_EXPONENT_t, TAG_ECIES_SINGLE_HASH_MODE_t, TAG_INCLUDE_UNIQUE_ID_t,
+    TAG_ACTIVE_DATETIME_t, TAG_ORIGINATION_EXPIRE_DATETIME_t, TAG_USAGE_EXPIRE_DATETIME_t,
+    TAG_MIN_SECONDS_BETWEEN_OPS_t, TAG_MAX_USES_PER_BOOT_t, TAG_ALL_USERS_t, TAG_USER_ID_t,
+    TAG_USER_SECURE_ID_t, TAG_NO_AUTH_REQUIRED_t, TAG_AUTH_TIMEOUT_t, TAG_ALLOW_WHILE_ON_BODY_t,
+    TAG_ALL_APPLICATIONS_t, TAG_APPLICATION_ID_t, TAG_APPLICATION_DATA_t, TAG_CREATION_DATETIME_t,
+    TAG_ROLLBACK_RESISTANT_t, TAG_ROOT_OF_TRUST_t, TAG_ASSOCIATED_DATA_t, TAG_NONCE_t,
+    TAG_AUTH_TOKEN_t, TAG_BOOTLOADER_ONLY_t, TAG_OS_VERSION_t, TAG_OS_PATCHLEVEL_t, TAG_UNIQUE_ID_t,
+    TAG_ATTESTATION_CHALLENGE_t, TAG_ATTESTATION_APPLICATION_ID_t, TAG_RESET_SINCE_ID_ROTATION_t,
+    TAG_PURPOSE_t, TAG_ALGORITHM_t, TAG_BLOCK_MODE_t, TAG_DIGEST_t, TAG_PADDING_t,
+    TAG_BLOB_USAGE_REQUIREMENTS_t, TAG_ORIGIN_t, TAG_USER_AUTH_TYPE_t, TAG_KDF_t, TAG_EC_CURVE_t>;
+
+/* implementation in keystore_utils.cpp */
+extern const char* stringifyTag(Tag tag);
+
+template <typename TypedTagType> struct TypedTag2ValueType;
+
+#define MAKE_TAG_VALUE_ACCESSOR(tag_type, field_name)                                              \
+    template <Tag tag> struct TypedTag2ValueType<TypedTag<tag_type, tag>> {                        \
+        typedef decltype(static_cast<KeyParameter*>(nullptr)->field_name) type;                    \
+    };                                                                                             \
+    template <Tag tag>                                                                             \
+    inline auto accessTagValue(TypedTag<tag_type, tag>, const KeyParameter& param)                 \
+        ->const decltype(param.field_name)& {                                                      \
+        return param.field_name;                                                                   \
+    }                                                                                              \
+    template <Tag tag>                                                                             \
+    inline auto accessTagValue(TypedTag<tag_type, tag>, KeyParameter& param)                       \
+        ->decltype(param.field_name)& {                                                            \
+        return param.field_name;                                                                   \
+    }
+
+MAKE_TAG_VALUE_ACCESSOR(TagType::ULONG, f.longInteger)
+MAKE_TAG_VALUE_ACCESSOR(TagType::ULONG_REP, f.longInteger)
+MAKE_TAG_VALUE_ACCESSOR(TagType::DATE, f.dateTime)
+MAKE_TAG_VALUE_ACCESSOR(TagType::UINT, f.integer)
+MAKE_TAG_VALUE_ACCESSOR(TagType::UINT_REP, f.integer)
+MAKE_TAG_VALUE_ACCESSOR(TagType::BOOL, f.boolValue)
+MAKE_TAG_VALUE_ACCESSOR(TagType::BYTES, blob)
+MAKE_TAG_VALUE_ACCESSOR(TagType::BIGNUM, blob)
+
+#define MAKE_TAG_ENUM_VALUE_ACCESSOR(typed_tag, field_name)                                        \
+    template <> struct TypedTag2ValueType<decltype(typed_tag)> {                                   \
+        typedef decltype(static_cast<KeyParameter*>(nullptr)->field_name) type;                    \
+    };                                                                                             \
+    inline auto accessTagValue(decltype(typed_tag), const KeyParameter& param)                     \
+        ->const decltype(param.field_name)& {                                                      \
+        return param.field_name;                                                                   \
+    }                                                                                              \
+    inline auto accessTagValue(decltype(typed_tag), KeyParameter& param)                           \
+        ->decltype(param.field_name)& {                                                            \
+        return param.field_name;                                                                   \
+    }
+
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_ALGORITHM, f.algorithm)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_BLOB_USAGE_REQUIREMENTS, f.keyBlobUsageRequirements)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_BLOCK_MODE, f.blockMode)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_DIGEST, f.digest)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_EC_CURVE, f.ecCurve)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_KDF, f.keyDerivationFunction)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_ORIGIN, f.origin)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_PADDING, f.paddingMode)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_PURPOSE, f.purpose)
+MAKE_TAG_ENUM_VALUE_ACCESSOR(TAG_USER_AUTH_TYPE, f.hardwareAuthenticatorType)
+
+template <TagType tag_type, Tag tag, typename ValueT>
+inline KeyParameter makeKeyParameter(TypedTag<tag_type, tag> ttag, ValueT&& value) {
+    KeyParameter param;
+    param.tag = tag;
+    param.f.longInteger = 0;
+    accessTagValue(ttag, param) = std::forward<ValueT>(value);
+    return param;
+}
+
+// the boolean case
+template <Tag tag> inline KeyParameter makeKeyParameter(TypedTag<TagType::BOOL, tag>) {
+    KeyParameter param;
+    param.tag = tag;
+    param.f.boolValue = true;
+    return param;
+}
+
+template <typename... Pack> struct FirstOrNoneHelper;
+template <typename First> struct FirstOrNoneHelper<First> { typedef First type; };
+template <> struct FirstOrNoneHelper<> {
+    struct type {};
+};
+
+template <typename... Pack> using FirstOrNone = typename FirstOrNoneHelper<Pack...>::type;
+
+template <TagType tag_type, Tag tag, typename... Args>
+inline KeyParameter Authorization(TypedTag<tag_type, tag> ttag, Args&&... args) {
+    static_assert(tag_type != TagType::BOOL || (sizeof...(args) == 0),
+                  "TagType::BOOL Authorizations do not take parameters. Presence is truth.");
+    static_assert(tag_type == TagType::BOOL || (sizeof...(args) == 1),
+                  "Authorization other then TagType::BOOL take exactly one parameter.");
+    static_assert(
+        tag_type == TagType::BOOL ||
+            std::is_convertible<std::remove_cv_t<std::remove_reference_t<FirstOrNone<Args...>>>,
+                                typename TypedTag2ValueType<TypedTag<tag_type, tag>>::type>::value,
+        "Invalid argument type for given tag.");
+
+    return makeKeyParameter(ttag, std::forward<Args>(args)...);
+}
+
+/**
+ * This class wraps a (mostly return) value and stores whether or not the wrapped value is valid out
+ * of band. Note that if the wrapped value is a reference it is unsafe to access the value if
+ * !isOk(). If the wrapped type is a pointer or value and !isOk(), it is still safe to access the
+ * wrapped value. In this case the pointer will be NULL though, and the value will be default
+ * constructed.
+ */
+template <typename ValueT> class NullOr {
+    template <typename T> struct reference_initializer {
+        static T&& init() { return *static_cast<std::remove_reference_t<T>*>(nullptr); }
+    };
+    template <typename T> struct pointer_initializer {
+        static T init() { return nullptr; }
+    };
+    template <typename T> struct value_initializer {
+        static T init() { return T(); }
+    };
+    template <typename T>
+    using initializer_t =
+        std::conditional_t<std::is_lvalue_reference<T>::value, reference_initializer<T>,
+                           std::conditional_t<std::is_pointer<T>::value, pointer_initializer<T>,
+                                              value_initializer<T>>>;
+
+  public:
+    NullOr() : value_(initializer_t<ValueT>::init()), null_(true) {}
+    NullOr(ValueT&& value) : value_(std::forward<ValueT>(value)), null_(false) {}
+
+    bool isOk() const { return !null_; }
+
+    const ValueT& value() const & { return value_; }
+    ValueT& value() & { return value_; }
+    ValueT&& value() && { return std::move(value_); }
+
+  private:
+    ValueT value_;
+    bool null_;
+};
+
+template <typename T> std::remove_reference_t<T> NullOrOr(NullOr<T>&& v) {
+    if (v.isOk()) return v;
+    return {};
+}
+
+template <typename Head, typename... Tail>
+std::remove_reference_t<Head> NullOrOr(Head&& head, Tail&&... tail) {
+    if (head.isOk()) return head;
+    return NullOrOr(std::forward<Tail>(tail)...);
+}
+
+template <typename Default, typename Wrapped>
+std::remove_reference_t<Wrapped> defaultOr(NullOr<Wrapped>&& optional, Default&& def) {
+    static_assert(std::is_convertible<std::remove_reference_t<Default>,
+                                      std::remove_reference_t<Wrapped>>::value,
+                  "Type of default value must match the type wrapped by NullOr");
+    if (optional.isOk()) return optional.value();
+    return def;
+}
+
+template <TagType tag_type, Tag tag>
+inline NullOr<const typename TypedTag2ValueType<TypedTag<tag_type, tag>>::type&>
+authorizationValue(TypedTag<tag_type, tag> ttag, const KeyParameter& param) {
+    if (tag != param.tag) return {};
+    return accessTagValue(ttag, param);
+}
+
+inline const char* stringify(Digest digest) {
+    switch (digest) {
+    case Digest::NONE:
+        return "None";
+    case Digest::MD5:
+        return "Md5";
+    case Digest::SHA1:
+        return "Sha1";
+    case Digest::SHA_2_224:
+        return "Sha224";
+    case Digest::SHA_2_256:
+        return "Sha256";
+    case Digest::SHA_2_384:
+        return "Sha384";
+    case Digest::SHA_2_512:
+        return "Sha512";
+    }
+    return "UNKNOWN DIGEST!";
+}
+
+inline const char* stringify(Algorithm algorithm) {
+    switch (algorithm) {
+    case Algorithm::RSA:
+        return "Rsa";
+    case Algorithm::EC:
+        return "Ec";
+    case Algorithm::AES:
+        return "Aes";
+    case Algorithm::HMAC:
+        return "Hmac";
+    }
+    return "UNKNOWN ALGORITHM";
+}
+
+inline const char* stringify(BlockMode block_mode) {
+    switch (block_mode) {
+    case BlockMode::ECB:
+        return "Ecb";
+    case BlockMode::CBC:
+        return "Cbc";
+    case BlockMode::CTR:
+        return "Ctr";
+    case BlockMode::GCM:
+        return "Gcm";
+    }
+    return "UNKNOWN BLOCK MODE";
+}
+
+inline const char* stringify(PaddingMode padding) {
+    switch (padding) {
+    case PaddingMode::NONE:
+        return "None";
+    case PaddingMode::RSA_OAEP:
+        return "RsaOaep";
+    case PaddingMode::RSA_PSS:
+        return "RsaPss";
+    case PaddingMode::RSA_PKCS1_1_5_ENCRYPT:
+        return "RsaPkcs115Encrypt";
+    case PaddingMode::RSA_PKCS1_1_5_SIGN:
+        return "RsaPkcs115Sign";
+    case PaddingMode::PKCS7:
+        return "Pkcs7";
+    }
+    return "UNKNOWN PADDING MODE";
+}
+
+inline const char* stringify(KeyOrigin origin) {
+    switch (origin) {
+    case KeyOrigin::GENERATED:
+        return "Generated";
+    case KeyOrigin::DERIVED:
+        return "Derived";
+    case KeyOrigin::IMPORTED:
+        return "Imported";
+    case KeyOrigin::UNKNOWN:
+        return "UNKNOWN (keymaster0 didn't record it)";
+    }
+    return "UNKOWN KEY ORIGIN VALUE";
+}
+
+inline const char* stringify(KeyPurpose purpose) {
+    switch (purpose) {
+    case KeyPurpose::ENCRYPT:
+        return "Encrypt";
+    case KeyPurpose::DECRYPT:
+        return "Decrypt";
+    case KeyPurpose::SIGN:
+        return "Sign";
+    case KeyPurpose::VERIFY:
+        return "Verify";
+    case KeyPurpose::DERIVE_KEY:
+        return "DeriveKey";
+    case KeyPurpose::WRAP_KEY:
+        return "WrapKey";
+    };
+    return "UNKNOWN KEY PURPOSE";
+}
+
+inline const char* stringify(EcCurve curve) {
+    switch (curve) {
+    case EcCurve::P_224:
+        return "P_224";
+    case EcCurve::P_256:
+        return "P_256";
+    case EcCurve::P_384:
+        return "P_384";
+    case EcCurve::P_521:
+        return "P_521";
+    }
+    return "UNKNOWN EC CURVE";
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
+
+#endif  // SYSTEM_SECURITY_KEYSTORE_KEYMASTER_TAGS_H_
diff --git a/keymaster/3.0/vts/functional/keystore_tags_utils.cpp b/keymaster/3.0/vts/functional/keystore_tags_utils.cpp
new file mode 100644
index 0000000..8dd99db
--- /dev/null
+++ b/keymaster/3.0/vts/functional/keystore_tags_utils.cpp
@@ -0,0 +1,50 @@
+/*
+**
+** 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.
+*/
+
+#include "keymaster_tags.h"
+
+namespace android {
+namespace hardware {
+namespace keymaster {
+namespace V3_0 {
+
+template <typename TagList> struct TagStringifier;
+
+template <typename... Tags> struct TagStringifier<MetaList<Tags...>> {
+    template <TagType tag_type, Tag tag>
+    static TypedTag<tag_type, tag> chooseString(TypedTag<tag_type, tag> ttag, Tag runtime_tag,
+                                                const char** result) {
+        if (tag == runtime_tag) {
+            *result = Tag2String<tag>::value();
+        }
+        return ttag;
+    }
+    static const char* stringify(Tag tag) {
+        const char* result = "unknown tag";
+        [](Tags&&...) {}(chooseString(Tags(), tag, &result)...);
+        return result;
+    }
+};
+
+const char* stringifyTag(Tag tag) {
+    return TagStringifier<all_tags_t>::stringify(tag);
+}
+
+}  // namespace V3_0
+}  // namespace keymaster
+}  // namespace hardware
+}  // namespace android
diff --git a/keymaster/3.0/vts/functional/openssl_utils.h b/keymaster/3.0/vts/functional/openssl_utils.h
new file mode 100644
index 0000000..2eba9ba
--- /dev/null
+++ b/keymaster/3.0/vts/functional/openssl_utils.h
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+template <typename T, void (*F)(T*)> struct UniquePtrDeleter {
+    void operator()(T* p) const { F(p); }
+};
+
+typedef UniquePtrDeleter<EVP_PKEY, EVP_PKEY_free> EVP_PKEY_Delete;
+
+#define MAKE_OPENSSL_PTR_TYPE(type)                                                                \
+    typedef std::unique_ptr<type, UniquePtrDeleter<type, type##_free>> type##_Ptr;
+
+MAKE_OPENSSL_PTR_TYPE(ASN1_OBJECT)
+MAKE_OPENSSL_PTR_TYPE(EVP_PKEY)
+MAKE_OPENSSL_PTR_TYPE(RSA)
+MAKE_OPENSSL_PTR_TYPE(X509)
+MAKE_OPENSSL_PTR_TYPE(BN_CTX)
+
+typedef std::unique_ptr<BIGNUM, UniquePtrDeleter<BIGNUM, BN_free>> BIGNUM_Ptr;
+
+inline const EVP_MD* openssl_digest(android::hardware::keymaster::V3_0::Digest digest) {
+    switch (digest) {
+    case android::hardware::keymaster::V3_0::Digest::NONE:
+        return nullptr;
+    case android::hardware::keymaster::V3_0::Digest::MD5:
+        return EVP_md5();
+    case android::hardware::keymaster::V3_0::Digest::SHA1:
+        return EVP_sha1();
+    case android::hardware::keymaster::V3_0::Digest::SHA_2_224:
+        return EVP_sha224();
+    case android::hardware::keymaster::V3_0::Digest::SHA_2_256:
+        return EVP_sha256();
+    case android::hardware::keymaster::V3_0::Digest::SHA_2_384:
+        return EVP_sha384();
+    case android::hardware::keymaster::V3_0::Digest::SHA_2_512:
+        return EVP_sha512();
+    }
+    return nullptr;
+}
diff --git a/light/2.0/types.hal b/light/2.0/types.hal
index cc2ec32..27b67e0 100644
--- a/light/2.0/types.hal
+++ b/light/2.0/types.hal
@@ -24,17 +24,17 @@
 };
 
 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,
@@ -77,7 +77,7 @@
     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
diff --git a/memtrack/1.0/IMemtrack.hal b/memtrack/1.0/IMemtrack.hal
index ae9d960..a329032 100644
--- a/memtrack/1.0/IMemtrack.hal
+++ b/memtrack/1.0/IMemtrack.hal
@@ -16,7 +16,7 @@
 
 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
@@ -30,7 +30,7 @@
  * 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.
      *
diff --git a/memtrack/1.0/types.hal b/memtrack/1.0/types.hal
index 3d702b3..189312a 100644
--- a/memtrack/1.0/types.hal
+++ b/memtrack/1.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.memtrack@1.0;
 
-/*
+/**
  * SMAPS_ACCOUNTED/SMAPS_UNACCOUNTED
  * Flags to differentiate memory that can already be accounted for in
  * /proc/<pid>/smaps,
@@ -56,7 +56,7 @@
     SECURE = 1 << 9,
 };
 
-/* Tags which define the usage of the memory buffers. */
+/** Tags which define the usage of the memory buffers. */
 enum MemtrackType : uint32_t {
     OTHER = 0,
     GL = 1,
@@ -79,7 +79,7 @@
  */
 struct MemtrackRecord {
     uint64_t sizeInBytes;
-    /*
+    /**
      * This is the bitfield for the MemtrackFlag indicating all the flags that
      * are valid for this record.
      */
diff --git a/nfc/1.0/INfc.hal b/nfc/1.0/INfc.hal
index c6e1511..74b69a0 100644
--- a/nfc/1.0/INfc.hal
+++ b/nfc/1.0/INfc.hal
@@ -19,7 +19,7 @@
 import INfcClientCallback;
 
 interface INfc {
-    /*
+    /**
      * Opens the NFC controller device and performs initialization.
      * This may include patch download and other vendor-specific initialization.
      *
@@ -37,7 +37,7 @@
     @callflow(next={"write", "coreInitialized", "prediscover", "powerCycle", "controlGranted"})
     open(INfcClientCallback clientCallback) generates (NfcStatus status);
 
-    /*
+    /**
      * Performs an NCI write.
      *
      * This method may queue writes and return immediately. The only
@@ -49,7 +49,7 @@
                     "controlGranted"})
     write(NfcData data) generates (uint32_t retval);
 
-    /*
+    /**
      * coreInitialized() is called after the CORE_INIT_RSP is received from the
      * NFCC. At this time, the HAL can do any chip-specific configuration.
      *
@@ -62,7 +62,7 @@
     @callflow(next={"write", "prediscover", "close"})
     coreInitialized(NfcData data) generates (NfcStatus status);
 
-    /*
+    /**
      * 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.
@@ -76,7 +76,7 @@
     @callflow(next={"write", "close", "coreInitialized", "powerCycle", "controlGranted"})
     prediscover() generates (NfcStatus status);
 
-    /*
+    /**
      * Close the NFC controller. Should free all resources.
      *
      * @return NfcStatus::OK on success and NfcStatus::FAILED on error.
@@ -84,7 +84,7 @@
     @exit
     close() generates (NfcStatus status);
 
-    /*
+    /**
      * Grant HAL the exclusive control to send NCI commands.
      * Called in response to NfcEvent.REQUEST_CONTROL.
      * Must only be called when there are no NCI commands pending.
@@ -95,7 +95,7 @@
     @callflow(next={"write", "close", "prediscover", "coreInitialized", "powerCycle"})
     controlGranted() generates (NfcStatus status);
 
-     /*
+     /**
      * Restart controller by power cyle;
      * NfcEvent.OPEN_CPLT will notify when operation is complete.
      *
diff --git a/nfc/1.0/INfcClientCallback.hal b/nfc/1.0/INfcClientCallback.hal
index a56cc09..9972ada 100644
--- a/nfc/1.0/INfcClientCallback.hal
+++ b/nfc/1.0/INfcClientCallback.hal
@@ -17,13 +17,13 @@
 package android.hardware.nfc@1.0;
 
 interface INfcClientCallback {
-    /*
+    /**
      * The callback passed in from the NFC stack that the HAL
      * can use to pass events back to the stack.
      */
     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.
      */
diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
index aa3bc9c..9da58e2 100644
--- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
+++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
@@ -22,10 +22,8 @@
 #include <android/hardware/nfc/1.0/types.h>
 #include <hardware/nfc.h>
 
+#include <VtsHalHidlTargetCallbackBase.h>
 #include <VtsHalHidlTargetTestBase.h>
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
 
 using ::android::hardware::nfc::V1_0::INfc;
 using ::android::hardware::nfc::V1_0::INfcClientCallback;
@@ -55,6 +53,43 @@
 #define VERSION 0x11
 #define TIMEOUT_PERIOD 5
 
+constexpr char kCallbackNameSendEvent[] = "sendEvent";
+constexpr char kCallbackNameSendData[] = "sendData";
+
+class NfcClientCallbackArgs {
+   public:
+    NfcEvent last_event_;
+    NfcStatus last_status_;
+    NfcData last_data_;
+};
+
+/* Callback class for data & Event. */
+class NfcClientCallback
+    : public ::testing::VtsHalHidlTargetCallbackBase<NfcClientCallbackArgs>,
+      public INfcClientCallback {
+   public:
+    virtual ~NfcClientCallback() = default;
+
+    /* sendEvent callback function - Records the Event & Status
+     * and notifies the TEST
+     **/
+    Return<void> sendEvent(NfcEvent event, NfcStatus event_status) override {
+        NfcClientCallbackArgs args;
+        args.last_event_ = event;
+        args.last_status_ = event_status;
+        NotifyFromCallback(kCallbackNameSendEvent, args);
+        return Void();
+    };
+
+    /* sendData callback function. Records the data and notifies the TEST*/
+    Return<void> sendData(const NfcData& data) override {
+        NfcClientCallbackArgs args;
+        args.last_data_ = data;
+        NotifyFromCallback(kCallbackNameSendData, args);
+        return Void();
+    };
+};
+
 // The main test class for NFC HIDL HAL.
 class NfcHidlTest : public ::testing::VtsHalHidlTargetTestBase {
  public:
@@ -62,88 +97,28 @@
     nfc_ = ::testing::VtsHalHidlTargetTestBase::getService<INfc>();
     ASSERT_NE(nfc_, nullptr);
 
-    nfc_cb_ = new NfcClientCallback(*this);
+    nfc_cb_ = new NfcClientCallback();
     ASSERT_NE(nfc_cb_, nullptr);
 
-    count = 0;
-    last_event_ = NfcEvent::ERROR;
-    last_status_ = NfcStatus::FAILED;
-
     EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
     // Wait for OPEN_CPLT event
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-    EXPECT_EQ(NfcStatus::OK, last_status_);
+    auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+    EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
   }
 
   virtual void TearDown() override {
     EXPECT_EQ(NfcStatus::OK, nfc_->close());
     // Wait for CLOSE_CPLT event
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(NfcEvent::CLOSE_CPLT, last_event_);
-    EXPECT_EQ(NfcStatus::OK, last_status_);
+    auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(NfcEvent::CLOSE_CPLT, res.args->last_event_);
+    EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
   }
 
-  /* Used as a mechanism to inform the test about data/event callback */
-  inline void notify() {
-    std::unique_lock<std::mutex> lock(mtx);
-    count++;
-    cv.notify_one();
-  }
-
-  /* Test code calls this function to wait for data/event callback */
-  inline std::cv_status wait() {
-    std::unique_lock<std::mutex> lock(mtx);
-
-    std::cv_status status = std::cv_status::no_timeout;
-    auto now = std::chrono::system_clock::now();
-    while (count == 0) {
-      status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
-      if (status == std::cv_status::timeout) return status;
-    }
-    count--;
-    return status;
-  }
-
-  /* Callback class for data & Event. */
-  class NfcClientCallback : public INfcClientCallback {
-    NfcHidlTest& parent_;
-
-   public:
-    NfcClientCallback(NfcHidlTest& parent) : parent_(parent){};
-
-    virtual ~NfcClientCallback() = default;
-
-    /* sendEvent callback function - Records the Event & Status
-     * and notifies the TEST
-     **/
-    Return<void> sendEvent(NfcEvent event, NfcStatus event_status) override {
-      parent_.last_event_ = event;
-      parent_.last_status_ = event_status;
-      parent_.notify();
-      return Void();
-    };
-
-    /* sendData callback function. Records the data and notifies the TEST*/
-    Return<void> sendData(const NfcData& data) override {
-      size_t size = parent_.last_data_.size();
-      parent_.last_data_.resize(size + 1);
-      parent_.last_data_[size] = data;
-      parent_.notify();
-      return Void();
-    };
-  };
-
   sp<INfc> nfc_;
-  sp<INfcClientCallback> nfc_cb_;
-  NfcEvent last_event_;
-  NfcStatus last_status_;
-  hidl_vec<NfcData> last_data_;
-
- private:
-  std::mutex mtx;
-  std::condition_variable cv;
-  int count;
+  sp<NfcClientCallback> nfc_cb_;
 };
 
 // A class for test environment setup (kept since this file is a template).
@@ -175,12 +150,12 @@
   NfcData data = cmd;
   EXPECT_EQ(data.size(), nfc_->write(data));
   // Wait for CORE_RESET_RSP
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(1ul, last_data_.size());
-  EXPECT_EQ(6ul, last_data_[0].size());
-  EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
-  EXPECT_GE(VERSION, last_data_[0][4]);
-  EXPECT_EQ(0ul, last_data_[0][5]);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(6ul, res.args->last_data_.size());
+  EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
+  EXPECT_GE(VERSION, res.args->last_data_[4]);
+  EXPECT_EQ(0ul, res.args->last_data_[5]);
 }
 
 /*
@@ -194,12 +169,12 @@
   NfcData data = cmd;
   EXPECT_EQ(data.size(), nfc_->write(data));
   // Wait for CORE_RESET_RSP
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(1ul, last_data_.size());
-  EXPECT_EQ(6ul, last_data_[0].size());
-  EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
-  EXPECT_GE(VERSION, last_data_[0][4]);
-  EXPECT_EQ(1ul, last_data_[0][5]);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(6ul, res.args->last_data_.size());
+  EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
+  EXPECT_GE(VERSION, res.args->last_data_[4]);
+  EXPECT_EQ(1ul, res.args->last_data_[5]);
 }
 
 /*
@@ -214,10 +189,10 @@
   NfcData data = cmd;
   EXPECT_EQ(data.size(), nfc_->write(data));
   // Wait for RSP
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(1ul, last_data_.size());
-  EXPECT_EQ(4ul, last_data_[0].size());
-  EXPECT_EQ(SYNTAX_ERROR, last_data_[0][3]);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(4ul, res.args->last_data_.size());
+  EXPECT_EQ(SYNTAX_ERROR, res.args->last_data_[3]);
 }
 
 /*
@@ -236,29 +211,27 @@
   size_t size = data.size();
 
   for (int i = 0; i < 100; i++) {
-    last_data_.resize(0);
     data.resize(++size);
     data[size - 1] = 0xFF;
     EXPECT_EQ(data.size(), nfc_->write(data));
     // Wait for CORE_INTERFACE_ERROR_NTF
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(1ul, last_data_.size());
-    EXPECT_EQ(5ul, last_data_[0].size());
-    EXPECT_EQ(0x60, last_data_[0][0]);
-    EXPECT_EQ(0x08, last_data_[0][1]);
-    EXPECT_EQ(0x02, last_data_[0][2]);
-    EXPECT_EQ(SYNTAX_ERROR, last_data_[0][3]);
+    auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(5ul, res.args->last_data_.size());
+    EXPECT_EQ(0x60, res.args->last_data_[0]);
+    EXPECT_EQ(0x08, res.args->last_data_[1]);
+    EXPECT_EQ(0x02, res.args->last_data_[2]);
+    EXPECT_EQ(SYNTAX_ERROR, res.args->last_data_[3]);
   }
 
   cmd = CORE_CONN_CREATE_CMD;
   data = cmd;
-  last_data_.resize(0);
   EXPECT_EQ(data.size(), nfc_->write(data));
   // Wait for CORE_CONN_CREATE_RSP
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(1ul, last_data_.size());
-  EXPECT_EQ(7ul, last_data_[0].size());
-  EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(7ul, res.args->last_data_.size());
+  EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
 }
 /*
  * Bandwidth:
@@ -273,40 +246,48 @@
   NfcData data = cmd;
   EXPECT_EQ(data.size(), nfc_->write(data));
   // Wait for CORE_CONN_CREATE_RSP
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(1ul, last_data_.size());
-  EXPECT_EQ(7ul, last_data_[0].size());
-  EXPECT_EQ((int)NfcStatus::OK, last_data_[0][3]);
-  uint8_t conn_id = last_data_[0][6];
-  uint32_t max_payload_size = last_data_[0][4];
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(7ul, res.args->last_data_.size());
+  EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
+  uint8_t conn_id = res.args->last_data_[6];
+  uint32_t max_payload_size = res.args->last_data_[4];
 
   for (int loops = 0; loops < NUMBER_LOOPS; loops++) {
-    last_data_.resize(0);
-    data.resize(max_payload_size + LOOP_BACK_HEADER_SIZE);
-    data[0] = conn_id;
-    data[1] = 0x00;
-    data[2] = max_payload_size;
-    for (uint32_t i = 0; i < max_payload_size; i++) {
-      data[i + LOOP_BACK_HEADER_SIZE] = i;
+      res.args->last_data_.resize(0);
+      data.resize(max_payload_size + LOOP_BACK_HEADER_SIZE);
+      data[0] = conn_id;
+      data[1] = 0x00;
+      data[2] = max_payload_size;
+      for (uint32_t i = 0; i < max_payload_size; i++) {
+          data[i + LOOP_BACK_HEADER_SIZE] = i;
     }
     EXPECT_EQ(max_payload_size + LOOP_BACK_HEADER_SIZE, nfc_->write(data));
     // Wait for data and CORE_CONN_CREDITS_NTF
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    // Check if the same data was recieved back
-    EXPECT_EQ(2ul, last_data_.size());
+    auto res1 = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+    EXPECT_TRUE(res1.no_timeout);
+    auto res2 = nfc_cb_->WaitForCallback(kCallbackNameSendData);
+    EXPECT_TRUE(res2.no_timeout);
+    // Check if the same data was received back
+    EXPECT_TRUE(res1.args);
+    EXPECT_TRUE(res2.args);
 
+    NfcData credits_ntf = res1.args->last_data_;
+    NfcData received_data = res2.args->last_data_;
     /* It is possible that CORE_CONN_CREDITS_NTF is received before data,
      * Find the order and do further checks depending on that */
-    uint8_t data_index = last_data_[0].size() == data.size() ? 0 : 1;
-    EXPECT_EQ(data.size(), last_data_[data_index].size());
+    if (received_data.size() != data.size()) {
+        credits_ntf = res2.args->last_data_;
+        received_data = res1.args->last_data_;
+    }
+    EXPECT_EQ(data.size(), received_data.size());
     for (size_t i = 0; i < data.size(); i++) {
-      EXPECT_EQ(data[i], last_data_[data_index][i]);
+        EXPECT_EQ(data[i], received_data[i]);
     }
 
-    EXPECT_EQ(6ul, last_data_[!data_index].size());
+    EXPECT_EQ(6ul, credits_ntf.size());
     // Check if the credit is refilled to 1
-    EXPECT_EQ(1, last_data_[!data_index][5]);
+    EXPECT_EQ(1, credits_ntf[5]);
   }
 }
 
@@ -319,9 +300,10 @@
 TEST_F(NfcHidlTest, PowerCycle) {
   EXPECT_EQ(NfcStatus::OK, nfc_->powerCycle());
   // Wait for NfcEvent.OPEN_CPLT
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 }
 
 /*
@@ -332,17 +314,19 @@
 TEST_F(NfcHidlTest, PowerCycleAfterClose) {
   EXPECT_EQ(NfcStatus::OK, nfc_->close());
   // Wait for CLOSE_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::CLOSE_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::CLOSE_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 
   EXPECT_EQ(NfcStatus::FAILED, nfc_->powerCycle());
 
   EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
   // Wait for OPEN_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 }
 
 /*
@@ -353,13 +337,17 @@
 TEST_F(NfcHidlTest, CoreInitialized) {
   NfcData data;
   data.resize(1);
-  for (int i = 0; i <= 6; i++)
-  {
-    data[0] = i;
-    EXPECT_EQ(NfcStatus::OK, nfc_->coreInitialized(data));
-    // Wait for NfcEvent.POST_INIT_CPLT
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(NfcEvent::POST_INIT_CPLT, last_event_);
+  NfcEvent last_event_;
+  for (int i = 0; i <= 6; i++) {
+      data[0] = i;
+      EXPECT_EQ(NfcStatus::OK, nfc_->coreInitialized(data));
+      // Wait for NfcEvent.POST_INIT_CPLT
+      auto res = nfc_cb_->WaitForCallbackAny();
+      if (res.name.compare(kCallbackNameSendEvent) == 0) {
+          last_event_ = res.args->last_event_;
+      }
+      EXPECT_TRUE(res.no_timeout);
+      EXPECT_EQ(NfcEvent::POST_INIT_CPLT, last_event_);
   }
 }
 
@@ -380,17 +368,19 @@
 TEST_F(NfcHidlTest, ControlGrantedAfterClose) {
   EXPECT_EQ(NfcStatus::OK, nfc_->close());
   // Wait for CLOSE_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::CLOSE_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::CLOSE_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 
   EXPECT_EQ(NfcStatus::OK, nfc_->controlGranted());
 
   EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
   // Wait for OPEN_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 }
 
 /* PreDiscover:
@@ -409,17 +399,19 @@
 TEST_F(NfcHidlTest, PreDiscoverAfterClose) {
   EXPECT_EQ(NfcStatus::OK, nfc_->close());
   // Wait for CLOSE_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::CLOSE_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::CLOSE_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 
   EXPECT_EQ(NfcStatus::OK, nfc_->prediscover());
 
   EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
   // Wait for OPEN_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 }
 
 /*
@@ -430,20 +422,21 @@
 TEST_F(NfcHidlTest, CloseAfterClose) {
   EXPECT_EQ(NfcStatus::OK, nfc_->close());
   // Wait for CLOSE_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::CLOSE_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::CLOSE_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 
   EXPECT_EQ(NfcStatus::FAILED, nfc_->close());
 
   EXPECT_EQ(NfcStatus::OK, nfc_->open(nfc_cb_));
   // Wait for OPEN_CPLT event
-  EXPECT_EQ(std::cv_status::no_timeout, wait());
-  EXPECT_EQ(NfcEvent::OPEN_CPLT, last_event_);
-  EXPECT_EQ(NfcStatus::OK, last_status_);
+  res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
+  EXPECT_TRUE(res.no_timeout);
+  EXPECT_EQ(NfcEvent::OPEN_CPLT, res.args->last_event_);
+  EXPECT_EQ(NfcStatus::OK, res.args->last_status_);
 }
 
-
 /*
  * OpenAfterOpen:
  * Calls open() multiple times
diff --git a/power/1.0/IPower.hal b/power/1.0/IPower.hal
index 6cba42a..250f645 100644
--- a/power/1.0/IPower.hal
+++ b/power/1.0/IPower.hal
@@ -15,12 +15,12 @@
  */
 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
@@ -49,7 +49,7 @@
      */
     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.
@@ -62,7 +62,7 @@
      */
     powerHint(PowerHint hint, int32_t data);
 
-    /*
+    /**
      * setFeature() is called to turn on or off a particular feature
      * depending on the state parameter.
      *
@@ -71,7 +71,7 @@
      */
     setFeature(Feature feature, bool activate);
 
-    /*
+    /**
      * Platform-level sleep state stats:
      * Report cumulative info on the statistics on platform-level sleep states
      * since boot.
diff --git a/power/1.0/types.hal b/power/1.0/types.hal
index debdc35..f839283 100644
--- a/power/1.0/types.hal
+++ b/power/1.0/types.hal
@@ -15,9 +15,9 @@
  */
 package android.hardware.power@1.0;
 
-/* Power hint identifiers passed to powerHint() */
+/** 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
@@ -28,7 +28,7 @@
     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,
@@ -38,13 +38,14 @@
     INTERACTION = 0x00000002,
 
 
-    /* DO NOT USE VIDEO_ENCODE/_DECODE!  They will be removed in
+    /**
+     * 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
@@ -52,7 +53,7 @@
     */
     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
@@ -61,7 +62,7 @@
     */
     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
@@ -69,7 +70,7 @@
     */
     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
@@ -79,7 +80,7 @@
 };
 
 enum Feature : uint32_t {
-    /*
+    /**
      * Enabling/Disabling this feature will allow/disallow the system
      * to wake up by tapping the screen twice.
      */
@@ -90,7 +91,7 @@
     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
@@ -100,24 +101,24 @@
  * 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.
@@ -125,27 +126,27 @@
  * 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
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index 0b1bf40..2976290 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -19,7 +19,7 @@
 import IRadioResponse;
 import IRadioIndication;
 
-/*
+/**
  * This interface is used by telephony & telecom to talk to cellular radio.
  * All the functions have minimum one parameter:
  * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
@@ -27,7 +27,7 @@
  * serial to different methods), multiple responses (one for each method call) must still be served.
  */
 interface IRadio {
-    /*
+    /**
      * Set response functions for radio requests & radio indications.
      *
      * @param radioResponse Object containing response functions
@@ -36,7 +36,7 @@
     setResponseFunctions(IRadioResponse radioResponse,
             IRadioIndication radioIndication);
 
-    /*
+    /**
      * Requests status of the ICC card
      *
      * @param serial Serial number of request.
@@ -46,7 +46,7 @@
      */
     oneway getIccCardStatus(int32_t serial);
 
-    /*
+    /**
      * Supplies ICC PIN. Only called if CardStatus has AppState.PIN state
      *
      * @param serial Serial number of request.
@@ -58,7 +58,7 @@
      */
     oneway supplyIccPinForApp(int32_t serial, string pin, string aid);
 
-    /*
+    /**
      * Supplies ICC PUK and new PIN.
      *
      * @param serial Serial number of request.
@@ -71,7 +71,7 @@
      */
     oneway supplyIccPukForApp(int32_t serial, string puk, string pin, string aid);
 
-    /*
+    /**
      * Supplies ICC PIN2. Only called following operation where SIM_PIN2 was
      * returned as a a failure from a previous operation.
      *
@@ -84,7 +84,7 @@
      */
     oneway supplyIccPin2ForApp(int32_t serial, string pin2, string aid);
 
-    /*
+    /**
      * Supplies ICC PUK2 and new PIN2.
      *
      * @param serial Serial number of request.
@@ -98,7 +98,7 @@
     oneway supplyIccPuk2ForApp(int32_t serial, string puk2, string pin2,
             string aid);
 
-    /*
+    /**
      * Supplies old ICC PIN and new PIN.
      *
      * @param serial Serial number of request.
@@ -112,7 +112,7 @@
     oneway changeIccPinForApp(int32_t serial, string oldPin, string newPin,
             string aid);
 
-    /*
+    /**
      * Supplies old ICC PIN2 and new PIN2.
      *
      * @param serial Serial number of request.
@@ -126,7 +126,7 @@
     oneway changeIccPin2ForApp(int32_t serial, string oldPin2, string newPin2,
             string aid);
 
-    /*
+    /**
      * Requests that network personalization be deactivated
      *
      * @param serial Serial number of request.
@@ -137,7 +137,7 @@
      */
     oneway supplyNetworkDepersonalization(int32_t serial, string netPin);
 
-    /*
+    /**
      * Requests current call list
      *
      * @param serial Serial number of request.
@@ -147,7 +147,7 @@
      */
     oneway getCurrentCalls(int32_t serial);
 
-    /*
+    /**
      * Initiate voice call.
      * This method is never used for supplementary service codes
      *
@@ -159,7 +159,7 @@
      */
     oneway dial(int32_t serial, Dial dialInfo);
 
-    /*
+    /**
      * Get the SIM IMSI
      * Only valid when radio state is "RADIO_STATE_ON"
      *
@@ -171,7 +171,7 @@
      */
     oneway getImsiForApp(int32_t serial, string aid);
 
-    /*
+    /**
      * Hang up a specific line (like AT+CHLD=1x)
      * After this HANGUP request returns, Radio must show the connection is NOT
      * active anymore in next requestGetCurrentCalls query.
@@ -184,7 +184,7 @@
      */
     oneway hangup(int32_t serial, int32_t gsmIndex);
 
-    /*
+    /**
      * Hang up waiting or held (like AT+CHLD=0)
      * After this HANGUP request returns, Radio must show the connection is NOT
      * active anymore in next getCurrentCalls() query.
@@ -196,7 +196,7 @@
      */
     oneway hangupWaitingOrBackground(int32_t serial);
 
-    /*
+    /**
      * Hang up waiting or held (like AT+CHLD=1)
      * After this HANGUP request returns, Radio must show the connection is NOT
      * active anymore in next getCurrentCalls query.
@@ -208,7 +208,7 @@
      */
     oneway hangupForegroundResumeBackground(int32_t serial);
 
-    /*
+    /**
      * Switch waiting or holding call and active call (like AT+CHLD=2)
      * State transitions must be as follows:
      *
@@ -229,7 +229,7 @@
      */
     oneway switchWaitingOrHoldingAndActive(int32_t serial);
 
-    /*
+    /**
      * Conference holding and active (like AT+CHLD=3)
      *
      * @param serial Serial number of request.
@@ -239,7 +239,7 @@
      */
     oneway conference(int32_t serial);
 
-    /*
+    /**
      * Send UDUB (user determined user busy) to ringing or
      * waiting call answer)
      *
@@ -250,7 +250,7 @@
      */
     oneway rejectCall(int32_t serial);
 
-    /*
+    /**
      * Requests the failure cause code for the most recently terminated call.
      *
      * @param serial Serial number of request.
@@ -260,7 +260,7 @@
      */
     oneway getLastCallFailCause(int32_t serial);
 
-    /*
+    /**
      * Requests current signal strength and associated information.
      * Must succeed if radio is on.
      *
@@ -270,7 +270,7 @@
      */
     oneway getSignalStrength(int32_t serial);
 
-    /*
+    /**
      * Request current voice registration state
      *
      * @param serial Serial number of request.
@@ -279,7 +279,7 @@
      */
     oneway getVoiceRegistrationState(int32_t serial);
 
-    /*
+    /**
      * Request current data registration state
      *
      * @param serial Serial number of request.
@@ -288,7 +288,7 @@
      */
     oneway getDataRegistrationState(int32_t serial);
 
-    /*
+    /**
      * Request current operator ONS or EONS
      *
      * @param serial Serial number of request.
@@ -297,7 +297,7 @@
      */
     oneway getOperator(int32_t serial);
 
-    /*
+    /**
      * Toggle radio on and off (for "airplane" mode)
      * If the radio is turned off/on the radio modem subsystem
      * is expected return to an initialized state. For instance,
@@ -311,7 +311,7 @@
      */
     oneway setRadioPower(int32_t serial, bool on);
 
-    /*
+    /**
      * Send a DTMF tone
      *
      * If the implementation is currently playing a tone requested via
@@ -325,7 +325,7 @@
      */
     oneway sendDtmf(int32_t serial, string s);
 
-    /*
+    /**
      * Send an SMS message
      *
      * @param serial Serial number of request.
@@ -339,7 +339,7 @@
      */
     oneway sendSms(int32_t serial, GsmSmsMessage message);
 
-    /*
+    /**
      * Send an SMS message. Identical to sendSms,
      * except that more messages are expected to be sent soon. If possible,
      * keep SMS relay protocol link open (eg TS 27.005 AT+CMMS command)
@@ -355,7 +355,7 @@
      */
     oneway sendSMSExpectMore(int32_t serial, GsmSmsMessage message);
 
-    /*
+    /**
      * Setup a packet data connection. If DataCallResponse.status
      * return DataCallFailCause:NONE it is added to the list of data calls and a
      * unsolDataCallListChanged() is sent. The call remains in the
@@ -391,7 +391,7 @@
             DataProfileInfo dataProfileInfo, bool modemCognitive, bool roamingAllowed,
             bool isRoaming);
 
-    /*
+    /**
      * Request ICC I/O operation.
      * This is similar to the TS 27.007 "restricted SIM" operation
      * where it assumes all of the EF selection must be done by the
@@ -411,7 +411,7 @@
      */
     oneway iccIOForApp(int32_t serial, IccIo iccIo);
 
-    /*
+    /**
      * Send a USSD message.
      *
      * If a USSD session already exists, the message must be sent in the
@@ -434,7 +434,7 @@
      */
     oneway sendUssd(int32_t serial, string ussd);
 
-    /*
+    /**
      * Cancel the current USSD session if one exists.
      *
      * @param serial Serial number of request.
@@ -443,7 +443,7 @@
      */
     oneway cancelPendingUssd(int32_t serial);
 
-    /*
+    /**
      * Gets current CLIR status
      *
      * @param serial Serial number of request.
@@ -452,7 +452,7 @@
      */
     oneway getClir(int32_t serial);
 
-    /*
+    /**
      * Set current CLIR status
      *
      * @param serial Serial number of request.
@@ -462,7 +462,7 @@
      */
     oneway setClir(int32_t serial, int32_t status);
 
-    /*
+    /**
      * Request call forward status.
      *
      * @param serial Serial number of request.
@@ -473,7 +473,7 @@
     oneway getCallForwardStatus(int32_t serial,
             CallForwardInfo callInfo);
 
-    /*
+    /**
      * Configure call forward rule
      *
      * @param serial Serial number of request.
@@ -483,7 +483,7 @@
      */
     oneway setCallForward(int32_t serial, CallForwardInfo callInfo);
 
-    /*
+    /**
      * Query current call waiting state
      *
      * @param serial Serial number of request.
@@ -493,7 +493,7 @@
      */
     oneway getCallWaiting(int32_t serial, int32_t serviceClass);
 
-    /*
+    /**
      * Configure current call waiting state
      *
      * @param serial Serial number of request.
@@ -505,7 +505,7 @@
     oneway setCallWaiting(int32_t serial, bool enable,
             int32_t serviceClass);
 
-    /*
+    /**
      * Acknowledge successful or failed receipt of SMS previously indicated
      * via unsolResponseNewSms
      *
@@ -521,7 +521,7 @@
     oneway acknowledgeLastIncomingGsmSms(int32_t serial, bool success,
             SmsAcknowledgeFailCause cause);
 
-    /*
+    /**
      * Answer incoming call
      * Must not be called for WAITING calls.
      * switchWaitingOrHoldingAndActive() must be used in this case
@@ -533,7 +533,7 @@
      */
     oneway acceptCall(int32_t serial);
 
-    /*
+    /**
      * Deactivate packet data connection and remove from the
      * data call list if RadioError:NONE is returned. Any other return
      * values must also try to remove the call from the list. An
@@ -551,7 +551,7 @@
     oneway deactivateDataCall(int32_t serial, int32_t cid,
             bool reasonRadioShutDown);
 
-    /*
+    /**
      * Query the status of a facility lock state
      *
      * @param serial Serial number of request.
@@ -567,7 +567,7 @@
     oneway getFacilityLockForApp(int32_t serial, string facility,
             string password, int32_t serviceClass, string appId);
 
-    /*
+    /**
      * Enable/disable one facility lock
      *
      * @param serial Serial number of request.
@@ -585,7 +585,7 @@
     oneway setFacilityLockForApp(int32_t serial, string facility, bool lockState,
             string password, int32_t serviceClass, string appId);
 
-    /*
+    /**
      * Change call barring facility password
      *
      * @param serial Serial number of request.
@@ -598,7 +598,7 @@
     oneway setBarringPassword(int32_t serial, string facility,
             string oldPassword, string newPassword);
 
-    /*
+    /**
      * Query current network selection mode
      *
      * @param serial Serial number of request.
@@ -607,7 +607,7 @@
      */
     oneway getNetworkSelectionMode(int32_t serial);
 
-    /*
+    /**
      * Specify that the network must be selected automatically.
      * This request must not respond until the new operator is selected and registered.
      *
@@ -617,7 +617,7 @@
      */
     oneway setNetworkSelectionModeAutomatic(int32_t serial);
 
-    /*
+    /**
      * Manually select a specified network.
      * This request must not respond until the new operator is selected and registered.
      *
@@ -628,7 +628,7 @@
      */
     oneway setNetworkSelectionModeManual(int32_t serial, string operatorNumeric);
 
-    /*
+    /**
      * Scans for available networks
      *
      * @param serial Serial number of request.
@@ -637,7 +637,7 @@
      */
     oneway getAvailableNetworks(int32_t serial);
 
-    /*
+    /**
      * Start playing a DTMF tone. Continue playing DTMF tone until
      * stopDtmf is received.
      * If a startDtmf() is received while a tone is currently playing,
@@ -650,7 +650,7 @@
      */
     oneway startDtmf(int32_t serial, string s);
 
-    /*
+    /**
      * Stop playing a currently playing DTMF tone.
      *
      * @param serial Serial number of request.
@@ -659,7 +659,7 @@
      */
     oneway stopDtmf(int32_t serial);
 
-    /*
+    /**
      * Return string value indicating baseband version, eg response from AT+CGMR
      *
      * @param serial Serial number of request.
@@ -668,7 +668,7 @@
      */
     oneway getBasebandVersion(int32_t serial);
 
-    /*
+    /**
      * Separate a party from a multiparty call placing the multiparty call
      * (less the specified party) on hold and leaving the specified party
      * as the only other member of the current (active) call
@@ -686,7 +686,7 @@
      */
     oneway separateConnection(int32_t serial, int32_t gsmIndex);
 
-    /*
+    /**
      * Turn on or off uplink (microphone) mute.
      * Must only be sent while voice call is active.
      * Must always be reset to "disable mute" when a new voice call is initiated
@@ -698,7 +698,7 @@
      */
     oneway setMute(int32_t serial, bool enable);
 
-    /*
+    /**
      * Queries the current state of the uplink mute setting
      *
      * @param serial Serial number of request.
@@ -707,7 +707,7 @@
      */
     oneway getMute(int32_t serial);
 
-    /*
+    /**
      * Queries the status of the CLIP supplementary service
      * (for MMI code "*#30#")
      *
@@ -717,7 +717,7 @@
      */
     oneway getClip(int32_t serial);
 
-    /*
+    /**
      * Returns the data call list. An entry is added when a
      * setupDataCall() is issued and removed on a
      * deactivateDataCall(). The list is emptied when
@@ -729,7 +729,7 @@
      */
     oneway getDataCallList(int32_t serial);
 
-    /*
+    /**
      * Enables/disables supplementary service related notifications from the network.
      * Notifications are reported via unsolSuppSvcNotification().
      *
@@ -740,7 +740,7 @@
      */
     oneway setSuppServiceNotifications(int32_t serial, bool enable);
 
-    /*
+    /**
      * Stores a SMS message to SIM memory.
      *
      * @param serial Serial number of request.
@@ -750,7 +750,7 @@
      */
     oneway writeSmsToSim(int32_t serial, SmsWriteArgs smsWriteArgs);
 
-    /*
+    /**
      * Deletes a SMS message from SIM memory.
      *
      * @param serial Serial number of request.
@@ -760,7 +760,7 @@
      */
     oneway deleteSmsOnSim(int32_t serial, int32_t index);
 
-    /*
+    /**
      * Assign a specified band for RF configuration.
      *
      * @param serial Serial number of request.
@@ -770,7 +770,7 @@
      */
     oneway setBandMode(int32_t serial, RadioBandMode mode);
 
-    /*
+    /**
      * Get the list of band modes supported by RF.
      *
      * @param serial Serial number of request.
@@ -779,7 +779,7 @@
      */
     oneway getAvailableBandModes(int32_t serial);
 
-    /*
+    /**
      * Requests to send a SAT/USAT envelope command to SIM.
      * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
      *
@@ -790,7 +790,7 @@
      */
     oneway sendEnvelope(int32_t serial, string command);
 
-    /*
+    /**
      * Requests to send a terminal response to SIM for a received proactive command
      *
      * @param serial Serial number of request.
@@ -801,7 +801,7 @@
      */
     oneway sendTerminalResponseToSim(int32_t serial, string commandResponse);
 
-    /*
+    /**
      * When STK application gets stkCallSetup(), the call actually has
      * been initialized by mobile device already. (We could see the call has been in the 'call
      * list') So, STK application needs to accept/reject the call according to user
@@ -815,7 +815,7 @@
     oneway handleStkCallSetupRequestFromSim(int32_t serial,
             bool accept);
 
-    /*
+    /**
      * Connects the two calls and disconnects the subscriber from both calls.
      *
      * @param serial Serial number of request.
@@ -824,7 +824,7 @@
      */
     oneway explicitCallTransfer(int32_t serial);
 
-    /*
+    /**
      * Requests to set the preferred network type for searching and registering
      * (CS/PS domain, RAT, and operation mode)
      *
@@ -836,7 +836,7 @@
     oneway setPreferredNetworkType(int32_t serial,
             PreferredNetworkType nwType);
 
-    /*
+    /**
      * Query the preferred network type (CS/PS domain, RAT, and operation mode)
      * for searching and registering
      *
@@ -846,7 +846,7 @@
      */
     oneway getPreferredNetworkType(int32_t serial);
 
-    /*
+    /**
      * Request neighboring cell id in GSM network
      *
      * @param serial Serial number of request.
@@ -855,7 +855,7 @@
      */
     oneway getNeighboringCids(int32_t serial);
 
-    /*
+    /**
      * Enables/disables network state change notifications due to changes in
      * LAC and/or CID (for GSM) or BID/SID/NID/latitude/longitude (for CDMA).
      * Basically +CREG=2 vs. +CREG=1 (TS 27.007).
@@ -869,7 +869,7 @@
      */
     oneway setLocationUpdates(int32_t serial, bool enable);
 
-    /*
+    /**
      * Request to set the location where the CDMA subscription shall
      * be retrieved
      *
@@ -881,7 +881,7 @@
     oneway setCdmaSubscriptionSource(int32_t serial,
             CdmaSubscriptionSource cdmaSub);
 
-    /*
+    /**
      * Request to set the roaming preferences in CDMA
      *
      * @param serial Serial number of request.
@@ -892,7 +892,7 @@
     oneway setCdmaRoamingPreference(int32_t serial,
             CdmaRoamingType type);
 
-    /*
+    /**
      * Request the actual setting of the roaming preferences in CDMA in the modem
      *
      * @param serial Serial number of request.
@@ -901,7 +901,7 @@
      */
     oneway getCdmaRoamingPreference(int32_t serial);
 
-    /*
+    /**
      * Request to set the TTY mode
      *
      * @param serial Serial number of request.
@@ -911,7 +911,7 @@
      */
     oneway setTTYMode(int32_t serial, TtyMode mode);
 
-    /*
+    /**
      * Request the setting of TTY mode
      *
      * @param serial Serial number of request.
@@ -920,7 +920,7 @@
      */
     oneway getTTYMode(int32_t serial);
 
-    /*
+    /**
      * Request to set the preferred voice privacy mode used in voice scrambling.
      *
      * @param serial Serial number of request.
@@ -931,7 +931,7 @@
      */
     oneway setPreferredVoicePrivacy(int32_t serial, bool enable);
 
-    /*
+    /**
      * Request the setting of preferred voice privacy mode.
      *
      * @param serial Serial number of request.
@@ -940,7 +940,7 @@
      */
     oneway getPreferredVoicePrivacy(int32_t serial);
 
-    /*
+    /**
      * Send FLASH command
      *
      * @param serial Serial number of request.
@@ -950,7 +950,7 @@
      */
     oneway sendCDMAFeatureCode(int32_t serial, string featureCode);
 
-    /*
+    /**
      * Send DTMF string
      *
      * @param serial Serial number of request.
@@ -962,7 +962,7 @@
      */
     oneway sendBurstDtmf(int32_t serial, string dtmf, int32_t on, int32_t off);
 
-    /*
+    /**
      * Send a CDMA SMS message
      *
      * @param serial Serial number of request.
@@ -972,7 +972,7 @@
      */
     oneway sendCdmaSms(int32_t serial, CdmaSmsMessage sms);
 
-    /*
+    /**
      * Acknowledge the success or failure in the receipt of SMS
      * previously indicated via responseCdmaNewSms()
      *
@@ -983,7 +983,7 @@
      */
     oneway acknowledgeLastIncomingCdmaSms(int32_t serial, CdmaSmsAck smsAck);
 
-    /*
+    /**
      * Request the setting of GSM/WCDMA Cell Broadcast SMS config.
      *
      * @param serial Serial number of request.
@@ -992,7 +992,7 @@
      */
     oneway getGsmBroadcastConfig(int32_t serial);
 
-    /*
+    /**
      * Set GSM/WCDMA Cell Broadcast SMS config
      *
      * @param serial Serial number of request.
@@ -1002,7 +1002,7 @@
      */
     oneway setGsmBroadcastConfig(int32_t serial, vec<GsmBroadcastSmsConfigInfo> configInfo);
 
-    /*
+    /**
      * Enable or disable the reception of GSM/WCDMA Cell Broadcast SMS
      *
      * @param serial Serial number of request.
@@ -1013,7 +1013,7 @@
      */
     oneway setGsmBroadcastActivation(int32_t serial, bool activate);
 
-    /*
+    /**
      * Request the setting of CDMA Broadcast SMS config
      *
      * @param serial Serial number of request.
@@ -1022,7 +1022,7 @@
      */
     oneway getCdmaBroadcastConfig(int32_t serial);
 
-    /*
+    /**
      * Set CDMA Broadcast SMS config
      *
      * @param serial Serial number of request.
@@ -1032,7 +1032,7 @@
      */
     oneway setCdmaBroadcastConfig(int32_t serial, vec<CdmaBroadcastSmsConfigInfo> configInfo);
 
-    /*
+    /**
      * Enable or disable the reception of CDMA Cell Broadcast SMS
      *
      * @param serial Serial number of request.
@@ -1043,7 +1043,7 @@
      */
     oneway setCdmaBroadcastActivation(int32_t serial, bool activate);
 
-    /*
+    /**
      * Request the device MDN / H_SID / H_NID.
      * The request is only allowed when CDMA subscription is available. When CDMA
      * subscription is changed, application layer must re-issue the request to
@@ -1055,7 +1055,7 @@
      */
     oneway getCDMASubscription(int32_t serial);
 
-    /*
+    /**
      * Stores a CDMA SMS message to RUIM memory.
      *
      * @param serial Serial number of request.
@@ -1065,7 +1065,7 @@
      */
     oneway writeSmsToRuim(int32_t serial, CdmaSmsWriteArgs cdmaSms);
 
-    /*
+    /**
      * Deletes a CDMA SMS message from RUIM memory.
      *
      * @param serial Serial number of request.
@@ -1075,7 +1075,7 @@
      */
     oneway deleteSmsOnRuim(int32_t serial, int32_t index);
 
-    /*
+    /**
      * Request the device ESN / MEID / IMEI / IMEISV.
      * The request is always allowed and contains GSM and CDMA device identity.
      * When CDMA subscription is changed the ESN/MEID changes. The application
@@ -1087,7 +1087,7 @@
      */
     oneway getDeviceIdentity(int32_t serial);
 
-    /*
+    /**
      * Request the radio's system selection module to exit emergency
      * callback mode. Radio must not respond with SUCCESS until the modem has
      * completely exited from Emergency Callback Mode.
@@ -1098,7 +1098,7 @@
      */
     oneway exitEmergencyCallbackMode(int32_t serial);
 
-    /*
+    /**
      * Get the default Short Message Service Center address on the device.
      *
      * @param serial Serial number of request.
@@ -1107,7 +1107,7 @@
      */
     oneway getSmscAddress(int32_t serial);
 
-    /*
+    /**
      * Set the default Short Message Service Center address on the device.
      *
      * @param serial Serial number of request.
@@ -1117,7 +1117,7 @@
      */
     oneway setSmscAddress(int32_t serial, string smsc);
 
-    /*
+    /**
      * Indicates whether there is storage available for new SMS messages.
      *
      * @param serial Serial number of request.
@@ -1128,7 +1128,7 @@
      */
     oneway reportSmsMemoryStatus(int32_t serial, bool available);
 
-    /*
+    /**
      * Indicates that the StkService is running and is
      * ready to receive unsolicited stkXXXXX commands.
      *
@@ -1138,7 +1138,7 @@
      */
     oneway reportStkServiceIsRunning(int32_t serial);
 
-    /*
+    /**
      * Request to query the location where the CDMA subscription shall be retrieved.
      *
      * @param serial Serial number of request.
@@ -1147,7 +1147,7 @@
      */
     oneway getCdmaSubscriptionSource(int32_t serial);
 
-    /*
+    /**
      * Request the ISIM application on the UICC to perform AKA
      * challenge/response algorithm for IMS authentication
      *
@@ -1158,7 +1158,7 @@
      */
     oneway requestIsimAuthentication(int32_t serial, string challenge);
 
-    /*
+    /**
      * Acknowledge successful or failed receipt of SMS previously indicated
      * via unsol responseNewSms(), including acknowledgement TPDU to send
      * as the RP-User-Data element of the RP-ACK or RP-ERROR PDU.
@@ -1172,7 +1172,7 @@
      */
     oneway acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, string ackPdu);
 
-    /*
+    /**
      * Requests to send a SAT/USAT envelope command to SIM.
      * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111.
      *
@@ -1191,7 +1191,7 @@
      */
     oneway sendEnvelopeWithStatus(int32_t serial, string contents);
 
-    /*
+    /**
      * Query the radio technology type (3GPP/3GPP2) used for voice. Query is valid only
      * when radio state is not RADIO_STATE_UNAVAILABLE
      *
@@ -1201,7 +1201,7 @@
      */
     oneway getVoiceRadioTechnology(int32_t serial);
 
-    /*
+    /**
      * Request all of the current cell information known to the radio. The radio
      * must return list of all current cells, including the neighboring cells. If for a particular
      * cell information isn't known then the appropriate unknown value will be returned.
@@ -1213,7 +1213,7 @@
      */
     oneway getCellInfoList(int32_t serial);
 
-    /*
+    /**
      * Sets the minimum time between when unsolicited cellInfoList() must be invoked.
      * A value of 0, means invoke cellInfoList() when any of the reported
      * information changes. Setting the value to INT_MAX(0x7fffffff) means never issue
@@ -1226,7 +1226,7 @@
      */
     oneway setCellInfoListRate(int32_t serial, int32_t rate);
 
-    /*
+    /**
      * Set an apn to initial attach network
      *
      * @param serial Serial number of request.
@@ -1243,7 +1243,7 @@
     oneway setInitialAttachApn(int32_t serial, DataProfileInfo dataProfileInfo,
             bool modemCognitive, bool isRoaming);
 
-    /*
+    /**
      * Request current IMS registration state
      *
      * @param serial Serial number of request.
@@ -1252,7 +1252,7 @@
      */
     oneway getImsRegistrationState(int32_t serial);
 
-    /*
+    /**
      * Send a SMS message over IMS.
      * Based on the return error, caller decides to resend if sending sms
      * fails. SMS_SEND_FAIL_RETRY means retry, and other errors means no retry.
@@ -1265,7 +1265,7 @@
      */
     oneway sendImsSms(int32_t serial, ImsSmsMessage message);
 
-    /*
+    /**
      * Request APDU exchange on the basic channel. This command reflects TS 27.007
      * "generic SIM access" operation (+CSIM). The modem must ensure proper function
      * of GSM/CDMA, and filter commands appropriately. It must filter
@@ -1279,7 +1279,7 @@
      */
     oneway iccTransmitApduBasicChannel(int32_t serial, SimApdu message);
 
-    /*
+    /**
      * Open a new logical channel and select the given application. This command
      * reflects TS 27.007 "open logical channel" operation (+CCHO).
      *
@@ -1290,7 +1290,7 @@
      */
     oneway iccOpenLogicalChannel(int32_t serial, string aid);
 
-    /*
+    /**
      * Close a previously opened logical channel. This command reflects TS 27.007
      * "close logical channel" operation (+CCHC).
      *
@@ -1301,7 +1301,7 @@
      */
     oneway iccCloseLogicalChannel(int32_t serial, int32_t channelId);
 
-    /*
+    /**
      * Exchange APDUs with a UICC over a previously opened logical channel. This
      * command reflects TS 27.007 "generic logical channel access" operation
      * (+CGLA). The modem must filter channel management and SELECT by DF name
@@ -1314,7 +1314,7 @@
      */
     oneway iccTransmitApduLogicalChannel(int32_t serial, SimApdu message);
 
-    /*
+    /**
      * Read one of the radio NV items.
      * This is used for device configuration by some CDMA operators.
      *
@@ -1325,7 +1325,7 @@
      */
     oneway nvReadItem(int32_t serial, NvItem itemId);
 
-    /*
+    /**
      * Write one of the radio NV items.
      * This is used for device configuration by some CDMA operators.
      *
@@ -1336,7 +1336,7 @@
      */
     oneway nvWriteItem(int32_t serial, NvWriteItem item);
 
-    /*
+    /**
      * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
      * This is used for device configuration by some CDMA operators.
      *
@@ -1347,7 +1347,7 @@
      */
     oneway nvWriteCdmaPrl(int32_t serial, vec<uint8_t> prl);
 
-    /*
+    /**
      * Reset the radio NV configuration to the factory state.
      * This is used for device configuration by some CDMA operators.
      *
@@ -1358,7 +1358,7 @@
      */
     oneway nvResetConfig(int32_t serial, ResetNvType resetType);
 
-    /*
+    /**
      * Selection/de-selection of a subscription from a SIM card
      *
      * @param serial Serial number of request.
@@ -1368,7 +1368,7 @@
      */
     oneway setUiccSubscription(int32_t serial, SelectUiccSub uiccSub);
 
-    /*
+    /**
      * Tells the modem whether data calls are allowed or not
      *
      * @param serial Serial number of request.
@@ -1378,7 +1378,7 @@
      */
     oneway setDataAllowed(int32_t serial, bool allow);
 
-    /*
+    /**
      * Request all of the current hardware (modem and sim) associated with Radio.
      *
      * @param serial Serial number of request.
@@ -1387,7 +1387,7 @@
      */
     oneway getHardwareConfig(int32_t serial);
 
-    /*
+    /**
      * Returns the response of SIM Authentication through Radio challenge request.
      *
      * @param serial Serial number of request.
@@ -1401,7 +1401,7 @@
     oneway requestIccSimAuthentication(int32_t serial, int32_t authContext, string authData,
             string aid);
 
-    /*
+    /**
      * Set data profile in modem.
      * Modem must erase existed profiles from framework, and apply new profiles
      *
@@ -1416,7 +1416,7 @@
      */
     oneway setDataProfile(int32_t serial, vec<DataProfileInfo> profiles, bool isRoaming);
 
-    /*
+    /**
      * Device is shutting down. All further commands are ignored
      * and RADIO_NOT_AVAILABLE must be returned.
      *
@@ -1426,7 +1426,7 @@
      */
     oneway requestShutdown(int32_t serial);
 
-    /*
+    /**
      * Used to get phone radio capability.
      *
      * @param serial Serial number of request.
@@ -1435,7 +1435,7 @@
      */
     oneway getRadioCapability(int32_t serial);
 
-    /*
+    /**
      * Used to set the phones radio capability. Be VERY careful
      * using this request as it may cause some vendor modems to reset. Because
      * of the possible modem reset any radio commands after this one may not be
@@ -1448,7 +1448,7 @@
      */
     oneway setRadioCapability(int32_t serial, RadioCapability rc);
 
-    /*
+    /**
      * Start Link Capacity Estimate (LCE) service if supported by the radio.
      *
      * @param serial Serial number of request.
@@ -1459,7 +1459,7 @@
      */
     oneway startLceService(int32_t serial, int32_t reportInterval, bool pullMode);
 
-    /*
+    /**
      * Stop Link Capacity Estimate (LCE) service, the STOP operation must be
      * idempotent for the radio modem.
      *
@@ -1469,7 +1469,7 @@
      */
     oneway stopLceService(int32_t serial);
 
-    /*
+    /**
      * Pull LCE service for capacity information.
      *
      * @param serial Serial number of request.
@@ -1478,7 +1478,7 @@
      */
     oneway pullLceData(int32_t serial);
 
-    /*
+    /**
      * Get modem activity information for power consumption estimation.
      * Request clear-on-read statistics information that is used for
      * estimating the per-millisecond power consumption of the cellular
@@ -1490,7 +1490,7 @@
      */
     oneway getModemActivityInfo(int32_t serial);
 
-    /*
+    /**
      * Set carrier restrictions. Expected modem behavior:
      *  If never receives this command
      *  - Must allow all carriers
@@ -1514,7 +1514,7 @@
      */
     oneway setAllowedCarriers(int32_t serial, bool allAllowed, CarrierRestrictions carriers);
 
-    /*
+    /**
      * Get carrier restrictions.
      *
      * @param serial Serial number of request.
@@ -1523,7 +1523,7 @@
      */
     oneway getAllowedCarriers(int32_t serial);
 
-    /*
+    /**
      * Send the updated device state.
      * This is providing the device state information for the modem to perform power saving
      * strategies.
@@ -1536,7 +1536,7 @@
      */
     oneway sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state);
 
-    /*
+    /**
      * Set the indication filter.
      * This is used to prevent unnecessary application processor wake up for power saving purposes
      * by suppressing the indications in certain scenarios.
@@ -1549,7 +1549,7 @@
      */
     oneway setIndicationFilter(int32_t serial, bitfield<IndicationFilter> indicationFilter);
 
-    /*
+    /**
      * Set SIM card power state.
      * Request is equivalent to inserting or removing the card.
      *
@@ -1563,7 +1563,7 @@
      */
     oneway setSimCardPower(int32_t serial, bool powerUp);
 
-    /*
+    /**
      * When response type received from a radio indication or radio response is
      * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
      * acknowledge the receipt of those messages by sending responseAcknowledgement().
diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal
index 0b95821..eb07226 100644
--- a/radio/1.0/IRadioIndication.hal
+++ b/radio/1.0/IRadioIndication.hal
@@ -16,11 +16,11 @@
 
 package android.hardware.radio@1.0;
 
-/*
+/**
  * Interface declaring unsolicited radio indications.
  */
 interface IRadioIndication {
-    /*
+    /**
      * Indicates when radio state changes.
      *
      * @param type Type of radio indication
@@ -28,7 +28,7 @@
      */
     oneway radioStateChanged(RadioIndicationType type, RadioState radioState);
 
-    /*
+    /**
      * Indicates when call state has changed.
      * Callee must invoke IRadio.getCurrentCalls()
      * Must be invoked on, for example,
@@ -41,7 +41,7 @@
      */
     oneway callStateChanged(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates when voice or data network state changed
      * Callee must invoke IRadio.getVoiceRegistrationState(), IRadio.getDataRegistrationState(),
      * and IRadio.getOperator()
@@ -50,7 +50,7 @@
      */
     oneway networkStateChanged(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates when new SMS is received.
      * Callee must subsequently confirm the receipt of the SMS with a
      * acknowledgeLastIncomingGsmSms()
@@ -64,7 +64,7 @@
      */
     oneway newSms(RadioIndicationType type, vec<uint8_t> pdu);
 
-    /*
+    /**
      * Indicates when new SMS Status Report is received.
      * Callee must subsequently confirm the receipt of the SMS with a
      * acknowledgeLastIncomingGsmSms()
@@ -78,7 +78,7 @@
      */
     oneway newSmsStatusReport(RadioIndicationType type, vec<uint8_t> pdu);
 
-    /*
+    /**
      * Indicates when new SMS has been stored on SIM card
      *
      * @param type Type of radio indication
@@ -86,7 +86,7 @@
      */
     oneway newSmsOnSim(RadioIndicationType type, int32_t recordNumber);
 
-    /*
+    /**
      * Indicates when a new USSD message is received.
      * The USSD session is assumed to persist if the type code is REQUEST, otherwise
      * the current session (if any) is assumed to have terminated.
@@ -97,7 +97,7 @@
      */
     oneway onUssd(RadioIndicationType type, UssdModeType modeType, string msg);
 
-    /*
+    /**
      * Indicates when radio has received a NITZ time message.
      *
      * @param type Type of radio indication
@@ -106,7 +106,7 @@
      */
     oneway nitzTimeReceived(RadioIndicationType type, string nitzTime, uint64_t receivedTime);
 
-    /*
+    /**
      * Indicates current signal strength of the radio.
      *
      * @param type Type of radio indication
@@ -114,7 +114,7 @@
      */
     oneway currentSignalStrength(RadioIndicationType type, SignalStrength signalStrength);
 
-    /*
+    /**
      * Indicates data call contexts have changed.
      *
      * @param type Type of radio indication
@@ -127,7 +127,7 @@
      */
     oneway dataCallListChanged(RadioIndicationType type, vec<SetupDataCallResult> dcList);
 
-    /*
+    /**
      * Reports supplementary service related notification from the network.
      *
      * @param type Type of radio indication
@@ -135,14 +135,14 @@
      */
     oneway suppSvcNotify(RadioIndicationType type, SuppSvcNotification suppSvc);
 
-    /*
+    /**
      * Indicates when STK session is terminated by SIM.
      *
      * @param type Type of radio indication
      */
     oneway stkSessionEnd(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates when SIM issue a STK proactive command to applications
      *
      * @param type Type of radio indication
@@ -151,7 +151,7 @@
      */
     oneway stkProactiveCommand(RadioIndicationType type, string cmd);
 
-    /*
+    /**
      * Indicates when SIM notifies applcations some event happens.
      *
      * @param type Type of radio indication
@@ -162,7 +162,7 @@
      */
     oneway stkEventNotify(RadioIndicationType type, string cmd);
 
-    /*
+    /**
      * Indicates when SIM wants application to setup a voice call.
      *
      * @param type Type of radio indication
@@ -170,7 +170,7 @@
      */
     oneway stkCallSetup(RadioIndicationType type, int64_t timeout);
 
-    /*
+    /**
      * Indicates that SMS storage on the SIM is full. Sent when the network
      * attempts to deliver a new SMS message. Messages cannot be saved on the
      * SIM until space is freed. In particular, incoming Class 2 messages must not
@@ -180,7 +180,7 @@
      */
     oneway simSmsStorageFull(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates that file(s) on the SIM have been updated, or the SIM
      * has been reinitialized.
      * Note: If the SIM state changes as a result of the SIM refresh (eg,
@@ -192,7 +192,7 @@
      */
     oneway simRefresh(RadioIndicationType type, SimRefreshResult refreshResult);
 
-    /*
+    /**
      * Ring indication for an incoming call (eg, RING or CRING event).
      * There must be at least one callRing() at the beginning
      * of a call and sending multiple is optional. If the system property
@@ -210,7 +210,7 @@
      */
     oneway callRing(RadioIndicationType type, bool isGsm, CdmaSignalInfoRecord record);
 
-    /*
+    /**
      * Indicates that SIM state changes.
      * Callee must invoke getIccCardStatus()
      *
@@ -218,7 +218,7 @@
      */
     oneway simStatusChanged(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates when new CDMA SMS is received
      * Callee must subsequently confirm the receipt of the SMS with
      * acknowledgeLastIncomingCdmaSms()
@@ -230,7 +230,7 @@
      */
     oneway cdmaNewSms(RadioIndicationType type, CdmaSmsMessage msg);
 
-    /*
+    /**
      * Indicates when new Broadcast SMS is received
      *
      * @param type Type of radio indication
@@ -243,7 +243,7 @@
      */
     oneway newBroadcastSms(RadioIndicationType type, vec<uint8_t> data);
 
-    /*
+    /**
      * Indicates that SMS storage on the RUIM is full. Messages
      * cannot be saved on the RUIM until space is freed.
      *
@@ -251,7 +251,7 @@
      */
     oneway cdmaRuimSmsStorageFull(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates a restricted state change (eg, for Domain Specific Access Control).
      * Radio must send this msg after radio off/on cycle no matter it is changed or not.
      *
@@ -260,7 +260,7 @@
      */
     oneway restrictedStateChanged(RadioIndicationType type, PhoneRestrictedState state);
 
-    /*
+    /**
      * Indicates that the radio system selection module has
      * autonomously entered emergency callback mode.
      *
@@ -268,7 +268,7 @@
      */
     oneway enterEmergencyCallbackMode(RadioIndicationType type);
 
-    /*
+    /**
      * Indicates when CDMA radio receives a call waiting indication.
      *
      * @param type Type of radio indication
@@ -276,7 +276,7 @@
      */
     oneway cdmaCallWaiting(RadioIndicationType type, CdmaCallWaiting callWaitingRecord);
 
-    /*
+    /**
      * Indicates when CDMA radio receives an update of the progress of an OTASP/OTAPA call.
      *
      * @param type Type of radio indication
@@ -284,7 +284,7 @@
      */
     oneway cdmaOtaProvisionStatus(RadioIndicationType type, CdmaOtaProvisionStatus status);
 
-   /*
+   /**
     * Indicates when CDMA radio receives one or more info recs.
     *
     * @param type Type of radio indication
@@ -292,7 +292,7 @@
     */
    oneway cdmaInfoRec(RadioIndicationType type, CdmaInformationRecords records);
 
-   /*
+   /**
     * Indicates that nework doesn't have in-band information, need to
     * play out-band tone.
     *
@@ -301,14 +301,14 @@
     */
    oneway indicateRingbackTone(RadioIndicationType type, bool start);
 
-   /*
+   /**
     * Indicates that framework/application must reset the uplink mute state.
     *
     * @param type Type of radio indication
     */
    oneway resendIncallMute(RadioIndicationType type);
 
-   /*
+   /**
     * Indicates when CDMA subscription source changed.
     *
     * @param type Type of radio indication
@@ -317,7 +317,7 @@
    oneway cdmaSubscriptionSourceChanged(RadioIndicationType type,
            CdmaSubscriptionSource cdmaSource);
 
-   /*
+   /**
     * Indicates when PRL (preferred roaming list) changes.
     *
     * @param type Type of radio indication
@@ -325,7 +325,7 @@
     */
    oneway cdmaPrlChanged(RadioIndicationType type, int32_t version);
 
-   /*
+   /**
     * Indicates when Emergency Callback Mode Ends.
     * Indicates that the radio system selection module has
     * proactively exited emergency callback mode.
@@ -334,14 +334,14 @@
     */
    oneway exitEmergencyCallbackMode(RadioIndicationType type);
 
-   /*
+   /**
     * Indicates the ril connects and returns the version
     *
     * @param type Type of radio indication
     */
    oneway rilConnected(RadioIndicationType type);
 
-   /*
+   /**
     * Indicates that voice technology has changed. Responds with new rat.
     *
     * @param type Type of radio indication
@@ -349,7 +349,7 @@
     */
    oneway voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat);
 
-   /*
+   /**
     * Same information as returned by getCellInfoList().
     *
     * @param type Type of radio indication
@@ -357,7 +357,7 @@
     */
    oneway cellInfoList(RadioIndicationType type, vec<CellInfo> records);
 
-   /*
+   /**
     * Indicates when IMS registration state has changed.
     * To get IMS registration state and IMS SMS format, callee needs to invoke
     * getImsRegistrationState()
@@ -366,7 +366,7 @@
     */
    oneway imsNetworkStateChanged(RadioIndicationType type);
 
-   /*
+   /**
     * Indicated when there is a change in subscription status.
     * This event must be sent in the following scenarios
     *  - subscription readiness at modem, which was selected by telephony layer
@@ -378,7 +378,7 @@
     */
    oneway subscriptionStatusChanged(RadioIndicationType type, bool activate);
 
-   /*
+   /**
     * Indicates when Single Radio Voice Call Continuity (SRVCC)
     * progress state has changed
     *
@@ -387,7 +387,7 @@
     */
    oneway srvccStateNotify(RadioIndicationType type, SrvccState state);
 
-   /*
+   /**
     * Indicates when the hardware configuration associated with the RILd changes.
     *
     * @param type Type of radio indication
@@ -395,7 +395,7 @@
     */
    oneway hardwareConfigChanged(RadioIndicationType type, vec<HardwareConfig> configs);
 
-   /*
+   /**
     * Sent when setRadioCapability() completes.
     * Returns the phone radio capability exactly as
     * getRadioCapability() and must be the
@@ -406,7 +406,7 @@
     */
    oneway radioCapabilityIndication(RadioIndicationType type, RadioCapability rc);
 
-   /*
+   /**
     * Indicates when Supplementary service(SS) response is received when DIAL/USSD/SS is changed to
     * SS by call control.
     *
@@ -414,7 +414,7 @@
     */
    oneway onSupplementaryServiceIndication(RadioIndicationType type, StkCcUnsolSsResult ss);
 
-   /*
+   /**
     * Indicates when there is an ALPHA from UICC during Call Control.
     *
     * @param type Type of radio indication
@@ -422,7 +422,7 @@
     */
    oneway stkCallControlAlphaNotify(RadioIndicationType type, string alpha);
 
-   /*
+   /**
     * Indicates when there is an incoming Link Capacity Estimate (LCE) info report.
     *
     * @param type Type of radio indication
@@ -430,7 +430,7 @@
     */
    oneway lceData(RadioIndicationType type, LceDataInfo lce);
 
-   /*
+   /**
     * Indicates when there is new Carrier PCO data received for a data call. Ideally
     * only new data must be forwarded, though this is not required. Multiple
     * boxes of carrier PCO data for a given call must result in a series of
@@ -441,7 +441,7 @@
     */
    oneway pcoData(RadioIndicationType type, PcoDataInfo pco);
 
-   /*
+   /**
     * Indicates when there is a modem reset.
     *
     * When modem restarts, one of the following radio state transitions must happen
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 42e53a7..2ba210b 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -16,13 +16,13 @@
 
 package android.hardware.radio@1.0;
 
-/*
+/**
  * Interface declaring response functions to solicited radio requests.
  * Response functions defined in this interface are as per following convention:
  * <xyz>Response is response to IRadio.<xyz>
  */
 interface IRadioResponse {
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param cardStatus ICC card status as defined by CardStatus in types.hal
      *
@@ -31,7 +31,7 @@
      */
     oneway getIccCardStatusResponse(RadioResponseInfo info, CardStatus cardStatus);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -42,7 +42,7 @@
      */
     oneway supplyIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -53,7 +53,7 @@
      */
     oneway supplyIccPukForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -64,7 +64,7 @@
      */
     oneway supplyIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      * Valid errors returned:
@@ -74,7 +74,7 @@
      */
     oneway supplyIccPuk2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -85,7 +85,7 @@
      */
     oneway changeIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -96,7 +96,7 @@
      */
     oneway changeIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param remainingRetries Number of retries remaining, must be equal to -1 if unknown.
      *
@@ -107,7 +107,7 @@
      */
     oneway supplyNetworkDepersonalizationResponse(RadioResponseInfo info, int32_t remainingRetries);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param calls Current call list
      *
@@ -119,7 +119,7 @@
      */
     oneway getCurrentCallsResponse(RadioResponseInfo info, vec<Call> calls);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -144,7 +144,7 @@
      */
     oneway dialResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param imsi String containing the IMSI
      *
@@ -154,7 +154,7 @@
      */
     oneway getIMSIForAppResponse(RadioResponseInfo info, string imsi);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -169,7 +169,7 @@
      */
     oneway hangupConnectionResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -186,7 +186,7 @@
      */
     oneway hangupWaitingOrBackgroundResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -203,7 +203,7 @@
      */
     oneway hangupForegroundResumeBackgroundResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -220,7 +220,7 @@
      */
     oneway switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -236,7 +236,7 @@
      */
     oneway conferenceResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -253,7 +253,7 @@
      */
     oneway rejectCallResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param failCauseInfo Contains LastCallFailCause and vendor cause code.
      *
@@ -297,7 +297,7 @@
     oneway getLastCallFailCauseResponse(RadioResponseInfo info,
             LastCallFailCauseInfo failCauseinfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param sigStrength Current signal strength
      *
@@ -307,7 +307,7 @@
      */
     oneway getSignalStrengthResponse(RadioResponseInfo info, SignalStrength sigStrength);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult
      *        in types.hal
@@ -319,7 +319,7 @@
     oneway getVoiceRegistrationStateResponse(RadioResponseInfo info,
             VoiceRegStateResult voiceRegResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in
      *        types.hal
@@ -331,7 +331,7 @@
     oneway getDataRegistrationStateResponse(RadioResponseInfo info,
             DataRegStateResult dataRegResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param longName is long alpha ONS or EONS or empty string if unregistered
      * @param shortName is short alpha ONS or EONS or empty string if unregistered
@@ -344,7 +344,7 @@
     oneway getOperatorResponse(RadioResponseInfo info, string longName, string shortName,
             string numeric);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -354,7 +354,7 @@
      */
     oneway setRadioPowerResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -368,7 +368,7 @@
      */
     oneway sendDtmfResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param sms Response to sms sent as defined by SendSmsResult in types.hal
      *
@@ -391,7 +391,7 @@
      */
     oneway sendSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param sms Response to sms sent as defined by SendSmsResult in types.hal
      *
@@ -415,7 +415,7 @@
      */
     oneway sendSMSExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param dcResponse SetupDataCallResult defined in types.hal
      *
@@ -430,7 +430,7 @@
      */
     oneway setupDataCallResponse(RadioResponseInfo info, SetupDataCallResult dcResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param iccIo ICC io operation response as defined by IccIoResult in types.hal
      *
@@ -442,7 +442,7 @@
      */
     oneway iccIOForAppResponse(RadioResponseInfo info, IccIoResult iccIo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -464,7 +464,7 @@
      */
     oneway sendUssdResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -479,7 +479,7 @@
      */
     oneway cancelPendingUssdResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param n is "n" parameter from TS 27.007 7.7
      * @param m is "m" parameter from TS 27.007 7.7
@@ -498,7 +498,7 @@
      */
     oneway getClirResponse(RadioResponseInfo info, int32_t n, int32_t m);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -513,7 +513,7 @@
      */
     oneway setClirResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param callForwardInfos points to a vector of CallForwardInfo, one for
      *        each distinct registered phone number.
@@ -541,7 +541,7 @@
     oneway getCallForwardStatusResponse(RadioResponseInfo info,
             vec<CallForwardInfo> callForwardInfos);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -560,7 +560,7 @@
      */
     oneway setCallForwardResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param enable If current call waiting state is disabled, enable = false else true
      * @param serviceClass If enable, then callWaitingResp[1]
@@ -584,7 +584,7 @@
      */
     oneway getCallWaitingResponse(RadioResponseInfo info, bool enable, int32_t serviceClass);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -602,7 +602,7 @@
      */
     oneway setCallWaitingResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -611,7 +611,7 @@
      */
     oneway acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -626,7 +626,7 @@
      */
     oneway acceptCallResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -635,7 +635,7 @@
      */
     oneway deactivateDataCallResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param response 0 is the TS 27.007 service class bit vector of
      *        services for which the specified barring facility
@@ -656,7 +656,7 @@
      */
     oneway getFacilityLockForAppResponse(RadioResponseInfo info, int32_t response);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param retry 0 is the number of retries remaining, or -1 if unknown
      *
@@ -675,7 +675,7 @@
      */
     oneway setFacilityLockForAppResponse(RadioResponseInfo info, int32_t retry);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -693,7 +693,7 @@
      */
     oneway setBarringPasswordResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param selection false for automatic selection, true for manual selection
      *
@@ -703,7 +703,7 @@
      */
     oneway getNetworkSelectionModeResponse(RadioResponseInfo info, bool manual);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -718,7 +718,7 @@
      */
     oneway setNetworkSelectionModeAutomaticResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -733,7 +733,7 @@
      */
     oneway setNetworkSelectionModeManualResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param networkInfos List of network operator information as OperatorInfos defined in
      *         types.hal
@@ -751,7 +751,7 @@
     oneway getAvailableNetworksResponse(RadioResponseInfo info,
             vec<OperatorInfo> networkInfos);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -767,7 +767,7 @@
      */
     oneway startDtmfResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -784,7 +784,7 @@
      */
     oneway stopDtmfResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param version string containing version string for log reporting
      *
@@ -795,7 +795,7 @@
      */
     oneway getBasebandVersionResponse(RadioResponseInfo info, string version);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -813,7 +813,7 @@
      */
     oneway separateConnectionResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -825,7 +825,7 @@
      */
     oneway setMuteResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param enable true for "mute enabled" and false for "mute disabled"
      *
@@ -840,7 +840,7 @@
      */
     oneway getMuteResponse(RadioResponseInfo info, bool enable);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param status indicates CLIP status
      *
@@ -856,7 +856,7 @@
      */
     oneway getClipResponse(RadioResponseInfo info, ClipStatus status);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param dcResponse List of DataCallResult as defined in types.hal
      *
@@ -866,7 +866,7 @@
      */
     oneway getDataCallListResponse(RadioResponseInfo info, vec<SetupDataCallResult> dcResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -881,7 +881,7 @@
      */
     oneway setSuppServiceNotificationsResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param index record index where the message is stored
      *
@@ -901,7 +901,7 @@
      */
     oneway writeSmsToSimResponse(RadioResponseInfo info, int32_t index);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -916,7 +916,7 @@
      */
     oneway deleteSmsOnSimResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -926,7 +926,7 @@
      */
     oneway setBandModeResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param bandModes List of RadioBandMode listing supported modes
      *
@@ -937,7 +937,7 @@
      */
     oneway getAvailableBandModesResponse(RadioResponseInfo info, vec<RadioBandMode> bandModes);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param commandResponse SAT/USAT response in hexadecimal format
      *        string starting with first byte of response
@@ -950,7 +950,7 @@
      */
     oneway sendEnvelopeResponse(RadioResponseInfo info, string commandResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -961,7 +961,7 @@
      */
     oneway sendTerminalResponseToSimResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -972,7 +972,7 @@
      */
     oneway handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -990,7 +990,7 @@
      */
     oneway explicitCallTransferResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1001,7 +1001,7 @@
      */
     oneway setPreferredNetworkTypeResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param nwType RadioPreferredNetworkType defined in types.hal
      *
@@ -1012,7 +1012,7 @@
     oneway getPreferredNetworkTypeResponse(RadioResponseInfo info,
             PreferredNetworkType nwType);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param cells Vector of neighboring radio cell
      *
@@ -1023,7 +1023,7 @@
      */
     oneway getNeighboringCidsResponse(RadioResponseInfo info, vec<NeighboringCell> cells);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1032,7 +1032,7 @@
      */
     oneway setLocationUpdatesResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1043,7 +1043,7 @@
      */
     oneway setCdmaSubscriptionSourceResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1052,7 +1052,7 @@
      */
     oneway setCdmaRoamingPreferenceResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param type CdmaRoamingType defined in types.hal
      *
@@ -1063,7 +1063,7 @@
      */
     oneway getCdmaRoamingPreferenceResponse(RadioResponseInfo info, CdmaRoamingType type);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1076,7 +1076,7 @@
      */
     oneway setTTYModeResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param mode TtyMode
      *
@@ -1090,7 +1090,7 @@
      */
     oneway getTTYModeResponse(RadioResponseInfo info, TtyMode mode);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1103,7 +1103,7 @@
      */
     oneway setPreferredVoicePrivacyResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param enable false for Standard Privacy Mode (Public Long Code Mask)
      *        true for Enhanced Privacy Mode (Private Long Code Mask)
@@ -1118,7 +1118,7 @@
      */
     oneway getPreferredVoicePrivacyResponse(RadioResponseInfo info, bool enable);
 
-    /*
+    /**
      * Response callback for IRadio.sendCDMAFeatureCode()
      *
      * @param info Response info struct containing response type, serial no. and error
@@ -1136,7 +1136,7 @@
      */
     oneway sendCDMAFeatureCodeResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1152,7 +1152,7 @@
      */
     oneway sendBurstDtmfResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param sms Sms result struct as defined by SendSmsResult in types.hal
      *
@@ -1176,7 +1176,7 @@
      */
     oneway sendCdmaSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1195,7 +1195,7 @@
      */
     oneway acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param configs Vector of GSM/WCDMA Cell broadcast configs
      *
@@ -1213,7 +1213,7 @@
     oneway getGsmBroadcastConfigResponse(RadioResponseInfo info,
             vec<GsmBroadcastSmsConfigInfo> configs);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1228,7 +1228,7 @@
      */
     oneway setGsmBroadcastConfigResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1243,7 +1243,7 @@
      */
     oneway setGsmBroadcastActivationResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param configs Vector of CDMA Broadcast SMS configs.
      *
@@ -1261,7 +1261,7 @@
     oneway getCdmaBroadcastConfigResponse(RadioResponseInfo info,
             vec<CdmaBroadcastSmsConfigInfo> configs);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1276,7 +1276,7 @@
      */
     oneway setCdmaBroadcastConfigResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1291,7 +1291,7 @@
      */
     oneway setCdmaBroadcastActivationResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param mdn MDN if CDMA subscription is available
      * @param hSid is a comma separated list of H_SID (Home SID) if
@@ -1309,7 +1309,7 @@
     oneway getCDMASubscriptionResponse(RadioResponseInfo info, string mdn, string hSid,
             string hNid, string min, string prl);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param index record index where the cmda sms message is stored
      *
@@ -1330,7 +1330,7 @@
      */
     oneway writeSmsToRuimResponse(RadioResponseInfo info, uint32_t index);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1345,7 +1345,7 @@
      */
     oneway deleteSmsOnRuimResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param imei IMEI if GSM subscription is available
      * @param imeisv IMEISV if GSM subscription is available
@@ -1363,7 +1363,7 @@
     oneway getDeviceIdentityResponse(RadioResponseInfo info, string imei, string imeisv,
             string esn, string meid);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1373,7 +1373,7 @@
      */
     oneway exitEmergencyCallbackModeResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param smsc Short Message Service Center address on the device
      *
@@ -1391,7 +1391,7 @@
      */
     oneway getSmscAddressResponse(RadioResponseInfo info, string smsc);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1407,7 +1407,7 @@
      */
     oneway setSmscAddressResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1422,7 +1422,7 @@
      */
     oneway reportSmsMemoryStatusResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1431,7 +1431,7 @@
      */
     oneway reportStkServiceIsRunningResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param source CDMA subscription source
      *
@@ -1442,7 +1442,7 @@
      */
     oneway getCdmaSubscriptionSourceResponse(RadioResponseInfo info, CdmaSubscriptionSource source);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param response response string of the challenge/response algo for ISIM auth in base64 format
      *
@@ -1452,7 +1452,7 @@
      */
     oneway requestIsimAuthenticationResponse(RadioResponseInfo info, string response);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1461,7 +1461,7 @@
      */
     oneway acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param iccIo IccIoResult as defined in types.hal corresponding to ICC IO response
      *
@@ -1473,7 +1473,7 @@
      */
     oneway sendEnvelopeWithStatusResponse(RadioResponseInfo info, IccIoResult iccIo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param rat Current voice RAT
      *
@@ -1483,7 +1483,7 @@
      */
     oneway getVoiceRadioTechnologyResponse(RadioResponseInfo info, RadioTechnology rat);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param cellInfo List of current cell information known to radio
      *
@@ -1493,7 +1493,7 @@
      */
     oneway getCellInfoListResponse(RadioResponseInfo info, vec<CellInfo> cellInfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1502,7 +1502,7 @@
      */
     oneway setCellInfoListRateResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1512,7 +1512,7 @@
      */
     oneway setInitialAttachApnResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param isRegistered false = not registered, true = registered
      * @param ratFamily RadioTechnologyFamily as defined in types.hal. This value is valid only if
@@ -1525,7 +1525,7 @@
     oneway getImsRegistrationStateResponse(RadioResponseInfo info, bool isRegistered,
             RadioTechnologyFamily ratFamily);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param sms Response to sms sent as defined by SendSmsResult in types.hal
      *
@@ -1548,7 +1548,7 @@
      */
     oneway sendImsSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param result IccIoResult as defined in types.hal
      *
@@ -1558,7 +1558,7 @@
      */
     oneway iccTransmitApduBasicChannelResponse(RadioResponseInfo info, IccIoResult result);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param channelId session id of the logical channel.
      * @param selectResponse Contains the select response for the open channel command with one
@@ -1573,7 +1573,7 @@
     oneway iccOpenLogicalChannelResponse(RadioResponseInfo info, int32_t channelId,
             vec<int8_t> selectResponse);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1582,7 +1582,7 @@
      */
     oneway iccCloseLogicalChannelResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param result IccIoResult as defined in types.hal
      *
@@ -1592,7 +1592,7 @@
      */
     oneway iccTransmitApduLogicalChannelResponse(RadioResponseInfo info, IccIoResult result);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param result string containing the contents of the NV item
      *
@@ -1602,7 +1602,7 @@
      */
     oneway nvReadItemResponse(RadioResponseInfo info, string result);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1611,7 +1611,7 @@
      */
     oneway nvWriteItemResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1620,7 +1620,7 @@
      */
     oneway nvWriteCdmaPrlResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1629,7 +1629,7 @@
      */
     oneway nvResetConfigResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1639,7 +1639,7 @@
      */
     oneway setUiccSubscriptionResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1648,7 +1648,7 @@
      */
     oneway setDataAllowedResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param config Array of HardwareConfig of the radio.
      *
@@ -1658,7 +1658,7 @@
      */
     oneway getHardwareConfigResponse(RadioResponseInfo info, vec<HardwareConfig> config);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param result IccIoResult as defined in types.hal
      *
@@ -1668,7 +1668,7 @@
      */
     oneway requestIccSimAuthenticationResponse(RadioResponseInfo info, IccIoResult result);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1678,7 +1678,7 @@
      */
     oneway setDataProfileResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1688,7 +1688,7 @@
      */
     oneway requestShutdownResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param rc Radio capability as defined by RadioCapability in types.hal
      *
@@ -1699,7 +1699,7 @@
      */
     oneway getRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param rc Radio capability as defined by RadioCapability in types.hal used to
      *        feedback return status
@@ -1711,7 +1711,7 @@
      */
     oneway setRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param statusInfo LceStatusInfo indicating LCE status
      *
@@ -1722,7 +1722,7 @@
      */
     oneway startLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param statusInfo LceStatusInfo indicating LCE status
      *
@@ -1733,7 +1733,7 @@
      */
     oneway stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param lceInfo LceDataInfo indicating LCE data as defined in types.hal
      *
@@ -1744,7 +1744,7 @@
      */
     oneway pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param activityInfo modem activity information
      *
@@ -1754,7 +1754,7 @@
      */
     oneway getModemActivityInfoResponse(RadioResponseInfo info, ActivityStatsInfo activityInfo);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param numAllowed number of allowed carriers which have been set correctly.
      *        On success, it must match the length of list Carriers->allowedCarriers.
@@ -1768,7 +1768,7 @@
      */
     oneway setAllowedCarriersResponse(RadioResponseInfo info, int32_t numAllowed);
 
-    /*
+    /**
      * Expected modem behavior:
      *  Return list of allowed carriers, and if all carriers are allowed.
      *
@@ -1785,7 +1785,7 @@
     oneway getAllowedCarriersResponse(RadioResponseInfo info, bool allAllowed,
             CarrierRestrictions carriers);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1794,7 +1794,7 @@
      */
     oneway sendDeviceStateResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1804,7 +1804,7 @@
      */
     oneway setIndicationFilterResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
@@ -1816,7 +1816,7 @@
      */
     oneway setSimCardPowerResponse(RadioResponseInfo info);
 
-    /*
+    /**
      * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for
      * radio request which take long time to respond.
      * For more details, refer https://source.android.com/devices/tech/connect/ril.html
diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal
index ad9f392..2224c8b 100644
--- a/radio/1.0/types.hal
+++ b/radio/1.0/types.hal
@@ -288,7 +288,7 @@
     WAITING,                              // MT call only
 };
 
-/*
+/**
  * User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0
  */
 enum UusType : int32_t {
@@ -301,7 +301,7 @@
     TYPE3_NOT_REQUIRED,
 };
 
-/*
+/**
  * User-to-User Signaling Information data coding schemes. Possible values for
  * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
  * specified in section 10.5.4.25 of 3GPP TS 24.008
@@ -410,7 +410,8 @@
                                           // callback mode
     CDMA_ACCESS_BLOCKED = 1009,
 
-    /* OEM specific error codes. Used to distinguish error from
+    /**
+     * OEM specific error codes. Used to distinguish error from
      * CALL_FAIL_ERROR_UNSPECIFIED and help assist debugging */
     OEM_CAUSE_1 = 0xf001,
     OEM_CAUSE_2 = 0xf002,
@@ -526,7 +527,7 @@
     ERROR_UNSPECIFIED = 0xffff,
 };
 
-/*
+/**
  * Please note that registration state UNKNOWN is
  * treated as "out of service" in the Android telephony.
  * Registration state REG_DENIED must be returned if Location Update
@@ -1018,7 +1019,7 @@
     OTAPA_ABORTED
 };
 
-/* Names of the CDMA info records (C.S0005 section 3.7.5) */
+/** Names of the CDMA info records (C.S0005 section 3.7.5) */
 enum CdmaInfoRecName : int32_t {
     DISPLAY,
     CALLED_PARTY_NUMBER,
@@ -1033,7 +1034,7 @@
     T53_AUDIO_CONTROL
 };
 
-/* Redirecting Number Information Record as defined in C.S0005 section 3.7.5.11 */
+/** Redirecting Number Information Record as defined in C.S0005 section 3.7.5.11 */
 enum CdmaRedirectingReason : int32_t {
     UNKNOWN = 0,
     CALL_FORWARDING_BUSY = 1,
@@ -1187,7 +1188,7 @@
     vec<AppStatus> applications;          // size <= RadioConst:CARD_MAX_APPS
 };
 
-/*
+/**
  * User-to-User Signaling Information defined in 3GPP 23.087 v8.0
  */
 struct UusInfo {
@@ -1893,7 +1894,7 @@
                                           // For SIM_RESET result it is empty string.
 };
 
-/* CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 */
+/** CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 */
 struct CdmaSignalInfoRecord {
     bool isPresent;                       // true if signal information record is present
     int8_t signalType;                    // as defined 3.7.5.5-1
@@ -1911,7 +1912,7 @@
     CdmaCallWaitingNumberPlan numberPlan;
 };
 
-/*
+/**
  * Display Info Rec as defined in C.S0005 section 3.7.5.1
  * Extended Display Info Rec as defined in C.S0005 section 3.7.5.16
  * Note: the Extended Display info rec contains multiple records of the
@@ -1924,7 +1925,7 @@
     string alphaBuf;                      // Max length = RadioConst:CDMA_ALPHA_INFO_BUFFER_LENGTH
 };
 
-/*
+/**
  * Called Party Number Info Rec as defined in C.S0005 section 3.7.5.2
  * Calling Party Number Info Rec as defined in C.S0005 section 3.7.5.3
  * Connected Number Info Rec as defined in C.S0005 section 3.7.5.4
@@ -1942,7 +1943,7 @@
     CdmaRedirectingReason redirectingReason; // redirectingReason is set to UNKNOWN if not included
 };
 
-/* Line Control Information Record as defined in C.S0005 section 3.7.5.15 */
+/** Line Control Information Record as defined in C.S0005 section 3.7.5.15 */
 struct CdmaLineControlInfoRecord {
     uint8_t lineCtrlPolarityIncluded;
     uint8_t lineCtrlToggle;
@@ -1950,12 +1951,12 @@
     uint8_t lineCtrlPowerDenial;
 };
 
-/* T53 CLIR Information Record */
+/** T53 CLIR Information Record */
 struct CdmaT53ClirInfoRecord {
     uint8_t cause;
 };
 
-/* T53 Audio Control Information Record */
+/** T53 Audio Control Information Record */
 struct CdmaT53AudioControlInfoRecord {
     uint8_t upLink;
     uint8_t downLink;
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index 24e3926..7808de1 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -44,3 +44,27 @@
         "-g",
     ],
 }
+
+cc_test {
+    name: "VtsHalSapV1_0TargetTest",
+    defaults: ["hidl_defaults"],
+    srcs: ["sap_callback.cpp",
+           "sap_hidl_hal_api.cpp",
+           "sap_hidl_hal_test.cpp",
+           "VtsHalSapV1_0TargetTest.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libnativehelper",
+        "libutils",
+        "android.hardware.radio@1.0",
+    ],
+    static_libs: ["VtsHalHidlTargetTestBase"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
index d01adf2..e7c89d5 100644
--- a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 int main(int argc, char** argv) {
-    ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
-    ::testing::InitGoogleTest(&argc, argv);
+  ::testing::AddGlobalTestEnvironment(new RadioHidlEnvironment);
+  ::testing::InitGoogleTest(&argc, argv);
 
-    int status = RUN_ALL_TESTS();
-    LOG(INFO) << "Test result = " << status;
+  int status = RUN_ALL_TESTS();
+  LOG(INFO) << "Test result = " << status;
 
-    return status;
+  return status;
 }
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
new file mode 100644
index 0000000..5306076
--- /dev/null
+++ b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 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 <sap_hidl_hal_utils.h>
+
+int main(int argc, char** argv) {
+  // Add Sim-access Profile Hidl Environment
+  ::testing::AddGlobalTestEnvironment(new SapHidlEnvironment);
+  ::testing::InitGoogleTest(&argc, argv);
+
+  int status = RUN_ALL_TESTS();
+  LOG(INFO) << "Test result = " << status;
+
+  return status;
+}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
index d87ce5f..53d1b90 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 using namespace ::android::hardware::radio::V1_0;
 
@@ -22,153 +22,154 @@
  * Test IRadio.setGsmBroadcastConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, setGsmBroadcastConfig) {
-    int serial = 0;
+  int serial = 0;
 
-    // Create GsmBroadcastSmsConfigInfo #1
-    GsmBroadcastSmsConfigInfo gbSmsConfig1;
-    gbSmsConfig1.fromServiceId = 4352;
-    gbSmsConfig1.toServiceId = 4354;
-    gbSmsConfig1.fromCodeScheme = 0;
-    gbSmsConfig1.toCodeScheme = 255;
-    gbSmsConfig1.selected = true;
+  // Create GsmBroadcastSmsConfigInfo #1
+  GsmBroadcastSmsConfigInfo gbSmsConfig1;
+  gbSmsConfig1.fromServiceId = 4352;
+  gbSmsConfig1.toServiceId = 4354;
+  gbSmsConfig1.fromCodeScheme = 0;
+  gbSmsConfig1.toCodeScheme = 255;
+  gbSmsConfig1.selected = true;
 
-    // Create GsmBroadcastSmsConfigInfo #2
-    GsmBroadcastSmsConfigInfo gbSmsConfig2;
-    gbSmsConfig2.fromServiceId = 4356;
-    gbSmsConfig2.toServiceId = 4356;
-    gbSmsConfig2.fromCodeScheme = 0;
-    gbSmsConfig2.toCodeScheme = 255;
-    gbSmsConfig2.selected = true;
+  // Create GsmBroadcastSmsConfigInfo #2
+  GsmBroadcastSmsConfigInfo gbSmsConfig2;
+  gbSmsConfig2.fromServiceId = 4356;
+  gbSmsConfig2.toServiceId = 4356;
+  gbSmsConfig2.fromCodeScheme = 0;
+  gbSmsConfig2.toCodeScheme = 255;
+  gbSmsConfig2.selected = true;
 
-    // Create GsmBroadcastSmsConfigInfo #3
-    GsmBroadcastSmsConfigInfo gbSmsConfig3;
-    gbSmsConfig3.fromServiceId = 4370;
-    gbSmsConfig3.toServiceId = 4379;
-    gbSmsConfig3.fromCodeScheme = 0;
-    gbSmsConfig3.toCodeScheme = 255;
-    gbSmsConfig3.selected = true;
+  // Create GsmBroadcastSmsConfigInfo #3
+  GsmBroadcastSmsConfigInfo gbSmsConfig3;
+  gbSmsConfig3.fromServiceId = 4370;
+  gbSmsConfig3.toServiceId = 4379;
+  gbSmsConfig3.fromCodeScheme = 0;
+  gbSmsConfig3.toCodeScheme = 255;
+  gbSmsConfig3.selected = true;
 
-    // Create GsmBroadcastSmsConfigInfo #4
-    GsmBroadcastSmsConfigInfo gbSmsConfig4;
-    gbSmsConfig4.fromServiceId = 4383;
-    gbSmsConfig4.toServiceId = 4391;
-    gbSmsConfig4.fromCodeScheme = 0;
-    gbSmsConfig4.toCodeScheme = 255;
-    gbSmsConfig4.selected = true;
+  // Create GsmBroadcastSmsConfigInfo #4
+  GsmBroadcastSmsConfigInfo gbSmsConfig4;
+  gbSmsConfig4.fromServiceId = 4383;
+  gbSmsConfig4.toServiceId = 4391;
+  gbSmsConfig4.fromCodeScheme = 0;
+  gbSmsConfig4.toCodeScheme = 255;
+  gbSmsConfig4.selected = true;
 
-    // Create GsmBroadcastSmsConfigInfo #5
-    GsmBroadcastSmsConfigInfo gbSmsConfig5;
-    gbSmsConfig5.fromServiceId = 4392;
-    gbSmsConfig5.toServiceId = 4392;
-    gbSmsConfig5.fromCodeScheme = 0;
-    gbSmsConfig5.toCodeScheme = 255;
-    gbSmsConfig5.selected = true;
+  // Create GsmBroadcastSmsConfigInfo #5
+  GsmBroadcastSmsConfigInfo gbSmsConfig5;
+  gbSmsConfig5.fromServiceId = 4392;
+  gbSmsConfig5.toServiceId = 4392;
+  gbSmsConfig5.fromCodeScheme = 0;
+  gbSmsConfig5.toCodeScheme = 255;
+  gbSmsConfig5.selected = true;
 
-    android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo> gsmBroadcastSmsConfigsInfoList
-        = {gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
+  android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>
+      gsmBroadcastSmsConfigsInfoList = {
+          gbSmsConfig1, gbSmsConfig2, gbSmsConfig3, gbSmsConfig4, gbSmsConfig5};
 
-    radio->setGsmBroadcastConfig(++serial, gsmBroadcastSmsConfigsInfoList);
+  radio->setGsmBroadcastConfig(++serial, gsmBroadcastSmsConfigsInfoList);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getGsmBroadcastConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, getGsmBroadcastConfig) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getGsmBroadcastConfig(++serial);
+  radio->getGsmBroadcastConfig(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setCdmaBroadcastConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, setCdmaBroadcastConfig) {
-    int serial = 0;
+  int serial = 0;
 
-    CdmaBroadcastSmsConfigInfo cbSmsConfig;
-    cbSmsConfig.serviceCategory = 4096;
-    cbSmsConfig.language = 1;
-    cbSmsConfig.selected = true;
+  CdmaBroadcastSmsConfigInfo cbSmsConfig;
+  cbSmsConfig.serviceCategory = 4096;
+  cbSmsConfig.language = 1;
+  cbSmsConfig.selected = true;
 
-    android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo> cdmaBroadcastSmsConfigInfoList
-        = {cbSmsConfig};
+  android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>
+      cdmaBroadcastSmsConfigInfoList = {cbSmsConfig};
 
-    radio->setCdmaBroadcastConfig(++serial, cdmaBroadcastSmsConfigInfoList);
+  radio->setCdmaBroadcastConfig(++serial, cdmaBroadcastSmsConfigInfoList);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getCdmaBroadcastConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, getCdmaBroadcastConfig) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getCdmaBroadcastConfig(++serial);
+  radio->getCdmaBroadcastConfig(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setCdmaBroadcastActivation() for the response returned.
  */
 TEST_F(RadioHidlTest, setCdmaBroadcastActivation) {
-    int serial = 0;
-    bool activate = false;
+  int serial = 0;
+  bool activate = false;
 
-    radio->setCdmaBroadcastActivation(++serial, activate);
+  radio->setCdmaBroadcastActivation(++serial, activate);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setGsmBroadcastActivation() for the response returned.
  */
 TEST_F(RadioHidlTest, setGsmBroadcastActivation) {
-    int serial = 0;
-    bool activate = false;
+  int serial = 0;
+  bool activate = false;
 
-    radio->setGsmBroadcastActivation(++serial, activate);
+  radio->setGsmBroadcastActivation(++serial, activate);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 06cab6a..526cb04 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 using namespace ::android::hardware::radio::V1_0;
 
@@ -22,198 +22,198 @@
  * Test IRadio.getDataRegistrationState() for the response returned.
  */
 TEST_F(RadioHidlTest, getDataRegistrationState) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getDataRegistrationState(++serial);
+  radio->getDataRegistrationState(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setupDataCall() for the response returned.
  */
 TEST_F(RadioHidlTest, setupDataCall) {
-    int serial = 0;
+  int serial = 0;
 
-    RadioTechnology radioTechnology = RadioTechnology::LTE;
+  RadioTechnology radioTechnology = RadioTechnology::LTE;
 
-    DataProfileInfo dataProfileInfo;
-    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
-    dataProfileInfo.profileId = DataProfileId::IMS;
-    dataProfileInfo.apn = hidl_string("VZWIMS");
-    dataProfileInfo.protocol = hidl_string("IPV4V6");
-    dataProfileInfo.roamingProtocol = hidl_string("IPV6");
-    dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
-    dataProfileInfo.user = "";
-    dataProfileInfo.password = "";
-    dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
-    dataProfileInfo.maxConnsTime = 300;
-    dataProfileInfo.maxConns = 20;
-    dataProfileInfo.waitTime = 0;
-    dataProfileInfo.enabled = true;
-    dataProfileInfo.supportedApnTypesBitmap = 320;
-    dataProfileInfo.bearerBitmap = 161543;
-    dataProfileInfo.mtu = 0;
-    dataProfileInfo.mvnoType = MvnoType::NONE;
-    dataProfileInfo.mvnoMatchData = hidl_string();
+  DataProfileInfo dataProfileInfo;
+  memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+  dataProfileInfo.profileId = DataProfileId::IMS;
+  dataProfileInfo.apn = hidl_string("VZWIMS");
+  dataProfileInfo.protocol = hidl_string("IPV4V6");
+  dataProfileInfo.roamingProtocol = hidl_string("IPV6");
+  dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+  dataProfileInfo.user = "";
+  dataProfileInfo.password = "";
+  dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
+  dataProfileInfo.maxConnsTime = 300;
+  dataProfileInfo.maxConns = 20;
+  dataProfileInfo.waitTime = 0;
+  dataProfileInfo.enabled = true;
+  dataProfileInfo.supportedApnTypesBitmap = 320;
+  dataProfileInfo.bearerBitmap = 161543;
+  dataProfileInfo.mtu = 0;
+  dataProfileInfo.mvnoType = MvnoType::NONE;
+  dataProfileInfo.mvnoMatchData = hidl_string();
 
-    bool modemCognitive = false;
-    bool roamingAllowed = false;
-    bool isRoaming = false;
+  bool modemCognitive = false;
+  bool roamingAllowed = false;
+  bool isRoaming = false;
 
-    radio->setupDataCall(++serial, radioTechnology, dataProfileInfo, modemCognitive,
-           roamingAllowed, isRoaming);
+  radio->setupDataCall(++serial, radioTechnology, dataProfileInfo,
+                       modemCognitive, roamingAllowed, isRoaming);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.deactivateDataCall() for the response returned.
  */
 TEST_F(RadioHidlTest, deactivateDataCall) {
-    int serial = 0;
-    int cid = 1;
-    bool reasonRadioShutDown = false;
+  int serial = 0;
+  int cid = 1;
+  bool reasonRadioShutDown = false;
 
-    radio->deactivateDataCall(++serial, cid, reasonRadioShutDown);
+  radio->deactivateDataCall(++serial, cid, reasonRadioShutDown);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getDataCallList() for the response returned.
  */
 TEST_F(RadioHidlTest, getDataCallList) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getDataCallList(++serial);
+  radio->getDataCallList(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setInitialAttachApn() for the response returned.
  */
 TEST_F(RadioHidlTest, setInitialAttachApn) {
-    int serial = 0;
+  int serial = 0;
 
-    DataProfileInfo dataProfileInfo;
-    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
-    dataProfileInfo.profileId = DataProfileId::IMS;
-    dataProfileInfo.apn = hidl_string("VZWIMS");
-    dataProfileInfo.protocol = hidl_string("IPV4V6");
-    dataProfileInfo.roamingProtocol = hidl_string("IPV6");
-    dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
-    dataProfileInfo.user = "";
-    dataProfileInfo.password = "";
-    dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
-    dataProfileInfo.maxConnsTime = 300;
-    dataProfileInfo.maxConns = 20;
-    dataProfileInfo.waitTime = 0;
-    dataProfileInfo.enabled = true;
-    dataProfileInfo.supportedApnTypesBitmap = 320;
-    dataProfileInfo.bearerBitmap = 161543;
-    dataProfileInfo.mtu = 0;
-    dataProfileInfo.mvnoType = MvnoType::NONE;
-    dataProfileInfo.mvnoMatchData = hidl_string();
+  DataProfileInfo dataProfileInfo;
+  memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+  dataProfileInfo.profileId = DataProfileId::IMS;
+  dataProfileInfo.apn = hidl_string("VZWIMS");
+  dataProfileInfo.protocol = hidl_string("IPV4V6");
+  dataProfileInfo.roamingProtocol = hidl_string("IPV6");
+  dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+  dataProfileInfo.user = "";
+  dataProfileInfo.password = "";
+  dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
+  dataProfileInfo.maxConnsTime = 300;
+  dataProfileInfo.maxConns = 20;
+  dataProfileInfo.waitTime = 0;
+  dataProfileInfo.enabled = true;
+  dataProfileInfo.supportedApnTypesBitmap = 320;
+  dataProfileInfo.bearerBitmap = 161543;
+  dataProfileInfo.mtu = 0;
+  dataProfileInfo.mvnoType = MvnoType::NONE;
+  dataProfileInfo.mvnoMatchData = hidl_string();
 
-    bool modemCognitive = true;
-    bool isRoaming = false;
+  bool modemCognitive = true;
+  bool isRoaming = false;
 
-    radio->setInitialAttachApn(++serial, dataProfileInfo,
-           modemCognitive, isRoaming);
+  radio->setInitialAttachApn(++serial, dataProfileInfo, modemCognitive,
+                             isRoaming);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setDataAllowed() for the response returned.
  */
 TEST_F(RadioHidlTest, setDataAllowed) {
-    int serial = 0;
-    bool allow = true;
+  int serial = 0;
+  bool allow = true;
 
-    radio->setDataAllowed(++serial, allow);
+  radio->setDataAllowed(++serial, allow);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.setDataProfile() for the response returned.
  */
 TEST_F(RadioHidlTest, setDataProfile) {
-    int serial = 0;
+  int serial = 0;
 
-    // Create a dataProfileInfo
-    DataProfileInfo dataProfileInfo;
-    memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
-    dataProfileInfo.profileId = DataProfileId::IMS;
-    dataProfileInfo.apn = hidl_string("VZWIMS");
-    dataProfileInfo.protocol = hidl_string("IPV4V6");
-    dataProfileInfo.roamingProtocol = hidl_string("IPV6");
-    dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
-    dataProfileInfo.user = "";
-    dataProfileInfo.password = "";
-    dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
-    dataProfileInfo.maxConnsTime = 300;
-    dataProfileInfo.maxConns = 20;
-    dataProfileInfo.waitTime = 0;
-    dataProfileInfo.enabled = true;
-    dataProfileInfo.supportedApnTypesBitmap = 320;
-    dataProfileInfo.bearerBitmap = 161543;
-    dataProfileInfo.mtu = 0;
-    dataProfileInfo.mvnoType = MvnoType::NONE;
-    dataProfileInfo.mvnoMatchData = hidl_string();
+  // Create a dataProfileInfo
+  DataProfileInfo dataProfileInfo;
+  memset(&dataProfileInfo, 0, sizeof(dataProfileInfo));
+  dataProfileInfo.profileId = DataProfileId::IMS;
+  dataProfileInfo.apn = hidl_string("VZWIMS");
+  dataProfileInfo.protocol = hidl_string("IPV4V6");
+  dataProfileInfo.roamingProtocol = hidl_string("IPV6");
+  dataProfileInfo.authType = ApnAuthType::NO_PAP_NO_CHAP;
+  dataProfileInfo.user = "";
+  dataProfileInfo.password = "";
+  dataProfileInfo.type = DataProfileInfoType::THREE_GPP2;
+  dataProfileInfo.maxConnsTime = 300;
+  dataProfileInfo.maxConns = 20;
+  dataProfileInfo.waitTime = 0;
+  dataProfileInfo.enabled = true;
+  dataProfileInfo.supportedApnTypesBitmap = 320;
+  dataProfileInfo.bearerBitmap = 161543;
+  dataProfileInfo.mtu = 0;
+  dataProfileInfo.mvnoType = MvnoType::NONE;
+  dataProfileInfo.mvnoMatchData = hidl_string();
 
-    // Create a dataProfileInfoList
-    android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = {dataProfileInfo};
+  // Create a dataProfileInfoList
+  android::hardware::hidl_vec<DataProfileInfo> dataProfileInfoList = {
+      dataProfileInfo};
 
-    bool isRoadming = false;
+  bool isRoadming = false;
 
-    radio->setDataProfile(++serial, dataProfileInfoList, isRoadming);
+  radio->setDataProfile(++serial, dataProfileInfoList, isRoadming);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        // TODO(shuoq): Will add error check when we know the expected error from QC
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    // TODO(shuoq): Will add error check when we know the expected error from QC
+  }
 }
-
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 9cae9c2..19738d5 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -14,293 +14,307 @@
  * limitations under the License.
  */
 
- #include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 /*
  * Test IRadio.getIccCardStatus() for the response returned.
  */
 TEST_F(RadioHidlTest, getIccCardStatus) {
-    EXPECT_LE(cardStatus.applications.size(), (unsigned int) RadioConst::CARD_MAX_APPS);
-    EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
-    EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
-    EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int) RadioConst::CARD_MAX_APPS);
+  EXPECT_LE(cardStatus.applications.size(),
+            (unsigned int)RadioConst::CARD_MAX_APPS);
+  EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex,
+            (int)RadioConst::CARD_MAX_APPS);
+  EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex,
+            (int)RadioConst::CARD_MAX_APPS);
+  EXPECT_LT(cardStatus.imsSubscriptionAppIndex, (int)RadioConst::CARD_MAX_APPS);
 }
 
 /*
  * Test IRadio.supplyIccPinForApp() for the response returned
  */
 TEST_F(RadioHidlTest, supplyIccPinForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->supplyIccPinForApp(++serial, hidl_string("test1"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->supplyIccPinForApp(++serial, hidl_string("test1"),
+                                cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.supplyIccPukForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, supplyIccPukForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->supplyIccPukForApp(++serial, hidl_string("test1"), hidl_string("test2"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->supplyIccPukForApp(++serial, hidl_string("test1"),
+                                hidl_string("test2"),
+                                cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.supplyIccPin2ForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, supplyIccPin2ForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->supplyIccPin2ForApp(++serial, hidl_string("test1"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->supplyIccPin2ForApp(++serial, hidl_string("test1"),
+                                 cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.supplyIccPuk2ForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, supplyIccPuk2ForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->supplyIccPuk2ForApp(++serial, hidl_string("test1"), hidl_string("test2"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->supplyIccPuk2ForApp(++serial, hidl_string("test1"),
+                                 hidl_string("test2"),
+                                 cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.changeIccPinForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, changeIccPinForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->changeIccPinForApp(++serial, hidl_string("test1"), hidl_string("test2"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->changeIccPinForApp(++serial, hidl_string("test1"),
+                                hidl_string("test2"),
+                                cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.changeIccPin2ForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, changeIccPin2ForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->changeIccPin2ForApp(++serial, hidl_string("test1"), hidl_string("test2"),
-                    cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
-        }
+  // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and
+  // 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->changeIccPin2ForApp(++serial, hidl_string("test1"),
+                                 hidl_string("test2"),
+                                 cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(RadioError::PASSWORD_INCORRECT, radioRsp->rspInfo.error);
     }
+  }
 }
 
 /*
  * Test IRadio.getImsiForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, getImsiForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    // Check success returned while getting imsi for 3GPP and 3GPP2 apps only
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        if (cardStatus.applications[i].appType == AppType::SIM
-                || cardStatus.applications[i].appType == AppType::USIM
-                || cardStatus.applications[i].appType == AppType::RUIM
-                || cardStatus.applications[i].appType == AppType::CSIM) {
-            radio->getImsiForApp(++serial, cardStatus.applications[i].aidPtr);
-            EXPECT_EQ(std::cv_status::no_timeout, wait());
-            EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-            EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-            EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  // Check success returned while getting imsi for 3GPP and 3GPP2 apps only
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    if (cardStatus.applications[i].appType == AppType::SIM ||
+        cardStatus.applications[i].appType == AppType::USIM ||
+        cardStatus.applications[i].appType == AppType::RUIM ||
+        cardStatus.applications[i].appType == AppType::CSIM) {
+      radio->getImsiForApp(++serial, cardStatus.applications[i].aidPtr);
+      EXPECT_EQ(std::cv_status::no_timeout, wait());
+      EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+      EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+      EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
 
-            // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
-            if (radioRsp->rspInfo.error == RadioError::NONE) {
-                EXPECT_NE(radioRsp->imsi, hidl_string());
-                EXPECT_GE((int) (radioRsp->imsi).size(), 6);
-                EXPECT_LE((int) (radioRsp->imsi).size(), 15);
-            }
-        }
+      // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more than 15
+      if (radioRsp->rspInfo.error == RadioError::NONE) {
+        EXPECT_NE(radioRsp->imsi, hidl_string());
+        EXPECT_GE((int)(radioRsp->imsi).size(), 6);
+        EXPECT_LE((int)(radioRsp->imsi).size(), 15);
+      }
     }
+  }
 }
 
 /*
  * Test IRadio.iccIOForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, iccIOForApp) {
-    int serial = 1;
+  int serial = 1;
 
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        IccIo iccIo;
-        iccIo.command = 0xc0;
-        iccIo.fileId = 0x6f11;
-        iccIo.path = hidl_string("3F007FFF");
-        iccIo.p1 = 0;
-        iccIo.p2 = 0;
-        iccIo.p3 = 0;
-        iccIo.data = hidl_string();
-        iccIo.pin2 = hidl_string();
-        iccIo.aid = cardStatus.applications[i].aidPtr;
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    IccIo iccIo;
+    iccIo.command = 0xc0;
+    iccIo.fileId = 0x6f11;
+    iccIo.path = hidl_string("3F007FFF");
+    iccIo.p1 = 0;
+    iccIo.p2 = 0;
+    iccIo.p3 = 0;
+    iccIo.data = hidl_string();
+    iccIo.pin2 = hidl_string();
+    iccIo.aid = cardStatus.applications[i].aidPtr;
 
-        radio->iccIOForApp(++serial, iccIo);
-        EXPECT_EQ(std::cv_status::no_timeout, wait());
-        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-        EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-    }
+    radio->iccIOForApp(++serial, iccIo);
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  }
 }
 
 /*
  * Test IRadio.iccTransmitApduBasicChannel() for the response returned.
  */
 TEST_F(RadioHidlTest, iccTransmitApduBasicChannel) {
-    int serial = 1;
-    SimApdu msg;
-    memset(&msg, 0, sizeof(msg));
-    msg.data = hidl_string();
+  int serial = 1;
+  SimApdu msg;
+  memset(&msg, 0, sizeof(msg));
+  msg.data = hidl_string();
 
-    radio->iccTransmitApduBasicChannel(serial, msg);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->iccTransmitApduBasicChannel(serial, msg);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    // TODO(sanketpadawe): Add test for error code
+  // TODO(sanketpadawe): Add test for error code
 }
 
 /*
  * Test IRadio.iccOpenLogicalChannel() for the response returned.
  */
 TEST_F(RadioHidlTest, iccOpenLogicalChannel) {
-    int serial = 1;
+  int serial = 1;
 
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
-        EXPECT_EQ(std::cv_status::no_timeout, wait());
-        EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    }
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    radio->iccOpenLogicalChannel(++serial, cardStatus.applications[i].aidPtr);
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  }
 }
 
 /*
  * Test IRadio.iccCloseLogicalChannel() for the response returned.
  */
 TEST_F(RadioHidlTest, iccCloseLogicalChannel) {
-    int serial = 1;
-    // Try closing invalid channel and check INVALID_ARGUMENTS returned as error
-    radio->iccCloseLogicalChannel(serial, 0);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  int serial = 1;
+  // Try closing invalid channel and check INVALID_ARGUMENTS returned as error
+  radio->iccCloseLogicalChannel(serial, 0);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+  EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
 }
 
 /*
  * Test IRadio.iccTransmitApduLogicalChannel() for the response returned.
  */
 TEST_F(RadioHidlTest, iccTransmitApduLogicalChannel) {
-    SimApdu msg;
-    memset(&msg, 0, sizeof(msg));
-    msg.data = hidl_string();
+  SimApdu msg;
+  memset(&msg, 0, sizeof(msg));
+  msg.data = hidl_string();
 
-    radio->iccTransmitApduLogicalChannel(1, msg);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(1, radioRsp->rspInfo.serial);
+  radio->iccTransmitApduLogicalChannel(1, msg);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(1, radioRsp->rspInfo.serial);
 
-    // TODO(sanketpadawe): Add test for error code
+  // TODO(sanketpadawe): Add test for error code
 }
 
 /*
  * Test IRadio.requestIccSimAuthentication() for the response returned.
  */
 TEST_F(RadioHidlTest, requestIccSimAuthentication) {
-    int serial = 1;
+  int serial = 1;
 
-    // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS returned as error.
-    for (int i = 0; i < (int) cardStatus.applications.size(); i++) {
-        radio->requestIccSimAuthentication(++serial, 0, hidl_string("test"),
-                cardStatus.applications[i].aidPtr);
-        EXPECT_EQ(std::cv_status::no_timeout, wait());
-        EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-        EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-        EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
-    }
+  // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS
+  // returned as error.
+  for (int i = 0; i < (int)cardStatus.applications.size(); i++) {
+    radio->requestIccSimAuthentication(++serial, 0, hidl_string("test"),
+                                       cardStatus.applications[i].aidPtr);
+    EXPECT_EQ(std::cv_status::no_timeout, wait());
+    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+    EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.supplyNetworkDepersonalization() for the response returned.
  */
 TEST_F(RadioHidlTest, supplyNetworkDepersonalization) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->supplyNetworkDepersonalization(serial, hidl_string("test"));
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT);
+  }
 }
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
index fdc39d8..0ec2e5c 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_ims.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 using namespace ::android::hardware::radio::V1_0;
 
@@ -22,179 +22,181 @@
  * Test IRadio.getClir() for the response returned.
  */
 TEST_F(RadioHidlTest, getClir) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getClir(++serial);
+  radio->getClir(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setClir() for the response returned.
  */
 TEST_F(RadioHidlTest, setClir) {
-    int serial = 0;
-    int32_t status = 1;
+  int serial = 0;
+  int32_t status = 1;
 
-    radio->setClir(++serial, status);
+  radio->setClir(++serial, status);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getFacilityLockForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, getFacilityLockForApp) {
-    int serial = 0;
-    std::string facility = "";
-    std::string password = "";
-    int32_t serviceClass = 1;
-    std::string appId = "";
+  int serial = 0;
+  std::string facility = "";
+  std::string password = "";
+  int32_t serviceClass = 1;
+  std::string appId = "";
 
-    radio->getFacilityLockForApp(++serial, facility, password, serviceClass, appId);
+  radio->getFacilityLockForApp(++serial, facility, password, serviceClass,
+                               appId);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setFacilityLockForApp() for the response returned.
  */
 TEST_F(RadioHidlTest, setFacilityLockForApp) {
-    int serial = 0;
-    std::string facility = "";
-    bool lockState = false;
-    std::string password = "";
-    int32_t serviceClass = 1;
-    std::string appId = "";
+  int serial = 0;
+  std::string facility = "";
+  bool lockState = false;
+  std::string password = "";
+  int32_t serviceClass = 1;
+  std::string appId = "";
 
-    radio->setFacilityLockForApp(++serial, facility, lockState, password, serviceClass, appId);
+  radio->setFacilityLockForApp(++serial, facility, lockState, password,
+                               serviceClass, appId);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setBarringPassword() for the response returned.
  */
 TEST_F(RadioHidlTest, setBarringPassword) {
-    int serial = 0;
-    std::string facility = "";
-    std::string oldPassword = "";
-    std::string newPassword = "";
+  int serial = 0;
+  std::string facility = "";
+  std::string oldPassword = "";
+  std::string newPassword = "";
 
-    radio->setBarringPassword(++serial, facility, oldPassword, newPassword);
+  radio->setBarringPassword(++serial, facility, oldPassword, newPassword);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.getClip() for the response returned.
  */
 TEST_F(RadioHidlTest, getClip) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getClip(++serial);
+  radio->getClip(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setSuppServiceNotifications() for the response returned.
  */
 TEST_F(RadioHidlTest, setSuppServiceNotifications) {
-    int serial = 0;
-    bool enable = false;
+  int serial = 0;
+  bool enable = false;
 
-    radio->setSuppServiceNotifications(++serial, enable);
+  radio->setSuppServiceNotifications(++serial, enable);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.requestIsimAuthentication() for the response returned.
  */
 TEST_F(RadioHidlTest, requestIsimAuthentication) {
-    int serial = 0;
-    std::string challenge = "";
+  int serial = 0;
+  std::string challenge = "";
 
-    radio->requestIsimAuthentication(++serial, challenge);
+  radio->requestIsimAuthentication(++serial, challenge);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getImsRegistrationState() for the response returned.
  */
 TEST_F(RadioHidlTest, getImsRegistrationState) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getImsRegistrationState(++serial);
+  radio->getImsRegistrationState(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index f704520..2e0a10f 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -14,778 +14,779 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 /*
  * Test IRadio.getSignalStrength() for the response returned.
  */
 TEST_F(RadioHidlTest, getSignalStrength) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getSignalStrength(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getSignalStrength(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getVoiceRegistrationState() for the response returned.
  */
 TEST_F(RadioHidlTest, getVoiceRegistrationState) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getVoiceRegistrationState(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getVoiceRegistrationState(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getOperator() for the response returned.
  */
 TEST_F(RadioHidlTest, getOperator) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getOperator(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getOperator(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setRadioPower() for the response returned.
  */
 TEST_F(RadioHidlTest, setRadioPower) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setRadioPower(++serial, 0);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setRadioPower(++serial, 0);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getNetworkSelectionMode() for the response returned.
  */
 TEST_F(RadioHidlTest, getNetworkSelectionMode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getNetworkSelectionMode(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getNetworkSelectionMode(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setNetworkSelectionModeAutomatic() for the response returned.
  */
 TEST_F(RadioHidlTest, setNetworkSelectionModeAutomatic) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setNetworkSelectionModeAutomatic(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setNetworkSelectionModeAutomatic(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME);
+  }
 }
 
 /*
  * Test IRadio.setNetworkSelectionModeManual() for the response returned.
  */
 TEST_F(RadioHidlTest, setNetworkSelectionModeManual) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setNetworkSelectionModeManual(++serial, "123456");
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setNetworkSelectionModeManual(++serial, "123456");
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::ILLEGAL_SIM_OR_ME);
+  }
 }
 
 /*
  * Test IRadio.getAvailableNetworks() for the response returned.
  */
 TEST_F(RadioHidlTest, getAvailableNetworks) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getAvailableNetworks(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getAvailableNetworks(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getBasebandVersion() for the response returned.
  */
 TEST_F(RadioHidlTest, getBasebandVersion) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getBasebandVersion(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getBasebandVersion(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setBandMode() for the response returned.
  */
 TEST_F(RadioHidlTest, setBandMode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setBandMode(++serial, RadioBandMode::BAND_MODE_USA);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setBandMode(++serial, RadioBandMode::BAND_MODE_USA);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getAvailableBandModes() for the response returned.
  */
 TEST_F(RadioHidlTest, getAvailableBandModes) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getAvailableBandModes(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getAvailableBandModes(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setPreferredNetworkType() for the response returned.
  */
 TEST_F(RadioHidlTest, setPreferredNetworkType) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setPreferredNetworkType(++serial, PreferredNetworkType::GSM_ONLY);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setPreferredNetworkType(++serial, PreferredNetworkType::GSM_ONLY);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getPreferredNetworkType() for the response returned.
  */
 TEST_F(RadioHidlTest, getPreferredNetworkType) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getPreferredNetworkType(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getPreferredNetworkType(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getNeighboringCids() for the response returned.
  */
 TEST_F(RadioHidlTest, getNeighboringCids) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getNeighboringCids(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getNeighboringCids(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setLocationUpdates() for the response returned.
  */
 TEST_F(RadioHidlTest, setLocationUpdates) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setLocationUpdates(++serial, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setLocationUpdates(++serial, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setCdmaRoamingPreference() for the response returned.
  */
 TEST_F(RadioHidlTest, setCdmaRoamingPreference) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setCdmaRoamingPreference(++serial, CdmaRoamingType::HOME_NETWORK);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setCdmaRoamingPreference(++serial, CdmaRoamingType::HOME_NETWORK);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getCdmaRoamingPreference() for the response returned.
  */
 TEST_F(RadioHidlTest, getCdmaRoamingPreference) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCdmaRoamingPreference(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCdmaRoamingPreference(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getTTYMode() for the response returned.
  */
 TEST_F(RadioHidlTest, getTTYMode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getTTYMode(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getTTYMode(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setTTYMode() for the response returned.
  */
 TEST_F(RadioHidlTest, setTTYMode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setTTYMode(++serial, TtyMode::OFF);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setTTYMode(++serial, TtyMode::OFF);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setPreferredVoicePrivacy() for the response returned.
  */
 TEST_F(RadioHidlTest, setPreferredVoicePrivacy) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setPreferredVoicePrivacy(++serial, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setPreferredVoicePrivacy(++serial, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getPreferredVoicePrivacy() for the response returned.
  */
 TEST_F(RadioHidlTest, getPreferredVoicePrivacy) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getPreferredVoicePrivacy(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getPreferredVoicePrivacy(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getCDMASubscription() for the response returned.
  */
 TEST_F(RadioHidlTest, getCDMASubscription) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCDMASubscription(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCDMASubscription(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getDeviceIdentity() for the response returned.
  */
 TEST_F(RadioHidlTest, getDeviceIdentity) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getDeviceIdentity(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getDeviceIdentity(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.exitEmergencyCallbackMode() for the response returned.
  */
 TEST_F(RadioHidlTest, exitEmergencyCallbackMode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->exitEmergencyCallbackMode(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->exitEmergencyCallbackMode(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getCdmaSubscriptionSource() for the response returned.
  */
 TEST_F(RadioHidlTest, getCdmaSubscriptionSource) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCdmaSubscriptionSource(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCdmaSubscriptionSource(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setCdmaSubscriptionSource() for the response returned.
  */
 TEST_F(RadioHidlTest, setCdmaSubscriptionSource) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setCdmaSubscriptionSource(++serial, CdmaSubscriptionSource::RUIM_SIM);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setCdmaSubscriptionSource(++serial, CdmaSubscriptionSource::RUIM_SIM);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT
-                || radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_AVAILABLE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT ||
+                radioRsp->rspInfo.error ==
+                    RadioError::SUBSCRIPTION_NOT_AVAILABLE);
+  }
 }
 
 /*
  * Test IRadio.getVoiceRadioTechnology() for the response returned.
  */
 TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getVoiceRadioTechnology(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getVoiceRadioTechnology(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getCellInfoList() for the response returned.
  */
 TEST_F(RadioHidlTest, getCellInfoList) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCellInfoList(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCellInfoList(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setCellInfoListRate() for the response returned.
  */
 TEST_F(RadioHidlTest, setCellInfoListRate) {
-    int serial = 1;
+  int serial = 1;
 
-    // TODO(sanketpadawe): RIL crashes with value of rate = 10
-    radio->setCellInfoListRate(++serial, 10);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  // TODO(sanketpadawe): RIL crashes with value of rate = 10
+  radio->setCellInfoListRate(++serial, 10);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.nvReadItem() for the response returned.
  */
 TEST_F(RadioHidlTest, nvReadItem) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->nvReadItem(++serial, NvItem::LTE_BAND_ENABLE_25);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->nvReadItem(++serial, NvItem::LTE_BAND_ENABLE_25);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.nvWriteItem() for the response returned.
  */
 TEST_F(RadioHidlTest, nvWriteItem) {
-    int serial = 1;
-    NvWriteItem item;
-    memset(&item, 0, sizeof(item));
-    item.value = hidl_string();
+  int serial = 1;
+  NvWriteItem item;
+  memset(&item, 0, sizeof(item));
+  item.value = hidl_string();
 
-    radio->nvWriteItem(++serial, item);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->nvWriteItem(++serial, item);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.nvWriteCdmaPrl() for the response returned.
  */
 TEST_F(RadioHidlTest, nvWriteCdmaPrl) {
-    int serial = 1;
-    std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
+  int serial = 1;
+  std::vector<uint8_t> prl = {1, 2, 3, 4, 5};
 
-    radio->nvWriteCdmaPrl(++serial, hidl_vec<uint8_t>(prl));
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->nvWriteCdmaPrl(++serial, hidl_vec<uint8_t>(prl));
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.nvResetConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, nvResetConfig) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->nvResetConfig(++serial, ResetNvType::RELOAD);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->nvResetConfig(++serial, ResetNvType::RELOAD);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setUiccSubscription() for the response returned.
  */
 TEST_F(RadioHidlTest, setUiccSubscription) {
-    int serial = 1;
-    SelectUiccSub item;
-    memset(&item, 0, sizeof(item));
+  int serial = 1;
+  SelectUiccSub item;
+  memset(&item, 0, sizeof(item));
 
-    radio->setUiccSubscription(++serial, item);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setUiccSubscription(++serial, item);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getHardwareConfig() for the response returned.
  */
 TEST_F(RadioHidlTest, getHardwareConfig) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getHardwareConfig(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getHardwareConfig(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.requestShutdown() for the response returned.
  */
 TEST_F(RadioHidlTest, requestShutdown) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->requestShutdown(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->requestShutdown(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getRadioCapability() for the response returned.
  */
 TEST_F(RadioHidlTest, getRadioCapability) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getRadioCapability(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getRadioCapability(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setRadioCapability() for the response returned.
  */
 TEST_F(RadioHidlTest, setRadioCapability) {
-    int serial = 1;
-    RadioCapability rc;
-    memset(&rc, 0, sizeof(rc));
-    rc.logicalModemUuid = hidl_string();
+  int serial = 1;
+  RadioCapability rc;
+  memset(&rc, 0, sizeof(rc));
+  rc.logicalModemUuid = hidl_string();
 
-    radio->setRadioCapability(++serial, rc);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setRadioCapability(++serial, rc);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.startLceService() for the response returned.
  */
 TEST_F(RadioHidlTest, startLceService) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->startLceService(++serial, 5, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->startLceService(++serial, 5, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE
-                || radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
+  }
 }
 
 /*
  * Test IRadio.stopLceService() for the response returned.
  */
 TEST_F(RadioHidlTest, stopLceService) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->stopLceService(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->stopLceService(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE
-                || radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
+  }
 }
 
 /*
  * Test IRadio.pullLceData() for the response returned.
  */
 TEST_F(RadioHidlTest, pullLceData) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->pullLceData(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->pullLceData(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE
-                || radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+                radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED);
+  }
 }
 
 /*
  * Test IRadio.getModemActivityInfo() for the response returned.
  */
 TEST_F(RadioHidlTest, getModemActivityInfo) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getModemActivityInfo(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getModemActivityInfo(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setAllowedCarriers() for the response returned.
  */
 TEST_F(RadioHidlTest, setAllowedCarriers) {
-    int serial = 1;
-    CarrierRestrictions carriers;
-    memset(&carriers, 0, sizeof(carriers));
-    carriers.allowedCarriers.resize(1);
-    carriers.excludedCarriers.resize(0);
-    carriers.allowedCarriers[0].mcc = hidl_string();
-    carriers.allowedCarriers[0].mnc = hidl_string();
-    carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL;
-    carriers.allowedCarriers[0].matchData = hidl_string();
+  int serial = 1;
+  CarrierRestrictions carriers;
+  memset(&carriers, 0, sizeof(carriers));
+  carriers.allowedCarriers.resize(1);
+  carriers.excludedCarriers.resize(0);
+  carriers.allowedCarriers[0].mcc = hidl_string();
+  carriers.allowedCarriers[0].mnc = hidl_string();
+  carriers.allowedCarriers[0].matchType = CarrierMatchType::ALL;
+  carriers.allowedCarriers[0].matchData = hidl_string();
 
-    radio->setAllowedCarriers(++serial, false, carriers);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setAllowedCarriers(++serial, false, carriers);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getAllowedCarriers() for the response returned.
  */
 TEST_F(RadioHidlTest, getAllowedCarriers) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getAllowedCarriers(++serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getAllowedCarriers(++serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.sendDeviceState() for the response returned.
  */
 TEST_F(RadioHidlTest, sendDeviceState) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->sendDeviceState(++serial, DeviceStateType::POWER_SAVE_MODE, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->sendDeviceState(++serial, DeviceStateType::POWER_SAVE_MODE, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setIndicationFilter() for the response returned.
  */
 TEST_F(RadioHidlTest, setIndicationFilter) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setIndicationFilter(++serial, 1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setIndicationFilter(++serial, 1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.setSimCardPower() for the response returned.
  */
 TEST_F(RadioHidlTest, setSimCardPower) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setSimCardPower(++serial, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setSimCardPower(++serial, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
+  }
 }
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
index 54ae7c0..7caf471 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 using namespace ::android::hardware::radio::V1_0;
 
@@ -22,403 +22,408 @@
  * Test IRadio.sendSms() for the response returned.
  */
 TEST_F(RadioHidlTest, sendSms) {
-    int serial = 0;
-    GsmSmsMessage msg;
-    msg.smscPdu = "";
-    msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+  int serial = 0;
+  GsmSmsMessage msg;
+  msg.smscPdu = "";
+  msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
 
-    radio->sendSms(++serial, msg);
+  radio->sendSms(++serial, msg);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
-        EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+    EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
+  }
 }
 
 /*
  * Test IRadio.sendSMSExpectMore() for the response returned.
  */
 TEST_F(RadioHidlTest, sendSMSExpectMore) {
-    int serial = 0;
-    GsmSmsMessage msg;
-    msg.smscPdu = "";
-    msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+  int serial = 0;
+  GsmSmsMessage msg;
+  msg.smscPdu = "";
+  msg.pdu = "01000b916105770203f3000006d4f29c3e9b01";
 
-    radio->sendSMSExpectMore(++serial, msg);
+  radio->sendSMSExpectMore(++serial, msg);
 
-    // TODO(shuoq): add more test for this API when inserted sim card is considered
+  // TODO(shuoq): add more test for this API when inserted sim card is
+  // considered
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+  }
 }
 
 /*
  * Test IRadio.acknowledgeLastIncomingGsmSms() for the response returned.
  */
 TEST_F(RadioHidlTest, acknowledgeLastIncomingGsmSms) {
-    int serial = 0;
-    bool success = true;
+  int serial = 0;
+  bool success = true;
 
-    radio->acknowledgeLastIncomingGsmSms(++serial, success,
-        SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
+  radio->acknowledgeLastIncomingGsmSms(
+      ++serial, success, SmsAcknowledgeFailCause::MEMORY_CAPACITY_EXCEEDED);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.acknowledgeIncomingGsmSmsWithPdu() for the response returned.
  */
 TEST_F(RadioHidlTest, acknowledgeIncomingGsmSmsWithPdu) {
-    int serial = 0;
-    bool success = true;
-    std::string ackPdu = "";
+  int serial = 0;
+  bool success = true;
+  std::string ackPdu = "";
 
-    radio->acknowledgeIncomingGsmSmsWithPdu(++serial, success, ackPdu);
+  radio->acknowledgeIncomingGsmSmsWithPdu(++serial, success, ackPdu);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        // TODO(shuoq): Will add error check when we know the expected error from QC
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    // TODO(shuoq): Will add error check when we know the expected error from QC
+  }
 }
 
 /*
  * Test IRadio.sendCdmaSms() for the response returned.
  */
 TEST_F(RadioHidlTest, sendCdmaSms) {
-    int serial = 0;
+  int serial = 0;
 
-    // Create a CdmaSmsAddress
-    CdmaSmsAddress cdmaSmsAddress;
-    cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
-    cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
-    cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
-    cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
-    cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+  // Create a CdmaSmsAddress
+  CdmaSmsAddress cdmaSmsAddress;
+  cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+  cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+  cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+  cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
+  cdmaSmsAddress.digits =
+      (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
 
-    // Create a CdmaSmsSubAddress
-    CdmaSmsSubaddress cdmaSmsSubaddress;
-    cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
-    cdmaSmsSubaddress.odd = false;
-    cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
+  // Create a CdmaSmsSubAddress
+  CdmaSmsSubaddress cdmaSmsSubaddress;
+  cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
+  cdmaSmsSubaddress.odd = false;
+  cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
 
-    // Create a CdmaSmsMessage
-    android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
-    cdmaSmsMessage.teleserviceId = 4098;
-    cdmaSmsMessage.isServicePresent = false;
-    cdmaSmsMessage.serviceCategory = 0;
-    cdmaSmsMessage.address = cdmaSmsAddress;
-    cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
-    cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
-        {15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+  // Create a CdmaSmsMessage
+  android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
+  cdmaSmsMessage.teleserviceId = 4098;
+  cdmaSmsMessage.isServicePresent = false;
+  cdmaSmsMessage.serviceCategory = 0;
+  cdmaSmsMessage.address = cdmaSmsAddress;
+  cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+  cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
+      15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
 
-    radio->sendCdmaSms(++serial, cdmaSmsMessage);
+  radio->sendCdmaSms(++serial, cdmaSmsMessage);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+  }
 }
 
 /*
  * Test IRadio.acknowledgeLastIncomingCdmaSms() for the response returned.
  */
 TEST_F(RadioHidlTest, acknowledgeLastIncomingCdmaSms) {
-    int serial = 0;
+  int serial = 0;
 
-    // Create a CdmaSmsAck
-    CdmaSmsAck cdmaSmsAck;
-    cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
-    cdmaSmsAck.smsCauseCode = 1;
+  // Create a CdmaSmsAck
+  CdmaSmsAck cdmaSmsAck;
+  cdmaSmsAck.errorClass = CdmaSmsErrorClass::NO_ERROR;
+  cdmaSmsAck.smsCauseCode = 1;
 
-    radio->acknowledgeLastIncomingCdmaSms(++serial, cdmaSmsAck);
+  radio->acknowledgeLastIncomingCdmaSms(++serial, cdmaSmsAck);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NO_SMS_TO_ACK, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.sendImsSms() for the response returned.
  */
 TEST_F(RadioHidlTest, sendImsSms) {
-    int serial = 1;
+  int serial = 1;
 
-    // Create a CdmaSmsAddress
-    CdmaSmsAddress cdmaSmsAddress;
-    cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
-    cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
-    cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
-    cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
-    cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+  // Create a CdmaSmsAddress
+  CdmaSmsAddress cdmaSmsAddress;
+  cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+  cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+  cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+  cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
+  cdmaSmsAddress.digits =
+      (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
 
-    // Create a CdmaSmsSubAddress
-    CdmaSmsSubaddress cdmaSmsSubaddress;
-    cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
-    cdmaSmsSubaddress.odd = false;
-    cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
+  // Create a CdmaSmsSubAddress
+  CdmaSmsSubaddress cdmaSmsSubaddress;
+  cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
+  cdmaSmsSubaddress.odd = false;
+  cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
 
-    // Create a CdmaSmsMessage
-    CdmaSmsMessage cdmaSmsMessage;
-    cdmaSmsMessage.teleserviceId = 4098;
-    cdmaSmsMessage.isServicePresent = false;
-    cdmaSmsMessage.serviceCategory = 0;
-    cdmaSmsMessage.address = cdmaSmsAddress;
-    cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
-    cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
-        {15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+  // Create a CdmaSmsMessage
+  CdmaSmsMessage cdmaSmsMessage;
+  cdmaSmsMessage.teleserviceId = 4098;
+  cdmaSmsMessage.isServicePresent = false;
+  cdmaSmsMessage.serviceCategory = 0;
+  cdmaSmsMessage.address = cdmaSmsAddress;
+  cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+  cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
+      15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
 
-    // Creata an ImsSmsMessage
-    ImsSmsMessage msg;
-    msg.tech = RadioTechnologyFamily::THREE_GPP2;
-    msg.retry = false;
-    msg.messageRef = 0;
-    msg.cdmaMessage = (std::vector<CdmaSmsMessage>) {cdmaSmsMessage};
-    msg.gsmMessage = (std::vector<GsmSmsMessage>) {};
+  // Creata an ImsSmsMessage
+  ImsSmsMessage msg;
+  msg.tech = RadioTechnologyFamily::THREE_GPP2;
+  msg.retry = false;
+  msg.messageRef = 0;
+  msg.cdmaMessage = (std::vector<CdmaSmsMessage>){cdmaSmsMessage};
+  msg.gsmMessage = (std::vector<GsmSmsMessage>){};
 
-    radio->sendImsSms(serial, msg);
+  radio->sendImsSms(serial, msg);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.getSmscAddress() for the response returned.
  */
 TEST_F(RadioHidlTest, getSmscAddress) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->getSmscAddress(++serial);
+  radio->getSmscAddress(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+  }
 }
 
 /*
  * Test IRadio.setSmscAddress() for the response returned.
  */
 TEST_F(RadioHidlTest, setSmscAddress) {
-    int serial = 0;
-    hidl_string address = hidl_string("smscAddress");
+  int serial = 0;
+  hidl_string address = hidl_string("smscAddress");
 
-    radio->setSmscAddress(++serial, address);
+  radio->setSmscAddress(++serial, address);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.writeSmsToSim() for the response returned.
  */
 TEST_F(RadioHidlTest, writeSmsToSim) {
-    int serial = 0;
-    SmsWriteArgs smsWriteArgs;
-    smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
-    smsWriteArgs.smsc = "";
-    smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
+  int serial = 0;
+  SmsWriteArgs smsWriteArgs;
+  smsWriteArgs.status = SmsWriteArgsStatus::REC_UNREAD;
+  smsWriteArgs.smsc = "";
+  smsWriteArgs.pdu = "01000b916105770203f3000006d4f29c3e9b01";
 
-    radio->writeSmsToSim(++serial, smsWriteArgs);
+  radio->writeSmsToSim(++serial, smsWriteArgs);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.deleteSmsOnSim() for the response returned.
  */
 TEST_F(RadioHidlTest, deleteSmsOnSim) {
-    int serial = 0;
-    int index = 1;
+  int serial = 0;
+  int index = 1;
 
-    radio->deleteSmsOnSim(++serial, index);
+  radio->deleteSmsOnSim(++serial, index);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::INVALID_SMS_FORMAT, radioRsp->rspInfo.error);
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
+  }
 }
 
 /*
  * Test IRadio.writeSmsToRuim() for the response returned.
  */
 TEST_F(RadioHidlTest, writeSmsToRuim) {
-    int serial = 0;
+  int serial = 0;
 
-    // Create a CdmaSmsAddress
-    CdmaSmsAddress cdmaSmsAddress;
-    cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
-    cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
-    cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
-    cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
-    cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+  // Create a CdmaSmsAddress
+  CdmaSmsAddress cdmaSmsAddress;
+  cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+  cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+  cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+  cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
+  cdmaSmsAddress.digits =
+      (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
 
-    // Create a CdmaSmsSubAddress
-    CdmaSmsSubaddress cdmaSmsSubaddress;
-    cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
-    cdmaSmsSubaddress.odd = false;
-    cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
+  // Create a CdmaSmsSubAddress
+  CdmaSmsSubaddress cdmaSmsSubaddress;
+  cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
+  cdmaSmsSubaddress.odd = false;
+  cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
 
-    // Create a CdmaSmsMessage
-    CdmaSmsMessage cdmaSmsMessage;
-    cdmaSmsMessage.teleserviceId = 4098;
-    cdmaSmsMessage.isServicePresent = false;
-    cdmaSmsMessage.serviceCategory = 0;
-    cdmaSmsMessage.address = cdmaSmsAddress;
-    cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
-    cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
-        {15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+  // Create a CdmaSmsMessage
+  CdmaSmsMessage cdmaSmsMessage;
+  cdmaSmsMessage.teleserviceId = 4098;
+  cdmaSmsMessage.isServicePresent = false;
+  cdmaSmsMessage.serviceCategory = 0;
+  cdmaSmsMessage.address = cdmaSmsAddress;
+  cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+  cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
+      15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
 
-    // Create a CdmaSmsWriteArgs
-    CdmaSmsWriteArgs cdmaSmsWriteArgs;
-    cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
-    cdmaSmsWriteArgs.message = cdmaSmsMessage;
+  // Create a CdmaSmsWriteArgs
+  CdmaSmsWriteArgs cdmaSmsWriteArgs;
+  cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
+  cdmaSmsWriteArgs.message = cdmaSmsMessage;
 
-    radio->writeSmsToRuim(++serial, cdmaSmsWriteArgs);
+  radio->writeSmsToRuim(++serial, cdmaSmsWriteArgs);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.deleteSmsOnRuim() for the response returned.
  */
 TEST_F(RadioHidlTest, deleteSmsOnRuim) {
-    int serial = 0;
-    int index = 1;
+  int serial = 0;
+  int index = 1;
 
-    // Create a CdmaSmsAddress
-    CdmaSmsAddress cdmaSmsAddress;
-    cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
-    cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
-    cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
-    cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
-    cdmaSmsAddress.digits = (std::vector<uint8_t>) {11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+  // Create a CdmaSmsAddress
+  CdmaSmsAddress cdmaSmsAddress;
+  cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+  cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+  cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+  cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
+  cdmaSmsAddress.digits =
+      (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
 
-    // Create a CdmaSmsSubAddress
-    CdmaSmsSubaddress cdmaSmsSubaddress;
-    cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
-    cdmaSmsSubaddress.odd = false;
-    cdmaSmsSubaddress.digits = (std::vector<uint8_t>) {};
+  // Create a CdmaSmsSubAddress
+  CdmaSmsSubaddress cdmaSmsSubaddress;
+  cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
+  cdmaSmsSubaddress.odd = false;
+  cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
 
-    // Create a CdmaSmsMessage
-    CdmaSmsMessage cdmaSmsMessage;
-    cdmaSmsMessage.teleserviceId = 4098;
-    cdmaSmsMessage.isServicePresent = false;
-    cdmaSmsMessage.serviceCategory = 0;
-    cdmaSmsMessage.address = cdmaSmsAddress;
-    cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
-    cdmaSmsMessage.bearerData = (std::vector<uint8_t>)
-        {15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+  // Create a CdmaSmsMessage
+  CdmaSmsMessage cdmaSmsMessage;
+  cdmaSmsMessage.teleserviceId = 4098;
+  cdmaSmsMessage.isServicePresent = false;
+  cdmaSmsMessage.serviceCategory = 0;
+  cdmaSmsMessage.address = cdmaSmsAddress;
+  cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+  cdmaSmsMessage.bearerData = (std::vector<uint8_t>){
+      15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
 
-    // Create a CdmaSmsWriteArgs
-    CdmaSmsWriteArgs cdmaSmsWriteArgs;
-    cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
-    cdmaSmsWriteArgs.message = cdmaSmsMessage;
+  // Create a CdmaSmsWriteArgs
+  CdmaSmsWriteArgs cdmaSmsWriteArgs;
+  cdmaSmsWriteArgs.status = CdmaSmsWriteArgsStatus::REC_UNREAD;
+  cdmaSmsWriteArgs.message = cdmaSmsMessage;
 
-    radio->deleteSmsOnRuim(++serial, index);
+  radio->deleteSmsOnRuim(++serial, index);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
+  }
 }
 
 /*
  * Test IRadio.reportSmsMemoryStatus() for the response returned.
  */
 TEST_F(RadioHidlTest, reportSmsMemoryStatus) {
-    int serial = 0;
-    bool available = true;
+  int serial = 0;
+  bool available = true;
 
-    radio->reportSmsMemoryStatus(++serial, available);
+  radio->reportSmsMemoryStatus(++serial, available);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+  }
 }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
index f6d576d..b02a740 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 using namespace ::android::hardware::radio::V1_0;
 
@@ -22,132 +22,133 @@
  * Test IRadio.sendEnvelope() for the response returned.
  */
 TEST_F(RadioHidlTest, sendEnvelope) {
-    int serial = 0;
+  int serial = 0;
 
-    // Test with sending empty string
-    std::string content = "";
+  // Test with sending empty string
+  std::string content = "";
 
-    radio->sendEnvelope(++serial, content);
+  radio->sendEnvelope(++serial, content);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 
-    // Test with sending random string
-    content = "0";
+  // Test with sending random string
+  content = "0";
 
-    radio->sendEnvelope(++serial, content);
+  radio->sendEnvelope(++serial, content);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.sendTerminalResponseToSim() for the response returned.
  */
 TEST_F(RadioHidlTest, sendTerminalResponseToSim) {
-    int serial = 0;
+  int serial = 0;
 
-    // Test with sending empty string
-    std::string commandResponse = "";
+  // Test with sending empty string
+  std::string commandResponse = "";
 
-    radio->sendTerminalResponseToSim(++serial, commandResponse);
+  radio->sendTerminalResponseToSim(++serial, commandResponse);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 
-    // Test with sending random string
-    commandResponse = "0";
+  // Test with sending random string
+  commandResponse = "0";
 
-    radio->sendTerminalResponseToSim(++serial, commandResponse);
+  radio->sendTerminalResponseToSim(++serial, commandResponse);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.handleStkCallSetupRequestFromSim() for the response returned.
  */
 TEST_F(RadioHidlTest, handleStkCallSetupRequestFromSim) {
-    int serial = 0;
-    bool accept = false;
+  int serial = 0;
+  bool accept = false;
 
-    radio->handleStkCallSetupRequestFromSim(++serial, accept);
+  radio->handleStkCallSetupRequestFromSim(++serial, accept);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
  * Test IRadio.reportStkServiceIsRunning() for the response returned.
  */
 TEST_F(RadioHidlTest, reportStkServiceIsRunning) {
-    int serial = 0;
+  int serial = 0;
 
-    radio->reportStkServiceIsRunning(++serial);
+  radio->reportStkServiceIsRunning(++serial);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 }
 
 /*
- * Test IRadio.sendEnvelopeWithStatus() for the response returned with empty string.
+ * Test IRadio.sendEnvelopeWithStatus() for the response returned with empty
+ * string.
  */
 TEST_F(RadioHidlTest, sendEnvelopeWithStatus) {
-    int serial = 0;
+  int serial = 0;
 
-    // Test with sending empty string
-    std::string contents = "";
+  // Test with sending empty string
+  std::string contents = "";
 
-    radio->sendEnvelopeWithStatus(++serial, contents);
+  radio->sendEnvelopeWithStatus(++serial, contents);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  }
 
-    // Test with sending random string
-    contents = "0";
+  // Test with sending random string
+  contents = "0";
 
-    radio->sendEnvelopeWithStatus(++serial, contents);
+  radio->sendEnvelopeWithStatus(++serial, contents);
 
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_FALSE(RadioError::NONE == radioRsp->rspInfo.error);
+  }
 }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index db7356f..9094f39 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -14,48 +14,47 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 void RadioHidlTest::SetUp() {
-    radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(hidl_string("rild"));
-    ASSERT_NE(radio, nullptr);
+  radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(
+      hidl_string("rild"));
+  ASSERT_NE(radio, nullptr);
 
-    radioRsp = new RadioResponse(*this);
-    ASSERT_NE(radioRsp, nullptr);
+  radioRsp = new RadioResponse(*this);
+  ASSERT_NE(radioRsp, nullptr);
 
-    count = 0;
+  count = 0;
 
-    radioInd = NULL;
-    radio->setResponseFunctions(radioRsp, radioInd);
+  radioInd = NULL;
+  radio->setResponseFunctions(radioRsp, radioInd);
 
-    radio->getIccCardStatus(1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(1, radioRsp->rspInfo.serial);
-    EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+  radio->getIccCardStatus(1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(1, radioRsp->rspInfo.serial);
+  EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
 }
 
-void RadioHidlTest::TearDown() {
-}
+void RadioHidlTest::TearDown() {}
 
 void RadioHidlTest::notify() {
-    std::unique_lock<std::mutex> lock(mtx);
-    count++;
-    cv.notify_one();
+  std::unique_lock<std::mutex> lock(mtx);
+  count++;
+  cv.notify_one();
 }
 
 std::cv_status RadioHidlTest::wait() {
-    std::unique_lock<std::mutex> lock(mtx);
+  std::unique_lock<std::mutex> lock(mtx);
 
-    std::cv_status status = std::cv_status::no_timeout;
-    auto now = std::chrono::system_clock::now();
-    while (count == 0) {
-        status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
-        if (status == std::cv_status::timeout) {
-            return status;
-        }
+  std::cv_status status = std::cv_status::no_timeout;
+  auto now = std::chrono::system_clock::now();
+  while (count == 0) {
+    status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+    if (status == std::cv_status::timeout) {
+      return status;
     }
-    count--;
-    return status;
+  }
+  count--;
+  return status;
 }
-
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
index 126ad0d..6826238 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -22,8 +22,8 @@
 #include <mutex>
 
 #include <android/hardware/radio/1.0/IRadio.h>
-#include <android/hardware/radio/1.0/IRadioResponse.h>
 #include <android/hardware/radio/1.0/IRadioIndication.h>
+#include <android/hardware/radio/1.0/IRadioResponse.h>
 #include <android/hardware/radio/1.0/types.h>
 
 using ::android::hardware::radio::V1_0::ActivityStatsInfo;
@@ -87,387 +87,426 @@
 
 /* Callback class for radio response */
 class RadioResponse : public IRadioResponse {
-private:
-    RadioHidlTest& parent;
+ private:
+  RadioHidlTest& parent;
 
-public:
-    RadioResponseInfo rspInfo;
-    hidl_string imsi;
-    IccIoResult iccIoResult;
-    int channelId;
+ public:
+  RadioResponseInfo rspInfo;
+  hidl_string imsi;
+  IccIoResult iccIoResult;
+  int channelId;
 
-    // Sms
-    SendSmsResult sendSmsResult;
-    hidl_string smscAddress;
-    uint32_t writeSmsToSimIndex;
-    uint32_t writeSmsToRuimIndex;
+  // Sms
+  SendSmsResult sendSmsResult;
+  hidl_string smscAddress;
+  uint32_t writeSmsToSimIndex;
+  uint32_t writeSmsToRuimIndex;
 
-    RadioResponse(RadioHidlTest& parent);
+  RadioResponse(RadioHidlTest& parent);
 
-    virtual ~RadioResponse() = default;
+  virtual ~RadioResponse() = default;
 
-    Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
-            const CardStatus& cardStatus);
+  Return<void> getIccCardStatusResponse(const RadioResponseInfo& info,
+                                        const CardStatus& cardStatus);
 
-    Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> supplyIccPinForAppResponse(const RadioResponseInfo& info,
+                                          int32_t remainingRetries);
 
-    Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> supplyIccPukForAppResponse(const RadioResponseInfo& info,
+                                          int32_t remainingRetries);
 
-    Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> supplyIccPin2ForAppResponse(const RadioResponseInfo& info,
+                                           int32_t remainingRetries);
 
-    Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> supplyIccPuk2ForAppResponse(const RadioResponseInfo& info,
+                                           int32_t remainingRetries);
 
-    Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> changeIccPinForAppResponse(const RadioResponseInfo& info,
+                                          int32_t remainingRetries);
 
-    Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
-            int32_t remainingRetries);
+  Return<void> changeIccPin2ForAppResponse(const RadioResponseInfo& info,
+                                           int32_t remainingRetries);
 
-    Return<void> supplyNetworkDepersonalizationResponse(
-            const RadioResponseInfo& info, int32_t remainingRetries);
+  Return<void> supplyNetworkDepersonalizationResponse(
+      const RadioResponseInfo& info, int32_t remainingRetries);
 
-    Return<void> getCurrentCallsResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<Call>& calls);
+  Return<void> getCurrentCallsResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<Call>& calls);
 
-    Return<void> dialResponse(const RadioResponseInfo& info);
+  Return<void> dialResponse(const RadioResponseInfo& info);
 
-    Return<void> getIMSIForAppResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& imsi);
+  Return<void> getIMSIForAppResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& imsi);
 
-    Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
+  Return<void> hangupConnectionResponse(const RadioResponseInfo& info);
 
-    Return<void> hangupWaitingOrBackgroundResponse(
-            const RadioResponseInfo& info);
+  Return<void> hangupWaitingOrBackgroundResponse(const RadioResponseInfo& info);
 
-    Return<void> hangupForegroundResumeBackgroundResponse(
-            const RadioResponseInfo& info);
+  Return<void> hangupForegroundResumeBackgroundResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> switchWaitingOrHoldingAndActiveResponse(
-            const RadioResponseInfo& info);
+  Return<void> switchWaitingOrHoldingAndActiveResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> conferenceResponse(const RadioResponseInfo& info);
+  Return<void> conferenceResponse(const RadioResponseInfo& info);
 
-    Return<void> rejectCallResponse(const RadioResponseInfo& info);
+  Return<void> rejectCallResponse(const RadioResponseInfo& info);
 
-    Return<void> getLastCallFailCauseResponse(const RadioResponseInfo& info,
-            const LastCallFailCauseInfo& failCauseInfo);
+  Return<void> getLastCallFailCauseResponse(
+      const RadioResponseInfo& info,
+      const LastCallFailCauseInfo& failCauseInfo);
 
-    Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
-            const SignalStrength& sigStrength);
+  Return<void> getSignalStrengthResponse(const RadioResponseInfo& info,
+                                         const SignalStrength& sigStrength);
 
-    Return<void> getVoiceRegistrationStateResponse(const RadioResponseInfo& info,
-            const VoiceRegStateResult& voiceRegResponse);
+  Return<void> getVoiceRegistrationStateResponse(
+      const RadioResponseInfo& info,
+      const VoiceRegStateResult& voiceRegResponse);
 
-    Return<void> getDataRegistrationStateResponse(const RadioResponseInfo& info,
-            const DataRegStateResult& dataRegResponse);
+  Return<void> getDataRegistrationStateResponse(
+      const RadioResponseInfo& info, const DataRegStateResult& dataRegResponse);
 
-    Return<void> getOperatorResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& longName,
-            const ::android::hardware::hidl_string& shortName,
-            const ::android::hardware::hidl_string& numeric);
+  Return<void> getOperatorResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& longName,
+      const ::android::hardware::hidl_string& shortName,
+      const ::android::hardware::hidl_string& numeric);
 
-    Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
+  Return<void> setRadioPowerResponse(const RadioResponseInfo& info);
 
-    Return<void> sendDtmfResponse(const RadioResponseInfo& info);
+  Return<void> sendDtmfResponse(const RadioResponseInfo& info);
 
-    Return<void> sendSmsResponse(const RadioResponseInfo& info,
-            const SendSmsResult& sms);
+  Return<void> sendSmsResponse(const RadioResponseInfo& info,
+                               const SendSmsResult& sms);
 
-    Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info,
-            const SendSmsResult& sms);
+  Return<void> sendSMSExpectMoreResponse(const RadioResponseInfo& info,
+                                         const SendSmsResult& sms);
 
-    Return<void> setupDataCallResponse(const RadioResponseInfo& info,
-            const SetupDataCallResult& dcResponse);
+  Return<void> setupDataCallResponse(const RadioResponseInfo& info,
+                                     const SetupDataCallResult& dcResponse);
 
-    Return<void> iccIOForAppResponse(const RadioResponseInfo& info,
-            const IccIoResult& iccIo);
+  Return<void> iccIOForAppResponse(const RadioResponseInfo& info,
+                                   const IccIoResult& iccIo);
 
-    Return<void> sendUssdResponse(const RadioResponseInfo& info);
+  Return<void> sendUssdResponse(const RadioResponseInfo& info);
 
-    Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
+  Return<void> cancelPendingUssdResponse(const RadioResponseInfo& info);
 
-    Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n, int32_t m);
+  Return<void> getClirResponse(const RadioResponseInfo& info, int32_t n,
+                               int32_t m);
 
-    Return<void> setClirResponse(const RadioResponseInfo& info);
+  Return<void> setClirResponse(const RadioResponseInfo& info);
 
-    Return<void> getCallForwardStatusResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
+  Return<void> getCallForwardStatusResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<CallForwardInfo>& call_forwardInfos);
 
-    Return<void> setCallForwardResponse(const RadioResponseInfo& info);
+  Return<void> setCallForwardResponse(const RadioResponseInfo& info);
 
-    Return<void> getCallWaitingResponse(const RadioResponseInfo& info,
-            bool enable, int32_t serviceClass);
+  Return<void> getCallWaitingResponse(const RadioResponseInfo& info,
+                                      bool enable, int32_t serviceClass);
 
-    Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
+  Return<void> setCallWaitingResponse(const RadioResponseInfo& info);
 
-    Return<void> acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info);
+  Return<void> acknowledgeLastIncomingGsmSmsResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> acceptCallResponse(const RadioResponseInfo& info);
+  Return<void> acceptCallResponse(const RadioResponseInfo& info);
 
-    Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
+  Return<void> deactivateDataCallResponse(const RadioResponseInfo& info);
 
-    Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info,int32_t response);
+  Return<void> getFacilityLockForAppResponse(const RadioResponseInfo& info,
+                                             int32_t response);
 
-    Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info,int32_t retry);
+  Return<void> setFacilityLockForAppResponse(const RadioResponseInfo& info,
+                                             int32_t retry);
 
-    Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
+  Return<void> setBarringPasswordResponse(const RadioResponseInfo& info);
 
-    Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info,bool manual);
+  Return<void> getNetworkSelectionModeResponse(const RadioResponseInfo& info,
+                                               bool manual);
 
-    Return<void> setNetworkSelectionModeAutomaticResponse(const RadioResponseInfo& info);
+  Return<void> setNetworkSelectionModeAutomaticResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> setNetworkSelectionModeManualResponse(const RadioResponseInfo& info);
+  Return<void> setNetworkSelectionModeManualResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> getAvailableNetworksResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
+  Return<void> getAvailableNetworksResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<OperatorInfo>& networkInfos);
 
-    Return<void> startDtmfResponse(const RadioResponseInfo& info);
+  Return<void> startDtmfResponse(const RadioResponseInfo& info);
 
-    Return<void> stopDtmfResponse(const RadioResponseInfo& info);
+  Return<void> stopDtmfResponse(const RadioResponseInfo& info);
 
-    Return<void> getBasebandVersionResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& version);
+  Return<void> getBasebandVersionResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& version);
 
-    Return<void> separateConnectionResponse(const RadioResponseInfo& info);
+  Return<void> separateConnectionResponse(const RadioResponseInfo& info);
 
-    Return<void> setMuteResponse(const RadioResponseInfo& info);
+  Return<void> setMuteResponse(const RadioResponseInfo& info);
 
-    Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
+  Return<void> getMuteResponse(const RadioResponseInfo& info, bool enable);
 
-    Return<void> getClipResponse(const RadioResponseInfo& info,ClipStatus status);
+  Return<void> getClipResponse(const RadioResponseInfo& info,
+                               ClipStatus status);
 
-    Return<void> getDataCallListResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
+  Return<void> getDataCallListResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<SetupDataCallResult>& dcResponse);
 
-    Return<void> sendOemRilRequestRawResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<uint8_t>& data);
+  Return<void> sendOemRilRequestRawResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<uint8_t>& data);
 
-    Return<void> sendOemRilRequestStringsResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data);
+  Return<void> sendOemRilRequestStringsResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<::android::hardware::hidl_string>&
+          data);
 
-    Return<void> setSuppServiceNotificationsResponse(
-            const RadioResponseInfo& info);
+  Return<void> setSuppServiceNotificationsResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> writeSmsToSimResponse(const RadioResponseInfo& info,int32_t index);
+  Return<void> writeSmsToSimResponse(const RadioResponseInfo& info,
+                                     int32_t index);
 
-    Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
+  Return<void> deleteSmsOnSimResponse(const RadioResponseInfo& info);
 
-    Return<void> setBandModeResponse(const RadioResponseInfo& info);
+  Return<void> setBandModeResponse(const RadioResponseInfo& info);
 
-    Return<void> getAvailableBandModesResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
+  Return<void> getAvailableBandModesResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<RadioBandMode>& bandModes);
 
-    Return<void> sendEnvelopeResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& commandResponse);
+  Return<void> sendEnvelopeResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& commandResponse);
 
-    Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
+  Return<void> sendTerminalResponseToSimResponse(const RadioResponseInfo& info);
 
-    Return<void> handleStkCallSetupRequestFromSimResponse(
-            const RadioResponseInfo& info);
+  Return<void> handleStkCallSetupRequestFromSimResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
+  Return<void> explicitCallTransferResponse(const RadioResponseInfo& info);
 
-    Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
+  Return<void> setPreferredNetworkTypeResponse(const RadioResponseInfo& info);
 
-    Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
-            PreferredNetworkType nwType);
+  Return<void> getPreferredNetworkTypeResponse(const RadioResponseInfo& info,
+                                               PreferredNetworkType nwType);
 
-    Return<void> getNeighboringCidsResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<NeighboringCell>& cells);
+  Return<void> getNeighboringCidsResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<NeighboringCell>& cells);
 
-    Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
+  Return<void> setLocationUpdatesResponse(const RadioResponseInfo& info);
 
-    Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
+  Return<void> setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info);
 
-    Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
+  Return<void> setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info);
 
-    Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
-            CdmaRoamingType type);
+  Return<void> getCdmaRoamingPreferenceResponse(const RadioResponseInfo& info,
+                                                CdmaRoamingType type);
 
-    Return<void> setTTYModeResponse(const RadioResponseInfo& info);
+  Return<void> setTTYModeResponse(const RadioResponseInfo& info);
 
-    Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
+  Return<void> getTTYModeResponse(const RadioResponseInfo& info, TtyMode mode);
 
-    Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
+  Return<void> setPreferredVoicePrivacyResponse(const RadioResponseInfo& info);
 
-    Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info, bool enable);
+  Return<void> getPreferredVoicePrivacyResponse(const RadioResponseInfo& info,
+                                                bool enable);
 
-    Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
+  Return<void> sendCDMAFeatureCodeResponse(const RadioResponseInfo& info);
 
-    Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
+  Return<void> sendBurstDtmfResponse(const RadioResponseInfo& info);
 
-    Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info, const SendSmsResult& sms);
+  Return<void> sendCdmaSmsResponse(const RadioResponseInfo& info,
+                                   const SendSmsResult& sms);
 
-    Return<void> acknowledgeLastIncomingCdmaSmsResponse(const RadioResponseInfo& info);
+  Return<void> acknowledgeLastIncomingCdmaSmsResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> getGsmBroadcastConfigResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
+  Return<void> getGsmBroadcastConfigResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& configs);
 
-    Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
+  Return<void> setGsmBroadcastConfigResponse(const RadioResponseInfo& info);
 
-    Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
+  Return<void> setGsmBroadcastActivationResponse(const RadioResponseInfo& info);
 
-    Return<void> getCdmaBroadcastConfigResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
+  Return<void> getCdmaBroadcastConfigResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& configs);
 
-    Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
+  Return<void> setCdmaBroadcastConfigResponse(const RadioResponseInfo& info);
 
-    Return<void> setCdmaBroadcastActivationResponse(const RadioResponseInfo& info);
+  Return<void> setCdmaBroadcastActivationResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> getCDMASubscriptionResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& mdn,
-            const ::android::hardware::hidl_string& hSid,
-            const ::android::hardware::hidl_string& hNid,
-            const ::android::hardware::hidl_string& min,
-            const ::android::hardware::hidl_string& prl);
+  Return<void> getCDMASubscriptionResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& mdn,
+      const ::android::hardware::hidl_string& hSid,
+      const ::android::hardware::hidl_string& hNid,
+      const ::android::hardware::hidl_string& min,
+      const ::android::hardware::hidl_string& prl);
 
-    Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info, uint32_t index);
+  Return<void> writeSmsToRuimResponse(const RadioResponseInfo& info,
+                                      uint32_t index);
 
-    Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
+  Return<void> deleteSmsOnRuimResponse(const RadioResponseInfo& info);
 
-    Return<void> getDeviceIdentityResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& imei,
-            const ::android::hardware::hidl_string& imeisv,
-            const ::android::hardware::hidl_string& esn,
-            const ::android::hardware::hidl_string& meid);
+  Return<void> getDeviceIdentityResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& imei,
+      const ::android::hardware::hidl_string& imeisv,
+      const ::android::hardware::hidl_string& esn,
+      const ::android::hardware::hidl_string& meid);
 
-    Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
+  Return<void> exitEmergencyCallbackModeResponse(const RadioResponseInfo& info);
 
-    Return<void> getSmscAddressResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& smsc);
+  Return<void> getSmscAddressResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& smsc);
 
-    Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
+  Return<void> setSmscAddressResponse(const RadioResponseInfo& info);
 
-    Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
+  Return<void> reportSmsMemoryStatusResponse(const RadioResponseInfo& info);
 
-    Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
+  Return<void> reportStkServiceIsRunningResponse(const RadioResponseInfo& info);
 
-    Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
-            CdmaSubscriptionSource source);
+  Return<void> getCdmaSubscriptionSourceResponse(const RadioResponseInfo& info,
+                                                 CdmaSubscriptionSource source);
 
-    Return<void> requestIsimAuthenticationResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& response);
+  Return<void> requestIsimAuthenticationResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& response);
 
-    Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
-            const RadioResponseInfo& info);
+  Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
+      const RadioResponseInfo& info);
 
-    Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
-            const IccIoResult& iccIo);
+  Return<void> sendEnvelopeWithStatusResponse(const RadioResponseInfo& info,
+                                              const IccIoResult& iccIo);
 
-    Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
-            RadioTechnology rat);
+  Return<void> getVoiceRadioTechnologyResponse(const RadioResponseInfo& info,
+                                               RadioTechnology rat);
 
-    Return<void> getCellInfoListResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
+  Return<void> getCellInfoListResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<CellInfo>& cellInfo);
 
-    Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
+  Return<void> setCellInfoListRateResponse(const RadioResponseInfo& info);
 
-    Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
+  Return<void> setInitialAttachApnResponse(const RadioResponseInfo& info);
 
-    Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info,
-            bool isRegistered, RadioTechnologyFamily ratFamily);
+  Return<void> getImsRegistrationStateResponse(const RadioResponseInfo& info,
+                                               bool isRegistered,
+                                               RadioTechnologyFamily ratFamily);
 
-    Return<void> sendImsSmsResponse(const RadioResponseInfo& info,
-            const SendSmsResult& sms);
+  Return<void> sendImsSmsResponse(const RadioResponseInfo& info,
+                                  const SendSmsResult& sms);
 
-    Return<void> iccTransmitApduBasicChannelResponse(
-            const RadioResponseInfo& info, const IccIoResult& result);
+  Return<void> iccTransmitApduBasicChannelResponse(
+      const RadioResponseInfo& info, const IccIoResult& result);
 
-    Return<void> iccOpenLogicalChannelResponse(const RadioResponseInfo& info,
-            int32_t channelId, const ::android::hardware::hidl_vec<int8_t>& selectResponse);
+  Return<void> iccOpenLogicalChannelResponse(
+      const RadioResponseInfo& info, int32_t channelId,
+      const ::android::hardware::hidl_vec<int8_t>& selectResponse);
 
-    Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
+  Return<void> iccCloseLogicalChannelResponse(const RadioResponseInfo& info);
 
-    Return<void> iccTransmitApduLogicalChannelResponse(
-            const RadioResponseInfo& info, const IccIoResult& result);
+  Return<void> iccTransmitApduLogicalChannelResponse(
+      const RadioResponseInfo& info, const IccIoResult& result);
 
-    Return<void> nvReadItemResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_string& result);
+  Return<void> nvReadItemResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_string& result);
 
-    Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
+  Return<void> nvWriteItemResponse(const RadioResponseInfo& info);
 
-    Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
+  Return<void> nvWriteCdmaPrlResponse(const RadioResponseInfo& info);
 
-    Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
+  Return<void> nvResetConfigResponse(const RadioResponseInfo& info);
 
-    Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
+  Return<void> setUiccSubscriptionResponse(const RadioResponseInfo& info);
 
-    Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
+  Return<void> setDataAllowedResponse(const RadioResponseInfo& info);
 
-    Return<void> getHardwareConfigResponse(const RadioResponseInfo& info,
-            const ::android::hardware::hidl_vec<HardwareConfig>& config);
+  Return<void> getHardwareConfigResponse(
+      const RadioResponseInfo& info,
+      const ::android::hardware::hidl_vec<HardwareConfig>& config);
 
-    Return<void> requestIccSimAuthenticationResponse(
-            const RadioResponseInfo& info, const IccIoResult& result);
+  Return<void> requestIccSimAuthenticationResponse(
+      const RadioResponseInfo& info, const IccIoResult& result);
 
-    Return<void> setDataProfileResponse(const RadioResponseInfo& info);
+  Return<void> setDataProfileResponse(const RadioResponseInfo& info);
 
-    Return<void> requestShutdownResponse(const RadioResponseInfo& info);
+  Return<void> requestShutdownResponse(const RadioResponseInfo& info);
 
-    Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
-            const RadioCapability& rc);
+  Return<void> getRadioCapabilityResponse(const RadioResponseInfo& info,
+                                          const RadioCapability& rc);
 
-    Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
-            const RadioCapability& rc);
+  Return<void> setRadioCapabilityResponse(const RadioResponseInfo& info,
+                                          const RadioCapability& rc);
 
-    Return<void> startLceServiceResponse(const RadioResponseInfo& info,
-            const LceStatusInfo& statusInfo);
+  Return<void> startLceServiceResponse(const RadioResponseInfo& info,
+                                       const LceStatusInfo& statusInfo);
 
-    Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
-            const LceStatusInfo& statusInfo);
+  Return<void> stopLceServiceResponse(const RadioResponseInfo& info,
+                                      const LceStatusInfo& statusInfo);
 
-    Return<void> pullLceDataResponse(const RadioResponseInfo& info,
-            const LceDataInfo& lceInfo);
+  Return<void> pullLceDataResponse(const RadioResponseInfo& info,
+                                   const LceDataInfo& lceInfo);
 
-    Return<void> getModemActivityInfoResponse(const RadioResponseInfo& info,
-            const ActivityStatsInfo& activityInfo);
+  Return<void> getModemActivityInfoResponse(
+      const RadioResponseInfo& info, const ActivityStatsInfo& activityInfo);
 
-    Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info,
-            int32_t numAllowed);
+  Return<void> setAllowedCarriersResponse(const RadioResponseInfo& info,
+                                          int32_t numAllowed);
 
-    Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info,
-            bool allAllowed, const CarrierRestrictions& carriers);
+  Return<void> getAllowedCarriersResponse(const RadioResponseInfo& info,
+                                          bool allAllowed,
+                                          const CarrierRestrictions& carriers);
 
-    Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
+  Return<void> sendDeviceStateResponse(const RadioResponseInfo& info);
 
-    Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+  Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
 
-    Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+  Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
 
-    Return<void> acknowledgeRequest(int32_t serial);
+  Return<void> acknowledgeRequest(int32_t serial);
 };
 
 // The main test class for Radio HIDL.
 class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
-private:
-    std::mutex mtx;
-    std::condition_variable cv;
-    int count;
+ private:
+  std::mutex mtx;
+  std::condition_variable cv;
+  int count;
 
-public:
-    virtual void SetUp() override;
+ public:
+  virtual void SetUp() override;
 
-    virtual void TearDown() override;
+  virtual void TearDown() override;
 
-    /* Used as a mechanism to inform the test about data/event callback */
-    void notify();
+  /* Used as a mechanism to inform the test about data/event callback */
+  void notify();
 
-    /* Test code calls this function to wait for response */
-    std::cv_status wait();
+  /* Test code calls this function to wait for response */
+  std::cv_status wait();
 
-    sp<IRadio> radio;
-    sp<RadioResponse> radioRsp;
-    sp<IRadioIndication> radioInd;
-
+  sp<IRadio> radio;
+  sp<RadioResponse> radioRsp;
+  sp<IRadioIndication> radioInd;
 };
 
 // A class for test environment setup
 class RadioHidlEnvironment : public ::testing::Environment {
-public:
-    virtual void SetUp() {}
-    virtual void TearDown() {}
+ public:
+  virtual void SetUp() {}
+  virtual void TearDown() {}
 };
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
index fa2871d..ef10d10 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
@@ -14,471 +14,471 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 /*
  * Test IRadio.getCurrentCalls() for the response returned.
  */
 TEST_F(RadioHidlTest, getCurrentCalls) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCurrentCalls(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCurrentCalls(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.dial() for the response returned.
  */
 TEST_F(RadioHidlTest, dial) {
-    int serial = 1;
+  int serial = 1;
 
-    Dial dialInfo;
-    memset(&dialInfo, 0, sizeof(dialInfo));
-    dialInfo.address = hidl_string("123456789");
+  Dial dialInfo;
+  memset(&dialInfo, 0, sizeof(dialInfo));
+  dialInfo.address = hidl_string("123456789");
 
-    radio->dial(serial, dialInfo);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->dial(serial, dialInfo);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.hangup() for the response returned.
  */
 TEST_F(RadioHidlTest, hangup) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->hangup(serial, 1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->hangup(serial, 1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.hangupWaitingOrBackground() for the response returned.
  */
 TEST_F(RadioHidlTest, hangupWaitingOrBackground) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->hangupWaitingOrBackground(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->hangupWaitingOrBackground(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.hangupForegroundResumeBackground() for the response returned.
  */
 TEST_F(RadioHidlTest, hangupForegroundResumeBackground) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->hangupForegroundResumeBackground(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->hangupForegroundResumeBackground(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.switchWaitingOrHoldingAndActive() for the response returned.
  */
 TEST_F(RadioHidlTest, switchWaitingOrHoldingAndActive) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->switchWaitingOrHoldingAndActive(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->switchWaitingOrHoldingAndActive(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.conference() for the response returned.
  */
 TEST_F(RadioHidlTest, conference) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->conference(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->conference(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.rejectCall() for the response returned.
  */
 TEST_F(RadioHidlTest, rejectCall) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->rejectCall(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->rejectCall(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.getLastCallFailCause() for the response returned.
  */
 TEST_F(RadioHidlTest, getLastCallFailCause) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getLastCallFailCause(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getLastCallFailCause(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.sendUssd() for the response returned.
  */
 TEST_F(RadioHidlTest, sendUssd) {
-    int serial = 1;
-    radio->sendUssd(serial, hidl_string("test"));
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  int serial = 1;
+  radio->sendUssd(serial, hidl_string("test"));
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.cancelPendingUssd() for the response returned.
  */
 TEST_F(RadioHidlTest, cancelPendingUssd) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->cancelPendingUssd(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->cancelPendingUssd(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.getCallForwardStatus() for the response returned.
  */
 TEST_F(RadioHidlTest, getCallForwardStatus) {
-    int serial = 1;
-    CallForwardInfo callInfo;
-    memset(&callInfo, 0, sizeof(callInfo));
-    callInfo.number = hidl_string();
+  int serial = 1;
+  CallForwardInfo callInfo;
+  memset(&callInfo, 0, sizeof(callInfo));
+  callInfo.number = hidl_string();
 
-    radio->getCallForwardStatus(serial, callInfo);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCallForwardStatus(serial, callInfo);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setCallForward() for the response returned.
  */
 TEST_F(RadioHidlTest, setCallForward) {
-    int serial = 1;
-    CallForwardInfo callInfo;
-    memset(&callInfo, 0, sizeof(callInfo));
-    callInfo.number = hidl_string();
+  int serial = 1;
+  CallForwardInfo callInfo;
+  memset(&callInfo, 0, sizeof(callInfo));
+  callInfo.number = hidl_string();
 
-    radio->setCallForward(serial, callInfo);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setCallForward(serial, callInfo);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.getCallWaiting() for the response returned.
  */
 TEST_F(RadioHidlTest, getCallWaiting) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getCallWaiting(serial, 1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getCallWaiting(serial, 1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::NONE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::NONE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setCallWaiting() for the response returned.
  */
 TEST_F(RadioHidlTest, setCallWaiting) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setCallWaiting(serial, true, 1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setCallWaiting(serial, true, 1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.acceptCall() for the response returned.
  */
 TEST_F(RadioHidlTest, acceptCall) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->acceptCall(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->acceptCall(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.separateConnection() for the response returned.
  */
 TEST_F(RadioHidlTest, separateConnection) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->separateConnection(serial, 1);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->separateConnection(serial, 1);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.explicitCallTransfer() for the response returned.
  */
 TEST_F(RadioHidlTest, explicitCallTransfer) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->explicitCallTransfer(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->explicitCallTransfer(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.sendCDMAFeatureCode() for the response returned.
  */
 TEST_F(RadioHidlTest, sendCDMAFeatureCode) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->sendCDMAFeatureCode(serial, hidl_string());
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->sendCDMAFeatureCode(serial, hidl_string());
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
+  }
 }
 
 /*
  * Test IRadio.sendDtmf() for the response returned.
  */
 TEST_F(RadioHidlTest, sendDtmf) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->sendDtmf(serial, "1");
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->sendDtmf(serial, "1");
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::NO_RESOURCES
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+  }
 }
 
 /*
  * Test IRadio.startDtmf() for the response returned.
  */
 TEST_F(RadioHidlTest, startDtmf) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->startDtmf(serial, "1");
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->startDtmf(serial, "1");
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.stopDtmf() for the response returned.
  */
 TEST_F(RadioHidlTest, stopDtmf) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->stopDtmf(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->stopDtmf(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+  }
 }
 
 /*
  * Test IRadio.setMute() for the response returned.
  */
 TEST_F(RadioHidlTest, setMute) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->setMute(serial, true);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->setMute(serial, true);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.getMute() for the response returned.
  */
 TEST_F(RadioHidlTest, getMute) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->getMute(serial);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->getMute(serial);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+  }
 }
 
 /*
  * Test IRadio.sendBurstDtmf() for the response returned.
  */
 TEST_F(RadioHidlTest, sendBurstDtmf) {
-    int serial = 1;
+  int serial = 1;
 
-    radio->sendBurstDtmf(serial, "1", 0, 0);
-    EXPECT_EQ(std::cv_status::no_timeout, wait());
-    EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
-    EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+  radio->sendBurstDtmf(serial, "1", 0, 0);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+  EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
-    if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
-                || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
-                || radioRsp->rspInfo.error == RadioError::MODEM_ERR
-                || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR
-                || radioRsp->rspInfo.error == RadioError::INVALID_STATE);
-    }
+  if (cardStatus.cardState == CardState::ABSENT) {
+    ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+                radioRsp->rspInfo.error == RadioError::SYSTEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+                radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+                radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+  }
 }
\ No newline at end of file
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index c889a18..22c20a5 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -14,913 +14,959 @@
  * limitations under the License.
  */
 
-#include<radio_hidl_hal_utils.h>
+#include <radio_hidl_hal_utils.h>
 
 CardStatus cardStatus;
 
-RadioResponse::RadioResponse(RadioHidlTest& parent) : parent(parent) {
-}
+RadioResponse::RadioResponse(RadioHidlTest& parent) : parent(parent) {}
 
 Return<void> RadioResponse::getIccCardStatusResponse(
-        const RadioResponseInfo& info, const CardStatus& card_status) {
-    rspInfo = info;
-    cardStatus = card_status;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const CardStatus& card_status) {
+  rspInfo = info;
+  cardStatus = card_status;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::supplyIccPinForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::supplyIccPukForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::supplyIccPin2ForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
   rspInfo = info;
   parent.notify();
   return Void();
 }
 
 Return<void> RadioResponse::supplyIccPuk2ForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::changeIccPinForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::changeIccPin2ForAppResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
-        const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*remainingRetries*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCurrentCallsResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<Call>& /*calls*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<Call>& /*calls*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::dialResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getIMSIForAppResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& imsi) {
-    rspInfo = info;
-    this->imsi = imsi;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& imsi) {
+  rspInfo = info;
+  this->imsi = imsi;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::hangupConnectionResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::conferenceResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::conferenceResponse(const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::rejectCallResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::rejectCallResponse(const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getLastCallFailCauseResponse(
-        const RadioResponseInfo& info, const LastCallFailCauseInfo& /*failCauseInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const LastCallFailCauseInfo& /*failCauseInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getSignalStrengthResponse(
-        const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const SignalStrength& /*sig_strength*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getVoiceRegistrationStateResponse(
-        const RadioResponseInfo& info, const VoiceRegStateResult& /*voiceRegResponse*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const VoiceRegStateResult& /*voiceRegResponse*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getDataRegistrationStateResponse(
-        const RadioResponseInfo& info, const DataRegStateResult& /*dataRegResponse*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const DataRegStateResult& /*dataRegResponse*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getOperatorResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*longName*/,
-        const ::android::hardware::hidl_string& /*shortName*/,
-        const ::android::hardware::hidl_string& /*numeric*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*longName*/,
+    const ::android::hardware::hidl_string& /*shortName*/,
+    const ::android::hardware::hidl_string& /*numeric*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setRadioPowerResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setRadioPowerResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendDtmfResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendSmsResponse(const RadioResponseInfo& info,
-        const SendSmsResult& sms) {
-    rspInfo = info;
-    sendSmsResult = sms;
-    parent.notify();
-    return Void();
+                                            const SendSmsResult& sms) {
+  rspInfo = info;
+  sendSmsResult = sms;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendSMSExpectMoreResponse(
-        const RadioResponseInfo& info, const SendSmsResult& sms) {
-    rspInfo = info;
-    sendSmsResult = sms;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const SendSmsResult& sms) {
+  rspInfo = info;
+  sendSmsResult = sms;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setupDataCallResponse(
-        const RadioResponseInfo& info, const SetupDataCallResult& /*dcResponse*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const SetupDataCallResult& /*dcResponse*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::iccIOForAppResponse(
-        const RadioResponseInfo& info, const IccIoResult& iccIo) {
-    rspInfo = info;
-    this->iccIoResult = iccIo;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::iccIOForAppResponse(const RadioResponseInfo& info,
+                                                const IccIoResult& iccIo) {
+  rspInfo = info;
+  this->iccIoResult = iccIo;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendUssdResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::cancelPendingUssdResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::cancelPendingUssdResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& info, int32_t /*n*/,
-        int32_t /*m*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::getClirResponse(const RadioResponseInfo& info,
+                                            int32_t /*n*/, int32_t /*m*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setClirResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCallForwardStatusResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_vec<CallForwardInfo>&
-        /*callForwardInfos*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<CallForwardInfo>&
+    /*callForwardInfos*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCallForwardResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCallForwardResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCallWaitingResponse(
-        const RadioResponseInfo& info, bool /*enable*/, int32_t /*serviceClass*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, bool /*enable*/, int32_t /*serviceClass*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCallWaitingResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCallWaitingResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::acceptCallResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::deactivateDataCallResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::deactivateDataCallResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::getFacilityLockForAppResponse(const RadioResponseInfo& info,
-        int32_t /*response*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::getFacilityLockForAppResponse(
+    const RadioResponseInfo& info, int32_t /*response*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setFacilityLockForAppResponse(const RadioResponseInfo& info,
-        int32_t /*retry*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setFacilityLockForAppResponse(
+    const RadioResponseInfo& info, int32_t /*retry*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setBarringPasswordResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setBarringPasswordResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getNetworkSelectionModeResponse(
-        const RadioResponseInfo& info, bool /*manual*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, bool /*manual*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getAvailableNetworksResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<OperatorInfo>& /*networkInfos*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::startDtmfResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::startDtmfResponse(const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::stopDtmfResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::stopDtmfResponse(const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getBasebandVersionResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*version*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*version*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::separateConnectionResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::separateConnectionResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setMuteResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::getMuteResponse(const RadioResponseInfo& info, bool /*enable*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::getMuteResponse(const RadioResponseInfo& info,
+                                            bool /*enable*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getClipResponse(const RadioResponseInfo& info,
-        ClipStatus /*status*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+                                            ClipStatus /*status*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getDataCallListResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<SetupDataCallResult>& /*dcResponse*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendOemRilRequestRawResponse(
-        const RadioResponseInfo& /*info*/,
-        const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
-    return Void();
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<uint8_t>& /*data*/) {
+  return Void();
 }
 
 Return<void> RadioResponse::sendOemRilRequestStringsResponse(
-        const RadioResponseInfo& /*info*/,
-        const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& /*data*/) {
-    return Void();
+    const RadioResponseInfo& /*info*/,
+    const ::android::hardware::hidl_vec<
+        ::android::hardware::hidl_string>& /*data*/) {
+  return Void();
 }
 
 Return<void> RadioResponse::setSuppServiceNotificationsResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::writeSmsToSimResponse(
-        const RadioResponseInfo& info, int32_t index) {
-    rspInfo = info;
-    writeSmsToSimIndex = index;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::writeSmsToSimResponse(const RadioResponseInfo& info,
+                                                  int32_t index) {
+  rspInfo = info;
+  writeSmsToSimIndex = index;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::deleteSmsOnSimResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setBandModeResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getAvailableBandModesResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<RadioBandMode>& /*bandModes*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendEnvelopeResponse(const RadioResponseInfo& info,
-        const ::android::hardware::hidl_string& /*commandResponse*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendEnvelopeResponse(
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*commandResponse*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendTerminalResponseToSimResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendTerminalResponseToSimResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::explicitCallTransferResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::explicitCallTransferResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setPreferredNetworkTypeResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setPreferredNetworkTypeResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getPreferredNetworkTypeResponse(
-        const RadioResponseInfo& info, PreferredNetworkType /*nw_type*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, PreferredNetworkType /*nw_type*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getNeighboringCidsResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<NeighboringCell>& /*cells*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setLocationUpdatesResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(
-        const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, CdmaRoamingType /*type*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setTTYModeResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getTTYModeResponse(const RadioResponseInfo& info,
-        TtyMode /*mode*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+                                               TtyMode /*mode*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setPreferredVoicePrivacyResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getPreferredVoicePrivacyResponse(
-        const RadioResponseInfo& info, bool /*enable*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, bool /*enable*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendCDMAFeatureCodeResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendBurstDtmfResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendBurstDtmfResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendCdmaSmsResponse(
-        const RadioResponseInfo& info, const SendSmsResult& sms) {
-    rspInfo = info;
-    sendSmsResult = sms;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendCdmaSmsResponse(const RadioResponseInfo& info,
+                                                const SendSmsResult& sms) {
+  rspInfo = info;
+  sendSmsResult = sms;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getGsmBroadcastConfigResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<GsmBroadcastSmsConfigInfo>& /*configs*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<
+        GsmBroadcastSmsConfigInfo>& /*configs*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setGsmBroadcastConfigResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setGsmBroadcastConfigResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setGsmBroadcastActivationResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setGsmBroadcastActivationResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<CdmaBroadcastSmsConfigInfo>& /*configs*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<
+        CdmaBroadcastSmsConfigInfo>& /*configs*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCdmaBroadcastConfigResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCdmaBroadcastActivationResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCDMASubscriptionResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*mdn*/,
-        const ::android::hardware::hidl_string& /*hSid*/,
-        const ::android::hardware::hidl_string& /*hNid*/,
-        const ::android::hardware::hidl_string& /*min*/,
-        const ::android::hardware::hidl_string& /*prl*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*mdn*/,
+    const ::android::hardware::hidl_string& /*hSid*/,
+    const ::android::hardware::hidl_string& /*hNid*/,
+    const ::android::hardware::hidl_string& /*min*/,
+    const ::android::hardware::hidl_string& /*prl*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::writeSmsToRuimResponse(
-        const RadioResponseInfo& info, uint32_t index) {
-    rspInfo = info;
-    writeSmsToRuimIndex = index;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, uint32_t index) {
+  rspInfo = info;
+  writeSmsToRuimIndex = index;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::deleteSmsOnRuimResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getDeviceIdentityResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*imei*/,
-        const ::android::hardware::hidl_string& /*imeisv*/,
-        const ::android::hardware::hidl_string& /*esn*/,
-        const ::android::hardware::hidl_string& /*meid*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*imei*/,
+    const ::android::hardware::hidl_string& /*imeisv*/,
+    const ::android::hardware::hidl_string& /*esn*/,
+    const ::android::hardware::hidl_string& /*meid*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::exitEmergencyCallbackModeResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::exitEmergencyCallbackModeResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getSmscAddressResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& smsc) {
-    rspInfo = info;
-    smscAddress = smsc;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& smsc) {
+  rspInfo = info;
+  smscAddress = smsc;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setSmscAddressResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setSmscAddressResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::reportSmsMemoryStatusResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::reportSmsMemoryStatusResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::reportStkServiceIsRunningResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::reportStkServiceIsRunningResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(
-        const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, CdmaSubscriptionSource /*source*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::requestIsimAuthenticationResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*response*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*response*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendEnvelopeWithStatusResponse(
-        const RadioResponseInfo& info, const IccIoResult& /*iccIo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const IccIoResult& /*iccIo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getVoiceRadioTechnologyResponse(
-        const RadioResponseInfo& info, RadioTechnology /*rat*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, RadioTechnology /*rat*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getCellInfoListResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<CellInfo>& /*cellInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<CellInfo>& /*cellInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setCellInfoListRateResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setCellInfoListRateResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setInitialAttachApnResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setInitialAttachApnResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getImsRegistrationStateResponse(
-        const RadioResponseInfo& info, bool /*isRegistered*/,
-        RadioTechnologyFamily /*ratFamily*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, bool /*isRegistered*/,
+    RadioTechnologyFamily /*ratFamily*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::sendImsSmsResponse(
-        const RadioResponseInfo& info, const SendSmsResult& sms) {
-    rspInfo = info;
-    sendSmsResult = sms;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::sendImsSmsResponse(const RadioResponseInfo& info,
+                                               const SendSmsResult& sms) {
+  rspInfo = info;
+  sendSmsResult = sms;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::iccTransmitApduBasicChannelResponse(
-        const RadioResponseInfo& info, const IccIoResult& result) {
-    rspInfo = info;
-    this->iccIoResult = result;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const IccIoResult& result) {
+  rspInfo = info;
+  this->iccIoResult = result;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::iccOpenLogicalChannelResponse(
-        const RadioResponseInfo& info, int32_t channelId,
-        const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
-    rspInfo = info;
-    this->channelId = channelId;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t channelId,
+    const ::android::hardware::hidl_vec<int8_t>& /*selectResponse*/) {
+  rspInfo = info;
+  this->channelId = channelId;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::iccCloseLogicalChannelResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::iccCloseLogicalChannelResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(
-        const RadioResponseInfo& info, const IccIoResult& result) {
-    rspInfo = info;
-    this->iccIoResult = result;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const IccIoResult& result) {
+  rspInfo = info;
+  this->iccIoResult = result;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::nvReadItemResponse(
-        const RadioResponseInfo& info, const ::android::hardware::hidl_string& /*result*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_string& /*result*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::nvWriteItemResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::nvWriteCdmaPrlResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::nvWriteCdmaPrlResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::nvResetConfigResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::nvResetConfigResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setUiccSubscriptionResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setUiccSubscriptionResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setDataAllowedResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getHardwareConfigResponse(
-        const RadioResponseInfo& info,
-        const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info,
+    const ::android::hardware::hidl_vec<HardwareConfig>& /*config*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::requestIccSimAuthenticationResponse(
-        const RadioResponseInfo& info, const IccIoResult& result) {
-    rspInfo = info;
-    this->iccIoResult = result;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const IccIoResult& result) {
+  rspInfo = info;
+  this->iccIoResult = result;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::setDataProfileResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::setDataProfileResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
-Return<void> RadioResponse::requestShutdownResponse(const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+Return<void> RadioResponse::requestShutdownResponse(
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getRadioCapabilityResponse(
-        const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setRadioCapabilityResponse(
-        const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const RadioCapability& /*rc*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::startLceServiceResponse(
-        const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::stopLceServiceResponse(
-        const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const LceStatusInfo& /*statusInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::pullLceDataResponse(
-        const RadioResponseInfo& info, const LceDataInfo& /*lceInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const LceDataInfo& /*lceInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getModemActivityInfoResponse(
-        const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, const ActivityStatsInfo& /*activityInfo*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setAllowedCarriersResponse(
-        const RadioResponseInfo& info, int32_t /*numAllowed*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, int32_t /*numAllowed*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::getAllowedCarriersResponse(
-        const RadioResponseInfo& info, bool /*allAllowed*/,
-        const CarrierRestrictions& /*carriers*/) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info, bool /*allAllowed*/,
+    const CarrierRestrictions& /*carriers*/) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::sendDeviceStateResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setIndicationFilterResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::setSimCardPowerResponse(
-        const RadioResponseInfo& info) {
-    rspInfo = info;
-    parent.notify();
-    return Void();
+    const RadioResponseInfo& info) {
+  rspInfo = info;
+  parent.notify();
+  return Void();
 }
 
 Return<void> RadioResponse::acknowledgeRequest(int32_t /*serial*/) {
-    return Void();
+  return Void();
 }
diff --git a/radio/1.0/vts/functional/sap_callback.cpp b/radio/1.0/vts/functional/sap_callback.cpp
new file mode 100644
index 0000000..3a06ecd
--- /dev/null
+++ b/radio/1.0/vts/functional/sap_callback.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 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 <sap_hidl_hal_utils.h>
+
+SapCallback::SapCallback(SapHidlTest& parent) : parent(parent) {}
+
+Return<void> SapCallback::connectResponse(int32_t token,
+                                          SapConnectRsp /*sapConnectRsp*/,
+                                          int32_t /*maxMsgSize*/) {
+  sapResponseToken = token;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::disconnectResponse(int32_t token) {
+  sapResponseToken = token;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::disconnectIndication(
+    int32_t /*token*/, SapDisconnectType /*disconnectType*/) {
+  return Void();
+}
+
+Return<void> SapCallback::apduResponse(
+    int32_t token, SapResultCode resultCode,
+    const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::transferAtrResponse(
+    int32_t token, SapResultCode resultCode,
+    const ::android::hardware::hidl_vec<uint8_t>& /*atr*/) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::powerResponse(int32_t token,
+                                        SapResultCode resultCode) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::resetSimResponse(int32_t token,
+                                           SapResultCode resultCode) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::statusIndication(int32_t /*token*/,
+                                           SapStatus /*status*/) {
+  return Void();
+}
+
+Return<void> SapCallback::transferCardReaderStatusResponse(
+    int32_t token, SapResultCode resultCode, int32_t /*cardReaderStatus*/) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
+
+Return<void> SapCallback::errorResponse(int32_t /*token*/) { return Void(); }
+
+Return<void> SapCallback::transferProtocolResponse(int32_t token,
+                                                   SapResultCode resultCode) {
+  sapResponseToken = token;
+  sapResultCode = resultCode;
+  parent.notify();
+  return Void();
+}
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp
new file mode 100644
index 0000000..682230c
--- /dev/null
+++ b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2017 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 <sap_hidl_hal_utils.h>
+
+/*
+ * Test ISap.connectReq() for the response returned.
+ */
+TEST_F(SapHidlTest, connectReq) {
+  int32_t token = 0;
+  int32_t maxMsgSize = 100;
+
+  sap->connectReq(++token, maxMsgSize);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+}
+
+/*
+ * Test IRadio.disconnectReq() for the response returned
+ */
+TEST_F(SapHidlTest, disconnectReq) {
+  int32_t token = 0;
+
+  sap->disconnectReq(++token);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+}
+
+/*
+ * Test IRadio.apduReq() for the response returned.
+ */
+TEST_F(SapHidlTest, apduReq) {
+  int32_t token = 0;
+  SapApduType sapApduType = SapApduType::APDU;
+  android::hardware::hidl_vec<uint8_t> command = {};
+
+  sap->apduReq(++token, sapApduType, command);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
+              SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
+              SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
+}
+
+/*
+ * Test IRadio.transferAtrReq() for the response returned.
+ */
+TEST_F(SapHidlTest, transferAtrReq) {
+  int32_t token = 0;
+
+  sap->transferAtrReq(++token);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  ASSERT_TRUE(SapResultCode::DATA_NOT_AVAILABLE == sapCb->sapResultCode ||
+              SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
+              SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
+}
+
+/*
+ * Test IRadio.powerReq() for the response returned.
+ */
+TEST_F(SapHidlTest, powerReq) {
+  int32_t token = 0;
+  bool state = true;
+
+  sap->powerReq(++token, state);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
+              SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
+              SapResultCode::CARD_REMOVED == sapCb->sapResultCode ||
+              SapResultCode::CARD_ALREADY_POWERED_ON == sapCb->sapResultCode);
+}
+
+/*
+ * Test IRadio.resetSimReq() for the response returned.
+ */
+TEST_F(SapHidlTest, resetSimReq) {
+  int32_t token = 0;
+
+  sap->resetSimReq(++token);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  ASSERT_TRUE(SapResultCode::CARD_NOT_ACCESSSIBLE == sapCb->sapResultCode ||
+              SapResultCode::CARD_ALREADY_POWERED_OFF == sapCb->sapResultCode ||
+              SapResultCode::CARD_REMOVED == sapCb->sapResultCode);
+}
+
+/*
+ * Test IRadio.transferCardReaderStatusReq() for the response returned.
+ */
+TEST_F(SapHidlTest, transferCardReaderStatusReq) {
+  int32_t token = 0;
+
+  sap->transferCardReaderStatusReq(++token);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  EXPECT_EQ(SapResultCode::DATA_NOT_AVAILABLE, sapCb->sapResultCode);
+}
+
+/*
+ * Test IRadio.setTransferProtocolReq() for the response returned.
+ */
+TEST_F(SapHidlTest, setTransferProtocolReq) {
+  int32_t token = 0;
+  SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0;
+
+  sap->setTransferProtocolReq(++token, sapTransferProtocol);
+  EXPECT_EQ(std::cv_status::no_timeout, wait());
+  EXPECT_EQ(sapCb->sapResponseToken, token);
+
+  EXPECT_EQ(SapResultCode::NOT_SUPPORTED, sapCb->sapResultCode);
+}
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
new file mode 100644
index 0000000..88274cd
--- /dev/null
+++ b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 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 <sap_hidl_hal_utils.h>
+
+void SapHidlTest::SetUp() {
+  sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(
+      hidl_string("sap_uim_socket1"));
+  ASSERT_NE(sap, nullptr);
+
+  sapCb = new SapCallback(*this);
+  ASSERT_NE(sapCb, nullptr);
+
+  count = 0;
+
+  sap->setCallback(sapCb);
+}
+
+void SapHidlTest::TearDown() {}
+
+void SapHidlTest::notify() {
+  std::unique_lock<std::mutex> lock(mtx);
+  count++;
+  cv.notify_one();
+}
+
+std::cv_status SapHidlTest::wait() {
+  std::unique_lock<std::mutex> lock(mtx);
+
+  std::cv_status status = std::cv_status::no_timeout;
+  auto now = std::chrono::system_clock::now();
+  while (count == 0) {
+    status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+    if (status == std::cv_status::timeout) {
+      return status;
+    }
+  }
+  count--;
+  return status;
+}
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
new file mode 100644
index 0000000..2ee3c96
--- /dev/null
+++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2017 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 <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include <android/hardware/radio/1.0/ISap.h>
+#include <android/hardware/radio/1.0/ISapCallback.h>
+#include <android/hardware/radio/1.0/types.h>
+
+using namespace ::android::hardware::radio::V1_0;
+
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define TIMEOUT_PERIOD 40
+
+class SapHidlTest;
+
+/* Callback class for sap response */
+class SapCallback : public ISapCallback {
+ private:
+  SapHidlTest& parent;
+
+ public:
+  SapResultCode sapResultCode;
+  int32_t sapResponseToken;
+
+  SapCallback(SapHidlTest& parent);
+
+  virtual ~SapCallback() = default;
+
+  Return<void> connectResponse(int32_t token, SapConnectRsp sapConnectRsp,
+                               int32_t maxMsgSize);
+
+  Return<void> disconnectResponse(int32_t token);
+
+  Return<void> disconnectIndication(int32_t token,
+                                    SapDisconnectType disconnectType);
+
+  Return<void> apduResponse(
+      int32_t token, SapResultCode resultCode,
+      const ::android::hardware::hidl_vec<uint8_t>& apduRsp);
+
+  Return<void> transferAtrResponse(
+      int32_t token, SapResultCode resultCode,
+      const ::android::hardware::hidl_vec<uint8_t>& atr);
+
+  Return<void> powerResponse(int32_t token, SapResultCode resultCode);
+
+  Return<void> resetSimResponse(int32_t token, SapResultCode resultCode);
+
+  Return<void> statusIndication(int32_t token, SapStatus status);
+
+  Return<void> transferCardReaderStatusResponse(int32_t token,
+                                                SapResultCode resultCode,
+                                                int32_t cardReaderStatus);
+
+  Return<void> errorResponse(int32_t token);
+
+  Return<void> transferProtocolResponse(int32_t token,
+                                        SapResultCode resultCode);
+};
+
+// The main test class for Sap HIDL.
+class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ private:
+  std::mutex mtx;
+  std::condition_variable cv;
+  int count;
+
+ public:
+  virtual void SetUp() override;
+
+  virtual void TearDown() override;
+
+  /* Used as a mechanism to inform the test about data/event callback */
+  void notify();
+
+  /* Test code calls this function to wait for response */
+  std::cv_status wait();
+
+  /* Sap service */
+  sp<ISap> sap;
+
+  /* Sap Callback object */
+  sp<SapCallback> sapCb;
+};
+
+// A class for test environment setup
+class SapHidlEnvironment : public ::testing::Environment {
+ public:
+  virtual void SetUp() {}
+  virtual void TearDown() {}
+};
diff --git a/radio/deprecated/1.0/IOemHookIndication.hal b/radio/deprecated/1.0/IOemHookIndication.hal
index 936779f..8636592 100644
--- a/radio/deprecated/1.0/IOemHookIndication.hal
+++ b/radio/deprecated/1.0/IOemHookIndication.hal
@@ -18,15 +18,15 @@
 
 import android.hardware.radio@1.0::types;
 
-/*
+/**
  * Interface declaring unsolicited oem hook indications.
  */
 interface IOemHookIndication {
-   /*
+   /**
     * This is for OEM specific use.
     *
     * @param type Type of radio indication
     * @param data data passed as raw bytes
     */
    oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
-};
\ No newline at end of file
+};
diff --git a/radio/deprecated/1.0/IOemHookResponse.hal b/radio/deprecated/1.0/IOemHookResponse.hal
index 4e49acc..e8e6445 100644
--- a/radio/deprecated/1.0/IOemHookResponse.hal
+++ b/radio/deprecated/1.0/IOemHookResponse.hal
@@ -18,13 +18,13 @@
 
 import android.hardware.radio@1.0::types;
 
-/*
+/**
  * Interface declaring response functions to solicited oem hook requests.
  * Response functions defined in this interface are as per following convention:
  * <xyz>Response is response to IOemHook.<xyz>
  */
 interface IOemHookResponse {
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param data data returned by oem
      *
@@ -36,7 +36,7 @@
      */
     oneway sendRequestRawResponse(RadioResponseInfo info, vec<uint8_t> data);
 
-    /*
+    /**
      * @param info Response info struct containing response type, serial no. and error
      * @param data data returned by oem
      *
@@ -47,4 +47,4 @@
      *   RadioError:OEM_ERROR_X
      */
     oneway sendRequestStringsResponse(RadioResponseInfo info, vec<string> data);
-};
\ No newline at end of file
+};
diff --git a/renderscript/1.0/IContext.hal b/renderscript/1.0/IContext.hal
index 2e386d2..43a09e1 100644
--- a/renderscript/1.0/IContext.hal
+++ b/renderscript/1.0/IContext.hal
@@ -32,7 +32,7 @@
 
 interface IContext {
 
-    /*
+    /**
      * TODO: Do we need to define "selectors"? It may be a property of the
      * "adapted allocation" that's returned.
      *
@@ -56,7 +56,7 @@
     allocationAdapterCreate(Type type, Allocation baseAlloc)
                  generates (AllocationAdapter subAlloc);
 
-    /*
+    /**
      * TODO: Need to relate "offset" back to the terminology in
      * allocationAdapterCreate() -- the latter uses the terms "selector" and
      * "selected value". Can we use consistent terminology? Are "offset" and
@@ -72,7 +72,7 @@
     @callflow(next={"*"})
     allocationAdapterOffset(AllocationAdapter alloc, vec<uint32_t> offsets);
 
-    /*
+    /**
      * TODO: add more explanation here.
      *
      * Returns the Type of the Allocation.
@@ -83,7 +83,7 @@
     @callflow(next={"*"})
     allocationGetType(Allocation allocation) generates (Type type);
 
-    /*
+    /**
      * TODO: more clarification needed describing if the pointer can be aliased
      * or if the data can outlive the allocation.
      *
@@ -102,7 +102,7 @@
                           bitfield<AllocationUsageType> usage, Ptr ptr)
                generates (Allocation allocation);
 
-    /*
+    /**
      * Creates an Allocation from a Bitmap.
      *
      * @param type Type describing data layout
@@ -118,7 +118,7 @@
                                bitfield<AllocationUsageType> usage)
                     generates (Allocation allocation);
 
-    /*
+    /**
      * Creates a Cubemapped Allocation from a Bitmap.
      *
      * @param type Type describing data layout
@@ -135,7 +135,7 @@
                                    bitfield<AllocationUsageType> usage)
                         generates (Allocation allocation);
 
-    /*
+    /**
      * Returns the handle to a raw buffer that is being managed by the screen
      * compositor. This operation is only valid for Allocations with
      * USAGE_IO_INPUT.
@@ -147,7 +147,7 @@
     allocationGetNativeWindow(Allocation allocation)
                    generates (NativeWindow nativeWindow);
 
-    /*
+    /**
      * TODO: more clarification needed
      *
      * Sets the NativeWindow of an Allocation. This operation is only valid
@@ -159,7 +159,7 @@
     @callflow(next={"*"})
     allocationSetNativeWindow(Allocation allocation, NativeWindow nativewindow);
 
-    /*
+    /**
      * Initialize BufferQueue with specified max number of buffers.
      *
      * @param alloc Allocation
@@ -168,7 +168,7 @@
     @callflow(next={"*"})
     allocationSetupBufferQueue(Allocation alloc, uint32_t numBuffer);
 
-    /*
+    /**
      * TODO: clearly define baseAlloc vs subAlloc
      *
      * Shares the BufferQueue with another Allocation. Both must be
@@ -181,7 +181,7 @@
     @callflow(next={"*"})
     allocationShareBufferQueue(Allocation baseAlloc, Allocation subAlloc);
 
-    /*
+    /**
      * Copies from the Allocation into a Bitmap. The bitmap must match the
      * dimensions of the Allocation.
      *
@@ -195,7 +195,7 @@
     @callflow(next={"*"})
     allocationCopyToBitmap(Allocation allocation, Ptr data, Size sizeBytes);
 
-    /*
+    /**
      * TODO: should we consolidate all [123]DWrite functions or [123]DRead
      * functions into the same API call? Our current plan is to be very similar
      * to the dispatch table API. How much should we deviate from the original
@@ -219,7 +219,7 @@
     allocation1DWrite(Allocation allocation, uint32_t offset, uint32_t lod,
                       uint32_t count, vec<uint8_t> data);
 
-    /*
+    /**
      * Copies a value into a single sub-Element of this Allocation.
      *
      * @param allocation Allocation to be updated
@@ -237,7 +237,7 @@
                            uint32_t z, uint32_t lod, vec<uint8_t> data,
                            Size compIdx);
 
-    /*
+    /**
      * Copies from an array into a rectangular region in this Allocation.
      *
      * When this HAL entry is executed, all Vec3 elements have been explicitly
@@ -262,7 +262,7 @@
                       uint32_t lod, AllocationCubemapFace face, uint32_t w,
                       uint32_t h, vec<uint8_t> data, Size stride);
 
-    /*
+    /**
      * Copies from an array into a 3D region in this Allocation.
      *
      * When this HAL entry is executed, all Vec3 elements have been explicitly
@@ -288,7 +288,7 @@
                       uint32_t zoff, uint32_t lod, uint32_t w, uint32_t h,
                       uint32_t d, vec<uint8_t> data, Size stride);
 
-    /*
+    /**
      * Generates a mipmap chain. This is only valid if the Type of the
      * Allocation includes mipmaps.
      *
@@ -304,7 +304,7 @@
     @callflow(next={"*"})
     allocationGenerateMipmaps(Allocation allocation);
 
-    /*
+    /**
      * Copies all of an Allocation's data into an array.
      *
      * All Vec3 elements of an Allocation are padded to be Vec4, so the data
@@ -320,7 +320,7 @@
     @callflow(next={"*"})
     allocationRead(Allocation allocation, Ptr data, Size sizeBytes);
 
-    /*
+    /**
      * Copies a 1D region of this Allocation into an array.
      *
      * All Vec3 elements of an Allocation are padded to be Vec4, so the data
@@ -342,7 +342,7 @@
     allocation1DRead(Allocation allocation, uint32_t xoff, uint32_t lod,
                      uint32_t count, Ptr data, Size sizeBytes);
 
-    /*
+    /**
      * Returns the value of a single sub-Element of this Allocation.
      *
      * HIDL is always running in Passthrough mode for RenderScript, so the
@@ -362,7 +362,7 @@
                           uint32_t z, uint32_t lod, Ptr data, Size sizeBytes,
                           Size compIdx);
 
-    /*
+    /**
      * Copies from a rectangular region in this Allocation to an array.
      *
      * All Vec3 elements of an Allocation are padded to be Vec4, so the data
@@ -391,7 +391,7 @@
                      uint32_t lod, AllocationCubemapFace face, uint32_t w,
                      uint32_t h, Ptr data, Size sizeBytes, Size stride);
 
-    /*
+    /**
      * Copies from a rectangular cuboid region in this Allocation to an array.
      *
      * All Vec3 elements of an Allocation are padded to be Vec4, so the data
@@ -421,7 +421,7 @@
                      uint32_t zoff, uint32_t lod, uint32_t w, uint32_t h,
                      uint32_t d, Ptr data, Size sizeBytes, Size stride);
 
-    /*
+    /**
      * Propagates changes from one usage of the Allocation to the other usages
      * of the Allocation.
      *
@@ -431,7 +431,7 @@
     @callflow(next={"*"})
     allocationSyncAll(Allocation allocation, AllocationUsageType usageType);
 
-    /*
+    /**
      * TODO: describe the functionality of resize1D better
      * TODO: original Java Doc description seems to contradict itself ("with
      * null contents and the region is otherwise undefined")
@@ -455,7 +455,7 @@
     @callflow(next={"*"})
     allocationResize1D(Allocation allocation, uint32_t dimX);
 
-    /*
+    /**
      * TODO: There are allocationCopy2DRange and 3DRange, but no 1DRange. Should
      * the interface be cleaned up more?
      *
@@ -483,7 +483,7 @@
                           uint32_t srcXoff, uint32_t srcYoff, uint32_t srcMip,
                           AllocationCubemapFace srcFace);
 
-    /*
+    /**
      * Copies a rectangular cuboid region into the allocation from another
      * Allocation.
      *
@@ -508,7 +508,7 @@
                           Allocation srcAlloc, uint32_t srcXoff,
                           uint32_t srcYoff, uint32_t srcZoff, uint32_t srcMip);
 
-    /*
+    /**
      * TODO: define buffer and output stream
      *
      * Sends a buffer to the output stream. The contents of the Allocation may
@@ -520,7 +520,7 @@
     @callflow(next={"*"})
     allocationIoSend(Allocation allocation);
 
-    /*
+    /**
      * Receives the latest input into the Allocation. This operation is only
      * valid if USAGE_IO_INPUT is set on the Allocation, otherwise an error
      * must be reported and no operations may be executed.
@@ -530,7 +530,7 @@
     @callflow(next={"*"})
     allocationIoReceive(Allocation allocation);
 
-    /*
+    /**
      * TODO: describe default values for lod, face, and z better.
      * TODO: what cases can invalidate the pointer? Resize? It should be
      * clarified that this method should always return a valid pointer, but the
@@ -560,7 +560,7 @@
                          AllocationCubemapFace face, uint32_t z)
               generates (Ptr dataPtr, Size stride);
 
-    /*
+    /**
      * Retrieves an Element's metadata from native code.
      *
      * @param element Element to be read
@@ -570,7 +570,7 @@
     elementGetNativeMetadata(Element element)
                   generates (vec<uint32_t> elemData);
 
-    /*
+    /**
      * TODO: define Sub-Element handles better.
      *
      * Retrieves an Element's sub Elements, specifically their identifiers,
@@ -587,7 +587,7 @@
                generates (vec<Element> ids, vec<string> names,
                           vec<Size> arraySizes);
 
-    /*
+    /**
      * TODO: can normalization flag be removed?
      *
      * Creates an Element.
@@ -602,7 +602,7 @@
     elementCreate(DataType dt, DataKind dk, bool norm, uint32_t size)
        generates (Element element);
 
-    /*
+    /**
      * Creates a complex Element.
      *
      * @param einsPtr Container of input Elements
@@ -615,7 +615,7 @@
                          vec<Size> arraySizesPtr)
               generates (Element element);
 
-    /*
+    /**
      * Retrives a Type's metadata from native code.
      *
      * @param type Type describing data layout
@@ -624,7 +624,7 @@
     @callflow(next={"*"})
     typeGetNativeMetadata(Type type) generates (vec<OpaqueHandle> metadata);
 
-    /*
+    /**
      * Creates a new Type.
      *
      * If Type is 1D, Y and Z must be 0. If Type is 2D, Z must be 0.
@@ -644,14 +644,14 @@
                bool mipmaps, bool faces, YuvFormat yuv)
     generates (Type type);
 
-    /*
+    /**
      * Destroys provided RenderScript context, including all objects created in
      * this context.
      */
     @exit
     contextDestroy();
 
-    /*
+    /**
      * TODO: provide overview of messaging model and figure out if this should
      * be part of HAL or not.
      * TODO: what is the "client" for purposes of this interface?
@@ -671,7 +671,7 @@
     contextGetMessage(Ptr data, Size size)
            generates (MessageToClientType messageType, Size receiveLen);
 
-    /*
+    /**
      * TODO: define subID better.
      *
      * Gets the metadata of a message to ensure entire message can be properly
@@ -687,7 +687,7 @@
             generates (MessageToClientType messageType, Size receiveLen,
                        uint32_t subID);
 
-    /*
+    /**
      * TODO: Define "previous commands" better
      * TODO: Is the message identifier the same as subID?
      *
@@ -702,7 +702,7 @@
     @callflow(next={"*"})
     contextSendMessage(uint32_t id, vec<uint8_t> data);
 
-    /*
+    /**
      * TODO: Can this be done automatically as part of context creation? What
      * happens if we perform message operations before doing this?
      *
@@ -713,7 +713,7 @@
     @callflow(next={"*"})
     contextInitToClient();
 
-    /*
+    /**
      * TODO: Why doesn't this happen automatically as part of context
      * destruction? What happens if the FIFO is not empty?
      *
@@ -722,7 +722,7 @@
     @callflow(next={"*"})
     contextDeinitToClient();
 
-    /*
+    /**
      * TODO: do we need to mark asynchronous operations in this interface
      * definition?
      *
@@ -732,14 +732,14 @@
     @callflow(next={"*"})
     contextFinish();
 
-    /*
+    /**
      * Prints the currently available debugging information about the state of
      * the RS context to the logcat.
      */
     @callflow(next={"*"})
     contextLog();
 
-    /*
+    /**
      * TODO: full path? relative path? Investigate further.
      *
      * Sets the cache directory of the context.
@@ -749,7 +749,7 @@
     @callflow(next={"*"})
     contextSetCacheDir(string cacheDir);
 
-    /*
+    /**
      * TODO: does this apply to the GPU as well?
      *
      * Changes the priority of the cpu worker threads for this context.
@@ -759,7 +759,7 @@
     @callflow(next={"*"})
     contextSetPriority(ThreadPriorities priority);
 
-    /*
+    /**
      * TODO: does this need to be part of the HAL? What if the object already
      * has a name?
      *
@@ -771,7 +771,7 @@
     @callflow(next={"*"})
     assignName(ObjectBase obj, string name);
 
-    /*
+    /**
      * TODO: what if the object has no name?
      *
      * Returns the name of an object.
@@ -782,7 +782,7 @@
     @callflow(next={"*"})
     getName(ObjectBase obj) generates (string name);
 
-    /*
+    /**
      * TODO: starting here we have a set of interfaces for use with
      * ScriptGroups. At the very least we should indicate for each one that's
      * what it's for. Should we include ScriptGroup in the interface names?
@@ -810,7 +810,7 @@
                   vec<ScriptFieldID> depFieldIDS)
        generates (Closure closure);
 
-    /*
+    /**
      * Creates a Closure which represents a function call to a invocable
      * function, combined with arguments and values for global variables.
      *
@@ -827,7 +827,7 @@
                         vec<int32_t> sizes)
              generates (Closure closure);
 
-    /*
+    /**
      * Sets the argument of a Closure at specified index and size to provided
      * value.
      *
@@ -839,7 +839,7 @@
     @callflow(next={"*"})
     closureSetArg(Closure closure, uint32_t index, Ptr value, int32_t size);
 
-    /*
+    /**
      * Sets a global variable in a Closure.
      *
      * @param closure Closure
@@ -851,7 +851,7 @@
     closureSetGlobal(Closure closure, ScriptFieldID fieldID, int64_t value,
                      int32_t size);
 
-    /*
+    /**
      * TODO: should slot be unsigned? (applies to other two ID interfaces, too)
      *
      * Creates a Script Kernel ID.
@@ -866,7 +866,7 @@
                          bitfield<MetadataSignatureBitval> sig)
               generates (ScriptKernelID scriptKernelID);
 
-    /*
+    /**
      * Creates a Script Invoke ID.
      *
      * @param script Script
@@ -877,7 +877,7 @@
     scriptInvokeIDCreate(Script script, int32_t slot)
               generates (ScriptInvokeID scriptInvokeID);
 
-    /*
+    /**
      * TODO: describe the return value better. What is it?
      *
      * Creates a Script Field ID.
@@ -890,7 +890,7 @@
     scriptFieldIDCreate(Script script, int32_t slot)
              generates (ScriptFieldID scriptFieldID);
 
-    /*
+    /**
      * TODO: add more description
      *
      * Creates a Script Group.
@@ -908,7 +908,7 @@
                       vec<Type> types)
            generates (ScriptGroup scriptGroup);
 
-    /*
+    /**
      * Creates a Script Group.
      *
      * @param name Name
@@ -920,7 +920,7 @@
     scriptGroup2Create(string name, string cacheDir, vec<Closure> closures)
             generates (ScriptGroup2 scriptGroup2);
 
-    /*
+    /**
      * TODO: if SetInput/Output corresponds to the Java API setInput() and
      * setOutput(), which are documented as deprecated in API 23, do we need to
      * support them? Or can we fallback to the CPU when they're used? Or can't
@@ -937,7 +937,7 @@
     @callflow(next={"*"})
     scriptGroupSetOutput(ScriptGroup sg, ScriptKernelID kid, Allocation alloc);
 
-    /*
+    /**
      * Sets an input of the Script Group. This specifies an Allocation to be
      * used for kernels that require an input Allocation provided from outside
      * of the Script Group.
@@ -949,7 +949,7 @@
     @callflow(next={"*"})
     scriptGroupSetInput(ScriptGroup sg, ScriptKernelID kid, Allocation alloc);
 
-    /*
+    /**
      * Executes a Script Group.
      *
      * @param sg Script Group to be executed.
@@ -957,7 +957,7 @@
     @callflow(next={"*"})
     scriptGroupExecute( ScriptGroup sg);
 
-    /*
+    /**
      * Frees any native resources associated with this object. The primary use
      * is to force immediate cleanup of resources when it is believed the GC
      * may not respond quickly enough.
@@ -967,7 +967,7 @@
     @callflow(next={"*"})
     objDestroy(ObjectBase obj);
 
-    /*
+    /**
      * Creates a Sampler.
      *
      * @param magFilter Magnification value for the filter
@@ -984,7 +984,7 @@
                   float aniso)
        generates (Sampler sampler);
 
-    /*
+    /**
      * Binds an Allocation to a global pointer in the Script.
      *
      * @param script Script to be bound to
@@ -994,7 +994,7 @@
     @callflow(next={"*"})
     scriptBindAllocation(Script script, Allocation allocation, uint32_t slot);
 
-    /*
+    /**
      * TODO: is this necessary?
      *
      * Sets the timezone of a Script.
@@ -1005,7 +1005,7 @@
     @callflow(next={"*"})
     scriptSetTimeZone(Script script, string timeZone);
 
-    /*
+    /**
      * TODO: can scriptInvoke be combined with scriptInvokeV?
      *
      * Launches an invokable function.
@@ -1016,7 +1016,7 @@
     @callflow(next={"*"})
     scriptInvoke(Script vs, uint32_t slot);
 
-    /*
+    /**
      * Invokes a Script with values.
      *
      * @param vs Script to be invoked
@@ -1026,7 +1026,7 @@
     @callflow(next={"*"})
     scriptInvokeV(Script vs, uint32_t slot, vec<uint8_t> data);
 
-    /*
+    /**
      * TODO: add documentation for params
      * TODO: Should we rename "ScriptCall" to "LaunchOptions"?
      *
@@ -1043,7 +1043,7 @@
     scriptForEach(Script vs, uint32_t slot, vec<Allocation> vains,
                   Allocation vaout, vec<uint8_t> params, Ptr sc);
 
-    /*
+    /**
      * Launches a Reduction kernel.
      *
      * @param vs Script
@@ -1056,7 +1056,7 @@
     scriptReduce(Script vs, uint32_t slot, vec<Allocation> vains,
                  Allocation vaout, Ptr sc);
 
-    /*
+    /**
      * Sets a Script's integer variable to a value.
      *
      * @param vs RenderScript Script
@@ -1066,7 +1066,7 @@
     @callflow(next={"*"})
     scriptSetVarI(Script vs, uint32_t slot, int32_t value);
 
-    /*
+    /**
      * Sets a Script's Object variable to a value
      *
      * @param vs RenderScript Script
@@ -1076,7 +1076,7 @@
     @callflow(next={"*"})
     scriptSetVarObj( Script vs,  uint32_t slot, ObjectBase obj);
 
-    /*
+    /**
      * Sets a Script's long variable to a value.
      *
      * @param vs RenderScript Script
@@ -1086,7 +1086,7 @@
     @callflow(next={"*"})
     scriptSetVarJ(Script vs, uint32_t slot, int64_t value);
 
-    /*
+    /**
      * Sets a Script's float variable to a value.
      *
      * @param vs RenderScript Script
@@ -1096,7 +1096,7 @@
     @callflow(next={"*"})
     scriptSetVarF(Script vs, uint32_t slot, float value);
 
-    /*
+    /**
      * Sets a Script's double variable to a value.
      *
      * @param vs RenderScript Script
@@ -1106,7 +1106,7 @@
     @callflow(next={"*"})
     scriptSetVarD(Script vs, uint32_t slot, double value);
 
-    /*
+    /**
      * Sets a Script's struct variable to a value.
      *
      * @param vs RenderScript Script
@@ -1116,7 +1116,7 @@
     @callflow(next={"*"})
     scriptSetVarV(Script vs, uint32_t slot, vec<uint8_t> data);
 
-    /*
+    /**
      * TODO: Why do we have typed setters but only untyped getter?
      *
      * Retrieves the value from a global variable in a script.
@@ -1130,7 +1130,7 @@
     scriptGetVarV(Script vs, uint32_t slot, Size len)
        generates (vec<uint8_t> data);
 
-    /*
+    /**
      * TODO: Is this a value to be replicated for each member of the array? Or
      * is there a representation for each separate member?
      *
@@ -1147,7 +1147,7 @@
     scriptSetVarVE(Script vs, uint32_t slot, vec<uint8_t> data, Element ve,
                    vec<uint32_t> dims);
 
-    /*
+    /**
      * TODO: is cacheDir redundant with createCache() function? Can we remove
      * it?
      * TODO: define resName more clearly
@@ -1163,7 +1163,7 @@
     scriptCCreate(string resName, string cacheDir, vec<uint8_t> text)
        generates (Script script);
 
-    /*
+    /**
      * Creates a RenderScript Intrinsic script.
      *
      * @param id Intrinsic Script identifier
diff --git a/renderscript/1.0/IDevice.hal b/renderscript/1.0/IDevice.hal
index 7b1b866..62ce521 100644
--- a/renderscript/1.0/IDevice.hal
+++ b/renderscript/1.0/IDevice.hal
@@ -21,7 +21,7 @@
 
 interface IDevice {
 
-    /*
+    /**
      * Creates a RenderScript context.
      *
      * @param sdkVersion Target RS API level
diff --git a/renderscript/1.0/default/Context.cpp b/renderscript/1.0/default/Context.cpp
index ef17b463..389b6e7 100644
--- a/renderscript/1.0/default/Context.cpp
+++ b/renderscript/1.0/default/Context.cpp
@@ -63,7 +63,7 @@
 Return<void> Context::allocationAdapterOffset(Allocation alloc, const hidl_vec<uint32_t>& offsets) {
     RsAllocation _alloc = hidl_to_rs<RsAllocation>(alloc);
     const hidl_vec<uint32_t>& _offsets = offsets;
-    Device::getHal().AllocationAdapterOffset(mContext, _alloc, _offsets.data(), _offsets.size());
+    Device::getHal().AllocationAdapterOffset(mContext, _alloc, _offsets.data(), _offsets.size() * sizeof(uint32_t));
     return Void();
 }
 
@@ -552,7 +552,7 @@
     std::vector<RsScriptKernelID> _dstK    = hidl_to_rs<RsScriptKernelID>(dstK,    [](ScriptFieldID val) { return hidl_to_rs<RsScriptKernelID>(val); });
     std::vector<RsScriptFieldID>  _dstF    = hidl_to_rs<RsScriptFieldID>(dstF,     [](ScriptFieldID val) { return hidl_to_rs<RsScriptFieldID>(val); });
     std::vector<RsType>           _types   = hidl_to_rs<RsType>(types,             [](Type val) { return hidl_to_rs<RsType>(val); });
-    RsScriptGroup _scriptGroup = Device::getHal().ScriptGroupCreate(mContext, _kernels.data(), _kernels.size(), _srcK.data(), _srcK.size(), _dstK.data(), _dstK.size(), _dstF.data(), _dstF.size(), _types.data(), _types.size());
+    RsScriptGroup _scriptGroup = Device::getHal().ScriptGroupCreate(mContext, _kernels.data(), _kernels.size() * sizeof(RsScriptKernelID), _srcK.data(), _srcK.size() * sizeof(RsScriptKernelID), _dstK.data(), _dstK.size() * sizeof(RsScriptKernelID), _dstF.data(), _dstF.size() * sizeof(RsScriptFieldID), _types.data(), _types.size() * sizeof(RsType));
     return rs_to_hidl<ScriptGroup>(_scriptGroup);
 }
 
@@ -725,7 +725,7 @@
     size_t _len = data.size();
     RsElement _ve = hidl_to_rs<RsElement>(ve);
     const uint32_t* _dimsPtr = dims.data();
-    size_t _dimLen = dims.size();
+    size_t _dimLen = dims.size() * sizeof(uint32_t);
     Device::getHal().ScriptSetVarVE(mContext, _vs, _slot, _dataPtr, _len, _ve, _dimsPtr, _dimLen);
     return Void();
 }
diff --git a/renderscript/1.0/vts/functional/VtsCopyTests.cpp b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
index 77217cb..168e681 100644
--- a/renderscript/1.0/vts/functional/VtsCopyTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsCopyTests.cpp
@@ -43,9 +43,7 @@
     context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
     context->allocation1DRead(allocation, 0, 0, (uint32_t)dataOut.size(), (Ptr)dataOut.data(),
                               (Size)dataOut.size()*sizeof(float));
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                            [](float x){ static int val = 0; return x == (float)val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(dataIn, dataOut);
 }
 
 /*
@@ -76,9 +74,7 @@
                                _data, 0);
     context->allocation2DRead(allocation, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 128, 128,
                               (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(float), 0);
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                            [](float x){ static int val = 0; return x == (float)val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(dataIn, dataOut);
 }
 
 /*
@@ -108,9 +104,7 @@
     context->allocation3DWrite(allocation, 0, 0, 0, 0, 32, 32, 32, _data, 0);
     context->allocation3DRead(allocation, 0, 0, 0, 0, 32, 32, 32, (Ptr)dataOut.data(),
                               (Size)dataOut.size()*sizeof(float), 0);
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                            [](float x){ static int val = 0; return x == (float)val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(dataIn, dataOut);
 }
 
 /*
@@ -139,18 +133,14 @@
                                                                 AllocationMipmapControl::NONE,
                                                                 _data,
                                                                 (int)AllocationUsageType::SCRIPT);
-    EXPECT_NE(allocation, Allocation(0));
+    EXPECT_NE(Allocation(0), allocation);
 
     context->allocationCopyToBitmap(allocation, (Ptr)dataOut1.data(),
                                     (Size)dataOut1.size()*sizeof(float));
-    bool same1 = std::all_of(dataOut1.begin(), dataOut1.end(),
-                             [](float x){ static int val = 0; return x == (float)val++; });
-    EXPECT_EQ(true, same1);
+    EXPECT_EQ(dataIn, dataOut1);
 
     context->allocationRead(allocation, (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(float));
-    bool same2 = std::all_of(dataOut2.begin(), dataOut2.end(),
-                             [](float x){ static int val = 0; return x == (float)val++; });
-    EXPECT_EQ(true, same2);
+    EXPECT_EQ(dataIn, dataOut2);
 }
 
 /*
@@ -368,24 +358,20 @@
 /*
  * This test creates a complex element type (uint8_t, uint32_t) out of known
  * elements. It then verifies the element structure was created correctly.
- * Finally, the test creates a 128-wide, 1-dimension allocation of this type
- * and transfers memory to and from this structure.
+ * Finally, the test creates a 1-wide, 1-dimension allocation of this type
+ * and transfers memory to and from a single cell of this Allocation.
  *
  * Calls: elementCreate, elementComplexCreate, elementGetSubElements,
  * typeCreate, allocationCreateTyped, allocationElementWrite,
  * allocationElementRead
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
  */
-/*
 TEST_F(RenderscriptHidlTest, ComplexElementTest) {
     Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
     Element element2 = context->elementCreate(DataType::UNSIGNED_32, DataKind::USER, false, 1);
 
     hidl_vec<Element> eins = {element1, element2};
     hidl_vec<hidl_string> names = {hidl_string("first"), hidl_string("second")};
-    hidl_vec<Size> arraySizesPtr = {sizeof(uint8_t), sizeof(uint32_t)};
+    hidl_vec<Size> arraySizesPtr = {1, 1};
     Element element3 = context->elementComplexCreate(eins, names, arraySizesPtr);
     EXPECT_NE(Element(0), element3);
 
@@ -400,28 +386,25 @@
                                                         namesOut.push_back(_names[1]);
                                                         arraySizesOut = _arraySizes;
                                                     });
-    EXPECT_NE(Element(0), ids[0]);
-    EXPECT_NE(Element(0), ids[1]);
+    EXPECT_EQ(element1, ids[0]);
+    EXPECT_EQ(element2, ids[1]);
     EXPECT_EQ("first", namesOut[0]);
     EXPECT_EQ("second", namesOut[1]);
-    EXPECT_EQ(sizeof(uint8_t), arraySizesOut[0]);
-    EXPECT_EQ(sizeof(uint32_t), arraySizesOut[1]);
+    EXPECT_EQ(Size(1), arraySizesOut[0]);
+    EXPECT_EQ(Size(1), arraySizesOut[1]);
 
-    // 128 x (uint8_t, uint32_t)
-    Type type = context->typeCreate(element3, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
-    // 128 x (uint8_t, uint32_t)
+    // 1 x (uint8_t, uint32_t)
+    Type type = context->typeCreate(element3, 1, 0, 0, false, false, YuvFormat::YUV_NONE);
+    // 1 x (uint8_t, uint32_t)
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
-    std::vector<uint32_t> dataIn(128), dataOut(128);
+    std::vector<uint32_t> dataIn(1), dataOut(1);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
     _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t));
     context->allocationElementWrite(allocation, 0, 0, 0, 0, _data, 1);
     context->allocationElementRead(allocation, 0, 0, 0, 0, (Ptr)dataOut.data(),
                                    (Size)dataOut.size()*sizeof(uint32_t), 1);
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                            [](uint32_t x){ static uint32_t val = 0; return x == val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(dataIn, dataOut);
 }
-*/
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
index fc1b7e4..527fef0 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
@@ -32,6 +32,7 @@
 using ::android::hardware::renderscript::V1_0::AllocationCubemapFace;
 using ::android::hardware::renderscript::V1_0::AllocationMipmapControl;
 using ::android::hardware::renderscript::V1_0::AllocationUsageType;
+using ::android::hardware::renderscript::V1_0::Closure;
 using ::android::hardware::renderscript::V1_0::IContext;
 using ::android::hardware::renderscript::V1_0::IDevice;
 using ::android::hardware::renderscript::V1_0::ContextType;
@@ -62,7 +63,26 @@
 using ::android::hardware::hidl_string;
 using ::android::sp;
 
-// bitcode variables
+// bitcode slots
+extern const int mExportVarIdx_var_int;
+extern const int mExportVarIdx_var_long;
+extern const int mExportVarIdx_var_float;
+extern const int mExportVarIdx_var_double;
+extern const int mExportVarIdx_var_allocation;
+extern const int mExportVarIdx_var_uint32_t;
+extern const int mExportVarIdx_var_point2;
+extern const int mExportVarIdx_var_int_ptr;
+// bitcode invoke slots
+//extern const int mExportForEachIdx_root;
+extern const int mExportForEachIdx_increment;
+// bitcode reduce slots
+extern const int mExportReduceIdx_summation;
+// bitcode invoke slots
+extern const int mExportFuncIdx_function;
+extern const int mExportFuncIdx_functionV;
+extern const int mExportFuncIdx_setBuffer;
+extern const int mExportFuncIdx_setAllocation;
+// bitcode
 typedef signed char int8_t;
 extern const int8_t bitCode[];
 extern const int bitCodeLength;
diff --git a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
index c2b3354..39d63ca 100644
--- a/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsMiscellaneousTests.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "VtsHalRenderscriptV1_0TargetTest.h"
+#include <system/window.h>
 
 /*
  * ContextCreateAndDestroy:
@@ -81,7 +82,7 @@
                                           elementMetadata = _metadata; });
     EXPECT_EQ(DataType::FLOAT_32, (DataType)elementMetadata[0]);
     EXPECT_EQ(DataKind::USER, (DataKind)elementMetadata[1]);
-    EXPECT_EQ(false, ((uint32_t)elementMetadata[2] == 1) ? true : false);
+    EXPECT_EQ(false, elementMetadata[2]);
     EXPECT_EQ(1u, (uint32_t)elementMetadata[3]);
     EXPECT_EQ(0u, (uint32_t)elementMetadata[4]);
 
@@ -134,21 +135,17 @@
  * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
  * allocationGetNativeWindow, allocationSetNativeWindow, allocationIoSend,
  * allocationIoReceive, allocation2DRead
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
  */
-/*
 TEST_F(RenderscriptHidlTest, NativeWindowIoTest) {
     // uint8x4
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
     // 512 x 512 x uint8x4
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
     std::vector<uint32_t> dataIn(512*512), dataOut(512*512);
-    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (uint32_t)val++; });
+    std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
     _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t));
-    // 512 x 512 x float1
+    // 512 x 512 x uint8x4
     Allocation allocationRecv = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                                (int)(AllocationUsageType::SCRIPT
                                                                | AllocationUsageType::IO_INPUT),
@@ -157,21 +154,20 @@
                                                                (int)(AllocationUsageType::SCRIPT
                                                                | AllocationUsageType::IO_OUTPUT),
                                                                (Ptr)nullptr);
-    context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
-                               _data, 0);
     NativeWindow nativeWindow = context->allocationGetNativeWindow(allocationRecv);
     EXPECT_NE(NativeWindow(0), nativeWindow);
 
+    ((ANativeWindow *)nativeWindow)->incStrong(nullptr);
+
     context->allocationSetNativeWindow(allocationSend, nativeWindow);
+    context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
+                               _data, 0);
     context->allocationIoSend(allocationSend);
     context->allocationIoReceive(allocationRecv);
     context->allocation2DRead(allocationRecv, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
                               (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint32_t), 0);
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                             [](uint32_t x){ static int val = 0; return x == (uint32_t)val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(dataIn, dataOut);
 }
-*/
 
 /*
  * Three allocations are created, two with IO_INPUT and one with IO_OUTPUT. The
@@ -180,21 +176,17 @@
  * Calls: elementCreate, typeCreate, allocationCreateTyped,
  * allocationCreateFromBitmap, allocationSetupBufferQueue,
  * allocationShareBufferQueue
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
  */
-/*
 TEST_F(RenderscriptHidlTest, BufferQueueTest) {
-    // float1
-    Element element = context->elementCreate(DataType::FLOAT_32, DataKind::USER, false, 1);
-    // 512 x 512 x float1
+    // uint8x4
+    Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 4);
+    // 512 x 512 x uint8x4
     Type type = context->typeCreate(element, 512, 512, 0, false, false, YuvFormat::YUV_NONE);
-    std::vector<float> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
-    std::generate(dataIn.begin(), dataIn.end(), [](){ static int val = 0; return (float)val++; });
+    std::vector<uint32_t> dataIn(512*512), dataOut1(512*512), dataOut2(512*512);
+    std::generate(dataIn.begin(), dataIn.end(), [](){ static uint32_t val = 0; return val++; });
     hidl_vec<uint8_t> _data;
-    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(float));
-    // 512 x 512 x float1
+    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(uint32_t));
+    // 512 x 512 x uint8x4
     Allocation allocationRecv1 = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                                 (int)(AllocationUsageType::SCRIPT
                                                                 | AllocationUsageType::IO_INPUT),
@@ -203,16 +195,37 @@
                                                                 (int)(AllocationUsageType::SCRIPT
                                                                 | AllocationUsageType::IO_INPUT),
                                                                 (Ptr)nullptr);
-    Allocation allocationSend = context->allocationCreateFromBitmap(type,
-                                                                    AllocationMipmapControl::NONE,
-                                                                    _data,
-                                                                   (int)(AllocationUsageType::SCRIPT
-                                                                 | AllocationUsageType::IO_OUTPUT));
+    Allocation allocationSend  = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
+                                                                (int)(AllocationUsageType::SCRIPT
+                                                                | AllocationUsageType::IO_INPUT),
+                                                                (Ptr)nullptr);
     context->allocationSetupBufferQueue(allocationRecv1, 2);
-    context->allocationShareBufferQueue(allocationRecv1, allocationRecv2);
-    // TODO: test the buffer queue
+    context->allocationShareBufferQueue(allocationRecv2, allocationRecv1);
+
+    NativeWindow nativeWindow1 = context->allocationGetNativeWindow(allocationRecv1);
+    EXPECT_NE(NativeWindow(0), nativeWindow1);
+    NativeWindow nativeWindow2 = context->allocationGetNativeWindow(allocationRecv2);
+    EXPECT_EQ(nativeWindow2, nativeWindow1);
+
+    ((ANativeWindow *)nativeWindow1)->incStrong(nullptr);
+
+    context->allocationSetNativeWindow(allocationSend, nativeWindow1);
+    context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
+                               _data, 0);
+    context->allocationIoSend(allocationSend);
+    context->allocationIoReceive(allocationRecv1);
+    context->allocation2DRead(allocationRecv1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
+                              (Ptr)dataOut1.data(), (Size)dataOut1.size()*sizeof(uint32_t), 0);
+    EXPECT_EQ(dataIn, dataOut1);
+
+    context->allocation2DWrite(allocationSend, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
+                               _data, 0);
+    context->allocationIoSend(allocationSend);
+    context->allocationIoReceive(allocationRecv2);
+    context->allocation2DRead(allocationRecv2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 512, 512,
+                              (Ptr)dataOut2.data(), (Size)dataOut2.size()*sizeof(uint32_t), 0);
+    EXPECT_EQ(dataIn, dataOut2);
 }
-*/
 
 /*
  * This test sets up the message queue, sends a message, peeks at the message,
@@ -220,33 +233,29 @@
  *
  * Calls: contextInitToClient, contextSendMessage, contextPeekMessage,
  * contextGetMessage, contextDeinitToClient, contextLog
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
  */
-/*
 TEST_F(RenderscriptHidlTest, ContextMessageTest) {
     context->contextInitToClient();
 
-    std::string messageOut = "correct";
+    const char * message = "correct";
+    std::vector<char> messageSend(message, message + sizeof(message));
     hidl_vec<uint8_t> _data;
-    _data.setToExternal((uint8_t*)const_cast<char*>(messageOut.c_str()), messageOut.length());
+    _data.setToExternal((uint8_t*)messageSend.data(), messageSend.size());
     context->contextSendMessage(0, _data);
     MessageToClientType messageType;
     size_t size;
     uint32_t subID;
     context->contextPeekMessage([&](MessageToClientType _type, Size _size, uint32_t _subID){
                                 messageType = _type; size = (uint32_t)_size; subID = _subID; });
-    std::vector<char> messageIn(size, '\0');
-    context->contextGetMessage(messageIn.data(), messageIn.size(),
+    std::vector<char> messageRecv(size, '\0');
+    context->contextGetMessage(messageRecv.data(), messageRecv.size(),
                                [&](MessageToClientType _type, Size _size){
                                messageType = _type; size = (uint32_t)_size; });
-    EXPECT_EQ(messageOut, messageIn.data());
+    EXPECT_EQ(messageSend, messageRecv);
 
     context->contextDeinitToClient();
     context->contextLog();
 }
-*/
 
 /*
  * Call through a bunch of APIs and make sure they don’t crash. Assign the name
diff --git a/renderscript/1.0/vts/functional/VtsScriptTests.cpp b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
index 9531e19..6bb375a 100644
--- a/renderscript/1.0/vts/functional/VtsScriptTests.cpp
+++ b/renderscript/1.0/vts/functional/VtsScriptTests.cpp
@@ -46,27 +46,30 @@
     EXPECT_NE(Script(0), script);
 
     // arg tests
-    context->scriptSetVarI(script, 0, 100);
+    context->scriptSetVarI(script, mExportVarIdx_var_int, 100);
     int resultI = 0;
-    context->scriptGetVarV(script, 0, sizeof(int), [&](const hidl_vec<uint8_t>& _data){
-                               resultI = *((int*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_int, sizeof(int),
+                           [&](const hidl_vec<uint8_t>& _data){ resultI = *((int*)_data.data()); });
     EXPECT_EQ(100, resultI);
 
-    context->scriptSetVarJ(script, 1, 101l);
+    context->scriptSetVarJ(script, mExportVarIdx_var_long, 101l);
     int resultJ = 0;
-    context->scriptGetVarV(script, 1, sizeof(long), [&](const hidl_vec<uint8_t>& _data){
+    context->scriptGetVarV(script, mExportVarIdx_var_long, sizeof(long),
+                           [&](const hidl_vec<uint8_t>& _data){
                                resultJ = *((long*)_data.data()); });
-    EXPECT_EQ(101, resultJ);
+    EXPECT_EQ(101l, resultJ);
 
-    context->scriptSetVarF(script, 2, 102.0f);
+    context->scriptSetVarF(script, mExportVarIdx_var_float, 102.0f);
     int resultF = 0.0f;
-    context->scriptGetVarV(script, 2, sizeof(float), [&](const hidl_vec<uint8_t>& _data){
+    context->scriptGetVarV(script, mExportVarIdx_var_float, sizeof(float),
+                           [&](const hidl_vec<uint8_t>& _data){
                                resultF = *((float*)_data.data()); });
     EXPECT_EQ(102.0f, resultF);
 
-    context->scriptSetVarD(script, 3, 103.0);
+    context->scriptSetVarD(script, mExportVarIdx_var_double, 103.0);
     int resultD = 0.0;
-    context->scriptGetVarV(script, 3, sizeof(double), [&](const hidl_vec<uint8_t>& _data){
+    context->scriptGetVarV(script, mExportVarIdx_var_double, sizeof(double),
+                           [&](const hidl_vec<uint8_t>& _data){
                                resultD = *((double*)_data.data()); });
     EXPECT_EQ(103.0, resultD);
 
@@ -79,23 +82,21 @@
                                                              (int)AllocationUsageType::SCRIPT,
                                                              (Ptr)nullptr);
     Allocation allocationOut = Allocation(0);
-    context->scriptSetVarObj(script, 4, (ObjectBase)allocationIn);
-    context->scriptGetVarV(script, 4, sizeof(ObjectBase), [&](const hidl_vec<uint8_t>& _data){
+    context->scriptSetVarObj(script, mExportVarIdx_var_allocation, (ObjectBase)allocationIn);
+    context->scriptGetVarV(script, mExportVarIdx_var_allocation, sizeof(ObjectBase),
+                           [&](const hidl_vec<uint8_t>& _data){
                                allocationOut = (Allocation) *((ObjectBase*)_data.data()); });
     EXPECT_EQ(allocationOut, allocationIn);
 
-    std::vector<int> arrayIn = {500, 501, 502, 503};
-    std::vector<int> arrayOut(4);
-    hidl_vec<uint8_t> arrayData;
-    arrayData.setToExternal((uint8_t*)arrayIn.data(), arrayIn.size()*sizeof(int));
-    context->scriptSetVarV(script, 5, arrayData);
-    context->scriptGetVarV(script, 5, 4*sizeof(int), [&](const hidl_vec<uint8_t>& _data){
-                               arrayOut = std::vector<int>((int*)_data.data(),
-                                                           (int*)_data.data() + 4); });
-    EXPECT_EQ(500, arrayOut[0]);
-    EXPECT_EQ(501, arrayOut[1]);
-    EXPECT_EQ(502, arrayOut[2]);
-    EXPECT_EQ(503, arrayOut[3]);
+    uint32_t valueV = 104u;
+    hidl_vec<uint8_t> _dataV;
+    _dataV.setToExternal((uint8_t*)&valueV, sizeof(uint32_t));
+    context->scriptSetVarV(script, mExportVarIdx_var_uint32_t, _dataV);
+    uint32_t resultV = 0u;
+    context->scriptGetVarV(script, mExportVarIdx_var_uint32_t, sizeof(uint32_t),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultV = *((uint32_t*)_data.data()); });
+    EXPECT_EQ(104u, resultV);
 
     std::vector<int> dataVE = {1000, 1001};
     std::vector<uint32_t> dimsVE = {1};
@@ -104,12 +105,13 @@
     hidl_vec<uint32_t> _dimsVE;
     _dataVE.setToExternal((uint8_t*)dataVE.data(), dataVE.size()*sizeof(int));
     _dimsVE.setToExternal((uint32_t*)dimsVE.data(), dimsVE.size());
-    // intx2
+    // intx2 to represent point2 which is {int, int}
     Element elementVE = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 2);
-    context->scriptSetVarVE(script, 6, _dataVE, elementVE, _dimsVE);
-    context->scriptGetVarV(script, 6, 2*sizeof(int), [&](const hidl_vec<uint8_t>& _data){
-                               outVE = std::vector<int>((int*)_data.data(),
-                                                        (int*)_data.data() + 2); });
+    context->scriptSetVarVE(script, mExportVarIdx_var_point2, _dataVE, elementVE, _dimsVE);
+    context->scriptGetVarV(script, mExportVarIdx_var_point2, 2*sizeof(int),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               outVE = std::vector<int>(
+                                   (int*)_data.data(), (int*)_data.data() + 2); });
     EXPECT_EQ(1000, outVE[0]);
     EXPECT_EQ(1001, outVE[1]);
 }
@@ -127,19 +129,47 @@
     EXPECT_NE(Script(0), script);
 
     // invoke test
-    int function_res = 0;
-    context->scriptInvoke(script, 0);
-    context->scriptGetVarV(script, 0, sizeof(int), [&](const hidl_vec<uint8_t>& _data){
-                               function_res = *((int*)_data.data()); });
-    EXPECT_NE(100, function_res);
+    int resultI = 0;
+    long resultJ = 0l;
+    float resultF = 0.0f;
+    double resultD = 0.0;
+    uint32_t resultV = 0u;
+    std::vector<int> resultVE(2);
+    context->scriptInvoke(script, mExportFuncIdx_function);
+    context->scriptGetVarV(script, mExportVarIdx_var_int, sizeof(int),
+                           [&](const hidl_vec<uint8_t>& _data){ resultI = *((int*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_long, sizeof(long),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultJ = *((long*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_float, sizeof(float),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultF = *((float*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_double, sizeof(double),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultD = *((double*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_uint32_t, sizeof(uint32_t),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultV = *((uint32_t*)_data.data()); });
+    context->scriptGetVarV(script, mExportVarIdx_var_point2, 2*sizeof(int),
+                           [&](const hidl_vec<uint8_t>& _data){
+                               resultVE = std::vector<int>(
+                                   (int*)_data.data(), (int*)_data.data() + 2); });
+    EXPECT_EQ(1, resultI);
+    EXPECT_EQ(2l, resultJ);
+    EXPECT_EQ(3.0f, resultF);
+    EXPECT_EQ(4.0, resultD);
+    EXPECT_EQ(5u, resultV);
+    EXPECT_EQ(6, resultVE[0]);
+    EXPECT_EQ(7, resultVE[1]);
 
     // invokeV test
     int functionV_arg = 5;
     int functionV_res = 0;
     hidl_vec<uint8_t> functionV_data;
     functionV_data.setToExternal((uint8_t*)&functionV_arg, sizeof(int));
-    context->scriptInvokeV(script, 1, functionV_data);
-    context->scriptGetVarV(script, 0, sizeof(int), [&](const hidl_vec<uint8_t>& _data){
+    context->scriptInvokeV(script, mExportFuncIdx_functionV, functionV_data);
+    context->scriptGetVarV(script, mExportVarIdx_var_int, sizeof(int),
+                           [&](const hidl_vec<uint8_t>& _data){
                                functionV_res = *((int*)_data.data()); });
     EXPECT_EQ(5, functionV_res);
 }
@@ -161,8 +191,9 @@
     Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
     // 64 x uint8_t
     Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
-    std::vector<uint8_t> dataIn(64), dataOut(64);
+    std::vector<uint8_t> dataIn(64), dataOut(64), expected(64);
     std::generate(dataIn.begin(), dataIn.end(), [](){ static uint8_t val = 0; return val++; });
+    std::generate(expected.begin(), expected.end(), [](){ static uint8_t val = 1; return val++; });
     hidl_vec<uint8_t> _data;
     _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size());
     // 64 x float1
@@ -176,11 +207,9 @@
     hidl_vec<Allocation> vains;
     vains.setToExternal(&allocation, 1);
     hidl_vec<uint8_t> params;
-    context->scriptForEach(script, 1, vains, vout, params, nullptr);
+    context->scriptForEach(script, mExportForEachIdx_increment, vains, vout, params, nullptr);
     context->allocationRead(vout, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint8_t));
-    bool same = std::all_of(dataOut.begin(), dataOut.end(),
-                            [](uint8_t x){ static uint8_t val = 1; return x == val++; });
-    EXPECT_EQ(true, same);
+    EXPECT_EQ(expected, dataOut);
 }
 
 /*
@@ -215,7 +244,7 @@
     context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
     hidl_vec<Allocation> vains;
     vains.setToExternal(&allocation, 1);
-    context->scriptReduce(script, 0, vains, vaout, nullptr);
+    context->scriptReduce(script, mExportReduceIdx_summation, vains, vaout, nullptr);
     context->contextFinish();
     context->allocationRead(vaout, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(int));
     // sum of 0, 1, 2, ..., 62, 63
@@ -228,38 +257,34 @@
  * RenderScript script, represented in the bitcode.
  *
  * Calls: scriptCCreate, elementCreate, typeCreate, allocationCreateTyped,
- * allocationGetPointer, scriptBindAllocation
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
+ * scriptSetVarV, scriptBindAllocation, allocationRead
  */
-/*
 TEST_F(RenderscriptHidlTest, ScriptBindTest) {
     hidl_vec<uint8_t> bitcode;
     bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
     Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
     EXPECT_NE(Script(0), script);
 
-    // uint8_t
+    // in32
     Element element = context->elementCreate(DataType::SIGNED_32, DataKind::USER, false, 1);
-    // 64 x uint8_t
+    // 64 x int32
     Type type = context->typeCreate(element, 64, 0, 0, false, false, YuvFormat::YUV_NONE);
-    // 64 x float1
+    // 64 x int32
     Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
-    Ptr dataPtr1, dataPtr2;
-    Size stride;
-    context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
-                                  [&](Ptr _dataPtr, Size _stride){ dataPtr1 = _dataPtr;
-                                      stride = _stride; });
-    context->scriptBindAllocation(script, allocation, 7);
-    context->allocationGetPointer(allocation, 0, AllocationCubemapFace::POSITIVE_X, 0,
-                                  [&](Ptr _dataPtr, Size _stride){ dataPtr2 = _dataPtr;
-                                      stride = _stride; });
-    EXPECT_NE(dataPtr1, dataPtr2);
+    std::vector<int> dataIn(64), dataOut(64), expected(64, 5);
+    hidl_vec<uint8_t> _data;
+    _data.setToExternal((uint8_t*)dataIn.data(), dataIn.size()*sizeof(int));
+    context->allocation1DWrite(allocation, 0, 0, (Size)dataIn.size(), _data);
+    context->scriptBindAllocation(script, allocation, mExportVarIdx_var_int_ptr);
+    int dim = 64;
+    hidl_vec<uint8_t> _dim;
+    _dim.setToExternal((uint8_t*)&dim, sizeof(int));
+    context->scriptInvokeV(script, mExportFuncIdx_setBuffer, _dim);
+    context->allocationRead(allocation, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(int));
+    EXPECT_EQ(expected, dataOut);
 }
-*/
 
 /*
  * This test groups together two RenderScript intrinsic kernels to run one after
@@ -269,38 +294,25 @@
  * ScriptGroup.
  *
  * Calls: elementCreate, typeCreate, allocationCreateTyped, allocation2DWrite,
- * scriptIntrinsicCreate, scriptKernelIDCreate, scriptGroupCreate,
- * scriptGroupSetInput, scriptGroupSetOutput, scriptGroupExecute,
- * allocation2DRead
- *
- * This test currently has a bug, and should be fixed by 3/17.
- * TODO(butlermichael)
+ * scriptIntrinsicCreate, scriptKernelIDCreate, scriptFieldIDCreate,
+ * scriptGroupCreate, scriptGroupSetOutput, scriptGroupExecute, allocation2DRead
  */
-/*
 TEST_F(RenderscriptHidlTest, ScriptGroupTest) {
-    //std::vector<uint8_t> dataIn(256*256*1, 128), dataOut(256*256*3, 0);
-    std::vector<uint8_t> dataIn(256*256*1, 128), dataOut(256*256*4, 0);
+    std::vector<uint8_t> dataIn(256*256*1, 128), dataOut(256*256*4, 0), zeros(256*256*4, 0);
     hidl_vec<uint8_t> _dataIn, _dataOut;
     _dataIn.setToExternal(dataIn.data(), dataIn.size());
-    _dataOut.setToExternal(dataOut.data(), dataIn.size());
+    _dataOut.setToExternal(dataOut.data(), dataOut.size());
 
     // 256 x 256 YUV pixels
     Element element1 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_YUV, true, 1);
-    //Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_420_888);
-    Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_NV21);
+    Type type1 = context->typeCreate(element1, 256, 256, 0, false, false, YuvFormat::YUV_420_888);
     Allocation allocation1 = context->allocationCreateTyped(type1, AllocationMipmapControl::NONE,
                                                            (int)AllocationUsageType::SCRIPT,
                                                            (Ptr)nullptr);
     context->allocation2DWrite(allocation1, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                _dataIn, 0);
-    Script yuv2rgb = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_YUV_TO_RGB, element1);
-    EXPECT_NE(Script(0), yuv2rgb);
 
-    ScriptKernelID yuv2rgbKID = context->scriptKernelIDCreate(yuv2rgb, 0, 2);
-    EXPECT_NE(ScriptKernelID(0), yuv2rgbKID);
-
-    // 256 x 256 RGB pixels
-    //Element element2 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_RGB, true, 3);
+    // 256 x 256 RGBA pixels
     Element element2 = context->elementCreate(DataType::UNSIGNED_8, DataKind::PIXEL_RGBA, true, 4);
     Type type2 = context->typeCreate(element2, 256, 256, 0, false, false, YuvFormat::YUV_NONE);
     Allocation allocation2 = context->allocationCreateTyped(type2, AllocationMipmapControl::NONE,
@@ -308,83 +320,170 @@
                                                            (Ptr)nullptr);
     context->allocation2DWrite(allocation2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                                _dataOut, 0);
+
+    // create scripts
+    Script yuv2rgb = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_YUV_TO_RGB, element1);
+    EXPECT_NE(Script(0), yuv2rgb);
+
+    ScriptKernelID yuv2rgbKID = context->scriptKernelIDCreate(yuv2rgb, 0, 2);
+    EXPECT_NE(ScriptKernelID(0), yuv2rgbKID);
+
     Script blur = context->scriptIntrinsicCreate(ScriptIntrinsicID::ID_BLUR, element2);
     EXPECT_NE(Script(0), blur);
 
     ScriptKernelID blurKID = context->scriptKernelIDCreate(blur, 0, 2);
     EXPECT_NE(ScriptKernelID(0), blurKID);
+    ScriptFieldID blurFID = context->scriptFieldIDCreate(blur, 1);
+    EXPECT_NE(ScriptFieldID(0), blurFID);
 
     // ScriptGroup
     hidl_vec<ScriptKernelID> kernels = {yuv2rgbKID, blurKID};
     hidl_vec<ScriptKernelID> srcK = {yuv2rgbKID};
-    hidl_vec<ScriptKernelID> dstK = {blurKID};
-    hidl_vec<ScriptFieldID> dstF = {};
+    hidl_vec<ScriptKernelID> dstK = {ScriptKernelID(0)};
+    hidl_vec<ScriptFieldID> dstF = {blurFID};
     hidl_vec<Type> types = {type2};
     ScriptGroup scriptGroup = context->scriptGroupCreate(kernels, srcK, dstK, dstF, types);
     EXPECT_NE(ScriptGroup(0), scriptGroup);
 
-    context->scriptGroupSetInput(scriptGroup, yuv2rgbKID, allocation1);
+    context->scriptSetVarObj(yuv2rgb, 0, (ObjectBase)allocation1);
     context->scriptGroupSetOutput(scriptGroup, blurKID, allocation2);
     context->scriptGroupExecute(scriptGroup);
+    context->contextFinish();
 
     // verify contents were changed
     context->allocation2DRead(allocation2, 0, 0, 0, AllocationCubemapFace::POSITIVE_X, 256, 256,
                               (Ptr)dataOut.data(), (Size)dataOut.size(), 0);
-    bool same = std::all_of(dataOut.begin(), dataOut.end(), [](uint8_t x){ return x != 0; });
-    EXPECT_EQ(true, same);
+    EXPECT_NE(zeros, dataOut);
 }
-*/
 
 /*
  * Similar to the ScriptGroup test, this test verifies the execution flow of
  * RenderScript kernels and invokables.
  *
  * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
- * invokeClosureCreate, closureSetArg, closureSetGlobal, scriptGroup2Create,
- * scriptGroupExecute
- *
- * This test currently still a work in progress, and should be finished by 3/17.
- * TODO(butlermichael)
+ * invokeClosureCreate, closureSetGlobal, scriptGroup2Create, scriptGroupExecute
  */
-/*
 TEST_F(RenderscriptHidlTest, ScriptGroup2Test) {
+    hidl_vec<uint8_t> bitcode;
+    bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
+    Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
+    EXPECT_NE(Script(0), script);
 
-    ScriptFieldID fieldID = context->scriptFieldIDCreate(script, slot);
+    std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 7+1);
+    hidl_vec<uint8_t> _dataIn, _dataOut;
+    _dataIn.setToExternal(dataIn.data(), dataIn.size());
+
+    // 256 x 256 YUV pixels
+    Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
+                                                           (int)AllocationUsageType::SCRIPT,
+                                                           (Ptr)nullptr);
+    context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
+
+    ScriptFieldID fieldID = context->scriptFieldIDCreate(script, mExportVarIdx_var_allocation);
     EXPECT_NE(ScriptFieldID(0), fieldID);
+    ASSERT_NE(ScriptFieldID(0), fieldID);
 
-    ScriptKernelID kernelID = context->scriptKernelIDCreate(script, slot, sig);
-    EXPECT_NE(ScriptKernelID(0), kernelID);
-
-    Allocation returnValue = 0;
-    hidl_vec<ScriptFieldID> fieldIDS = {};
-    hidl_vec<int64_t> values = {};
-    hidl_vec<int32_t> sizes = {};
-    hidl_veC<Closure> depClosures = {};
-    hidl_vec<ScriptFieldID> depFieldIDS = {};
-    Closure closure1 = context->closureCreate(kernelID, returnValue, fieldIDS, values, sizes,
-                                             depClosures, depFieldIDS);
-    EXPECT_NE(Closure(0), closure1);
-
-    ScriptInvokeID invokeID = context->scriptInvokeIDCreate(script, slot);
+    // invoke
+    ScriptInvokeID invokeID = context->scriptInvokeIDCreate(script, mExportFuncIdx_setAllocation);
     EXPECT_NE(ScriptInvokeID(0), invokeID);
+    ASSERT_NE(ScriptInvokeID(0), invokeID);
 
-    hidl_vec<uint8_t> params = {};
-    hidl_vec<ScriptFieldID> fieldsIDS2 = {};
-    hidl_vec<int64_t> values2 = {};
-    hidl_vec<int32_t> sizes2 = {};
-    Closure closure2 = context->invokeClosureCreate(invokeID, params, fieldIDS2, values2, sizes2);
+    int dim = 128;
+    hidl_vec<uint8_t> params;
+    params.setToExternal((uint8_t*)&dim, sizeof(dim));
+    hidl_vec<ScriptFieldID> fieldIDS1 = {fieldID};
+    hidl_vec<int64_t> values1 = {int64_t(0)};
+    hidl_vec<int32_t> sizes1 = {int32_t(0)};
+    Closure closure1 = context->invokeClosureCreate(invokeID, params, fieldIDS1, values1, sizes1);
+    EXPECT_NE(Closure(0), closure1);
+    ASSERT_NE(Closure(0), closure1);
+
+    // kernel
+    ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
+    EXPECT_NE(ScriptKernelID(0), kernelID);
+    ASSERT_NE(ScriptKernelID(0), kernelID);
+
+    hidl_vec<ScriptFieldID> fieldIDS2 = {ScriptFieldID(0)};
+    hidl_vec<int64_t> values2 = {(int64_t)(intptr_t)allocation};
+    hidl_vec<int32_t> sizes2 = {-1 /* allocation */};
+    hidl_vec<Closure> depClosures2 = {closure1};
+    hidl_vec<ScriptFieldID> depFieldIDS2 = {fieldID};
+    Closure closure2 = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS2,
+                                              values2, sizes2, depClosures2, depFieldIDS2);
     EXPECT_NE(Closure(0), closure2);
+    ASSERT_NE(Closure(0), closure2);
 
-    context->closureSetArg(closure, index, value, size);
-    context->closureSetGlobal(closure, fieldID, value, size);
+    // set argument
+    context->closureSetGlobal(closure1, fieldID, (int64_t)(intptr_t)allocation,
+                              -1 /* allocation */);
 
+    // execute
     hidl_string name = "script_group_2_test";
-    hidl_string cacheDir = "data/local/tmp/";
-    hidl_vec<Closures> closures;
+    hidl_string cacheDir = "/data/local/tmp";
+    hidl_vec<Closure> closures = {closure1, closure2};
     ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
     EXPECT_NE(ScriptGroup2(0), scriptGroup2);
+    ASSERT_NE(ScriptGroup2(0), scriptGroup2);
 
     context->scriptGroupExecute(scriptGroup2);
-    // verify script group launched...
+    context->allocationRead(allocation, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint8_t));
+    EXPECT_EQ(expected, dataOut);
 }
-*/
+
+/*
+ * Similar to the ScriptGroup test, this test verifies a single kernel can be
+ * called by ScriptGroup with an unbound allocation specified before launch
+ *
+ * Calls: scriptFieldIDCreate, closureCreate, scriptInvokeIDCreate,
+ * invokeClosureCreate, closureSetArg, scriptGroup2Create, scriptGroupExecute
+ */
+TEST_F(RenderscriptHidlTest, ScriptGroup2KernelTest) {
+    hidl_vec<uint8_t> bitcode;
+    bitcode.setToExternal((uint8_t*)bitCode, bitCodeLength);
+    Script script = context->scriptCCreate("struct_test", "/data/local/tmp/", bitcode);
+    EXPECT_NE(Script(0), script);
+
+    std::vector<uint8_t> dataIn(128, 128), dataOut(128, 0), expected(128, 128 + 1);
+    hidl_vec<uint8_t> _dataIn, _dataOut;
+    _dataIn.setToExternal(dataIn.data(), dataIn.size());
+
+    // 256 x 256 YUV pixels
+    Element element = context->elementCreate(DataType::UNSIGNED_8, DataKind::USER, false, 1);
+    Type type = context->typeCreate(element, 128, 0, 0, false, false, YuvFormat::YUV_NONE);
+    Allocation allocation = context->allocationCreateTyped(type, AllocationMipmapControl::NONE,
+                                                           (int)AllocationUsageType::SCRIPT,
+                                                           (Ptr)nullptr);
+    context->allocation1DWrite(allocation, 0, 0, (Size)_dataIn.size(), _dataIn);
+
+    // kernel
+    ScriptKernelID kernelID = context->scriptKernelIDCreate(script, mExportForEachIdx_increment, 3);
+    EXPECT_NE(ScriptKernelID(0), kernelID);
+    ASSERT_NE(ScriptKernelID(0), kernelID);
+
+    hidl_vec<ScriptFieldID> fieldIDS = {ScriptFieldID(0)};
+    hidl_vec<int64_t> values = {int64_t(0)};
+    hidl_vec<int32_t> sizes = {int32_t(0)};
+    hidl_vec<Closure> depClosures = {Closure(0)};
+    hidl_vec<ScriptFieldID> depFieldIDS = {ScriptFieldID(0)};
+    Closure closure = context->closureCreate(kernelID, allocation /* returnValue */, fieldIDS,
+                                              values, sizes, depClosures, depFieldIDS);
+    EXPECT_NE(Closure(0), closure);
+    ASSERT_NE(Closure(0), closure);
+
+    // set argument
+    context->closureSetArg(closure, 0 /* first argument */, (Ptr)allocation, -1);
+
+    // execute
+    hidl_string name = "script_group_2_test";
+    hidl_string cacheDir = "/data/local/tmp";
+    hidl_vec<Closure> closures = {closure};
+    ScriptGroup2 scriptGroup2 = context->scriptGroup2Create(name, cacheDir, closures);
+    EXPECT_NE(ScriptGroup2(0), scriptGroup2);
+    ASSERT_NE(ScriptGroup2(0), scriptGroup2);
+
+    context->scriptGroupExecute(scriptGroup2);
+    context->allocationRead(allocation, (Ptr)dataOut.data(), (Size)dataOut.size()*sizeof(uint8_t));
+    EXPECT_EQ(expected, dataOut);
+}
diff --git a/renderscript/1.0/vts/functional/bitcode.cpp b/renderscript/1.0/vts/functional/bitcode.cpp
index 72143c9..8a7d542 100644
--- a/renderscript/1.0/vts/functional/bitcode.cpp
+++ b/renderscript/1.0/vts/functional/bitcode.cpp
@@ -15,169 +15,215 @@
  */
 
 /*
-#include "shared.rsh"
-
-// types
-typedef struct Point2 {
-    int x;
-    int y;
-} Point_2;
-
-// variables
-int var_int;
-long var_long;
-float var_float;
-double var_double;
-rs_allocation var_allocation;
-int var_array[4];
-Point_2 var_point2;
-Point_2 *var_point2_ptr;
-
-// invoke
-void function() {
-    var_int = 1;
-    var_long = 2;
-    var_float = 3.0f;
-    var_double = 4.0;
-
-    var_array[0] = 5;
-    var_array[1] = 6;
-    var_array[2] = 7;
-    var_array[3] = 8;
-
-    var_point2.x = 9;
-    var_point2.y = 10;
-}
-
-// invokeV
-void functionV(int arg) {
-    var_int = arg;
-}
-
-// forEach
-uchar RS_KERNEL increment(uchar in) {
-    return in+1;
-}
-
-// reduction
-#pragma rs reduce(summation) accumulator(sumAccumulator) combiner(sumCombiner)
-
-static void sumAccumulator(int* accum, int val) {
-    *accum += val;
-}
-
-static void sumCombiner(int* accum, const int *val) {
-    *accum += *val;
-}
-*/
+ * // This .rs code was used to generate the 32-bit and 64-bit versions of the
+ * // bitcode shown below. It is left in here for reference, as many of the
+ * // variables are used in the the script tests.
+ *
+ * #include "shared.rsh"
+ *
+ * // types
+ * typedef struct Point2 {
+ *     int x;
+ *     int y;
+ * } Point_2;
+ *
+ * // variables
+ * int var_int;
+ * long var_long;
+ * float var_float;
+ * double var_double;
+ * rs_allocation var_allocation;
+ * uint32_t var_uint32_t;
+ * Point_2 var_point2;
+ * int *var_int_ptr;
+ *
+ * // invoke
+ * void function() {
+ *     var_int = 1;
+ *     var_long = 2;
+ *     var_float = 3.0f;
+ *     var_double = 4.0;
+ *     var_uint32_t = 5;
+ *     var_point2.x = 6;
+ *     var_point2.y = 7;
+ * }
+ *
+ * // invokeV
+ * void functionV(int arg) {
+ *     var_int = arg;
+ * }
+ *
+ * // set bound buffer
+ * void setBuffer(int dim) {
+ *     int i;
+ *     for (i = 0; i < dim; ++i) {
+ *         var_int_ptr[i] = 5;
+ *     }
+ * }
+ *
+ * // set allocation
+ * void setAllocation(int dim) {
+ *     int x;
+ *     for (x = 0; x < dim; ++x) {
+ *         rsSetElementAt_uchar(var_allocation, 7, x);
+ *     }
+ * }
+ *
+ * // forEach
+ * uchar RS_KERNEL increment(uchar in) {
+ *     return in+1;
+ * }
+ *
+ * // reduction
+ * #pragma rs reduce(summation) accumulator(sumAccumulator) combiner(sumCombiner)
+ *
+ * static void sumAccumulator(int* accum, int val) {
+ *     *accum += val;
+ * }
+ *
+ * static void sumCombiner(int* accum, const int *val) {
+ *     *accum += *val;
+ * }
+ */
 
 #include "VtsHalRenderscriptV1_0TargetTest.h"
 
+// bitcode slots
+const int mExportVarIdx_var_int = 0;
+const int mExportVarIdx_var_long = 1;
+const int mExportVarIdx_var_float = 2;
+const int mExportVarIdx_var_double = 3;
+const int mExportVarIdx_var_allocation = 4;
+const int mExportVarIdx_var_uint32_t = 5;
+const int mExportVarIdx_var_point2 = 6;
+const int mExportVarIdx_var_int_ptr = 7;
+// bitcode invoke slots
+//const int mExportForEachIdx_root = 0;
+const int mExportForEachIdx_increment = 1;
+// bitcode reduce slots
+const int mExportReduceIdx_summation = 0;
+// bitcode invoke slots
+const int mExportFuncIdx_function = 0;
+const int mExportFuncIdx_functionV = 1;
+const int mExportFuncIdx_setBuffer = 2;
+const int mExportFuncIdx_setAllocation = 3;
+
+// bitcode
 #ifndef __LP64__
 
 const int8_t bitCode[] = {
-     -34,  -64,   23,   11,    0,    0,    0,    0,   44,    0,    0,    0,  -84,   10,    0,    0,
+     -34,  -64,   23,   11,    0,    0,    0,    0,   44,    0,    0,    0,   -8,   12,    0,    0,
        0,    0,    0,    0,   -1,   -1,   -1,   -1,    0,    0,    0,    0,    1,   64,    4,    0,
       96,    9,    0,    0,    2,   64,    4,    0,    3,    0,    0,    0,   66,   67,  -64,  -34,
-      33,   12,    0,    0,  -88,    2,    0,    0,    1,   16,    0,    0,   18,    0,    0,    0,
+      33,   12,    0,    0,   59,    3,    0,    0,    1,   16,    0,    0,   18,    0,    0,    0,
        7, -127,   35, -111,   65,  -56,    4,   73,    6,   16,   50,   57, -110,    1, -124,   12,
       37,    5,    8,   25,   30,    4, -117,   98, -128,   24,   69,    2,   66, -110,   11,   66,
      -60,   16,   50,   20,   56,    8,   24,   73,   10,   50,   68,   36,   72,   10, -112,   33,
       35,  -60,   82, -128,   12,   25,   33,  114,   36,    7,  -56, -120,   17,   98,  -88,  -96,
-     -88,   64,  -58,  -16,    1,    0,    0,    0,   73,   24,    0,    0,   25,    0,    0,    0,
-      11, -124,   -1,   -1,   -1,   -1,   31,  -64,   96, -127,    1,    4,   65,  -16,   -1,   -1,
-      -1,   -1,    3,   24,   45,   32,    2,   16,    4,   65,   16,   36,   -2,   -1,   -1,   -1,
-     127,    0, -125,    5,   70,    0, -126,   32,    8, -126, -124,    0, -126,   32,    8, -126,
-     -60,   -1,   -1,   -1,   -1,   15,   96,  -80,   64,   -8,   -1,   -1,   -1,   -1,    1,   12,
-      22,    8,   -1,   -1,   -1,   -1,   63,    0,   11, -120,    0,    4,   65,   16,    4, -119,
-      -1,   -1,   -1,   -1,   31,  -64,   80,   88,   64,    4,  -64,   -1,   -1,   -1,   -1,   15,
-      96,    0,    0,    0, -119,   32,    0,    0,   33,    0,    0,    0,   50,   34, -120,    9,
-      32,  100, -123,    4,   19,   35,  -92, -124,    4,   19,   35,  -29, -124,  -95, -112,   20,
-      18,   76, -116, -116,   11, -124,  -60,   76,   16, -112,  -63,   28,    1,   24,   16,   48,
-      71,    0,   10,   36,  -52,    0,   16,   49,    4,   64,   70,   18,    0, -124,   92,   35,
-      77,   17,   37,   76,  126,  -22,   32,  -51,  100,   35,    1,    0,   72,  -71,   75, -102,
-      34,   74, -104,   -4,   72,   -6, -127,  101,  113,    4,   96,   66, -100,  -58,  -65,  115,
-      20,    4,  -60,  -48,   50,   71, -128,  -48,   67,  -48,    8,   64,    9,   36, -102, -118,
-      32,    1,   84,   21,  -31,  121,  -24,   42, -125,   20,    0, -108, -107,   65,   10,    2,
-     -38, -118,   32,   53,  -44, -103,    0,  -96,  -81,    8,   18,   72,  -31,   64,    0,    0,
+     -88,   64,  -58,  -16,    1,    0,    0,    0,   73,   24,    0,    0,   34,    0,    0,    0,
+      11, -124,   -1,   -1,   -1,   -1,   31,  -64,   96, -127,  -16,   -1,   -1,   -1,   -1,    3,
+      24,   44,   32, -124,  -32,   -1,   -1,   -1,   -1,    7,   96, -127,    1,    4,   65,  -16,
+      -1,   -1,   -1,   -1,    3,   24,   45,   32,    2,   16,    4,   65,   16,   36,   -2,   -1,
+      -1,   -1,  127,    0, -125,    5,   70,    0, -126,   32,    8, -126, -124,    0, -126,   32,
+       8, -126,  -60,   -1,   -1,   -1,   -1,   15,   96,  -80,   64,   -8,   -1,   -1,   -1,   -1,
+       1,   88,   64,    4,   32,    8, -126,   32,   72,   -4,   -1,   -1,   -1,   -1,    0, -122,
+     -62,    2,   34,    0,   65,   16,    4,   65,  -30,   -1,   -1,   -1,   -1,    7,   48,   20,
+      22,   16,   66,  -16,   -1,   -1,   -1,   -1,    3,   24,   44,   32,    2,  -32,   -1,   -1,
+      -1,   -1,    7,   48,    0,    0,    0,    0, -119,   32,    0,    0,   36,    0,    0,    0,
+      50,   34, -120,    9,   32,  100, -123,    4,   19,   35,  -92, -124,    4,   19,   35,  -29,
+    -124,  -95, -112,   20,   18,   76, -116, -116,   11, -124,  -60,   76,   16, -100,  -63,   28,
+       1,   24,   16,   48,   71,    0,   10,   36,  -52,    0,   16,   49,    4,   64,  -58,   53,
+     -46,   20,   81,  -62,  -28,  -89,   14,  -46,   76,   54,   18,    0, -128,   16,   10,  -18,
+    -110,  -90, -120,   18,   38,   63, -110,  126,   96,   89,   28,    1, -104,   16,  -89,  -15,
+     -17,   28,    5,    1,   45,  115,    4,    8,   53,  -28, -116,    0, -108,    0,  -94,  -88,
+       8,   16,   64,   83,    6,    0, -123, -128,  -86,    6,   32,  -85,    8,   77,   67,   88,
+      25,  -96,    0,   32,  -83,   12,   80,   16,   16,   87,    4, -120,   33,  -49,    4,    0,
+    -127,   69, -128,   66,   18,    7,    2,  -26,    8, -126,   41,    0,    0,    0,    0,    0,
       19,  -80,  112, -112, -121,  118,  -80, -121,   59,  104,    3,  119,  120,    7,  119,   40,
     -121,   54,   96, -121,  116,  112, -121,  122,  -64, -121,   54,   56,    7,  119,  -88, -121,
      114,    8,    7,  113,   72, -121,   13,  100,   80,   14,  109,    0,   15,  122,   48,    7,
      114,  -96,    7,  115,   32,    7,  109, -112,   14,  118,   64,    7,  122,   96,    7,  116,
      -48,    6,  -10,   16,    7,  114, -128,    7,  122,   96,    7,  116,  -96,    7,  113,   32,
        7,  120,  -48,    6,  -18,   48,    7,  114,  -48,    6,  -77,   96,    7,  116,  -96,  -13,
-      64, -118,    4,   50,   66,  100,    4,  -40,  -95,    4,  -64, -124,   12,    0,    0,    4,
-     -64,   14,  101,    0,   44, -124,    0,    0,   32,    0,  118,   40,    5,  112,   33,    3,
-       0,    0,    1,  -80,   67,   57,    0,   12,   33,    0,    0,    8, -128,   29,   74,    2,
-     100,  -56,    0,    0,   64,    0,  -20,   80,   22,   64,   67,    6,    0,    0,    2, -128,
-      13, -121,  -37,  -95,   56,  -64, -122,   12,    0,    0,    4,  -64,   14,   37,    2,   58,
-      96,    0,    0,   32,    0,  118,   40,   17,  -32,    1,    3,    0,    0,    1,   48,   68,
-     -95,    0,    0,    8,    0,    0,    0, -126,   33, -118,    5,    0,   64,    0,    0,    0,
-      16,   12,   81,   48,    0,    0,    4,    0,    0, -128,   96, -120,  -94,    1,  -64,   48,
-       0,    0,    0,    0,   67,   20,   14,    0,    6,    2,    0,    0,    0,   24,  -94,   80,
-       0,    0,   20,    0,    0,    0,  -63,   16,  -59,    3,    2,  -64,    0,    0,    0,    8,
-    -122,   40,   98,    0,    0,  -64,    1,    0,    0,   16,  100, -127,    0,    0,    0,    0,
-      13,    0,    0,    0,   50,   30, -104,   20,   25,   17,   76, -112, -116,    9,   38,   71,
-     -58,    4,   67,    2,   70,    0,   74,  -96,   16,   72,   24,    1,   32,   98,    4, -128,
-    -116,   17,    0,   66,   70,    0,   72,   25,    1,  -96,  101,    4, -128, -104,   17,    0,
-    -126,  108,  -75,    6,   91,  -50,    1,    0,  121,   24,    0,    0,  -30,    0,    0,    0,
-      26,    3,   76, -112,   70,    2,   19,   52,   68,    0,   38,   42,  119,   99,  104,   97,
-     114,   95,  115,  105,  122,  101,   67,    4, -128,   26,   98,    0,  -45,   24,    4,    0,
-     -59,  -90,   45,  -51,  -19,  -85,  -52,  -83,  -82,  -19,  107,   46,   77,  -81,  108, -120,
-       1,   76,   99,   64,    0,   20,   -7,   32,  -56, -115,   76,  -18,   45, -115,   12,  100,
-    -116,   45,  -52,  -19,   12,  -60,  -82,   76,  110,   46,  -19,  -51,   13,  100,  -58,    5,
-     -57,   69,  -26,  -90, -122,    6,    7,    6,    4,    4,   69,   44,  108,  -82, -116,   12,
-     -28,  -51,   13, -124, -119,  -55,  -86,    9,  100,  -58,    5,  -57,   69,  -26,  -90, -122,
-       6,    7,   38,  101, -120,   48,    6,    6,   15,  -69,   50,  -71,  -71,  -76,   55,   55,
-       6,   49,   67, -120,   49,   64,  -58,   32,   97,  -92,   22,  102,   23,  -10,    5,   23,
-      54,  -74,   22,  118,   86,  -10,  -27,   22,  -42,   86,  -58,  105,  -20,  -83,  -51,   37,
-     -52, -115,   76,  -18,   45, -115,  -52,   69,  110,  -50, -123,  -82,  108, -114,  110,    8,
-      49,    6,  -53,   24,   48,   60,  -20,  -62,  -28,  -66,  -46,  -36,  -24,   24,  -44,   12,
-      33,  -58,  -64,   25, -125, -121, -120,   93, -104,  -36,   23,  -37, -101,  -37,   25,    3,
-    -101,   33,  -60,   24,   68,   99,   32,   49,  -79,   11, -109,   -5,   50,   99,  123,   11,
-     -93,   27,   66, -116,    1,   53,    6,    9,   21,  -69,   48,  -71,   47,  -78,  -73,   58,
-      49,  -74,   50,    6,   50,   67, -120,   49,  -80,  -58,  -32,  -94,   99,   23,   38,   -9,
-      21,  -58,  -58,  -10,   54,   22,   70, -105,  -10,  -26,   70,   65,    6,  102,    8,   49,
-       6,  -39,   24,  104,   76,  -20,  -62,  -28,  -66,  -62,  -28,  -28,  -62,  -14,   -8,  -16,
-      12,  -67,  -71,  -51,  -47, -123,  -71,  -47,    5,  -55,  -55, -123,  -27,   -7,   12,   33,
-     -58, -128,   27, -125, -114, -118,   93, -104,  -36,   23,  -36,   91, -102,   27,  -99,   12,
-      13,  -88,  -73,   52,   55,   58, -103,   33,  -60,   24,  124,   99,    0,    6,  116,  -20,
-     -62,  -28,  -66,  -32,  -34,  -46,  -36,  -24,  100,  -66,  -32,  -24,  -28,  120,  -88,   64,
-     -67,  -91,  -71,  -47,  -55,   12,   33,  -58,   64,   12,  -58,   96,   12,   24,  -48,   12,
-      17,  -58,  -96,   12, -120, -104,  -43,  -71, -115,  -47,  -91,  -67,  -71,   13,   17,  -58,
-     -32,   12,   24,  -71,  -96, -107,  -79,  -63, -107,  -55,  125, -103,  -43,  -71, -115,  -47,
-     -91,  -67,  -71,   89,   13,   17,  -58,   32,   13,   72,  -56,  -67,  -67,  -47,   13,   17,
-     -58,   96,   13, -104,  -92,  -71, -115,  -55, -107,  -75, -107,  -71,  -47,   13,   17,  -58,
-     -96,   13,   24,  -64,   12,   17,  -58,  -32,   13,   40,  -52,  -44,   12,   17,  -58,   32,
-      14, -104,  -52,  -43,  -75,  -75, -123,  -47,  -91,  -67,  -71,  -47, -103,  -85,  107,   11,
-      26,   27,  -85,  107,  -85,   99,   11,  -93,  123, -109,   27,   66, -116,    1,   29, -116,
-      65,  -62,  101,  -82,  -82,  109,  -24,  -83,   77,   44,  -51,  -83,   76,  110, -120,   50,
-       6,  115,   48,    6,  101,   48,    6,  117,   32,    1,   99,   96,    7,   67, -124,   49,
-       0,    3,    6,  120,   28,  -46,  -36,  -24, -122,   16,   99, -112,    7,   99,  -96,    7,
-      12,  -14, -122,   16,   99,  -64,    7,   99,  -96,    7,  124,  -34,  -38,  -36,  -46,  -32,
-     -34,  -24,  -54,  -36,  -24,   64,  -58,  -48,  -62,  -28,   24,   77,  -91,  -75,  -63,  -79,
-    -107, -127,   12,  -67,   12,  -83,  -84, -128,   80,    9,    5,    5,   13,   17,  -58,  -32,
-      15, -122,    8,   66,   53,  -60,   24,    3,   63,   24,    3,   80,   16,  -86,   33,  -58,
-      24,  -24,  -63,   24, -120, -126,   80,   13,   49,  -58,   96,   20,  -58,   96,   20, -124,
-    -118,    4,  -37, -101,  -37,  -39,   16,   99,   12,   74,   97,   12,   68,   65,  -88, -122,
-      24,   99,   96,   10,   99,   96,   10,   66,  -59,  -62, -116,  -19,   45, -116,  110, -120,
-      49,    6,  -88,   48,    6,  -94,   32,   84,   67, -116,   49,   72, -123,   49,   72,    5,
-     -95,  -94,   65,  -10,   86,   39,  -58,   86,   54,  -60,   24, -125,   85,   24,    3,   81,
-      16,  -86,   33,  -58,   24,  -80,  -62,   24,  -80, -126,   80,   53,   98,   99,  -77,  107,
-     115,  105,  123,   35,  -85,   99,   43,  115,   49,   99,   11,   59, -101, -101,   34,   12,
-      69,   21,   54,   54,  -69,   54, -105,   52,  -78,   50,   55,  -70,   41,  -63,  -47,   99,
-       4,   78,   46,  -20,  -84,   45,  108, -118,  -96,   52,  117,   70,  -28,  -26,  -66,  -54,
-     -16,  -32,  -34,  -28,  -24,  -66,  -20,  -62,  -28,  -90,   32,  -48,   84,   97, -101,   23,
-       6,  100,   80,  104,   68,  110,  -18,  -21,   77,   76,  -83,  108, -116,  -18,  107, -114,
-     -19, -115,  110,  110,   74,   96,    6,  125,   70,  -28,  -26,  -66,  -54,  -16,  -32,  -34,
-     -28,  -24,  -66,  -52,  -22,  -36,  -58,  -90,    8,  104,  -96,    6,  -67,   70,  -28,  -26,
-     -66,  -54,  -16,  -32,  -34,  -28,  -24,  -66,  -52,  -34,  -28,  -54,  -62,  -58,  -48,  -66,
-     -36,  -62,  -38,  -54,  -90,    8,  108,  -32,    6, -107,   70,  -28,  -26,  -66,  -54,  -16,
-     -32,  -34,  -28,  -24,  -66,  -52,  -34,  -28,  -54,  -62,  -58,  -48,  -90,    8,  112,   32,
-       7, -115,   70,  -28,  -26,  -66,  -54,  -16,  -32,  -34,  -28,  -24,  -66,  -28,  -54,  -56,
-     -22,  -58,  -54,  -90,    4,  119,  -48,  103,   68,  110,  -18,  -85,   12,   15,  -18,   77,
-    -114,  -18, -117,   46,   15,  -82,  108,   74, -128,    7,   61,   74,  -96,  -34,  -46,  -36,
-     -24,  100,  -90,    8,  123,  -48,    7,    0,  121,   24,    0,    0,   92,    0,    0,    0,
+      64, -120,    4,   50,   66,  100,    4,  -40,  -95,    4,    0, -122,   12,    0,    0,    4,
+     -64,   14,  101,    0,   54, -124,    0,    0,   32,    0,  118,   40,    5,  -48,   33,    3,
+       0,    0,    1,  -80,   67,   57,    0,   15,   33,    0,    0,    8, -128,   29,   74,    0,
+      96,  -56,    0,    0,   64,    0,  -20,   80,   18,  -32,   67,    6,    0,    0,    2,   96,
+    -121,  -94,    0,   28,   50,    0,    0,   16,    0,  100,   96, -128,  -37,  -95,   60,   64,
+      24,    0,    3,    0,    0,    1,  -80,   67,  121,    0,   49,    0,    6,    0,    0,    2,
+      96, -120,   34,    1,    0,   16,    0,    0,    0,    4,   67,   20,   10,    0, -128,    0,
+       0,    0,   32,   24,  -94,   80,    0,    0,    4,    0,    0,    0,  -63,   16, -123,    2,
+       0,   64,    0,    0,    0,    8, -122,   40,   23,   16,    0,    3,    0,    0,   64,   48,
+      68,  -55,    0,    0,   32,    0,    0,    0, -126,   33,  -54,    6,    0,   67,    1,    0,
+       0,    0,   12,   81,   58,    0,   24,   12,    0,    0,    0,   96, -120,   34,    1,    0,
+      32,    0,    0,    0,    4,   67, -108,   15,    8, -128,    3,    0,    0,   32,   24,  -94,
+    -116,    1,    0,    0,    8,    0,    0,   64,   48,   68,   25,    3,    0,    0,   16,    0,
+       0, -128,   96, -120,   50,    6,    0,    0,   36,    0,    0,    0,   65,   22,    8,    0,
+      12,    0,    0,    0,   50,   30, -104,   24,   25,   17,   76, -112, -116,    9,   38,   71,
+     -58,    4,   67,    2,   70,    0,   74,  -96,   16,   72,   24,    1,  -96,   96,    4, -128,
+    -120,   17,    0,   50,   70,    0,    8,   25,    1,  -96,  101,    4, -128,   28,  -37,   13,
+     -62,  -74, -117,    0,  121,   24,    0,    0,  -13,    0,    0,    0,   26,    3,   76, -112,
+      70,    2,   19,   52,   68,    0,   48,   42,  119,   99,  104,   97,  114,   95,  115,  105,
+     122,  101,   67,    4,   32,   27,   98,    0,   24,   25,    4,   64,  -58,  -90,   45,  -51,
+     -19,  -85,  -52,  -83,  -82,  -19,  107,   46,   77,  -81,  108, -120,    1,   96,  100,   64,
+       0,   25,   -7,   32,  -56, -115,   76,  -18,   45, -115,   12,  100, -116,   45,  -52,  -19,
+      12,  -60,  -82,   76,  110,   46,  -19,  -51,   13,  100,  -58,    5,  -57,   69,  -26,  -90,
+    -122,    6,    7,    6,    4,    4,   69,   44,  108,  -82, -116,   12,  -28,  -51,   13, -124,
+    -119,  -55,  -86,    9,  100,  -58,    5,  -57,   69,  -26,  -90, -122,    6,    7,   38,  101,
+    -120,   64,    6,    6,   15,  -69,   50,  -71,  -71,  -76,   55,   55,    6,   49,   67,    8,
+      50,   64,  -56,   32,   97,  -92,   22,  102,   23,  -10,    5,   23,   54,  -74,   22,  118,
+      86,  -10,  -27,   22,  -42,   86,  -58,  105,  -20,  -83,  -51,   37,  -52, -115,   76,  -18,
+      45, -115,  -52,   69,  110,  -50, -123,  -82,  108, -114,  110,    8,   65,    6,   11,   25,
+      48,   60,  -20,  -62,  -28,  -66,  -46,  -36,  -24,   24,  -44,   12,   33,  -56,  -64,   33,
+    -125, -121, -120,   93, -104,  -36,   23,  -37, -101,  -37,   25,    3, -101,   33,    4,   25,
+      68,  100,   32,   49,  -79,   11, -109,   -5,   50,   99,  123,   11,  -93,   27,   66, -112,
+       1,   69,    6,    9,   21,  -69,   48,  -71,   47,  -78,  -73,   58,   49,  -74,   50,    6,
+      50,   67,    8,   50,  -80,  -56,  -32,  -94,   99,   23,   38,   -9,   21,  -58,  -58,  -10,
+      54,   22,   70, -105,  -10,  -26,   70,   65,    6,  102,    8,   65,    6,   25,   25,  104,
+     100,  -20,  -62,  -28,  -66,  -22,  -46,  -36,  -24,  102,  100,  -66,  -24,   24,  -28,   12,
+      33,  -56, -128,   35, -125, -114, -118,   93, -104,  -36,   23,  -36,   91, -102,   27,  -99,
+      12,   13,  -88,  -73,   52,   55,   58, -103,   33,    4,   25,  124,  100,    0,    6,   92,
+     -20,  -62,  -28,  -66,  -46,  -36,  -24,  -66,  -32,  -24,  -28,   72,  -88,  -92,  -71,  -47,
+      13,   33,  -56,   64,   12,  -56,   96,   12,   24,  -48,   12,   17,  -56,  -96,   12, -120,
+    -104,  -43,  -71, -115,  -47,  -91,  -67,  -71,   13,   17,  -56,  -32,   12,   24,  -71,  -96,
+    -107,  -79,  -63, -107,  -55,  125, -103,  -43,  -71, -115,  -47,  -91,  -67,  -71,   89,   13,
+      17,  -56,   32,   13,   24,  -71,  -96, -107,  -79,  -63, -107,  -55,  125,  -51, -107,  -47,
+       9,  -43, -103, -103, -107,  -55,   13,   17,  -56,   96,   13,   88,  -71,  -96, -107,  -79,
+     -63, -107,  -55,  125,  -51, -107,  -47,    5,  -79,  -79,  -67, -115, -123,  -47,  -91,  -67,
+     -71,   13,   17,  -56,  -96,   13,   72,  -56,  -67,  -67,  -47,   13,   17,  -56,  -32,   13,
+    -104,  -92,  -71, -115,  -55, -107,  -75, -107,  -71,  -47,   13,   17,  -56,   32,   14,   24,
+     -64,   12,   17,  -56,   96,   14,   40,  -52,  -44,   12,   17,  -56,  -96,   14, -104,  -52,
+     -43,  -75,  -75, -123,  -47,  -91,  -67,  -71,  -47, -103,  -85,  107,   11,   26,   27,  -85,
+     107,  -85,   99,   11,  -93,  123, -109,   27,   66, -112,    1,   30, -112,   65,  -62,  101,
+     -82,  -82,  109,  -24,  -83,   77,   44,  -51,  -83,   76,  110, -120,   66,    6,  119,   64,
+       6,  101,   64,    6,  121,    0,    1,  100,  -96,    7,   67,    4,   50,    0,    3,    6,
+     120,   28,  -46,  -36,  -24, -122,   16,  100,  -48,    7,  100,  -32,    7,   12,  -14, -122,
+      16,  100,    0,   10,  100,  -32,    7,  124,  -34,  -38,  -36,  -46,  -32,  -34,  -24,  -54,
+     -36,  -24,   64,  -58,  -48,  -62,  -28,   24,   77,  -91,  -75,  -63,  -79, -107, -127,   12,
+     -67,   12,  -83,  -84, -128,   80,    9,    5,    5,   13,   17,  -56,   96,   20, -122,    8,
+    -126,   54,  -60,   32,    3,   81,   32,    3,   82,   16,  -76,   33,    6,   25,   -8,    1,
+      25, -104, -126,  -96,   13,   49,  -56,  -32,   20,  -56,  -32,   20,    4, -115,    4,  -37,
+    -101,  -37,  -39,   16, -125,   12,   82, -127,   12,   76,   65,  -48, -122,   24,  100,  -96,
+      10,  100,  -96,   10, -126,  -58,  -62, -116,  -19,   45, -116,  110, -120,   65,    6,  -84,
+      64,    6,  -90,   32,  104,   67,   12,   50,  104,    5,   50,  104,    5,   65,  -93,   65,
+     -10,   86,   39,  -58,   86,   54,  -60,   32, -125,   87,   32,    3,   83,   16,  -76,   33,
+       6,   25,  -64,    2,   25,  -64, -126,  -96,  113,    9,  115,  -53,    3, -127,  123,   75,
+     115,  -93,   43, -109,   27,   98, -112, -127,   44, -112, -127,   41,    8,  -38,   16, -125,
+      12,  102, -127,   12,  102,   65,  -48,   26,  -79,  -79,  -39,  -75,  -71,  -76,  -67, -111,
+     -43,  -79, -107,  -71, -104,  -79, -123,  -99,  -51,   77,   17, -122,  -94,   10,   27, -101,
+      93, -101,   75,   26,   89, -103,   27,  -35, -108,  -32,  -24,   49,    2,   39,   23,  118,
+     -42,   22,   54,   69,   80, -102,   58,   35,  114,  115,   95,  101,  120,  112,  111,  114,
+     116,   95,  118,   97,  114,   83,   16,  104,  -86,  -80,  -51,   11,    3,   50,   40,   52,
+      34,   55,   -9,  -11,   38,  -90,   86,   54,   70,   -9,   53,  -57,  -10,   70,   55,   55,
+      37,   48, -125,   62,   35,  114,  115,   95,  101,  120,  112,  111,  114,  116,   95,  102,
+     117,  110,   99,   83,    8,   52,   80,    3,   54,  112, -125,   94,   35,  114,  115,   95,
+     101,  120,  112,  111,  114,  116,   95,  102,  111,  114,  101,   97,   99,  104,   95,  110,
+      97,  109,  101,   83,    4,   56, -112, -125,   74,   35,  114,  115,   95,  101,  120,  112,
+     111,  114,  116,   95,  102,  111,  114,  101,   97,   99,  104,   83,    4,   58,  -80, -125,
+      70,   35,  114,  115,   95,  101,  120,  112,  111,  114,  116,   95,  114,  101,  100,  117,
+      99,  101,   83, -126,   61,  -24,   51,   34,   55,   -9,   85, -122,    7,   -9,   38,   71,
+      -9,   69, -105,    7,   87,   54,   37,  -32, -125,   30,   37,   80,  111,  105,  110,  116,
+      50,   83, -124,   63,    8,    5,    0,    0,  121,   24,    0,    0,   92,    0,    0,    0,
       51,    8, -128,   28,  -60,  -31,   28,  102,   20,    1,   61, -120,   67,   56, -124,  -61,
     -116,   66, -128,    7,  121,  120,    7,  115, -104,  113,   12,  -26,    0,   15,  -19,   16,
       14,  -12, -128,   14,   51,   12,   66,   30,  -62,  -63,   29,  -50,  -95,   28,  102,   48,
@@ -201,236 +247,309 @@
     -127,   30,  -36,  -32,   28,  -28,  -31,   29,  -22,    1,   30,  102,   24,   81,   56,  -80,
       67,   58, -100, -125,   59,  -52,   80,   36,  118,   96,    7,  123,  104,    7,   55,   96,
     -121,  119,  120,    7,  120, -104,   81,   76,  -12, -112,   15,  -16,   80,   14,    0,    0,
-     113,   32,    0,    0,   56,    0,    0,    0,    6,   17,    6,   -1,   92,  -33, -111,  -60,
-      45,    4,   16,  -95,   65,   66,    8,   83,   90,  -33, -111,  -12,    3,  -53,  -30,    8,
-     -64, -124,   56, -115,   13,   40,   21,   16,   -3, -125,   67,    5,   11,   97,    5,   74,
-       5,   68,   -1,  -29,   32,  -51,  100,   27,   67, -126,   52,   66,   68,   48,   68,   51,
-    -103,    2,   82,   80, -115,   48,   33,   78,   99,    4,   73,    5,   68,   63,   16,   69,
-       0,  102,   17, -111,  127,   16,  -53,   67,   68,  127,   65,   53,  -62, -124,   56,  -51,
-     107,   14, -117,   68,   49, -100,  -61,    4,   72,   67,   68,  102,  -32,   84,   64,  -12,
-       3,  -53,  -30,    8,  -64, -124,   56, -115,   33,  112,  126,   36,   -7,   17,   49,   80,
-       2,  -15,   23, -115,   47,   81, -116,   38,    8,   20,   67,   45,  -64,  -28,   68,    6,
-     112,   84,   64,  -12,   35,  -51,  100,   13, -114,   68,   49, -102,   32,   80,   12,  -75,
-       0, -109,   19,   89,    0,   82,    1,  -47,  -65,   56, -115,   97,    7,   78,    5,   68,
-      -1,  -29,   32,  -51,  100,   -1,  -49,   20,  -39,    3,  -30,   71, -110,   63,   76,   78,
-     100,   11,   73,   65,   53,  -62, -124,   56,  -51,  107,    2,   73,    5,   68,  127,  -79,
-      56,  -64,  100,    9, -103,   31,   73,  126,   68,   12, -108,   64,   -4,   69,  -29,   75,
-      20,  -61,   57,   76, -128,   52,   68,    4,   97,   32,    0,    0,   54,    0,    0,    0,
-      19,    4,   65,   44,   16,    0,    0,    0,   20,    0,    0,    0,    4, -108,   66,   49,
-    -108,   67,   17,   20,   68,   25, -108,   68,   81, -112,   80,    4,   20,   12,  101,   36,
-       4,   32,    1,  -45,   80,   70,   66,    0,   18,   16,    6,   67,   25,    9,    1,   72,
-     -64,   24,   12,  101,   44,    5,   32,    1,  -46,   80,  -58,   82,    0,   18,   48,   13,
-     101,   36,    4,   32,    1,   18,   17,   99,    4,   32,    8, -126,   36,   24, -112,   49,
-      70,    0, -126,   32,    8, -126,   32,    8, -126,   36,   72,    0, -125,   17,  -64,   52,
-       0, -125,   17, -127,   25,   16,  -64,   96, -124,  -48,    6,    3,   48,   24,   49,  -72,
-       1,    1,   12,   70,  -80, -127,   55,    0, -125,   17,  103,  -16,   13,  -64,   96,    4,
-      26, -128,  -63,    0,   12,   70,  -92, -127,   24,   12,  -64,   96, -124,   26, -112,  -63,
-       0,   12,   70,  -84,   65,   25,   12,    0,    6,  -60,    0,    0,   13,    0,    0,    0,
-      91,    6,   32,   32, -123,   45,   67,   16, -100,  -62, -106,   65,    8,   84,   97,  -53,
-      48,    4,  -83,  -80,  101,   32,    2,   82,  -40,   50,   20,    1,   41,  108,   25, -116,
-    -128,   20,  -74,   12,   71,   64,   10,   91,    6,   36,   32, -123,   45,   67,   18, -112,
-       2,    0,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,   11,    0,    0,    0,
-      19,    4,  -63,   96,    4,  -32,   13,    0, -122,    3,    1,    0,    2,    0,    0,    0,
-     -26,   49,    0, -111,    1,    0,    0,    0,    1,   49,    0,    0,    2,    0,    0,    0,
-      91,    6,   32,   32,    5,    0,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,
-      11,    0,    0,    0,   19,    4,  -63,  121,   64,  -40,   55,  -63,  -32,  -64,  -32, -127,
-      12, -125,  112,   32,    5,    0,    0,    0,  -10,   65,    8,   78,   83, -103, -121, -128,
-      52,   22,   82,    8,   78,   83,  -43,    6,   50,    0,  -61,    0,    0,    0,    0,    0,
-      97,   32,    0,    0,   16,    0,    0,    0,   19,    4,    1,  121,  -61,  -64,  -32,    3,
-     -63,   96, -124,   23,    6,    3, -128,  -31,   64,    0,    0,    0,    4,    0,    0,    0,
-     -10,   49,   84,  -64,   98,   30,    5,   32,    8,   20,   99,   33,    3,   48,   12,    0,
-       1,   49,    0,    0,    3,    0,    0,    0,   91,    6,   32,   32, -123,   45, -125,   16,
-    -112,    2,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,   17,    0,    0,    0,
-      19,    4,    1,  125, -125,  -68,   97,   97,    0,    6,   32,   24, -116,  -16,  -60,   96,
-       0,   48,   28,    8,    4,    0,    0,    0,  -10,   49,   84,  -64,   98,   30,    5,   32,
-       8,   20,   99,   34,    3,   48,   12,    0,    1,   49,    0,    0,    4,    0,    0,    0,
-      91,    6,   32,   32, -123,   45,   67,   16, -112,  -62, -106,   97,    8,   72,    1,    0,
-       0,    0,    0,    0,   97,   32,    0,    0,    3,    0,    0,    0,   19,    4,  -63, -120,
-       1, -127,    4, -112, -127,    0,    0,    0,   97,   32,    0,    0,    9,    0,    0,    0,
-      19,    4,  -63,  120, -125,   39,   73,  -12, -115,   17,    3,    2,    8,   22,   48,  -64,
-     112,   32,    0,    0,    2,    0,    0,    0,    7,   80,   16,  -51,   20,   97,    0,    0,
-       0,    0,    0,    0,    0,    0,    0,    0,
+     113,   32,    0,    0,   78,    0,    0,    0,   70,  -64,   84,   64,  -12,   83,   72,   51,
+     -35,  -10,   63,  -39, -128,   82,    1,  -47,   63,   56,   84,  -80,   16,  -90, -128,   20,
+      84,   35,   76, -120,  -45, -104,  -63,   82,    1,  -47, -113,   52,  -45,   -1,   76, -111,
+      53,   52,   18,   49,  105,  -53,  -30,    8,  -64, -124,   56, -115,    5,   32,   21,   16,
+      -3, -117,  -45,   24,  -74, -112,   20,   84,   35,   76, -120,  -45,  -68,  -26, -112,    6,
+      -1,  108,  -45, -111,  -60,   18, -109,  -73,   16,   12,  -47,   76,  -38,  -12,   83,  -62,
+       1,   68,  -11,   29,   73,   63,  -80,   44, -114,    0,   76, -120,  -45,   28, -119,   77,
+    -124,  -63,   63,  -41,  119,   36,  113,   11,    1,   68,  104, -112,   16,  -62, -108,  -42,
+     119,   36,   -3,  -64,  -78,   56,    2,   48,   33,   78,   99,   22, -107,  127,   16,  -53,
+      67,   68,  -65,   68,   76,  -38,  -78,   56,    2,   48,   33,   78,   99,    2,   73,    5,
+      68,  127,  -79,   56,  -64,  100,    5,   74,    5,   68,   -1,  -29,   32,  -51,  100,  -37,
+      67, -126,   52,   66,   68,   48,   68,   51,   25,   67,   34,   17,  -45,   70,   21,    5,
+      17,   89,  -60,   34,   81,   12,  -25,   48,    1,  -46,   16, -111,   37,  100,  126,   36,
+      -7,   17,   49,   80,    2,  -15,   23, -115,   47,   81,   12,  -25,   48,    1,  -46,   16,
+    -111,   81,   68,   -2,   65,   44,   15,   17,   -3,    5,  -43,    8,   19,  -30,   52,  -81,
+      29,   56,   21,   16,   -3,  -64,  -78,   56,    2,   48,   33,   78,   99,    8, -100,   31,
+      73,  126,   68,   12, -108,   64,   -4,   69,  -29,   75,   20,  -93,    9,    2,  -59,   80,
+      11,   48,   57, -111,    1,   28,   21,   16,   -3,   72,   51,   89,   69,  -28,   31,  -60,
+     -14,   16,  -47,   47,   17,  -45,   70,   21,    5,   17,   25, -124,   35,   81, -116,   38,
+       8,   20,   67,   45,  -64,  -28,   68,   38, -127,   -8, -111,  -28,   15, -109,   19,    1,
+      97,   32,    0,    0,   37,    0,    0,    0,   19,    4,   65,   44,   16,    0,    0,    0,
+      12,    0,    0,    0,    4, -108,   66,   49, -108,    3,    9,   69,   64,  -63,   80,   70,
+      82,    0,   23, -128,   13,  101,   36,    5,  112,    1,   23,   17,   99,    4,   32,    8,
+    -126,   36,   24, -112,   49,   70,    0, -126,   32,    8, -126,   32,    8, -126,   36,   72,
+       0,    0,    0,    0, -125,   17,    0,   54,    0, -125,   17,   65,   25,   16,  -64,   96,
+    -124, -128,    6,    3,   48,   24,   49,  -92,    1,    1,   12,   70,   16,   98,   48,    0,
+    -125,   17,  103,   48,    6,    3,   48,   24,   97,    6,  100,   48,    0,   24,   16,    3,
+       9,    0,    0,    0,   91,    6,   32,   64, -123,   45,   67,   16,  -84,  -62, -106,   65,
+       8,   92,   97,  -53,   48,    4,  -79,  -80,  101,   32,    2,   84,  -40,   50,   20,    1,
+      42,  108,   25, -116,    0,   21,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,
+      11,    0,    0,    0,   19,    4,  -63,   96,    4,   32,    6,    3, -128,  -31,   64,    0,
+       2,    0,    0,    0,   38,   50,    0, -111,    1,    0,    0,    0,    1,   49,    0,    0,
+       2,    0,    0,    0,   91,    6,   32,   64,    5,    0,    0,    0,    0,    0,    0,    0,
+      97,   32,    0,    0,   38,    0,    0,    0,   19,    4,   68,   44,   16,    0,    0,    0,
+       1,    0,    0,    0,    4, -108,    2,    0,  -61,   13,   98,  112, -103,  -63,   44,   67,
+      48, -112,    1,   25,   99, -106,   64,   24,  -88,    0,  -82,    0,   13, -124,  -15, -124,
+      50,   48, -125,  -63, -120,   51,   24, -125,    1,   48,   51,  -64,   96,   48,  -36, -128,
+       6,   98,    0,    6,  -77,   12, -125, -112,    6,   24,   14,    4,   14,    0,    0,    0,
+      23,   96,   -8,   75,  -28,   63,  -57,   13,   44,   -2,   47,   68,  -56,  -12,   19, -125,
+      65,  -40,    9,    2,   68,   17, -128,   33,  -61,  101,   36, -124,  -64,   60,  -72, -119,
+      12,    3,  -62,   24,  -54, -128,   52, -126, -103,   16, -120,   79,  -25, -106, -126,   16,
+      23,   50,    9,   78,   51,    0,    0,    0,    1,   49,    0,    0,    3,    0,    0,    0,
+      91,    6,   33,  -96, -123,   45, -125,   17,  -96,    2,    0,    0,    0,    0,    0,    0,
+      97,   32,    0,    0,   36,    0,    0,    0,   19,    4,   67,   44,   16,    0,    0,    0,
+       3,    0,    0,    0,  -44, -108,    3,    5,  -74,  -52,    1,   85,   51,    0,    0,    0,
+     -61,   13,   98,  112, -103,  -63,   44,   67,   32, -104,  -63,   64,    5,  -96,    6,  -63,
+       5,   16,   25, -116,  -39, -122,   50,   64,    3,   96,  -60,  -64,   80,    2,   39,   13,
+     -58,  -32,   12,  -20,   12,   48,   24,   12,   55,  -88, -127,   24, -128,  -63,   44, -125,
+      16,  -84,    1, -122,    3,    1,    0,    0,   14,    0,    0,    0, -122,  114,   -8,   84,
+     -13,    0, -126,  114,    1, -122,  -65,   68,   -2,  115, -100,  -64,  -30,   -1,   66, -124,
+      76,   63,   49,   24, -124, -103,   16,    2,  -13,  -32,   38,   50,   12,    8,   99,   42,
+       3,  -46,    8,  118,   66,   92,   62,  -99,  -37,   10,   66,   92,  -56,   36,   56,  -51,
+       0,    0,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,   12,    0,    0,    0,
+      19,    4,  -63, -119,    1,   16,   54,    6,   24,   12, -114,   12,   26,  -56,   50,    8,
+       7,    2,    0,    0,    5,    0,    0,    0,   54,   66,    8,   78,   83, -103, -120, -128,
+      52,   86,   82,    8,   78,   83,  -43,   70,   50,    0,  -61,    0,    0,    0,    0,    0,
+      97,   32,    0,    0,   16,    0,    0,    0,   19,    4,    1, -119,  -63,   48,   50,   24,
+       3,   16,   12,   70, -120,   65,   25,   12,    0, -122,    3,    1,    4,    0,    0,    0,
+      54,   50,   84,  -64,   98,   34,    5,   32,    8,   20,   99,   37,    3,   48,   12,    0,
+       1,   49,    0,    0,    3,    0,    0,    0,   91,    6,   32,   64, -123,   45, -125,   16,
+     -96,    2,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,   18,    0,    0,    0,
+      19,    4,    1, -115,  -63,   32,   49,   24,   86,    6,  100,    0, -126,  -63,    8,   49,
+      48, -125,    1,  -64,  112,   32,    0,    0,    4,    0,    0,    0,   54,   50,   84,  -64,
+      98,   34,    5,   32,    8,   20,   99,   38,    3,   48,   12,    0,    1,   49,    0,    0,
+       4,    0,    0,    0,   91,    6,   32,   64, -123,   45,   67,   16,  -96,  -62, -106,   97,
+       8,   80,    1,    0,    0,    0,    0,    0,   97,   32,    0,    0,    3,    0,    0,    0,
+      19,    4,  -63, -120,    1,  -79,    4,  -45, -127,    0,    0,    0,   97,   32,    0,    0,
+       9,    0,    0,    0,   19,    4,  -63,  120, -125,   24,   92,   23, -115,  -63,   24,   49,
+      32, -128,   96,   33,    3,   12,    7,    2,    2,    0,    0,    0,    7,   80,   16,  -51,
+      20,   97,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,    9,    0,    0,    0,
+      19,    4,  -63,  120, -125,   24,   92,   23, -115,  -63,   24,   49,   32, -128, -128,   33,
+       3,   12,    7,    2,    2,    0,    0,    0,    7,   80,   16,  -51,   20,   97,    0,    0,
+       0,    0,    0,    0,   97,   32,    0,    0,    9,    0,    0,    0,   19,    4,  -63,  120,
+    -125,   24,   92,   23, -115,  -63,   24,   49,   32, -128,  -96,   33,    3,   12,    7,    2,
+       2,    0,    0,    0,    7,   80,   16,  -51,   20,   97,    0,    0,    0,    0,    0,    0,
+       0,    0,    0,    0,
 };
 
-const int bitCodeLength = 2776;
+const int bitCodeLength = 3364;
 
 #else
 
 const int8_t bitCode[] = {
-     -34,  -64,   23,   11,    0,    0,    0,    0,   44,    0,    0,    0, -116,   10,    0,    0,
+     -34,  -64,   23,   11,    0,    0,    0,    0,   44,    0,    0,    0,  108,   13,    0,    0,
        0,    0,    0,    0,   -1,   -1,   -1,   -1,    0,    0,    0,    0,    1,   64,    4,    0,
       96,    9,    0,    0,    2,   64,    4,    0,    3,    0,    0,    0,   66,   67,  -64,  -34,
-      33,   12,    0,    0,  -96,    2,    0,    0,    1,   16,    0,    0,   18,    0,    0,    0,
+      33,   12,    0,    0,   88,    3,    0,    0,    1,   16,    0,    0,   18,    0,    0,    0,
        7, -127,   35, -111,   65,  -56,    4,   73,    6,   16,   50,   57, -110,    1, -124,   12,
       37,    5,    8,   25,   30,    4, -117,   98, -128,   24,   69,    2,   66, -110,   11,   66,
      -60,   16,   50,   20,   56,    8,   24,   73,   10,   50,   68,   36,   72,   10, -112,   33,
       35,  -60,   82, -128,   12,   25,   33,  114,   36,    7,  -56, -120,   17,   98,  -88,  -96,
-     -88,   64,  -58,  -16,    1,    0,    0,    0,   73,   24,    0,    0,   24,    0,    0,    0,
+     -88,   64,  -58,  -16,    1,    0,    0,    0,   73,   24,    0,    0,   33,    0,    0,    0,
       11, -124,   -1,   -1,   -1,   -1,   31,  -64,   96, -127,  -16,   -1,   -1,   -1,   -1,    3,
-      24,   45,   32,    2,   16,    4,   65,   16,   36,   -2,   -1,   -1,   -1,  127,    0, -125,
-       5,   70,    0, -126,   32,    8, -126, -124,    0, -126,   32,    8, -126,  -60,   -1,   -1,
-      -1,   -1,   15,   96,  -80,   64,   -8,   -1,   -1,   -1,   -1,    1,   12,   22,    8,   -1,
-      -1,   -1,   -1,   63,    0,   11, -120,    0,    4,   65,   16,    4, -119,   -1,   -1,   -1,
-      -1,   31,  -64,   80,   88,   64,    4,  -64,   -1,   -1,   -1,   -1,   15,   96,    0,    0,
-    -119,   32,    0,    0,   34,    0,    0,    0,   50,   34, -120,    9,   32,  100, -123,    4,
-      19,   35,  -92, -124,    4,   19,   35,  -29, -124,  -95, -112,   20,   18,   76, -116, -116,
-      11, -124,  -60,   76,   16, -112,  -63,   28,    1,   24,   16,   48,   71,    0,   10,   36,
-     -52,    0,   16,   49,    4,   64,   70,   18,    0, -124,   28,   36,   77,   17,   37,   76,
-     126,  -22,   32,  -51,  100,   -5,   61, -114,    4,    0,   32,  -27,   46,  105, -118,   40,
-      97,  -14,   35,  -23,    7, -106,  -59,   17, -128,    9,  113,   26,  -65,  -49,   17,   49,
-      12,  -61,   64,   12,   45,  115,    4,    8,   61,    4, -115,    0, -108,   64,  -94,  -87,
-       8,   18,   64,   85,   17,  -98, -121,  -82,   50,   72,    1,   64,   89,   25,  -92,   32,
-     -96,  -83,    8,   82,   67,  -99,    9,    0,   -6, -118,   32, -127,   20,   14,    4,    0,
-      19,  -76,  112,    8,    7,  121,   24,    7,  116,  -80,    3,   58,  104,    3,  119,  120,
-       7,  119,   40, -121,   54,   96, -121,  116,  112, -121,  122,  -64, -121,   54,   56,    7,
-     119,  -88, -121,  114,    8,    7,  113,   72, -121,   13,  115,   80,   14,  109,  -48,   14,
-     122,   80,   14,  109, -112,   14,  120,  -96,    7,  120,  -96,    7,  115,   32,    7,  109,
-    -112,   14,  113,   96,    7,  122,   16,    7,  118,  -96,    7,  115,   32,    7,  109, -112,
-      14,  118,   64,    7,  122,   96,    7,  116,  -48,    6,  -23,   16,    7,  114, -128,    7,
-     122,   16,    7,  114, -128,    7,  109,  -32,   14,  115,   32,    7,  122,   96,    7,  116,
-     -48,    6,  -77,   16,    7,  114, -128,    7,   58,   15,  -92,   72,   32,   35,   68,   70,
-    -128,   29,   74,    0,   76,  -56,    0,    0,   64,    0,  -20,   80,    6, -128,   66,    8,
-       0,    0,    2,   96, -121,   82,    0,   21,   50,    0,    0,   16,    0,   59, -108,    3,
-     -80,   16,    2,    0, -128,    0,  -40,  -95,   36,  -64, -123,   12,    0,    0,    4,  -64,
-      14,  101,    1,   48,  100,    0,    0,   32,    0,  -40,  104,  -56,   29, -118,    3,  100,
-       8,    1,    0,   64,    0,  -20,   80,   34,   96,    3,    8,    0,    0,    2,   96, -121,
-      18,    1,   28,   64,    0,    0,   16,    0,   67,   20,   10,    0, -128,    0,    0,    0,
-      32,   24,  -94,   88,    0,    0,    4,    0,    0,    0,  -63,   16,    5,    3,    0,   64,
-       0,    0,    0,    8, -122,   40,   26,    0,   12,    3,    0,    0,    0,   48,   68,  -31,
-       0,   96,   32,    0,    0,    0, -128,   33,   10,    5,    0,   64,    1,    0,    0,   16,
-      12,   81,   60,   32,    0,   12,    0,    0, -128,   96, -120,   34,    6,    0,    0,   28,
-       0,    0,    0,   65,   22,    8,    0,    0,   13,    0,    0,    0,   50,   30, -104,   20,
-      25,   17,   76, -112, -116,    9,   38,   71,  -58,    4,   67,    2,   70,    0,   72,   24,
-       1,   32,   98,    4, -128, -116,   17,    0,   66,   70,    0,   72,   25,    1,  -96,  101,
-       4, -128, -104,   17,    0, -126,  108,  -75,    6,   91,  -50,    1,    0,    0,    0,    0,
-     121,   24,    0,    0,  -48,    0,    0,    0,   26,    3,   76, -112,   70,    2,   19,   68,
+      24,   44,   16,   -2,   -1,   -1,   -1,  127,    0,   22,   24,    1,    8, -126,   32,    8,
+      18,    2,    8, -126,   32,    8,   18,   -1,   -1,   -1,   -1,   63, -128,  -63,    2,  -31,
+      -1,   -1,   -1,   -1,    7,   48,   90,   64,    4,   32,    8, -126,   32,   72,   -4,   -1,
+      -1,   -1,   -1,    0,    6,   11, -116,    0,    4,   65,   16,    4,    9,    1,    4,   65,
+      16,    4, -119,   -1,   -1,   -1,   -1,   31,  -64,   96,    1,   17, -128,   32,    8, -126,
+      32,  -15,   -1,   -1,   -1,   -1,    3,   24,   10,   11, -120,    0,    4,   65,   16,    4,
+    -119,   -1,   -1,   -1,   -1,   31,  -64,   80,   88,   64,    4,  -64,   -1,   -1,   -1,   -1,
+      15,   96,    0,    0, -119,   32,    0,    0,   38,    0,    0,    0,   50,   34, -120,    9,
+      32,  100, -123,    4,   19,   35,  -92, -124,    4,   19,   35,  -29, -124,  -95, -112,   20,
+      18,   76, -116, -116,   11, -124,  -60,   76,   16,  -96,  -63,   28,    1,   24,   16,   48,
+      71,    0,   10,   36,  -52,    0,   16,   49,    4,   64,  -58,   65,  -46,   20,   81,  -62,
+     -28,  -89,   14,  -46,   76,  -74,  -33,  -29,   72,    0,    0,   66,   40,  -72,   75, -102,
+      34,   74, -104,   -4,   72,   -6, -127,  101,  113,    4,   96,   66, -100,  -58,  -17,  115,
+      68,   12,  -61,   48,  -48,   50,   71, -128,   80,   67,  -50,    8,   64,    9,   32, -118,
+    -118,    0,    1,   52,   21,    2,   98,   26, -128,  -86,   57, -126,  -96,   24, -112,  -29,
+       8,  -64,   69,   88,   17, -102, -122,  -76,   50,   64,    1,   64,   92,   25,  -96,   32,
+      32,  -81,    8,   16,   67,  -96,    9,    0,   18, -117,    0, -115,   68,   14,    4,   76,
+       1,    0,    0,    0,   19,  -76,  112,    8,    7,  121,   24,    7,  116,  -80,    3,   58,
+     104,    3,  119,  120,    7,  119,   40, -121,   54,   96, -121,  116,  112, -121,  122,  -64,
+    -121,   54,   56,    7,  119,  -88, -121,  114,    8,    7,  113,   72, -121,   13,  115,   80,
+      14,  109,  -48,   14,  122,   80,   14,  109, -112,   14,  120,  -96,    7,  120,  -96,    7,
+     115,   32,    7,  109, -112,   14,  113,   96,    7,  122,   16,    7,  118,  -96,    7,  115,
+      32,    7,  109, -112,   14,  118,   64,    7,  122,   96,    7,  116,  -48,    6,  -23,   16,
+       7,  114, -128,    7,  122,   16,    7,  114, -128,    7,  109,  -32,   14,  115,   32,    7,
+     122,   96,    7,  116,  -48,    6,  -77,   16,    7,  114, -128,    7,   58,   15, -124,   72,
+      32,   35,   68,   70, -128,   29,   74,    0,  100,  -56,    0,    0,   64,    0,  -20,   80,
+       6,   96,   67,    8,    0,    0,    2,   96, -121,   82,    0,   31,   50,    0,    0,   16,
+       0,   59, -108,    3,    0,    3, -124,    0,    0,   32,    0,  118,   40,    1, -112,   33,
+       3,    0,    0,    1,  -80,   67,   73, -128,   48,   64,    6,    0,    0,    2,   96, -121,
+     -94,    0,   30,   66,    0,    0,   16,    0,  100,   98, -128,  -36,  -95,   60,  -64,   24,
+       0,    4,    0,    0,    1,  -80,   67,  121,    0,   50,    0,    8,    0,    0,    2,   96,
+    -120,   34,    1,    0,   16,    0,    0,    0,    4,   67,   20,   10,    0, -128,    0,    0,
+       0,   32,   24,  -94,   80,    0,    0,    4,    0,    0,    0,  -63,   16, -123,    2,    0,
+      64,    0,    0,    0,    8, -122,   40,   22,   16,    0,    3,    0,    0,   64,   48,   68,
+     -55, -128,    0,   32,    0,    0,    0, -128,   33,  -54,    6,    0,   64,    1,    0,    0,
+      16,   12,   81,   58,    0,   24,   12,    0,    0,    0,   96, -120,  -14,    1,  -64,  112,
+       0,    0,    0,    0,   67,   20,    9,    0,    0,    1,    0,    0,   32,   24,  -94, -124,
+       1,   16,    0,    3,    0,    0,   64,   48,   68,   41,    3,    0,    0,   16,    0,    0,
+    -128,   96, -120,   82,    6,    0,    0,   32,    0,    0,    0,  -63,   16,  -91,   12,    0,
+       0,   72,    0,    0,    0, -126,   44,   16,   13,    0,    0,    0,   50,   30, -104,   24,
+      25,   17,   76, -112, -116,    9,   38,   71,  -58,    4,   67,    2,   70,    0,   72,   40,
+    -104,   17, -128, -126,   40,   16,   10,   70,    0, -120,   24,    1,   32,   99,    4, -128,
+    -112,   17,    0,   90,   70,    0,  -56,  -79,  -19,   34,  108,   63,    9,    0,    0,    0,
+     121,   24,    0,    0,  -22,    0,    0,    0,   26,    3,   76, -112,   70,    2,   19,   68,
       62,    8,  114,   35, -109,  123,   75,   35,    3,   25,   99,   11,  115,   59,    3,  -79,
       43, -109, -101,   75,  123,  115,    3, -103,  113,  -63,  113, -111,  -71,  -87,  -95,  -63,
     -127,    1,    1,   65,   17,   11, -101,   43,   35,    3,  121,  115,    3,   97,   98,  -78,
-     106,    2, -103,  113,  -63,  113, -111,  -71,  -87,  -95,  -63, -127,   73,   25,   34, -116,
-       1,  -64,  -61,  -82,   76,  110,   46,  -19,  -51, -115,   65,  -52,   16,   98,   12, -124,
-      49,   24,   24,  -87, -123,  -39, -123,  125,  -63, -123, -115,  -83, -123,  -99, -107,  125,
+     106,    2, -103,  113,  -63,  113, -111,  -71,  -87,  -95,  -63, -127,   73,   25,   34, -104,
+       1,  -64,  -61,  -82,   76,  110,   46,  -19,  -51, -115,   65,  -52,   16,  -62,   12,    4,
+      51,   24,   24,  -87, -123,  -39, -123,  125,  -63, -123, -115,  -83, -123,  -99, -107,  125,
      -71, -123,  -75, -107,  113,   26,  123,  107,  115,    9,  115,   35, -109,  123,   75,   35,
-     115, -111, -101,  115,  -95,   43, -101,  -93,   27,   66, -116,   65,   49,    6,    6,   15,
-     -69,   48,  -71,  -81,   52,   55,   58,    6,   53,   67, -120,   49,   64,  -58,   32,   33,
-      98,   23,   38,   -9,  -59,  -10,  -26,  118,  -58,  -64,  102,    8,   49,    6,  -53,   24,
-      48,   76,  -20,  -62,  -28,  -66,  -52,  -40,  -34,  -62,  -24, -122,   16,   99,  -32, -116,
+     115, -111, -101,  115,  -95,   43, -101,  -93,   27,   66, -104,   65,   97,    6,    6,   15,
+     -69,   48,  -71,  -81,   52,   55,   58,    6,   53,   67,    8,   51,   64,  -52,   32,   33,
+      98,   23,   38,   -9,  -59,  -10,  -26,  118,  -58,  -64,  102,    8,   97,    6, -117,   25,
+      48,   76,  -20,  -62,  -28,  -66,  -52,  -40,  -34,  -62,  -24, -122,   16,  102,  -32, -104,
      -63,   64,  -59,   46,   76,  -18, -117,  -20,  -83,   78, -116,  -83, -116, -127,  -52,   16,
-      98,   12,  -96,   49, -120,  -24,  -40, -123,  -55,  125, -123,  -79,  -79,  -67, -115, -123,
-     -47,  -91,  -67,  -71,   81, -112, -127,   25,   66, -116,  -63,   52,    6,   20,   19,  -69,
-      48,  -71,  -81,   48,   57,  -71,  -80,   60,   62,   60,   67,  111,  110,  115,  116,   97,
-     110,  116,   65,  114,  114,   97,  121,   62,   67, -120,   49,  -80,  -58,  -32,  -94,   98,
-      23,   38,   -9,    5,   -9, -106,  -26,   70,   39,   67,    3,  -22,   45,  -51, -115,   78,
-     102,    8,   49,    6,  -39,   24,  104,  116,  -20,  -62,  -28,  -66,  -32,  -34,  -46,  -36,
-     -24,  100,  -66,  -32,  -24,  -28,  120,  -88,   64,  -67,  -91,  -71,  -47,  -55,   12,   33,
-     -58, -128,   27, -125, -114,    1,  -51,   16,   97,   12,   62,   34,  102,  117,  110,   99,
-     116,  105,  111,  110,   67, -124,   49,    8,    3,   70,   46,  104,  101,  108,  112,  101,
-     114,   95,  102,  117,  110,   99,  116,  105,  111,  110,   86,   67, -124,   49,   24,    3,
-      18,  114,  111,  111,  116,   67, -124,   49,   40,    3,   38,  105,  110,   99,  114,  101,
-     109,  101,  110,  116,   67, -124,   49,   56,    3,    6,   48,   67, -124,   49,   72,    3,
-      10,   51,   53,   67, -124,   49,   88,    3,   38,  115,  117,  109,  109,   97,  116,  105,
-     111,  110,  116,  -26,  -22,  -38, -126,  -58,  -58,  -22,  -38,  -22,  -40,  -62,  -24,  -34,
-     -28, -122,   16,   99,  -32,    6,   99,   48,  112, -103,  -85,  107,   27,  122,  107,   19,
-      75,  115,   43, -109,   27,  -94, -116,   65,   27, -116,  -63,   55,    6,  111,   32,    1,
-      99,    0,    7,   67, -124,   49,  -48,   24,  -32,  113,   72,  115,  -93,   27,   66, -116,
-     -63,   28, -116,    1,   29,   48,  -56,   27,   66, -116, -127,   29, -116,    1,   29,  -16,
-     121,  107,  115,   75, -125,  123,  -93,   43,  115,  -93,    3,   25,   67,   11, -109,   99,
-      52, -107,  -42,    6,  -57,   86,    6,   50,  -12,   50,  -76,  -78,    2,   66,   37,   20,
-      20,   52,   68,   24, -125,   60,   24,   34,    8,  -45,   16,   99,   12,  -16,   96,   12,
-     -12,   64, -104, -122,   24,   99,   64,    7,   99,  -64,    7,  -62,   52,  -60,   24, -125,
-      62,   24, -125,   62,   16,   38,   18,  108,  111,  110,  103,   67, -116,   49,   -8, -125,
-      49,  -32,    3,   97,   26,   98, -116,    1,   40, -116,    1,   40,    8,   19,   11,   51,
-     -74,  -73,   48,  -70,   33,  -58,   24, -120,  -62,   24,  -16, -127,   48,   13,   49,  -58,
-      96,   20,  -58,   96,   20, -124, -119,    6,  -39,   91,  -99,   24,   91,  -39,   16,   99,
-      12,   74,   97,   12,   -8,   64, -104, -122,   24,   99,   96,   10,   99,   96,   10,  -62,
-      84, -123, -115,  -51,  -82,  -51,   37, -115,  -84,  -52, -115,  110,   74,   16,  -12,   24,
-    -127, -109,   11,   59,  107,   11, -101,   34,   16,   71,  -99,   17,  -71,  -71,  -81,   50,
-      60,  -72,   55,   57,  -70,   47,  -69,   48,  -71,   41, -120,  -46,   60,   82, -123,  109,
-      94,  -95,   17,  -71,  -71,  -81,   55,   49,  -75,  -78,   49,  -70,  -81,   57,  -74,   55,
-     -70,  -71,   41,    1,   24,  -12,   25, -111, -101,   -5,   42,  -61, -125,  123, -109,  -93,
-      -5,   50,  -85,  115,   27, -101,   34, -120,    1,   25,  -12,   26, -111, -101,   -5,   42,
-     -61, -125,  123, -109,  -93,   -5,   50,  123, -109,   43,   11,   27,   67,   -5,  114,   11,
-     107,   43, -101,   34, -104,    1,   26,   84,   26, -111, -101,   -5,   42,  -61, -125,  123,
-    -109,  -93,   -5,   50,  123, -109,   43,   11,   27,   67, -101,   34,  -88,    1,   27,   52,
-      26, -111, -101,   -5,   42,  -61, -125,  123, -109,  -93,   -5, -110,   43,   35,  -85,   27,
-      43, -101,   18,  -60,   65,  -97,   17,  -71,  -71,  -81,   50,   60,  -72,   55,   57,  -70,
-      47,  -70,   60,  -72,  -78,   41, -127,   28,  -12,   40, -127,  122,   75,  115,  -93, -109,
-    -103,   34,  -44,  -63,   29,    0,    0,    0,  121,   24,    0,    0,   92,    0,    0,    0,
-      51,    8, -128,   28,  -60,  -31,   28,  102,   20,    1,   61, -120,   67,   56, -124,  -61,
-    -116,   66, -128,    7,  121,  120,    7,  115, -104,  113,   12,  -26,    0,   15,  -19,   16,
-      14,  -12, -128,   14,   51,   12,   66,   30,  -62,  -63,   29,  -50,  -95,   28,  102,   48,
-       5,   61, -120,   67,   56, -124, -125,   27,  -52,    3,   61,  -56,   67,   61, -116,    3,
-      61,  -52,  120, -116,  116,  112,    7,  123,    8,    7,  121,   72, -121,  112,  112,    7,
-     122,  112,    3,  118,  120, -121,  112,   32, -121,   25,  -52,   17,   14,  -20, -112,   14,
-     -31,   48,   15,  110,   48,   15,  -29,  -16,   14,  -16,   80,   14,   51,   16,  -60,   29,
-     -34,   33,   28,  -40,   33,   29,  -62,   97,   30,  102,   48, -119,   59,  -68, -125,   59,
-     -48,   67,   57,  -76,    3,   60,  -68, -125,   60, -124,    3,   59,  -52,  -16,   20,  118,
-      96,    7,  123,  104,    7,   55,  104, -121,  114,  104,    7,   55, -128, -121,  112, -112,
-    -121,  112,   96,    7,  118,   40,    7,  118,   -8,    5,  118,  120, -121,  119, -128, -121,
-      95,    8, -121,  113,   24, -121,  114, -104, -121,  121, -104, -127,   44,  -18,  -16,   14,
-     -18,  -32,   14,  -11,  -64,   14,  -20,   48,    3,   98,  -56,  -95,   28,  -28,  -95,   28,
-     -52,  -95,   28,  -28,  -95,   28,  -36,   97,   28,  -54,   33,   28,  -60, -127,   29,  -54,
-      97,    6,  -42, -112,   67,   57,  -56,   67,   57, -104,   67,   57,  -56,   67,   57,  -72,
-     -61,   56, -108,   67,   56, -120,    3,   59, -108,  -61,   47,  -68, -125,   60,   -4, -126,
-      59,  -44,    3,   59,  -80,  -61,   12,  -57,  105, -121,  112,   88, -121,  114,  112, -125,
-     116,  104,    7,  120,   96, -121,  116,   24, -121,  116,  -96, -121,   25,  -50,   83,   15,
-     -18,    0,   15,  -14,   80,   14,  -28, -112,   14,  -29,   64,   15,  -31,   32,   14,  -20,
-      80,   14,   51,   32,   40,   29,  -36,  -63,   30,  -62,   65,   30,  -46,   33,   28,  -36,
-    -127,   30,  -36,  -32,   28,  -28,  -31,   29,  -22,    1,   30,  102,   24,   81,   56,  -80,
-      67,   58, -100, -125,   59,  -52,   80,   36,  118,   96,    7,  123,  104,    7,   55,   96,
-    -121,  119,  120,    7,  120, -104,   81,   76,  -12, -112,   15,  -16,   80,   14,    0,    0,
-     113,   32,    0,    0,   56,    0,    0,    0,    6,   17,    6,   -1,   92,  -33, -111,  -60,
-      45,    4,   16,  -95,   65,   66,    8,   83,   90,  -33, -111,  -12,    3,  -53,  -30,    8,
-     -64, -124,   56, -115,   13,   40,   21,   16,   -3, -125,   67,    5,   11,   97,    5,   74,
-       5,   68,   -1,  -29,   32,  -51,  100,   27,   67, -126,   52,   66,   68,   48,   68,   51,
-    -103,    2,   82,   80, -115,   48,   33,   78,   99,    4,   73,    5,   68,   63,   16,   69,
-       0,  102,   17, -111,  127,   16,  -53,   67,   68,  127,   65,   53,  -62, -124,   56,  -51,
-     107,   14, -117,   68,   49, -100,  -61,    4,   72,   67,   68,  102,  -32,   84,   64,  -12,
-       3,  -53,  -30,    8,  -64, -124,   56, -115,   33,  112,  126,   36,   -7,   17,   49,   80,
-       2,  -15,   23, -115,   47,   81, -116,   38,    8,   20,   67,   45,  -64,  -28,   68,    6,
-     112,   84,   64,  -12,   35,  -51,  100,   13, -114,   68,   49, -102,   32,   80,   12,  -75,
-       0, -109,   19,   89,    0,   82,    1,  -47,  -65,   56, -115,   97,    7,   78,    5,   68,
-      -1,  -29,   32,  -51,  100,   -1,  -49,   20,  -39,    3,  -30,   71, -110,   63,   76,   78,
-     100,   11,   73,   65,   53,  -62, -124,   56,  -51,  107,    2,   73,    5,   68,  127,  -79,
-      56,  -64,  100,    9, -103,   31,   73,  126,   68,   12, -108,   64,   -4,   69,  -29,   75,
-      20,  -61,   57,   76, -128,   52,   68,    4,   97,   32,    0,    0,   55,    0,    0,    0,
-      19,    4,   65,   44,   16,    0,    0,    0,   21,    0,    0,    0,    4, -108,   64,   41,
-      20,   67,   57,   20,   68,   73,   20,    5,    9,  101,   80,    2,   69,   64,  -63,   80,
-      70,   66,    8, -109,   48,    6,   67,   25,   75,   33,   76, -128,   52, -108,  -79,   20,
-     -62,    4,  112,   67,   25,    9,   33,   76,   66,   25,   12,  101,   36, -124,   48,    9,
-     100,   48, -108, -111,   16,  -62,   36,   76,   68, -116,   17, -128,   32,    8, -110,   96,
-      64,  -58,   24,    1,    8, -126,   32,    8, -126,   32,    8, -110,   32,    1,    0,    0,
-    -125,   17,    0,   55,    0, -125,   17,   65,   25,   16,  -64,   96, -124,  -64,    6,    3,
-      48,   24,   49,  -76,    1,    1,   12,   70,  -84,   65,   55,    0, -125,   17,  106,  -32,
-      13,  -64,   96,   68,   26,  124,    3,   48,   24,   97,    6,   96,   48,    0, -125,   17,
-     103,   16,    6,    3,   48,   24, -127,    6,   98,   48,    0,   24,   16,    3,    0,    0,
-      13,    0,    0,    0,   91,    6,   32,  -16, -125,   45,   67,   16, -124,  -62, -106,   65,
-       8,   72,   97,  -53,   48,    4,  -89,  -80,  101,   32,    2,   63,  -40,   50,   20, -127,
-      31,  108,   25, -116,  -64,   15,  -74,   12,   71,  -32,    7,   91,    6,   36,  -16, -125,
-      45,   67,   18,   -8,    1,    0,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,
-      11,    0,    0,    0,   19,    4,  -63,   96,    4,  -64,   13,    0, -122,    3,    1,    0,
-       2,    0,    0,    0,  -58,   49,    0, -111,    1,    0,    0,    0,    1,   49,    0,    0,
-       2,    0,    0,    0,   91,    6,   32,  -16,    3,    0,    0,    0,    0,    0,    0,    0,
+     -62,   12,   32,   51, -120,  -24,  -40, -123,  -55,  125, -123,  -79,  -79,  -67, -115, -123,
+     -47,  -91,  -67,  -71,   81, -112, -127,   25,   66, -104,  -63,  100,    6,   20,   25,  -69,
+      48,  -71,  -81,  -70,   52,   55,  -70,   25, -103,   47,   58,    6,   57,   67,    8,   51,
+     -80,  -52,  -32,  -94,   98,   23,   38,   -9,    5,   -9, -106,  -26,   70,   39,   67,    3,
+     -22,   45,  -51, -115,   78,  102,    8,   97,    6, -103,   25,  104,   92,  -20,  -62,  -28,
+     -66,  -46,  -36,  -24,  -66,  -32,  -24,  -28,   72,  -88,  -92,  -71,  -47,   13,   33,  -52,
+    -128,   51, -125, -114,    1,  -51,   16,  -63,   12,   62,   34,  102,  117,  110,   99,  116,
+     105,  111,  110,   67,    4,   51,    8,    3,   70,   46,  104,  101,  108,  112,  101,  114,
+      95,  102,  117,  110,   99,  116,  105,  111,  110,   86,   67,    4,   51,   24,    3,   70,
+      46,  104,  101,  108,  112,  101,  114,   95,  115,  101,  116,   66,  117,  102,  102,  101,
+     114,   67,    4,   51,   40,    3,   86,   46,  104,  101,  108,  112,  101,  114,   95,  115,
+     101,  116,   65,  108,  108,  111,   99,   97,  116,  105,  111,  110,   67,    4,   51,   56,
+       3,   18,  114,  111,  111,  116,   67,    4,   51,   72,    3,   38,  105,  110,   99,  114,
+     101,  109,  101,  110,  116,   67,    4,   51,   88,    3,    6,   48,   67,    4,   51,  104,
+       3,   10,   51,   53,   67,    4,   51,  120,    3,   38,  115,  117,  109,  109,   97,  116,
+     105,  111,  110,  116,  -26,  -22,  -38, -126,  -58,  -58,  -22,  -38,  -22,  -40,  -62,  -24,
+     -34,  -28, -122,   16,  102,   32,    7,  102,   48,  112, -103,  -85,  107,   27,  122,  107,
+      19,   75,  115,   43, -109,   27,  -94, -104,   65,   28, -104,  -63,  103,    6,  115,    0,
+       1,  102,   64,    7,   67,    4,   51,  -48,   24,  -32,  113,   72,  115,  -93,   27,   66,
+    -104,  -63,   29, -104,    1,   30,   48,  -56,   27,   66, -104, -127,   30, -104,    1,   30,
+     -16,  121,  107,  115,   75, -125,  123,  -93,   43,  115,  -93,    3,   25,   67,   11, -109,
+      99,   52, -107,  -42,    6,  -57,   86,    6,   50,  -12,   50,  -76,  -78,    2,   66,   37,
+      20,   20,   52,   68,   48, -125,   62,   24,   34,    8,  -38,   16,  -61,   12,   -8,  -64,
+      12,   -4,   64,  -48, -122,   24,  102, -128,    7,  102,    0,   10, -126,   54,  -60,   48,
+    -125,   80,   48, -125,   80,   16,   52,   18,  108,  111,  110,  103,   67,   12,   51,   24,
+       5,   51,    0,    5,   65,   27,   98, -104,    1,   41, -104,    1,   41,    8,   26,   11,
+      51,  -74,  -73,   48,  -70,   33, -122,   25, -104, -126,   25, -128, -126,  -96,   13,   49,
+     -52,  -32,   20,  -52,  -32,   20,    4, -115,    6,  -39,   91,  -99,   24,   91,  -39,   16,
+     -61,   12,   82,  -63,   12,   64,   65,  -48, -122,   24,  102,  -96,   10,  102,  -96,   10,
+    -126,  -58,   37,  -52,   45,   15,    4,  -18,   45,  -51, -115,  -82,   76,  110, -120,   97,
+       6,  -84,   96,    6,  -96,   32,  104,   67,   12,   51,  104,    5,   51,  104,    5,   65,
+      27,   34,    8,  -37,   16,   65,  -32, -122,    8,   66,   54,    4,   19,   52,   97,   51,
+       3,   87,   16,   54,   97,   51,    3,   87,   16,   56,   97,   51,    3,   87,   16,   50,
+      97,   51,    3,   87,  -88,  -62,  -58,  102,  -41,  -26, -110,   70,   86,  -26,   70,   55,
+      37,    8,  122, -116,  -64,  -55, -123,  -99,  -75, -123,   77,   17, -120,  -93,  -50, -120,
+     -36,  -36,   87,   25,   30,  -36, -101,   28,  -35, -105,   93, -104,  -36,   20,   68,  105,
+      30,  -87,  -62,   54,  -81,  -48, -120,  -36,  -36,  -41, -101, -104,   90,  -39,   24,  -35,
+     -41,   28,  -37,   27,  -35,  -36, -108,    0,   12,   -6, -116,  -56,  -51,  125, -107,  -31,
+     -63,  -67,  -55,  -47,  125, -103,  -43,  -71, -115,   77,   33,  -60, -128,   12,  -52,    0,
+      13,  122, -115,  -56,  -51,  125, -107,  -31,  -63,  -67,  -55,  -47,  125, -103,  -67,  -55,
+    -107, -123, -115,  -95,  125,  -71, -123,  -75, -107,   77,   17,  -44, -128,   13,   42, -115,
+     -56,  -51,  125, -107,  -31,  -63,  -67,  -55,  -47,  125, -103,  -67,  -55, -107, -123, -115,
+     -95,   77,   17,  -36,    0,   14,   26, -115,  -56,  -51,  125, -107,  -31,  -63,  -67,  -55,
+     -47,  125,  -55, -107, -111,  -43, -115, -107,   77,    9,  -22,  -96,  -49, -120,  -36,  -36,
+      87,   25,   30,  -36, -101,   28,  -35,   23,   93,   30,   92,  -39, -108,  -64,   14,  122,
+    -108,   64,  -67,  -91,  -71,  -47,  -55,   76,   17,  -14,   96,   15,    0,    0,    0,    0,
+     121,   24,    0,    0,   92,    0,    0,    0,   51,    8, -128,   28,  -60,  -31,   28,  102,
+      20,    1,   61, -120,   67,   56, -124,  -61, -116,   66, -128,    7,  121,  120,    7,  115,
+    -104,  113,   12,  -26,    0,   15,  -19,   16,   14,  -12, -128,   14,   51,   12,   66,   30,
+     -62,  -63,   29,  -50,  -95,   28,  102,   48,    5,   61, -120,   67,   56, -124, -125,   27,
+     -52,    3,   61,  -56,   67,   61, -116,    3,   61,  -52,  120, -116,  116,  112,    7,  123,
+       8,    7,  121,   72, -121,  112,  112,    7,  122,  112,    3,  118,  120, -121,  112,   32,
+    -121,   25,  -52,   17,   14,  -20, -112,   14,  -31,   48,   15,  110,   48,   15,  -29,  -16,
+      14,  -16,   80,   14,   51,   16,  -60,   29,  -34,   33,   28,  -40,   33,   29,  -62,   97,
+      30,  102,   48, -119,   59,  -68, -125,   59,  -48,   67,   57,  -76,    3,   60,  -68, -125,
+      60, -124,    3,   59,  -52,  -16,   20,  118,   96,    7,  123,  104,    7,   55,  104, -121,
+     114,  104,    7,   55, -128, -121,  112, -112, -121,  112,   96,    7,  118,   40,    7,  118,
+      -8,    5,  118,  120, -121,  119, -128, -121,   95,    8, -121,  113,   24, -121,  114, -104,
+    -121,  121, -104, -127,   44,  -18,  -16,   14,  -18,  -32,   14,  -11,  -64,   14,  -20,   48,
+       3,   98,  -56,  -95,   28,  -28,  -95,   28,  -52,  -95,   28,  -28,  -95,   28,  -36,   97,
+      28,  -54,   33,   28,  -60, -127,   29,  -54,   97,    6,  -42, -112,   67,   57,  -56,   67,
+      57, -104,   67,   57,  -56,   67,   57,  -72,  -61,   56, -108,   67,   56, -120,    3,   59,
+    -108,  -61,   47,  -68, -125,   60,   -4, -126,   59,  -44,    3,   59,  -80,  -61,   12,  -57,
+     105, -121,  112,   88, -121,  114,  112, -125,  116,  104,    7,  120,   96, -121,  116,   24,
+    -121,  116,  -96, -121,   25,  -50,   83,   15,  -18,    0,   15,  -14,   80,   14,  -28, -112,
+      14,  -29,   64,   15,  -31,   32,   14,  -20,   80,   14,   51,   32,   40,   29,  -36,  -63,
+      30,  -62,   65,   30,  -46,   33,   28,  -36, -127,   30,  -36,  -32,   28,  -28,  -31,   29,
+     -22,    1,   30,  102,   24,   81,   56,  -80,   67,   58, -100, -125,   59,  -52,   80,   36,
+     118,   96,    7,  123,  104,    7,   55,   96, -121,  119,  120,    7,  120, -104,   81,   76,
+     -12, -112,   15,  -16,   80,   14,    0,    0,  113,   32,    0,    0,   84,    0,    0,    0,
+      70,  -64,   84,   64,  -12,   83,   72,   51,  -35,  -10,   63,  -39, -128,   82,    1,  -47,
+      63,   56,   84,  -80,   16,  -90, -128,   20,   84,   35,   76, -120,  -45, -104,  -63,   82,
+       1,  -47, -113,   52,  -45,   -1,   76, -111,   53,   52,   18,   49,  105,  -53,  -30,    8,
+     -64, -124,   56, -115,   61,  100,  -53,   82,   49,   62,   67,   48,  -62, -125,   -7,   15,
+    -115,  -16,   -2,   67,   35,  -68, -113,  -24,  -72,    5,   32,   21,   16,   -3, -117,  -45,
+      24,  -74, -112,   20,   84,   35,   76, -120,  -45,  -68,  -26, -112,    6,   -1,  108,  -45,
+    -111,  -60,   18, -109,  -73,   16,   12,  -47,   76,  -38,  -12,   83,  -62,    1,   68,  -11,
+      29,   73,   63,  -80,   44, -114,    0,   76, -120,  -45,   28, -119,   81, -124,  -63,   63,
+     -41,  119,   36,  113,   11,    1,   68,  104, -112,   16,  -62, -108,  -42,  119,   36,   -3,
+     -64,  -78,   56,    2,   48,   33,   78,   99,    2,   73,    5,   68,  127,  -79,   56,  -64,
+     100,    9, -103,   31,   73,  126,   68,   12, -108,   64,   -4,   69,  -29,   75,   20,  -61,
+      57,   76, -128,   52,   68,  100,   23, -107,  127,   16,  -53,   67,   68,  -65,   68,   76,
+     -38,  -78,   56,    2,   48,   33,   78,   99,    5,   74,    5,   68,   -1,  -29,   32,  -51,
+     100,   27,   68, -126,   52,   66,   68,   48,   68,   51,   25,   67,   34,   17,  -45,   70,
+      21,    5,   17, -103,  -60,   34,   81,   12,  -25,   48,    1,  -46,   16, -111,   85,   68,
+      -2,   65,   44,   15,   17,   -3,    5,  -43,    8,   19,  -30,   52,  -81,   29,   56,   21,
+      16,   -3,  -64,  -78,   56,    2,   48,   33,   78,   99,    8, -100,   31,   73,  126,   68,
+      12, -108,   64,   -4,   69,  -29,   75,   20,  -93,    9,    2,  -59,   80,   11,   48,   57,
+    -111,    1,   28,   21,   16,   -3,   72,   51, -103,   69,  -28,   31,  -60,  -14,   16,  -47,
+      47,   17,  -45,   70,   21,    5,   17,   89, -124,   35,   81, -116,   38,    8,   20,   67,
+      45,  -64,  -28,   68,   54, -127,   -8, -111,  -28,   15, -109,   19,    1,    0,    0,    0,
+      97,   32,    0,    0,   38,    0,    0,    0,   19,    4,   65,   44,   16,    0,    0,    0,
+      12,    0,    0,    0,    4, -108,   64,   41,   20,   67,   57, -112,   80,    4,   20,   12,
+     101,   36, -123,  -96,    1,  100,   48, -108, -111,   20, -126,    6,   96,   68, -116,   17,
+    -128,   32,    8, -110,   96,   64,  -58,   24,    1,    8, -126,   32,    8, -126,   32,    8,
+    -110,   32,    1,    0, -125,   17,    0,   25,   12,  -64,   96,   68, -128,    6,    4,   48,
+      24,   33,  -84,  -63,    0,   12,   70,   12,  108,   64,    0, -125,   17,   68,   25,   12,
+     -64,   96, -124,   26, -104,  -63,    0,   12,   70,  -92,  -63,   25,   12,    0,    6,  -60,
+       0,    0,    0,    0,    9,    0,    0,    0,   91,    6,   32,   16, -123,   45,   67,   16,
+    -108,  -62, -106,   65,    8,   80,   97,  -53,   48,    4,  -85,  -80,  101,   32,    2,   81,
+     -40,   50,   20, -127,   40,  108,   25, -116,   64,   20,    0,    0,    0,    0,    0,    0,
+      97,   32,    0,    0,   11,    0,    0,    0,   19,    4,  -63,   96,    4,   64,    6,    3,
+    -128,  -31,   64,    0,    2,    0,    0,    0,   70,   50,    0, -111,    1,    0,    0,    0,
+       1,   49,    0,    0,    2,    0,    0,    0,   91,    6,   32,   16,    5,    0,    0,    0,
+       0,    0,    0,    0,   97,   32,    0,    0,   46,    0,    0,    0,   19,    4,   68,   44,
+      16,    0,    0,    0,    2,    0,    0,    0,    4, -108,    2,    9,   37,    0,    0,    0,
+     -61,   13,  100, -128, -103,  -63,   44,   67,   48, -100,    1,   25,  100, -106,   64,   24,
+     -88,   16,  -76,   96,   13, -124,  -15,    4,   52,   72, -125,  -63,    8,   53,   40, -125,
+       1,  -80,   52,   48,    3,   24,  -36,   26,    0,   48,  -36,  -64,    6,  100,    0,    6,
+     -77,   12, -125,  -48,    6,   24,   14,    4,   20,    0,    0,    0,  -90, -126,    0,   81,
+       4,   96,  -56,  112,   89, -118, -126,   52,   67,    5,   68, -110, -113,   84,  -58,  -78,
+      44,  -59,   20,   -7,   22,   50,   16,   72,  101,   43,   15,  -46,   12,   21,   16,   73,
+      62,   82,   -7,   13,  113,   77,   23,   96,   -8,   75,  -28,   63,  -57,   13,   44,   -2,
+      47,   68,  -56,  -12,   19, -125,   65,  -40,    9,   33,   48,   15,  110,   36,  -61, -128,
+      48,  -42, -126,   16,   23,   50,    9,   78,   51,    0,    0,    0,    1,   49,    0,    0,
+       3,    0,    0,    0,   91,    6,   33,  112, -123,   45, -125,   17, -120,    2,    0,    0,
+       0,    0,    0,    0,   97,   32,    0,    0,   45,    0,    0,    0,   19,    4,   68,   44,
+      16,    0,    0,    0,    5,    0,    0,    0,    4, -108,   64,   65, -112,   80,   64,  -44,
+    -108,    3,   93,   35,    0,  -28,  -40,   50,    7,    0,    0,    0,   51,   17,   12,   80,
+       6,  -60,  112,    3,   25,   96,  102,   48,  -53,   16,   12,  108,  112,  107,  -32,  -20,
+      44, -127,   48,   80,    1,   96,  -63,   27,    8,   35,    6,    8,    0,   60,  109,  -96,
+       6,  103,   96,    6,  105,   48,   98,   96,   40, -128,  -77,    6,  104,  -32,    6,  -26,
+       6,  101,    0, -125,  -31, -122,   55,   32,    3,   48, -104,  101,   24,    4,   56,  -64,
+     112,   32,    0,    0,   13,    0,    0,    0,  -74,   50,   76,  -52,  115,    1, -122,  -65,
+      68,   -2,  115,  -36,  -64,  -30,   -1,   66, -124,   76,   63,   49,   24, -124,  -79,   16,
+       2,  -13,  -32,   70,   50,   12,    8,   99,   47,    3,  -46,    8,  -26,   66,   92,   62,
+     -99,   27,   12,   66,   92,  -56,   36,   56,  -51,    0,    0,    0,    1,   49,    0,    0,
+       2,    0,    0,    0,   91,    6,  -93, -112,    5,    0,    0,    0,    0,    0,    0,    0,
       97,   32,    0,    0,   15,    0,    0,    0,   19,    4,   65,   44,   16,    0,    0,    0,
-       1,    0,    0,    0,    4, -108,    0,    0,  -57,    1,   97,   94,    7, -125,   -5,   30,
-      72,   48,    8,    7,    2,    0,    0,    0,    5,    0,    0,    0,  -26,   65,    8,   78,
-      83,   25, -121, -128,   52,    6,   82,    8,   78,   83,  -43,  -10,   49,    0,  -61,    0,
-       0,    0,    0,    0,   97,   32,    0,    0,   15,    0,    0,    0,   19,    4,    1,  113,
-     -61,  -68,   14,    4, -125,   17,  -36,   55,    0,   24,   14,    4,    4,    0,    0,    0,
-     -42,   49,   84,  -64,   98,   28,    5,   32,    8,   20,   99,   31,    3,   48,   12,    0,
-       1,   49,    0,    0,    3,    0,    0,    0,   91,    6,   32,  -16, -125,   45, -125,   16,
-      -8,    1,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,   17,    0,    0,    0,
-      19,    4,    1,  117, -125,  -72,   97,  -97,    7, -126,  -63,    8,   14,   12,    6,    0,
-     -61, -127,    0,    0,    4,    0,    0,    0,  -42,   49,   84,  -64,   98,   28,    5,   32,
-       8,   20,   99,   32,    3,   48,   12,    0,    1,   49,    0,    0,    4,    0,    0,    0,
-      91,    6,   32,  -16, -125,   45,   67,   16,   -8,  -63, -106,   97,    8,   -4,    0,    0,
-       0,    0,    0,    0,   97,   32,    0,    0,    3,    0,    0,    0,   19,    4,  -63, -120,
-       1, -127,    4, -112, -127,    0,    0,    0,   97,   32,    0,    0,    9,    0,    0,    0,
-      19,    4,  -63,  120,    3,   55,   73,  -44, -115,   17,    3,    2,    8,   22,   15,  -61,
-    -127,    0,    0,    0,    2,    0,    0,    0,    7,   80,   16,  -51,   20,   97,    0,    0,
+       1,    0,    0,    0,    4, -108,    0,    0,   71,    6,   64, -104,   25, -108,    1,   12,
+     -18,   12,   26,   72,   52,    8,    7,    2,    5,    0,    0,    0,  102,   66,    8,   78,
+      83,   25, -119, -128,   52, -122,   82,    8,   78,   83,  -43,  118,   50,    0,  -61,    0,
+       0,    0,    0,    0,   97,   32,    0,    0,   16,    0,    0,    0,   19,    4,    1, -111,
+     -63,   48,   51,   40,    3,   16,   12,   70, -112,  -63,   25,   12,    0, -122,    3,    1,
+       4,    0,    0,    0,   86,   50,   84,  -64,   98,   36,    5,   32,    8,   20,   99,   39,
+       3,   48,   12,    0,    1,   49,    0,    0,    3,    0,    0,    0,   91,    6,   32,   16,
+    -123,   45, -125,   16, -120,    2,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,
+      18,    0,    0,    0,   19,    4,    1, -107,  -63,   32,   50,   24,  118,    6,  102,    0,
+    -126,  -63,    8,   50,   64, -125,    1,  -64,  112,   32,    0,    0,    4,    0,    0,    0,
+      86,   50,   84,  -64,   98,   36,    5,   32,    8,   20,   99,   40,    3,   48,   12,    0,
+       1,   49,    0,    0,    4,    0,    0,    0,   91,    6,   32,   16, -123,   45,   67,   16,
+    -120,  -62, -106,   97,    8,   68,    1,    0,    0,    0,    0,    0,   97,   32,    0,    0,
+       3,    0,    0,    0,   19,    4,  -63, -120,    1,  -95,    4,  -44, -127,    0,    0,    0,
+      97,   32,    0,    0,    9,    0,    0,    0,   19,    4,  -63,  120,    3,   25,  104,   24,
+    -107,  -63,   24,   49,   32, -128,   96,   49,    3,   12,    7,    2,    2,    0,    0,    0,
+       7,   80,   16,  -51,   20,   97,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,
+       9,    0,    0,    0,   19,    4,  -63,  120,    3,   25,  104,   24, -107,  -63,   24,   49,
+      32, -128, -128,   49,    3,   12,    7,    2,    2,    0,    0,    0,    7,   80,   16,  -51,
+      20,   97,    0,    0,    0,    0,    0,    0,   97,   32,    0,    0,    9,    0,    0,    0,
+      19,    4,  -63,  120,    3,   25,  104,   24, -107,  -63,   24,   49,   32, -128,  -96,   49,
+       3,   12,    7,    2,    2,    0,    0,    0,    7,   80,   16,  -51,   20,   97,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,
 };
 
-const int bitCodeLength = 2744;
+const int bitCodeLength = 3480;
 
 #endif
diff --git a/sensors/1.0/ISensors.hal b/sensors/1.0/ISensors.hal
index 5c8301a..8d41de2 100644
--- a/sensors/1.0/ISensors.hal
+++ b/sensors/1.0/ISensors.hal
@@ -37,7 +37,8 @@
      */
     setOperationMode(OperationMode mode) generates (Result result);
 
-    /* Activate/de-activate one sensor.
+    /**
+     * Activate/de-activate one sensor.
      *
      * After sensor de-activation, existing sensor events that have not
      * been picked up by poll() must be abandoned immediately so that
@@ -76,7 +77,7 @@
                 vec<Event> data,
                 vec<SensorInfo> dynamicSensorsAdded);
 
-    /*
+    /**
      * Sets a sensor’s parameters, including sampling frequency and maximum
      * report latency. This function can be called while the sensor is
      * activated, in which case it must not cause any sensor measurements to
@@ -96,7 +97,7 @@
           int64_t samplingPeriodNs,
           int64_t maxReportLatencyNs) generates (Result result);
 
-    /*
+    /**
      * Trigger a flush of internal FIFO.
      *
      * Flush adds a FLUSH_COMPLETE metadata event to the end of the "batch mode"
@@ -113,7 +114,7 @@
      */
     flush(int32_t sensorHandle) generates (Result result);
 
-    /*
+    /**
      * Inject a single sensor event or push operation environment parameters to
      * device.
      *
@@ -137,7 +138,7 @@
      */
     injectSensorData(Event event) generates (Result result);
 
-    /*
+    /**
      * Register direct report channel.
      *
      * Register a direct channel with supplied shared memory information. Upon
@@ -156,7 +157,7 @@
     registerDirectChannel(SharedMemInfo mem)
             generates (Result result, int32_t channelHandle);
 
-    /*
+    /**
      * Unregister direct report channel.
      *
      * Unregister a direct channel previously registered using
@@ -169,7 +170,7 @@
      */
     unregisterDirectChannel(int32_t channelHandle) generates (Result result);
 
-    /*
+    /**
      * Configure direct sensor event report in direct channel.
      *
      * This function start, modify rate or stop direct report of a sensor in a
diff --git a/sensors/1.0/types.hal b/sensors/1.0/types.hal
index efb18c6..3926e2f 100644
--- a/sensors/1.0/types.hal
+++ b/sensors/1.0/types.hal
@@ -22,7 +22,7 @@
  * http://source.android.com/devices/sensors/index.html
  */
 
-/* Type enumerating various result codes returned from ISensors methods */
+/** Type enumerating various result codes returned from ISensors methods */
 enum Result : int32_t {
     OK,
     PERMISSION_DENIED                   = -1,
@@ -31,7 +31,7 @@
     INVALID_OPERATION                   = -38,
 };
 
-/*
+/**
  * Sensor HAL modes used in setOperationMode method
  */
 @export(name="", value_prefix="SENSOR_HAL_", value_suffix="_MODE")
@@ -40,7 +40,7 @@
     DATA_INJECTION                  = 1,
 };
 
-/*
+/**
  * Sensor type
  *
  * Each sensor has a type which defines what this sensor measures and how
@@ -88,7 +88,7 @@
  *  - This way, all applications can now use this sensor.
  */
 
-/*
+/**
  * Wake up sensors.
  * Each sensor may have either or both a wake-up and a non-wake variant.
  * When registered in batch mode, wake-up sensors will wake up the AP when
@@ -116,14 +116,15 @@
 
 @export(name="", value_prefix="SENSOR_TYPE_")
 enum SensorType : int32_t {
-    /* META_DATA is a special event type used to populate the MetaData
+    /**
+     * META_DATA is a special event type used to populate the MetaData
      * structure. It doesn't correspond to a physical sensor. Events of this
      * type exist only inside the HAL, their primary purpose is to signal the
      * completion of a flush request.
      */
     META_DATA                       = 0,
 
-    /*
+    /**
      * ACCELEROMETER
      * reporting-mode: continuous
      *
@@ -135,7 +136,7 @@
      */
     ACCELEROMETER                   = 1,
 
-    /*
+    /**
      * MAGNETIC_FIELD
      * reporting-mode: continuous
      *
@@ -147,7 +148,7 @@
      */
     MAGNETIC_FIELD                  = 2,
 
-    /*
+    /**
      * ORIENTATION
      * reporting-mode: continuous
      *
@@ -161,7 +162,7 @@
      */
     ORIENTATION                     = 3,
 
-    /*
+    /**
      * GYROSCOPE
      * reporting-mode: continuous
      *
@@ -173,7 +174,7 @@
      */
     GYROSCOPE                       = 4,
 
-    /*
+    /**
      * LIGHT
      * reporting-mode: on-change
      *
@@ -183,7 +184,7 @@
      */
     LIGHT                           = 5,
 
-    /*
+    /**
      * PRESSURE
      * reporting-mode: continuous
      *
@@ -194,10 +195,10 @@
      */
     PRESSURE                        = 6,
 
-    /* TEMPERATURE is deprecated in the HAL */
+    /** TEMPERATURE is deprecated in the HAL */
     TEMPERATURE                     = 7,
 
-    /*
+    /**
      * PROXIMITY
      * reporting-mode: on-change
      *
@@ -210,7 +211,7 @@
      */
     PROXIMITY                       = 8,
 
-    /*
+    /**
      * GRAVITY
      * reporting-mode: continuous
      *
@@ -222,7 +223,7 @@
      */
     GRAVITY                         = 9,
 
-    /*
+    /**
      * LINEAR_ACCELERATION
      * reporting-mode: continuous
      *
@@ -234,7 +235,7 @@
      */
     LINEAR_ACCELERATION             = 10,
 
-    /*
+    /**
      * ROTATION_VECTOR
      * reporting-mode: continuous
      *
@@ -246,7 +247,7 @@
      */
     ROTATION_VECTOR                 = 11,
 
-    /*
+    /**
      * RELATIVE_HUMIDITY
      * reporting-mode: on-change
      *
@@ -257,7 +258,7 @@
      */
     RELATIVE_HUMIDITY               = 12,
 
-    /*
+    /**
      * AMBIENT_TEMPERATURE
      * reporting-mode: on-change
      *
@@ -267,7 +268,7 @@
      */
     AMBIENT_TEMPERATURE             = 13,
 
-    /*
+    /**
      * MAGNETIC_FIELD_UNCALIBRATED
      * reporting-mode: continuous
      *
@@ -279,7 +280,7 @@
      */
     MAGNETIC_FIELD_UNCALIBRATED     = 14,
 
-    /*
+    /**
      * GAME_ROTATION_VECTOR
      * reporting-mode: continuous
      *
@@ -291,7 +292,7 @@
      */
     GAME_ROTATION_VECTOR            = 15,
 
-    /*
+    /**
      * GYROSCOPE_UNCALIBRATED
      * reporting-mode: continuous
      *
@@ -303,7 +304,7 @@
      */
     GYROSCOPE_UNCALIBRATED          = 16,
 
-    /*
+    /**
      * SIGNIFICANT_MOTION
      * reporting-mode: one-shot
      *
@@ -316,7 +317,7 @@
      */
     SIGNIFICANT_MOTION              = 17,
 
-    /*
+    /**
      * STEP_DETECTOR
      * reporting-mode: special
      *
@@ -328,7 +329,7 @@
      */
     STEP_DETECTOR                   = 18,
 
-    /*
+    /**
      * STEP_COUNTER
      * reporting-mode: on-change
      *
@@ -341,7 +342,7 @@
      */
     STEP_COUNTER                    = 19,
 
-    /*
+    /**
      * GEOMAGNETIC_ROTATION_VECTOR
      * reporting-mode: continuous
      *
@@ -353,7 +354,7 @@
      */
     GEOMAGNETIC_ROTATION_VECTOR     = 20,
 
-    /*
+    /**
      * HEART_RATE
      * reporting-mode: on-change
      *
@@ -377,7 +378,7 @@
      */
     HEART_RATE                      = 21,
 
-    /*
+    /**
      * WAKE_UP_TILT_DETECTOR
      * reporting-mode: special (setDelay has no impact)
      *
@@ -416,7 +417,7 @@
      */
     TILT_DETECTOR                   = 22,
 
-    /*
+    /**
      * WAKE_GESTURE
      * reporting-mode: one-shot
      *
@@ -437,7 +438,7 @@
      */
     WAKE_GESTURE                    = 23,
 
-    /*
+    /**
      * GLANCE_GESTURE
      * reporting-mode: one-shot
      *
@@ -474,7 +475,7 @@
      */
     PICK_UP_GESTURE                 = 25,
 
-    /*
+    /**
      * WRIST_TILT_GESTURE
      * trigger-mode: special
      * wake-up sensor: yes
@@ -489,7 +490,7 @@
      */
     WRIST_TILT_GESTURE              = 26,
 
-    /*
+    /**
      * DEVICE_ORIENTATION
      * reporting-mode: on-change
      *
@@ -523,7 +524,7 @@
      */
     DEVICE_ORIENTATION              = 27,
 
-    /*
+    /**
      * POSE_6DOF
      * trigger-mode: continuous
      *
@@ -541,7 +542,7 @@
      */
     POSE_6DOF                       = 28,
 
-    /*
+    /**
      * STATIONARY_DETECT
      * trigger mode: one shot
      *
@@ -555,7 +556,7 @@
      */
     STATIONARY_DETECT               = 29,
 
-    /*
+    /**
      * MOTION_DETECT
      * trigger mode: one shot
      *
@@ -573,7 +574,7 @@
      */
     MOTION_DETECT                   = 30,
 
-    /*
+    /**
      * HEART_BEAT
      * trigger mode: continuous
      *
@@ -680,7 +681,7 @@
      */
     ADDITIONAL_INFO                 = 33,
 
-    /*
+    /**
      * LOW_LATENCY_OFFBODY_DETECT
      * trigger-mode: on-change
      * wake-up sensor: yes
@@ -703,7 +704,7 @@
      */
     LOW_LATENCY_OFFBODY_DETECT      = 34,
 
-    /*
+    /**
      * ACCELEROMETER_UNCALIBRATED
      * reporting-mode: continuous
      *
@@ -715,7 +716,7 @@
      */
     ACCELEROMETER_UNCALIBRATED      = 35,
 
-    /*
+    /**
      * Base for device manufacturers private sensor types.
      * These sensor types can't be exposed in the SDK.
      */
@@ -724,7 +725,7 @@
 
 @export(name="", value_prefix="SENSOR_FLAG_")
 enum SensorFlagBits : uint32_t {
-    /*
+    /**
      * Whether this sensor wakes up the AP from suspend mode when data is
      * available.  Whenever sensor events are delivered from a wake_up sensor,
      * the driver needs to hold a wake_lock till the events are read by the
@@ -735,7 +736,7 @@
      */
     WAKE_UP                     = 1,
 
-    /*
+    /**
      * Reporting modes for various sensors. Each sensor will have exactly one of
      * these modes set.
      * The least significant 2nd, 3rd and 4th bits are used to represent four
@@ -746,7 +747,7 @@
     ONE_SHOT_MODE               = 4,
     SPECIAL_REPORTING_MODE      = 6,
 
-    /*
+    /**
      * Set this flag if the sensor supports data_injection mode and allows data
      * to be injected from the SensorService. When in data_injection ONLY
      * sensors with this flag set are injected sensor data and only sensors with
@@ -756,42 +757,42 @@
      */
     DATA_INJECTION              = 0x10,
 
-    /*
+    /**
      * Set this flag if the sensor is a dynamically connected sensor. See
      * DynamicSensorInfo and DYNAMIC_SENSOR_META for details.
      */
     DYNAMIC_SENSOR              = 0x20,
 
-    /*
+    /**
      * Set this flag if sensor additional information is supported.
      * See ADDITIONAL_INFO and AdditionalInfo for details.
      */
     ADDITIONAL_INFO             = 0x40,
 
-    /*
+    /**
      * Set this flag if sensor suppor direct channel backed by ashmem.
      * See SharedMemType and registerDirectChannel for more details.
      */
     DIRECT_CHANNEL_ASHMEM       = 0x400,
 
-    /*
+    /**
      * Set this flag if sensor suppor direct channel backed by gralloc HAL memory.
      * See SharedMemType and registerDirectChannel for more details.
      */
     DIRECT_CHANNEL_GRALLOC      = 0x800,
 
-    /*
+    /**
      * Flags mask for reporting mode of sensor.
      */
     MASK_REPORTING_MODE         = 0xE,
 
-    /*
+    /**
      * Flags mask for direct report maximum rate level support.
      * See RateLevel.
      */
     MASK_DIRECT_REPORT          = 0x380,
 
-    /*
+    /**
      * Flags mask for all direct channel support bits.
      * See SharedMemType.
      */
@@ -809,30 +810,34 @@
 };
 
 struct SensorInfo {
-    /* handle that identifies this sensors. This handle is used to reference
+    /**
+     * handle that identifies this sensors. This handle is used to reference
      * this sensor throughout the HAL API.
      */
     int32_t sensorHandle;
 
-    /* Name of this sensor.
+    /**
+     * Name of this sensor.
      * All sensors of the same "type" must have a different "name".
      */
     string name;
 
-    /* vendor of the hardware part */
+    /** vendor of the hardware part */
     string vendor;
 
-    /* version of the hardware part + driver. The value of this field
+    /**
+     * version of the hardware part + driver. The value of this field
      * must increase when the driver is updated in a way that changes the
      * output of this sensor. This is important for fused sensors when the
      * fusion algorithm is updated.
      */
     int32_t version;
 
-    /* this sensor's type. */
+    /** this sensor's type. */
     SensorType type;
 
-    /* type of this sensor as a string.
+    /**
+     * type of this sensor as a string.
      *
      * When defining an OEM specific sensor or sensor manufacturer specific
      * sensor, use your reserve domain name as a prefix.
@@ -843,16 +848,17 @@
      */
     string typeAsString;
 
-    /* maximum range of this sensor's value in SI units */
+    /** maximum range of this sensor's value in SI units */
     float maxRange;
 
-    /* smallest difference between two values reported by this sensor */
+    /** smallest difference between two values reported by this sensor */
     float resolution;
 
-    /* rough estimate of this sensor's power consumption in mA */
+    /** rough estimate of this sensor's power consumption in mA */
     float power;
 
-    /* this value depends on the reporting mode:
+    /**
+     * this value depends on the reporting mode:
      *
      *   continuous: minimum sample period allowed in microseconds
      *   on-change : 0
@@ -861,20 +867,23 @@
      */
     int32_t minDelay;
 
-    /* number of events reserved for this sensor in the batch mode FIFO.
+    /**
+     * number of events reserved for this sensor in the batch mode FIFO.
      * If there is a dedicated FIFO for this sensor, then this is the
      * size of this FIFO. If the FIFO is shared with other sensors,
      * this is the size reserved for that sensor and it can be zero.
      */
     uint32_t fifoReservedEventCount;
 
-    /* maximum number of events of this sensor that could be batched.
+    /**
+     * maximum number of events of this sensor that could be batched.
      * This is especially relevant when the FIFO is shared between
      * several sensors; this value is then set to the size of that FIFO.
      */
     uint32_t fifoMaxEventCount;
 
-    /* permission required to see this sensor, register to it and receive data.
+    /**
+     * permission required to see this sensor, register to it and receive data.
      * Set to "" if no permission is required. Some sensor types like the
      * heart rate monitor have a mandatory require_permission.
      * For sensors that always require a specific permission, like the heart
@@ -883,7 +892,8 @@
      */
     string requiredPermission;
 
-    /* This value is defined only for continuous mode and on-change sensors.
+    /**
+     * This value is defined only for continuous mode and on-change sensors.
      * It is the delay between two sensor events corresponding to the lowest
      * frequency that this sensor supports. When lower frequencies are requested
      * through batch()/setDelay() the events will be generated at this frequency
@@ -901,7 +911,7 @@
      */
     int32_t maxDelay;
 
-    /* Bitmask of SensorFlagBits */
+    /** Bitmask of SensorFlagBits */
     bitfield<SensorFlagBits> flags;
 };
 
@@ -938,13 +948,14 @@
 };
 
 struct HeartRate {
-    /* Heart rate in beats per minute.
+    /**
+     * Heart rate in beats per minute.
      * Set to 0 when status is SensorStatus::UNRELIABLE or
      * SensorStatus::NO_CONTACT
      */
     float bpm;
 
-    /* Status of the heart rate sensor for this reading. */
+    /** Status of the heart rate sensor for this reading. */
     SensorStatus status;
 };
 
@@ -961,7 +972,8 @@
     bool connected;
     int32_t sensorHandle;
 
-    /* UUID of a dynamic sensor (using RFC 4122 byte order)
+    /**
+     * UUID of a dynamic sensor (using RFC 4122 byte order)
      * For UUID 12345678-90AB-CDEF-1122-334455667788 the uuid field is
      * initialized as:
      *   {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF, 0x11, ...}
@@ -971,53 +983,60 @@
 
 @export(name="additional_info_type_t")
 enum AdditionalInfoType : uint32_t {
-    /* Marks the beginning of additional information frames */
+    /** Marks the beginning of additional information frames */
     AINFO_BEGIN                       = 0,
 
-    /* Marks the end of additional information frames */
+    /** Marks the end of additional information frames */
     AINFO_END                         = 1,
 
-    /* Estimation of the delay that is not tracked by sensor timestamps. This
+    /**
+     * Estimation of the delay that is not tracked by sensor timestamps. This
      * includes delay introduced by sensor front-end filtering, data transport,
      * etc.
      * float[2]: delay in seconds, standard deviation of estimated value
      */
     AINFO_UNTRACKED_DELAY             = 0x10000,
 
-    /* float: Celsius temperature */
+    /** float: Celsius temperature */
     AINFO_INTERNAL_TEMPERATURE,
 
-    /* First three rows of a homogeneous matrix, which represents calibration to
+    /**
+     * First three rows of a homogeneous matrix, which represents calibration to
      * a three-element vector raw sensor reading.
      * float[12]: 3x4 matrix in row major order
      */
     AINFO_VEC3_CALIBRATION,
 
-    /* Location and orientation of sensor element in the device frame: origin is
+    /**
+     * Location and orientation of sensor element in the device frame: origin is
      * the geometric center of the mobile device screen surface; the axis
      * definition corresponds to Android sensor definitions.
      * float[12]: 3x4 matrix in row major order
      */
     AINFO_SENSOR_PLACEMENT,
 
-    /* float[2]: raw sample period in seconds,
+    /**
+     * float[2]: raw sample period in seconds,
      *           standard deviation of sampling period
      */
     AINFO_SAMPLING,
 
     // Sampling channel modeling information section
 
-    /* int32_t: noise type
+    /**
+     * int32_t: noise type
      * float[n]: parameters
      */
     AINFO_CHANNEL_NOISE               = 0x20000,
 
-    /* float[3]: sample period, standard deviation of sample period,
+    /**
+     * float[3]: sample period, standard deviation of sample period,
      * quantization unit
      */
     AINFO_CHANNEL_SAMPLER,
 
-    /* Represents a filter:
+    /**
+     * Represents a filter:
      *   \sum_j a_j y[n-j] == \sum_i b_i x[n-i]
      *
      * int32_t[3]: number of feedforward coeffients M,
@@ -1031,48 +1050,56 @@
      */
     AINFO_CHANNEL_FILTER,
 
-    /* int32_t[2]: size in (row, column) ... 1st frame
+    /**
+     * int32_t[2]: size in (row, column) ... 1st frame
      * float[n]: matrix element values in row major order.
      */
     AINFO_CHANNEL_LINEAR_TRANSFORM,
 
-    /* int32_t[2]: extrapolate method, interpolate method
+    /**
+     * int32_t[2]: extrapolate method, interpolate method
      * float[n]: mapping key points in pairs, (in, out)...
      *           (may be used to model saturation).
      */
     AINFO_CHANNEL_NONLINEAR_MAP,
 
-    /* int32_t: resample method (0-th order, 1st order...)
+    /**
+     * int32_t: resample method (0-th order, 1st order...)
      * float[1]: resample ratio (upsampling if < 1.0, downsampling if > 1.0).
      */
     AINFO_CHANNEL_RESAMPLER,
 
-    /* Operation environment parameters section
+    /**
+     * Operation environment parameters section
      * Types in the following section is sent down (instead of reported from)
      * device as additional information to aid sensor operation. Data is sent
      * via injectSensorData() function to sensor handle -1 denoting all sensors
      * in device.
      */
 
-    /* Local geomagnetic field information based on device geo location. This
+    /**
+     * Local geomagnetic field information based on device geo location. This
      * type is primarily for for magnetic field calibration and rotation vector
      * sensor fusion.
      * float[3]: strength (uT), declination and inclination angle (rad).
      */
     AINFO_LOCAL_GEOMAGNETIC_FIELD     = 0x30000,
 
-    /* Local gravitational acceleration strength at device geo location.
+    /**
+     * Local gravitational acceleration strength at device geo location.
      * float: gravitational acceleration norm in m/s^2.
      */
     AINFO_LOCAL_GRAVITY,
 
-    /* Device dock state.
+    /**
+     * Device dock state.
      * int32_t: dock state following Android API Intent.EXTRA_DOCK_STATE
      * definition, undefined value is ignored.
      */
     AINFO_DOCK_STATE,
 
-    /* High performance mode hint. Device is able to use up more power and take
+    /**
+     * High performance mode hint. Device is able to use up more power and take
      * more reources to improve throughput and latency in high performance mode.
      * One possible use case is virtual reality, when sensor latency need to be
      * carefully controlled.
@@ -1081,7 +1108,8 @@
      */
     AINFO_HIGH_PERFORMANCE_MODE,
 
-    /* Magnetic field calibration hint. Device is notified when manually
+    /**
+     * Magnetic field calibration hint. Device is notified when manually
      * triggered magnetic field calibration procedure is started or stopped. The
      * calibration procedure is assumed timed out after 1 minute from start,
      * even if an explicit stop is not received.
@@ -1090,18 +1118,18 @@
      */
     AINFO_MAGNETIC_FIELD_CALIBRATION,
 
-    /* Custom information */
+    /** Custom information */
     AINFO_CUSTOM_START                = 0x10000000,
 
-    /* Debugging */
+    /** Debugging */
     AINFO_DEBUGGING_START             = 0x40000000,
 };
 
 struct AdditionalInfo {
-    /* type of payload data, see AdditionalInfoType */
+    /** type of payload data, see AdditionalInfoType */
     AdditionalInfoType type;
 
-    /* sequence number of this frame for this type */
+    /** sequence number of this frame for this type */
     int32_t serial;
 
     union Payload {
@@ -1121,27 +1149,31 @@
  * relative humidity in percent
  */
 union EventPayload {
-    /* SensorType::ACCELEROMETER, SensorType::MAGNETIC_FIELD,
+    /**
+     * SensorType::ACCELEROMETER, SensorType::MAGNETIC_FIELD,
      * SensorType::ORIENTATION, SensorType::GYROSCOPE, SensorType::GRAVITY,
      * SensorType::LINEAR_ACCELERATION
      */
     Vec3 vec3;
 
-    /* SensorType::ROTATION_VECTOR, SensorType::GAME_ROTATION_VECTOR,
+    /**
+     * SensorType::ROTATION_VECTOR, SensorType::GAME_ROTATION_VECTOR,
      * SensorType::GEOMAGNETIC_ROTATION_VECTOR
      */
     Vec4 vec4;
 
-    /* SensorType::MAGNETIC_FIELD_UNCALIBRATED,
+    /**
+     * SensorType::MAGNETIC_FIELD_UNCALIBRATED,
      * SensorType::GYROSCOPE_UNCALIBRATED
      * SensorType::ACCELEROMETER_UNCALIBRATED
      */
     Uncal uncal;
 
-    /* SensorType::META_DATA */
+    /** SensorType::META_DATA */
     MetaData meta;
 
-    /* SensorType::DEVICE_ORIENTATION, SensorType::LIGHT, SensorType::PRESSURE,
+    /**
+     * SensorType::DEVICE_ORIENTATION, SensorType::LIGHT, SensorType::PRESSURE,
      * SensorType::TEMPERATURE, SensorType::PROXIMITY,
      * SensorType::RELATIVE_HUMIDITY, SensorType::AMBIENT_TEMPERATURE,
      * SensorType::SIGNIFICANT_MOTION, SensorType::STEP_DETECTOR,
@@ -1153,35 +1185,35 @@
      */
     float scalar;
 
-    /* SensorType::STEP_COUNTER */
+    /** SensorType::STEP_COUNTER */
     uint64_t stepCount;
 
-    /* SensorType::HEART_RATE */
+    /** SensorType::HEART_RATE */
     HeartRate heartRate;
 
-    /* SensorType::POSE_6DOF */
+    /** SensorType::POSE_6DOF */
     float[15] pose6DOF;
 
-    /* SensorType::DYNAMIC_SENSOR_META */
+    /** SensorType::DYNAMIC_SENSOR_META */
     DynamicSensorInfo dynamic;
 
-    /* SensorType::ADDITIONAL_INFO */
+    /** SensorType::ADDITIONAL_INFO */
     AdditionalInfo additional;
 
-    /* undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE */
+    /** undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE */
     float[16] data;
 };
 
 struct Event {
-    /* Time measured in nanoseconds, in "elapsedRealtimeNano()'s" timebase. */
+    /** Time measured in nanoseconds, in "elapsedRealtimeNano()'s" timebase. */
     int64_t timestamp;
 
-    /* sensor identifier */
+    /** sensor identifier */
     int32_t sensorHandle;
 
     SensorType sensorType;
 
-    /* Union discriminated on sensorType */
+    /** Union discriminated on sensorType */
     EventPayload u;
 };
 
diff --git a/soundtrigger/2.0/ISoundTriggerHw.hal b/soundtrigger/2.0/ISoundTriggerHw.hal
index cf35ef1..0c235c9 100644
--- a/soundtrigger/2.0/ISoundTriggerHw.hal
+++ b/soundtrigger/2.0/ISoundTriggerHw.hal
@@ -22,106 +22,110 @@
 
 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 */
+        /** Implementor name */
         string   implementor;
-        /* Implementation description */
+        /** Implementation description */
         string   description;
-        /* Implementation version */
+        /** Implementation version */
         uint32_t version;
-        /* Unique implementation ID. The UUID must change with each version of
+        /**
+         * Unique implementation ID. The UUID must change with each version of
            the engine implementation */
         Uuid     uuid;
-        /* Maximum number of concurrent sound models loaded */
+        /** Maximum number of concurrent sound models loaded */
         uint32_t maxSoundModels;
-        /* Maximum number of key phrases */
+        /** Maximum number of key phrases */
         uint32_t maxKeyPhrases;
-        /* Maximum number of concurrent users detected */
+        /** Maximum number of concurrent users detected */
         uint32_t maxUsers;
-        /* All supported modes. e.g RecognitionMode.VOICE_TRIGGER */
+        /** All supported modes. e.g RecognitionMode.VOICE_TRIGGER */
         uint32_t recognitionModes;
-        /* Supports seamless transition from detection to capture */
+        /** Supports seamless transition from detection to capture */
         bool     captureTransition;
-        /* Maximum buffering capacity in ms if captureTransition is true */
+        /** Maximum buffering capacity in ms if captureTransition is true */
         uint32_t maxBufferMs;
-        /* Supports capture by other use cases while detection is active */
+        /** Supports capture by other use cases while detection is active */
         bool     concurrentCapture;
-        /* Returns the trigger capture in event */
+        /** Returns the trigger capture in event */
         bool     triggerInEvent;
-        /* Rated power consumption when detection is active with TDB
+        /**
+         * 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 */
+        /** Model type. e.g. SoundModelType.KEYPHRASE */
         SoundModelType type;
-        /* Unique sound model ID. */
+        /** Unique sound model ID. */
         Uuid           uuid;
-        /* Unique vendor ID. Identifies the engine the sound model
+        /**
+         * Unique vendor ID. Identifies the engine the sound model
          * was build for */
         Uuid           vendorUuid;
-        /* Opaque data transparent to Android framework */
+        /** Opaque data transparent to Android framework */
         vec<uint8_t>   data;
     };
 
-    /* Key phrase descriptor */
+    /** Key phrase descriptor */
     struct Phrase {
-        /* Unique keyphrase ID assigned at enrollment time */
+        /** Unique keyphrase ID assigned at enrollment time */
         uint32_t      id;
-        /* Recognition modes supported by this key phrase */
+        /** Recognition modes supported by this key phrase */
         uint32_t      recognitionModes;
-        /* List of users IDs associated with this key phrase */
+        /** List of users IDs associated with this key phrase */
         vec<uint32_t> users;
-        /* Locale - Java Locale style (e.g. en_US) */
+        /** Locale - Java Locale style (e.g. en_US) */
         string        locale;
-        /* Phrase text in UTF-8 format. */
+        /** 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 */
+        /** Common part of sound model descriptor */
         SoundModel  common;
-        /* List of descriptors for key phrases supported by this sound model */
+        /** 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
+        /**
+         * IO handle that will be used for capture. N/A if captureRequested
          * is false */
         AudioIoHandle   captureHandle;
-        /* Input device requested for detection capture */
+        /** Input device requested for detection capture */
         AudioDevice     captureDevice;
-        /* Capture and buffer audio for this recognition instance */
+        /** Capture and buffer audio for this recognition instance */
         bool            captureRequested;
-        /* Configuration for each key phrase */
+        /** Configuration for each key phrase */
         vec<PhraseRecognitionExtra> phrases;
-        /* Opaque capture configuration data transparent to the framework */
+        /** 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.
@@ -130,7 +134,7 @@
      */
     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
@@ -158,7 +162,7 @@
                    CallbackCookie cookie)
             generates (int32_t retval, SoundModelHandle modelHandle);
 
-    /*
+    /**
      * Load a key phrase 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
@@ -186,7 +190,7 @@
                    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
@@ -197,7 +201,7 @@
     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.
@@ -221,7 +225,7 @@
                      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.
@@ -233,7 +237,7 @@
     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.
diff --git a/soundtrigger/2.0/ISoundTriggerHwCallback.hal b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
index c6555f6..90132d9 100644
--- a/soundtrigger/2.0/ISoundTriggerHwCallback.hal
+++ b/soundtrigger/2.0/ISoundTriggerHwCallback.hal
@@ -29,62 +29,66 @@
         UPDATED  = 0,
     };
 
-    /*
+    /**
      * Generic recognition event sent via recognition callback
      */
     struct RecognitionEvent {
-        /* Recognition status e.g. SUCCESS */
+        /** Recognition status e.g. SUCCESS */
         RecognitionStatus status;
-        /* Sound model type for this event. e.g SoundModelType.TYPE_KEYPHRASE */
+        /** Sound model type for this event. e.g SoundModelType.TYPE_KEYPHRASE */
         SoundModelType    type;
-        /* Handle of loaded sound model which triggered the event */
+        /** Handle of loaded sound model which triggered the event */
         SoundModelHandle  model;
-        /* It is possible to capture audio from this */
-        /* utterance buffered by the implementation */
+        /** It is possible to capture audio from this */
+        /** utterance buffered by the implementation */
         bool              captureAvailable;
-        /* Audio session ID. framework use */
+        /** 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
+        /**
+         * 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.
+        /**
+         * 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 */
+        /** 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
+        /**
+         * 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 */
+        /** Opaque event data */
         vec<uint8_t>      data;
     };
 
-    /*
+    /**
      * Specialized recognition event for key phrase recognitions
      */
     struct PhraseRecognitionEvent {
-        /* Common part of the recognition event */
+        /** Common part of the recognition event */
         RecognitionEvent common;
-        /* List of descriptors for each recognized key phrase */
+        /** 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 */
+         /** Sound model status e.g. SoundModelStatus.UPDATED */
         SoundModelStatus status;
-        /* Loaded sound model that triggered the event */
+        /** Loaded sound model that triggered the event */
         SoundModelHandle model;
-        /* Opaque event data, passed transparently by the framework */
+        /** 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
@@ -93,7 +97,7 @@
      */
     recognitionCallback(RecognitionEvent event, CallbackCookie cookie);
 
-    /*
+    /**
      * Callback method called by the HAL when the sound recognition triggers
      * for a key phrase sound model.
      * @param event A RecognitionEvent structure containing detailed results
@@ -103,7 +107,7 @@
      */
     phraseRecognitionCallback(PhraseRecognitionEvent 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
diff --git a/soundtrigger/2.0/types.hal b/soundtrigger/2.0/types.hal
index 26928ba..fc7d019 100644
--- a/soundtrigger/2.0/types.hal
+++ b/soundtrigger/2.0/types.hal
@@ -16,66 +16,67 @@
 
 package android.hardware.soundtrigger@2.0;
 
-/*
+/**
  * Sound model types modes used in ISoundTriggerHw.SoundModel
  */
 enum SoundModelType : int32_t {
-    /* use for unspecified sound model type */
+    /** use for unspecified sound model type */
     UNKNOWN   = -1,
-    /* use for key phrase sound models */
+    /** use for key phrase sound models */
     KEYPHRASE = 0,
-    /* use for all models other than keyphrase */
+    /** 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 */
+    /** simple voice trigger */
     VOICE_TRIGGER       = (1 << 0),
-    /* trigger only if one user in model identified */
+    /** trigger only if one user in model identified */
     USER_IDENTIFICATION = (1 << 1),
-    /* trigger only if one user in mode authenticated */
+    /** trigger only if one user in mode authenticated */
     USER_AUTHENTICATION = (1 << 2),
-    /* generic sound trigger */
+    /** generic sound trigger */
     GENERIC_TRIGGER     = (1 << 3),
 };
 
-/*
+/**
  * Confidence level for each user in structure PhraseRecognitionExtra
  */
 struct ConfidenceLevel {
-    /* user ID */
+    /** user ID */
     uint32_t userId;
-    /* confidence level in percent (0 - 100): */
-    /* - min level for recognition configuration */
-    /* - detected level for recognition event */
+    /** 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 */
+    /** keyphrase ID */
     uint32_t id;
-    /* recognition modes used for this keyphrase */
+    /** recognition modes used for this keyphrase */
     uint32_t recognitionModes;
-    /* confidence level for mode RecognitionMode.VOICE_TRIGGER */
+    /** confidence level for mode RecognitionMode.VOICE_TRIGGER */
     uint32_t confidenceLevel;
-    /* list of confidence levels per user for
+    /**
+     * 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 */
+/** 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/baz/1.0/IBase.hal b/tests/baz/1.0/IBase.hal
index d5e3565..97b2db4 100644
--- a/tests/baz/1.0/IBase.hal
+++ b/tests/baz/1.0/IBase.hal
@@ -38,7 +38,7 @@
     };
 
     struct MoreThanOneArrayField {
-        /*
+        /**
          * Generated (Java) code used to redeclare the same variable name
          * multiple times in the same scope, this test ensures that that's no
          * longer the case.
diff --git a/tests/baz/1.0/types.hal b/tests/baz/1.0/types.hal
index 030dbe5..694b459 100644
--- a/tests/baz/1.0/types.hal
+++ b/tests/baz/1.0/types.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.tests.baz@1.0;
 
-/*
+/**
  * Verify that introducing a typedef in types.hal does not mistakenly emit
  * a makefile section to create a dedicated ulong.java class as it used to.
  */
diff --git a/tests/msgq/1.0/IBenchmarkMsgQ.hal b/tests/msgq/1.0/IBenchmarkMsgQ.hal
index 81754a4..6ee3485 100644
--- a/tests/msgq/1.0/IBenchmarkMsgQ.hal
+++ b/tests/msgq/1.0/IBenchmarkMsgQ.hal
@@ -17,7 +17,7 @@
 package android.hardware.tests.msgq@1.0;
 
 interface IBenchmarkMsgQ {
-    /*
+    /**
      * This method requests the service to set up Synchronous read/write
      * wait-free FMQ with the client as reader.
      * @return ret Will be true if the setup was successful, false otherwise.
@@ -27,7 +27,7 @@
     configureClientInboxSyncReadWrite()
         generates(bool ret, fmq_sync<uint8_t> mqDescIn);
 
-    /*
+    /**
      * This method requests the service to set up Synchronous read/write
      * wait-free FMQ with the client as writer.
      * @return ret Will be true if the setup was successful, false otherwise.
@@ -37,7 +37,7 @@
     configureClientOutboxSyncReadWrite()
         generates(bool ret, fmq_sync<uint8_t> mqDescOut);
 
-    /*
+    /**
      * This method request the service to write into the FMQ.
      * @param count Number to messages to write.
      * @return ret Will be true if the write operation was successful,
@@ -45,14 +45,14 @@
      */
     requestWrite(int32_t count) generates (bool ret);
 
-    /*
+    /**
      * This method request the service to read from the FMQ.
      * @param count Number to messages to read.
      * @ret Will be true if the read operation was successful, false otherwise.
      */
     requestRead(int32_t count) generates (bool ret);
 
-    /*
+    /**
      * This method kicks off a benchmarking experiment where
      * the client writes a message into its outbox FMQ,
      * the service reads it and writes it into the client's
@@ -62,14 +62,14 @@
      */
     benchmarkPingPong(uint32_t numIter);
 
-    /*
+    /**
      * This method kicks off a benchmarking experiment where
      * the service writes into an FMQ and the client reads the same.
      * @param numIter The number of iterations to run the experiment.
      */
     benchmarkServiceWriteClientRead(uint32_t numIter);
 
-    /*
+    /**
      * This method sends a vector of time duration(in ns).
      * @param timeData vector of time instants measured by client.
      * Each entry is the number of ns between the epoch and a
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index dfb9be4..350e26d 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -22,7 +22,7 @@
         FMQ_NOT_FULL  = 1 << 1,
     };
 
-    /*
+    /**
      * This method requests the service to set up a synchronous read/write
      * wait-free FMQ with the client as reader.
      *
@@ -33,7 +33,7 @@
     configureFmqSyncReadWrite()
         generates(bool ret, fmq_sync<uint16_t> mqDesc);
 
-    /*
+    /**
      * This method requests the service to return an MQDescriptor to
      * an unsynchronized FMQ set up by the server. If 'configureFmq' is
      * true, then the server sets up a new unsynchronized FMQ. This
@@ -48,7 +48,7 @@
      */
     getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync<uint16_t> mqDesc);
 
-    /*
+    /**
      * This method request the service to write into the synchronized read/write
      * flavor of the FMQ.
      *
@@ -58,7 +58,7 @@
      */
     requestWriteFmqSync(int32_t count) generates(bool ret);
 
-    /*
+    /**
      * This method request the service to read from the synchronized read/write
      * FMQ.
      *
@@ -68,7 +68,7 @@
      */
     requestReadFmqSync(int32_t count) generates(bool ret);
 
-    /*
+    /**
      * This method request the service to write into the unsynchronized flavor
      * of FMQ.
      *
@@ -78,7 +78,7 @@
      */
     requestWriteFmqUnsync(int32_t count) generates(bool ret);
 
-    /*
+    /**
      * This method request the service to read from the unsynchronized flavor of
      * FMQ.
      *
@@ -88,7 +88,7 @@
      */
     requestReadFmqUnsync(int32_t count) generates(bool ret);
 
-    /*
+    /**
      * This method requests the service to trigger a blocking read.
      *
      * @param count Number of messages to read.
@@ -96,7 +96,7 @@
      */
     oneway requestBlockingRead(int32_t count);
 
-    /*
+    /**
      * This method requests the service to trigger a blocking read using
      * default Event Flag notification bits defined by the MessageQueue class.
      *
@@ -105,7 +105,7 @@
      */
     oneway requestBlockingReadDefaultEventFlagBits(int32_t count);
 
-    /*
+    /**
      * This method requests the service to repeatedly trigger blocking reads.
      *
      * @param count Number of messages to read in a single blocking read.
diff --git a/thermal/1.0/IThermal.hal b/thermal/1.0/IThermal.hal
index e5f70cb..31a65d4 100644
--- a/thermal/1.0/IThermal.hal
+++ b/thermal/1.0/IThermal.hal
@@ -18,7 +18,7 @@
 
 interface IThermal {
 
-    /*
+    /**
      * Retrieves temperatures in Celsius.
      *
      * @return status Status of the operation. If status code is FAILURE,
@@ -38,7 +38,7 @@
     getTemperatures()
         generates (ThermalStatus status, vec<Temperature> temperatures);
 
-    /*
+    /**
      * Retrieves CPU usage information of each core: active and total times
      * in ms since first boot.
      *
@@ -55,7 +55,7 @@
     @exit
     getCpuUsages() generates (ThermalStatus status, vec<CpuUsage> cpuUsages);
 
-    /*
+    /**
      * Retrieves the cooling devices information.
      *
      * @return status Status of the operation. If status code is FAILURE,
diff --git a/tv/cec/1.0/IHdmiCec.hal b/tv/cec/1.0/IHdmiCec.hal
index e8db265..2840417 100644
--- a/tv/cec/1.0/IHdmiCec.hal
+++ b/tv/cec/1.0/IHdmiCec.hal
@@ -18,11 +18,11 @@
 
 import IHdmiCecCallback;
 
-/*
+/**
  * HDMI-CEC HAL interface definition.
  */
 interface IHdmiCec {
-    /*
+    /**
      * Passes the logical address that must be used in this system.
      *
      * HAL must use it to configure the hardware so that the CEC commands
@@ -39,7 +39,7 @@
     @callflow(next={"*"})
     addLogicalAddress(CecLogicalAddress addr) generates (Result result);
 
-    /*
+    /**
      * Clears all the logical addresses.
      *
      * It is used when the system doesn't need to process CEC command any more,
@@ -50,7 +50,7 @@
     @exit
     clearLogicalAddress();
 
-    /*
+    /**
      * Gets the CEC physical address.
      *
      * The physical address depends on the topology of the network formed by
@@ -66,7 +66,7 @@
     @callflow(next="*")
     getPhysicalAddress() generates (Result result, uint16_t addr);
 
-    /*
+    /**
      * Transmits HDMI-CEC message to other HDMI device.
      *
      * The method must be designed to return in a certain amount of time and not
@@ -84,7 +84,7 @@
     @callflow(next="*")
     sendMessage(CecMessage message) generates (SendMessageResult result);
 
-    /*
+    /**
      * Sets a callback that HDMI-CEC HAL must later use for incoming CEC
      * messages or internal HDMI events.
      *
@@ -95,7 +95,7 @@
     @entry
     setCallback(IHdmiCecCallback callback);
 
-    /*
+    /**
      * Returns the CEC version supported by underlying hardware.
      *
      * @return version the CEC version supported by underlying hardware.
@@ -103,7 +103,7 @@
     @callflow(next={"*"})
     getCecVersion() generates (int32_t version);
 
-    /*
+    /**
      * Gets the identifier of the vendor.
      *
      * @return vendorId Identifier of the vendor that is the 24-bit unique
@@ -113,7 +113,7 @@
     @callflow(next={"*"})
     getVendorId() generates (uint32_t vendorId);
 
-    /*
+    /**
      * Gets the hdmi port information of underlying hardware.
      *
      * @return infos The list of HDMI port information
@@ -121,7 +121,7 @@
     @callflow(next={"*"})
     getPortInfo() generates (vec<HdmiPortInfo> infos);
 
-    /*
+    /**
      * Sets flags controlling the way HDMI-CEC service works down to HAL
      * implementation. Those flags must be used in case the feature needs update
      * in HAL itself, firmware or microcontroller.
@@ -132,7 +132,7 @@
     @callflow(next="*")
     setOption(OptionKey key, bool value);
 
-    /*
+    /**
      * Passes the updated language information of Android system. Contains
      * three-letter code as defined in ISO/FDIS 639-2. Must be used for HAL to
      * respond to <Get Menu Language> while in standby mode.
@@ -143,7 +143,7 @@
     @callflow(next="*")
     setLanguage(string language);
 
-    /*
+    /**
      * Configures ARC circuit in the hardware logic to start or stop the
      * feature.
      *
@@ -154,7 +154,7 @@
     @callflow(next="*")
     enableAudioReturnChannel(int32_t portId, bool enable);
 
-    /*
+    /**
      * Gets the connection status of the specified port.
      *
      * @param portId Port id to be inspected for the connection status.
diff --git a/tv/cec/1.0/IHdmiCecCallback.hal b/tv/cec/1.0/IHdmiCecCallback.hal
index 4a9d28f..754d19f 100644
--- a/tv/cec/1.0/IHdmiCecCallback.hal
+++ b/tv/cec/1.0/IHdmiCecCallback.hal
@@ -17,13 +17,13 @@
 package android.hardware.tv.cec@1.0;
 
 interface IHdmiCecCallback {
-    /*
+    /**
      * The callback function that must be called by HAL implementation to notify
      * the system of new CEC message arrival.
      */
     oneway onCecMessage(CecMessage message);
 
-    /*
+    /**
      * The callback function that must be called by HAL implementation to notify
      * the system of new hotplug event.
      */
diff --git a/tv/cec/1.0/types.hal b/tv/cec/1.0/types.hal
index ec2e373..a1853a3 100644
--- a/tv/cec/1.0/types.hal
+++ b/tv/cec/1.0/types.hal
@@ -48,7 +48,7 @@
     BROADCAST = 15, // as Destination address
 };
 
-/*
+/**
  * HDMI CEC message types. The assigned values represent opcode used in CEC
  * frame as specified in CEC Table 8-26 of the CEC Spec 1.4b.
  */
@@ -123,7 +123,7 @@
     ABORT = 0xFF,
 };
 
-/*
+/**
  * Operand description [Abort Reason]
  */
 enum AbortReason : int32_t {
@@ -144,7 +144,7 @@
     FAILURE_BUSY = 5,
 };
 
-/*
+/**
  * error code used for send_message.
  */
 enum SendMessageResult : int32_t {
@@ -154,7 +154,7 @@
     FAIL = 3,
 };
 
-/*
+/**
  * HDMI port type.
  */
 enum HdmiPortType : int32_t {
@@ -162,24 +162,27 @@
     OUTPUT = 1,
 };
 
-/*
+/**
  * Options used for IHdmiCec.setOption()
  */
 enum OptionKey : int32_t {
-    /* When set to false, HAL does not wake up the system upon receiving <Image
+    /**
+     * When set to false, HAL does not wake up the system upon receiving <Image
      * View On> or <Text View On>. Used when user changes the TV settings to
      * disable the auto TV on functionality.
      * True by default.
      */
     WAKEUP = 1,
 
-    /* When set to false, all the CEC commands are discarded. Used when user
+    /**
+     * When set to false, all the CEC commands are discarded. Used when user
      * changes the TV settings to disable CEC functionality.
      * True by default.
      */
     ENABLE_CEC = 2,
 
-    /* Setting this flag to false means Android system must stop handling CEC
+    /**
+     * Setting this flag to false means Android system must stop handling CEC
      * service and yield the control over to the microprocessor that is powered
      * on through the standby mode. When set to true, the system must gain the
      * control over, hence telling the microprocessor to stop handling the CEC
@@ -190,17 +193,18 @@
      */
     SYSTEM_CEC_CONTROL = 3,
 
-    /* Option 4 not used */
+    /** Option 4 not used */
 };
 
 struct CecMessage {
-    /* logical address of sender */
+    /** logical address of sender */
     CecLogicalAddress initiator;
 
-    /* logical address of receiver */
+    /** logical address of receiver */
     CecLogicalAddress destination;
 
-    /* The maximum size of body is 15 (MaxLength::MESSAGE_BODY) as specified in
+    /**
+     * The maximum size of body is 15 (MaxLength::MESSAGE_BODY) as specified in
      * the section 6 of the CEC Spec 1.4b. Overflowed data must be ignored. */
     vec<uint8_t> body;
 };
@@ -210,7 +214,7 @@
     uint32_t portId;
 };
 
-/*
+/**
  * HDMI port descriptor
  */
 struct HdmiPortInfo {
diff --git a/tv/input/1.0/ITvInput.hal b/tv/input/1.0/ITvInput.hal
index 43de276..95aff21 100644
--- a/tv/input/1.0/ITvInput.hal
+++ b/tv/input/1.0/ITvInput.hal
@@ -19,7 +19,7 @@
 import ITvInputCallback;
 
 interface ITvInput {
-    /*
+    /**
      * Sets a callback for events.
      *
      * Note that initially no device is available in the client side, so the
@@ -33,7 +33,7 @@
     @callflow(next={"getStreamConfigurations"})
     setCallback(ITvInputCallback callback);
 
-    /*
+    /**
      * Gets stream configurations for a specific device.
      *
      * The configs object is valid only until the next
@@ -48,7 +48,7 @@
     getStreamConfigurations(int32_t deviceId)
             generates (Result result, vec<TvStreamConfig> configurations);
 
-    /*
+    /**
      * Opens a specific stream in a device.
      *
      * @param deviceId Device ID for the steam to open.
@@ -65,7 +65,7 @@
     openStream(int32_t deviceId, int32_t streamId)
             generates (Result result, handle sidebandStream);
 
-    /*
+    /**
      * Closes a specific stream in a device.
      *
      * @param deviceId Device ID for the steam to open.
diff --git a/tv/input/1.0/ITvInputCallback.hal b/tv/input/1.0/ITvInputCallback.hal
index f2f07a0..6d88c5b 100644
--- a/tv/input/1.0/ITvInputCallback.hal
+++ b/tv/input/1.0/ITvInputCallback.hal
@@ -17,7 +17,7 @@
 package android.hardware.tv.input@1.0;
 
 interface ITvInputCallback {
-    /*
+    /**
      * Notifies the client that an event has occured. For possible event types,
      * check TvInputEventType.
      *
diff --git a/tv/input/1.0/types.hal b/tv/input/1.0/types.hal
index 60a3b7b..55dd6c0 100644
--- a/tv/input/1.0/types.hal
+++ b/tv/input/1.0/types.hal
@@ -26,7 +26,7 @@
     INVALID_STATE,
 };
 
-/* Type of physical TV input. */
+/** Type of physical TV input. */
 @export(name="", value_prefix="TV_INPUT_TYPE_")
 enum TvInputType : int32_t {
     OTHER = 1,         // Generic hardware.
@@ -41,7 +41,7 @@
     DISPLAY_PORT = 10,
 };
 
-/*
+/**
  * Status of cable connection.
  * This status is for devices having availability to detect the cable in a mechanical way,
  * regardless of whether the connected external device is electrically on or not.
@@ -67,7 +67,7 @@
 
 @export(name="", value_prefix="EVENT_")
 enum TvInputEventType : int32_t {
-    /*
+    /**
      * Hardware notifies the framework that a device is available.
      *
      * Note that DEVICE_AVAILABLE and DEVICE_UNAVAILABLE events do not represent
@@ -89,7 +89,7 @@
      */
     DEVICE_AVAILABLE = 1,
 
-    /*
+    /**
      * Hardware notifies the framework that a device is unavailable.
      *
      * HAL implementation must generate this event when a device registered
@@ -104,7 +104,7 @@
      */
     DEVICE_UNAVAILABLE = 2,
 
-    /*
+    /**
      * Stream configurations are changed. Client must regard all open streams
      * at the specific device are closed, and must call
      * getStreamConfigurations() again, opening some of them if necessary.
@@ -126,7 +126,7 @@
 
 struct TvInputEvent {
     TvInputEventType type;
-    /*
+    /**
      * DEVICE_AVAILABLE: all fields are relevant.
      * DEVICE_UNAVAILABLE: only deviceId is relevant.
      * STREAM_CONFIGURATIONS_CHANGED: only deviceId is relevant.
diff --git a/usb/1.0/IUsb.hal b/usb/1.0/IUsb.hal
index 965326a..f464379 100644
--- a/usb/1.0/IUsb.hal
+++ b/usb/1.0/IUsb.hal
@@ -19,7 +19,7 @@
 import IUsbCallback;
 
 interface IUsb {
-    /*
+    /**
      * This function is used to change the port role of a specific port.
      * For example, when PD_SWAP or PR_SWAP is supported.
      * This is function is asynchronous. The status of the role switch
@@ -31,7 +31,7 @@
      */
     oneway switchRole(string portName, PortRole role);
 
-    /*
+    /**
      * This function is used to register a callback function which is
      * called by the HAL whenever there is a change in the port state.
      * i.e. DATA_ROLE, POWER_ROLE or MODE.
@@ -44,7 +44,7 @@
      */
     oneway setCallback(IUsbCallback callback);
 
-    /*
+    /**
      * This functions is used to request the hal for the current status
      * status of the Type-C ports. This method is async/oneway. The result of the
      * query would be sent through the IUsbCallback object's notifyRoleSwitchStatus
diff --git a/usb/1.0/IUsbCallback.hal b/usb/1.0/IUsbCallback.hal
index b665ba3..fd91cbf 100644
--- a/usb/1.0/IUsbCallback.hal
+++ b/usb/1.0/IUsbCallback.hal
@@ -16,13 +16,13 @@
 
 package android.hardware.usb@1.0;
 
-/*
+/**
  * Callback object used for all the IUsb async methods which expects a result.
  * Caller is expected to register the callback object using setCallback method
  * to receive updates on the PortStatus.
  */
 interface IUsbCallback {
-    /*
+    /**
      * Used to convey the current port status to the caller.
      * Called either when PortState changes due to the port partner (or)
      * when caller requested for the PortStatus update through queryPortStatus.
@@ -34,7 +34,7 @@
      */
     oneway notifyPortStatusChange(vec<PortStatus> currentPortStatus, Status retval);
 
-    /*
+    /**
      * Used to notify the result of the switchRole call to the caller.
      *
      * @param portName name of the port for which the roleswap is requested.
diff --git a/usb/1.0/types.hal b/usb/1.0/types.hal
index 17cd8c7..302616e 100644
--- a/usb/1.0/types.hal
+++ b/usb/1.0/types.hal
@@ -19,42 +19,42 @@
 enum Status : uint32_t {
     SUCCESS = 0,
 
-    /*
+    /**
      * error value when the HAL operation fails for reasons not listed here.
      */
     ERROR = 1,
 
-    /*
+    /**
      * error value returned when input argument is invalid.
      */
     INVALID_ARGUMENT = 2,
 
-    /*
+    /**
      * error value returned when role string is unrecognized.
      */
     UNRECOGNIZED_ROLE = 3,
 };
 
-/*
+/**
  * Denotes the Port role type.
  * Passed as an argument for functions used to query or change port roles.
  */
 enum PortRoleType : uint32_t {
-    /*
+    /**
      * Denotes the data role of the port.
      * The port can either be a "host" or a "device" for data.
      * This maps to the PortDataRole enum.
      */
     DATA_ROLE = 0,
 
-    /*
+    /**
      * Denotes the power role of the port.
      * The port can either be a "source" or "sink" for power.
      * This maps to PortPowerRole enum.
      */
     POWER_ROLE = 1,
 
-    /*
+    /**
      * USB ports can be a pure DFP port which can only act
      * as a host. A UFP port which can only act as a device.
      * Or a dual role ports which can either can as a host or
@@ -65,19 +65,19 @@
 
 @export
 enum PortDataRole : uint32_t {
-    /*
+    /**
      * Indicates that the port does not have a data role.
      * In case of DRP, the current data role of the port is only resolved
      * when the type-c handshake happens.
      */
     NONE = 0,
 
-    /*
+    /**
      * Indicates that the port is acting as a host for data.
      */
     HOST = 1,
 
-    /*
+    /**
      * Indicated that the port is acting as a device for data.
      */
     DEVICE = 2,
@@ -87,19 +87,19 @@
 
 @export
 enum PortPowerRole : uint32_t {
-    /*
+    /**
      * Indicates that the port does not have a power role.
      * In case of DRP, the current power role of the port is only resolved
      * when the type-c handshake happens.
      */
     NONE = 0,
 
-    /*
+    /**
      * Indicates that the port is supplying power to the other port.
      */
     SOURCE = 1,
 
-    /*
+    /**
      * Indicates that the port is sinking power from the other port.
      */
     SINK = 2,
@@ -109,23 +109,23 @@
 
 @export
 enum PortMode : uint32_t {
-    /*
+    /**
      * Indicates that the port does not have a mode.
      * In case of DRP, the current mode of the port is only resolved
      * when the type-c handshake happens.
      */
     NONE = 0,
-    /*
+    /**
      * Indicates that port can only act as device for data and sink for power.
      */
     UFP = 1,
 
-    /*
+    /**
      * Indicates the port can only act as host for data and source for power.
      */
     DFP = 2,
 
-    /*
+    /**
      * Indicates can either act as UFP or DFP at a given point of time.
      */
     DRP = 3,
@@ -133,17 +133,17 @@
     NUM_MODES = 4,
 };
 
-/*
+/**
  * Used as a container to send port role information.
  */
 struct PortRole {
-    /*
+    /**
      * Indicates the type of Port Role.
      * Maps to the PortRoleType enum.
      */
     PortRoleType type;
 
-    /*
+    /**
      * when type is HAL_USB_DATA_ROLE pass values from enum PortDataRole.
      * when type is HAL_USB_POWER_ROLE pass values from enum PortPowerRole.
      * when type is HAL_USB_MODE pass values from enum PortMode.
@@ -151,40 +151,40 @@
     uint32_t role;
 };
 
-/*
+/**
  * Used as the container to report data back to the caller.
  * Represents the current connection status of a single USB port.
  */
 struct PortStatus {
-     /*
+     /**
       * Name of the port.
       * Used as the port's id by the caller.
       */
      string portName;
 
-     /*
+     /**
       * Data role of the port.
       */
      PortDataRole currentDataRole;
 
-     /*
+     /**
       * Power Role of thte port.
       */
      PortPowerRole currentPowerRole;
 
-     /*
+     /**
       * Mode in which the port is connected.
       * Can be UFP or DFP.
       */
      PortMode currentMode;
 
-     /*
+     /**
       * True indicates that the port's mode can
       * be changed. False otherwise.
       */
      bool canChangeMode;
 
-     /*
+     /**
       * True indicates that the port's data role
       * can be changed. False otherwise.
       * For example, true if Type-C PD PD_SWAP
@@ -192,7 +192,7 @@
       */
      bool canChangeDataRole;
 
-     /*
+     /**
       * True indicates that the port's power role
       * can be changed. False otherwise.
       * For example, true if Type-C PD PR_SWAP
@@ -200,7 +200,7 @@
       */
      bool canChangePowerRole;
 
-     /*
+     /**
       * Identifies the type of the local port.
       *
       * UFP - Indicates that port can only act as device for
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 17aadee..1662312 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -589,10 +589,10 @@
  * Size limits for parameters used in the NAN interface.
  */
 enum NanParamSizeLimits : uint32_t {
-  /* Minimum length of Passphrase argument for data-path configuration */
+  /** Minimum length of Passphrase argument for data-path configuration */
   MIN_PASSPHRASE_LENGTH = 8,
 
-  /* Maximum length of Passphrase argument for data-path configuration */
+  /** Maximum length of Passphrase argument for data-path configuration */
   MAX_PASSPHRASE_LENGTH = 63,
 };
 
@@ -607,29 +607,29 @@
  */
 enum NanStatusType : uint32_t {
   SUCCESS = 0,
-  /* NAN Discovery Engine/Host driver failures */
+  /** NAN Discovery Engine/Host driver failures */
   INTERNAL_FAILURE = 1,
-  /* NAN OTA failures */
+  /** NAN OTA failures */
   PROTOCOL_FAILURE = 2,
-  /* The publish/subscribe discovery session id is invalid */
+  /** The publish/subscribe discovery session id is invalid */
   INVALID_SESSION_ID = 3,
-  /* Out of resources to fufill request */
+  /** Out of resources to fufill request */
   NO_RESOURCES_AVAILABLE = 4,
-  /* Invalid arguments passed */
+  /** Invalid arguments passed */
   INVALID_ARGS = 5,
-  /* Invalid peer id */
+  /** Invalid peer id */
   INVALID_PEER_ID = 6,
-  /* Invalid NAN data-path (ndp) id */
+  /** Invalid NAN data-path (ndp) id */
   INVALID_NDP_ID = 7,
-  /* Attempting to enable NAN when not available, e.g. wifi is disabled */
+  /** Attempting to enable NAN when not available, e.g. wifi is disabled */
   NAN_NOT_ALLOWED = 8,
-  /* Over the air ACK not received */
+  /** Over the air ACK not received */
   NO_OTA_ACK = 9,
-  /* Attempting to enable NAN when already enabled */
+  /** Attempting to enable NAN when already enabled */
   ALREADY_ENABLED = 10,
-  /* Can't queue tx followup message foor transmission */
+  /** Can't queue tx followup message foor transmission */
   FOLLOWUP_TX_QUEUE_FULL = 11,
-  /* Unsupported concurrency of NAN and another feature - NAN disabled */
+  /** Unsupported concurrency of NAN and another feature - NAN disabled */
   UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12
 };
 
diff --git a/wifi/supplicant/1.0/vts/Android.mk b/wifi/supplicant/1.0/vts/Android.mk
new file mode 100644
index 0000000..6361f9b
--- /dev/null
+++ b/wifi/supplicant/1.0/vts/Android.mk
@@ -0,0 +1,2 @@
+LOCAL_PATH := $(call my-dir)
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index 1fcfc8c..df4bfa9 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -136,14 +136,14 @@
 };
 
 void stopWifiFramework() {
-    ASSERT_EQ(std::system("svc wifi disable"), 0);
+    ASSERT_EQ(std::system("stop"), 0);
     // TODO: Use some other mechanism to wait for the framework to
     // finish disabling.
     sleep(5);
 }
 
 void startWifiFramework() {
-    ASSERT_EQ(std::system("svc wifi enable"), 0);
+    ASSERT_EQ(std::system("start"), 0);
     // These tests don't care whether the framework
     // finished enabling or not.
 }
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
index c2a58b6..5abf4e0 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -104,11 +104,13 @@
     }
     Return<void> onDisconnected(const hidl_array<uint8_t, 6>& /* bssid */,
                                 bool /* locallyGenerated */,
-                                uint32_t /* reasonCode */) override {
+                                ISupplicantStaIfaceCallback::ReasonCode
+                                /* reasonCode */) override {
         return Void();
     }
     Return<void> onAssociationRejected(
-        const hidl_array<uint8_t, 6>& /* bssid */, uint32_t /* statusCode */,
+        const hidl_array<uint8_t, 6>& /* bssid */,
+        ISupplicantStaIfaceCallback::StatusCode /* statusCode */,
         bool /*timedOut */) override {
         return Void();
     }
@@ -116,6 +118,11 @@
         const hidl_array<uint8_t, 6>& /* bssid */) override {
         return Void();
     }
+    Return<void> onBssidChanged(
+        ISupplicantStaIfaceCallback::BssidChangeReason /* reason */,
+        const hidl_array<uint8_t, 6>& /* bssid */) override {
+        return Void();
+    }
     Return<void> onEapFailure() override { return Void(); }
     Return<void> onWpsEventSuccess() override { return Void(); }
     Return<void> onWpsEventFail(