Merge "Basic target VTS test for Sound Trigger HAL"
diff --git a/audio/2.0/IDevicesFactory.hal b/audio/2.0/IDevicesFactory.hal
index a4e6956..f1dc7d3 100644
--- a/audio/2.0/IDevicesFactory.hal
+++ b/audio/2.0/IDevicesFactory.hal
@@ -22,7 +22,7 @@
interface IDevicesFactory {
typedef android.hardware.audio@2.0::Result Result;
- enum Device {
+ enum Device : int32_t {
PRIMARY,
A2DP,
USB,
diff --git a/audio/2.0/IPrimaryDevice.hal b/audio/2.0/IPrimaryDevice.hal
index 6beddfe..f1dd56e 100644
--- a/audio/2.0/IPrimaryDevice.hal
+++ b/audio/2.0/IPrimaryDevice.hal
@@ -76,7 +76,7 @@
*/
setBtScoWidebandEnabled(bool enabled) generates (Result retval);
- enum TtyMode {
+ enum TtyMode : int32_t {
OFF,
VCO,
HCO,
diff --git a/audio/2.0/default/Device.h b/audio/2.0/default/Device.h
index 3fd67e3..49d6b2c 100644
--- a/audio/2.0/default/Device.h
+++ b/audio/2.0/default/Device.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
#include <memory>
@@ -144,4 +144,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_Device_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
diff --git a/audio/2.0/default/DevicesFactory.h b/audio/2.0/default/DevicesFactory.h
index 0ea9859..b046f9f 100644
--- a/audio/2.0/default/DevicesFactory.h
+++ b/audio/2.0/default/DevicesFactory.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
#include <hardware/audio.h>
@@ -56,4 +56,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_DevicesFactory_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
diff --git a/audio/2.0/default/PrimaryDevice.h b/audio/2.0/default/PrimaryDevice.h
index 968c208..8177b68 100644
--- a/audio/2.0/default/PrimaryDevice.h
+++ b/audio/2.0/default/PrimaryDevice.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
#include <android/hardware/audio/2.0/IPrimaryDevice.h>
#include <hidl/Status.h>
@@ -114,4 +114,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_PrimaryDevice_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
diff --git a/audio/2.0/default/Stream.h b/audio/2.0/default/Stream.h
index 3893af4..2e641d6 100644
--- a/audio/2.0/default/Stream.h
+++ b/audio/2.0/default/Stream.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
#include <android/hardware/audio/2.0/IStream.h>
#include <hidl/Status.h>
@@ -91,4 +91,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_Stream_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
diff --git a/audio/2.0/default/StreamIn.h b/audio/2.0/default/StreamIn.h
index c2a7ea2..f7c17b7 100644
--- a/audio/2.0/default/StreamIn.h
+++ b/audio/2.0/default/StreamIn.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
#include <android/hardware/audio/2.0/IStreamIn.h>
#include <hidl/Status.h>
@@ -95,4 +95,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_StreamIn_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
diff --git a/audio/2.0/default/StreamOut.h b/audio/2.0/default/StreamOut.h
index ca33b2d..d51fc66 100644
--- a/audio/2.0/default/StreamOut.h
+++ b/audio/2.0/default/StreamOut.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
-#define HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
+#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
+#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
#include <android/hardware/audio/2.0/IStreamOut.h>
#include <hidl/Status.h>
@@ -110,4 +110,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_V2_0_StreamOut_H_
+#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
diff --git a/audio/2.0/types.hal b/audio/2.0/types.hal
index 9a5e4f1..7002f38 100644
--- a/audio/2.0/types.hal
+++ b/audio/2.0/types.hal
@@ -18,7 +18,7 @@
import android.hardware.audio.common@2.0;
-enum Result {
+enum Result : int32_t {
OK,
NOT_INITIALIZED,
INVALID_ARGUMENTS,
@@ -27,7 +27,7 @@
};
@export(name="audio_drain_type_t", value_prefix="AUDIO_DRAIN_")
-enum AudioDrain {
+enum AudioDrain : int32_t {
/* drain() returns when all data has been played. */
ALL,
/* drain() returns a short time before all data from the current track has
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
index 75fdb52..4e969a7 100644
--- a/audio/common/2.0/types.hal
+++ b/audio/common/2.0/types.hal
@@ -56,7 +56,7 @@
* Each port has a unique ID or handle allocated by policy manager.
*/
@export(name="")
-enum AudioHandleConsts {
+enum AudioHandleConsts : int32_t {
AUDIO_IO_HANDLE_NONE = 0,
AUDIO_MODULE_HANDLE_NONE = 0,
AUDIO_PORT_HANDLE_NONE = 0,
@@ -114,7 +114,7 @@
};
@export(name="audio_source_t", value_prefix="AUDIO_SOURCE_")
-enum AudioSource {
+enum AudioSource : int32_t {
// These values must kept in sync with
// frameworks/base/media/java/android/media/MediaRecorder.java,
// frameworks/av/services/audiopolicy/AudioPolicyService.cpp,
@@ -269,7 +269,7 @@
* assumptions.
*/
@export(name="")
-enum FixedChannelCount {
+enum FixedChannelCount : int32_t {
FCC_2 = 2, // This is typically due to legacy implementation of stereo I/O
FCC_8 = 8 // This is typically due to audio mixer and resampler limitations
};
@@ -425,7 +425,7 @@
* to this convention will be noted at the appropriate API.
*/
@export(name="", value_prefix="AUDIO_INTERLEAVE_")
-enum AudioInterleave {
+enum AudioInterleave : int32_t {
LEFT = 0,
RIGHT = 1,
};
@@ -435,7 +435,7 @@
* routing.
*/
@export(name="audio_mode_t", value_prefix="AUDIO_MODE_")
-enum AudioMode {
+enum AudioMode : int32_t {
INVALID = -2,
CURRENT = -1,
NORMAL = 0,
@@ -597,7 +597,7 @@
* (when getOuput() is called) to an available output stream.
*/
@export(name="audio_output_flags_t", value_prefix="AUDIO_OUTPUT_FLAG_")
-enum AudioOutputFlag {
+enum AudioOutputFlag : int32_t {
NONE = 0x0, // no attributes
DIRECT = 0x1, // this output directly connects a track
// to one output stream: no software mixer
@@ -627,7 +627,7 @@
* attributes corresponding to the specified flags.
*/
@export(name="audio_input_flags_t", value_prefix="AUDIO_INPUT_FLAG_")
-enum AudioInputFlag {
+enum AudioInputFlag : int32_t {
NONE = 0x0, // no attributes
FAST = 0x1, // prefer an input that supports "fast tracks"
HW_HOTWORD = 0x2, // prefer an input that captures from hw hotword source
@@ -728,7 +728,7 @@
/* Audio port role: either source or sink */
@export(name="audio_port_role_t", value_prefix="AUDIO_PORT_ROLE_")
-enum AudioPortRole {
+enum AudioPortRole : int32_t {
NONE,
SOURCE,
SINK,
@@ -739,7 +739,7 @@
* PlaybackThread output) or a physical device (e.g OUT_SPEAKER)
*/
@export(name="audio_port_type_t", value_prefix="AUDIO_PORT_TYPE_")
-enum AudioPortType {
+enum AudioPortType : int32_t {
NONE,
DEVICE,
MIX,
@@ -816,7 +816,7 @@
* Latency class of the audio mix.
*/
@export(name="audio_mix_latency_class_t", value_prefix="AUDIO_LATENCY_")
-enum AudioMixLatencyClass {
+enum AudioMixLatencyClass : int32_t {
LOW,
NORMAL
} ;
diff --git a/audio/effect/2.0/IDownmixEffect.hal b/audio/effect/2.0/IDownmixEffect.hal
index 817e14c..06409a3 100644
--- a/audio/effect/2.0/IDownmixEffect.hal
+++ b/audio/effect/2.0/IDownmixEffect.hal
@@ -20,7 +20,7 @@
import IEffect;
interface IDownmixEffect extends IEffect {
- enum Type {
+ enum Type : int32_t {
STRIP, // throw away the extra channels
FOLD // mix the extra channels with FL/FR
};
diff --git a/audio/effect/2.0/INoiseSuppressionEffect.hal b/audio/effect/2.0/INoiseSuppressionEffect.hal
index 58e439f..ae2bfb5 100644
--- a/audio/effect/2.0/INoiseSuppressionEffect.hal
+++ b/audio/effect/2.0/INoiseSuppressionEffect.hal
@@ -20,7 +20,7 @@
import IEffect;
interface INoiseSuppressionEffect extends IEffect {
- enum Level {
+ enum Level : int32_t {
LOW,
MEDIUM,
HIGH
@@ -36,7 +36,7 @@
*/
getSuppressionLevel() generates (Result retval, Level level);
- enum Type {
+ enum Type : int32_t {
SINGLE_CHANNEL,
MULTI_CHANNEL
};
diff --git a/audio/effect/2.0/IPresetReverbEffect.hal b/audio/effect/2.0/IPresetReverbEffect.hal
index 58dfd40..2237bc4 100644
--- a/audio/effect/2.0/IPresetReverbEffect.hal
+++ b/audio/effect/2.0/IPresetReverbEffect.hal
@@ -20,7 +20,7 @@
import IEffect;
interface IPresetReverbEffect extends IEffect {
- enum Preset {
+ enum Preset : int32_t {
NONE, // no reverb or reflections
SMALLROOM, // a small room less than five meters in length
MEDIUMROOM, // a medium room with a length of ten meters or less
diff --git a/audio/effect/2.0/IVisualizerEffect.hal b/audio/effect/2.0/IVisualizerEffect.hal
index 70dabf9..79dc9ee 100644
--- a/audio/effect/2.0/IVisualizerEffect.hal
+++ b/audio/effect/2.0/IVisualizerEffect.hal
@@ -20,7 +20,7 @@
import IEffect;
interface IVisualizerEffect extends IEffect {
- enum CaptureSizeRange {
+ enum CaptureSizeRange : int32_t {
MAX = 1024, // maximum capture size in samples
MIN = 128 // minimum capture size in samples
};
@@ -35,7 +35,7 @@
*/
getCaptureSize() generates (Result retval, uint16_t captureSize);
- enum ScalingMode {
+ enum ScalingMode : int32_t {
// Keep in sync with SCALING_MODE_... in
// frameworks/base/media/java/android/media/audiofx/Visualizer.java
NORMALIZED = 0,
@@ -62,7 +62,7 @@
*/
getLatency() generates (Result retval, uint32_t latencyMs);
- enum MeasurementMode {
+ enum MeasurementMode : int32_t {
// Keep in sync with MEASUREMENT_MODE_... in
// frameworks/base/media/java/android/media/audiofx/Visualizer.java
NONE = 0x0,
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
index cebc2d4..71fcc97 100644
--- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
+++ b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
#include <android/hardware/audio/effect/2.0/IAcousticEchoCancelerEffect.h>
#include <hidl/Status.h>
@@ -115,4 +115,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_AcousticEchoCancelerEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.h b/audio/effect/2.0/default/AutomaticGainControlEffect.h
index f4b228c..1696d3c 100644
--- a/audio/effect/2.0/default/AutomaticGainControlEffect.h
+++ b/audio/effect/2.0/default/AutomaticGainControlEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
#include <system/audio_effects/effect_agc.h>
@@ -131,4 +131,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_AutomaticGainControlEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
diff --git a/audio/effect/2.0/default/BassBoostEffect.h b/audio/effect/2.0/default/BassBoostEffect.h
index 23377e1..6636717 100644
--- a/audio/effect/2.0/default/BassBoostEffect.h
+++ b/audio/effect/2.0/default/BassBoostEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
#include <android/hardware/audio/effect/2.0/IBassBoostEffect.h>
#include <hidl/Status.h>
@@ -116,4 +116,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_BassBoostEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
diff --git a/audio/effect/2.0/default/DownmixEffect.h b/audio/effect/2.0/default/DownmixEffect.h
index 5ed4ffd..c7e1b9b 100644
--- a/audio/effect/2.0/default/DownmixEffect.h
+++ b/audio/effect/2.0/default/DownmixEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
#include <android/hardware/audio/effect/2.0/IDownmixEffect.h>
#include <hidl/Status.h>
@@ -115,4 +115,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_DownmixEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
diff --git a/audio/effect/2.0/default/Effect.h b/audio/effect/2.0/default/Effect.h
index e27a7e4..82eb1f2 100644
--- a/audio/effect/2.0/default/Effect.h
+++ b/audio/effect/2.0/default/Effect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
#include <vector>
@@ -256,4 +256,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_Effect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
diff --git a/audio/effect/2.0/default/EffectsFactory.h b/audio/effect/2.0/default/EffectsFactory.h
index d934c93..829a534 100644
--- a/audio/effect/2.0/default/EffectsFactory.h
+++ b/audio/effect/2.0/default/EffectsFactory.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
#include <system/audio_effect.h>
@@ -63,4 +63,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EffectsFactory_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.h b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
index c97c51c..edb5747 100644
--- a/audio/effect/2.0/default/EnvironmentalReverbEffect.h
+++ b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H
#include <system/audio_effects/effect_environmentalreverb.h>
@@ -157,4 +157,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EnvironmentalReverbEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H
diff --git a/audio/effect/2.0/default/EqualizerEffect.h b/audio/effect/2.0/default/EqualizerEffect.h
index 5665e9c..ba99e2b 100644
--- a/audio/effect/2.0/default/EqualizerEffect.h
+++ b/audio/effect/2.0/default/EqualizerEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H
#include <vector>
@@ -147,4 +147,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_EqualizerEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.h b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
index e68b038..8ca6e94 100644
--- a/audio/effect/2.0/default/LoudnessEnhancerEffect.h
+++ b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H
#include <android/hardware/audio/effect/2.0/ILoudnessEnhancerEffect.h>
#include <hidl/Status.h>
@@ -125,4 +125,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_LoudnessEnhancerEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.h b/audio/effect/2.0/default/NoiseSuppressionEffect.h
index 83e513e..b73727e 100644
--- a/audio/effect/2.0/default/NoiseSuppressionEffect.h
+++ b/audio/effect/2.0/default/NoiseSuppressionEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H
#include <system/audio_effects/effect_ns.h>
@@ -139,4 +139,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_NoiseSuppressionEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H
diff --git a/audio/effect/2.0/default/PresetReverbEffect.h b/audio/effect/2.0/default/PresetReverbEffect.h
index 3d98102..4d39569 100644
--- a/audio/effect/2.0/default/PresetReverbEffect.h
+++ b/audio/effect/2.0/default/PresetReverbEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H
#include <android/hardware/audio/effect/2.0/IPresetReverbEffect.h>
#include <hidl/Status.h>
@@ -125,4 +125,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_PresetReverbEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H
diff --git a/audio/effect/2.0/default/VirtualizerEffect.h b/audio/effect/2.0/default/VirtualizerEffect.h
index 2731c4e..ba89a61 100644
--- a/audio/effect/2.0/default/VirtualizerEffect.h
+++ b/audio/effect/2.0/default/VirtualizerEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H
#include <android/hardware/audio/effect/2.0/IVirtualizerEffect.h>
#include <hidl/Status.h>
@@ -136,4 +136,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_VirtualizerEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H
diff --git a/audio/effect/2.0/default/VisualizerEffect.h b/audio/effect/2.0/default/VisualizerEffect.h
index 505b16f..ae0b05c 100644
--- a/audio/effect/2.0/default/VisualizerEffect.h
+++ b/audio/effect/2.0/default/VisualizerEffect.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
-#define HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
#include <android/hardware/audio/effect/2.0/IVisualizerEffect.h>
#include <hidl/Status.h>
@@ -135,4 +135,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_audio_effect_V2_0_VisualizerEffect_H_
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
diff --git a/audio/effect/2.0/types.hal b/audio/effect/2.0/types.hal
index 35015b2..ad7f4ce 100644
--- a/audio/effect/2.0/types.hal
+++ b/audio/effect/2.0/types.hal
@@ -18,7 +18,7 @@
import android.hardware.audio.common@2.0;
-enum Result {
+enum Result : int32_t {
OK,
NOT_INITIALIZED,
INVALID_ARGUMENTS,
@@ -110,7 +110,7 @@
* +----------------+--------+--------------------------------------------------
*/
@export(name="", value_prefix="EFFECT_FLAG_")
-enum EffectFlags {
+enum EffectFlags : int32_t {
// Insert mode
TYPE_SHIFT = 0,
TYPE_SIZE = 3,
@@ -229,7 +229,7 @@
};
@export(name="effect_buffer_access_e", value_prefix="EFFECT_BUFFER_")
-enum EffectBufferAccess {
+enum EffectBufferAccess : int32_t {
ACCESS_WRITE,
ACCESS_READ,
ACCESS_ACCUMULATE
@@ -239,7 +239,7 @@
* Determines what fields of EffectBufferConfig need to be considered.
*/
@export(name="", value_prefix="EFFECT_CONFIG_")
-enum EffectConfigParameters {
+enum EffectConfigParameters : int32_t {
BUFFER = 0x0001, // buffer field
SMP_RATE = 0x0002, // samplingRate
CHANNELS = 0x0004, // channels
@@ -267,7 +267,7 @@
};
@export(name="effect_feature_e", value_prefix="EFFECT_FEATURE_")
-enum EffectFeature {
+enum EffectFeature : int32_t {
AUX_CHANNELS, // supports auxiliary channels
// (e.g. dual mic noise suppressor)
CNT
diff --git a/boot/1.0/default/BootControl.cpp b/boot/1.0/default/BootControl.cpp
index 4c34168..56d7b33 100644
--- a/boot/1.0/default/BootControl.cpp
+++ b/boot/1.0/default/BootControl.cpp
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#define LOG_TAG "android.hardware.boot@1.0-impl"
#include <utils/Log.h>
diff --git a/boot/1.0/default/BootControl.h b/boot/1.0/default/BootControl.h
index 73af4f4..3d668dc 100644
--- a/boot/1.0/default/BootControl.h
+++ b/boot/1.0/default/BootControl.h
@@ -1,5 +1,20 @@
-#ifndef HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
-#define HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
+#define ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
#include <android/hardware/boot/1.0/IBootControl.h>
#include <hidl/Status.h>
@@ -43,4 +58,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_boot_V1_0_BootControl_H_
+#endif // ANDROID_HARDWARE_BOOT_V1_0_BOOTCONTROL_H
diff --git a/boot/1.0/default/service.cpp b/boot/1.0/default/service.cpp
index a594db6..0dc56bf 100644
--- a/boot/1.0/default/service.cpp
+++ b/boot/1.0/default/service.cpp
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#define LOG_TAG "android.hardware.boot@1.0-service"
#include <android/hardware/boot/1.0/IBootControl.h>
diff --git a/broadcastradio/1.0/default/BroadcastRadio.h b/broadcastradio/1.0/default/BroadcastRadio.h
index dbd6e07..6764d82 100644
--- a/broadcastradio/1.0/default/BroadcastRadio.h
+++ b/broadcastradio/1.0/default/BroadcastRadio.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadio_H_
-#define HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadio_H_
+#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H
#include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
#include <hidl/Status.h>
@@ -68,4 +68,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadio_H_
+#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H
diff --git a/broadcastradio/1.0/default/BroadcastRadioFactory.h b/broadcastradio/1.0/default/BroadcastRadioFactory.h
index 9b2ca17..97f7f55 100644
--- a/broadcastradio/1.0/default/BroadcastRadioFactory.h
+++ b/broadcastradio/1.0/default/BroadcastRadioFactory.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadioFactory_H_
-#define HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadioFactory_H_
+#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIOFACTORY_H
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIOFACTORY_H
#include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
#include <hidl/Status.h>
@@ -40,4 +40,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_broadcastradio_V1_0_BroadcastRadioFactory_H_
+#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIOFACTORY_H
diff --git a/broadcastradio/1.0/default/Tuner.h b/broadcastradio/1.0/default/Tuner.h
index 94e216e..a621d97 100644
--- a/broadcastradio/1.0/default/Tuner.h
+++ b/broadcastradio/1.0/default/Tuner.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_broadcastradio_V1_0_Tuner_H_
-#define HIDL_GENERATED_android_hardware_broadcastradio_V1_0_Tuner_H_
+#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H
+#define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H
#include <android/hardware/broadcastradio/1.0/ITuner.h>
#include <android/hardware/broadcastradio/1.0/ITunerCallback.h>
@@ -64,4 +64,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_broadcastradio_V1_0_Tuner_H_
+#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H
diff --git a/broadcastradio/1.0/types.hal b/broadcastradio/1.0/types.hal
index d04359c..d8b2da3 100644
--- a/broadcastradio/1.0/types.hal
+++ b/broadcastradio/1.0/types.hal
@@ -16,7 +16,7 @@
package android.hardware.broadcastradio@1.0;
-enum Result {
+enum Result : int32_t {
OK,
NOT_INITIALIZED,
INVALID_ARGUMENTS,
@@ -139,7 +139,7 @@
vec<BandConfig> bands; /* band descriptors */
};
-enum MetadataType {
+enum MetadataType : int32_t {
INVALID = -1,
/* Signed 32 bit integer */
INT = 0,
@@ -152,7 +152,7 @@
CLOCK = 3,
};
-enum MetadataKey {
+enum MetadataKey : int32_t {
INVALID = -1,
/* RDS PI - string */
RDS_PI = 0,
diff --git a/contexthub/1.0/types.hal b/contexthub/1.0/types.hal
index 7d5a1ac..b9f014b 100644
--- a/contexthub/1.0/types.hal
+++ b/contexthub/1.0/types.hal
@@ -138,7 +138,7 @@
RESTARTED = 1, // Hub restarted unexpectedly
};
-enum TransactionResult {
+enum TransactionResult : int32_t {
SUCCESS, // successful completion of transaction
FAILURE, // failed transaction
};
diff --git a/dumpstate/1.0/Android.bp b/dumpstate/1.0/Android.bp
index 123275e..ab34af2 100644
--- a/dumpstate/1.0/Android.bp
+++ b/dumpstate/1.0/Android.bp
@@ -37,6 +37,7 @@
"libhidlbase",
"libhidltransport",
"libhwbinder",
+ "liblog",
"libutils",
"libcutils",
],
diff --git a/dumpstate/1.0/default/DumpstateDevice.cpp b/dumpstate/1.0/default/DumpstateDevice.cpp
index fac4ff3..4264235 100644
--- a/dumpstate/1.0/default/DumpstateDevice.cpp
+++ b/dumpstate/1.0/default/DumpstateDevice.cpp
@@ -1,3 +1,19 @@
+/*
+ * 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 "dumpstate"
#include "DumpstateDevice.h"
@@ -13,7 +29,7 @@
namespace implementation {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
-Return<void> DumpstateDevice::dumpstateBoard(const native_handle_t* handle) {
+Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
if (handle->numFds < 1) {
ALOGE("no FDs\n");
return Void();
@@ -28,11 +44,9 @@
ALOGI("Dumpstate HIDL not provided by device\n");
dprintf(fd, "Dumpstate HIDL not provided by device; providing bogus data.\n");
- // Shows some examples on how to use the libdumpstateutils API.
- dprintf(fd, "Time now is: ");
- RunCommandToFd(fd, {"/system/bin/date"});
- dprintf(fd, "Contents of a small file (/system/etc/hosts):\n");
- DumpFileToFd(fd, "/system/etc/hosts");
+ // Shows some examples on how to use the libdumpstateutil API.
+ RunCommandToFd(fd, "DATE", {"/system/bin/date"});
+ DumpFileToFd(fd, "HOSTS", "/system/etc/hosts");
return Void();
}
diff --git a/dumpstate/1.0/default/DumpstateDevice.h b/dumpstate/1.0/default/DumpstateDevice.h
index 366888d..f216304 100644
--- a/dumpstate/1.0/default/DumpstateDevice.h
+++ b/dumpstate/1.0/default/DumpstateDevice.h
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
#define ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
@@ -13,6 +28,7 @@
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
@@ -21,7 +37,7 @@
struct DumpstateDevice : public IDumpstateDevice {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
- Return<void> dumpstateBoard(const native_handle_t* fd) override;
+ Return<void> dumpstateBoard(const hidl_handle& h) override;
};
diff --git a/example/extension/light/2.0/default/Light.cpp b/example/extension/light/2.0/default/Light.cpp
index d738a6d..2e56319 100644
--- a/example/extension/light/2.0/default/Light.cpp
+++ b/example/extension/light/2.0/default/Light.cpp
@@ -1,3 +1,18 @@
+/*
+ * 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 "Light.h"
namespace android {
diff --git a/example/extension/light/2.0/default/Light.h b/example/extension/light/2.0/default/Light.h
index e09ec92..e3b60df 100644
--- a/example/extension/light/2.0/default/Light.h
+++ b/example/extension/light/2.0/default/Light.h
@@ -1,5 +1,20 @@
-#ifndef HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
-#define HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_EXAMPLE_EXTENSION_LIGHT_V2_0_LIGHT_H
+#define ANDROID_HARDWARE_EXAMPLE_EXTENSION_LIGHT_V2_0_LIGHT_H
#include <android/hardware/example/extension/light/2.0/IExtLight.h>
#include <hidl/Status.h>
@@ -43,4 +58,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_example_extension_light_V2_0_Light_H_
+#endif // ANDROID_HARDWARE_EXAMPLE_EXTENSION_LIGHT_V2_0_LIGHT_H
diff --git a/example/extension/light/2.0/default/service.cpp b/example/extension/light/2.0/default/service.cpp
index d21afa6..ae00506 100644
--- a/example/extension/light/2.0/default/service.cpp
+++ b/example/extension/light/2.0/default/service.cpp
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#define LOG_TAG "android.hardware.light@2.0-service"
#include <utils/Log.h>
diff --git a/gatekeeper/1.0/Android.bp b/gatekeeper/1.0/Android.bp
new file mode 100644
index 0000000..c841510
--- /dev/null
+++ b/gatekeeper/1.0/Android.bp
@@ -0,0 +1,54 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.gatekeeper@1.0_genc++",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gatekeeper@1.0",
+ srcs: [
+ "types.hal",
+ "IGatekeeper.hal",
+ ],
+ out: [
+ "android/hardware/gatekeeper/1.0/types.cpp",
+ "android/hardware/gatekeeper/1.0/GatekeeperAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.gatekeeper@1.0_genc++_headers",
+ tools: ["hidl-gen"],
+ cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gatekeeper@1.0",
+ srcs: [
+ "types.hal",
+ "IGatekeeper.hal",
+ ],
+ out: [
+ "android/hardware/gatekeeper/1.0/types.h",
+ "android/hardware/gatekeeper/1.0/IGatekeeper.h",
+ "android/hardware/gatekeeper/1.0/IHwGatekeeper.h",
+ "android/hardware/gatekeeper/1.0/BnGatekeeper.h",
+ "android/hardware/gatekeeper/1.0/BpGatekeeper.h",
+ "android/hardware/gatekeeper/1.0/BsGatekeeper.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.gatekeeper@1.0",
+ generated_sources: ["android.hardware.gatekeeper@1.0_genc++"],
+ generated_headers: ["android.hardware.gatekeeper@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.gatekeeper@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "liblog",
+ "libutils",
+ "libcutils",
+ ],
+ export_shared_lib_headers: [
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libutils",
+ ],
+}
diff --git a/gatekeeper/1.0/IGatekeeper.hal b/gatekeeper/1.0/IGatekeeper.hal
new file mode 100644
index 0000000..c193477
--- /dev/null
+++ b/gatekeeper/1.0/IGatekeeper.hal
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.gatekeeper@1.0;
+
+interface IGatekeeper {
+
+/**
+ * Enrolls desiredPassword, which may be derived from a user selected pin
+ * or password, with the private key used only for enrolling authentication
+ * factor data.
+ *
+ * If there was already a password enrolled, current password handle must be
+ * passed in currentPasswordHandle, and current password must be passed in
+ * currentPassword. Valid currentPassword must verify() against
+ * currentPasswordHandle.
+ *
+ * @param uid The Android user identifier
+ *
+ * @param currentPasswordHandle The currently enrolled password handle the user
+ * wants to replace. May be empty only if there's no currently enrolled
+ * password. Otherwise must be non-empty.
+ *
+ * @param currentPassword The user's current password in plain text.
+ * it MUST verify against current_password_handle if the latter is not-empty
+ *
+ * @param desiredPassword The new password the user wishes to enroll in
+ * plaintext.
+ *
+ * @return response
+ * On success, data buffer must contain the new password handle referencing
+ * the password provided in desiredPassword.
+ * This buffer can be used on subsequent calls to enroll or
+ * verify. On error, this buffer must be empty.
+ * response.code must always contain operation completion status.
+ * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on
+ * failure. It must return STATUS_OK on success.
+ * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero.
+ */
+enroll(uint32_t uid,
+ vec<uint8_t> currentPasswordHandle,
+ vec<uint8_t> currentPassword,
+ vec<uint8_t> desiredPassword)
+ generates (GatekeeperResponse response);
+
+/**
+ * Verifies that providedPassword matches enrolledPasswordHandle.
+ *
+ * Implementations of this module may retain the result of this call
+ * to attest to the recency of authentication.
+ *
+ * On success, returns verification token in response.data, which shall be
+ * usable to attest password verification to other trusted services.
+ *
+ * @param uid The Android user identifier
+ *
+ * @param challenge An optional challenge to authenticate against, or 0.
+ * Used when a separate authenticator requests password verification,
+ * or for transactional password authentication.
+ *
+ * @param enrolledPasswordHandle The currently enrolled password handle that
+ * user wishes to verify against. Must be non-empty.
+ *
+ * @param providedPassword The plaintext password to be verified against the
+ * enrolledPasswordHandle
+ *
+ * @return response
+ * On success, a non-empty data buffer containing the
+ * authentication token resulting from this verification is returned.
+ * On error, data buffer must be empty.
+ * response.code must always contain operation completion status.
+ * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on
+ * failure. It must return STATUS_OK on success.
+ * If password re-enrollment is necessary, it must return STATUS_REENROLL.
+ * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero.
+ */
+verify(uint32_t uid, uint64_t challenge,
+ vec<uint8_t> enrolledPasswordHandle,
+ 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.
+ *
+ * @param uid The Android user identifier
+ *
+ * @return response
+ * response.code must always contain operation completion status.
+ * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on
+ * failure. It must return STATUS_OK on success.
+ * If not implemented, it must return ERROR_NOT_IMPLEMENTED.
+ * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero.
+ */
+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.
+ *
+ * @return response
+ * response.code must always contain operation completion status.
+ * This method may return ERROR_GENERAL_FAILURE or ERROR_RETRY_TIMEOUT on
+ * failure. It must return STATUS_OK on success.
+ * If not implemented, it must return ERROR_NOT_IMPLEMENTED.
+ * If ERROR_RETRY_TIMEOUT is returned, response.timeout must be non-zero.
+ */
+deleteAllUsers() generates (GatekeeperResponse response);
+};
diff --git a/gatekeeper/1.0/default/Android.mk b/gatekeeper/1.0/default/Android.mk
new file mode 100644
index 0000000..e3b7d10
--- /dev/null
+++ b/gatekeeper/1.0/default/Android.mk
@@ -0,0 +1,40 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.gatekeeper@1.0-impl
+
+LOCAL_SRC_FILES := \
+ Gatekeeper.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.gatekeeper@1.0 \
+ libhardware \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libutils \
+ liblog \
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := android.hardware.gatekeeper@1.0-service
+LOCAL_INIT_RC := android.hardware.gatekeeper@1.0-service.rc
+
+LOCAL_SRC_FILES := \
+ service.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.gatekeeper@1.0 \
+ libhardware \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libutils \
+ liblog \
+
+include $(BUILD_EXECUTABLE)
diff --git a/gatekeeper/1.0/default/Gatekeeper.cpp b/gatekeeper/1.0/default/Gatekeeper.cpp
new file mode 100644
index 0000000..35b8c02
--- /dev/null
+++ b/gatekeeper/1.0/default/Gatekeeper.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.gatekeeper@1.0-service"
+
+#include <utils/Log.h>
+#include <dlfcn.h>
+
+#include "Gatekeeper.h"
+
+namespace android {
+namespace hardware {
+namespace gatekeeper {
+namespace V1_0 {
+namespace implementation {
+
+Gatekeeper::Gatekeeper()
+{
+ int ret = hw_get_module_by_class(GATEKEEPER_HARDWARE_MODULE_ID, NULL, &module);
+ device = NULL;
+
+ if (!ret) {
+ ret = gatekeeper_open(module, &device);
+ }
+ if (ret < 0) {
+ LOG_ALWAYS_FATAL_IF(ret < 0, "Unable to open GateKeeper HAL");
+ }
+}
+
+Gatekeeper::~Gatekeeper()
+{
+ if (device != nullptr) {
+ int ret = gatekeeper_close(device);
+ if (ret < 0) {
+ ALOGE("Unable to close GateKeeper HAL");
+ }
+ }
+ dlclose(module->dso);
+}
+
+// Methods from ::android::hardware::gatekeeper::V1_0::IGatekeeper follow.
+Return<void> Gatekeeper::enroll(uint32_t uid,
+ const hidl_vec<uint8_t>& currentPasswordHandle,
+ const hidl_vec<uint8_t>& currentPassword,
+ const hidl_vec<uint8_t>& desiredPassword,
+ enroll_cb cb)
+{
+ GatekeeperResponse rsp;
+ uint8_t *enrolled_password_handle = nullptr;
+ uint32_t enrolled_password_handle_length = 0;
+
+ int ret = device->enroll(device, uid,
+ currentPasswordHandle.data(), currentPasswordHandle.size(),
+ currentPassword.data(), currentPassword.size(),
+ desiredPassword.data(), desiredPassword.size(),
+ &enrolled_password_handle, &enrolled_password_handle_length);
+ if (!ret) {
+ rsp.data.setToExternal(enrolled_password_handle,
+ enrolled_password_handle_length,
+ true);
+ rsp.code = GatekeeperStatusCode::STATUS_OK;
+ } else if (ret > 0) {
+ rsp.timeout = ret;
+ rsp.code = GatekeeperStatusCode::ERROR_RETRY_TIMEOUT;
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_GENERAL_FAILURE;
+ }
+ cb(rsp);
+ return Void();
+}
+
+Return<void> Gatekeeper::verify(uint32_t uid,
+ uint64_t challenge,
+ const hidl_vec<uint8_t>& enrolledPasswordHandle,
+ const hidl_vec<uint8_t>& providedPassword,
+ verify_cb cb)
+{
+ GatekeeperResponse rsp;
+ uint8_t *auth_token = nullptr;
+ uint32_t auth_token_length = 0;
+ bool request_reenroll = false;
+
+ int ret = device->verify(device, uid, challenge,
+ enrolledPasswordHandle.data(), enrolledPasswordHandle.size(),
+ providedPassword.data(), providedPassword.size(),
+ &auth_token, &auth_token_length,
+ &request_reenroll);
+ if (!ret) {
+ rsp.data.setToExternal(auth_token, auth_token_length, true);
+ if (request_reenroll) {
+ rsp.code = GatekeeperStatusCode::STATUS_REENROLL;
+ } else {
+ rsp.code = GatekeeperStatusCode::STATUS_OK;
+ }
+ } else if (ret > 0) {
+ rsp.timeout = ret;
+ rsp.code = GatekeeperStatusCode::ERROR_RETRY_TIMEOUT;
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_GENERAL_FAILURE;
+ }
+ cb(rsp);
+ return Void();
+}
+
+Return<void> Gatekeeper::deleteUser(uint32_t uid, deleteUser_cb cb) {
+ GatekeeperResponse rsp;
+
+ if (device->delete_user != nullptr) {
+ int ret = device->delete_user(device, uid);
+ if (!ret) {
+ rsp.code = GatekeeperStatusCode::STATUS_OK;
+ } else if (ret > 0) {
+ rsp.timeout = ret;
+ rsp.code = GatekeeperStatusCode::ERROR_RETRY_TIMEOUT;
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_GENERAL_FAILURE;
+ }
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED;
+ }
+ cb(rsp);
+ return Void();
+}
+
+Return<void> Gatekeeper::deleteAllUsers(deleteAllUsers_cb cb) {
+ GatekeeperResponse rsp;
+ if (device->delete_all_users != nullptr) {
+ int ret = device->delete_all_users(device);
+ if (!ret) {
+ rsp.code = GatekeeperStatusCode::STATUS_OK;
+ } else if (ret > 0) {
+ rsp.timeout = ret;
+ rsp.code = GatekeeperStatusCode::ERROR_RETRY_TIMEOUT;
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_GENERAL_FAILURE;
+ }
+ } else {
+ rsp.code = GatekeeperStatusCode::ERROR_NOT_IMPLEMENTED;
+ }
+ cb(rsp);
+ return Void();
+}
+
+IGatekeeper* HIDL_FETCH_IGatekeeper(const char* /* name */) {
+ return new Gatekeeper();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gatekeeper
+} // namespace hardware
+} // namespace android
diff --git a/gatekeeper/1.0/default/Gatekeeper.h b/gatekeeper/1.0/default/Gatekeeper.h
new file mode 100644
index 0000000..4cc01f6
--- /dev/null
+++ b/gatekeeper/1.0/default/Gatekeeper.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
+#define ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
+
+#include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
+#include <hidl/Status.h>
+
+#include <hidl/MQDescriptor.h>
+
+#include <hardware/hardware.h>
+#include <hardware/gatekeeper.h>
+
+namespace android {
+namespace hardware {
+namespace gatekeeper {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::gatekeeper::V1_0::GatekeeperResponse;
+using ::android::hardware::gatekeeper::V1_0::IGatekeeper;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::sp;
+
+class Gatekeeper : public IGatekeeper {
+public:
+ Gatekeeper();
+ ~Gatekeeper();
+
+ // Methods from ::android::hardware::gatekeeper::V1_0::IGatekeeper follow.
+ Return<void> enroll(uint32_t uid,
+ const hidl_vec<uint8_t>& currentPasswordHandle,
+ const hidl_vec<uint8_t>& currentPassword,
+ const hidl_vec<uint8_t>& desiredPassword,
+ enroll_cb _hidl_cb) override;
+ Return<void> verify(uint32_t uid,
+ uint64_t challenge,
+ const hidl_vec<uint8_t>& enrolledPasswordHandle,
+ const hidl_vec<uint8_t>& providedPassword,
+ verify_cb _hidl_cb) override;
+ Return<void> deleteUser(uint32_t uid, deleteUser_cb _hidl_cb) override;
+ Return<void> deleteAllUsers(deleteAllUsers_cb _hidl_cb) override;
+private:
+ gatekeeper_device_t *device;
+ const hw_module_t *module;
+};
+
+extern "C" IGatekeeper* HIDL_FETCH_IGatekeeper(const char* name);
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gatekeeper
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GATEKEEPER_V1_0_GATEKEEPER_H
diff --git a/gatekeeper/1.0/default/android.hardware.gatekeeper@1.0-service.rc b/gatekeeper/1.0/default/android.hardware.gatekeeper@1.0-service.rc
new file mode 100644
index 0000000..ac15e23
--- /dev/null
+++ b/gatekeeper/1.0/default/android.hardware.gatekeeper@1.0-service.rc
@@ -0,0 +1,4 @@
+service gatekeeper-1-0 /system/bin/hw/android.hardware.gatekeeper@1.0-service
+ class hal
+ user system
+ group system
diff --git a/gatekeeper/1.0/default/service.cpp b/gatekeeper/1.0/default/service.cpp
new file mode 100644
index 0000000..407cf71
--- /dev/null
+++ b/gatekeeper/1.0/default/service.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.gatekeeper@1.0-service"
+
+#include <android/hardware/gatekeeper/1.0/IGatekeeper.h>
+
+#include <hidl/LegacySupport.h>
+
+// Generated HIDL files
+using android::hardware::gatekeeper::V1_0::IGatekeeper;
+using android::hardware::defaultPassthroughServiceImplementation;
+
+int main() {
+ return defaultPassthroughServiceImplementation<IGatekeeper>("gatekeeper");
+}
diff --git a/gatekeeper/1.0/types.hal b/gatekeeper/1.0/types.hal
new file mode 100644
index 0000000..8c184ee
--- /dev/null
+++ b/gatekeeper/1.0/types.hal
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.gatekeeper@1.0;
+
+/**
+ * Gatekeeper response codes; success >= 0; error < 0
+ */
+enum GatekeeperStatusCode : int32_t {
+ STATUS_REENROLL = 1, // success, but upper layers should re-enroll
+ // the verified password due to a version change
+ STATUS_OK = 0, // operation is successful
+ ERROR_GENERAL_FAILURE = -1, // operation failed
+ ERROR_RETRY_TIMEOUT = -2, // operation should be retried after timeout
+ ERROR_NOT_IMPLEMENTED = -3, // operation is not implemented
+};
+
+/**
+ * Gatekeeper response to any/all requests has this structure as mandatory part
+ */
+struct GatekeeperResponse {
+ /* request completion status */
+ GatekeeperStatusCode code;
+ /* retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+ * otherwise unused (0)
+ */
+ uint32_t timeout;
+ /* optional crypto blob */
+ vec<uint8_t> data;
+};
diff --git a/gatekeeper/Android.bp b/gatekeeper/Android.bp
new file mode 100644
index 0000000..bbb3e4b
--- /dev/null
+++ b/gatekeeper/Android.bp
@@ -0,0 +1,4 @@
+// This is an autogenerated file, do not edit.
+subdirs = [
+ "1.0",
+]
diff --git a/gnss/1.0/IAGnssRil.hal b/gnss/1.0/IAGnssRil.hal
index fb73498..7363d46 100644
--- a/gnss/1.0/IAGnssRil.hal
+++ b/gnss/1.0/IAGnssRil.hal
@@ -41,7 +41,7 @@
WIMAX = 6,
};
- enum AGnssRefLocationType {
+ enum AGnssRefLocationType : int32_t {
GSM_CELLID = 1,
UMTS_CELLID = 2,
MAC = 3,
diff --git a/graphics/allocator/2.0/Android.bp b/graphics/allocator/2.0/Android.bp
index e26e9a3..f823570 100644
--- a/graphics/allocator/2.0/Android.bp
+++ b/graphics/allocator/2.0/Android.bp
@@ -7,10 +7,12 @@
srcs: [
"types.hal",
"IAllocator.hal",
+ "IAllocatorClient.hal",
],
out: [
"android/hardware/graphics/allocator/2.0/types.cpp",
"android/hardware/graphics/allocator/2.0/AllocatorAll.cpp",
+ "android/hardware/graphics/allocator/2.0/AllocatorClientAll.cpp",
],
}
@@ -21,6 +23,7 @@
srcs: [
"types.hal",
"IAllocator.hal",
+ "IAllocatorClient.hal",
],
out: [
"android/hardware/graphics/allocator/2.0/types.h",
@@ -29,6 +32,11 @@
"android/hardware/graphics/allocator/2.0/BnAllocator.h",
"android/hardware/graphics/allocator/2.0/BpAllocator.h",
"android/hardware/graphics/allocator/2.0/BsAllocator.h",
+ "android/hardware/graphics/allocator/2.0/IAllocatorClient.h",
+ "android/hardware/graphics/allocator/2.0/IHwAllocatorClient.h",
+ "android/hardware/graphics/allocator/2.0/BnAllocatorClient.h",
+ "android/hardware/graphics/allocator/2.0/BpAllocatorClient.h",
+ "android/hardware/graphics/allocator/2.0/BsAllocatorClient.h",
],
}
diff --git a/graphics/allocator/2.0/IAllocator.hal b/graphics/allocator/2.0/IAllocator.hal
index 9a45444..00d07d5 100644
--- a/graphics/allocator/2.0/IAllocator.hal
+++ b/graphics/allocator/2.0/IAllocator.hal
@@ -16,7 +16,7 @@
package android.hardware.graphics.allocator@2.0;
-import android.hardware.graphics.common@1.0::PixelFormat;
+import IAllocatorClient;
interface IAllocator {
enum Capability : int32_t {
@@ -24,53 +24,18 @@
INVALID = 0,
/*
- * testAllocate will always return UNDEFINED unless this capability
- * is supported.
+ * IAllocatorClient::testAllocate must always return UNDEFINED unless
+ * this capability is supported.
*/
TEST_ALLOCATE = 1,
/*
- * layerCount must be 1 unless this capability is supported.
+ * IAllocatorClient::BufferDescriptorInfo::layerCount must be 1 unless
+ * this capability is supported.
*/
LAYERED_BUFFERS = 2,
};
- 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
- * padded.
- */
- 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. */
- PixelFormat format;
-
- /*
- * Buffer producer usage mask; valid flags can be found in the
- * definition of ProducerUsage.
- */
- uint64_t producerUsageMask;
-
- /*
- * Buffer consumer usage mask; valid flags can be found in the
- * definition of ConsumerUsage.
- */
- uint64_t consumerUsageMask;
- };
-
/*
* Provides a list of supported capabilities (as described in the
* definition of Capability above). This list must not change after
@@ -95,110 +60,15 @@
dumpDebugInfo() generates (string debugInfo);
/*
- * Creates a new, opaque buffer descriptor.
+ * 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.
*
- * @param descriptorInfo specifies the attributes of the buffer
- * descriptor.
* @return error is NONE upon success. Otherwise,
- * BAD_VALUE when any attribute in descriptorInfo is invalid.
- * NO_RESOURCES when no more descriptors can currently be created.
- * @return descriptor is the newly created buffer descriptor.
+ * NO_RESOURCES when no more client can currently be created.
+ * @return client is the newly created client.
*/
@entry
@callflow(next="*")
- createDescriptor(BufferDescriptorInfo descriptorInfo)
- generates (Error error,
- BufferDescriptor descriptor);
-
- /*
- * Destroys an existing buffer descriptor.
- *
- * @param descriptor is the descriptor to destroy.
- * @return error is either NONE or BAD_DESCRIPTOR.
- */
- @exit
- @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.
- *
- * @param descriptors is a list of buffer descriptors.
- * @return error is NONE or NOT_SHARED upon success;
- * NONE when buffers can be created and share a backing store.
- * NOT_SHARED when buffers can be created but require more than a
- * backing store.
- * Otherwise,
- * BAD_DESCRIPTOR when any of the descriptors is invalid.
- * UNSUPPORTED when any of the descriptors can never be satisfied.
- * UNDEFINED when TEST_ALLOCATE is not listed in getCapabilities.
- */
- @callflow(next="allocate")
- testAllocate(vec<BufferDescriptor> descriptors) generates (Error error);
-
- /*
- * Attempts to allocate a list of buffers sharing a backing store.
- *
- * Each buffer will correspond to one of the descriptors passed into the
- * function and will hold a reference to its backing store. If the device
- * is unable to share the backing store between the buffers, it must
- * attempt to allocate the buffers with different backing stores and
- * return NOT_SHARED if it is successful.
- *
- * @param descriptors is the buffer descriptors to attempt to allocate.
- * @return error is NONE or NOT_SHARED upon success;
- * NONE when buffers can be created and share a backing store.
- * NOT_SHARED when buffers can be created but require more than a
- * backing store.
- * Otherwise,
- * BAD_DESCRIPTOR when any of the descriptors is invalid.
- * UNSUPPORTED when any of the descriptors can never be satisfied.
- * NO_RESOURCES when any of the buffers cannot be created at this
- * time.
- * @return buffers is the allocated buffers.
- */
- @callflow(next="exportHandle")
- allocate(vec<BufferDescriptor> descriptors)
- generates (Error error,
- vec<Buffer> buffers);
-
- /*
- * Frees a buffer.
- *
- * @param buffer is the buffer to be freed.
- * @return error is NONE upon success. Otherwise,
- * BAD_BUFFER when the buffer is invalid.
- */
- @exit
- @callflow(next="*")
- free(Buffer buffer) generates (Error error);
-
- /*
- * Exports a buffer for use in other client libraries or for cross-process
- * sharing.
- *
- * The exported handle is a handle to the backing store of the buffer, not
- * to the buffer itself. It however may not hold any reference to the
- * backing store and may be considered invalid by client libraries. To use
- * it and, in most cases, to save it for later use, a client must make a
- * clone of the handle and have the cloned handle hold a reference to the
- * backing store. Such a cloned handle will stay valid even after the
- * original buffer is freed. Refer to native_handle_clone and IMapper for
- * how a handle is cloned and how a reference is added.
- *
- * @param descriptor is the descriptor used to allocate the buffer.
- * @param buffer is the buffer to be exported.
- * @return error is NONE upon success. Otherwise,
- * BAD_DESCRIPTOR when the descriptor is invalid.
- * BAD_BUFFER when the buffer is invalid.
- * BAD_VALUE when descriptor and buffer do not match.
- * NO_RESOURCES when the buffer cannot be exported at this time.
- * @return bufferHandle is the exported handle.
- */
- @callflow(next="free")
- exportHandle(BufferDescriptor descriptor,
- Buffer buffer)
- generates (Error error,
- handle bufferHandle);
+ createClient() generates (Error error, IAllocatorClient client);
};
diff --git a/graphics/allocator/2.0/IAllocatorClient.hal b/graphics/allocator/2.0/IAllocatorClient.hal
new file mode 100644
index 0000000..080e3ea
--- /dev/null
+++ b/graphics/allocator/2.0/IAllocatorClient.hal
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.allocator@2.0;
+
+import android.hardware.graphics.common@1.0::PixelFormat;
+
+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
+ * padded.
+ */
+ 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. */
+ 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
+ * descriptor.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_VALUE when any attribute in descriptorInfo is invalid.
+ * NO_RESOURCES when no more descriptors can currently be created.
+ * @return descriptor is the newly created buffer descriptor.
+ */
+ @entry
+ @callflow(next="*")
+ createDescriptor(BufferDescriptorInfo descriptorInfo)
+ generates (Error error,
+ BufferDescriptor descriptor);
+
+ /*
+ * Destroys an existing buffer descriptor.
+ *
+ * @param descriptor is the descriptor to destroy.
+ * @return error is either NONE or BAD_DESCRIPTOR.
+ */
+ @exit
+ @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.
+ *
+ * @param descriptors is a list of buffer descriptors.
+ * @return error is NONE or NOT_SHARED upon success;
+ * NONE when buffers can be created and share a backing store.
+ * NOT_SHARED when buffers can be created but require more than a
+ * backing store.
+ * Otherwise,
+ * BAD_DESCRIPTOR when any of the descriptors is invalid.
+ * UNSUPPORTED when any of the descriptors can never be satisfied.
+ * UNDEFINED when TEST_ALLOCATE is not listed in getCapabilities.
+ */
+ @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
+ * function and must hold a reference to its backing store. If the device
+ * is unable to share the backing store between the buffers, it must
+ * attempt to allocate the buffers with different backing stores and
+ * return NOT_SHARED if it is successful.
+ *
+ * @param descriptors is the buffer descriptors to attempt to allocate.
+ * @return error is NONE or NOT_SHARED upon success;
+ * NONE when buffers can be created and share a backing store.
+ * NOT_SHARED when buffers can be created but require more than a
+ * backing store.
+ * Otherwise,
+ * BAD_DESCRIPTOR when any of the descriptors is invalid.
+ * UNSUPPORTED when any of the descriptors can never be satisfied.
+ * NO_RESOURCES when any of the buffers cannot be created at this
+ * time.
+ * @return buffers is the allocated buffers.
+ */
+ @callflow(next="exportHandle")
+ allocate(vec<BufferDescriptor> descriptors)
+ generates (Error error,
+ vec<Buffer> buffers);
+
+ /*
+ * Frees a buffer.
+ *
+ * @param buffer is the buffer to be freed.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_BUFFER when the buffer is invalid.
+ */
+ @exit
+ @callflow(next="*")
+ free(Buffer buffer) generates (Error error);
+
+ /*
+ * Exports a buffer for use in other client libraries or for cross-process
+ * sharing.
+ *
+ * The exported handle is a handle to the backing store of the buffer, not
+ * to the buffer itself. It however may not hold any reference to the
+ * backing store and may be considered invalid by client libraries. To use
+ * it and, in most cases, to save it for later use, a client must make a
+ * clone of the handle and have the cloned handle hold a reference to the
+ * backing store. Such a cloned handle will stay valid even after the
+ * original buffer is freed. Refer to native_handle_clone and IMapper for
+ * how a handle is cloned and how a reference is added.
+ *
+ * @param descriptor is the descriptor used to allocate the buffer.
+ * @param buffer is the buffer to be exported.
+ * @return error is NONE upon success. Otherwise,
+ * BAD_DESCRIPTOR when the descriptor is invalid.
+ * BAD_BUFFER when the buffer is invalid.
+ * BAD_VALUE when descriptor and buffer do not match.
+ * NO_RESOURCES when the buffer cannot be exported at this time.
+ * @return bufferHandle is the exported handle.
+ */
+ @callflow(next="free")
+ exportHandle(BufferDescriptor descriptor,
+ Buffer buffer)
+ generates (Error error,
+ handle bufferHandle);
+};
diff --git a/graphics/allocator/2.0/default/Gralloc.cpp b/graphics/allocator/2.0/default/Gralloc.cpp
index 8a74661..e3d2703 100644
--- a/graphics/allocator/2.0/default/Gralloc.cpp
+++ b/graphics/allocator/2.0/default/Gralloc.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "GrallocPassthrough"
+#include <mutex>
#include <type_traits>
#include <unordered_set>
#include <vector>
@@ -42,18 +43,19 @@
// IAllocator interface
Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
- Return<void> createDescriptor(const BufferDescriptorInfo& descriptorInfo,
- createDescriptor_cb hidl_cb) override;
- Return<Error> destroyDescriptor(BufferDescriptor descriptor) override;
+ Return<void> createClient(createClient_cb hidl_cb) override;
- Return<Error> testAllocate(
- const hidl_vec<BufferDescriptor>& descriptors) override;
- Return<void> allocate(const hidl_vec<BufferDescriptor>& descriptors,
- allocate_cb hidl_cb) override;
- Return<Error> free(Buffer buffer) override;
+ Error createDescriptor(
+ const IAllocatorClient::BufferDescriptorInfo& descriptorInfo,
+ BufferDescriptor& outDescriptor);
+ Error destroyDescriptor(BufferDescriptor descriptor);
- Return<void> exportHandle(BufferDescriptor descriptor,
- Buffer buffer, exportHandle_cb hidl_cb) override;
+ Error testAllocate(const hidl_vec<BufferDescriptor>& descriptors);
+ Error allocate(const hidl_vec<BufferDescriptor>& descriptors,
+ hidl_vec<Buffer>& outBuffers);
+ Error free(Buffer buffer);
+
+ Error exportHandle(Buffer buffer, const native_handle_t*& outHandle);
private:
void initCapabilities();
@@ -79,12 +81,36 @@
GRALLOC1_PFN_SET_PRODUCER_USAGE setProducerUsage;
GRALLOC1_PFN_ALLOCATE allocate;
GRALLOC1_PFN_RELEASE release;
- GRALLOC1_PFN_GET_BACKING_STORE getBackingStore;
- GRALLOC1_PFN_GET_STRIDE getStride;
- GRALLOC1_PFN_GET_NUM_FLEX_PLANES getNumFlexPlanes;
} mDispatch;
};
+class GrallocClient : public IAllocatorClient {
+public:
+ GrallocClient(GrallocHal& hal);
+ virtual ~GrallocClient();
+
+ // IAllocatorClient interface
+ Return<void> createDescriptor(const BufferDescriptorInfo& descriptorInfo,
+ createDescriptor_cb hidl_cb) override;
+ Return<Error> destroyDescriptor(BufferDescriptor descriptor) override;
+
+ Return<Error> testAllocate(
+ const hidl_vec<BufferDescriptor>& descriptors) override;
+ Return<void> allocate(const hidl_vec<BufferDescriptor>& descriptors,
+ allocate_cb hidl_cb) override;
+ Return<Error> free(Buffer buffer) override;
+
+ Return<void> exportHandle(BufferDescriptor descriptor,
+ Buffer buffer, exportHandle_cb hidl_cb) override;
+
+private:
+ GrallocHal& mHal;
+
+ std::mutex mMutex;
+ std::unordered_set<BufferDescriptor> mDescriptors;
+ std::unordered_set<Buffer> mBuffers;
+};
+
GrallocHal::GrallocHal(const hw_module_t* module)
: mDevice(nullptr), mDispatch()
{
@@ -182,24 +208,37 @@
return Void();
}
-Return<void> GrallocHal::createDescriptor(
- const BufferDescriptorInfo& descriptorInfo,
- createDescriptor_cb hidl_cb)
+Return<void> GrallocHal::createClient(createClient_cb hidl_cb)
{
- BufferDescriptor descriptor;
+ sp<IAllocatorClient> client = new GrallocClient(*this);
+ hidl_cb(Error::NONE, client);
+
+ return Void();
+}
+
+Error GrallocHal::createDescriptor(
+ const IAllocatorClient::BufferDescriptorInfo& descriptorInfo,
+ BufferDescriptor& outDescriptor)
+{
+ gralloc1_buffer_descriptor_t descriptor;
int32_t err = mDispatch.createDescriptor(mDevice, &descriptor);
- if (err == GRALLOC1_ERROR_NONE) {
- err = mDispatch.setDimensions(mDevice, descriptor,
- descriptorInfo.width, descriptorInfo.height);
+ if (err != GRALLOC1_ERROR_NONE) {
+ return static_cast<Error>(err);
}
+
+ err = mDispatch.setDimensions(mDevice, descriptor,
+ descriptorInfo.width, descriptorInfo.height);
if (err == GRALLOC1_ERROR_NONE) {
err = mDispatch.setFormat(mDevice, descriptor,
static_cast<int32_t>(descriptorInfo.format));
}
- if (err == GRALLOC1_ERROR_NONE &&
- hasCapability(Capability::LAYERED_BUFFERS)) {
- err = mDispatch.setLayerCount(mDevice, descriptor,
- descriptorInfo.layerCount);
+ if (err == GRALLOC1_ERROR_NONE) {
+ if (hasCapability(Capability::LAYERED_BUFFERS)) {
+ err = mDispatch.setLayerCount(mDevice, descriptor,
+ descriptorInfo.layerCount);
+ } else if (descriptorInfo.layerCount != 1) {
+ err = GRALLOC1_ERROR_BAD_VALUE;
+ }
}
if (err == GRALLOC1_ERROR_NONE) {
uint64_t producerUsageMask = descriptorInfo.producerUsageMask;
@@ -221,64 +260,189 @@
consumerUsageMask);
}
- hidl_cb(static_cast<Error>(err), descriptor);
+ if (err == GRALLOC1_ERROR_NONE) {
+ outDescriptor = descriptor;
+ } else {
+ mDispatch.destroyDescriptor(mDevice, descriptor);
+ }
- return Void();
+ return static_cast<Error>(err);
}
-Return<Error> GrallocHal::destroyDescriptor(
- BufferDescriptor descriptor)
+Error GrallocHal::destroyDescriptor(BufferDescriptor descriptor)
{
int32_t err = mDispatch.destroyDescriptor(mDevice, descriptor);
return static_cast<Error>(err);
}
-Return<Error> GrallocHal::testAllocate(
- const hidl_vec<BufferDescriptor>& descriptors)
+Error GrallocHal::testAllocate(const hidl_vec<BufferDescriptor>& descriptors)
{
if (!hasCapability(Capability::TEST_ALLOCATE)) {
return Error::UNDEFINED;
}
int32_t err = mDispatch.allocate(mDevice, descriptors.size(),
- &descriptors[0], nullptr);
+ descriptors.data(), nullptr);
return static_cast<Error>(err);
}
-Return<void> GrallocHal::allocate(
- const hidl_vec<BufferDescriptor>& descriptors,
- allocate_cb hidl_cb) {
+Error GrallocHal::allocate(const hidl_vec<BufferDescriptor>& descriptors,
+ hidl_vec<Buffer>& outBuffers)
+{
std::vector<buffer_handle_t> buffers(descriptors.size());
int32_t err = mDispatch.allocate(mDevice, descriptors.size(),
- &descriptors[0], buffers.data());
- if (err != GRALLOC1_ERROR_NONE && err != GRALLOC1_ERROR_NOT_SHARED) {
- buffers.clear();
+ descriptors.data(), buffers.data());
+ if (err == GRALLOC1_ERROR_NONE || err == GRALLOC1_ERROR_NOT_SHARED) {
+ outBuffers.resize(buffers.size());
+ for (size_t i = 0; i < outBuffers.size(); i++) {
+ outBuffers[i] = static_cast<Buffer>(
+ reinterpret_cast<uintptr_t>(buffers[i]));
+ }
}
- hidl_vec<Buffer> reply;
- reply.setToExternal(
- reinterpret_cast<Buffer*>(buffers.data()),
- buffers.size());
- hidl_cb(static_cast<Error>(err), reply);
-
- return Void();
+ return static_cast<Error>(err);
}
-Return<Error> GrallocHal::free(Buffer buffer)
+Error GrallocHal::free(Buffer buffer)
{
- buffer_handle_t handle = reinterpret_cast<buffer_handle_t>(buffer);
+ buffer_handle_t handle = reinterpret_cast<buffer_handle_t>(
+ static_cast<uintptr_t>(buffer));
+
int32_t err = mDispatch.release(mDevice, handle);
return static_cast<Error>(err);
}
-Return<void> GrallocHal::exportHandle(BufferDescriptor /*descriptor*/,
+Error GrallocHal::exportHandle(Buffer buffer,
+ const native_handle_t*& outHandle)
+{
+ // we rely on the caller to validate buffer here
+ outHandle = reinterpret_cast<buffer_handle_t>(
+ static_cast<uintptr_t>(buffer));
+ return Error::NONE;
+}
+
+GrallocClient::GrallocClient(GrallocHal& hal)
+ : mHal(hal)
+{
+}
+
+GrallocClient::~GrallocClient()
+{
+ if (!mBuffers.empty()) {
+ ALOGW("client destroyed with valid buffers");
+ for (auto buf : mBuffers) {
+ mHal.free(buf);
+ }
+ }
+
+ if (!mDescriptors.empty()) {
+ ALOGW("client destroyed with valid buffer descriptors");
+ for (auto desc : mDescriptors) {
+ mHal.destroyDescriptor(desc);
+ }
+ }
+}
+
+Return<void> GrallocClient::createDescriptor(
+ const BufferDescriptorInfo& descriptorInfo,
+ createDescriptor_cb hidl_cb)
+{
+ BufferDescriptor descriptor;
+ Error err = mHal.createDescriptor(descriptorInfo, descriptor);
+
+ if (err == Error::NONE) {
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ auto result = mDescriptors.insert(descriptor);
+ if (!result.second) {
+ ALOGW("duplicated buffer descriptor id returned");
+ mHal.destroyDescriptor(descriptor);
+ err = Error::NO_RESOURCES;
+ }
+ }
+
+ hidl_cb(err, descriptor);
+ return Void();
+}
+
+Return<Error> GrallocClient::destroyDescriptor(BufferDescriptor descriptor)
+{
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!mDescriptors.erase(descriptor)) {
+ return Error::BAD_DESCRIPTOR;
+ }
+ }
+
+ return mHal.destroyDescriptor(descriptor);
+}
+
+Return<Error> GrallocClient::testAllocate(
+ const hidl_vec<BufferDescriptor>& descriptors)
+{
+ return mHal.testAllocate(descriptors);
+}
+
+Return<void> GrallocClient::allocate(
+ const hidl_vec<BufferDescriptor>& descriptors,
+ allocate_cb hidl_cb) {
+ hidl_vec<Buffer> buffers;
+ Error err = mHal.allocate(descriptors, buffers);
+
+ if (err == Error::NONE || err == Error::NOT_SHARED) {
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ for (size_t i = 0; i < buffers.size(); i++) {
+ auto result = mBuffers.insert(buffers[i]);
+ if (!result.second) {
+ ALOGW("duplicated buffer id returned");
+
+ for (size_t j = 0; j < buffers.size(); j++) {
+ if (j < i) {
+ mBuffers.erase(buffers[i]);
+ }
+ mHal.free(buffers[i]);
+ }
+
+ buffers = hidl_vec<Buffer>();
+ err = Error::NO_RESOURCES;
+ break;
+ }
+ }
+ }
+
+ hidl_cb(err, buffers);
+ return Void();
+}
+
+Return<Error> GrallocClient::free(Buffer buffer)
+{
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (!mBuffers.erase(buffer)) {
+ return Error::BAD_BUFFER;
+ }
+ }
+
+ return mHal.free(buffer);
+}
+
+Return<void> GrallocClient::exportHandle(BufferDescriptor /*descriptor*/,
Buffer buffer, exportHandle_cb hidl_cb)
{
- // do we want to validate?
- buffer_handle_t handle = reinterpret_cast<buffer_handle_t>(buffer);
+ const native_handle_t* handle = nullptr;
- hidl_cb(Error::NONE, handle);
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (mBuffers.count(buffer) == 0) {
+ hidl_cb(Error::BAD_BUFFER, handle);
+ return Void();
+ }
+ }
+ Error err = mHal.exportHandle(buffer, handle);
+
+ hidl_cb(err, handle);
return Void();
}
diff --git a/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp b/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
index 54369a4..bd846c4 100644
--- a/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
+++ b/graphics/allocator/2.0/vts/functional/graphics_allocator_hidl_hal_test.cpp
@@ -43,10 +43,10 @@
class TempDescriptor {
public:
- TempDescriptor(const sp<IAllocator>& allocator,
- const IAllocator::BufferDescriptorInfo& info)
- : mAllocator(allocator), mError(Error::NO_RESOURCES) {
- mAllocator->createDescriptor(
+ TempDescriptor(const sp<IAllocatorClient>& client,
+ const IAllocatorClient::BufferDescriptorInfo& info)
+ : mClient(client), mError(Error::NO_RESOURCES) {
+ mClient->createDescriptor(
info, [&](const auto& tmpError, const auto& tmpDescriptor) {
mError = tmpError;
mDescriptor = tmpDescriptor;
@@ -55,7 +55,7 @@
~TempDescriptor() {
if (mError == Error::NONE) {
- mAllocator->destroyDescriptor(mDescriptor);
+ mClient->destroyDescriptor(mDescriptor);
}
}
@@ -64,7 +64,7 @@
operator BufferDescriptor() const { return mDescriptor; }
private:
- sp<IAllocator> mAllocator;
+ sp<IAllocatorClient> mClient;
Error mError;
BufferDescriptor mDescriptor;
};
@@ -75,10 +75,18 @@
mAllocator = IAllocator::getService("gralloc");
ASSERT_NE(mAllocator, nullptr);
+ mAllocator->createClient([this](const auto& error, const auto& client) {
+ if (error == Error::NONE) {
+ mClient = client;
+ }
+ });
+ ASSERT_NE(mClient, nullptr);
+
initCapabilities();
mDummyDescriptorInfo.width = 64;
mDummyDescriptorInfo.height = 64;
+ mDummyDescriptorInfo.layerCount = 1;
mDummyDescriptorInfo.format = PixelFormat::RGBA_8888;
mDummyDescriptorInfo.producerUsageMask =
static_cast<uint64_t>(ProducerUsage::CPU_WRITE);
@@ -106,7 +114,8 @@
}
sp<IAllocator> mAllocator;
- IAllocator::BufferDescriptorInfo mDummyDescriptorInfo{};
+ sp<IAllocatorClient> mClient;
+ IAllocatorClient::BufferDescriptorInfo mDummyDescriptorInfo{};
private:
std::unordered_set<IAllocator::Capability> mCapabilities;
@@ -134,7 +143,7 @@
TEST_F(GraphicsAllocatorHidlTest, CreateDestroyDescriptor) {
Error error;
BufferDescriptor descriptor;
- auto ret = mAllocator->createDescriptor(
+ auto ret = mClient->createDescriptor(
mDummyDescriptorInfo,
[&](const auto& tmpError, const auto& tmpDescriptor) {
error = tmpError;
@@ -144,7 +153,7 @@
ASSERT_TRUE(ret.getStatus().isOk());
ASSERT_EQ(Error::NONE, error);
- auto err_ret = mAllocator->destroyDescriptor(descriptor);
+ auto err_ret = mClient->destroyDescriptor(descriptor);
ASSERT_TRUE(err_ret.getStatus().isOk());
ASSERT_EQ(Error::NONE, static_cast<Error>(err_ret));
}
@@ -155,14 +164,14 @@
TEST_F(GraphicsAllocatorHidlTest, TestAllocateBasic) {
CHECK_FEATURE_OR_SKIP(IAllocator::Capability::TEST_ALLOCATE);
- TempDescriptor descriptor(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor.isValid());
hidl_vec<BufferDescriptor> descriptors;
descriptors.resize(1);
descriptors[0] = descriptor;
- auto ret = mAllocator->testAllocate(descriptors);
+ auto ret = mClient->testAllocate(descriptors);
ASSERT_TRUE(ret.getStatus().isOk());
auto error = static_cast<Error>(ret);
@@ -175,7 +184,7 @@
TEST_F(GraphicsAllocatorHidlTest, TestAllocateArray) {
CHECK_FEATURE_OR_SKIP(IAllocator::Capability::TEST_ALLOCATE);
- TempDescriptor descriptor(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor.isValid());
hidl_vec<BufferDescriptor> descriptors;
@@ -183,7 +192,7 @@
descriptors[0] = descriptor;
descriptors[1] = descriptor;
- auto ret = mAllocator->testAllocate(descriptors);
+ auto ret = mClient->testAllocate(descriptors);
ASSERT_TRUE(ret.getStatus().isOk());
auto error = static_cast<Error>(ret);
@@ -194,7 +203,7 @@
* Test allocate/free with a single buffer descriptor.
*/
TEST_F(GraphicsAllocatorHidlTest, AllocateFreeBasic) {
- TempDescriptor descriptor(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor.isValid());
hidl_vec<BufferDescriptor> descriptors;
@@ -203,7 +212,7 @@
Error error;
std::vector<Buffer> buffers;
- auto ret = mAllocator->allocate(
+ auto ret = mClient->allocate(
descriptors, [&](const auto& tmpError, const auto& tmpBuffers) {
error = tmpError;
buffers = tmpBuffers;
@@ -214,7 +223,7 @@
EXPECT_EQ(1u, buffers.size());
if (!buffers.empty()) {
- auto err_ret = mAllocator->free(buffers[0]);
+ auto err_ret = mClient->free(buffers[0]);
EXPECT_TRUE(err_ret.getStatus().isOk());
EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
}
@@ -224,10 +233,10 @@
* Test allocate/free with an array of buffer descriptors.
*/
TEST_F(GraphicsAllocatorHidlTest, AllocateFreeArray) {
- TempDescriptor descriptor1(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor1(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor1.isValid());
- TempDescriptor descriptor2(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor2(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor2.isValid());
hidl_vec<BufferDescriptor> descriptors;
@@ -238,7 +247,7 @@
Error error;
std::vector<Buffer> buffers;
- auto ret = mAllocator->allocate(
+ auto ret = mClient->allocate(
descriptors, [&](const auto& tmpError, const auto& tmpBuffers) {
error = tmpError;
buffers = tmpBuffers;
@@ -249,14 +258,14 @@
EXPECT_EQ(descriptors.size(), buffers.size());
for (auto buf : buffers) {
- auto err_ret = mAllocator->free(buf);
+ auto err_ret = mClient->free(buf);
EXPECT_TRUE(err_ret.getStatus().isOk());
EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
}
}
TEST_F(GraphicsAllocatorHidlTest, ExportHandle) {
- TempDescriptor descriptor(mAllocator, mDummyDescriptorInfo);
+ TempDescriptor descriptor(mClient, mDummyDescriptorInfo);
ASSERT_TRUE(descriptor.isValid());
hidl_vec<BufferDescriptor> descriptors;
@@ -265,7 +274,7 @@
Error error;
std::vector<Buffer> buffers;
- auto ret = mAllocator->allocate(
+ auto ret = mClient->allocate(
descriptors, [&](const auto& tmpError, const auto& tmpBuffers) {
error = tmpError;
buffers = tmpBuffers;
@@ -275,13 +284,13 @@
ASSERT_TRUE(error == Error::NONE || error == Error::NOT_SHARED);
ASSERT_EQ(1u, buffers.size());
- ret = mAllocator->exportHandle(
+ ret = mClient->exportHandle(
descriptors[0], buffers[0],
[&](const auto& tmpError, const auto&) { error = tmpError; });
EXPECT_TRUE(ret.getStatus().isOk());
EXPECT_EQ(Error::NONE, error);
- auto err_ret = mAllocator->free(buffers[0]);
+ auto err_ret = mClient->free(buffers[0]);
EXPECT_TRUE(err_ret.getStatus().isOk());
EXPECT_EQ(Error::NONE, static_cast<Error>(err_ret));
}
diff --git a/health/1.0/default/Health.h b/health/1.0/default/Health.h
index c05751f..ed364c1 100644
--- a/health/1.0/default/Health.h
+++ b/health/1.0/default/Health.h
@@ -1,5 +1,20 @@
-#ifndef HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
-#define HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_HEALTH_V1_0_HEALTH_H
+#define ANDROID_HARDWARE_HEALTH_V1_0_HEALTH_H
#include <android/hardware/health/1.0/IHealth.h>
#include <hidl/Status.h>
@@ -39,4 +54,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_health_V1_0_Health_H_
+#endif // ANDROID_HARDWARE_HEALTH_V1_0_HEALTH_H
diff --git a/light/2.0/default/Light.cpp b/light/2.0/default/Light.cpp
index fe94e91..eb1f559 100644
--- a/light/2.0/default/Light.cpp
+++ b/light/2.0/default/Light.cpp
@@ -1,3 +1,18 @@
+/*
+ * 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 "Light.h"
namespace android {
diff --git a/light/2.0/default/Light.h b/light/2.0/default/Light.h
index b32a09a..8987036 100644
--- a/light/2.0/default/Light.h
+++ b/light/2.0/default/Light.h
@@ -1,5 +1,20 @@
-#ifndef HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
-#define HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
+#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
#include <android/hardware/light/2.0/ILight.h>
#include <hardware/hardware.h>
@@ -43,4 +58,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_light_V2_0_Light_H_
+#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
diff --git a/light/2.0/vts/functional/Android.bp b/light/2.0/vts/functional/Android.bp
new file mode 100644
index 0000000..c3475a6
--- /dev/null
+++ b/light/2.0/vts/functional/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "light_hidl_hal_test",
+ gtest: true,
+ srcs: ["light_hidl_hal_test.cpp"],
+ shared_libs: [
+ "liblog",
+ "libutils",
+ "android.hardware.light@2.0",
+ ],
+ static_libs: ["libgtest"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
+
diff --git a/light/2.0/vts/functional/light_hidl_hal_test.cpp b/light/2.0/vts/functional/light_hidl_hal_test.cpp
new file mode 100644
index 0000000..db67467
--- /dev/null
+++ b/light/2.0/vts/functional/light_hidl_hal_test.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "light_hidl_hal_test"
+
+#include <android-base/logging.h>
+#include <android/hardware/light/2.0/ILight.h>
+#include <android/hardware/light/2.0/types.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+using ::android::hardware::light::V2_0::Brightness;
+using ::android::hardware::light::V2_0::Flash;
+using ::android::hardware::light::V2_0::ILight;
+using ::android::hardware::light::V2_0::LightState;
+using ::android::hardware::light::V2_0::Status;
+using ::android::hardware::light::V2_0::Type;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define LIGHT_SERVICE_NAME "light"
+
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.getStatus().isOk())
+
+// The main test class for VIBRATOR HIDL HAL.
+class LightHidlTest : public ::testing::Test {
+public:
+ virtual void SetUp() override {
+ light = ILight::getService(LIGHT_SERVICE_NAME);
+
+ ASSERT_NE(light, nullptr);
+ ALOGI("Test is remote: %d", light->isRemote());
+ }
+
+ virtual void TearDown() override {}
+
+ sp<ILight> light;
+};
+
+// A class for test environment setup (kept since this file is a template).
+class LightHidlEnvironment : public ::testing::Environment {
+public:
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+
+private:
+};
+
+const static LightState kWhite = {
+ .color = 0xFFFFFFFF,
+ .flashMode = Flash::TIMED,
+ .flashOnMs = 100,
+ .flashOffMs = 50,
+ .brightnessMode = Brightness::USER,
+};
+
+const static LightState kOff = {
+ .color = 0x00000000,
+ .flashMode = Flash::NONE,
+ .flashOnMs = 0,
+ .flashOffMs = 0,
+ .brightnessMode = Brightness::USER,
+};
+
+/**
+ * Ensure all lights which are reported as supported work.
+ */
+TEST_F(LightHidlTest, TestSupported) {
+ EXPECT_OK(light->getSupportedTypes([this](const hidl_vec<Type> &supportedTypes) {
+ for (size_t i = 0; i < supportedTypes.size(); i++) {
+ EXPECT_OK(light->setLight(supportedTypes[i], kWhite));
+ }
+
+ usleep(500000);
+
+ for (size_t i = 0; i < supportedTypes.size(); i++) {
+ EXPECT_OK(light->setLight(supportedTypes[i], kOff));
+ }
+ }));
+}
+
+int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(new LightHidlEnvironment);
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/light/Android.bp b/light/Android.bp
index c12cd4f..8d2c986 100644
--- a/light/Android.bp
+++ b/light/Android.bp
@@ -1,4 +1,5 @@
// This is an autogenerated file, do not edit.
subdirs = [
"2.0",
+ "2.0/vts/functional",
]
diff --git a/media/omx/1.0/IGraphicBufferSource.hal b/media/omx/1.0/IGraphicBufferSource.hal
index bee57ac..a5b5813 100644
--- a/media/omx/1.0/IGraphicBufferSource.hal
+++ b/media/omx/1.0/IGraphicBufferSource.hal
@@ -47,7 +47,7 @@
setStartTimeUs(int64_t startTimeUs)
generates (Status status);
- setColorAspects(uint32_t aspects) // TODO: Maybe break down aspects.
+ setColorAspects(ColorAspects aspects)
generates (Status status);
setTimeOffsetUs(int64_t timeOffsetUs)
diff --git a/media/omx/1.0/types.hal b/media/omx/1.0/types.hal
index c0350de..5918b59 100644
--- a/media/omx/1.0/types.hal
+++ b/media/omx/1.0/types.hal
@@ -112,7 +112,7 @@
/**
* There are four main types of buffers.
*/
- enum Type {
+ enum Type : int32_t {
INVALID = 0,
PRESET,
SHARED_MEM,
@@ -164,7 +164,7 @@
*
* Enumeration of port modes.
*/
-enum PortMode {
+enum PortMode : int32_t {
PRESET_START = 0,
PRESET_BYTE_BUFFER,
PRESET_ANW_BUFFER,
@@ -176,3 +176,71 @@
DYNAMIC_END
};
+/**
+ * Ref: frameworks/native/include/media/hardware/VideoAPI.h
+ *
+ * Framework defined color aspects. These are based mainly on ISO 23001-8 spec. As this standard
+ * continues to evolve, new values may be defined in the future. Use OTHER for these future values
+ * as well as for values not listed here, as those are not supported by the framework.
+ */
+struct ColorAspects {
+ enum Range : uint32_t {
+ UNSPECIFIED, // Unspecified
+ FULL, // Full range
+ LIMITED, // Limited range (if defined), or not full range
+
+ OTHER = 0xff, // Not one of the above values
+ };
+
+ // Color primaries
+ enum Primaries : uint32_t {
+ UNSPECIFIED, // Unspecified
+ BT709_5, // Rec.ITU-R BT.709-5 or equivalent
+ BT470_6M, // Rec.ITU-R BT.470-6 System M or equivalent
+ BT601_6_625, // Rec.ITU-R BT.601-6 625 or equivalent
+ BT601_6_525, // Rec.ITU-R BT.601-6 525 or equivalent
+ GENERIC_FILM, // Generic Film
+ BT2020, // Rec.ITU-R BT.2020 or equivalent
+
+ OTHER = 0xff, // Not one of the above values
+ };
+
+ // Transfer characteristics
+ enum Transfer : uint32_t {
+ UNSPECIFIED, // Unspecified
+ LINEAR, // Linear transfer characteristics
+ SRGB, // sRGB or equivalent
+ SMPTE170M, // SMPTE 170M or equivalent (e.g. BT.601/709/2020)
+ GAMMA22, // Assumed display gamma 2.2
+ GAMMA28, // Assumed display gamma 2.8
+ ST2084, // SMPTE ST 2084 for 10/12/14/16 bit systems
+ HLG, // ARIB STD-B67 hybrid-log-gamma
+
+ // values unlikely to be required by Android follow here
+ SMPTE240M = 0x40, // SMPTE 240M
+ XVYCC, // IEC 61966-2-4
+ BT1361, // Rec.ITU-R BT.1361 extended gamut
+ ST428, // SMPTE ST 428-1
+
+ OTHER = 0xff, // Not one of the above values
+ };
+
+ // YUV <-> RGB conversion
+ enum MatrixCoeffs : uint32_t {
+ UNSPECIFIED, // Unspecified
+ BT709_5, // Rec.ITU-R BT.709-5 or equivalent
+ BT470_6M, // KR=0.30, KB=0.11 or equivalent
+ BT601_6, // Rec.ITU-R BT.601-6 625 or equivalent
+ SMPTE240M, // SMPTE 240M or equivalent
+ BT2020, // Rec.ITU-R BT.2020 non-constant luminance
+ BT2020CONSTANT, // Rec.ITU-R BT.2020 constant luminance
+
+ OTHER = 0xff, // Not one of the above values
+ };
+
+ Range range;
+ Primaries primaries;
+ Transfer transfer;
+ MatrixCoeffs matrixCoeffs;
+};
+
diff --git a/memtrack/1.0/default/Memtrack.h b/memtrack/1.0/default/Memtrack.h
index 86dae72..a3c55e4 100644
--- a/memtrack/1.0/default/Memtrack.h
+++ b/memtrack/1.0/default/Memtrack.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
-#define HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+#ifndef ANDROID_HARDWARE_MEMTRACK_V1_0_MEMTRACK_H
+#define ANDROID_HARDWARE_MEMTRACK_V1_0_MEMTRACK_H
#include <android/hardware/memtrack/1.0/IMemtrack.h>
#include <hidl/Status.h>
@@ -54,4 +54,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_memtrack_V1_0_Memtrack_H_
+#endif // ANDROID_HARDWARE_MEMTRACK_V1_0_MEMTRACK_H
diff --git a/nfc/1.0/INfc.hal b/nfc/1.0/INfc.hal
index 1c952db..c6e1511 100644
--- a/nfc/1.0/INfc.hal
+++ b/nfc/1.0/INfc.hal
@@ -27,72 +27,80 @@
* NCI initialization - ie accept CORE_RESET and subsequent commands through
* the write() call.
*
- * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT
- * before continuing.
+ * If open() returns NfcStatus::OK, the NCI stack will wait for a
+ * NfcEvent.OPEN_CPLT before continuing.
*
- * If open() returns any other value, the NCI stack will stop.
+ * If open() returns NfcStatus::FAILED, the NCI stack will stop.
*
*/
@entry
@callflow(next={"write", "coreInitialized", "prediscover", "powerCycle", "controlGranted"})
- open(INfcClientCallback clientCallback) generates (int32_t retval);
+ open(INfcClientCallback clientCallback) generates (NfcStatus status);
/*
* Performs an NCI write.
*
* This method may queue writes and return immediately. The only
* requirement is that the writes are executed in order.
+ *
+ * @return number of bytes written to the NFCC
*/
@callflow(next={"write", "prediscover", "coreInitialized", "close", "powerCycle",
"controlGranted"})
- write(NfcData data) generates (int32_t retval);
+ 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.
+ * coreInitialized() is called after the CORE_INIT_RSP is received from the
+ * NFCC. At this time, the HAL can do any chip-specific configuration.
*
- * If coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT
- * before continuing.
+ * If coreInitialized() returns NfcStatus::OK, the NCI stack will wait for a
+ * NfcEvent.POST_INIT_CPLT before continuing.
*
- * If coreInitialized() returns any other value, the NCI stack will continue
- * immediately.
+ * If coreInitialized() returns NfcStatus::FAILED, the NCI stack will
+ * continue immediately.
*/
@callflow(next={"write", "prediscover", "close"})
- coreInitialized(NfcData data) generates (int32_t retval);
+ 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.
*
- * If prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT
- * before continuing.
+ * If prediscover() returns NfcStatus::OK, the NCI stack will wait for a
+ * NfcEvent.PREDISCOVER_CPLT before continuing.
*
- * If prediscover() returns any other value, the NCI stack will start
+ * If prediscover() returns NfcStatus::FAILED, the NCI stack will start
* RF discovery immediately.
*/
@callflow(next={"write", "close", "coreInitialized", "powerCycle", "controlGranted"})
- prediscover() generates (int32_t retval);
+ prediscover() generates (NfcStatus status);
/*
* Close the NFC controller. Should free all resources.
+ *
+ * @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@exit
- close() generates (int32_t retval);
+ 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.
* NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
+ *
+ * @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@callflow(next={"write", "close", "prediscover", "coreInitialized", "powerCycle"})
- controlGranted() generates (int32_t retval);
+ controlGranted() generates (NfcStatus status);
/*
* Restart controller by power cyle;
* NfcEvent.OPEN_CPLT will notify when operation is complete.
+ *
+ * @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@callflow(next={"write", "coreInitialized", "prediscover", "controlGranted", "close"})
- powerCycle() generates (int32_t retval);
+ powerCycle() generates (NfcStatus status);
};
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index d3868c1..bee374d 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -17,34 +17,36 @@
}
// Methods from ::android::hardware::nfc::V1_0::INfc follow.
-::android::hardware::Return<int32_t> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
+::android::hardware::Return<NfcStatus> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
mCallback = clientCallback;
- return mDevice->open(mDevice, eventCallback, dataCallback);
+ int ret = mDevice->open(mDevice, eventCallback, dataCallback);
+ return ret == 0 ? NfcStatus::OK : NfcStatus::FAILED;
}
-::android::hardware::Return<int32_t> Nfc::write(const hidl_vec<uint8_t>& data) {
+::android::hardware::Return<uint32_t> Nfc::write(const hidl_vec<uint8_t>& data) {
return mDevice->write(mDevice, data.size(), &data[0]);
}
-::android::hardware::Return<int32_t> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
+::android::hardware::Return<NfcStatus> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
hidl_vec<uint8_t> copy = data;
- return mDevice->core_initialized(mDevice, ©[0]);
+ int ret = mDevice->core_initialized(mDevice, ©[0]);
+ return ret == 0 ? NfcStatus::OK : NfcStatus::FAILED;
}
-::android::hardware::Return<int32_t> Nfc::prediscover() {
- return mDevice->pre_discover(mDevice);
+::android::hardware::Return<NfcStatus> Nfc::prediscover() {
+ return mDevice->pre_discover(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
-::android::hardware::Return<int32_t> Nfc::close() {
- return mDevice->close(mDevice);
+::android::hardware::Return<NfcStatus> Nfc::close() {
+ return mDevice->close(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
-::android::hardware::Return<int32_t> Nfc::controlGranted() {
- return mDevice->control_granted(mDevice);
+::android::hardware::Return<NfcStatus> Nfc::controlGranted() {
+ return mDevice->control_granted(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
-::android::hardware::Return<int32_t> Nfc::powerCycle() {
- return mDevice->power_cycle(mDevice);
+::android::hardware::Return<NfcStatus> Nfc::powerCycle() {
+ return mDevice->power_cycle(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
diff --git a/nfc/1.0/default/Nfc.h b/nfc/1.0/default/Nfc.h
index e596495..13004a5 100644
--- a/nfc/1.0/default/Nfc.h
+++ b/nfc/1.0/default/Nfc.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
-#define HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
+#ifndef ANDROID_HARDWARE_NFC_V1_0_NFC_H
+#define ANDROID_HARDWARE_NFC_V1_0_NFC_H
#include <android/hardware/nfc/1.0/INfc.h>
#include <hidl/Status.h>
@@ -21,13 +21,13 @@
struct Nfc : public INfc {
Nfc(nfc_nci_device_t* device);
- ::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override;
- ::android::hardware::Return<int32_t> write(const hidl_vec<uint8_t>& data) override;
- ::android::hardware::Return<int32_t> coreInitialized(const hidl_vec<uint8_t>& data) override;
- ::android::hardware::Return<int32_t> prediscover() override;
- ::android::hardware::Return<int32_t> close() override;
- ::android::hardware::Return<int32_t> controlGranted() override;
- ::android::hardware::Return<int32_t> powerCycle() override;
+ ::android::hardware::Return<NfcStatus> open(const sp<INfcClientCallback>& clientCallback) override;
+ ::android::hardware::Return<uint32_t> write(const hidl_vec<uint8_t>& data) override;
+ ::android::hardware::Return<NfcStatus> coreInitialized(const hidl_vec<uint8_t>& data) override;
+ ::android::hardware::Return<NfcStatus> prediscover() override;
+ ::android::hardware::Return<NfcStatus> close() override;
+ ::android::hardware::Return<NfcStatus> controlGranted() override;
+ ::android::hardware::Return<NfcStatus> powerCycle() override;
static void eventCallback(uint8_t event, uint8_t status) {
if (mCallback != nullptr) {
@@ -56,4 +56,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_
+#endif // ANDROID_HARDWARE_NFC_V1_0_NFC_H
diff --git a/nfc/1.0/types.hal b/nfc/1.0/types.hal
index a266178..3384311 100644
--- a/nfc/1.0/types.hal
+++ b/nfc/1.0/types.hal
@@ -16,6 +16,7 @@
package android.hardware.nfc@1.0;
+@export(name="", value_prefix="HAL_NFC_", value_suffix="_EVT")
enum NfcEvent : uint32_t {
OPEN_CPLT = 0,
CLOSE_CPLT = 1,
@@ -26,6 +27,7 @@
ERROR = 6
};
+@export(name="", value_prefix="HAL_NFC_STATUS_")
enum NfcStatus : uint32_t {
OK = 0,
FAILED = 1,
diff --git a/nfc/1.0/vts/Nfc.vts b/nfc/1.0/vts/Nfc.vts
index c2313d5..5882bf5 100644
--- a/nfc/1.0/vts/Nfc.vts
+++ b/nfc/1.0/vts/Nfc.vts
@@ -11,8 +11,8 @@
api: {
name: "open"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
arg: {
type: TYPE_HIDL_CALLBACK
@@ -35,7 +35,7 @@
name: "write"
return_type_hidl: {
type: TYPE_SCALAR
- scalar_type: "int32_t"
+ scalar_type: "uint32_t"
}
arg: {
type: TYPE_VECTOR
@@ -57,8 +57,8 @@
api: {
name: "coreInitialized"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
arg: {
type: TYPE_VECTOR
@@ -77,8 +77,8 @@
api: {
name: "prediscover"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
callflow: {
next: "write"
@@ -92,8 +92,8 @@
api: {
name: "close"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
callflow: {
exit: true
@@ -103,8 +103,8 @@
api: {
name: "controlGranted"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
callflow: {
next: "write"
@@ -118,8 +118,8 @@
api: {
name: "powerCycle"
return_type_hidl: {
- type: TYPE_SCALAR
- scalar_type: "int32_t"
+ type: TYPE_ENUM
+ predefined_type: "::android::hardware::nfc::V1_0::NfcStatus"
}
callflow: {
next: "write"
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
index e215704..4d7c557 100644
--- a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
+++ b/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
@@ -17,63 +17,145 @@
#define LOG_TAG "nfc_hidl_hal_test"
#include <android-base/logging.h>
-#include <hardware/nfc.h>
-#include <android/hardware/nfc/1.0/types.h>
#include <android/hardware/nfc/1.0/INfc.h>
#include <android/hardware/nfc/1.0/INfcClientCallback.h>
+#include <android/hardware/nfc/1.0/types.h>
+#include <hardware/nfc.h>
+#include <hwbinder/ProcessState.h>
#include <gtest/gtest.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+using ::android::hardware::ProcessState;
using ::android::hardware::nfc::V1_0::INfc;
using ::android::hardware::nfc::V1_0::INfcClientCallback;
+using ::android::hardware::nfc::V1_0::NfcEvent;
+using ::android::hardware::nfc::V1_0::NfcStatus;
+using ::android::hardware::nfc::V1_0::NfcData;
using ::android::hardware::Return;
using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
using ::android::sp;
#define NFC_NCI_SERVICE_NAME "nfc_nci"
+/* NCI Commands */
+#define CORE_RESET_CMD \
+ { 0x20, 0x00, 0x01, 0x00 }
+#define CORE_CONN_CREATE_CMD \
+ { 0x20, 0x04, 0x02, 0x01, 0x00 }
+#define INVALID_COMMAND \
+ { 0x20, 0x00, 0x00 }
+#define FAULTY_DATA_PACKET \
+ { 0x00, 0x00, 0xFF }
-// Simple NfcClientCallback used as part of testing.
-class NfcClientCallback : public INfcClientCallback {
- public:
- NfcClientCallback() {};
+#define LOOP_BACK_HEADER_SIZE 3
+#define SYNTAX_ERROR 5
+#define NUMBER_LOOPS 3922
+#define VERSION 0x11
+#define TIMEOUT_PERIOD 5
- virtual ~NfcClientCallback() = default;
-
- // sendEvent callback function - currently no-op.
- Return<void> sendEvent(
- ::android::hardware::nfc::V1_0::NfcEvent event,
- ::android::hardware::nfc::V1_0::NfcStatus event_status) override {
- return Void();
- };
-
- // sendData callback function - currently no-op.
- Return<void> sendData(const ::android::hardware::nfc::V1_0::NfcData &data ) override {
- ::android::hardware::nfc::V1_0::NfcData copy = data;
- return Void();
- };
-};
-
+static bool passthrough = true;
// The main test class for NFC HIDL HAL.
class NfcHidlTest : public ::testing::Test {
public:
virtual void SetUp() override {
- // currently test passthrough mode only
- nfc = INfc::getService(NFC_NCI_SERVICE_NAME, true);
- ASSERT_NE(nfc, nullptr);
+ nfc_ = INfc::getService(NFC_NCI_SERVICE_NAME, passthrough);
+ ASSERT_NE(nfc_, nullptr);
- nfc_cb = new NfcClientCallback();
- ASSERT_NE(nfc_cb, nullptr);
+ // TODO:b/31748996
+ if (nfc_->isRemote()) {
+ ProcessState::self()->setThreadPoolMaxThreadCount(1);
+ ProcessState::self()->startThreadPool();
+ }
+
+ nfc_cb_ = new NfcClientCallback(*this);
+ 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_);
}
- virtual void TearDown() override {}
+ 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_);
+ }
- sp<INfc> nfc;
- sp<INfcClientCallback> nfc_cb;
+ /* 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;
};
-
// A class for test environment setup (kept since this file is a template).
class NfcHidlEnvironment : public ::testing::Environment {
public:
@@ -83,15 +165,201 @@
private:
};
-TEST_F(NfcHidlTest, OpenAndClose) {
- EXPECT_EQ(0, (int)nfc->open(nfc_cb));
- EXPECT_EQ(0, (int)nfc->close());
+/*
+ * OpenAndClose:
+ * Makes an open call, waits for NfcEvent.OPEN_CPLT
+ * Immediately calls close() and waits for NfcEvent.CLOSE_CPLT
+ * Since open and close calls are a part of SetUp() and TearDown(),
+ * the function definition is intentionally kept empty
+ */
+TEST_F(NfcHidlTest, OpenAndClose) {}
+
+/*
+ * WriteCoreReset:
+ * Sends CORE_RESET_CMD
+ * Waits for CORE_RESET_RSP
+ * Checks the status and the version number
+ */
+TEST_F(NfcHidlTest, WriteCoreReset) {
+ std::vector<uint8_t> cmd = CORE_RESET_CMD;
+ 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]);
}
-int main(int argc, char **argv) {
+/*
+ * WriteInvalidCommand:
+ * Sends an invalid command
+ * Waits for response
+ * Checks SYNTAX_ERROR status
+ */
+TEST_F(NfcHidlTest, WriteInvalidCommand) {
+ // Send an Error Command
+ std::vector<uint8_t> cmd = INVALID_COMMAND;
+ 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]);
+}
+
+/*
+ * WriteInvalidAndThenValidCommand:
+ * Sends an Faulty Data Packet
+ * Waits for CORE_INTERFACE_ERROR_NTF
+ * Checks SYNTAX_ERROR status
+ * Repeat for 100 times appending 0xFF each time to the packet
+ * Send CORE_CONN_CREATE_CMD for loop-back mode
+ * Check the response
+ */
+TEST_F(NfcHidlTest, WriteInvalidAndThenValidCommand) {
+ // Send an Error Data Packet
+ std::vector<uint8_t> cmd = FAULTY_DATA_PACKET;
+ NfcData data = cmd;
+ 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]);
+ }
+
+ 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]);
+}
+/*
+ * Bandwidth:
+ * Sets the loop-back mode using CORE_CONN_CREATE_CMD
+ * Sends max payload size data
+ * Waits for the response
+ * Checks the data received
+ * Repeat to send total of 1Mb data
+ */
+TEST_F(NfcHidlTest, Bandwidth) {
+ std::vector<uint8_t> cmd = CORE_CONN_CREATE_CMD;
+ 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];
+
+ 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;
+ }
+ 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());
+ EXPECT_EQ(data.size(), last_data_[0].size());
+ for (size_t i = 0; i < data.size(); i++) {
+ EXPECT_EQ(data[i], last_data_[0][i]);
+ }
+
+ EXPECT_EQ(6ul, last_data_[1].size());
+ // Check if the credit is refilled to 1
+ EXPECT_EQ(1, last_data_[1][5]);
+ }
+}
+
+/*
+ * PowerCycle:
+ * Calls powerCycle()
+ * Waits for NfcEvent.OPEN_CPLT
+ * Checks status
+ */
+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_);
+}
+
+/*
+ * CoreInitialized:
+ * Calls coreInitialized()
+ * Waits for NfcEvent.POST_INIT_CPLT
+ */
+TEST_F(NfcHidlTest, CoreInitialized) {
+ NfcData data;
+ data.resize(1);
+ data[0] = 0;
+ 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_);
+}
+
+/*
+ * ControlGranted:
+ * Calls controlGranted()
+ * Checks the return value
+ */
+TEST_F(NfcHidlTest, ControlGranted) {
+ EXPECT_EQ(NfcStatus::OK, nfc_->controlGranted());
+}
+
+/* PreDiscover:
+ * Calls prediscover()
+ * Checks the return value
+ */
+TEST_F(NfcHidlTest, PreDiscover) {
+ EXPECT_EQ(NfcStatus::OK, nfc_->prediscover());
+}
+
+int main(int argc, char** argv) {
::testing::AddGlobalTestEnvironment(new NfcHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
+
+ for (int i = 0; i < argc; i++) {
+ if (strstr(argv[i], "passthrough=false") != nullptr) {
+ passthrough = false;
+ break;
+ }
+ }
+ std::system("svc nfc disable"); /* Turn off NFC */
+ sleep(5);
+
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
+
+ std::system("svc nfc enable"); /* Turn on NFC */
+ sleep(5);
+
return status;
}
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
index 0c34f99..ede7897 100644
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
+++ b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/host/NfcHidlBasicTest.py
@@ -37,8 +37,8 @@
self.dut.shell.InvokeTerminal("one")
self.dut.shell.one.Execute("setenforce 0") # SELinux permissive mode
- self.dut.shell.one.Execute("service call nfc 6") # Turn off
- time.sleep(2)
+ self.dut.shell.one.Execute("svc nfc disable") # Turn off
+ time.sleep(5)
if getattr(self, PASSTHROUGH_MODE_KEY, True):
self.dut.shell.one.Execute(
@@ -56,7 +56,9 @@
def tearDownClass(self):
"""Turns off the framework-layer NFC service."""
- self.dut.shell.one.Execute("service call nfc 6") # make sure it's off
+ # Ideally, we would want to store the nfc service's state before
+ # turning that off in setUpClass and restore the original state.
+ self.dut.shell.one.Execute("svc nfc disable") # make sure it's off
def testBase(self):
"""A simple test case which just calls each registered function."""
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
index e442c7c..11aa88f 100644
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
+++ b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/AndroidTest.xml
@@ -18,14 +18,14 @@
<option name="push-group" value="HidlHalTest.push" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="NfcHidlTargetProfilingTest" />
- <option name="binary-test-sources" value="
- _32bit::DATA/nativetest/nfc_hidl_hal_test/nfc_hidl_hal_test,
- _64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
- "/>
- <option name="test-config-path" value="vts/testcases/hal/nfc/hidl/target_profiling/NfcHidlTargetProfilingTest.config" />
- <option name="binary-test-type" value="gtest" />
- <option name="test-timeout" value="1m" />
- </test>
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="NfcHidlTargetProfilingTest" />
+ <option name="binary-test-sources" value="
+ _32bit::DATA/nativetest/nfc_hidl_hal_test/nfc_hidl_hal_test,
+ _64bit::DATA/nativetest64/nfc_hidl_hal_test/nfc_hidl_hal_test,
+ "/>
+ <option name="binary-test-type" value="gtest" />
+ <option name="test-timeout" value="1m" />
+ <option name="enable-profiling" value="true" />
+ </test>
</configuration>
diff --git a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/NfcHidlTargetProfilingTest.config b/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/NfcHidlTargetProfilingTest.config
deleted file mode 100644
index 912d8d5..0000000
--- a/nfc/1.0/vts/functional/vts/testcases/hal/nfc/hidl/target_profiling/NfcHidlTargetProfilingTest.config
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "enable_profiling": true
-}
\ No newline at end of file
diff --git a/power/1.0/default/Power.h b/power/1.0/default/Power.h
index a0495be..a43aefb 100644
--- a/power/1.0/default/Power.h
+++ b/power/1.0/default/Power.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
-#define HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
+#ifndef ANDROID_HARDWARE_POWER_V1_0_POWER_H
+#define ANDROID_HARDWARE_POWER_V1_0_POWER_H
#include <android/hardware/power/1.0/IPower.h>
#include <hidl/Status.h>
@@ -58,4 +58,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_power_V1_0_Power_H_
+#endif // ANDROID_HARDWARE_POWER_V1_0_POWER_H
diff --git a/power/1.0/vts/functional/Android.bp b/power/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..81dc316
--- /dev/null
+++ b/power/1.0/vts/functional/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+ name: "power_hidl_hal_test",
+ gtest: true,
+ srcs: ["power_hidl_hal_test.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.power@1.0",
+ ],
+ static_libs: ["libgtest"],
+ cflags: [
+ "--coverage",
+ "-O0",
+ "-g",
+ ],
+ ldflags: [
+ "--coverage"
+ ]
+}
diff --git a/power/1.0/vts/functional/power_hidl_hal_test.cpp b/power/1.0/vts/functional/power_hidl_hal_test.cpp
new file mode 100644
index 0000000..ac56f1a
--- /dev/null
+++ b/power/1.0/vts/functional/power_hidl_hal_test.cpp
@@ -0,0 +1,108 @@
+/*
+ * 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 "power_hidl_hal_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/power/1.0/IPower.h>
+
+#include <gtest/gtest.h>
+
+using ::android::hardware::power::V1_0::IPower;
+using ::android::hardware::power::V1_0::Feature;
+using ::android::hardware::power::V1_0::PowerHint;
+using ::android::hardware::power::V1_0::PowerStatePlatformSleepState;
+using ::android::hardware::power::V1_0::Status;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::sp;
+
+class PowerHidlTest : public ::testing::Test {
+ public:
+ virtual void SetUp() override {
+ power = IPower::getService("power");
+ ASSERT_NE(power, nullptr);
+ }
+
+ virtual void TearDown() override {}
+
+ sp<IPower> power;
+};
+
+// Sanity check Power::setInteractive.
+TEST_F(PowerHidlTest, SetInteractive) {
+ Return<void> ret;
+
+ ret = power->setInteractive(true);
+ ASSERT_TRUE(ret.getStatus().isOk());
+
+ ret = power->setInteractive(false);
+ ASSERT_TRUE(ret.getStatus().isOk());
+}
+
+// Sanity check Power::powerHint on good and bad inputs.
+TEST_F(PowerHidlTest, PowerHint) {
+ PowerHint badHint = static_cast<PowerHint>(0xA);
+ auto hints = {PowerHint::VSYNC, PowerHint::INTERACTION,
+ PowerHint::VIDEO_ENCODE, PowerHint::VIDEO_DECODE,
+ PowerHint::LOW_POWER, PowerHint::SUSTAINED_PERFORMANCE,
+ PowerHint::VR_MODE, PowerHint::LAUNCH,
+ PowerHint::DISABLE_TOUCH, badHint};
+ Return<void> ret;
+ for (auto hint : hints) {
+ ret = power->powerHint(hint, 1);
+ ASSERT_TRUE(ret.getStatus().isOk());
+
+ ret = power->powerHint(hint, 0);
+ ASSERT_TRUE(ret.getStatus().isOk());
+ }
+}
+
+// Sanity check Power::setFeature() on good and bad inputs.
+TEST_F(PowerHidlTest, SetFeature) {
+ Return<void> ret;
+ ret = power->setFeature(Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE, true);
+ ASSERT_TRUE(ret.getStatus().isOk());
+ ret = power->setFeature(Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE, false);
+ ASSERT_TRUE(ret.getStatus().isOk());
+
+ Feature badFeature = static_cast<Feature>(0x2);
+ ret = power->setFeature(badFeature, true);
+ ASSERT_TRUE(ret.getStatus().isOk());
+ ret = power->setFeature(badFeature, false);
+ ASSERT_TRUE(ret.getStatus().isOk());
+}
+
+// Sanity check Power::getPlatformLowPowerStats().
+TEST_F(PowerHidlTest, GetPlatformLowPowerStats) {
+ hidl_vec<PowerStatePlatformSleepState> vec;
+ Status s;
+ auto cb = [&vec, &s](hidl_vec<PowerStatePlatformSleepState> states,
+ Status status) {
+ vec = states;
+ s = status;
+ };
+ Return<void> ret = power->getPlatformLowPowerStats(cb);
+ ASSERT_TRUE(ret.getStatus().isOk());
+ ASSERT_TRUE(s == Status::SUCCESS || s == Status::FILESYSTEM_ERROR);
+}
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/Android.mk b/power/1.0/vts/functional/vts/testcases/hal/power/Android.mk
similarity index 100%
rename from Android.mk
rename to power/1.0/vts/functional/vts/testcases/hal/power/Android.mk
diff --git a/power/1.0/vts/functional/vts/testcases/hal/power/__init__.py b/power/1.0/vts/functional/vts/testcases/hal/power/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/power/1.0/vts/functional/vts/testcases/hal/power/__init__.py
diff --git a/Android.mk b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/Android.mk
similarity index 100%
copy from Android.mk
copy to power/1.0/vts/functional/vts/testcases/hal/power/hidl/Android.mk
diff --git a/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/Android.mk b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/Android.mk
new file mode 100644
index 0000000..c66b6fb
--- /dev/null
+++ b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/Android.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := HalPowerHidlTargetTest
+VTS_CONFIG_SRC_DIR := testcases/hal/power/hidl/target
+include test/vts/tools/build/Android.host_config.mk
+
diff --git a/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/AndroidTest.xml b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/AndroidTest.xml
new file mode 100644
index 0000000..bb80de2
--- /dev/null
+++ b/power/1.0/vts/functional/vts/testcases/hal/power/hidl/target/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Config for VTS Power HIDL HAL's target-side test cases">
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+ <option name="push-group" value="HidlHalTest.push" />
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="HalPowerHidlTargetTest"/>
+ <option name="binary-test-sources" value="
+ _32bit::DATA/nativetest/power_hidl_hal_test/power_hidl_hal_test,
+ _64bit::DATA/nativetest64/power_hidl_hal_test/power_hidl_hal_test,
+ "/>
+ <option name="binary-test-type" value="gtest" />
+ <option name="test-timeout" value="1m" />
+ </test>
+</configuration>
diff --git a/power/Android.bp b/power/Android.bp
index ba90f2c..ed19a37 100644
--- a/power/Android.bp
+++ b/power/Android.bp
@@ -2,4 +2,5 @@
subdirs = [
"1.0",
"1.0/default",
+ "1.0/vts/functional",
]
diff --git a/tests/bar/1.0/default/Bar.cpp b/tests/bar/1.0/default/Bar.cpp
index c07e2fa..b3f971a 100644
--- a/tests/bar/1.0/default/Bar.cpp
+++ b/tests/bar/1.0/default/Bar.cpp
@@ -2,7 +2,7 @@
#define LOG_TAG "hidl_test"
#include "Bar.h"
-#include <android-base/logging.h>
+#include <android/log.h>
#include <inttypes.h>
namespace android {
diff --git a/tests/bar/1.0/default/Bar.h b/tests/bar/1.0/default/Bar.h
index 29eedec..d23c1e1 100644
--- a/tests/bar/1.0/default/Bar.h
+++ b/tests/bar/1.0/default/Bar.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
-#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+#ifndef ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
+#define ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
#include <android/hardware/tests/bar/1.0/IBar.h>
#include <hidl/Status.h>
@@ -79,4 +79,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_bar_V1_0_Bar_H_
+#endif // ANDROID_HARDWARE_TESTS_BAR_V1_0_BAR_H
diff --git a/tests/bar/1.0/default/ImportTypes.h b/tests/bar/1.0/default/ImportTypes.h
index b43be70..59c7bea 100644
--- a/tests/bar/1.0/default/ImportTypes.h
+++ b/tests/bar/1.0/default/ImportTypes.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
-#define HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+#ifndef ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
+#define ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
#include <android/hardware/tests/bar/1.0/IImportTypes.h>
#include <hidl/Status.h>
@@ -33,4 +33,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_bar_V1_0_ImportTypes_H_
+#endif // ANDROID_HARDWARE_TESTS_BAR_V1_0_IMPORTTYPES_H
diff --git a/tests/baz/1.0/IBase.hal b/tests/baz/1.0/IBase.hal
index add4153..7f90f16 100644
--- a/tests/baz/1.0/IBase.hal
+++ b/tests/baz/1.0/IBase.hal
@@ -17,7 +17,7 @@
package android.hardware.tests.baz@1.0;
interface IBase {
- enum SomeBaseEnum {
+ enum SomeBaseEnum : int32_t {
grrr = 1,
};
diff --git a/tests/expression/1.0/IExpression.hal b/tests/expression/1.0/IExpression.hal
index a44e03c..6eb5b2a 100644
--- a/tests/expression/1.0/IExpression.hal
+++ b/tests/expression/1.0/IExpression.hal
@@ -178,7 +178,7 @@
MAX_PLUS_2 // 1
};
- enum Constants {
+ enum Constants : int32_t {
CONST_FOO,
CONST_BAR = 70,
MAX_ARRAY_SIZE = 20,
diff --git a/tests/foo/1.0/default/Foo.cpp b/tests/foo/1.0/default/Foo.cpp
index a1df3b2..5a51532 100644
--- a/tests/foo/1.0/default/Foo.cpp
+++ b/tests/foo/1.0/default/Foo.cpp
@@ -17,7 +17,7 @@
// Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
Return<void> Foo::doThis(float param) {
- ALOGI("SERVER(Foo) doThis(%.2f)", param);
+ LOG(INFO) << "SERVER(Foo) doThis(" << param << ")";
return Void();
}
@@ -49,7 +49,7 @@
Return<void> Foo::doSomethingElse(
const hidl_array<int32_t, 15> ¶m, doSomethingElse_cb _cb) {
- ALOGI("SERVER(Foo) doSomethingElse(...)");
+ LOG(INFO) << "SERVER(Foo) doSomethingElse(...)";
hidl_array<int32_t, 32> result;
for (size_t i = 0; i < 15; ++i) {
@@ -66,7 +66,7 @@
Return<void> Foo::doStuffAndReturnAString(
doStuffAndReturnAString_cb _cb) {
- ALOGI("SERVER(Foo) doStuffAndReturnAString");
+ LOG(INFO) << "SERVER(Foo) doStuffAndReturnAString";
_cb("Hello, world");
@@ -75,7 +75,7 @@
Return<void> Foo::mapThisVector(
const hidl_vec<int32_t> ¶m, mapThisVector_cb _cb) {
- ALOGI("SERVER(Foo) mapThisVector");
+ LOG(INFO) << "SERVER(Foo) mapThisVector";
hidl_vec<int32_t> out;
out.resize(param.size());
@@ -91,74 +91,98 @@
Return<void> Foo::callMe(
const sp<IFooCallback> &cb) {
- ALOGI("SERVER(Foo) callMe %p", cb.get());
+ LOG(INFO) << "SERVER(Foo) callMe " << cb.get();
if (cb != NULL) {
-
hidl_array<nsecs_t, 3> c;
- ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou, " \
- "should return immediately", cb.get());
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::heyItsYou, should return immediately";
c[0] = systemTime();
cb->heyItsYou(cb);
c[0] = systemTime() - c[0];
- ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYou " \
- "returned after %" PRId64 "ns", cb.get(), c[0]);
-
- ALOGI("SERVER(Foo) callMe %p calling IFooCallback::heyItsYouIsntIt, " \
- "should block for %" PRId64 " seconds", cb.get(),
- DELAY_S);
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::heyItsYou, returned after"
+ << c[0]
+ << "ns";
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::heyItsYouIsntIt, should block for"
+ << DELAY_S
+ << " seconds";
c[1] = systemTime();
- bool answer = cb->heyItsYouIsntIt(cb);
+ Return<bool> ret = cb->heyItsYouIsntIt(cb);
+ if (!ret.isOk()) {
+ LOG(ERROR) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " encountered transport error ("
+ << ret.getStatus().exceptionCode()
+ << ").";
+ return Void();
+ }
+ bool answer = ret.get();
c[1] = systemTime() - c[1];
- ALOGI("SERVER(Foo) callMe %p IFooCallback::heyItsYouIsntIt " \
- "responded with %d after %" PRId64 "ns", cb.get(), answer, c[1]);
- ALOGI("SERVER(Foo) callMe %p calling " \
- "IFooCallback::heyItsTheMeaningOfLife, " \
- "should return immediately ", cb.get());
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::heyItsYouIsntIt, responded with "
+ << answer
+ << " after "
+ << c[1]
+ << "ns";
+
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::heyItsTheMeaningOfLife,"
+ << " should return immediately";
c[2] = systemTime();
cb->heyItsTheMeaningOfLife(42);
c[2] = systemTime() - c[2];
- ALOGI("SERVER(Foo) callMe %p After call to " \
- "IFooCallback::heyItsTheMeaningOfLife " \
- "responded after %" PRId64 "ns", cb.get(), c[2]);
- ALOGI("SERVER(Foo) callMe %p calling IFooCallback::youBlockedMeFor " \
- "to report times", cb.get());
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " cAfter call to IFooCallback::heyItsTheMeaningOfLife responded after "
+ << c[2]
+ << "ns";
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " calling IFooCallback::youBlockedMeFor to report times";
cb->youBlockedMeFor(c);
- ALOGI("SERVER(Foo) callMe %p After call to " \
- "IFooCallback::heyYouBlockedMeFor", cb.get());
+ LOG(INFO) << "SERVER(Foo) callMe "
+ << cb.get()
+ << " After call to IFooCallback::youBlockedMeFor";
}
return Void();
}
Return<Foo::SomeEnum> Foo::useAnEnum(SomeEnum param) {
- ALOGI("SERVER(Foo) useAnEnum %d", (int)param);
+ LOG(INFO) << "SERVER(Foo) useAnEnum " << (int)param;
return SomeEnum::goober;
}
Return<void> Foo::haveAGooberVec(const hidl_vec<Goober>& param) {
- ALOGI("SERVER(Foo) haveAGooberVec ¶m = %p", ¶m);
+ LOG(INFO) << "SERVER(Foo) haveAGooberVec ¶m = " << ¶m;
return Void();
}
Return<void> Foo::haveAGoober(const Goober &g) {
- ALOGI("SERVER(Foo) haveaGoober g=%p", &g);
+ LOG(INFO) << "SERVER(Foo) haveaGoober g=" << &g;
return Void();
}
Return<void> Foo::haveAGooberArray(const hidl_array<Goober, 20> & /* lots */) {
- ALOGI("SERVER(Foo) haveAGooberArray");
+ LOG(INFO) << "SERVER(Foo) haveAGooberArray";
return Void();
}
Return<void> Foo::haveATypeFromAnotherFile(const Abc &def) {
- ALOGI("SERVER(Foo) haveATypeFromAnotherFile def=%p", &def);
+ LOG(INFO) << "SERVER(Foo) haveATypeFromAnotherFile def=" << &def;
return Void();
}
@@ -166,10 +190,14 @@
Return<void> Foo::haveSomeStrings(
const hidl_array<hidl_string, 3> &array,
haveSomeStrings_cb _cb) {
- ALOGI("SERVER(Foo) haveSomeStrings([\"%s\", \"%s\", \"%s\"])",
- array[0].c_str(),
- array[1].c_str(),
- array[2].c_str());
+
+ LOG(INFO) << "SERVER(Foo) haveSomeStrings([\""
+ << array[0].c_str()
+ << "\", \""
+ << array[1].c_str()
+ << "\", \""
+ << array[2].c_str()
+ << "\"])";
hidl_array<hidl_string, 2> result;
result[0] = "Hello";
@@ -183,10 +211,13 @@
Return<void> Foo::haveAStringVec(
const hidl_vec<hidl_string> &vector,
haveAStringVec_cb _cb) {
- ALOGI("SERVER(Foo) haveAStringVec([\"%s\", \"%s\", \"%s\"])",
- vector[0].c_str(),
- vector[1].c_str(),
- vector[2].c_str());
+ LOG(INFO) << "SERVER(Foo) haveAStringVec([\""
+ << vector[0].c_str()
+ << "\", \""
+ << vector[1].c_str()
+ << "\", \""
+ << vector[2].c_str()
+ << "\"])";
hidl_vec<hidl_string> result;
result.resize(2);
@@ -201,7 +232,7 @@
Return<void> Foo::transposeMe(
const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
- ALOGI("SERVER(Foo) transposeMe(%s)", to_string(in).c_str());
+ LOG(INFO) << "SERVER(Foo) transposeMe(" << to_string(in).c_str() << ")";
hidl_array<float, 5, 3> out;
for (size_t i = 0; i < 5; ++i) {
@@ -210,7 +241,7 @@
}
}
- ALOGI("SERVER(Foo) transposeMe returning %s", to_string(out).c_str());
+ LOG(INFO) << "SERVER(Foo) transposeMe returning " << to_string(out).c_str();
_cb(out);
@@ -219,7 +250,7 @@
Return<void> Foo::callingDrWho(
const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
- ALOGI("SERVER(Foo) callingDrWho(%s)", MultiDimensionalToString(in).c_str());
+ LOG(INFO) << "SERVER(Foo) callingDrWho(" << MultiDimensionalToString(in).c_str() << ")";
MultiDimensional out;
for (size_t i = 0; i < 5; ++i) {
diff --git a/tests/foo/1.0/default/Foo.h b/tests/foo/1.0/default/Foo.h
index 703c210..84629db 100644
--- a/tests/foo/1.0/default/Foo.h
+++ b/tests/foo/1.0/default/Foo.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+#ifndef ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
+#define ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
#include <android/hardware/tests/foo/1.0/IFoo.h>
#include <hidl/Status.h>
@@ -71,4 +71,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_foo_V1_0_Foo_H_
+#endif // ANDROID_HARDWARE_TESTS_FOO_V1_0_FOO_H
diff --git a/tests/foo/1.0/default/FooCallback.cpp b/tests/foo/1.0/default/FooCallback.cpp
index e4704f2..ff3a545 100644
--- a/tests/foo/1.0/default/FooCallback.cpp
+++ b/tests/foo/1.0/default/FooCallback.cpp
@@ -2,7 +2,7 @@
#define LOG_TAG "hidl_test"
#include "FooCallback.h"
-#include <android-base/logging.h>
+#include <android/log.h>
#include <hidl-test/FooHelper.h>
#include <inttypes.h>
#include <utils/Timers.h>
diff --git a/tests/foo/1.0/default/FooCallback.h b/tests/foo/1.0/default/FooCallback.h
index 00233b5..3164a9d 100644
--- a/tests/foo/1.0/default/FooCallback.h
+++ b/tests/foo/1.0/default/FooCallback.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
-#define HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+#ifndef ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
+#define ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
#include <android/hardware/tests/foo/1.0/IFooCallback.h>
#include <hidl/Status.h>
@@ -43,4 +43,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_foo_V1_0_FooCallback_H_
+#endif // ANDROID_HARDWARE_TESTS_FOO_V1_0_FOOCALLBACK_H
diff --git a/tests/inheritance/1.0/default/Child.cpp b/tests/inheritance/1.0/default/Child.cpp
index 66720b3..fd6608c 100644
--- a/tests/inheritance/1.0/default/Child.cpp
+++ b/tests/inheritance/1.0/default/Child.cpp
@@ -1,5 +1,5 @@
#define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
#include "Child.h"
diff --git a/tests/inheritance/1.0/default/Child.h b/tests/inheritance/1.0/default/Child.h
index 0d34e83..268dfeb 100644
--- a/tests/inheritance/1.0/default/Child.h
+++ b/tests/inheritance/1.0/default/Child.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
#include <android/hardware/tests/inheritance/1.0/IChild.h>
#include <hidl/Status.h>
@@ -41,4 +41,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Child_H_
+#endif // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_CHILD_H
diff --git a/tests/inheritance/1.0/default/Fetcher.cpp b/tests/inheritance/1.0/default/Fetcher.cpp
index 74f8d07..f3b576b 100644
--- a/tests/inheritance/1.0/default/Fetcher.cpp
+++ b/tests/inheritance/1.0/default/Fetcher.cpp
@@ -28,7 +28,7 @@
} else {
toSend = local;
}
- ALOGI("SERVER(Fetcher) selectService returning %p", toSend.get());
+ LOG(INFO) << "SERVER(Fetcher) selectService returning " << toSend.get();
_hidl_cb(toSend);
return Void();
}
diff --git a/tests/inheritance/1.0/default/Fetcher.h b/tests/inheritance/1.0/default/Fetcher.h
index d389853..da9b153 100644
--- a/tests/inheritance/1.0/default/Fetcher.h
+++ b/tests/inheritance/1.0/default/Fetcher.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
#include "Child.h"
#include <android/hardware/tests/inheritance/1.0/IFetcher.h>
@@ -42,4 +42,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Fetcher_H_
+#endif // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_FETCHER_H
diff --git a/tests/inheritance/1.0/default/Grandparent.h b/tests/inheritance/1.0/default/Grandparent.h
index e1113bf..5458b01 100644
--- a/tests/inheritance/1.0/default/Grandparent.h
+++ b/tests/inheritance/1.0/default/Grandparent.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
#include <android/hardware/tests/inheritance/1.0/IGrandparent.h>
#include <hidl/Status.h>
@@ -34,4 +34,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Grandparent_H_
+#endif // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_GRANDPARENT_H
diff --git a/tests/inheritance/1.0/default/Parent.cpp b/tests/inheritance/1.0/default/Parent.cpp
index bdd20c9..a6fd911 100644
--- a/tests/inheritance/1.0/default/Parent.cpp
+++ b/tests/inheritance/1.0/default/Parent.cpp
@@ -1,5 +1,5 @@
#define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
#include "Parent.h"
diff --git a/tests/inheritance/1.0/default/Parent.h b/tests/inheritance/1.0/default/Parent.h
index 2e07fdc..48085fd 100644
--- a/tests/inheritance/1.0/default/Parent.h
+++ b/tests/inheritance/1.0/default/Parent.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
-#define HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+#ifndef ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
+#define ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
#include <android/hardware/tests/inheritance/1.0/IParent.h>
#include <hidl/Status.h>
@@ -37,4 +37,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_inheritance_V1_0_Parent_H_
+#endif // ANDROID_HARDWARE_TESTS_INHERITANCE_V1_0_PARENT_H
diff --git a/tests/libhwbinder/1.0/default/Benchmark.h b/tests/libhwbinder/1.0/default/Benchmark.h
index 454fdf2..74b3745 100644
--- a/tests/libhwbinder/1.0/default/Benchmark.h
+++ b/tests/libhwbinder/1.0/default/Benchmark.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
-#define HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
+#ifndef ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
+#define ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
#include <android/hardware/tests/libhwbinder/1.0/IBenchmark.h>
#include <hidl/Status.h>
@@ -28,4 +28,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_benchmark_V1_0_Benchmark_H_
+#endif // ANDROID_HARDWARE_BENCHMARK_V1_0_BENCHMARK_H
diff --git a/tests/pointer/1.0/default/Graph.cpp b/tests/pointer/1.0/default/Graph.cpp
index 5aa2243..9852407 100644
--- a/tests/pointer/1.0/default/Graph.cpp
+++ b/tests/pointer/1.0/default/Graph.cpp
@@ -1,5 +1,7 @@
+#define LOG_TAG "hidl_test"
+
#include "Graph.h"
-#include <android-base/logging.h>
+#include <android/log.h>
#include <hidl-test/PointerHelper.h>
#define PUSH_ERROR_IF(__cond__) if(__cond__) { errors.push_back(std::to_string(__LINE__) + ": " + #__cond__); }
diff --git a/tests/pointer/1.0/default/Graph.h b/tests/pointer/1.0/default/Graph.h
index cbd5a8a..03bd163 100644
--- a/tests/pointer/1.0/default/Graph.h
+++ b/tests/pointer/1.0/default/Graph.h
@@ -1,5 +1,5 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
-#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
+#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
#include <android/hardware/tests/pointer/1.0/IGraph.h>
#include <hidl/Status.h>
@@ -44,4 +44,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Graph_H_
+#endif // ANDROID_HARDWARE_TESTS_POINTER_V1_0_GRAPH_H
diff --git a/tests/pointer/1.0/default/Pointer.cpp b/tests/pointer/1.0/default/Pointer.cpp
index d7cd772..2b4a323 100644
--- a/tests/pointer/1.0/default/Pointer.cpp
+++ b/tests/pointer/1.0/default/Pointer.cpp
@@ -1,4 +1,7 @@
+#define LOG_TAG "hidl_test"
+
#include "Pointer.h"
+#include <android/log.h>
namespace android {
namespace hardware {
@@ -7,6 +10,14 @@
namespace V1_0 {
namespace implementation {
+Return<int32_t> Pointer::getErrors() {
+ if(!errors.empty()) {
+ for(const auto& e : errors)
+ ALOGW("SERVER(Pointer) error: %s", e.c_str());
+ }
+ return errors.size();
+}
+
IPointer* HIDL_FETCH_IPointer(const char* /* name */) {
return new Pointer();
}
diff --git a/tests/pointer/1.0/default/Pointer.h b/tests/pointer/1.0/default/Pointer.h
index 41d96fd..d6e3e48 100644
--- a/tests/pointer/1.0/default/Pointer.h
+++ b/tests/pointer/1.0/default/Pointer.h
@@ -1,8 +1,7 @@
-#ifndef HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
-#define HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+#ifndef ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
+#define ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
#include <android/hardware/tests/pointer/1.0/IPointer.h>
-#include <android-base/logging.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
@@ -28,13 +27,7 @@
private:
std::vector<std::string> errors;
public:
- Return<int32_t> getErrors() {
- if(!errors.empty()) {
- for(const auto& e : errors)
- ALOGW("SERVER(Pointer) error: %s", e.c_str());
- }
- return errors.size();
- }
+ Return<int32_t> getErrors() override;
Return<void> foo1(const IPointer::Sam& s, IPointer::Sam const* s_ptr) override {
PUSH_ERROR_IF(!(&s == s_ptr));
return Void();
@@ -71,9 +64,6 @@
return Void();
}
Return<void> foo9(::android::hardware::hidl_string const* str_ref) override {
- ALOGI("SERVER(Pointer) foo9 got string @ %p (size = %ld) \"%s\"",
- str_ref->c_str(),
- (unsigned long) str_ref->size(), str_ref->c_str());
PUSH_ERROR_IF(!(strcmp(str_ref->c_str(), "meowmeowmeow") == 0));
return Void();
}
@@ -345,4 +335,4 @@
#undef PUSH_ERROR_IF
-#endif // HIDL_GENERATED_android_hardware_tests_pointer_V1_0_Pointer_H_
+#endif // ANDROID_HARDWARE_TESTS_POINTER_V1_0_POINTER_H
diff --git a/tests/pointer/1.0/default/lib/PointerHelper.cpp b/tests/pointer/1.0/default/lib/PointerHelper.cpp
index ed7d49a..3bc82c2 100644
--- a/tests/pointer/1.0/default/lib/PointerHelper.cpp
+++ b/tests/pointer/1.0/default/lib/PointerHelper.cpp
@@ -1,5 +1,5 @@
#define LOG_TAG "hidl_test"
-#include <android-base/logging.h>
+#include <android/log.h>
#include "PointerHelper.h"
namespace android {
diff --git a/thermal/1.0/default/Thermal.h b/thermal/1.0/default/Thermal.h
index 8212ab9..2e06289 100644
--- a/thermal/1.0/default/Thermal.h
+++ b/thermal/1.0/default/Thermal.h
@@ -1,5 +1,20 @@
-#ifndef HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
-#define HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_THERMAL_V1_0_THERMAL_H
+#define ANDROID_HARDWARE_THERMAL_V1_0_THERMAL_H
#include <android/hardware/thermal/1.0/IThermal.h>
#include <hidl/Status.h>
@@ -42,4 +57,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_thermal_V1_0_Thermal_H_
+#endif // ANDROID_HARDWARE_THERMAL_V1_0_THERMAL_H
diff --git a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target/AndroidTest.xml b/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target/AndroidTest.xml
index cc159b9..169264d 100644
--- a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target/AndroidTest.xml
+++ b/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target/AndroidTest.xml
@@ -25,7 +25,7 @@
_64bit::DATA/nativetest64/thermal_hidl_hal_test/thermal_hidl_hal_test,
"/>
<option name="binary-test-type" value="gtest" />
- <option name="test-timeout" value="1m" />
+ <option name="test-timeout" value="5m" />
</test>
</configuration>
diff --git a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/AndroidTest.xml b/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/AndroidTest.xml
index 038dfe2..46ae05a 100644
--- a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/AndroidTest.xml
+++ b/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/AndroidTest.xml
@@ -24,9 +24,9 @@
_32bit::DATA/nativetest/thermal_hidl_hal_test/thermal_hidl_hal_test,
_64bit::DATA/nativetest64/thermal_hidl_hal_test/thermal_hidl_hal_test,
"/>
- <option name="test-config-path" value="vts/testcases/hal/thermal/hidl/target_profiling/ThermalHidlTargetProfilingTest.config" />
<option name="binary-test-type" value="gtest" />
- <option name="test-timeout" value="1m" />
+ <option name="test-timeout" value="5m" />
+ <option name="enable-profiling" value="true" />
</test>
</configuration>
diff --git a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/ThermalHidlTargetProfilingTest.config b/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/ThermalHidlTargetProfilingTest.config
deleted file mode 100644
index 912d8d5..0000000
--- a/thermal/1.0/vts/functional/vts/testcases/hal/thermal/hidl/target_profiling/ThermalHidlTargetProfilingTest.config
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "enable_profiling": true
-}
\ No newline at end of file
diff --git a/tv/cec/1.0/default/HdmiCec.h b/tv/cec/1.0/default/HdmiCec.h
index a41a5f0..34a3bb0 100644
--- a/tv/cec/1.0/default/HdmiCec.h
+++ b/tv/cec/1.0/default/HdmiCec.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_tv_cec_V1_0_HdmiCec_H_
-#define HIDL_GENERATED_android_hardware_tv_cec_V1_0_HdmiCec_H_
+#ifndef ANDROID_HARDWARE_TV_CEC_V1_0_HDMICEC_H
+#define ANDROID_HARDWARE_TV_CEC_V1_0_HDMICEC_H
#include <algorithm>
@@ -101,4 +101,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tv_cec_V1_0_HdmiCec_H_
+#endif // ANDROID_HARDWARE_TV_CEC_V1_0_HDMICEC_H
diff --git a/tv/input/1.0/default/TvInput.h b/tv/input/1.0/default/TvInput.h
index 81cbb20..beb69f5 100644
--- a/tv/input/1.0/default/TvInput.h
+++ b/tv/input/1.0/default/TvInput.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
-#define HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
+#ifndef ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
+#define ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
#include <android/hardware/tv/input/1.0/ITvInput.h>
#include <hidl/Status.h>
@@ -72,4 +72,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_tv_input_V1_0_TvInput_H_
+#endif // ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
diff --git a/tv/input/1.0/types.hal b/tv/input/1.0/types.hal
index 89a7acc..6852c70 100644
--- a/tv/input/1.0/types.hal
+++ b/tv/input/1.0/types.hal
@@ -18,7 +18,7 @@
import android.hardware.audio.common@2.0;
-enum Result {
+enum Result : int32_t {
OK,
UNKNOWN,
NO_RESOURCE,
@@ -27,7 +27,7 @@
};
/* Type of physical TV input. */
-enum TvInputType {
+enum TvInputType : int32_t {
OTHER = 1, // Generic hardware.
TUNER = 2, // Tuner. e.g. built-in terrestrial tuner
COMPOSITE = 3,
@@ -50,7 +50,7 @@
// must be filled with 0s.
};
-enum TvInputEventType {
+enum TvInputEventType : int32_t {
/*
* Hardware notifies the framework that a device is available.
*
diff --git a/vehicle/2.0/default/impl/DefaultConfig.h b/vehicle/2.0/default/impl/DefaultConfig.h
index 7985737..b1c49c8 100644
--- a/vehicle/2.0/default/impl/DefaultConfig.h
+++ b/vehicle/2.0/default/impl/DefaultConfig.h
@@ -128,6 +128,13 @@
},
{
+ .prop = VehicleProperty::DRIVING_STATUS,
+ .access = VehiclePropertyAccess::READ,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .permissionModel = VehiclePermissionModel::NO_RESTRICTION,
+ },
+
+ {
.prop = VehicleProperty::GEAR_SELECTION,
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
diff --git a/vehicle/2.0/default/impl/DefaultVehicleHal.cpp b/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
index c56248b..5054cfe 100644
--- a/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
+++ b/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
@@ -81,6 +81,9 @@
case VehicleProperty::GEAR_SELECTION:
v = pool.obtainInt32(toInt(VehicleGear::GEAR_PARK));
break;
+ case VehicleProperty::DRIVING_STATUS:
+ v = pool.obtainInt32(toInt(VehicleDrivingStatus::UNRESTRICTED));
+ break;
default:
*outStatus = StatusCode::INVALID_ARG;
}
diff --git a/vehicle/2.0/types.hal b/vehicle/2.0/types.hal
index b19621c..0e0e3ea 100644
--- a/vehicle/2.0/types.hal
+++ b/vehicle/2.0/types.hal
@@ -2073,7 +2073,7 @@
METER_PER_SEC = 0x01,
RPM = 0x02,
- HZ = 0x03,
+ HERTZ = 0x03,
PERCENTILE = 0x10,
MILLIMETER = 0x20,
METER = 0x21,
@@ -2430,7 +2430,7 @@
};
-enum SubscribeFlags {
+enum SubscribeFlags : int32_t {
UNDEFINED = 0x0,
/*
@@ -2477,7 +2477,7 @@
};
/* Error codes used in vehicle HAL interface. */
-enum StatusCode {
+enum StatusCode : int32_t {
OK = 0,
/* Try again. */
diff --git a/vibrator/1.0/default/Vibrator.h b/vibrator/1.0/default/Vibrator.h
index 36c4cc1..061b364 100644
--- a/vibrator/1.0/default/Vibrator.h
+++ b/vibrator/1.0/default/Vibrator.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
-#define HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
+#ifndef ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H
+#define ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H
#include <android/hardware/vibrator/1.0/IVibrator.h>
#include <hidl/Status.h>
@@ -53,4 +53,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_vibrator_V1_0_Vibrator_H_
+#endif // ANDROID_HARDWARE_VIBRATOR_V1_0_VIBRATOR_H
diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/AndroidTest.xml b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/AndroidTest.xml
index 713e9d0..54830f0 100644
--- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/AndroidTest.xml
+++ b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/AndroidTest.xml
@@ -24,6 +24,6 @@
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="VibratorHidlProfilingTest" />
<option name="test-case-path" value="vts/testcases/hal/vibrator/hidl/host/VibratorHidlTest" />
- <option name="test-config-path" value="vts/testcases/hal/vibrator/hidl/host_profiling/VibratorHidlProfilingTest.config" />
+ <option name="enable-profiling" value="true" />
</test>
</configuration>
diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/VibratorHidlProfilingTest.config b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/VibratorHidlProfilingTest.config
deleted file mode 100644
index 912d8d5..0000000
--- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/host_profiling/VibratorHidlProfilingTest.config
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "enable_profiling": true
-}
\ No newline at end of file
diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/AndroidTest.xml b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/AndroidTest.xml
index addd67e..4643e23 100644
--- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/AndroidTest.xml
+++ b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/AndroidTest.xml
@@ -24,9 +24,9 @@
_32bit::DATA/nativetest/vibrator_hidl_hal_test/vibrator_hidl_hal_test,
_64bit::DATA/nativetest64/vibrator_hidl_hal_test/vibrator_hidl_hal_test,
"/>
- <option name="test-config-path" value="vts/testcases/hal/vibrator/hidl/target_profiling/VibratorHidlTargetProfilingTest.config" />
<option name="binary-test-type" value="gtest" />
<option name="test-timeout" value="1m" />
+ <option name="enable-profiling" value="true" />
</test>
</configuration>
diff --git a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/VibratorHidlTargetProfilingTest.config b/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/VibratorHidlTargetProfilingTest.config
deleted file mode 100644
index 912d8d5..0000000
--- a/vibrator/1.0/vts/functional/vts/testcases/hal/vibrator/hidl/target_profiling/VibratorHidlTargetProfilingTest.config
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "enable_profiling": true
-}
\ No newline at end of file
diff --git a/vr/1.0/default/Vr.h b/vr/1.0/default/Vr.h
index 90694d9..dd5e764 100644
--- a/vr/1.0/default/Vr.h
+++ b/vr/1.0/default/Vr.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_
-#define HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_
+#ifndef ANDROID_HARDWARE_VR_V1_0_VR_H
+#define ANDROID_HARDWARE_VR_V1_0_VR_H
#include <android/hardware/vr/1.0/IVr.h>
#include <hardware/vr.h>
@@ -48,4 +48,4 @@
} // namespace hardware
} // namespace android
-#endif // HIDL_GENERATED_android_hardware_vr_V1_0_Vr_H_
+#endif // ANDROID_HARDWARE_VR_V1_0_VR_H
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index 15b6bfc..560a273 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -36,6 +36,8 @@
static constexpr uint32_t kMaxCachedGscanResults = 64;
static constexpr uint32_t kMaxGscanFrequenciesForBand = 64;
static constexpr uint32_t kLinkLayerStatsDataMpduSizeThreshold = 128;
+static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32;
+static constexpr uint32_t kMaxRingBuffers = 10;
// Legacy HAL functions accept "C" style function pointers, so use global
// functions to pass to the legacy HAL function and store the corresponding
@@ -97,6 +99,141 @@
}
}
+// Callback to be invoked for ring buffer data indication.
+std::function<void(char*, char*, int, wifi_ring_buffer_status*)>
+ on_ring_buffer_data_internal_callback;
+void onRingBufferData(char* ring_name,
+ char* buffer,
+ int buffer_size,
+ wifi_ring_buffer_status* status) {
+ if (on_ring_buffer_data_internal_callback) {
+ on_ring_buffer_data_internal_callback(
+ ring_name, buffer, buffer_size, status);
+ }
+}
+
+// Callback to be invoked for rtt results results.
+std::function<void(
+ wifi_request_id, unsigned num_results, wifi_rtt_result* rtt_results[])>
+ on_rtt_results_internal_callback;
+void onRttResults(wifi_request_id id,
+ unsigned num_results,
+ wifi_rtt_result* rtt_results[]) {
+ if (on_rtt_results_internal_callback) {
+ on_rtt_results_internal_callback(id, num_results, rtt_results);
+ }
+}
+
+// Callbacks for the various NAN operations.
+// NOTE: These have very little conversions to perform before invoking the user
+// callbacks.
+// So, handle all of them here directly to avoid adding an unnecessary layer.
+std::function<void(transaction_id, const NanResponseMsg&)>
+ on_nan_notify_response_user_callback;
+void onNanNotifyResponse(transaction_id id, NanResponseMsg* msg) {
+ if (on_nan_notify_response_user_callback && msg) {
+ on_nan_notify_response_user_callback(id, *msg);
+ }
+}
+
+std::function<void(const NanPublishTerminatedInd&)>
+ on_nan_event_publish_terminated_user_callback;
+void onNanEventPublishTerminated(NanPublishTerminatedInd* event) {
+ if (on_nan_event_publish_terminated_user_callback && event) {
+ on_nan_event_publish_terminated_user_callback(*event);
+ }
+}
+
+std::function<void(const NanMatchInd&)> on_nan_event_match_user_callback;
+void onNanEventMatch(NanMatchInd* event) {
+ if (on_nan_event_match_user_callback && event) {
+ on_nan_event_match_user_callback(*event);
+ }
+}
+
+std::function<void(const NanMatchExpiredInd&)>
+ on_nan_event_match_expired_user_callback;
+void onNanEventMatchExpired(NanMatchExpiredInd* event) {
+ if (on_nan_event_match_expired_user_callback && event) {
+ on_nan_event_match_expired_user_callback(*event);
+ }
+}
+
+std::function<void(const NanSubscribeTerminatedInd&)>
+ on_nan_event_subscribe_terminated_user_callback;
+void onNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) {
+ if (on_nan_event_subscribe_terminated_user_callback && event) {
+ on_nan_event_subscribe_terminated_user_callback(*event);
+ }
+}
+
+std::function<void(const NanFollowupInd&)> on_nan_event_followup_user_callback;
+void onNanEventFollowup(NanFollowupInd* event) {
+ if (on_nan_event_followup_user_callback && event) {
+ on_nan_event_followup_user_callback(*event);
+ }
+}
+
+std::function<void(const NanDiscEngEventInd&)>
+ on_nan_event_disc_eng_event_user_callback;
+void onNanEventDiscEngEvent(NanDiscEngEventInd* event) {
+ if (on_nan_event_disc_eng_event_user_callback && event) {
+ on_nan_event_disc_eng_event_user_callback(*event);
+ }
+}
+
+std::function<void(const NanDisabledInd&)> on_nan_event_disabled_user_callback;
+void onNanEventDisabled(NanDisabledInd* event) {
+ if (on_nan_event_disabled_user_callback && event) {
+ on_nan_event_disabled_user_callback(*event);
+ }
+}
+
+std::function<void(const NanTCAInd&)> on_nan_event_tca_user_callback;
+void onNanEventTca(NanTCAInd* event) {
+ if (on_nan_event_tca_user_callback && event) {
+ on_nan_event_tca_user_callback(*event);
+ }
+}
+
+std::function<void(const NanBeaconSdfPayloadInd&)>
+ on_nan_event_beacon_sdf_payload_user_callback;
+void onNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) {
+ if (on_nan_event_beacon_sdf_payload_user_callback && event) {
+ on_nan_event_beacon_sdf_payload_user_callback(*event);
+ }
+}
+
+std::function<void(const NanDataPathRequestInd&)>
+ on_nan_event_data_path_request_user_callback;
+void onNanEventDataPathRequest(NanDataPathRequestInd* event) {
+ if (on_nan_event_data_path_request_user_callback && event) {
+ on_nan_event_data_path_request_user_callback(*event);
+ }
+}
+std::function<void(const NanDataPathConfirmInd&)>
+ on_nan_event_data_path_confirm_user_callback;
+void onNanEventDataPathConfirm(NanDataPathConfirmInd* event) {
+ if (on_nan_event_data_path_confirm_user_callback && event) {
+ on_nan_event_data_path_confirm_user_callback(*event);
+ }
+}
+
+std::function<void(const NanDataPathEndInd&)>
+ on_nan_event_data_path_end_user_callback;
+void onNanEventDataPathEnd(NanDataPathEndInd* event) {
+ if (on_nan_event_data_path_end_user_callback && event) {
+ on_nan_event_data_path_end_user_callback(*event);
+ }
+}
+
+std::function<void(const NanTransmitFollowupInd&)>
+ on_nan_event_transmit_follow_up_user_callback;
+void onNanEventTransmitFollowUp(NanTransmitFollowupInd* event) {
+ if (on_nan_event_transmit_follow_up_user_callback && event) {
+ on_nan_event_transmit_follow_up_user_callback(*event);
+ }
+}
// End of the free-standing "C" style callbacks.
WifiLegacyHal::WifiLegacyHal()
@@ -402,6 +539,406 @@
return {status, link_stats};
}
+std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet() {
+ uint32_t supported_features;
+ wifi_error status = global_func_table_.wifi_get_logger_supported_feature_set(
+ wlan_interface_handle_, &supported_features);
+ return {status, supported_features};
+}
+
+wifi_error WifiLegacyHal::startPktFateMonitoring() {
+ return global_func_table_.wifi_start_pkt_fate_monitoring(
+ wlan_interface_handle_);
+}
+
+std::pair<wifi_error, std::vector<wifi_tx_report>>
+WifiLegacyHal::getTxPktFates() {
+ std::vector<wifi_tx_report> tx_pkt_fates;
+ tx_pkt_fates.resize(MAX_FATE_LOG_LEN);
+ size_t num_fates = 0;
+ wifi_error status =
+ global_func_table_.wifi_get_tx_pkt_fates(wlan_interface_handle_,
+ tx_pkt_fates.data(),
+ tx_pkt_fates.size(),
+ &num_fates);
+ CHECK(num_fates <= MAX_FATE_LOG_LEN);
+ tx_pkt_fates.resize(num_fates);
+ return {status, std::move(tx_pkt_fates)};
+}
+
+std::pair<wifi_error, std::vector<wifi_rx_report>>
+WifiLegacyHal::getRxPktFates() {
+ std::vector<wifi_rx_report> rx_pkt_fates;
+ rx_pkt_fates.resize(MAX_FATE_LOG_LEN);
+ size_t num_fates = 0;
+ wifi_error status =
+ global_func_table_.wifi_get_rx_pkt_fates(wlan_interface_handle_,
+ rx_pkt_fates.data(),
+ rx_pkt_fates.size(),
+ &num_fates);
+ CHECK(num_fates <= MAX_FATE_LOG_LEN);
+ rx_pkt_fates.resize(num_fates);
+ return {status, std::move(rx_pkt_fates)};
+}
+
+std::pair<wifi_error, WakeReasonStats> WifiLegacyHal::getWakeReasonStats() {
+ WakeReasonStats stats;
+ stats.cmd_event_wake_cnt.resize(kMaxWakeReasonStatsArraySize);
+ stats.driver_fw_local_wake_cnt.resize(kMaxWakeReasonStatsArraySize);
+
+ // This legacy struct needs separate memory to store the variable sized wake
+ // reason types.
+ stats.wake_reason_cnt.cmd_event_wake_cnt =
+ reinterpret_cast<int32_t*>(stats.cmd_event_wake_cnt.data());
+ stats.wake_reason_cnt.cmd_event_wake_cnt_sz = stats.cmd_event_wake_cnt.size();
+ stats.wake_reason_cnt.cmd_event_wake_cnt_used = 0;
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt =
+ reinterpret_cast<int32_t*>(stats.driver_fw_local_wake_cnt.data());
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt_sz =
+ stats.driver_fw_local_wake_cnt.size();
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt_used = 0;
+
+ wifi_error status = global_func_table_.wifi_get_wake_reason_stats(
+ wlan_interface_handle_, &stats.wake_reason_cnt);
+
+ CHECK(stats.wake_reason_cnt.cmd_event_wake_cnt_used >= 0 &&
+ static_cast<uint32_t>(stats.wake_reason_cnt.cmd_event_wake_cnt_used) <=
+ kMaxWakeReasonStatsArraySize);
+ stats.cmd_event_wake_cnt.resize(
+ stats.wake_reason_cnt.cmd_event_wake_cnt_used);
+ stats.wake_reason_cnt.cmd_event_wake_cnt = nullptr;
+
+ CHECK(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used >= 0 &&
+ static_cast<uint32_t>(
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt_used) <=
+ kMaxWakeReasonStatsArraySize);
+ stats.driver_fw_local_wake_cnt.resize(
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt_used);
+ stats.wake_reason_cnt.driver_fw_local_wake_cnt = nullptr;
+
+ return {status, stats};
+}
+
+wifi_error WifiLegacyHal::registerRingBufferCallbackHandler(
+ const on_ring_buffer_data_callback& on_user_data_callback) {
+ if (on_ring_buffer_data_internal_callback) {
+ return WIFI_ERROR_NOT_AVAILABLE;
+ }
+ on_ring_buffer_data_internal_callback = [on_user_data_callback](
+ char* ring_name,
+ char* buffer,
+ int buffer_size,
+ wifi_ring_buffer_status* status) {
+ if (status && buffer) {
+ std::vector<uint8_t> buffer_vector(
+ reinterpret_cast<uint8_t*>(buffer),
+ reinterpret_cast<uint8_t*>(buffer) + buffer_size);
+ on_user_data_callback(ring_name, buffer_vector, *status);
+ }
+ };
+ return global_func_table_.wifi_set_log_handler(
+ 0, wlan_interface_handle_, {onRingBufferData});
+}
+
+std::pair<wifi_error, std::vector<wifi_ring_buffer_status>>
+WifiLegacyHal::getRingBuffersStatus() {
+ std::vector<wifi_ring_buffer_status> ring_buffers_status;
+ ring_buffers_status.resize(kMaxRingBuffers);
+ uint32_t num_rings = 0;
+ wifi_error status = global_func_table_.wifi_get_ring_buffers_status(
+ wlan_interface_handle_, &num_rings, ring_buffers_status.data());
+ CHECK(num_rings <= kMaxRingBuffers);
+ ring_buffers_status.resize(num_rings);
+ return {status, std::move(ring_buffers_status)};
+}
+
+wifi_error WifiLegacyHal::startRingBufferLogging(const std::string& ring_name,
+ uint32_t verbose_level,
+ uint32_t max_interval_sec,
+ uint32_t min_data_size) {
+ std::vector<char> ring_name_internal(ring_name.begin(), ring_name.end());
+ return global_func_table_.wifi_start_logging(wlan_interface_handle_,
+ verbose_level,
+ 0,
+ max_interval_sec,
+ min_data_size,
+ ring_name_internal.data());
+}
+
+wifi_error WifiLegacyHal::getRingBufferData(const std::string& ring_name) {
+ std::vector<char> ring_name_internal(ring_name.begin(), ring_name.end());
+ return global_func_table_.wifi_get_ring_data(wlan_interface_handle_,
+ ring_name_internal.data());
+}
+
+wifi_error WifiLegacyHal::startRttRangeRequest(
+ wifi_request_id id,
+ const std::vector<wifi_rtt_config>& rtt_configs,
+ const on_rtt_results_callback& on_results_user_callback) {
+ if (on_rtt_results_internal_callback) {
+ return WIFI_ERROR_NOT_AVAILABLE;
+ }
+
+ on_rtt_results_internal_callback = [on_results_user_callback](
+ wifi_request_id id,
+ unsigned num_results,
+ wifi_rtt_result* rtt_results[]) {
+ if (num_results > 0 && !rtt_results) {
+ LOG(ERROR) << "Unexpected nullptr in RTT results";
+ return;
+ }
+ std::vector<const wifi_rtt_result*> rtt_results_vec;
+ std::copy_if(
+ rtt_results,
+ rtt_results + num_results,
+ back_inserter(rtt_results_vec),
+ [](wifi_rtt_result* rtt_result) { return rtt_result != nullptr; });
+ on_results_user_callback(id, rtt_results_vec);
+ };
+
+ std::vector<wifi_rtt_config> rtt_configs_internal(rtt_configs);
+ return global_func_table_.wifi_rtt_range_request(id,
+ wlan_interface_handle_,
+ rtt_configs.size(),
+ rtt_configs_internal.data(),
+ {onRttResults});
+}
+
+wifi_error WifiLegacyHal::cancelRttRangeRequest(
+ wifi_request_id id, const std::vector<std::array<uint8_t, 6>>& mac_addrs) {
+ if (!on_rtt_results_internal_callback) {
+ return WIFI_ERROR_NOT_AVAILABLE;
+ }
+ static_assert(sizeof(mac_addr) == sizeof(std::array<uint8_t, 6>),
+ "MAC address size mismatch");
+ // TODO: How do we handle partial cancels (i.e only a subset of enabled mac
+ // addressed are cancelled).
+ std::vector<std::array<uint8_t, 6>> mac_addrs_internal(mac_addrs);
+ wifi_error status = global_func_table_.wifi_rtt_range_cancel(
+ id,
+ wlan_interface_handle_,
+ mac_addrs.size(),
+ reinterpret_cast<mac_addr*>(mac_addrs_internal.data()));
+ // If the request Id is wrong, don't stop the ongoing range request. Any
+ // other error should be treated as the end of rtt ranging.
+ if (status != WIFI_ERROR_INVALID_REQUEST_ID) {
+ on_rtt_results_internal_callback = nullptr;
+ }
+ return status;
+}
+
+std::pair<wifi_error, wifi_rtt_capabilities>
+WifiLegacyHal::getRttCapabilities() {
+ wifi_rtt_capabilities rtt_caps;
+ wifi_error status = global_func_table_.wifi_get_rtt_capabilities(
+ wlan_interface_handle_, &rtt_caps);
+ return {status, rtt_caps};
+}
+
+std::pair<wifi_error, wifi_rtt_responder> WifiLegacyHal::getRttResponderInfo() {
+ wifi_rtt_responder rtt_responder;
+ wifi_error status = global_func_table_.wifi_rtt_get_responder_info(
+ wlan_interface_handle_, &rtt_responder);
+ return {status, rtt_responder};
+}
+
+wifi_error WifiLegacyHal::enableRttResponder(
+ wifi_request_id id,
+ const wifi_channel_info& channel_hint,
+ uint32_t max_duration_secs,
+ const wifi_rtt_responder& info) {
+ wifi_rtt_responder info_internal(info);
+ return global_func_table_.wifi_enable_responder(id,
+ wlan_interface_handle_,
+ channel_hint,
+ max_duration_secs,
+ &info_internal);
+}
+
+wifi_error WifiLegacyHal::disableRttResponder(wifi_request_id id) {
+ return global_func_table_.wifi_disable_responder(id, wlan_interface_handle_);
+}
+
+wifi_error WifiLegacyHal::setRttLci(wifi_request_id id,
+ const wifi_lci_information& info) {
+ wifi_lci_information info_internal(info);
+ return global_func_table_.wifi_set_lci(
+ id, wlan_interface_handle_, &info_internal);
+}
+
+wifi_error WifiLegacyHal::setRttLcr(wifi_request_id id,
+ const wifi_lcr_information& info) {
+ wifi_lcr_information info_internal(info);
+ return global_func_table_.wifi_set_lcr(
+ id, wlan_interface_handle_, &info_internal);
+}
+
+wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(
+ const NanCallbackHandlers& user_callbacks) {
+ on_nan_notify_response_user_callback = user_callbacks.on_notify_response;
+ on_nan_event_publish_terminated_user_callback =
+ user_callbacks.on_event_publish_terminated;
+ on_nan_event_match_user_callback = user_callbacks.on_event_match;
+ on_nan_event_match_expired_user_callback =
+ user_callbacks.on_event_match_expired;
+ on_nan_event_subscribe_terminated_user_callback =
+ user_callbacks.on_event_subscribe_terminated;
+ on_nan_event_followup_user_callback = user_callbacks.on_event_followup;
+ on_nan_event_disc_eng_event_user_callback =
+ user_callbacks.on_event_disc_eng_event;
+ on_nan_event_disabled_user_callback = user_callbacks.on_event_disabled;
+ on_nan_event_tca_user_callback = user_callbacks.on_event_tca;
+ on_nan_event_beacon_sdf_payload_user_callback =
+ user_callbacks.on_event_beacon_sdf_payload;
+ on_nan_event_data_path_request_user_callback =
+ user_callbacks.on_event_data_path_request;
+ on_nan_event_data_path_confirm_user_callback =
+ user_callbacks.on_event_data_path_confirm;
+ on_nan_event_data_path_end_user_callback =
+ user_callbacks.on_event_data_path_end;
+ on_nan_event_transmit_follow_up_user_callback =
+ user_callbacks.on_event_transmit_follow_up;
+
+ return global_func_table_.wifi_nan_register_handler(
+ wlan_interface_handle_,
+ {onNanNotifyResponse,
+ onNanEventPublishTerminated,
+ onNanEventMatch,
+ onNanEventMatchExpired,
+ onNanEventSubscribeTerminated,
+ onNanEventFollowup,
+ onNanEventDiscEngEvent,
+ onNanEventDisabled,
+ onNanEventTca,
+ onNanEventBeaconSdfPayload,
+ onNanEventDataPathRequest,
+ onNanEventDataPathConfirm,
+ onNanEventDataPathEnd,
+ onNanEventTransmitFollowUp});
+}
+
+wifi_error WifiLegacyHal::nanEnableRequest(transaction_id id,
+ const NanEnableRequest& msg) {
+ NanEnableRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_enable_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanDisableRequest(transaction_id id) {
+ return global_func_table_.wifi_nan_disable_request(id,
+ wlan_interface_handle_);
+}
+
+wifi_error WifiLegacyHal::nanPublishRequest(transaction_id id,
+ const NanPublishRequest& msg) {
+ NanPublishRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_publish_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanPublishCancelRequest(
+ transaction_id id, const NanPublishCancelRequest& msg) {
+ NanPublishCancelRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_publish_cancel_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanSubscribeRequest(transaction_id id,
+ const NanSubscribeRequest& msg) {
+ NanSubscribeRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_subscribe_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanSubscribeCancelRequest(
+ transaction_id id, const NanSubscribeCancelRequest& msg) {
+ NanSubscribeCancelRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_subscribe_cancel_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanTransmitFollowupRequest(
+ transaction_id id, const NanTransmitFollowupRequest& msg) {
+ NanTransmitFollowupRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_transmit_followup_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanStatsRequest(transaction_id id,
+ const NanStatsRequest& msg) {
+ NanStatsRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_stats_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanConfigRequest(transaction_id id,
+ const NanConfigRequest& msg) {
+ NanConfigRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_config_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanTcaRequest(transaction_id id,
+ const NanTCARequest& msg) {
+ NanTCARequest msg_internal(msg);
+ return global_func_table_.wifi_nan_tca_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanBeaconSdfPayloadRequest(
+ transaction_id id, const NanBeaconSdfPayloadRequest& msg) {
+ NanBeaconSdfPayloadRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_beacon_sdf_payload_request(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+std::pair<wifi_error, NanVersion> WifiLegacyHal::nanGetVersion() {
+ NanVersion version;
+ wifi_error status =
+ global_func_table_.wifi_nan_get_version(global_handle_, &version);
+ return {status, version};
+}
+
+wifi_error WifiLegacyHal::nanGetCapabilities(transaction_id id) {
+ return global_func_table_.wifi_nan_get_capabilities(id,
+ wlan_interface_handle_);
+}
+
+wifi_error WifiLegacyHal::nanDataInterfaceCreate(
+ transaction_id id, const std::string& iface_name) {
+ std::vector<char> iface_name_internal(iface_name.begin(), iface_name.end());
+ return global_func_table_.wifi_nan_data_interface_create(
+ id, wlan_interface_handle_, iface_name_internal.data());
+}
+
+wifi_error WifiLegacyHal::nanDataInterfaceDelete(
+ transaction_id id, const std::string& iface_name) {
+ std::vector<char> iface_name_internal(iface_name.begin(), iface_name.end());
+ return global_func_table_.wifi_nan_data_interface_delete(
+ id, wlan_interface_handle_, iface_name_internal.data());
+}
+
+wifi_error WifiLegacyHal::nanDataRequestInitiator(
+ transaction_id id, const NanDataPathInitiatorRequest& msg) {
+ NanDataPathInitiatorRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_data_request_initiator(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanDataIndicationResponse(
+ transaction_id id, const NanDataPathIndicationResponse& msg) {
+ NanDataPathIndicationResponse msg_internal(msg);
+ return global_func_table_.wifi_nan_data_indication_response(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
+wifi_error WifiLegacyHal::nanDataEnd(transaction_id id,
+ const NanDataPathEndRequest& msg) {
+ NanDataPathEndRequest msg_internal(msg);
+ return global_func_table_.wifi_nan_data_end(
+ id, wlan_interface_handle_, &msg_internal);
+}
+
wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
const std::string& ifname_to_find = getStaIfaceName();
wifi_interface_handle* iface_handles = nullptr;
@@ -479,6 +1016,22 @@
on_gscan_event_internal_callback = nullptr;
on_gscan_full_result_internal_callback = nullptr;
on_link_layer_stats_result_internal_callback = nullptr;
+ on_ring_buffer_data_internal_callback = nullptr;
+ on_rtt_results_internal_callback = nullptr;
+ on_nan_notify_response_user_callback = nullptr;
+ on_nan_event_publish_terminated_user_callback = nullptr;
+ on_nan_event_match_user_callback = nullptr;
+ on_nan_event_match_expired_user_callback = nullptr;
+ on_nan_event_subscribe_terminated_user_callback = nullptr;
+ on_nan_event_followup_user_callback = nullptr;
+ on_nan_event_disc_eng_event_user_callback = nullptr;
+ on_nan_event_disabled_user_callback = nullptr;
+ on_nan_event_tca_user_callback = nullptr;
+ on_nan_event_beacon_sdf_payload_user_callback = nullptr;
+ on_nan_event_data_path_request_user_callback = nullptr;
+ on_nan_event_data_path_confirm_user_callback = nullptr;
+ on_nan_event_data_path_end_user_callback = nullptr;
+ on_nan_event_transmit_follow_up_user_callback = nullptr;
}
} // namespace legacy_hal
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index df1c3d6..62b773e 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -54,6 +54,41 @@
};
#pragma GCC diagnostic pop
+// The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and
+// |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided
+// as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL
+// API. Separate that out into a separate return elements to avoid passing
+// pointers around.
+struct WakeReasonStats {
+ WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt;
+ std::vector<uint32_t> cmd_event_wake_cnt;
+ std::vector<uint32_t> driver_fw_local_wake_cnt;
+};
+
+// NAN response and event callbacks struct.
+struct NanCallbackHandlers {
+ // NotifyResponse invoked to notify the status of the Request.
+ std::function<void(transaction_id, const NanResponseMsg&)> on_notify_response;
+ // Various event callbacks.
+ std::function<void(const NanPublishTerminatedInd&)>
+ on_event_publish_terminated;
+ std::function<void(const NanMatchInd&)> on_event_match;
+ std::function<void(const NanMatchExpiredInd&)> on_event_match_expired;
+ std::function<void(const NanSubscribeTerminatedInd&)>
+ on_event_subscribe_terminated;
+ std::function<void(const NanFollowupInd&)> on_event_followup;
+ std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event;
+ std::function<void(const NanDisabledInd&)> on_event_disabled;
+ std::function<void(const NanTCAInd&)> on_event_tca;
+ std::function<void(const NanBeaconSdfPayloadInd&)>
+ on_event_beacon_sdf_payload;
+ std::function<void(const NanDataPathRequestInd&)> on_event_data_path_request;
+ std::function<void(const NanDataPathConfirmInd&)> on_event_data_path_confirm;
+ std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
+ std::function<void(const NanTransmitFollowupInd&)>
+ on_event_transmit_follow_up;
+};
+
// Full scan results contain IE info and are hence passed by reference, to
// preserve the variable length array member |ie_data|. Callee must not retain
// the pointer.
@@ -64,6 +99,19 @@
using on_gscan_results_callback = std::function<void(
wifi_request_id, const std::vector<wifi_cached_scan_results>&)>;
+// Callback for RTT range request results.
+// Rtt results contain IE info and are hence passed by reference, to
+// preserve the |LCI| and |LCR| pointers. Callee must not retain
+// the pointer.
+using on_rtt_results_callback = std::function<void(
+ wifi_request_id, const std::vector<const wifi_rtt_result*>&)>;
+
+// Callback for ring buffer data.
+using on_ring_buffer_data_callback =
+ std::function<void(const std::string&,
+ const std::vector<uint8_t>&,
+ const wifi_ring_buffer_status&)>;
+
/**
* Class that encapsulates all legacy HAL interactions.
* This class manages the lifetime of the event loop thread used by legacy HAL.
@@ -115,6 +163,66 @@
wifi_error enableLinkLayerStats(bool debug);
wifi_error disableLinkLayerStats();
std::pair<wifi_error, LinkLayerStats> getLinkLayerStats();
+ // Logger/debug functions.
+ std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet();
+ wifi_error startPktFateMonitoring();
+ std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates();
+ std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates();
+ std::pair<wifi_error, WakeReasonStats> getWakeReasonStats();
+ wifi_error registerRingBufferCallbackHandler(
+ const on_ring_buffer_data_callback& on_data_callback);
+ std::pair<wifi_error, std::vector<wifi_ring_buffer_status>>
+ getRingBuffersStatus();
+ wifi_error startRingBufferLogging(const std::string& ring_name,
+ uint32_t verbose_level,
+ uint32_t max_interval_sec,
+ uint32_t min_data_size);
+ wifi_error getRingBufferData(const std::string& ring_name);
+ // RTT functions.
+ wifi_error startRttRangeRequest(
+ wifi_request_id id,
+ const std::vector<wifi_rtt_config>& rtt_configs,
+ const on_rtt_results_callback& on_results_callback);
+ wifi_error cancelRttRangeRequest(
+ wifi_request_id id, const std::vector<std::array<uint8_t, 6>>& mac_addrs);
+ std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities();
+ std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo();
+ wifi_error enableRttResponder(wifi_request_id id,
+ const wifi_channel_info& channel_hint,
+ uint32_t max_duration_secs,
+ const wifi_rtt_responder& info);
+ wifi_error disableRttResponder(wifi_request_id id);
+ wifi_error setRttLci(wifi_request_id id, const wifi_lci_information& info);
+ wifi_error setRttLcr(wifi_request_id id, const wifi_lcr_information& info);
+ // NAN functions.
+ wifi_error nanRegisterCallbackHandlers(const NanCallbackHandlers& callbacks);
+ wifi_error nanEnableRequest(transaction_id id, const NanEnableRequest& msg);
+ wifi_error nanDisableRequest(transaction_id id);
+ wifi_error nanPublishRequest(transaction_id id, const NanPublishRequest& msg);
+ wifi_error nanPublishCancelRequest(transaction_id id,
+ const NanPublishCancelRequest& msg);
+ wifi_error nanSubscribeRequest(transaction_id id,
+ const NanSubscribeRequest& msg);
+ wifi_error nanSubscribeCancelRequest(transaction_id id,
+ const NanSubscribeCancelRequest& msg);
+ wifi_error nanTransmitFollowupRequest(transaction_id id,
+ const NanTransmitFollowupRequest& msg);
+ wifi_error nanStatsRequest(transaction_id id, const NanStatsRequest& msg);
+ wifi_error nanConfigRequest(transaction_id id, const NanConfigRequest& msg);
+ wifi_error nanTcaRequest(transaction_id id, const NanTCARequest& msg);
+ wifi_error nanBeaconSdfPayloadRequest(transaction_id id,
+ const NanBeaconSdfPayloadRequest& msg);
+ std::pair<wifi_error, NanVersion> nanGetVersion();
+ wifi_error nanGetCapabilities(transaction_id id);
+ wifi_error nanDataInterfaceCreate(transaction_id id,
+ const std::string& iface_name);
+ wifi_error nanDataInterfaceDelete(transaction_id id,
+ const std::string& iface_name);
+ wifi_error nanDataRequestInitiator(transaction_id id,
+ const NanDataPathInitiatorRequest& msg);
+ wifi_error nanDataIndicationResponse(
+ transaction_id id, const NanDataPathIndicationResponse& msg);
+ wifi_error nanDataEnd(transaction_id id, const NanDataPathEndRequest& msg);
private:
// Retrieve the interface handle to be used for the "wlan" interface.
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 066662c..9e53377 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -486,7 +486,7 @@
/**
* Mask of flags set in the |ScanData| instance.
*/
-enum StaScanDataFlagMask {
+enum StaScanDataFlagMask : int32_t {
/**
* Indicates that a scan was interrupted/did not occur so results may be
* incomplete.