Merge "Apply AnimationModule to SurroundView Service" into rvc-dev
diff --git a/surround_view/service-impl/Android.bp b/surround_view/service-impl/Android.bp
index 02da338..582650b 100644
--- a/surround_view/service-impl/Android.bp
+++ b/surround_view/service-impl/Android.bp
@@ -116,6 +116,7 @@
name : "android.automotive.sv.service@1.0-impl",
vendor : true,
srcs : [
+ "AnimationModule.cpp",
"CoreLibSetupHelper.cpp",
"SurroundViewService.cpp",
"SurroundView2dSession.cpp",
diff --git a/surround_view/service-impl/SurroundView3dSession.cpp b/surround_view/service-impl/SurroundView3dSession.cpp
index a06a260..8700b13 100644
--- a/surround_view/service-impl/SurroundView3dSession.cpp
+++ b/surround_view/service-impl/SurroundView3dSession.cpp
@@ -165,10 +165,13 @@
}
}
-SurroundView3dSession::SurroundView3dSession(sp<IEvsEnumerator> pEvs, VhalHandler* vhalHandler) :
+SurroundView3dSession::SurroundView3dSession(sp<IEvsEnumerator> pEvs,
+ VhalHandler* vhalHandler,
+ AnimationModule* animationModule) :
mEvs(pEvs),
mStreamState(STOPPED),
- mVhalHandler(vhalHandler) {
+ mVhalHandler(vhalHandler),
+ mAnimationModule(animationModule) {
mEvsCameraIds = {"0" , "1", "2", "3"};
}
@@ -505,6 +508,19 @@
LOG(WARNING) << "VhalHandler is null. Ignored";
}
+ vector<AnimationParam> params;
+ if (mAnimationModule != nullptr) {
+ params = mAnimationModule->getUpdatedAnimationParams(mPropertyValues);
+ } else {
+ LOG(WARNING) << "AnimationModule is null. Ignored";
+ }
+
+ if (!params.empty()) {
+ mSurroundView->SetAnimations(params);
+ } else {
+ LOG(INFO) << "AnimationParams is empty. Ignored";
+ }
+
if (mSurroundView->Get3dSurroundView(
mInputPointers, matrix, &mOutputPointer)) {
LOG(INFO) << "Get3dSurroundView succeeded";
diff --git a/surround_view/service-impl/SurroundView3dSession.h b/surround_view/service-impl/SurroundView3dSession.h
index fbb974f..efa257f 100644
--- a/surround_view/service-impl/SurroundView3dSession.h
+++ b/surround_view/service-impl/SurroundView3dSession.h
@@ -26,6 +26,7 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include "AnimationModule.h"
#include "CoreLibSetupHelper.h"
#include "VhalHandler.h"
@@ -82,7 +83,9 @@
public:
// TODO(b/158479099): use strong pointer for VhalHandler
- SurroundView3dSession(sp<IEvsEnumerator> pEvs, VhalHandler* vhalHandler);
+ SurroundView3dSession(sp<IEvsEnumerator> pEvs,
+ VhalHandler* vhalHandler,
+ AnimationModule* animationModule);
~SurroundView3dSession();
bool initialize();
@@ -170,6 +173,7 @@
bool mIsInitialized GUARDED_BY(mAccessLock) = false;
VhalHandler* mVhalHandler;
+ AnimationModule* mAnimationModule;
std::vector<VehiclePropValue> mPropertyValues;
};
diff --git a/surround_view/service-impl/SurroundViewService.cpp b/surround_view/service-impl/SurroundViewService.cpp
index a1c97bd..38d0524 100644
--- a/surround_view/service-impl/SurroundViewService.cpp
+++ b/surround_view/service-impl/SurroundViewService.cpp
@@ -39,10 +39,14 @@
SurroundViewService::SurroundViewService() {
mVhalHandler = new VhalHandler();
+ mAnimationModule = new AnimationModule(map<string, CarPart>(),
+ map<string, CarTexture>(),
+ vector<AnimationInfo>());
}
SurroundViewService::~SurroundViewService() {
delete mVhalHandler;
+ delete mAnimationModule;
}
sp<SurroundViewService> SurroundViewService::getInstance() {
@@ -126,7 +130,9 @@
LOG(WARNING) << "Only one 3d session is supported at the same time";
_hidl_cb(nullptr, SvResult::INTERNAL_ERROR);
} else {
- sSurroundView3dSession = new SurroundView3dSession(mEvs, mVhalHandler);
+ sSurroundView3dSession = new SurroundView3dSession(mEvs,
+ mVhalHandler,
+ mAnimationModule);
if (sSurroundView3dSession->initialize()) {
_hidl_cb(sSurroundView3dSession, SvResult::OK);
} else {
diff --git a/surround_view/service-impl/SurroundViewService.h b/surround_view/service-impl/SurroundViewService.h
index edff4df..e5fb69c 100644
--- a/surround_view/service-impl/SurroundViewService.h
+++ b/surround_view/service-impl/SurroundViewService.h
@@ -19,6 +19,7 @@
#include "SurroundView2dSession.h"
#include "SurroundView3dSession.h"
#include "VhalHandler.h"
+#include "AnimationModule.h"
#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
#include <android/hardware/automotive/sv/1.0/types.h>
@@ -61,6 +62,7 @@
~SurroundViewService();
VhalHandler* mVhalHandler;
+ AnimationModule* mAnimationModule;
bool initialize();
sp<IEvsEnumerator> mEvs;