Added example vendor extension for light.
Test: make
Bug: 32065239
Change-Id: I8004eaea180d768ccdec0e932d08c1167f5c10cd
diff --git a/example/extension/light/2.0/default/Light.cpp b/example/extension/light/2.0/default/Light.cpp
new file mode 100644
index 0000000..d738a6d
--- /dev/null
+++ b/example/extension/light/2.0/default/Light.cpp
@@ -0,0 +1,56 @@
+#include "Light.h"
+
+namespace android {
+namespace hardware {
+namespace example {
+namespace extension {
+namespace light {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::light::V2_0::ILight follow.
+Return<Status> Light::setLight(Type type, const LightState& state) {
+ // Forward types for new methods.
+
+ ExtLightState extState {
+ .state = state,
+ .interpolationOmega =
+ static_cast<int32_t>(Default::INTERPOLATION_OMEGA),
+ .brightness = // ExtBrightness inherits from Brightness
+ static_cast<ExtBrightness>(state.brightnessMode)
+ };
+
+ return setExtLight(type, extState);
+}
+
+Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) {
+ // implement unchanged method as you would always
+ hidl_vec<Type> vec{};
+
+ // ******************************************************
+ // Note: awesome proprietary hardware implementation here
+ // ******************************************************
+
+ _hidl_cb(vec);
+
+ return Void();
+}
+
+// Methods from ::android::hardware::example::extension::light::V2_0::ILight follow.
+Return<Status> Light::setExtLight(Type /* type */,
+ const ExtLightState& /* state */) {
+
+ // ******************************************************
+ // Note: awesome proprietary hardware implementation here
+ // ******************************************************
+
+ return Status::SUCCESS;
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace light
+} // namespace extension
+} // namespace example
+} // namespace hardware
+} // namespace android