extern "C" EXPORT_API int ambient_viewer_notify_ambient_event(
ambient_viewer_h handle, ambient_viewer_state_e state,
ambient_viewer_direction_e dir, bundle *extra) {
- if (handle == nullptr || extra == nullptr) {
+ if (handle == nullptr) {
LOGE("Invalid parameter");
return AMBIENT_VIEWER_ERROR_INVALID_PARAMETER;
}
+ Bundle bundle;
+ if (extra)
+ bundle = Bundle(extra, false, false);
+
AmbientViewerStub* stub = static_cast<AmbientViewerStub*>(handle);
stub->NotifyAmbientEvent((AmbientViewer::AmbientState)state,
- static_cast<AmbientViewer::Direction>(dir), Bundle(extra, false, false));
+ static_cast<AmbientViewer::Direction>(dir), std::move(bundle));
return AMBIENT_VIEWER_ERROR_NONE;
}