diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_host_proxy.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_host_proxy.cpp index 8c52f2287c..78258b96bb 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_host_proxy.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_host_proxy.cpp @@ -123,6 +123,5 @@ napi_value JsUIServiceHostProxy::OnSendData(napi_env env, NapiCallbackInfo& info } return CreateJsUndefined(env); } - } } diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_proxy.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_proxy.cpp index 0ad14321a1..633f81e73d 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_proxy.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/js_ui_service_proxy.cpp @@ -77,6 +77,7 @@ napi_value JsUIServiceProxy::SendData(napi_env env, napi_callback_info info) napi_value JsUIServiceProxy::OnSendData(napi_env env, NapiCallbackInfo& info) { if (proxy_ == nullptr || hostProxy_ == nullptr) { + TAG_LOGE(AAFwkTag::UISERVC_EXT, "proxy_ or hostProxy_ is null"); ThrowError(env, AbilityErrorCode::ERROR_CODE_INNER); return CreateJsUndefined(env); } @@ -100,6 +101,5 @@ napi_value JsUIServiceProxy::OnSendData(napi_env env, NapiCallbackInfo& info) } return CreateJsUndefined(env); } - } } diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.cpp index ba397bbca9..e5599793f8 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.cpp @@ -19,14 +19,13 @@ #include "ability_manager_ipc_interface_code.h" #include "ipc_types.h" #include "hilog_tag_wrapper.h" -#include "hilog_wrapper.h" namespace OHOS { namespace AAFwk { using namespace AbilityRuntime; UIServiceHostProxy::UIServiceHostProxy(const sptr& impl) - :IRemoteProxy(impl) + :IRemoteProxy(impl) { TAG_LOGI(AAFwkTag::UISERVC_EXT, "called"); } @@ -59,9 +58,7 @@ int32_t UIServiceHostProxy::SendData(OHOS::AAFwk::WantParams &data) TAG_LOGE(AAFwkTag::UISERVC_EXT, "SendRequest failed, error %{public}d", error); return static_cast(AbilityErrorCode::ERROR_CODE_INNER); } - int32_t ret = reply.ReadInt32(); - return ret; -} - + return ERR_OK; +} } } diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.cpp index ec0d8e0285..cd41164693 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.cpp @@ -15,7 +15,6 @@ #include "ui_service_host_stub.h" #include "hilog_tag_wrapper.h" -#include "hilog_wrapper.h" namespace OHOS { namespace AAFwk { @@ -52,7 +51,7 @@ int UIServiceHostStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Messa int32_t UIServiceHostStub::OnSendData(MessageParcel& data, MessageParcel& reply) { - AAFwk::WantParams* wantParams = data.ReadParcelable(); + std::unique_ptr wantParams(data.ReadParcelable()); if (wantParams == nullptr) { TAG_LOGE(AAFwkTag::UISERVC_EXT, "UIServiceHostStub::OnSendData, read WantParams failed"); return ERR_INVALID_VALUE; @@ -64,6 +63,5 @@ int32_t UIServiceHostStub::OnSendData(MessageParcel& data, MessageParcel& reply) } return NO_ERROR; } - } } diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_proxy.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_proxy.cpp index d6dabfd38f..0bceb7d366 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_proxy.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_proxy.cpp @@ -19,7 +19,6 @@ #include "ability_manager_ipc_interface_code.h" #include "ipc_types.h" #include "hilog_tag_wrapper.h" -#include "hilog_wrapper.h" namespace OHOS { namespace AAFwk { @@ -51,7 +50,7 @@ int32_t UIServiceProxy::SendData(sptr hostProxy, OHOS::AAFwk::Wan return static_cast(AbilityErrorCode::ERROR_CODE_INNER); } if (!parcelData.WriteRemoteObject(hostProxy)) { - TAG_LOGE(AAFwkTag::UISERVC_EXT, "Write hostProxy failed."); + TAG_LOGE(AAFwkTag::UISERVC_EXT, "Write hostProxy failed."); return static_cast(AbilityErrorCode::ERROR_CODE_INNER); } if (!parcelData.WriteParcelable(&data)) { @@ -68,9 +67,7 @@ int32_t UIServiceProxy::SendData(sptr hostProxy, OHOS::AAFwk::Wan TAG_LOGE(AAFwkTag::UISERVC_EXT, "SendRequest failed, error %{public}d", error); return static_cast(AbilityErrorCode::ERROR_CODE_INNER); } - int32_t ret = reply.ReadInt32(); - return ret; -} - + return ERR_OK; +} } } diff --git a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.cpp b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.cpp index 1be7d0c1e2..0784f87af0 100644 --- a/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.cpp +++ b/frameworks/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.cpp @@ -15,7 +15,6 @@ #include "ui_service_stub.h" #include "hilog_tag_wrapper.h" -#include "hilog_wrapper.h" namespace OHOS { namespace AAFwk { @@ -57,7 +56,7 @@ int32_t UIServiceStub::OnSendData(MessageParcel& data, MessageParcel& reply) TAG_LOGE(AAFwkTag::UISERVC_EXT, "UIServiceStub::OnSendData, read hostProxy failed"); return ERR_INVALID_VALUE; } - AAFwk::WantParams* wantParams = data.ReadParcelable(); + std::unique_ptr wantParams(data.ReadParcelable()); if (wantParams == nullptr) { TAG_LOGE(AAFwkTag::UISERVC_EXT, "UIServiceStub::OnSendData, read WantParams failed"); return ERR_INVALID_VALUE; @@ -69,6 +68,5 @@ int32_t UIServiceStub::OnSendData(MessageParcel& data, MessageParcel& reply) } return NO_ERROR; } - } } diff --git a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_extension_connection_constants.h b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_extension_connection_constants.h new file mode 100644 index 0000000000..9e0901efe7 --- /dev/null +++ b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_extension_connection_constants.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_UISERVICEEXTENSION_CONNECTION_CONSTANTS_H +#define OHOS_ABILITY_RUNTIME_UISERVICEEXTENSION_CONNECTION_CONSTANTS_H + +namespace OHOS { +namespace AbilityRuntime { +constexpr const char* UISERVICEHOSTPROXY_KEY = "ohos.ability.params.UIServiceHostProxy"; +} // namespace AbilityRuntime +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_UISERVICEEXTENSION_CONNECTION_CONSTANTS_H diff --git a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.h b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.h index 9a6cc808ee..b7ab6f4ac8 100644 --- a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.h +++ b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_proxy.h @@ -13,14 +13,14 @@ * limitations under the License. */ +#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_PROXY_H +#define OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_PROXY_H + #include "iremote_broker.h" #include "iremote_object.h" #include "iremote_proxy.h" #include "ui_service_host_interface.h" -#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_PROXY_H -#define OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_PROXY_H - namespace OHOS { namespace AAFwk { diff --git a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.h b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.h index a444750680..7825c2c4dd 100644 --- a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.h +++ b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_host_stub.h @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_STUB_H +#define OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_STUB_H #include @@ -21,9 +23,6 @@ #include "message_parcel.h" #include "ui_service_host_interface.h" -#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_STUB_H -#define OHOS_ABILITY_RUNTIME_UI_SERVICE_HOST_STUB_H - namespace OHOS { namespace AAFwk { diff --git a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.h b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.h index 0f3dbe0bc0..53127e5f81 100644 --- a/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.h +++ b/interfaces/kits/native/ability/native/ui_service_extension_ability/connection/ui_service_stub.h @@ -12,14 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_STUB_H +#define OHOS_ABILITY_RUNTIME_UI_SERVICE_STUB_H #include #include #include "ui_service_interface.h" -#ifndef OHOS_ABILITY_RUNTIME_UI_SERVICE_STUB_H -#define OHOS_ABILITY_RUNTIME_UI_SERVICE_STUB_H - namespace OHOS { namespace AAFwk {