diff --git a/extension/extension_connection/BUILD.gn b/extension/extension_connection/BUILD.gn index 4bc46b06..0f610caf 100644 --- a/extension/extension_connection/BUILD.gn +++ b/extension/extension_connection/BUILD.gn @@ -31,7 +31,6 @@ ohos_shared_library("libwindowextension") { sources = [ "src/window_extension_connection.cpp", - "src/window_extension_connection_impl.cpp", "src/window_extension_server_proxy.cpp", "src/window_extension_server_stub.cpp", ] diff --git a/extension/extension_connection/include/window_extension_server_interface.h b/extension/extension_connection/include/window_extension_server_interface.h index 089bb50f..379c2e50 100644 --- a/extension/extension_connection/include/window_extension_server_interface.h +++ b/extension/extension_connection/include/window_extension_server_interface.h @@ -25,6 +25,7 @@ namespace OHOS { namespace Rosen { class IWindowExtensionServer : public IRemoteBroker { +public: DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowExtensionServer"); enum { TRANS_ID_ON_WINDOW_READY, diff --git a/extension/extension_connection/include/window_extension_server_proxy.h b/extension/extension_connection/include/window_extension_server_proxy.h index 721dc931..3fd8312c 100644 --- a/extension/extension_connection/include/window_extension_server_proxy.h +++ b/extension/extension_connection/include/window_extension_server_proxy.h @@ -22,14 +22,15 @@ namespace OHOS { namespace Rosen { class WindowExtensionServerProxy : public IRemoteProxy { +public: WindowExtensionServerProxy(const sptr &impl) : IRemoteProxy(impl) {}; ~WindowExtensionServerProxy() {}; void OnWindowReady(const std::shared_ptr& surfaceNode) override; void OnBackPress() override; - void OnKeyEvent(shared_ptr& keyEvent) override; - void OnPointerEvent(shared_ptr& pointerEvent) override; -} + void OnKeyEvent(std::shared_ptr& keyEvent) override; + void OnPointerEvent(std::shared_ptr& pointerEvent) override; +}; } // namespace Rosen } // namespace OHOS #endif // WINDOW_EXTESNION_SERVER_PROXY \ No newline at end of file diff --git a/extension/extension_connection/src/window_extension_connection.cpp b/extension/extension_connection/src/window_extension_connection.cpp index 4f340faf..081c6e81 100644 --- a/extension/extension_connection/src/window_extension_connection.cpp +++ b/extension/extension_connection/src/window_extension_connection.cpp @@ -15,11 +15,14 @@ #include "window_extension_connection.h" +#include "ability_connect_callback_stub.h" #include "ability_manager_client.h" #include "element_name.h" #include #include "window_manager_hilog.h" #include "wm_common.h" +#include "window_extension_client_proxy.h" +#include "window_extension_server_stub.h" namespace OHOS { namespace Rosen { @@ -27,14 +30,20 @@ namespace { constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowExtensionConnection"}; } +class WindowExtensionClientRecipient + : public IRemoteObject::DeathRecipient { + void OnRemoteDied(const wptr& remote); +}; + + class WindowExtensionConnection::Impl - : public AAFwk::AbilityConnectionStub, public RefBase { + : public AAFwk::AbilityConnectionStub { public: Impl() = default; ~Impl() = default; - void WindowExtensionConnection::Impl::OnAbilityConnectDone(const AppExecFwk::ElementName &element, + void OnAbilityConnectDone(const AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) override; - void WindowExtensionConnection::Impl::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override; + void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override; void ConnectExtension(const AppExecFwk::ElementName &element, Rect rect, uint32_t uid, sptr& callback); @@ -42,10 +51,15 @@ public: void Hide(); void Resize(Rect rect); void RequestFocus(); +private: + sptr stub_; + sptr componentCallback_; + sptr proxy_; + sptr deathRecipient_; }; WindowExtensionConnection::WindowExtensionConnection() -:: pImpl_(new Impl()) + : pImpl_(new Impl()) { } @@ -54,6 +68,7 @@ void WindowExtensionConnection::Impl::ConnectExtension(const AppExecFwk::Element { AAFwk::Want want; want.SetElement(element); + // TODO // want.SetParam(RECT_FORM_KEY_POS_X, rect.posX_); // want.SetParam(RECT_FORM_KEY_POS_Y, rect.posY_); // want.SetParam(RECT_FORM_KEY_WIDTH, rect.width_); @@ -90,7 +105,7 @@ void WindowExtensionConnection::Impl::RequestFocus() } } -void WindowExtensionConnection::Impp::OnAbilityConnectDone(const AppExecFwk::ElementName &element, +void WindowExtensionConnection::Impl::OnAbilityConnectDone(const AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) { if (!remoteObject) { @@ -125,22 +140,22 @@ void WindowExtensionConnection::Impl::OnAbilityDisconnectDone(const AppExecFwk:: void WindowExtensionConnection::ConnectExtension(const AppExecFwk::ElementName &element, Rect rect, uint32_t uid, sptr& callback) { - impl_->ConnectExtension(element, rect, uid, callback); + pImpl_->ConnectExtension(element, rect, uid, callback); } void WindowExtensionConnection::Show() { - impl_->Show(); + pImpl_->Show(); } void WindowExtensionConnection::Hide() { - impl_->Hide(); + pImpl_->Hide(); } void WindowExtensionConnection::RequestFocus() { - impl_->RequestFocus(); + pImpl_->RequestFocus(); } } // namespace Rosen } // namespace OHOS \ No newline at end of file diff --git a/extension/extension_connection/src/window_extension_server_proxy.cpp b/extension/extension_connection/src/window_extension_server_proxy.cpp index e2965be0..f06f3068 100644 --- a/extension/extension_connection/src/window_extension_server_proxy.cpp +++ b/extension/extension_connection/src/window_extension_server_proxy.cpp @@ -28,14 +28,14 @@ void WindowExtensionServerProxy::OnWindowReady(const std::shared_ptrMarshalling(data)) { WLOGFE("write surfaceNode failed"); return; } @@ -44,10 +44,10 @@ void WindowExtensionServerProxy::OnWindowReady(const std::shared_ptr& keyEvent) +void WindowExtensionServerProxy::OnKeyEvent(std::shared_ptr& keyEvent) { - MessageParcel message; - MeeeageParcel message; + MessageParcel data; + MessageParcel replay; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { @@ -70,10 +70,10 @@ void WindowExtensionClientProxy::OnKeyEvent(std::shared_ptr& keyE return; } - if (!keyEvent.Marshalling(data)) { - WLOGFE("write key event failed"); - return; - } + // if (!keyEvent->Marshalling(data)) { + // WLOGFE("write key event failed"); + // return; + // } if (Remote()->SendRequest(TRANS_ID_ON_KEY_EVENT, data, replay, option) != ERR_NONE) { WLOGFE("send request failed"); } @@ -81,8 +81,8 @@ void WindowExtensionClientProxy::OnKeyEvent(std::shared_ptr& keyE void WindowExtensionServerProxy::OnPointerEvent(std::shared_ptr& pointerEvent) { - MessageParcel message; - MeeeageParcel message; + MessageParcel data; + MessageParcel replay; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { @@ -90,10 +90,10 @@ void WindowExtensionServerProxy::OnPointerEvent(std::shared_ptrMarshalling(data)) { + // WLOGFE("write key event failed"); + // return; + // } if (Remote()->SendRequest(TRANS_ID_ON_POINTER_EVENT, data, replay, option) != ERR_NONE) { WLOGFE("send request failed"); } diff --git a/extension/extension_connection/src/window_extension_server_stub.cpp b/extension/extension_connection/src/window_extension_server_stub.cpp index fce48f50..658ce95e 100644 --- a/extension/extension_connection/src/window_extension_server_stub.cpp +++ b/extension/extension_connection/src/window_extension_server_stub.cpp @@ -40,7 +40,7 @@ int WindowExtensionServerStub::OnRemoteRequest(uint32_t code, MessageParcel &dat break; } } - retrun 0; + return 0; } } // namespace Rosen } // namespace OHOS \ No newline at end of file diff --git a/interfaces/innerkits/wm/window_extension_connection.h b/interfaces/innerkits/wm/window_extension_connection.h index ad392409..10076a60 100644 --- a/interfaces/innerkits/wm/window_extension_connection.h +++ b/interfaces/innerkits/wm/window_extension_connection.h @@ -29,6 +29,13 @@ namespace OHOS { namespace Rosen { +namespace { + const static std::string RECT_FORM_KEY_POS_X = "ext_pos_x"; + const static std::string RECT_FORM_KEY_POS_Y = "ext_pos_y"; + const static std::string RECT_FORM_KEY_HEIGHT = "ext_pos_heigh"; + const static std::string RECT_FORM_KEY_WIDTH = "ext_pos_width"; +} + class RSSurfaceNode; class IWindowExtensionCallback : virtual public RefBase { public: @@ -41,13 +48,13 @@ public: class WindowExtensionConnection : public RefBase { public: - WindowExtensionConnection() = default; + WindowExtensionConnection(); ~WindowExtensionConnection() = default; - virtual void ConnectExtension(const AppExecFwk::ElementName &element, Rect rect, - uint32_t uid, sptr& callback) = 0; - virtual void Show() = 0; - virtual void Hide() = 0; - virtual void RequestFocus() = 0; + void ConnectExtension(const AppExecFwk::ElementName &element, Rect rect, + uint32_t uid, sptr& callback); + void Show(); + void Hide(); + void RequestFocus(); private: class Impl;