Loading services/core/jni/tvinput/JTvInputHal.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ JTvInputHal::JTvInputHal(JNIEnv* env, jobject thiz, std::shared_ptr<ITvInputWrap mThiz = env->NewWeakGlobalRef(thiz); mTvInput = tvInput; mLooper = looper; mTvInputCallback = ::ndk::SharedRefBase::make<TvInputCallback>(this); mTvInputCallback = std::shared_ptr<TvInputCallbackWrapper>(new TvInputCallbackWrapper(this)); mTvInput->setCallback(mTvInputCallback); } Loading Loading @@ -443,18 +443,23 @@ void JTvInputHal::NotifyTvMessageHandler::handleMessage(const Message& message) } } JTvInputHal::TvInputCallback::TvInputCallback(JTvInputHal* hal) { JTvInputHal::TvInputCallbackWrapper::TvInputCallbackWrapper(JTvInputHal* hal) { aidlTvInputCallback = ::ndk::SharedRefBase::make<AidlTvInputCallback>(hal); hidlTvInputCallback = sp<HidlTvInputCallback>::make(hal); } JTvInputHal::AidlTvInputCallback::AidlTvInputCallback(JTvInputHal* hal) { mHal = hal; } ::ndk::ScopedAStatus JTvInputHal::TvInputCallback::notify(const AidlTvInputEvent& event) { ::ndk::ScopedAStatus JTvInputHal::AidlTvInputCallback::notify(const AidlTvInputEvent& event) { mHal->mLooper->sendMessage(new NotifyHandler(mHal, TvInputEventWrapper::createEventWrapper(event)), static_cast<int>(event.type)); return ::ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus JTvInputHal::TvInputCallback::notifyTvMessageEvent( ::ndk::ScopedAStatus JTvInputHal::AidlTvInputCallback::notifyTvMessageEvent( const AidlTvMessageEvent& event) { const std::string DEVICE_ID_SUBTYPE = "device_id"; ::ndk::ScopedAStatus status = ::ndk::ScopedAStatus::ok(); Loading Loading @@ -487,11 +492,14 @@ JTvInputHal::ITvInputWrapper::ITvInputWrapper(std::shared_ptr<AidlITvInput>& aid : mIsHidl(false), mAidlTvInput(aidlTvInput) {} ::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::setCallback( const std::shared_ptr<TvInputCallback>& in_callback) { const std::shared_ptr<TvInputCallbackWrapper>& in_callback) { if (mIsHidl) { return hidlSetCallback(in_callback); in_callback->aidlTvInputCallback = nullptr; return hidlSetCallback(in_callback == nullptr ? nullptr : in_callback->hidlTvInputCallback); } else { return mAidlTvInput->setCallback(in_callback); in_callback->hidlTvInputCallback = nullptr; return mAidlTvInput->setCallback(in_callback == nullptr ? nullptr : in_callback->aidlTvInputCallback); } } Loading services/core/jni/tvinput/JTvInputHal.h +21 −5 Original line number Diff line number Diff line Loading @@ -168,23 +168,39 @@ private: JTvInputHal* mHal; }; class TvInputCallback : public HidlITvInputCallback, public BnTvInputCallback { class AidlTvInputCallback : public BnTvInputCallback { public: explicit TvInputCallback(JTvInputHal* hal); explicit AidlTvInputCallback(JTvInputHal* hal); ::ndk::ScopedAStatus notify(const AidlTvInputEvent& event) override; ::ndk::ScopedAStatus notifyTvMessageEvent(const AidlTvMessageEvent& event) override; private: JTvInputHal* mHal; }; class HidlTvInputCallback : public HidlITvInputCallback { public: explicit HidlTvInputCallback(JTvInputHal* hal); Return<void> notify(const HidlTvInputEvent& event) override; private: JTvInputHal* mHal; }; class TvInputCallbackWrapper { public: explicit TvInputCallbackWrapper(JTvInputHal* hal); std::shared_ptr<AidlTvInputCallback> aidlTvInputCallback; sp<HidlTvInputCallback> hidlTvInputCallback; }; class ITvInputWrapper { public: ITvInputWrapper(std::shared_ptr<AidlITvInput>& aidlTvInput); ITvInputWrapper(sp<HidlITvInput>& hidlTvInput); ::ndk::ScopedAStatus setCallback(const std::shared_ptr<TvInputCallback>& in_callback); ::ndk::ScopedAStatus setCallback( const std::shared_ptr<TvInputCallbackWrapper>& in_callback); ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId, std::vector<AidlTvStreamConfig>* _aidl_return); ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId, Loading @@ -198,7 +214,7 @@ private: ::ndk::ScopedAStatus getAidlInterfaceVersion(int32_t* _aidl_return); private: ::ndk::ScopedAStatus hidlSetCallback(const std::shared_ptr<TvInputCallback>& in_callback); ::ndk::ScopedAStatus hidlSetCallback(const sp<HidlTvInputCallback>& in_callback); ::ndk::ScopedAStatus hidlGetStreamConfigurations( int32_t in_deviceId, std::vector<AidlTvStreamConfig>* _aidl_return); ::ndk::ScopedAStatus hidlOpenStream(int32_t in_deviceId, int32_t in_streamId, Loading Loading @@ -229,7 +245,7 @@ private: KeyedVector<int, KeyedVector<int, Connection> > mConnections; std::shared_ptr<ITvInputWrapper> mTvInput; std::shared_ptr<TvInputCallback> mTvInputCallback; std::shared_ptr<TvInputCallbackWrapper> mTvInputCallback; }; } // namespace android services/core/jni/tvinput/TvInputHal_hidl.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -59,7 +59,11 @@ JTvInputHal::TvInputEventWrapper JTvInputHal::TvInputEventWrapper::createEventWr return event; } Return<void> JTvInputHal::TvInputCallback::notify(const HidlTvInputEvent& event) { JTvInputHal::HidlTvInputCallback::HidlTvInputCallback(JTvInputHal* hal) { mHal = hal; } Return<void> JTvInputHal::HidlTvInputCallback::notify(const HidlTvInputEvent& event) { mHal->mLooper->sendMessage(new NotifyHandler(mHal, TvInputEventWrapper::createEventWrapper(event)), static_cast<int>(event.type)); Loading @@ -70,9 +74,8 @@ JTvInputHal::ITvInputWrapper::ITvInputWrapper(sp<HidlITvInput>& hidlTvInput) : mIsHidl(true), mHidlTvInput(hidlTvInput) {} ::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::hidlSetCallback( const std::shared_ptr<TvInputCallback>& in_callback) { mHidlTvInput->setCallback(in_callback == nullptr ? nullptr : sp<TvInputCallback>(in_callback.get())); const sp<HidlTvInputCallback>& in_callback) { mHidlTvInput->setCallback(in_callback); return ::ndk::ScopedAStatus::ok(); } Loading Loading
services/core/jni/tvinput/JTvInputHal.cpp +15 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ JTvInputHal::JTvInputHal(JNIEnv* env, jobject thiz, std::shared_ptr<ITvInputWrap mThiz = env->NewWeakGlobalRef(thiz); mTvInput = tvInput; mLooper = looper; mTvInputCallback = ::ndk::SharedRefBase::make<TvInputCallback>(this); mTvInputCallback = std::shared_ptr<TvInputCallbackWrapper>(new TvInputCallbackWrapper(this)); mTvInput->setCallback(mTvInputCallback); } Loading Loading @@ -443,18 +443,23 @@ void JTvInputHal::NotifyTvMessageHandler::handleMessage(const Message& message) } } JTvInputHal::TvInputCallback::TvInputCallback(JTvInputHal* hal) { JTvInputHal::TvInputCallbackWrapper::TvInputCallbackWrapper(JTvInputHal* hal) { aidlTvInputCallback = ::ndk::SharedRefBase::make<AidlTvInputCallback>(hal); hidlTvInputCallback = sp<HidlTvInputCallback>::make(hal); } JTvInputHal::AidlTvInputCallback::AidlTvInputCallback(JTvInputHal* hal) { mHal = hal; } ::ndk::ScopedAStatus JTvInputHal::TvInputCallback::notify(const AidlTvInputEvent& event) { ::ndk::ScopedAStatus JTvInputHal::AidlTvInputCallback::notify(const AidlTvInputEvent& event) { mHal->mLooper->sendMessage(new NotifyHandler(mHal, TvInputEventWrapper::createEventWrapper(event)), static_cast<int>(event.type)); return ::ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus JTvInputHal::TvInputCallback::notifyTvMessageEvent( ::ndk::ScopedAStatus JTvInputHal::AidlTvInputCallback::notifyTvMessageEvent( const AidlTvMessageEvent& event) { const std::string DEVICE_ID_SUBTYPE = "device_id"; ::ndk::ScopedAStatus status = ::ndk::ScopedAStatus::ok(); Loading Loading @@ -487,11 +492,14 @@ JTvInputHal::ITvInputWrapper::ITvInputWrapper(std::shared_ptr<AidlITvInput>& aid : mIsHidl(false), mAidlTvInput(aidlTvInput) {} ::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::setCallback( const std::shared_ptr<TvInputCallback>& in_callback) { const std::shared_ptr<TvInputCallbackWrapper>& in_callback) { if (mIsHidl) { return hidlSetCallback(in_callback); in_callback->aidlTvInputCallback = nullptr; return hidlSetCallback(in_callback == nullptr ? nullptr : in_callback->hidlTvInputCallback); } else { return mAidlTvInput->setCallback(in_callback); in_callback->hidlTvInputCallback = nullptr; return mAidlTvInput->setCallback(in_callback == nullptr ? nullptr : in_callback->aidlTvInputCallback); } } Loading
services/core/jni/tvinput/JTvInputHal.h +21 −5 Original line number Diff line number Diff line Loading @@ -168,23 +168,39 @@ private: JTvInputHal* mHal; }; class TvInputCallback : public HidlITvInputCallback, public BnTvInputCallback { class AidlTvInputCallback : public BnTvInputCallback { public: explicit TvInputCallback(JTvInputHal* hal); explicit AidlTvInputCallback(JTvInputHal* hal); ::ndk::ScopedAStatus notify(const AidlTvInputEvent& event) override; ::ndk::ScopedAStatus notifyTvMessageEvent(const AidlTvMessageEvent& event) override; private: JTvInputHal* mHal; }; class HidlTvInputCallback : public HidlITvInputCallback { public: explicit HidlTvInputCallback(JTvInputHal* hal); Return<void> notify(const HidlTvInputEvent& event) override; private: JTvInputHal* mHal; }; class TvInputCallbackWrapper { public: explicit TvInputCallbackWrapper(JTvInputHal* hal); std::shared_ptr<AidlTvInputCallback> aidlTvInputCallback; sp<HidlTvInputCallback> hidlTvInputCallback; }; class ITvInputWrapper { public: ITvInputWrapper(std::shared_ptr<AidlITvInput>& aidlTvInput); ITvInputWrapper(sp<HidlITvInput>& hidlTvInput); ::ndk::ScopedAStatus setCallback(const std::shared_ptr<TvInputCallback>& in_callback); ::ndk::ScopedAStatus setCallback( const std::shared_ptr<TvInputCallbackWrapper>& in_callback); ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId, std::vector<AidlTvStreamConfig>* _aidl_return); ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId, Loading @@ -198,7 +214,7 @@ private: ::ndk::ScopedAStatus getAidlInterfaceVersion(int32_t* _aidl_return); private: ::ndk::ScopedAStatus hidlSetCallback(const std::shared_ptr<TvInputCallback>& in_callback); ::ndk::ScopedAStatus hidlSetCallback(const sp<HidlTvInputCallback>& in_callback); ::ndk::ScopedAStatus hidlGetStreamConfigurations( int32_t in_deviceId, std::vector<AidlTvStreamConfig>* _aidl_return); ::ndk::ScopedAStatus hidlOpenStream(int32_t in_deviceId, int32_t in_streamId, Loading Loading @@ -229,7 +245,7 @@ private: KeyedVector<int, KeyedVector<int, Connection> > mConnections; std::shared_ptr<ITvInputWrapper> mTvInput; std::shared_ptr<TvInputCallback> mTvInputCallback; std::shared_ptr<TvInputCallbackWrapper> mTvInputCallback; }; } // namespace android
services/core/jni/tvinput/TvInputHal_hidl.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -59,7 +59,11 @@ JTvInputHal::TvInputEventWrapper JTvInputHal::TvInputEventWrapper::createEventWr return event; } Return<void> JTvInputHal::TvInputCallback::notify(const HidlTvInputEvent& event) { JTvInputHal::HidlTvInputCallback::HidlTvInputCallback(JTvInputHal* hal) { mHal = hal; } Return<void> JTvInputHal::HidlTvInputCallback::notify(const HidlTvInputEvent& event) { mHal->mLooper->sendMessage(new NotifyHandler(mHal, TvInputEventWrapper::createEventWrapper(event)), static_cast<int>(event.type)); Loading @@ -70,9 +74,8 @@ JTvInputHal::ITvInputWrapper::ITvInputWrapper(sp<HidlITvInput>& hidlTvInput) : mIsHidl(true), mHidlTvInput(hidlTvInput) {} ::ndk::ScopedAStatus JTvInputHal::ITvInputWrapper::hidlSetCallback( const std::shared_ptr<TvInputCallback>& in_callback) { mHidlTvInput->setCallback(in_callback == nullptr ? nullptr : sp<TvInputCallback>(in_callback.get())); const sp<HidlTvInputCallback>& in_callback) { mHidlTvInput->setCallback(in_callback); return ::ndk::ScopedAStatus::ok(); } Loading