From 60752d49650dd3352c54b6395af5648febb41e32 Mon Sep 17 00:00:00 2001 From: zhanglitao Date: Mon, 28 Jul 2025 15:32:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Node=E3=80=81Interface=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglitao --- .../rs_render_process_connection.cpp | 2678 +++++++++ .../rs_render_process_connection.h | 386 ++ .../rs_render_service_connection.cpp | 1686 +----- .../rs_render_service_connection.h | 193 - .../rs_render_process_connection_stub.cpp | 3018 ++++++++++ .../rs_render_process_connection_stub.h | 57 + .../rs_render_service_connection_stub.cpp | 2077 +------ .../rs_render_service_connection_stub.h | 9 - .../ohos/rs_irender_process_connection.h | 331 +- .../platform/ohos/rs_irender_service.h | 5 +- .../ohos/rs_irender_service_connection.h | 200 - .../transaction/rs_render_service_client.h | 4 + .../rs_render_process_connection_proxy.cpp | 4209 +++++++++++++- .../ohos/rs_render_process_connection_proxy.h | 323 +- .../ohos/rs_render_service_client.cpp | 762 +-- .../rs_render_service_connection_proxy.cpp | 5094 ++++------------- .../ohos/rs_render_service_connection_proxy.h | 202 - 17 files changed, 12793 insertions(+), 8441 deletions(-) create mode 100644 rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp create mode 100644 rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h create mode 100644 rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp create mode 100644 rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp new file mode 100644 index 0000000000..b23e782b8f --- /dev/null +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp @@ -0,0 +1,2678 @@ +/* + * Copyright (c) 2021-2023 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. + */ + +#include "rs_render_process_connection.h" +#include + +#include "frame_report.h" +#include "hgm_command.h" +#include "hgm_core.h" +#include "hgm_frame_rate_manager.h" +#include "offscreen_render/rs_offscreen_render_thread.h" +#include "rs_frame_report.h" +#include "rs_main_thread.h" +#include "rs_trace.h" +#include "rs_profiler.h" +//blur predict +#include "rs_frame_blur_predict.h" +#include "system/rs_system_parameters.h" + +#include "command/rs_command_verify_helper.h" +#include "command/rs_display_node_command.h" +#include "command/rs_surface_node_command.h" +#include "common/rs_background_thread.h" +#include "display_engine/rs_luminance_control.h" +#include "drawable/rs_canvas_drawing_render_node_drawable.h" +#include "feature/capture/rs_ui_capture.h" +#include "feature/capture/rs_uni_ui_capture.h" +#include "feature/capture/rs_surface_capture_task.h" +#include "feature/capture/rs_ui_capture_task_parallel.h" +#include "feature/capture/rs_ui_capture_solo_task_parallel.h" +#include "feature/capture/rs_surface_capture_task_parallel.h" +#include "feature/uifirst/rs_uifirst_frame_rate_control.h" +#include "gfx/fps_info/rs_surface_fps_manager.h" +#include "gfx/first_frame_notifier/rs_first_frame_notifier.h" +#ifdef RS_ENABLE_OVERLAY_DISPLAY +#include "feature/overlay_display/rs_overlay_display_manager.h" +#endif +#ifdef USE_M133_SKIA +#include "include/gpu/ganesh/GrDirectContext.h" +#else +#include "include/gpu/GrDirectContext.h" +#endif +#include "info_collection/rs_hdr_collection.h" +#ifdef RS_ENABLE_GPU +#include "feature/uifirst/rs_sub_thread_manager.h" +#endif +#include "feature/uifirst/rs_uifirst_manager.h" +#include "memory/rs_memory_manager.h" +#include "monitor/self_drawing_node_monitor.h" +#include "pipeline/rs_canvas_drawing_render_node.h" +#include "pipeline/rs_pointer_window_manager.h" +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR +#include "pipeline/magic_pointer_render/rs_magic_pointer_render_manager.h" +#endif +#include "pipeline/hardware_thread/rs_realtime_refresh_rate_manager.h" +#include "pipeline/rs_render_frame_rate_linker_map.h" +#include "pipeline/rs_render_node_gc.h" +#include "pipeline/rs_render_node_map.h" +#include "pipeline/main_thread/rs_render_service_listener.h" +#include "pipeline/rs_surface_buffer_callback_manager.h" +#include "pipeline/rs_surface_render_node.h" +#include "pipeline/rs_task_dispatcher.h" +#include "pipeline/rs_uni_render_judgement.h" +#include "pixel_map_from_surface.h" +#include "platform/common/rs_log.h" +#include "platform/common/rs_system_properties.h" +#include "platform/ohos/rs_jank_stats_helper.h" +#include "render/rs_typeface_cache.h" +#include "transaction/rs_unmarshal_thread.h" +#include "transaction/rs_transaction_data_callback_manager.h" +#include "graphic_feature_param_manager.h" + +#ifdef TP_FEATURE_ENABLE +#include "screen_manager/touch_screen.h" +#endif + +#ifdef RS_ENABLE_VK +#include "platform/ohos/backend/rs_vulkan_context.h" +#endif + +#if defined(RS_ENABLE_DVSYNC) +#include "dvsync.h" +#endif + +#undef LOG_TAG +#define LOG_TAG "RSRenderProcessConnection" + +namespace OHOS { +namespace Rosen { +namespace { +constexpr int SLEEP_TIME_US = 1000; +const std::string REGISTER_NODE = "RegisterNode"; +const std::string APS_SET_VSYNC = "APS_SET_VSYNC"; +constexpr uint32_t MEM_BYTE_TO_MB = 1024 * 1024; +} +// we guarantee that when constructing this object, +// all these pointers are valid, so will not check them. +RSRenderProcessConnection::RSRenderProcessConnection( + pid_t remotePid, + wptr renderService, + RSMainThread* mainThread, + sptr screenManager, + sptr token, + sptr distributor) + : remotePid_(remotePid), + renderService_(renderService), + mainThread_(mainThread), +#ifdef RS_ENABLE_GPU + renderThread_(RSUniRenderThread::Instance()), +#endif + screenManager_(screenManager), + token_(token), + connDeathRecipient_(new RSConnectionDeathRecipient(this)), + applicationDeathRecipient_(new RSApplicationRenderThreadDeathRecipient(this)), + appVSyncDistributor_(distributor) +{ + if (token_ == nullptr || !token_->AddDeathRecipient(connDeathRecipient_)) { + RS_LOGW("RSRenderProcessConnection: Failed to set death recipient."); + } + if (renderService_ == nullptr) { + RS_LOGW("RSRenderProcessConnection: renderService_ is nullptr"); + } + if (mainThread_ == nullptr) { + RS_LOGW("RSRenderProcessConnection: mainThread_ is nullptr"); + } + if (screenManager_ == nullptr) { + RS_LOGW("RSRenderProcessConnection: screenManager_ is nullptr"); + } + if (appVSyncDistributor_ == nullptr) { + RS_LOGW("RSRenderProcessConnection: appVSyncDistributor_ is nullptr"); + } +} + +RSRenderProcessConnection::~RSRenderProcessConnection() noexcept +{ + if (token_ && connDeathRecipient_) { + token_->RemoveDeathRecipient(connDeathRecipient_); + } + CleanAll(); +} + +void RSRenderProcessConnection::CleanVirtualScreens() noexcept +{ + std::lock_guard lock(mutex_); + + if (screenManager_ != nullptr) { + for (const auto id : virtualScreenIds_) { + screenManager_->RemoveVirtualScreen(id); + } + } + virtualScreenIds_.clear(); + + if (screenChangeCallback_ != nullptr && screenManager_ != nullptr) { + screenManager_->RemoveScreenChangeCallback(screenChangeCallback_); + screenChangeCallback_ = nullptr; + } +} + +void RSRenderProcessConnection::CleanRenderNodes() noexcept +{ + if (mainThread_ == nullptr) { + return; + } + auto& context = mainThread_->GetContext(); + auto& nodeMap = context.GetMutableNodeMap(); + + nodeMap.FilterNodeByPid(remotePid_); +} + +void RSRenderProcessConnection::CleanFrameRateLinkers() noexcept +{ + if (mainThread_ == nullptr) { + return; + } + auto& context = mainThread_->GetContext(); + auto& frameRateLinkerMap = context.GetMutableFrameRateLinkerMap(); + + frameRateLinkerMap.FilterFrameRateLinkerByPid(remotePid_); +} + +void RSRenderProcessConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexcept +{ + if (mainThread_ == nullptr) { + return; + } + auto& context = mainThread_->GetContext(); + auto& frameRateLinkerMap = context.GetMutableFrameRateLinkerMap(); + frameRateLinkerMap.UnRegisterExpectedFpsUpdateCallbackByListener(remotePid_); +} + +void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept +{ + { + std::lock_guard lock(mutex_); + if (cleanDone_) { + return; + } + } + if (!mainThread_) { + return; + } + RS_LOGD("CleanAll() start."); + RS_TRACE_NAME("RSRenderProcessConnection CleanAll begin, remotePid: " + std::to_string(remotePid_)); + RsCommandVerifyHelper::GetInstance().RemoveCntWithPid(remotePid_); + mainThread_->ScheduleTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (!connection) { + return; + } + RS_TRACE_NAME_FMT("CleanVirtualScreens %d", connection->remotePid_); + connection->CleanVirtualScreens(); + }).wait(); + mainThread_->ScheduleTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (!connection) { + return; + } + RS_TRACE_NAME_FMT("CleanRenderNodes %d", connection->remotePid_); + connection->CleanRenderNodes(); + connection->CleanFrameRateLinkers(); + connection->CleanFrameRateLinkerExpectedFpsCallbacks(); + }).wait(); + mainThread_->ScheduleTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + RS_TRACE_NAME_FMT("ClearTransactionDataPidInfo %d", connection->remotePid_); + connection->mainThread_->ClearTransactionDataPidInfo(connection->remotePid_); + }).wait(); + mainThread_->ScheduleTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + RS_TRACE_NAME_FMT("UnRegisterCallback %d", connection->remotePid_); + connection->mainThread_->UnRegisterOcclusionChangeCallback(connection->remotePid_); + connection->mainThread_->ClearSurfaceOcclusionChangeCallback(connection->remotePid_); + connection->mainThread_->UnRegisterUIExtensionCallback(connection->remotePid_); + }).wait(); + if (SelfDrawingNodeMonitor::GetInstance().IsListeningEnabled()) { + mainThread_->ScheduleTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (connection == nullptr) { + return; + } + auto &monitor = SelfDrawingNodeMonitor::GetInstance(); + monitor.UnRegisterRectChangeCallback(connection->remotePid_); + }).wait(); + } + RSSurfaceBufferCallbackManager::Instance().UnregisterSurfaceBufferCallback(remotePid_); + HgmTaskHandleThread::Instance().ScheduleTask([pid = remotePid_] () { + RS_TRACE_NAME_FMT("CleanHgmEvent %d", pid); + HgmConfigCallbackManager::GetInstance()->UnRegisterHgmConfigChangeCallback(pid); + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr != nullptr) { + frameRateMgr->CleanVote(pid); + } + }).wait(); + RSTypefaceCache::Instance().RemoveDrawingTypefacesByPid(remotePid_); + { + std::lock_guard lock(mutex_); + cleanDone_ = true; + } + + if (toDelete) { + auto renderService = renderService_.promote(); + if (renderService == nullptr) { + RS_LOGW("CleanAll() RenderService is dead."); + } else { + renderService->RemoveConnection(GetToken()); + } + } + + RS_LOGD("CleanAll() end."); + RS_TRACE_NAME("RSRenderProcessConnection CleanAll end, remotePid: " + std::to_string(remotePid_)); +} + +RSRenderProcessConnection::RSConnectionDeathRecipient::RSConnectionDeathRecipient( + wptr conn) : conn_(conn) +{ +} + +void RSRenderProcessConnection::RSConnectionDeathRecipient::OnRemoteDied(const wptr& token) +{ + auto tokenSptr = token.promote(); + if (tokenSptr == nullptr) { + RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: can't promote remote object."); + return; + } + + auto rsConn = conn_.promote(); + if (rsConn == nullptr) { + RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: RSRenderProcessConnection was dead, do nothing."); + return; + } + + if (rsConn->GetToken() != tokenSptr) { + RS_LOGI("RSConnectionDeathRecipient::OnRemoteDied: token doesn't match, ignore it."); + return; + } + + rsConn->CleanAll(true); +} + +RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::RSApplicationRenderThreadDeathRecipient( + wptr conn) : conn_(conn) +{} + +void RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::OnRemoteDied(const wptr& token) +{ + auto tokenSptr = token.promote(); + if (tokenSptr == nullptr) { + RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: can't promote remote object."); + return; + } + + auto rsConn = conn_.promote(); + if (rsConn == nullptr) { + RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: " + "RSRenderProcessConnection was dead, do nothing."); + return; + } + + RS_LOGD("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: Unregister."); + auto app = iface_cast(tokenSptr); + rsConn->UnRegisterApplicationAgent(app); +} + +ErrCode RSRenderProcessConnection::CommitTransaction(std::unique_ptr& transactionData) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + pid_t callingPid = GetCallingPid(); + bool isTokenTypeValid = true; + bool isNonSystemAppCalling = false; + RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemAppCalling); + bool shouldDrop = RSUnmarshalThread::Instance().ReportTransactionDataStatistics( + callingPid, transactionData.get(), isNonSystemAppCalling); + if (shouldDrop) { + RS_LOGW("CommitTransaction data droped"); + return ERR_INVALID_VALUE; + } + if (transactionData && transactionData->GetDVSyncUpdate()) { + mainThread_->DVSyncUpdate(transactionData->GetDVSyncTime(), transactionData->GetTimestamp()); + } + bool isProcessBySingleFrame = mainThread_->IsNeedProcessBySingleFrameComposer(transactionData); + if (isProcessBySingleFrame) { + mainThread_->ProcessDataBySingleFrameComposer(transactionData); + } else { + mainThread_->RecvRSTransactionData(transactionData); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::ExecuteSynchronousTask(const std::shared_ptr& task) +{ + if (task == nullptr || mainThread_ == nullptr) { + RS_LOGW("ExecuteSynchronousTask, task or main thread is null!"); + return ERR_INVALID_VALUE; + } + // After a synchronous task times out, it will no longer be executed. + auto isTimeout = std::make_shared(0); + std::weak_ptr isTimeoutWeak = isTimeout; + std::chrono::nanoseconds span(task->GetTimeout()); + mainThread_->ScheduleTask([task, mainThread = mainThread_, isTimeoutWeak] { + if (task == nullptr || mainThread == nullptr || isTimeoutWeak.expired()) { + return; + } + task->Process(mainThread->GetContext()); + }).wait_for(span); + isTimeout.reset(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetUniRenderEnabled(bool& enable) +{ + enable = RSUniRenderJudgement::IsUniRender(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, + bool& success) +{ + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } + auto node = DisplayNodeCommandHelper::CreateWithConfigInRS(mainThread_->GetContext(), nodeId, displayNodeConfig); + if (node == nullptr) { + RS_LOGE("RSRenderService::CreateDisplayNode fail"); + success = false; + return ERR_INVALID_VALUE; + } + std::function registerNode = [this, nodeId, node, &displayNodeConfig]() { + if (mainThread_ == nullptr) { + return; + } + auto& context = mainThread_->GetContext(); + auto& nodeMap = context.GetMutableNodeMap(); + nodeMap.RegisterRenderNode(node); + nodeMap.TraverseScreenNodes([&node, id = node->GetScreenId()](auto& screenNode) { + if (!screenNode || screenNode->GetScreenId() != id) { + return; + } + screenNode->AddChild(node); + }); + + DisplayNodeCommandHelper::SetDisplayMode(context, nodeId, displayNodeConfig); + }; + mainThread_->PostSyncTask(registerNode); + success = true; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +{ + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } + std::shared_ptr node = + SurfaceNodeCommandHelper::CreateWithConfigInRS(config, mainThread_->GetContext()); + if (node == nullptr) { + RS_LOGE("RSRenderService::CreateNode fail"); + success = false; + return ERR_INVALID_VALUE; + } + std::function registerNode = [node, weakThis = wptr(this)]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + connection->mainThread_->GetContext().GetMutableNodeMap().RegisterRenderNode(node); + }; + mainThread_->PostTask(registerNode); + success = true; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, + sptr& sfc, bool unobscured) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + std::shared_ptr node = + SurfaceNodeCommandHelper::CreateWithConfigInRS(config, mainThread_->GetContext(), unobscured); + if (node == nullptr) { + RS_LOGE("RSRenderService::CreateNodeAndSurface CreateNode fail"); + return ERR_INVALID_VALUE; + } + sptr surface = IConsumerSurface::Create(config.name); + if (surface == nullptr) { + RS_LOGE("RSRenderService::CreateNodeAndSurface get consumer surface fail"); + return ERR_INVALID_VALUE; + } + const std::string& surfaceName = surface->GetName(); + RS_LOGI("RsDebug RSRenderService::CreateNodeAndSurface node" + "id:%{public}" PRIu64 " name:%{public}s surface id:%{public}" PRIu64 " name:%{public}s", + node->GetId(), node->GetName().c_str(), + surface->GetUniqueId(), surfaceName.c_str()); + auto defaultUsage = surface->GetDefaultUsage(); + surface->SetDefaultUsage(defaultUsage | BUFFER_USAGE_MEM_DMA | BUFFER_USAGE_HW_COMPOSER); + node->GetRSSurfaceHandler()->SetConsumer(surface); + RSMainThread* mainThread = mainThread_; + std::function registerNode = [node, mainThread]() -> void { + if (auto preNode = mainThread->GetContext().GetNodeMap().GetRenderNode(node->GetId())) { + if (auto preSurfaceNode = node->ReinterpretCastTo()) { + RS_LOGE("CreateNodeAndSurface same id node:%{public}" PRIu64 ", name:%{public}s, type:%{public}d", + node->GetId(), preSurfaceNode->GetName().c_str(), preNode->GetType()); + } else { + RS_LOGE("CreateNodeAndSurface same id node:%{public}" PRIu64 ", type:%{public}d", node->GetId(), + preNode->GetType()); + } + usleep(SLEEP_TIME_US); + } + RS_LOGI("CreateNodeAndSurface RegisterRenderNode id:%{public}" PRIu64 ", name:%{public}s", node->GetId(), + node->GetName().c_str()); + mainThread->GetContext().GetMutableNodeMap().RegisterRenderNode(node); + }; + if (config.isSync) { + mainThread_->PostSyncTask(registerNode); + } else { + mainThread_->PostTask(registerNode, REGISTER_NODE, 0, AppExecFwk::EventQueue::Priority::VIP); + } + std::weak_ptr surfaceRenderNode(node); + sptr listener = new RSRenderServiceListener(surfaceRenderNode); + SurfaceError ret = surface->RegisterConsumerListener(listener); + if (ret != SURFACE_ERROR_OK) { + RS_LOGE("RSRenderService::CreateNodeAndSurface Register Consumer Listener fail"); + return ERR_INVALID_VALUE; + } + sptr producer = surface->GetProducer(); + sfc = Surface::CreateSurfaceAsProducer(producer); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetPixelMapByProcessId( + std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) +{ + if (mainThread_ == nullptr) { + repCode = INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + std::vector, std::string, RectI>> sfBufferInfoVector; + std::function getSurfaceBufferByPidTask = [weakThis = wptr(this), + &sfBufferInfoVector, pid]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + RS_TRACE_NAME_FMT("RSRenderProcessConnection::GetPixelMapByProcessId getSurfaceBufferByPidTask pid: %d", pid); + auto selfDrawingNodeVector = + connection->mainThread_->GetContext().GetMutableNodeMap().GetSelfDrawingNodeInProcess(pid); + for (auto iter = selfDrawingNodeVector.rbegin(); iter != selfDrawingNodeVector.rend(); ++iter) { + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(*iter); + if (auto surfaceNode = node->ReinterpretCastTo()) { + auto surfaceBuffer = surfaceNode->GetRSSurfaceHandler()->GetBuffer(); + auto surfaceBufferInfo = std::make_tuple(surfaceBuffer, surfaceNode->GetName(), + surfaceNode->GetRenderProperties().GetBoundsGeometry()->GetAbsRect()); + sfBufferInfoVector.push_back(surfaceBufferInfo); + } + } + }; + mainThread_->PostSyncTask(getSurfaceBufferByPidTask); + + for (uint32_t i = 0; i < sfBufferInfoVector.size(); i++) { + auto surfaceBuffer = std::get<0>(sfBufferInfoVector[i]); + if (surfaceBuffer) { + OHOS::Media::Rect rect = {0, 0, surfaceBuffer->GetWidth(), surfaceBuffer->GetHeight()}; + std::shared_ptr pixelmap = nullptr; + RSBackgroundThread::Instance().PostSyncTask([&surfaceBuffer, rect, &pixelmap]() { + pixelmap = Rosen::CreatePixelMapFromSurfaceBuffer(surfaceBuffer, rect); + }); + PixelMapInfo info; + info.pixelMap = pixelmap; + RectI absRect = std::get<2>(sfBufferInfoVector[i]); + info.location = {absRect.GetLeft(), absRect.GetTop(), absRect.GetWidth(), absRect.GetHeight(), i}; + info.nodeName = std::get<1>(sfBufferInfoVector[i]); + pixelMapInfoVector.push_back(info); + } else { + RS_LOGE("CreatePixelMapFromSurface surfaceBuffer is null"); + } + } + repCode = SUCCESS; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::CreatePixelMapFromSurface(sptr surface, + const Rect &srcRect, std::shared_ptr &pixelMap) +{ + OHOS::Media::Rect rect = { + .left = srcRect.x, + .top = srcRect.y, + .width = srcRect.w, + .height = srcRect.h, + }; + RSBackgroundThread::Instance().PostSyncTask([surface, rect, &pixelMap]() { + pixelMap = Rosen::CreatePixelMapFromSurface(surface, rect); + }); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) +{ + if (mainThread_ == nullptr) { + repCode = INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + mainThread_->ScheduleTask( + [info, mainThread = mainThread_]() { + // don't use 'this' to get mainThread poninter + mainThread->SetFocusAppInfo(info); + } + ); + repCode = SUCCESS; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetWatermark(const std::string& name, std::shared_ptr watermark, + bool& success) +{ + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } + mainThread_->SetWatermark(name, watermark); + success = true; + return ERR_OK; +} + +int32_t RSRenderProcessConnection::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) +{ + if (blackListVector.empty()) { + RS_LOGW("SetVirtualScreenBlackList blackList is empty."); + } + std::lock_guard lock(mutex_); + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetVirtualScreenBlackList(id, blackListVector); +} + +ErrCode RSRenderProcessConnection::SetVirtualScreenTypeBlackList( + ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) +{ + if (typeBlackListVector.empty()) { + RS_LOGW("SetVirtualScreenTypeBlackList typeBlackList is empty."); + } + std::lock_guard lock(mutex_); + if (!screenManager_) { + repCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + repCode = screenManager_->SetVirtualScreenTypeBlackList(id, typeBlackListVector); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::AddVirtualScreenBlackList( + ScreenId id, std::vector& blackListVector, int32_t& repCode) +{ + if (blackListVector.empty()) { + RS_LOGW("AddVirtualScreenBlackList blackList is empty."); + repCode = StatusCode::BLACKLIST_IS_EMPTY; + return ERR_INVALID_VALUE; + } + std::lock_guard lock(mutex_); + if (!screenManager_) { + repCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + repCode = screenManager_->AddVirtualScreenBlackList(id, blackListVector); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::RemoveVirtualScreenBlackList( + ScreenId id, std::vector& blackListVector, int32_t& repCode) +{ + if (blackListVector.empty()) { + RS_LOGW("RemoveVirtualScreenBlackList blackList is empty."); + repCode = StatusCode::BLACKLIST_IS_EMPTY; + return ERR_INVALID_VALUE; + } + std::lock_guard lock(mutex_); + if (!screenManager_) { + repCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + repCode = screenManager_->RemoveVirtualScreenBlackList(id, blackListVector); + return ERR_OK; +} + +int32_t RSRenderProcessConnection::SetVirtualScreenSecurityExemptionList( + ScreenId id, + const std::vector& securityExemptionList) +{ + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); +} + +int32_t RSRenderProcessConnection::SetScreenSecurityMask(ScreenId id, + std::shared_ptr securityMask) +{ + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetScreenSecurityMask(id, std::move(securityMask)); +} + +int32_t RSRenderProcessConnection::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, + bool supportRotation) +{ + if (screenManager_ == nullptr) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); +} + +int32_t RSRenderProcessConnection::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetCastScreenEnableSkipWindow(id, enable); +} + +int32_t RSRenderProcessConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->SetVirtualScreenSurface(id, surface); +} + +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR +int32_t RSRenderProcessConnection::SetPointerColorInversionConfig(float darkBuffer, + float brightBuffer, int64_t interval, int32_t rangeSize) +{ + RSMagicPointerRenderManager::GetInstance().SetPointerColorInversionConfig(darkBuffer, brightBuffer, + interval, rangeSize); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::SetPointerColorInversionEnabled(bool enable) +{ + RSMagicPointerRenderManager::GetInstance().SetPointerColorInversionEnabled(enable); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterPointerLuminanceChangeCallback( + sptr callback) +{ + if (!callback) { + RS_LOGE("RegisterPointerLuminanceChangeCallback: callback is nullptr"); + return StatusCode::INVALID_ARGUMENTS; + } + RSMagicPointerRenderManager::GetInstance().RegisterPointerLuminanceChangeCallback(remotePid_, callback); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::UnRegisterPointerLuminanceChangeCallback() +{ + RSMagicPointerRenderManager::GetInstance().UnRegisterPointerLuminanceChangeCallback(remotePid_); + return StatusCode::SUCCESS; +} +#endif + +void RSRenderProcessConnection::RemoveVirtualScreen(ScreenId id) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return; + } + screenManager_->RemoveVirtualScreen(id); + virtualScreenIds_.erase(id); + EventInfo event = { "VOTER_VIRTUALDISPLAY", REMOVE_VOTE }; + NotifyRefreshRateEvent(event); +} + +void RSRenderProcessConnection::SetScreenActiveMode(ScreenId id, uint32_t modeId) +{ + if (!screenManager_) { + return; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + return RSHardwareThread::Instance().ScheduleTask( + [=]() { screenManager_->SetScreenActiveMode(id, modeId); }).wait(); +#endif + } else if (mainThread_ != nullptr) { + return mainThread_->ScheduleTask( + [=]() { screenManager_->SetScreenActiveMode(id, modeId); }).wait(); + } +} + +void RSRenderProcessConnection::SyncFrameRateRange(FrameRateLinkerId id, + const FrameRateRange& range, int32_t animatorExpectedFrameRate) +{ + if (!mainThread_) { + return; + } + mainThread_->ScheduleTask( + [weakThis = wptr(this), id, &range, animatorExpectedFrameRate]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + auto& linkerMap = context.GetMutableFrameRateLinkerMap(); + auto linker = linkerMap.GetFrameRateLinker(id); + if (linker == nullptr) { + RS_LOGW("SyncFrameRateRange there is no frameRateLinker for id %{public}" PRIu64, id); + return; + } + linker->SetExpectedRange(range); + linker->SetAnimatorExpectedFrameRate(animatorExpectedFrameRate); + if (range.type_ != OHOS::Rosen::NATIVE_VSYNC_FRAME_RATE_TYPE) { + return; + } + auto appVSyncDistributor = connection->appVSyncDistributor_; + if (appVSyncDistributor == nullptr) { + return; + } + auto conn = appVSyncDistributor->GetVSyncConnection(id); + if (conn == nullptr) { + return; + } + std::weak_ptr weakPtr = linker; + conn->RegisterRequestNativeVSyncCallback([weakPtr]() { + RS_TRACE_NAME("NativeVSync request frame, update timepoint"); + auto linker = weakPtr.lock(); + if (linker == nullptr) { + return; + } + linker->UpdateNativeVSyncTimePoint(); + }); + }).wait(); +} + +void RSRenderProcessConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) +{ + if (!mainThread_) { + return; + } + mainThread_->ScheduleTask( + [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + auto& linkerMap = context.GetMutableFrameRateLinkerMap(); + auto linker = linkerMap.GetFrameRateLinker(id); + if (linker == nullptr) { + RS_LOGE("UnregisterFrameRateLinker there is no frameRateLinker for id %{public}" PRIu64, id); + return; + } + linkerMap.UnregisterFrameRateLinker(id); + }).wait(); +} + +ErrCode RSRenderProcessConnection::GetRefreshInfo(pid_t pid, std::string& enable) +{ + if (!mainThread_) { + enable = ""; + return ERR_INVALID_VALUE; + } + auto& context = mainThread_->GetContext(); + auto& nodeMap = context.GetMutableNodeMap(); + std::string surfaceName = nodeMap.GetSelfDrawSurfaceNameByPid(pid); + if (surfaceName.empty()) { + enable = ""; + return ERR_INVALID_VALUE; + } + std::string dumpString; + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + RSHardwareThread::Instance().ScheduleTask( + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return; + } + connection->screenManager_->FpsDump(dumpString, surfaceName); + }).wait(); +#endif + } else { + mainThread_->ScheduleTask( + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return; + } + connection->screenManager_->FpsDump(dumpString, surfaceName); + }).wait(); + } + enable = dumpString; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetRefreshInfoToSP(NodeId id, std::string& enable) +{ + if (!mainThread_) { + enable = ""; + return ERR_INVALID_VALUE; + } + std::string dumpString; + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + auto dumpTask = [weakThis = wptr(this), &dumpString, &id]() { + sptr connection = weakThis.promote(); + if (connection == nullptr) { + RS_LOGE("GetRefreshInfoToSP connection is nullptr"); + return; + } + if (connection->screenManager_ == nullptr) { + RS_LOGE("GetRefreshInfoToSP connection->screenManager_ is nullptr"); + return; + } + RSSurfaceFpsManager::GetInstance().Dump(dumpString, id); + }; + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + RSHardwareThread::Instance().ScheduleTask(dumpTask).wait(); +#endif + } else { + mainThread_->ScheduleTask(dumpTask).wait(); + } + enable = dumpString; + return ERR_OK; +} + +int32_t RSRenderProcessConnection::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +{ + if (!screenManager_) { + return StatusCode::SCREEN_MANAGER_NULL; + } + return screenManager_->SetPhysicalScreenResolution(id, width, height); +} + +int32_t RSRenderProcessConnection::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +{ + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + return RSHardwareThread::Instance().ScheduleTask( + [=]() { return screenManager_->SetVirtualScreenResolution(id, width, height); }).get(); +#else + return StatusCode::SCREEN_NOT_FOUND; +#endif + } else if (mainThread_ != nullptr) { + return mainThread_->ScheduleTask( + [=]() { return screenManager_->SetVirtualScreenResolution(id, width, height); }).get(); + } else { + return StatusCode::SCREEN_NOT_FOUND; + } +} + +ErrCode RSRenderProcessConnection::MarkPowerOffNeedProcessOneFrame() +{ + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType != UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { + return ERR_INVALID_VALUE; + } +#ifdef RS_ENABLE_GPU + renderThread_.PostTask( + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return; + } + connection->screenManager_->MarkPowerOffNeedProcessOneFrame(); + } + ); +#endif + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::RepaintEverything() +{ + if (mainThread_ == nullptr) { + RS_LOGE("RepaintEverything, mainThread_ is null, return"); + return ERR_INVALID_VALUE; + } + auto task = []() -> void { + RS_LOGI("RepaintEverything, setDirtyflag, forceRefresh in mainThread"); + RSMainThread::Instance()->SetDirtyFlag(); + RSMainThread::Instance()->ForceRefreshForUni(); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::ForceRefreshOneFrameWithNextVSync() +{ + if (!mainThread_) { + RS_LOGE("%{public}s mainThread_ is nullptr, return", __func__); + return ERR_INVALID_VALUE; + } + + auto task = [weakThis = wptr(this)]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + + RS_LOGI("ForceRefreshOneFrameWithNextVSync, setDirtyflag, forceRefresh in mainThread"); + connection->mainThread_->SetDirtyFlag(); + connection->mainThread_->RequestNextVSync(); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +void RSRenderProcessConnection::DisablePowerOffRenderControl(ScreenId id) +{ + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + renderThread_.PostTask( + [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return; + } + connection->screenManager_->DisablePowerOffRenderControl(id); + } + ); +#endif + } +} + +namespace { +void TakeSurfaceCaptureForUiParallel( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig, + const Drawing::Rect& specifiedAreaRect) +{ +#ifdef RS_ENABLE_GPU + RS_LOGI("TakeSurfaceCaptureForUiParallel nodeId:[%{public}" PRIu64 "], issync:%{public}s", id, + captureConfig.isSync ? "true" : "false"); + std::function captureTask = [id, callback, captureConfig, specifiedAreaRect]() { + RSUiCaptureTaskParallel::Capture(id, callback, captureConfig, specifiedAreaRect); + }; + auto& context = RSMainThread::Instance()->GetContext(); + if (captureConfig.isSync) { + context.GetUiCaptureHelper().InsertUiCaptureCmdsExecutedFlag(id, false); + RSMainThread::Instance()->AddUiCaptureTask(id, captureTask); + return; + } + + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); + if (!node) { + RS_LOGE("TakeSurfaceCaptureForUiParallel node is nullptr"); + callback->OnSurfaceCapture(id, captureConfig, nullptr); + return; + } + + if (node->IsOnTheTree() && !node->IsDirty() && !node->IsSubTreeDirty()) { + RSMainThread::Instance()->PostTask(captureTask); + } else { + RSMainThread::Instance()->AddUiCaptureTask(id, captureTask); + } +#endif +} + +void TakeSurfaceCaptureForUIWithUni(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig) +{ +#ifdef RS_ENABLE_GPU + std::function offscreenRenderTask = [id, callback, captureConfig]() -> void { + RS_LOGD("RSRenderService::TakeSurfaceCaptureForUIWithUni callback->OnOffscreenRender" + " nodeId:[%{public}" PRIu64 "]", id); + ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP, "RSRenderService::TakeSurfaceCaptureForUIWithUni"); + std::shared_ptr rsUniUICapture = std::make_shared(id, captureConfig); + std::shared_ptr pixelmap = rsUniUICapture->TakeLocalCapture(); + callback->OnSurfaceCapture(id, captureConfig, pixelmap.get()); + ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP); + }; + if (!captureConfig.isSync) { + RSOffscreenRenderThread::Instance().PostTask(offscreenRenderTask); + } else { + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr || !node->GetCommandExecuted()) { + RSOffscreenRenderThread::Instance().InSertCaptureTask(id, offscreenRenderTask); + return; + } + RSOffscreenRenderThread::Instance().PostTask(offscreenRenderTask); + node->SetCommandExecuted(false); + } +#endif +} +} + +void RSRenderProcessConnection::TakeSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, + const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions permissions) +{ + if (!mainThread_) { + RS_LOGE("%{public}s mainThread_ is nullptr", __func__); + return; + } + + std::function captureTask = [id, callback, captureConfig, blurParam, specifiedAreaRect, + screenCapturePermission = permissions.screenCapturePermission, + isSystemCalling = permissions.isSystemCalling, + selfCapture = permissions.selfCapture]() -> void { + RS_TRACE_NAME_FMT("RSRenderProcessConnection::TakeSurfaceCapture captureTask nodeId:[%" PRIu64 "]", id); + RS_LOGD("TakeSurfaceCapture captureTask begin nodeId:[%{public}" PRIu64 "]", id); + if (captureConfig.captureType == SurfaceCaptureType::UICAPTURE) { + // When the isSync flag in captureConfig is true, UI capture processes commands before capture. + // When the isSync flag in captureConfig is false, UI capture will check null node independently. + // Therefore, a null node is valid for UI capture. + auto uiCaptureHasPermission = selfCapture || isSystemCalling; + if (!uiCaptureHasPermission) { + RS_LOGE("TakeSurfaceCapture uicapture failed, nodeId:[%{public}" PRIu64 + "], isSystemCalling: %{public}u, selfCapture: %{public}u", + id, isSystemCalling, selfCapture); + callback->OnSurfaceCapture(id, captureConfig, nullptr); + return; + } + if (RSUniRenderJudgement::IsUniRender()) { + TakeSurfaceCaptureForUiParallel(id, callback, captureConfig, specifiedAreaRect); + } else { + TakeSurfaceCaptureForUIWithUni(id, callback, captureConfig); + } + return; + } + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr) { + RS_LOGE("TakeSurfaceCapture failed, node is nullptr"); + callback->OnSurfaceCapture(id, captureConfig, nullptr); + return; + } + auto displayCaptureHasPermission = screenCapturePermission && isSystemCalling; + auto surfaceCaptureHasPermission = blurParam.isNeedBlur ? isSystemCalling : (selfCapture || isSystemCalling); + if ((node->GetType() == RSRenderNodeType::LOGICAL_DISPLAY_NODE && !displayCaptureHasPermission) || + (node->GetType() == RSRenderNodeType::SURFACE_NODE && !surfaceCaptureHasPermission)) { + RS_LOGE("TakeSurfaceCapture failed, node type: %{public}u, " + "screenCapturePermission: %{public}u, isSystemCalling: %{public}u, selfCapture: %{public}u", + node->GetType(), screenCapturePermission, isSystemCalling, selfCapture); + callback->OnSurfaceCapture(id, captureConfig, nullptr); + return; + } + if (RSUniRenderJudgement::GetUniRenderEnabledType() == UniRenderEnabledType::UNI_RENDER_DISABLED) { + RS_LOGD("RSRenderService::TakeSurfaceCapture captureTaskInner nodeId:[%{public}" PRIu64 "]", id); + ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP, "RSRenderService::TakeSurfaceCapture"); + RSSurfaceCaptureTask task(id, captureConfig); + if (!task.Run(callback)) { + callback->OnSurfaceCapture(id, captureConfig, nullptr); + } + ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP); + } else { +#ifdef RS_ENABLE_GPU + RSSurfaceCaptureParam captureParam; + captureParam.id = id; + captureParam.config = captureConfig; + captureParam.isSystemCalling = isSystemCalling; + captureParam.blurParam = blurParam; + RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); + RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); +#endif + } + }; + mainThread_->PostTask(captureTask); +} + +std::vector>> RSRenderProcessConnection::TakeSurfaceCaptureSoloNode( + NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions permissions) +{ + RS_LOGI("TakeSurfaceCaptureSoloNode nodeId:[%{public}" PRIu64 "]", id); + std::vector>> pixelMapIdPairVector; + std::function captureTask = [id, captureConfig, &pixelMapIdPairVector, + isSystemCalling = permissions.isSystemCalling, + selfCapture = permissions.selfCapture]() { + RS_TRACE_NAME_FMT("RSRenderProcessConnection::TakeSurfaceCaptureSoloNode captureTask" + " nodeId:[%" PRIu64 "]", id); + RS_LOGI("TakeSurfaceCaptureSoloNode captureTask begin " + "nodeId:[%{public}" PRIu64 "]", id); + auto uiCaptureHasPermission = selfCapture || isSystemCalling; + if (!uiCaptureHasPermission) { + RS_LOGE("TakeSurfaceCaptureSoloNode " + "uicapturesolo failed, nodeId:[%{public}" PRIu64 + "], isSystemCalling: %{public}u, selfCapture: %{public}u", id, isSystemCalling, selfCapture); + return; + } + pixelMapIdPairVector = RSUiCaptureSoloTaskParallel::CaptureSoloNode(id, captureConfig); + }; + RSMainThread::Instance()->PostSyncTask(captureTask); + return pixelMapIdPairVector; +} + +void RSRenderProcessConnection::TakeSelfSurfaceCapture( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) +{ + if (!mainThread_) { + RS_LOGE("%{public}s mainThread_ is nullptr", __func__); + return; + } + bool isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( + RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::TAKE_SELF_SURFACE_CAPTURE"); + std::function selfCaptureTask = [id, callback, captureConfig, isSystemCalling]() -> void { + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr) { + RS_LOGE("TakeSelfSurfaceCapture failed, node is nullptr"); + if (callback) { + callback->OnSurfaceCapture(id, captureConfig, nullptr); + } + return; + } + RSSurfaceCaptureParam captureParam; + captureParam.id = id; + captureParam.config = captureConfig; + captureParam.isSystemCalling = isSystemCalling; + captureParam.isSelfCapture = true; + RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); + RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); + }; + mainThread_->PostTask(selfCaptureTask); +} + +ErrCode RSRenderProcessConnection::SetWindowFreezeImmediately(NodeId id, bool isFreeze, + sptr callback, const RSSurfaceCaptureConfig& captureConfig, + const RSSurfaceCaptureBlurParam& blurParam) +{ + if (!mainThread_) { + RS_LOGE("%{public}s mainThread_ is nullptr", __func__); + return ERR_INVALID_VALUE; + } + bool isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( + RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::SET_WINDOW_FREEZE_IMMEDIATELY"); + std::function setWindowFreezeTask = + [id, isFreeze, callback, captureConfig, blurParam, isSystemCalling]() -> void { + auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr) { + RS_LOGE("SetWindowFreezeImmediately failed, node is nullptr"); + if (callback) { + callback->OnSurfaceCapture(id, captureConfig, nullptr); + } + return; + } + node->SetStaticCached(isFreeze); + if (isFreeze) { + RSSurfaceCaptureParam captureParam; + captureParam.id = id; + captureParam.config = captureConfig; + captureParam.isSystemCalling = isSystemCalling; + captureParam.isFreeze = isFreeze; + captureParam.blurParam = blurParam; + RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); + RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); + } else { + RSSurfaceCaptureTaskParallel::ClearCacheImageByFreeze(id); + } + }; + mainThread_->PostTask(setWindowFreezeTask); + return ERR_OK; +} + +void RSRenderProcessConnection::TakeUICaptureInRange( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) +{ + TakeSurfaceCaptureForUiParallel(id, callback, captureConfig, {}); +} + +ErrCode RSRenderProcessConnection::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, + float positionZ, float positionW) +{ + if (mainThread_ == nullptr || screenManager_ == nullptr) { + return ERR_INVALID_VALUE; + } + + // adapt video scene pointer + if (screenManager_->GetCurrentVirtualScreenNum() > 0 || + !RSPointerWindowManager::Instance().GetIsPointerEnableHwc()) { + // when has virtual screen or pointer is enable hwc, we can't skip + RSPointerWindowManager::Instance().SetIsPointerCanSkipFrame(false); + RSMainThread::Instance()->RequestNextVSync(); + } else { + RSPointerWindowManager::Instance().SetIsPointerCanSkipFrame(true); + } + + RSPointerWindowManager::Instance().SetHwcNodeBounds(rsNodeId, positionX, positionY, + positionZ, positionW); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::RegisterApplicationAgent(uint32_t pid, sptr app) +{ + if (!mainThread_) { + RS_LOGE("RegisterApplicationAgent mainThread_ is nullptr"); + return ERR_INVALID_VALUE; + } + auto captureTask = [weakThis = wptr(this), pid, app]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + RS_LOGE("RegisterApplicationAgent connection or mainThread_ is nullptr"); + return; + } + connection->mainThread_->RegisterApplicationAgent(pid, app); + }; + mainThread_->PostTask(captureTask); + + app->AsObject()->AddDeathRecipient(applicationDeathRecipient_); + return ERR_OK; +} + +RSVirtualScreenResolution RSRenderProcessConnection::GetVirtualScreenResolution(ScreenId id) +{ + RSVirtualScreenResolution virtualScreenResolution; + if (!screenManager_) { + return virtualScreenResolution; + } + screenManager_->GetVirtualScreenResolution(id, virtualScreenResolution); + return virtualScreenResolution; +} + +ErrCode RSRenderProcessConnection::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) +{ + if (!screenManager_) { + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + RSHardwareThread::Instance().ScheduleTask( + [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); +#else + return screenModeInfo; +#endif + } else if (mainThread_ != nullptr) { + mainThread_->ScheduleTask( + [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) +{ +#ifdef RS_ENABLE_GPU + RSMainThread::Instance()->GetAppMemoryInMB(cpuMemSize, gpuMemSize); + gpuMemSize += RSSubThreadManager::Instance()->GetAppGpuMemoryInMB(); +#endif + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) +{ + if (!mainThread_ || !mainThread_->GetContext().GetNodeMap().ContainPid(pid)) { + return ERR_INVALID_VALUE; + } + bool enable; + if (GetUniRenderEnabled(enable) == ERR_OK && enable) { + renderThread_.PostSyncTask( + [weakThis = wptr(this), &memoryGraphic, &pid] { + sptr connection = weakThis.promote(); + if (connection == nullptr) { + return; + } + memoryGraphic = MemoryManager::CountPidMemory(pid, + connection->renderThread_.GetRenderEngine()->GetRenderContext()->GetDrGPUContext()); + }); + return ERR_OK; + } else { + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::GetMemoryGraphics(std::vector& memoryGraphics) +{ + bool res; + if (!mainThread_ || GetUniRenderEnabled(res) != ERR_OK || !res) { + return ERR_INVALID_VALUE; + } + + const auto& nodeMap = mainThread_->GetContext().GetNodeMap(); + std::vector pids; + nodeMap.TraverseSurfaceNodes([&pids] (const std::shared_ptr& node) { + auto pid = ExtractPid(node->GetId()); + if (std::find(pids.begin(), pids.end(), pid) == pids.end()) { + pids.emplace_back(pid); + } + }); + renderThread_.PostSyncTask( + [weakThis = wptr(this), &memoryGraphics, &pids] { + sptr connection = weakThis.promote(); + if (connection == nullptr) { + return; + } + MemoryManager::CountMemory(pids, + connection->renderThread_.GetRenderEngine()->GetRenderContext()->GetDrGPUContext(), memoryGraphics); + }); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::RegisterBufferClearListener( + NodeId id, sptr callback) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto registerBufferClearListener = + [id, callback, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return false; + } + if (auto node = connection->mainThread_->GetContext().GetNodeMap().GetRenderNode(id)) { + node->RegisterBufferClearListener(callback); + return true; + } + return false; + }; + mainThread_->PostTask(registerBufferClearListener); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto registerBufferAvailableListener = + [id, callback, isFromRenderThread, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return false; + } + if (auto node = connection->mainThread_->GetContext().GetNodeMap().GetRenderNode(id)) { + node->RegisterBufferAvailableListener(callback, isFromRenderThread); + return true; + } + return false; + }; + mainThread_->PostTask(registerBufferAvailableListener); + return ERR_OK; +} + +bool RSRenderProcessConnection::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return false; + } + return screenManager_->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); +} + +int32_t RSRenderProcessConnection::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) +{ + if (!screenManager_) { + return StatusCode::SCREEN_MANAGER_NULL; + } + return screenManager_->SetVirtualScreenAutoRotation(id, isAutoRotation); +} + +ErrCode RSRenderProcessConnection::SetGlobalDarkColorMode(bool isDark) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), isDark]() { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + RS_LOGE("SetGlobalDarkColorMode fail"); + return; + } + connection->mainThread_->SetGlobalDarkColorMode(isDark); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +bool RSRenderProcessConnection::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return false; + } + return screenManager_->SetVirtualMirrorScreenScaleMode(id, scaleMode); +} + +int32_t RSRenderProcessConnection::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) +{ + std::lock_guard lock(mutex_); + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + return screenManager_->GetScreenHDRCapability(id, screenHdrCapability); +} + +ErrCode RSRenderProcessConnection::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=, &pixelFormat]() { return screenManager_->GetPixelFormat(id, pixelFormat); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=, &pixelFormat]() { return screenManager_->GetPixelFormat(id, pixelFormat); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=]() { return screenManager_->SetPixelFormat(id, pixelFormat); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=]() { return screenManager_->SetPixelFormat(id, pixelFormat); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::GetScreenSupportedHDRFormats( + ScreenId id, std::vector& hdrFormats, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=, &hdrFormats]() { return screenManager_->GetScreenSupportedHDRFormats(id, hdrFormats); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=, &hdrFormats]() { return screenManager_->GetScreenSupportedHDRFormats(id, hdrFormats); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=, &hdrFormat]() { return screenManager_->GetScreenHDRFormat(id, hdrFormat); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=, &hdrFormat]() { return screenManager_->GetScreenHDRFormat(id, hdrFormat); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=]() { return screenManager_->SetScreenHDRFormat(id, modeIdx); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=]() { return screenManager_->SetScreenHDRFormat(id, modeIdx); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +{ + if (mainThread_ == nullptr) { + return ERR_INVALID_VALUE; + } + HdrStatus hdrStatusRet = HdrStatus::NO_HDR; + StatusCode resCodeRet = StatusCode::SCREEN_NOT_FOUND; + auto isTimeout = std::make_shared(0); + std::weak_ptr isTimeoutWeak = isTimeout; + auto task = [id, mainThread = mainThread_, &resCodeRet, &hdrStatusRet, isTimeoutWeak]() { + if (isTimeoutWeak.expired()) { + RS_LOGE("GetScreenHDRStatus time out, ScreenId: [%{public}" PRIu64 "]", id); + return; + } + std::shared_ptr screenNode = nullptr; + auto& nodeMap = mainThread->GetContext().GetNodeMap(); + nodeMap.TraverseScreenNodes([id, &screenNode](const std::shared_ptr& node) { + if (node && node->GetScreenId() == id) { + screenNode = node; + } + }); + if (screenNode == nullptr) { + resCodeRet = StatusCode::SCREEN_NOT_FOUND; + return; + } + hdrStatusRet = screenNode->GetLastDisplayHDRStatus(); + resCodeRet = StatusCode::SUCCESS; + }; + auto span = std::chrono::duration_cast(std::chrono::milliseconds(100)); // timeout 100 ms + if (mainThread_->ScheduleTask(task).wait_for(span) == std::future_status::timeout) { + isTimeout.reset(); + } + if (isTimeoutWeak.expired() && resCodeRet != StatusCode::SUCCESS) { + return ERR_TIMED_OUT; + } + if (resCodeRet == StatusCode::SUCCESS) { + hdrStatus = hdrStatusRet; + } + resCode = resCodeRet; + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); + return ERR_OK; +#else + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; +#endif + } else if (mainThread_ != nullptr) { + resCode = mainThread_->ScheduleTask( + [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); + return ERR_OK; + } else { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } +} + +ErrCode RSRenderProcessConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +{ + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } + std::promise result; + std::future future = result.get_future(); + RSMainThread* mainThread = mainThread_; +#ifdef RS_ENABLE_GPU + RSUniRenderThread* renderThread = &renderThread_; + auto getBitmapTask = [id, &bitmap, mainThread, renderThread, &result]() { + auto node = mainThread->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr) { + RS_LOGE("GetBitmap cannot find NodeId: [%{public}" PRIu64 "]", id); + result.set_value(false); + return; + } + if (node->GetType() != RSRenderNodeType::CANVAS_DRAWING_NODE) { + RS_LOGE("GetBitmap RenderNodeType != RSRenderNodeType::CANVAS_DRAWING_NODE"); + result.set_value(false); + return; + } + auto grContext = renderThread->GetRenderEngine()->GetRenderContext()->GetDrGPUContext(); + auto drawableNode = DrawableV2::RSRenderNodeDrawableAdapter::OnGenerate(node); + auto getDrawableBitmapTask = [drawableNode, &bitmap, grContext, &result]() { + bitmap = std::static_pointer_cast(drawableNode) + ->GetBitmap(grContext); + result.set_value(!bitmap.IsEmpty()); + }; + renderThread->PostTask(getDrawableBitmapTask); + }; + mainThread_->PostTask(getBitmapTask); +#endif + success = future.get(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetPixelmap(NodeId id, const std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) +{ + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } + std::promise result; + std::future future = result.get_future(); +#ifdef RS_ENABLE_GPU + RSMainThread* mainThread = mainThread_; + RSUniRenderThread* renderThread = &renderThread_; + auto getPixelMapTask = [id, pixelmap, rect, drawCmdList, mainThread, renderThread, &result]() { + auto node = mainThread->GetContext().GetNodeMap().GetRenderNode(id); + if (node == nullptr) { + RS_LOGD("GetPixelmap: cannot find NodeId: [%{public}" PRIu64 "]", id); + result.set_value(false); + return; + } + if (node->GetType() != RSRenderNodeType::CANVAS_DRAWING_NODE) { + RS_LOGE("GetPixelmap: RenderNodeType != RSRenderNodeType::CANVAS_DRAWING_NODE"); + result.set_value(false); + return; + } + + auto tid = node->GetTid(); // planning: id may change in subthread + auto drawableNode = DrawableV2::RSRenderNodeDrawableAdapter::OnGenerate(node); + if (drawableNode) { + tid = std::static_pointer_cast(drawableNode)->GetTid(); + } + auto getDrawablePixelmapTask = [drawableNode, pixelmap, rect, &result, tid, drawCmdList]() { + result.set_value(std::static_pointer_cast(drawableNode)-> + GetPixelmap(pixelmap, rect, tid, drawCmdList)); + }; + if (!node->IsOnTheTree()) { + node->ClearOp(); + } + if (tid == UNI_MAIN_THREAD_INDEX) { + if (!mainThread->IsIdle() && mainThread->GetContext().HasActiveNode(node)) { + result.set_value(false); + return; + } + result.set_value(node->GetPixelmap(pixelmap, rect, tid, drawCmdList)); + } else if (tid == UNI_RENDER_THREAD_INDEX) { + renderThread->PostTask(getDrawablePixelmapTask); + } else { + auto tidMap = RSSubThreadManager::Instance()->GetReThreadIndexMap(); + if (auto found = tidMap.find(tid); found != tidMap.end()) { + RSTaskDispatcher::GetInstance().PostTask(found->second, getDrawablePixelmapTask, false); + } else { + renderThread->PostTask(getDrawablePixelmapTask); + } + } + }; + mainThread_->PostTask(getPixelMapTask); +#endif + success = future.get(); + return ERR_OK; +} + +bool RSRenderProcessConnection::RegisterTypeface(uint64_t globalUniqueId, + std::shared_ptr& typeface) +{ + RS_LOGI("reg typeface, pid[%{public}d], familyname:%{public}s, uniqueid:%{public}u", + RSTypefaceCache::GetTypefacePid(globalUniqueId), typeface->GetFamilyName().c_str(), + RSTypefaceCache::GetTypefaceId(globalUniqueId)); + RSTypefaceCache::Instance().CacheDrawingTypeface(globalUniqueId, typeface); + return true; +} + +bool RSRenderProcessConnection::UnRegisterTypeface(uint64_t globalUniqueId) +{ + RS_LOGW("uneg typeface: pid[%{public}d], uniqueid:%{public}u", + RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); + RSTypefaceCache::Instance().AddDelayDestroyQueue(globalUniqueId); + return true; +} + +ErrCode RSRenderProcessConnection::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) +{ + if (!screenManager_) { + resCode = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + resCode = RSHardwareThread::Instance().ScheduleTask( + [=]() { return screenManager_->SetScreenSkipFrameInterval(id, skipFrameInterval); }).get(); +#else + resCode = StatusCode::SCREEN_NOT_FOUND; +#endif + } else { + if (!mainThread_) { + resCode = StatusCode::INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + resCode = mainThread_->ScheduleTask( + [=]() { return screenManager_->SetScreenSkipFrameInterval(id, skipFrameInterval); }).get(); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetVirtualScreenRefreshRate( + ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) +{ + if (!screenManager_) { + retVal = StatusCode::SCREEN_NOT_FOUND; + return ERR_INVALID_VALUE; + } + retVal = screenManager_->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate); + return ERR_OK; +} + +void RSRenderProcessConnection::SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) +{ + if (!screenManager_) { + return; + } + screenManager_->SetScreenOffset(id, offsetX, offsetY); +} + +void RSRenderProcessConnection::SetScreenFrameGravity(ScreenId id, int32_t gravity) +{ + auto task = [weakThis = wptr(this), id, gravity]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + context.GetNodeMap().TraverseScreenNodes([id, gravity](auto& node) { + if (node && node->GetScreenId() == id) { + node->GetMutableRenderProperties().SetFrameGravity(static_cast(gravity)); + } + }); + }; + mainThread_->PostTask(task); +} + +ErrCode RSRenderProcessConnection::RegisterOcclusionChangeCallback( + sptr callback, int32_t& repCode) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + repCode = StatusCode::INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + if (!callback) { + RS_LOGD("RegisterOcclusionChangeCallback: callback is nullptr"); + repCode = StatusCode::INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + mainThread_->RegisterOcclusionChangeCallback(remotePid_, callback); + repCode = StatusCode::SUCCESS; + return ERR_OK; +} + +int32_t RSRenderProcessConnection::RegisterSurfaceOcclusionChangeCallback( + NodeId id, sptr callback, std::vector& partitionPoints) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + return StatusCode::INVALID_ARGUMENTS; + } + if (!callback) { + RS_LOGD("RegisterSurfaceOcclusionChangeCallback: callback is nullptr"); + return StatusCode::INVALID_ARGUMENTS; + } + mainThread_->RegisterSurfaceOcclusionChangeCallback(id, remotePid_, callback, partitionPoints); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + return StatusCode::INVALID_ARGUMENTS; + } + mainThread_->UnRegisterSurfaceOcclusionChangeCallback(id); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterHgmConfigChangeCallback(sptr callback) +{ + std::lock_guard lock(mutex_); + if (!callback) { + RS_LOGD("RegisterHgmConfigChangeCallback: callback is nullptr"); + return StatusCode::INVALID_ARGUMENTS; + } + + HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { + HgmConfigCallbackManager::GetInstance()->RegisterHgmConfigChangeCallback(remotePid_, callback); + }); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterHgmRefreshRateModeChangeCallback( + sptr callback) +{ + std::lock_guard lock(mutex_); + if (!callback) { + RS_LOGD("RegisterHgmRefreshRateModeChangeCallback: callback is nullptr"); + return StatusCode::INVALID_ARGUMENTS; + } + + HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { + HgmConfigCallbackManager::GetInstance()->RegisterHgmRefreshRateModeChangeCallback(remotePid_, callback); + }); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterHgmRefreshRateUpdateCallback( + sptr callback) +{ + std::lock_guard lock(mutex_); + + HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { + HgmConfigCallbackManager::GetInstance()->RegisterHgmRefreshRateUpdateCallback(remotePid_, callback); + }); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterFirstFrameCommitCallback( + sptr callback) +{ + std::lock_guard lock(mutex_); + RSFirstFrameNotifier::GetInstance().RegisterFirstFrameCommitCallback(remotePid_, callback); + return StatusCode::SUCCESS; +} + +int32_t RSRenderProcessConnection::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, + sptr callback) +{ + if (dstPid == 0) { + return StatusCode::INVALID_ARGUMENTS; + } + + HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, dstPid, callback] () { + HgmConfigCallbackManager::GetInstance()->RegisterXComponentExpectedFrameRateCallback( + remotePid, dstPid, callback); + }); + + return StatusCode::SUCCESS; +} + +ErrCode RSRenderProcessConnection::SetAppWindowNum(uint32_t num) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), num]() -> void { + sptr connection = weakThis.promote(); + if (!connection || !connection->mainThread_) { + return; + } + connection->mainThread_->SetAppWindowNum(num); + }; + mainThread_->PostTask(task); + + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetSystemAnimatedScenes( + SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + success = false; + return ERR_INVALID_VALUE; + } +#ifdef RS_ENABLE_GPU + RSUifirstManager::Instance().OnProcessAnimateScene(systemAnimatedScenes); + success = mainThread_->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation); + return ERR_OK; +#else + success = false; + return ERR_INVALID_VALUE; +#endif +} + +void RSRenderProcessConnection::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) +{ + if (!mainThread_) { + return; + } + auto task = [weakThis = wptr(this), watermarkImg, isShow]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + connection->mainThread_->ShowWatermark(watermarkImg, isShow); + }; + mainThread_->PostTask(task); +} + +int32_t RSRenderProcessConnection::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) +{ + if (!screenManager_) { + return StatusCode::SCREEN_NOT_FOUND; + } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + return RSHardwareThread::Instance().ScheduleTask( + [weakThis = wptr(this), id, width, height]() -> int32_t { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return RS_CONNECTION_ERROR; + } + return connection->screenManager_->ResizeVirtualScreen(id, width, height); + } + ).get(); +#else + return StatusCode::SCREEN_NOT_FOUND; +#endif + } else if (mainThread_ != nullptr) { + return mainThread_->ScheduleTask( + [weakThis = wptr(this), id, width, height]() -> int32_t { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->screenManager_ == nullptr) { + return RS_CONNECTION_ERROR; + } + return connection->screenManager_->ResizeVirtualScreen(id, width, height); + } + ).get(); + } else { + return StatusCode::SCREEN_NOT_FOUND; + } +} + +ErrCode RSRenderProcessConnection::ReportJankStats() +{ +#ifdef RS_ENABLE_GPU + auto task = []() -> void { RSJankStats::GetInstance().ReportJankStats(); }; + renderThread_.PostTask(task); +#endif + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::NotifyLightFactorStatus(int32_t lightFactorStatus) +{ + HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, lightFactorStatus]() { + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr != nullptr) { + frameRateMgr->HandleLightFactorStatus(pid, lightFactorStatus); + } + }); + return ERR_OK; +} + +void RSRenderProcessConnection::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) +{ + if (!mainThread_) { + return; + } + mainThread_->NotifyPackageEvent(packageList); + HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, listSize, packageList]() { + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr != nullptr) { + frameRateMgr->HandlePackageEvent(pid, packageList); + } + }); +} + +void RSRenderProcessConnection::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, + const std::vector>& newConfig) +{ + HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, listSize, pkgName, newConfig] () { + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr != nullptr) { + frameRateMgr->HandleAppStrategyConfigEvent(pid, pkgName, newConfig); + } + }); +} + +ErrCode RSRenderProcessConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +{ + if (!appVSyncDistributor_) { + return ERR_INVALID_VALUE; + } + appVSyncDistributor_->SetQosVSyncRateByPidPublic(pid, rateDiscount, true); + return ERR_OK; +} + +bool RSRenderProcessConnection::NotifySoftVsyncRateDiscountEvent(uint32_t pid, + const std::string &name, uint32_t rateDiscount) +{ + if (!appVSyncDistributor_) { + return false; + } + + std::vector linkerIds = appVSyncDistributor_->GetVsyncNameLinkerIds(pid, name); + if (linkerIds.empty()) { + RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d linkerIds is nullptr.", + pid); + return false; + } + + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr == nullptr) { + RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d frameRateMgr is nullptr.", + pid); + return false; + } + + if (!frameRateMgr->SetVsyncRateDiscountLTPO(linkerIds, rateDiscount)) { + RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d Set LTPO fail.", + pid); + return false; + } + + VsyncError ret = appVSyncDistributor_->SetVsyncRateDiscountLTPS(pid, name, rateDiscount); + if (ret != VSYNC_ERROR_OK) { + RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d Set LTPS fail.", + pid); + return false; + } + + return true; +} + +ErrCode RSRenderProcessConnection::NotifyHgmConfigEvent(const std::string &eventName, bool state) +{ + HgmTaskHandleThread::Instance().PostTask([eventName, state] () { + auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); + if (frameRateMgr == nullptr) { + RS_LOGW("NotifyHgmConfigEvent: frameRateMgr is nullptr."); + return; + } + RS_LOGI("NotifyHgmConfigEvent: recive notify %{public}s, %{public}d", + eventName.c_str(), state); + if (eventName == "HGMCONFIG_HIGH_TEMP") { + frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_THERMAL_SUFFIX); + } else if (eventName == "IA_DRAG_SLIDE") { + frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_DRAGSLIDE_SUFFIX); + } else if (eventName == "IL_THROW_SLIDE") { + frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_THROWSLIDE_SUFFIX); + } + }); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) +{ + HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, id, expectedFrameRate] () { + HgmConfigCallbackManager::GetInstance()->SyncXComponentExpectedFrameRateCallback( + remotePid, id, expectedFrameRate); + }); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::ReportEventResponse(DataBaseRs info) +{ + auto task = [info]() -> void { + RSJankStats::GetInstance().SetReportEventResponse(info); + }; +#ifdef RS_ENABLE_GPU + renderThread_.PostTask(task); + RSUifirstManager::Instance().OnProcessEventResponse(info); +#endif + RSUifirstFrameRateControl::Instance().SetAnimationStartInfo(info); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::ReportEventComplete(DataBaseRs info) +{ + auto task = [info]() -> void { + RSJankStats::GetInstance().SetReportEventComplete(info); + }; +#ifdef RS_ENABLE_GPU + renderThread_.PostTask(task); + RSUifirstManager::Instance().OnProcessEventComplete(info); +#endif + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::ReportEventJankFrame(DataBaseRs info) +{ +#ifdef RS_ENABLE_GPU + bool isReportTaskDelayed = renderThread_.IsMainLooping(); + auto task = [info, isReportTaskDelayed]() -> void { + RSJankStats::GetInstance().SetReportEventJankFrame(info, isReportTaskDelayed); + }; + renderThread_.PostTask(task); +#endif + RSUifirstFrameRateControl::Instance().SetAnimationEndInfo(info); + return ERR_OK; +} + +void RSRenderProcessConnection::ReportRsSceneJankStart(AppInfo info) +{ + auto task = [info]() -> void { + RSJankStats::GetInstance().SetReportRsSceneJankStart(info); + }; + renderThread_.PostTask(task); +} + +void RSRenderProcessConnection::ReportRsSceneJankEnd(AppInfo info) +{ + auto task = [info]() -> void { + RSJankStats::GetInstance().SetReportRsSceneJankEnd(info); + }; + renderThread_.PostTask(task); +} + +ErrCode RSRenderProcessConnection::ReportGameStateData(GameStateData info) +{ + RS_LOGD("ReportGameStateData = %{public}s, uid = %{public}d, state = %{public}d, " + "pid = %{public}d renderTid = %{public}d ", + info.bundleName.c_str(), info.uid, info.state, info.pid, info.renderTid); + + FrameReport::GetInstance().SetGameScene(info.pid, info.state); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, + bool dynamicHardwareEnable) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), id, isEnabled, selfDrawingType, + dynamicHardwareEnable]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + auto node = context.GetNodeMap().GetRenderNode(id); + if (node) { + node->SetHardwareEnabled(isEnabled, selfDrawingType, dynamicHardwareEnable); + } + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +{ + if (!mainThread_) { + resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), id, needHidePrivacyContent]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + auto node = context.GetNodeMap().GetRenderNode(id); + if (node) { + node->SetHidePrivacyContent(needHidePrivacyContent); + } + }; + mainThread_->PostTask(task); + resCode = static_cast(RSInterfaceErrorCode::NO_ERROR); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetCacheEnabledForRotation(bool isEnabled) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [isEnabled]() { + RSSystemProperties::SetCacheEnabledForRotation(isEnabled); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +std::vector RSRenderProcessConnection::GetActiveDirtyRegionInfo() +{ +#ifdef RS_ENABLE_GPU + const auto& activeDirtyRegionInfos = GpuDirtyRegionCollection::GetInstance().GetActiveDirtyRegionInfo(); + GpuDirtyRegionCollection::GetInstance().ResetActiveDirtyRegionInfo(); + return activeDirtyRegionInfos; +#else + return {}; +#endif +} + +GlobalDirtyRegionInfo RSRenderProcessConnection::GetGlobalDirtyRegionInfo() +{ +#ifdef RS_ENABLE_GPU + const auto& globalDirtyRegionInfo = GpuDirtyRegionCollection::GetInstance().GetGlobalDirtyRegionInfo(); + GpuDirtyRegionCollection::GetInstance().ResetGlobalDirtyRegionInfo(); + return globalDirtyRegionInfo; +#else + return {}; +#endif +} + +ErrCode RSRenderProcessConnection::GetHdrOnDuration(int64_t& hdrOnDuration) +{ + auto rsHdrCollection = RsHdrCollection::GetInstance(); + if (rsHdrCollection == nullptr) { + return ERR_INVALID_VALUE; + } + hdrOnDuration = rsHdrCollection->GetHdrOnDuration(); + rsHdrCollection->ResetHdrOnDuration(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetVmaCacheStatus(bool flag) +{ +#ifdef RS_ENABLE_GPU + renderThread_.SetVmaCacheStatus(flag); +#endif + return ERR_OK; +} + +#ifdef TP_FEATURE_ENABLE +ErrCode RSRenderProcessConnection::SetTpFeatureConfig(int32_t feature, const char* config, + TpFeatureConfigType tpFeatureConfigType) +{ + switch (tpFeatureConfigType) { + case TpFeatureConfigType::DEFAULT_TP_FEATURE: { + if (TOUCH_SCREEN->SetFeatureConfig(feature, config) < 0) { + RS_LOGW("SetTpFeatureConfig: SetFeatureConfig failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; + } + case TpFeatureConfigType::AFT_TP_FEATURE: { + if (TOUCH_SCREEN->SetAftConfig(config) < 0) { + RS_LOGW("SetTpFeatureConfig: SetAftConfig failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; + } + default: { + RS_LOGW("SetTpFeatureConfig: unknown TpFeatureConfigType: %" PRIu8"", + static_cast(tpFeatureConfigType)); + return ERR_INVALID_VALUE; + } + } +} +#endif + +void RSRenderProcessConnection::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) +{ + if (isVirtualScreenUsingStatus) { + EventInfo event = { "VOTER_VIRTUALDISPLAY", ADD_VOTE, OLED_60_HZ, OLED_60_HZ }; + NotifyRefreshRateEvent(event); + } else { + EventInfo event = { "VOTER_VIRTUALDISPLAY", REMOVE_VOTE }; + NotifyRefreshRateEvent(event); + } + return; +} + +ErrCode RSRenderProcessConnection::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), isCurtainScreenOn]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + connection->mainThread_->SetCurtainScreenUsingStatus(isCurtainScreenOn); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::DropFrameByPid(const std::vector pidList) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + mainThread_->ScheduleTask( + [weakThis = wptr(this), pidList]() { + // don't use 'this' directly + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + connection->mainThread_->AddPidNeedDropFrame(pidList); + } + ); + return ERR_OK; +} + +int32_t RSRenderProcessConnection::RegisterUIExtensionCallback(uint64_t userId, sptr callback, + bool unobscured) +{ + std::lock_guard lock(mutex_); + if (!mainThread_) { + return StatusCode::INVALID_ARGUMENTS; + } + if (!callback) { + RS_LOGE("RegisterUIExtensionCallback register null callback, failed."); + return StatusCode::INVALID_ARGUMENTS; + } + mainThread_->RegisterUIExtensionCallback(remotePid_, userId, callback, unobscured); + return StatusCode::SUCCESS; +} + +ErrCode RSRenderProcessConnection::SetVirtualScreenStatus(ScreenId id, + VirtualScreenStatus screenStatus, bool& success) +{ + if (!screenManager_) { + success = false; + return StatusCode::SCREEN_NOT_FOUND; + } + RS_LOGD("SetVirtualScreenStatus ScreenId:%{public}" PRIu64 " screenStatus:%{public}d", + id, screenStatus); + success = screenManager_->SetVirtualScreenStatus(id, screenStatus); + return StatusCode::SUCCESS; +} + +ErrCode RSRenderProcessConnection::SetAncoForceDoDirect(bool direct, bool& res) +{ + std::lock_guard lock(mutex_); + if (mainThread_ == nullptr) { + res = false; + return ERR_INVALID_VALUE; + } + mainThread_->SetAncoForceDoDirect(direct); + res = true; + return ERR_OK; +} + +void RSRenderProcessConnection::SetFreeMultiWindowStatus(bool enable) +{ +#ifdef RS_ENABLE_GPU + if (mainThread_ == nullptr) { + return; + } + auto task = [enable]() -> void { + RSUifirstManager::Instance().SetFreeMultiWindowStatus(enable); + }; + mainThread_->PostTask(task); +#endif +} + +ErrCode RSRenderProcessConnection::RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, + sptr callback) +{ + RSSurfaceBufferCallbackManager::Instance().RegisterSurfaceBufferCallback(pid, uid, callback); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) +{ + RSSurfaceBufferCallbackManager::Instance().UnregisterSurfaceBufferCallback(pid, uid); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) +{ + if (mainThread_ == nullptr) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), nodeIdStr, isForceRefresh]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + context.GetNodeMap().TraverseSurfaceNodes( + [&nodeIdStr, &isForceRefresh](const std::shared_ptr& surfaceNode) mutable { + if ((surfaceNode != nullptr) && (surfaceNode->GetName() == nodeIdStr) && + (surfaceNode->GetSurfaceNodeType() == RSSurfaceNodeType::SELF_DRAWING_NODE)) { + surfaceNode->SetForceRefresh(isForceRefresh); + return; + } + }); + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +void RSRenderProcessConnection::RegisterTransactionDataCallback(uint64_t token, + uint64_t timeStamp, sptr callback) +{ + RSTransactionDataCallbackManager::Instance().RegisterTransactionDataCallback(token, timeStamp, callback); +} + +void RSRenderProcessConnection::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) +{ + if (mainThread_ == nullptr) { + return; + } + auto task = [weakThis = wptr(this), nodeIdStr, isColorFollow]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& context = connection->mainThread_->GetContext(); + context.GetNodeMap().TraverseSurfaceNodes( + [&nodeIdStr, &isColorFollow](const std::shared_ptr& surfaceNode) mutable { + if ((surfaceNode != nullptr) && (surfaceNode->GetName() == nodeIdStr) && + (surfaceNode->GetSurfaceNodeType() == RSSurfaceNodeType::SELF_DRAWING_NODE)) { + surfaceNode->SetColorFollow(isColorFollow); + return; + } + }); + connection->mainThread_->SetDirtyFlag(); + connection->mainThread_->RequestNextVSync(); + }; + mainThread_->PostTask(task); +} + +ErrCode RSRenderProcessConnection::SetWindowContainer(NodeId nodeId, bool value) +{ + if (!mainThread_) { + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), nodeId, value]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + auto& nodeMap = connection->mainThread_->GetContext().GetNodeMap(); + if (auto node = nodeMap.GetRenderNode(nodeId)) { + auto displayNodeId = node->GetLogicalDisplayNodeId(); + if (auto displayNode = nodeMap.GetRenderNode(displayNodeId)) { + RS_LOGD("SetWindowContainer nodeId: %{public}" PRIu64 ", value: %{public}d", + nodeId, value); + displayNode->SetWindowContainer(value ? node : nullptr); + } else { + RS_LOGE("SetWindowContainer displayNode is nullptr, nodeId: %{public}" + PRIu64, displayNodeId); + } + } else { + RS_LOGE("SetWindowContainer node is nullptr, nodeId: %{public}" PRIu64, + nodeId); + } + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +bool RSRenderProcessConnection::GetHighContrastTextState() +{ + return RSBaseRenderEngine::IsHighContrastEnabled(); +} + +ErrCode RSRenderProcessConnection::AvcodecVideoStart( + uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) +{ + RSJankStats::GetInstance().AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +{ + RSJankStats::GetInstance().AvcodecVideoStop(uniqueId, surfaceName, fps); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::SetBehindWindowFilterEnabled(bool enabled) +{ + if (!mainThread_) { + RS_LOGE("SetBehindWindowFilterEnabled mainThread_ is nullptr."); + return ERR_INVALID_VALUE; + } + auto task = [weakThis = wptr(this), enabled]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + return; + } + if (RSSystemProperties::GetBehindWindowFilterEnabled() == enabled) { + return; + } + RSSystemProperties::SetBehindWindowFilterEnabled(enabled); + auto& nodeMap = connection->mainThread_->GetContext().GetNodeMap(); + bool needRequestNextVSync = false; + nodeMap.TraverseSurfaceNodes( + [&needRequestNextVSync](const std::shared_ptr& surfaceNode) mutable { + if (!surfaceNode) { + return; + } + if (!surfaceNode->NeedUpdateDrawableBehindWindow()) { + return; + } + surfaceNode->SetContentDirty(); + needRequestNextVSync = true; + }); + if (needRequestNextVSync) { + connection->mainThread_->RequestNextVSync(); + connection->mainThread_->SetForceUpdateUniRenderFlag(true); + } + }; + mainThread_->PostTask(task); + return ERR_OK; +} + +ErrCode RSRenderProcessConnection::GetBehindWindowFilterEnabled(bool& enabled) +{ + enabled = RSSystemProperties::GetBehindWindowFilterEnabled(); + return ERR_OK; +} + +int32_t RSRenderProcessConnection::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) +{ + MemorySnapshotInfo memorySnapshotInfo; + + bool ret = MemorySnapshot::Instance().GetMemorySnapshotInfoByPid(pid, memorySnapshotInfo); + if (!ret) { + RS_LOGD("RSRenderProcessConnection::GetPidGpuMemoryInMB fail to find pid!"); + return ERR_INVALID_VALUE; + } + gpuMemInMB = static_cast(memorySnapshotInfo.gpuMemory) / MEM_BYTE_TO_MB; + RS_LOGD("RSRenderProcessConnection::GetPidGpuMemoryInMB called succ"); + return ERR_OK; +} + +RetCodeHrpService RSRenderProcessConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, + const std::string& fileName, int32_t flags, int& outFd) +{ +#ifdef RS_PROFILER_ENABLED + if (fileName.length() == 0 || !HrpServiceValidDirOrFileName(fileName)) { + return RET_HRP_SERVICE_ERR_INVALID_PARAM; + } + + return RSProfiler::HrpServiceOpenFile(dirInfo, fileName, flags, outFd); +#else + outFd = -1; + return RET_HRP_SERVICE_ERR_UNSUPPORTED; +#endif +} + +RetCodeHrpService RSRenderProcessConnection::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, + uint32_t firstFileIndex, std::vector& outFiles) +{ +#ifdef RS_PROFILER_ENABLED + return RSProfiler::HrpServicePopulateFiles(dirInfo, firstFileIndex, outFiles); +#else + outFiles.clear(); + return RET_HRP_SERVICE_ERR_UNSUPPORTED; +#endif +} + +bool RSRenderProcessConnection::ProfilerIsSecureScreen() +{ +#ifdef RS_PROFILER_ENABLED + if (!RSSystemProperties::GetProfilerEnabled()) { + return false; + } + return RSProfiler::IsSecureScreen(); +#else + return false; +#endif +} + +void RSRenderProcessConnection::ClearUifirstCache(NodeId id) +{ + if (!mainThread_) { + return; + } + auto task = [id]() -> void { + RSUifirstManager::Instance().AddMarkedClearCacheNode(id); + }; + mainThread_->PostTask(task); +} +} // namespace Rosen +} // namespace OHOS diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h new file mode 100644 index 0000000000..331ee6aa20 --- /dev/null +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2021-2023 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 RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H +#define RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H + +#include +#include + +#include "hgm_config_callback_manager.h" +#include "ipc_callbacks/buffer_available_callback.h" +#include "ipc_callbacks/buffer_clear_callback.h" +#include "pipeline/hardware_thread/rs_hardware_thread.h" +#include "pipeline/render_thread/rs_uni_render_thread.h" +#include "pipeline/main_thread/rs_render_service.h" +#include "screen_manager/rs_screen_manager.h" +#include "transaction/rs_render_process_connection_stub.h" +#include "vsync_distributor.h" + +namespace OHOS { +namespace Rosen { +class HgmFrameRateManager; +class RSRenderProcessConnection : public RSRenderProcessConnectionStub { +public: + RSRenderProcessConnection( + pid_t remotePid, + wptr renderService, + RSMainThread* mainThread, + sptr screenManager, + sptr token, + sptr distributor); + ~RSRenderProcessConnection() noexcept; + RSRenderProcessConnection(const RSRenderProcessConnection&) = delete; + RSRenderProcessConnection& operator=(const RSRenderProcessConnection&) = delete; + + sptr GetToken() const + { + return token_; + } + +private: + void CleanVirtualScreens() noexcept; + void CleanRenderNodes() noexcept; + void CleanFrameRateLinkers() noexcept; + void CleanFrameRateLinkerExpectedFpsCallbacks() noexcept; + void CleanAll(bool toDelete = false) noexcept; + + // IPC RSIRenderProcessConnection Interfaces + ErrCode CommitTransaction(std::unique_ptr& transactionData) override; + ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) override; + ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) override; + ErrCode GetMemoryGraphics(std::vector& memoryGraphics) override; + ErrCode GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) override; + ErrCode GetUniRenderEnabled(bool& enable) override; + + ErrCode CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) override; + ErrCode CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) override; + ErrCode CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, + bool unobscured = false) override; + + ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) override; + + ErrCode CreatePixelMapFromSurface(sptr surface, + const Rect &srcRect, std::shared_ptr &pixelMap) override; + + ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) override; + + int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) override; + + ErrCode SetVirtualScreenTypeBlackList( + ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) override; + + ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; + + ErrCode RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; + + int32_t SetVirtualScreenSecurityExemptionList( + ScreenId id, const std::vector& securityExemptionList) override; + + int32_t SetScreenSecurityMask(ScreenId id, + std::shared_ptr securityMask) override; + + int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false) override; + + int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override; + + int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) override; + + void RemoveVirtualScreen(ScreenId id) override; + +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR + int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, + int64_t interval, int32_t rangeSize) override; + + int32_t SetPointerColorInversionEnabled(bool enable) override; + + int32_t RegisterPointerLuminanceChangeCallback(sptr callback) override; + + int32_t UnRegisterPointerLuminanceChangeCallback() override; +#endif + + void SetScreenActiveMode(ScreenId id, uint32_t modeId) override; + + void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, + int32_t animatorExpectedFrameRate) override; + + void UnregisterFrameRateLinker(FrameRateLinkerId id) override; + + ErrCode GetRefreshInfo(pid_t pid, std::string& enable) override; + ErrCode GetRefreshInfoToSP(NodeId id, std::string& enable) override; + + int32_t SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; + + int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; + + ErrCode MarkPowerOffNeedProcessOneFrame() override; + + ErrCode RepaintEverything() override; + + ErrCode ForceRefreshOneFrameWithNextVSync() override; + + void DisablePowerOffRenderControl(ScreenId id) override; + + void TakeSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, + const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; + + std::vector>> TakeSurfaceCaptureSoloNode( + NodeId id, const RSSurfaceCaptureConfig& captureConfig, + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; + + void TakeSelfSurfaceCapture( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; + + ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) override; + + void TakeUICaptureInRange( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; + + ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, + float positionZ, float positionW) override; + + ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) override; + + RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override; + + ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& info) override; + + ErrCode RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) override; + + ErrCode RegisterBufferClearListener( + NodeId id, sptr callback) override; + + bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) override; + + int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) override; + + bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) override; + + ErrCode SetGlobalDarkColorMode(bool isDark) override; + + int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override; + + ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) override; + + ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) override; + + ErrCode GetScreenSupportedHDRFormats( + ScreenId id, std::vector& hdrFormats, int32_t& resCode) override; + + ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) override; + + ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) override; + + ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) override; + + ErrCode GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) override; + + ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) override; + ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) override; + bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) override; + bool UnRegisterTypeface(uint64_t globalUniqueId) override; + + ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) override; + + ErrCode SetVirtualScreenRefreshRate( + ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) override; + + void SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) override; + + void SetScreenFrameGravity(ScreenId id, int32_t gravity) override; + + ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) override; + + int32_t RegisterSurfaceOcclusionChangeCallback( + NodeId id, sptr callback, std::vector& partitionPoints) override; + + int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) override; + + int32_t RegisterHgmConfigChangeCallback(sptr callback) override; + + int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) override; + + int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) override; + + int32_t RegisterFirstFrameCommitCallback(sptr callback) override; + + int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, + sptr callback) override; + + ErrCode SetAppWindowNum(uint32_t num) override; + + ErrCode SetSystemAnimatedScenes( + SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) override; + + void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) override; + + ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) override; + + int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) override; + + ErrCode ReportJankStats() override; + + ErrCode ReportEventResponse(DataBaseRs info) override; + + ErrCode ReportEventComplete(DataBaseRs info) override; + + ErrCode ReportEventJankFrame(DataBaseRs info) override; + + void ReportRsSceneJankStart(AppInfo info) override; + + void ReportRsSceneJankEnd(AppInfo info) override; + + ErrCode ReportGameStateData(GameStateData info) override; + + ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, + bool dynamicHardwareEnable) override; + + ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) override; + + ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) override; + + void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) override; + + void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, + const std::vector>& newConfig) override; + + ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) override; + + bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) override; + + ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) override; + + ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) override; + + ErrCode SetCacheEnabledForRotation(bool isEnabled) override; + + ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) override; + + std::vector GetActiveDirtyRegionInfo() override; + + GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() override; + + ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) override; + + ErrCode SetVmaCacheStatus(bool flag) override; + + int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, + bool unobscured = false) override; + +#ifdef TP_FEATURE_ENABLE + ErrCode SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) override; +#endif + + void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) override; + ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) override; + + ErrCode DropFrameByPid(const std::vector pidList) override; + + ErrCode SetAncoForceDoDirect(bool direct, bool& res) override; + + void SetFreeMultiWindowStatus(bool enable) override; + + ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) override; + + void RegisterTransactionDataCallback(uint64_t token, + uint64_t timeStamp, sptr callback) override; + + void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override; + + ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, + sptr callback) override; + ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) override; + + ErrCode SetWindowContainer(NodeId nodeId, bool value) override; + + bool GetHighContrastTextState() override; + + ErrCode SetBehindWindowFilterEnabled(bool enabled) override; + + ErrCode GetBehindWindowFilterEnabled(bool& enabled) override; + + ErrCode AvcodecVideoStart(uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) override; + + ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) override; + + int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) override; + + RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, + const std::string& fileName, int32_t flags, int& outFd) override; + RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, + uint32_t firstFileIndex, std::vector& outFiles) override; + bool ProfilerIsSecureScreen() override; + + void ClearUifirstCache(NodeId id) override; + + pid_t remotePid_; + wptr renderService_; + RSMainThread* mainThread_ = nullptr; +#ifdef RS_ENABLE_GPU + RSUniRenderThread& renderThread_; +#endif + sptr screenManager_; + sptr token_; + + class RSConnectionDeathRecipient : public IRemoteObject::DeathRecipient { + public: + explicit RSConnectionDeathRecipient(wptr conn); + virtual ~RSConnectionDeathRecipient() = default; + + void OnRemoteDied(const wptr& token) override; + + private: + wptr conn_; + }; + friend class RSConnectionDeathRecipient; + sptr connDeathRecipient_; + + class RSApplicationRenderThreadDeathRecipient : public IRemoteObject::DeathRecipient { + public: + explicit RSApplicationRenderThreadDeathRecipient(wptr conn); + virtual ~RSApplicationRenderThreadDeathRecipient() = default; + + void OnRemoteDied(const wptr& token) override; + + private: + wptr conn_; + }; + friend class RSApplicationRenderThreadDeathRecipient; + sptr applicationDeathRecipient_ = nullptr; + + mutable std::mutex mutex_; + bool cleanDone_ = false; + const std::string VOTER_SCENE_BLUR = "VOTER_SCENE_BLUR"; + const std::string VOTER_SCENE_GPU = "VOTER_SCENE_GPU"; + + // save all virtual screenIds created by this connection. + std::unordered_set virtualScreenIds_; + sptr screenChangeCallback_; + sptr appVSyncDistributor_; + +#ifdef RS_PROFILER_ENABLED + friend class RSProfiler; +#endif +}; +} // namespace Rosen +} // namespace OHOS + +#endif // RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp index 52a89ed993..4dec606552 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp @@ -563,100 +563,6 @@ ErrCode RSRenderServiceConnection::CreateVSyncConnection(sptr& return ERR_OK; } -ErrCode RSRenderServiceConnection::GetPixelMapByProcessId( - std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) -{ - if (mainThread_ == nullptr) { - repCode = INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - std::vector, std::string, RectI>> sfBufferInfoVector; - std::function getSurfaceBufferByPidTask = [weakThis = wptr(this), - &sfBufferInfoVector, pid]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - RS_TRACE_NAME_FMT("RSRenderServiceConnection::GetPixelMapByProcessId getSurfaceBufferByPidTask pid: %d", pid); - auto selfDrawingNodeVector = - connection->mainThread_->GetContext().GetMutableNodeMap().GetSelfDrawingNodeInProcess(pid); - for (auto iter = selfDrawingNodeVector.rbegin(); iter != selfDrawingNodeVector.rend(); ++iter) { - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(*iter); - if (auto surfaceNode = node->ReinterpretCastTo()) { - auto surfaceBuffer = surfaceNode->GetRSSurfaceHandler()->GetBuffer(); - auto surfaceBufferInfo = std::make_tuple(surfaceBuffer, surfaceNode->GetName(), - surfaceNode->GetRenderProperties().GetBoundsGeometry()->GetAbsRect()); - sfBufferInfoVector.push_back(surfaceBufferInfo); - } - } - }; - mainThread_->PostSyncTask(getSurfaceBufferByPidTask); - - for (uint32_t i = 0; i < sfBufferInfoVector.size(); i++) { - auto surfaceBuffer = std::get<0>(sfBufferInfoVector[i]); - if (surfaceBuffer) { - OHOS::Media::Rect rect = {0, 0, surfaceBuffer->GetWidth(), surfaceBuffer->GetHeight()}; - std::shared_ptr pixelmap = nullptr; - RSBackgroundThread::Instance().PostSyncTask([&surfaceBuffer, rect, &pixelmap]() { - pixelmap = Rosen::CreatePixelMapFromSurfaceBuffer(surfaceBuffer, rect); - }); - PixelMapInfo info; - info.pixelMap = pixelmap; - RectI absRect = std::get<2>(sfBufferInfoVector[i]); - info.location = {absRect.GetLeft(), absRect.GetTop(), absRect.GetWidth(), absRect.GetHeight(), i}; - info.nodeName = std::get<1>(sfBufferInfoVector[i]); - pixelMapInfoVector.push_back(info); - } else { - RS_LOGE("CreatePixelMapFromSurface surfaceBuffer is null"); - } - } - repCode = SUCCESS; - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::CreatePixelMapFromSurface(sptr surface, - const Rect &srcRect, std::shared_ptr &pixelMap) -{ - OHOS::Media::Rect rect = { - .left = srcRect.x, - .top = srcRect.y, - .width = srcRect.w, - .height = srcRect.h, - }; - RSBackgroundThread::Instance().PostSyncTask([surface, rect, &pixelMap]() { - pixelMap = Rosen::CreatePixelMapFromSurface(surface, rect); - }); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) -{ - if (mainThread_ == nullptr) { - repCode = INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - mainThread_->ScheduleTask( - [info, mainThread = mainThread_]() { - // don't use 'this' to get mainThread poninter - mainThread->SetFocusAppInfo(info); - } - ); - repCode = SUCCESS; - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::SetWatermark(const std::string& name, std::shared_ptr watermark, - bool& success) -{ - if (!mainThread_) { - success = false; - return ERR_INVALID_VALUE; - } - mainThread_->SetWatermark(name, watermark); - success = true; - return ERR_OK; -} - ErrCode RSRenderServiceConnection::GetDefaultScreenId(uint64_t& screenId) { std::lock_guard lock(mutex_); @@ -712,104 +618,6 @@ ScreenId RSRenderServiceConnection::CreateVirtualScreen( return newVirtualScreenId; } -int32_t RSRenderServiceConnection::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) -{ - if (blackListVector.empty()) { - RS_LOGW("SetVirtualScreenBlackList blackList is empty."); - } - std::lock_guard lock(mutex_); - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->SetVirtualScreenBlackList(id, blackListVector); -} - -ErrCode RSRenderServiceConnection::SetVirtualScreenTypeBlackList( - ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) -{ - if (typeBlackListVector.empty()) { - RS_LOGW("SetVirtualScreenTypeBlackList typeBlackList is empty."); - } - std::lock_guard lock(mutex_); - if (!screenManager_) { - repCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - repCode = screenManager_->SetVirtualScreenTypeBlackList(id, typeBlackListVector); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::AddVirtualScreenBlackList( - ScreenId id, std::vector& blackListVector, int32_t& repCode) -{ - if (blackListVector.empty()) { - RS_LOGW("AddVirtualScreenBlackList blackList is empty."); - repCode = StatusCode::BLACKLIST_IS_EMPTY; - return ERR_INVALID_VALUE; - } - std::lock_guard lock(mutex_); - if (!screenManager_) { - repCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - repCode = screenManager_->AddVirtualScreenBlackList(id, blackListVector); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::RemoveVirtualScreenBlackList( - ScreenId id, std::vector& blackListVector, int32_t& repCode) -{ - if (blackListVector.empty()) { - RS_LOGW("RemoveVirtualScreenBlackList blackList is empty."); - repCode = StatusCode::BLACKLIST_IS_EMPTY; - return ERR_INVALID_VALUE; - } - std::lock_guard lock(mutex_); - if (!screenManager_) { - repCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - repCode = screenManager_->RemoveVirtualScreenBlackList(id, blackListVector); - return ERR_OK; -} - -int32_t RSRenderServiceConnection::SetVirtualScreenSecurityExemptionList( - ScreenId id, - const std::vector& securityExemptionList) -{ - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); -} - -int32_t RSRenderServiceConnection::SetScreenSecurityMask(ScreenId id, - std::shared_ptr securityMask) -{ - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->SetScreenSecurityMask(id, std::move(securityMask)); -} - -int32_t RSRenderServiceConnection::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, - bool supportRotation) -{ - if (screenManager_ == nullptr) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); -} - -int32_t RSRenderServiceConnection::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) -{ - std::lock_guard lock(mutex_); - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->SetCastScreenEnableSkipWindow(id, enable); -} - int32_t RSRenderServiceConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) { std::lock_guard lock(mutex_); @@ -819,39 +627,6 @@ int32_t RSRenderServiceConnection::SetVirtualScreenSurface(ScreenId id, sptrSetVirtualScreenSurface(id, surface); } -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR -int32_t RSRenderServiceConnection::SetPointerColorInversionConfig(float darkBuffer, - float brightBuffer, int64_t interval, int32_t rangeSize) -{ - RSMagicPointerRenderManager::GetInstance().SetPointerColorInversionConfig(darkBuffer, brightBuffer, - interval, rangeSize); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::SetPointerColorInversionEnabled(bool enable) -{ - RSMagicPointerRenderManager::GetInstance().SetPointerColorInversionEnabled(enable); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterPointerLuminanceChangeCallback( - sptr callback) -{ - if (!callback) { - RS_LOGE("RegisterPointerLuminanceChangeCallback: callback is nullptr"); - return StatusCode::INVALID_ARGUMENTS; - } - RSMagicPointerRenderManager::GetInstance().RegisterPointerLuminanceChangeCallback(remotePid_, callback); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::UnRegisterPointerLuminanceChangeCallback() -{ - RSMagicPointerRenderManager::GetInstance().UnRegisterPointerLuminanceChangeCallback(remotePid_); - return StatusCode::SUCCESS; -} -#endif - void RSRenderServiceConnection::RemoveVirtualScreen(ScreenId id) { std::lock_guard lock(mutex_); @@ -936,50 +711,6 @@ void RSRenderServiceConnection::SetRefreshRateMode(int32_t refreshRateMode) ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP); } -void RSRenderServiceConnection::SyncFrameRateRange(FrameRateLinkerId id, - const FrameRateRange& range, int32_t animatorExpectedFrameRate) -{ - if (!mainThread_) { - return; - } - mainThread_->ScheduleTask( - [weakThis = wptr(this), id, &range, animatorExpectedFrameRate]() { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - auto& context = connection->mainThread_->GetContext(); - auto& linkerMap = context.GetMutableFrameRateLinkerMap(); - auto linker = linkerMap.GetFrameRateLinker(id); - if (linker == nullptr) { - RS_LOGW("SyncFrameRateRange there is no frameRateLinker for id %{public}" PRIu64, id); - return; - } - linker->SetExpectedRange(range); - linker->SetAnimatorExpectedFrameRate(animatorExpectedFrameRate); - if (range.type_ != OHOS::Rosen::NATIVE_VSYNC_FRAME_RATE_TYPE) { - return; - } - auto appVSyncDistributor = connection->appVSyncDistributor_; - if (appVSyncDistributor == nullptr) { - return; - } - auto conn = appVSyncDistributor->GetVSyncConnection(id); - if (conn == nullptr) { - return; - } - std::weak_ptr weakPtr = linker; - conn->RegisterRequestNativeVSyncCallback([weakPtr]() { - RS_TRACE_NAME("NativeVSync request frame, update timepoint"); - auto linker = weakPtr.lock(); - if (linker == nullptr) { - return; - } - linker->UpdateNativeVSyncTimePoint(); - }); - }).wait(); -} - void RSRenderServiceConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) { if (!mainThread_) { @@ -1144,26 +875,6 @@ int32_t RSRenderServiceConnection::SetVirtualScreenResolution(ScreenId id, uint3 } } -ErrCode RSRenderServiceConnection::MarkPowerOffNeedProcessOneFrame() -{ - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType != UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { - return ERR_INVALID_VALUE; - } -#ifdef RS_ENABLE_GPU - renderThread_.PostTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->screenManager_ == nullptr) { - return; - } - connection->screenManager_->MarkPowerOffNeedProcessOneFrame(); - } - ); -#endif - return ERR_OK; -} - ErrCode RSRenderServiceConnection::RepaintEverything() { if (mainThread_ == nullptr) { @@ -1179,45 +890,6 @@ ErrCode RSRenderServiceConnection::RepaintEverything() return ERR_OK; } -ErrCode RSRenderServiceConnection::ForceRefreshOneFrameWithNextVSync() -{ - if (!mainThread_) { - RS_LOGE("%{public}s mainThread_ is nullptr, return", __func__); - return ERR_INVALID_VALUE; - } - - auto task = [weakThis = wptr(this)]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - - RS_LOGI("ForceRefreshOneFrameWithNextVSync, setDirtyflag, forceRefresh in mainThread"); - connection->mainThread_->SetDirtyFlag(); - connection->mainThread_->RequestNextVSync(); - }; - mainThread_->PostTask(task); - return ERR_OK; -} - -void RSRenderServiceConnection::DisablePowerOffRenderControl(ScreenId id) -{ - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - renderThread_.PostTask( - [weakThis = wptr(this), id]() { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->screenManager_ == nullptr) { - return; - } - connection->screenManager_->DisablePowerOffRenderControl(id); - } - ); -#endif - } -} - void RSRenderServiceConnection::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { if (screenManager_ == nullptr || mainThread_ == nullptr) { @@ -1243,331 +915,59 @@ void RSRenderServiceConnection::SetScreenPowerStatus(ScreenId id, ScreenPowerSta } } -namespace { -void TakeSurfaceCaptureForUiParallel( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig, - const Drawing::Rect& specifiedAreaRect) +ErrCode RSRenderServiceConnection::RegisterApplicationAgent(uint32_t pid, sptr app) { -#ifdef RS_ENABLE_GPU - RS_LOGI("TakeSurfaceCaptureForUiParallel nodeId:[%{public}" PRIu64 "], issync:%{public}s", id, - captureConfig.isSync ? "true" : "false"); - std::function captureTask = [id, callback, captureConfig, specifiedAreaRect]() { - RSUiCaptureTaskParallel::Capture(id, callback, captureConfig, specifiedAreaRect); - }; - auto& context = RSMainThread::Instance()->GetContext(); - if (captureConfig.isSync) { - context.GetUiCaptureHelper().InsertUiCaptureCmdsExecutedFlag(id, false); - RSMainThread::Instance()->AddUiCaptureTask(id, captureTask); - return; + if (!mainThread_) { + RS_LOGE("RegisterApplicationAgent mainThread_ is nullptr"); + return ERR_INVALID_VALUE; } + auto captureTask = [weakThis = wptr(this), pid, app]() -> void { + sptr connection = weakThis.promote(); + if (connection == nullptr || connection->mainThread_ == nullptr) { + RS_LOGE("RegisterApplicationAgent connection or mainThread_ is nullptr"); + return; + } + connection->mainThread_->RegisterApplicationAgent(pid, app); + }; + mainThread_->PostTask(captureTask); - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); - if (!node) { - RS_LOGE("TakeSurfaceCaptureForUiParallel node is nullptr"); - callback->OnSurfaceCapture(id, captureConfig, nullptr); - return; - } + app->AsObject()->AddDeathRecipient(applicationDeathRecipient_); + return ERR_OK; +} - if (node->IsOnTheTree() && !node->IsDirty() && !node->IsSubTreeDirty()) { - RSMainThread::Instance()->PostTask(captureTask); - } else { - RSMainThread::Instance()->AddUiCaptureTask(id, captureTask); +ErrCode RSRenderServiceConnection::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) +{ + if (!screenManager_) { + return ERR_INVALID_VALUE; } + auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); + if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { +#ifdef RS_ENABLE_GPU + RSHardwareThread::Instance().ScheduleTask( + [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); +#else + return screenModeInfo; #endif + } else if (mainThread_ != nullptr) { + mainThread_->ScheduleTask( + [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); + } + return ERR_OK; } -void TakeSurfaceCaptureForUIWithUni(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig) +ErrCode RSRenderServiceConnection::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) { #ifdef RS_ENABLE_GPU - std::function offscreenRenderTask = [id, callback, captureConfig]() -> void { - RS_LOGD("RSRenderService::TakeSurfaceCaptureForUIWithUni callback->OnOffscreenRender" - " nodeId:[%{public}" PRIu64 "]", id); - ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP, "RSRenderService::TakeSurfaceCaptureForUIWithUni"); - std::shared_ptr rsUniUICapture = std::make_shared(id, captureConfig); - std::shared_ptr pixelmap = rsUniUICapture->TakeLocalCapture(); - callback->OnSurfaceCapture(id, captureConfig, pixelmap.get()); - ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP); - }; - if (!captureConfig.isSync) { - RSOffscreenRenderThread::Instance().PostTask(offscreenRenderTask); - } else { - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); - if (node == nullptr || !node->GetCommandExecuted()) { - RSOffscreenRenderThread::Instance().InSertCaptureTask(id, offscreenRenderTask); - return; - } - RSOffscreenRenderThread::Instance().PostTask(offscreenRenderTask); - node->SetCommandExecuted(false); - } + RSMainThread::Instance()->GetAppMemoryInMB(cpuMemSize, gpuMemSize); + gpuMemSize += RSSubThreadManager::Instance()->GetAppGpuMemoryInMB(); #endif -} + return ERR_OK; } -void RSRenderServiceConnection::TakeSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, - const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions permissions) +ErrCode RSRenderServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) { - if (!mainThread_) { - RS_LOGE("%{public}s mainThread_ is nullptr", __func__); - return; - } - - std::function captureTask = [id, callback, captureConfig, blurParam, specifiedAreaRect, - screenCapturePermission = permissions.screenCapturePermission, - isSystemCalling = permissions.isSystemCalling, - selfCapture = permissions.selfCapture]() -> void { - RS_TRACE_NAME_FMT("RSRenderServiceConnection::TakeSurfaceCapture captureTask nodeId:[%" PRIu64 "]", id); - RS_LOGD("TakeSurfaceCapture captureTask begin nodeId:[%{public}" PRIu64 "]", id); - if (captureConfig.captureType == SurfaceCaptureType::UICAPTURE) { - // When the isSync flag in captureConfig is true, UI capture processes commands before capture. - // When the isSync flag in captureConfig is false, UI capture will check null node independently. - // Therefore, a null node is valid for UI capture. - auto uiCaptureHasPermission = selfCapture || isSystemCalling; - if (!uiCaptureHasPermission) { - RS_LOGE("TakeSurfaceCapture uicapture failed, nodeId:[%{public}" PRIu64 - "], isSystemCalling: %{public}u, selfCapture: %{public}u", - id, isSystemCalling, selfCapture); - callback->OnSurfaceCapture(id, captureConfig, nullptr); - return; - } - if (RSUniRenderJudgement::IsUniRender()) { - TakeSurfaceCaptureForUiParallel(id, callback, captureConfig, specifiedAreaRect); - } else { - TakeSurfaceCaptureForUIWithUni(id, callback, captureConfig); - } - return; - } - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); - if (node == nullptr) { - RS_LOGE("TakeSurfaceCapture failed, node is nullptr"); - callback->OnSurfaceCapture(id, captureConfig, nullptr); - return; - } - auto displayCaptureHasPermission = screenCapturePermission && isSystemCalling; - auto surfaceCaptureHasPermission = blurParam.isNeedBlur ? isSystemCalling : (selfCapture || isSystemCalling); - if ((node->GetType() == RSRenderNodeType::LOGICAL_DISPLAY_NODE && !displayCaptureHasPermission) || - (node->GetType() == RSRenderNodeType::SURFACE_NODE && !surfaceCaptureHasPermission)) { - RS_LOGE("TakeSurfaceCapture failed, node type: %{public}u, " - "screenCapturePermission: %{public}u, isSystemCalling: %{public}u, selfCapture: %{public}u", - node->GetType(), screenCapturePermission, isSystemCalling, selfCapture); - callback->OnSurfaceCapture(id, captureConfig, nullptr); - return; - } - if (RSUniRenderJudgement::GetUniRenderEnabledType() == UniRenderEnabledType::UNI_RENDER_DISABLED) { - RS_LOGD("RSRenderService::TakeSurfaceCapture captureTaskInner nodeId:[%{public}" PRIu64 "]", id); - ROSEN_TRACE_BEGIN(HITRACE_TAG_GRAPHIC_AGP, "RSRenderService::TakeSurfaceCapture"); - RSSurfaceCaptureTask task(id, captureConfig); - if (!task.Run(callback)) { - callback->OnSurfaceCapture(id, captureConfig, nullptr); - } - ROSEN_TRACE_END(HITRACE_TAG_GRAPHIC_AGP); - } else { -#ifdef RS_ENABLE_GPU - RSSurfaceCaptureParam captureParam; - captureParam.id = id; - captureParam.config = captureConfig; - captureParam.isSystemCalling = isSystemCalling; - captureParam.blurParam = blurParam; - RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); - RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); -#endif - } - }; - mainThread_->PostTask(captureTask); -} - -std::vector>> RSRenderServiceConnection::TakeSurfaceCaptureSoloNode( - NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions permissions) -{ - RS_LOGI("TakeSurfaceCaptureSoloNode nodeId:[%{public}" PRIu64 "]", id); - std::vector>> pixelMapIdPairVector; - std::function captureTask = [id, captureConfig, &pixelMapIdPairVector, - isSystemCalling = permissions.isSystemCalling, - selfCapture = permissions.selfCapture]() { - RS_TRACE_NAME_FMT("RSRenderServiceConnection::TakeSurfaceCaptureSoloNode captureTask" - " nodeId:[%" PRIu64 "]", id); - RS_LOGI("TakeSurfaceCaptureSoloNode captureTask begin " - "nodeId:[%{public}" PRIu64 "]", id); - auto uiCaptureHasPermission = selfCapture || isSystemCalling; - if (!uiCaptureHasPermission) { - RS_LOGE("TakeSurfaceCaptureSoloNode " - "uicapturesolo failed, nodeId:[%{public}" PRIu64 - "], isSystemCalling: %{public}u, selfCapture: %{public}u", id, isSystemCalling, selfCapture); - return; - } - pixelMapIdPairVector = RSUiCaptureSoloTaskParallel::CaptureSoloNode(id, captureConfig); - }; - RSMainThread::Instance()->PostSyncTask(captureTask); - return pixelMapIdPairVector; -} - -void RSRenderServiceConnection::TakeSelfSurfaceCapture( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) -{ - if (!mainThread_) { - RS_LOGE("%{public}s mainThread_ is nullptr", __func__); - return; - } - bool isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( - RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::TAKE_SELF_SURFACE_CAPTURE"); - std::function selfCaptureTask = [id, callback, captureConfig, isSystemCalling]() -> void { - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); - if (node == nullptr) { - RS_LOGE("TakeSelfSurfaceCapture failed, node is nullptr"); - if (callback) { - callback->OnSurfaceCapture(id, captureConfig, nullptr); - } - return; - } - RSSurfaceCaptureParam captureParam; - captureParam.id = id; - captureParam.config = captureConfig; - captureParam.isSystemCalling = isSystemCalling; - captureParam.isSelfCapture = true; - RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); - RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); - }; - mainThread_->PostTask(selfCaptureTask); -} - -ErrCode RSRenderServiceConnection::SetWindowFreezeImmediately(NodeId id, bool isFreeze, - sptr callback, const RSSurfaceCaptureConfig& captureConfig, - const RSSurfaceCaptureBlurParam& blurParam) -{ - if (!mainThread_) { - RS_LOGE("%{public}s mainThread_ is nullptr", __func__); - return ERR_INVALID_VALUE; - } - bool isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( - RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::SET_WINDOW_FREEZE_IMMEDIATELY"); - std::function setWindowFreezeTask = - [id, isFreeze, callback, captureConfig, blurParam, isSystemCalling]() -> void { - auto node = RSMainThread::Instance()->GetContext().GetNodeMap().GetRenderNode(id); - if (node == nullptr) { - RS_LOGE("SetWindowFreezeImmediately failed, node is nullptr"); - if (callback) { - callback->OnSurfaceCapture(id, captureConfig, nullptr); - } - return; - } - node->SetStaticCached(isFreeze); - if (isFreeze) { - RSSurfaceCaptureParam captureParam; - captureParam.id = id; - captureParam.config = captureConfig; - captureParam.isSystemCalling = isSystemCalling; - captureParam.isFreeze = isFreeze; - captureParam.blurParam = blurParam; - RSSurfaceCaptureTaskParallel::CheckModifiers(id, captureConfig.useCurWindow); - RSSurfaceCaptureTaskParallel::Capture(callback, captureParam); - } else { - RSSurfaceCaptureTaskParallel::ClearCacheImageByFreeze(id); - } - }; - mainThread_->PostTask(setWindowFreezeTask); - return ERR_OK; -} - -void RSRenderServiceConnection::TakeUICaptureInRange( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) -{ - TakeSurfaceCaptureForUiParallel(id, callback, captureConfig, {}); -} - -ErrCode RSRenderServiceConnection::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, - float positionZ, float positionW) -{ - if (mainThread_ == nullptr || screenManager_ == nullptr) { - return ERR_INVALID_VALUE; - } - - // adapt video scene pointer - if (screenManager_->GetCurrentVirtualScreenNum() > 0 || - !RSPointerWindowManager::Instance().GetIsPointerEnableHwc()) { - // when has virtual screen or pointer is enable hwc, we can't skip - RSPointerWindowManager::Instance().SetIsPointerCanSkipFrame(false); - RSMainThread::Instance()->RequestNextVSync(); - } else { - RSPointerWindowManager::Instance().SetIsPointerCanSkipFrame(true); - } - - RSPointerWindowManager::Instance().SetHwcNodeBounds(rsNodeId, positionX, positionY, - positionZ, positionW); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::RegisterApplicationAgent(uint32_t pid, sptr app) -{ - if (!mainThread_) { - RS_LOGE("RegisterApplicationAgent mainThread_ is nullptr"); - return ERR_INVALID_VALUE; - } - auto captureTask = [weakThis = wptr(this), pid, app]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - RS_LOGE("RegisterApplicationAgent connection or mainThread_ is nullptr"); - return; - } - connection->mainThread_->RegisterApplicationAgent(pid, app); - }; - mainThread_->PostTask(captureTask); - - app->AsObject()->AddDeathRecipient(applicationDeathRecipient_); - return ERR_OK; -} - -void RSRenderServiceConnection::UnRegisterApplicationAgent(sptr app) -{ - auto captureTask = [=]() -> void { - RSMainThread::Instance()->UnRegisterApplicationAgent(app); - }; - RSMainThread::Instance()->ScheduleTask(captureTask).wait(); -} - -RSVirtualScreenResolution RSRenderServiceConnection::GetVirtualScreenResolution(ScreenId id) -{ - RSVirtualScreenResolution virtualScreenResolution; - if (!screenManager_) { - return virtualScreenResolution; - } - screenManager_->GetVirtualScreenResolution(id, virtualScreenResolution); - return virtualScreenResolution; -} - -ErrCode RSRenderServiceConnection::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) -{ - if (!screenManager_) { - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - RSHardwareThread::Instance().ScheduleTask( - [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); -#else - return screenModeInfo; -#endif - } else if (mainThread_ != nullptr) { - mainThread_->ScheduleTask( - [=, &screenModeInfo]() { return screenManager_->GetScreenActiveMode(id, screenModeInfo); }).wait(); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) -{ -#ifdef RS_ENABLE_GPU - RSMainThread::Instance()->GetAppMemoryInMB(cpuMemSize, gpuMemSize); - gpuMemSize += RSSubThreadManager::Instance()->GetAppGpuMemoryInMB(); -#endif - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) -{ - if (!mainThread_ || !mainThread_->GetContext().GetNodeMap().ContainPid(pid)) { - return ERR_INVALID_VALUE; + if (!mainThread_ || !mainThread_->GetContext().GetNodeMap().ContainPid(pid)) { + return ERR_INVALID_VALUE; } bool enable; if (GetUniRenderEnabled(enable) == ERR_OK && enable) { @@ -1917,23 +1317,6 @@ int32_t RSRenderServiceConnection::SetScreenCorrection(ScreenId id, ScreenRotati return screenManager_->SetScreenCorrection(id, screenRotation); } -bool RSRenderServiceConnection::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) -{ - std::lock_guard lock(mutex_); - if (!screenManager_) { - return false; - } - return screenManager_->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); -} - -int32_t RSRenderServiceConnection::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) -{ - if (!screenManager_) { - return StatusCode::SCREEN_MANAGER_NULL; - } - return screenManager_->SetVirtualScreenAutoRotation(id, isAutoRotation); -} - ErrCode RSRenderServiceConnection::SetGlobalDarkColorMode(bool isDark) { std::lock_guard lock(mutex_); @@ -1952,15 +1335,6 @@ ErrCode RSRenderServiceConnection::SetGlobalDarkColorMode(bool isDark) return ERR_OK; } -bool RSRenderServiceConnection::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) -{ - std::lock_guard lock(mutex_); - if (!screenManager_) { - return false; - } - return screenManager_->SetVirtualMirrorScreenScaleMode(id, scaleMode); -} - int32_t RSRenderServiceConnection::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { if (!screenManager_) { @@ -1982,42 +1356,50 @@ int32_t RSRenderServiceConnection::GetScreenGamutMap(ScreenId id, ScreenGamutMap } } -int32_t RSRenderServiceConnection::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) -{ - std::lock_guard lock(mutex_); - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->GetScreenHDRCapability(id, screenHdrCapability); -} - -ErrCode RSRenderServiceConnection::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) +ErrCode RSRenderServiceConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { - if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; + if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=, &pixelFormat]() { return screenManager_->GetPixelFormat(id, pixelFormat); }).get(); - return ERR_OK; -#else - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; -#endif - } else if (mainThread_ != nullptr) { - resCode = mainThread_->ScheduleTask( - [=, &pixelFormat]() { return screenManager_->GetPixelFormat(id, pixelFormat); }).get(); - return ERR_OK; - } else { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; + HdrStatus hdrStatusRet = HdrStatus::NO_HDR; + StatusCode resCodeRet = StatusCode::SCREEN_NOT_FOUND; + auto isTimeout = std::make_shared(0); + std::weak_ptr isTimeoutWeak = isTimeout; + auto task = [id, mainThread = mainThread_, &resCodeRet, &hdrStatusRet, isTimeoutWeak]() { + if (isTimeoutWeak.expired()) { + RS_LOGE("GetScreenHDRStatus time out, ScreenId: [%{public}" PRIu64 "]", id); + return; + } + std::shared_ptr screenNode = nullptr; + auto& nodeMap = mainThread->GetContext().GetNodeMap(); + nodeMap.TraverseScreenNodes([id, &screenNode](const std::shared_ptr& node) { + if (node && node->GetScreenId() == id) { + screenNode = node; + } + }); + if (screenNode == nullptr) { + resCodeRet = StatusCode::SCREEN_NOT_FOUND; + return; + } + hdrStatusRet = screenNode->GetLastDisplayHDRStatus(); + resCodeRet = StatusCode::SUCCESS; + }; + auto span = std::chrono::duration_cast(std::chrono::milliseconds(100)); // timeout 100 ms + if (mainThread_->ScheduleTask(task).wait_for(span) == std::future_status::timeout) { + isTimeout.reset(); + } + if (isTimeoutWeak.expired() && resCodeRet != StatusCode::SUCCESS) { + return ERR_TIMED_OUT; } + if (resCodeRet == StatusCode::SUCCESS) { + hdrStatus = hdrStatusRet; + } + resCode = resCodeRet; + return ERR_OK; } -ErrCode RSRenderServiceConnection::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) +ErrCode RSRenderServiceConnection::GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2027,7 +1409,7 @@ ErrCode RSRenderServiceConnection::SetPixelFormat(ScreenId id, GraphicPixelForma if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU resCode = RSHardwareThread::Instance().ScheduleTask( - [=]() { return screenManager_->SetPixelFormat(id, pixelFormat); }).get(); + [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); return ERR_OK; #else resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2035,7 +1417,7 @@ ErrCode RSRenderServiceConnection::SetPixelFormat(ScreenId id, GraphicPixelForma #endif } else if (mainThread_ != nullptr) { resCode = mainThread_->ScheduleTask( - [=]() { return screenManager_->SetPixelFormat(id, pixelFormat); }).get(); + [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); return ERR_OK; } else { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2043,8 +1425,8 @@ ErrCode RSRenderServiceConnection::SetPixelFormat(ScreenId id, GraphicPixelForma } } -ErrCode RSRenderServiceConnection::GetScreenSupportedHDRFormats( - ScreenId id, std::vector& hdrFormats, int32_t& resCode) +ErrCode RSRenderServiceConnection::GetScreenColorSpace( + ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2054,7 +1436,7 @@ ErrCode RSRenderServiceConnection::GetScreenSupportedHDRFormats( if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU resCode = RSHardwareThread::Instance().ScheduleTask( - [=, &hdrFormats]() { return screenManager_->GetScreenSupportedHDRFormats(id, hdrFormats); }).get(); + [=, &colorSpace]() { return screenManager_->GetScreenColorSpace(id, colorSpace); }).get(); return ERR_OK; #else resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2062,7 +1444,7 @@ ErrCode RSRenderServiceConnection::GetScreenSupportedHDRFormats( #endif } else if (mainThread_ != nullptr) { resCode = mainThread_->ScheduleTask( - [=, &hdrFormats]() { return screenManager_->GetScreenSupportedHDRFormats(id, hdrFormats); }).get(); + [=, &colorSpace]() { return screenManager_->GetScreenColorSpace(id, colorSpace); }).get(); return ERR_OK; } else { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2070,7 +1452,8 @@ ErrCode RSRenderServiceConnection::GetScreenSupportedHDRFormats( } } -ErrCode RSRenderServiceConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) +ErrCode RSRenderServiceConnection::SetScreenColorSpace( + ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2080,7 +1463,7 @@ ErrCode RSRenderServiceConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRForm if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU resCode = RSHardwareThread::Instance().ScheduleTask( - [=, &hdrFormat]() { return screenManager_->GetScreenHDRFormat(id, hdrFormat); }).get(); + [=]() { return screenManager_->SetScreenColorSpace(id, colorSpace); }).get(); return ERR_OK; #else resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2088,7 +1471,7 @@ ErrCode RSRenderServiceConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRForm #endif } else if (mainThread_ != nullptr) { resCode = mainThread_->ScheduleTask( - [=, &hdrFormat]() { return screenManager_->GetScreenHDRFormat(id, hdrFormat); }).get(); + [=]() { return screenManager_->SetScreenColorSpace(id, colorSpace); }).get(); return ERR_OK; } else { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -2096,168 +1479,19 @@ ErrCode RSRenderServiceConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRForm } } -ErrCode RSRenderServiceConnection::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) +int32_t RSRenderServiceConnection::GetScreenType(ScreenId id, RSScreenType& screenType) { + std::lock_guard lock(mutex_); if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=]() { return screenManager_->SetScreenHDRFormat(id, modeIdx); }).get(); - return ERR_OK; -#else - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; -#endif - } else if (mainThread_ != nullptr) { - resCode = mainThread_->ScheduleTask( - [=]() { return screenManager_->SetScreenHDRFormat(id, modeIdx); }).get(); - return ERR_OK; - } else { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; + return StatusCode::SCREEN_NOT_FOUND; } + return screenManager_->GetScreenType(id, screenType); } -ErrCode RSRenderServiceConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +ErrCode RSRenderServiceConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { - if (mainThread_ == nullptr) { - return ERR_INVALID_VALUE; - } - HdrStatus hdrStatusRet = HdrStatus::NO_HDR; - StatusCode resCodeRet = StatusCode::SCREEN_NOT_FOUND; - auto isTimeout = std::make_shared(0); - std::weak_ptr isTimeoutWeak = isTimeout; - auto task = [id, mainThread = mainThread_, &resCodeRet, &hdrStatusRet, isTimeoutWeak]() { - if (isTimeoutWeak.expired()) { - RS_LOGE("GetScreenHDRStatus time out, ScreenId: [%{public}" PRIu64 "]", id); - return; - } - std::shared_ptr screenNode = nullptr; - auto& nodeMap = mainThread->GetContext().GetNodeMap(); - nodeMap.TraverseScreenNodes([id, &screenNode](const std::shared_ptr& node) { - if (node && node->GetScreenId() == id) { - screenNode = node; - } - }); - if (screenNode == nullptr) { - resCodeRet = StatusCode::SCREEN_NOT_FOUND; - return; - } - hdrStatusRet = screenNode->GetLastDisplayHDRStatus(); - resCodeRet = StatusCode::SUCCESS; - }; - auto span = std::chrono::duration_cast(std::chrono::milliseconds(100)); // timeout 100 ms - if (mainThread_->ScheduleTask(task).wait_for(span) == std::future_status::timeout) { - isTimeout.reset(); - } - if (isTimeoutWeak.expired() && resCodeRet != StatusCode::SUCCESS) { - return ERR_TIMED_OUT; - } - if (resCodeRet == StatusCode::SUCCESS) { - hdrStatus = hdrStatusRet; - } - resCode = resCodeRet; - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::GetScreenSupportedColorSpaces( - ScreenId id, std::vector& colorSpaces, int32_t& resCode) -{ - if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); - return ERR_OK; -#else - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; -#endif - } else if (mainThread_ != nullptr) { - resCode = mainThread_->ScheduleTask( - [=, &colorSpaces]() { return screenManager_->GetScreenSupportedColorSpaces(id, colorSpaces); }).get(); - return ERR_OK; - } else { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } -} - -ErrCode RSRenderServiceConnection::GetScreenColorSpace( - ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) -{ - if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=, &colorSpace]() { return screenManager_->GetScreenColorSpace(id, colorSpace); }).get(); - return ERR_OK; -#else - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; -#endif - } else if (mainThread_ != nullptr) { - resCode = mainThread_->ScheduleTask( - [=, &colorSpace]() { return screenManager_->GetScreenColorSpace(id, colorSpace); }).get(); - return ERR_OK; - } else { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } -} - -ErrCode RSRenderServiceConnection::SetScreenColorSpace( - ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) -{ - if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=]() { return screenManager_->SetScreenColorSpace(id, colorSpace); }).get(); - return ERR_OK; -#else - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; -#endif - } else if (mainThread_ != nullptr) { - resCode = mainThread_->ScheduleTask( - [=]() { return screenManager_->SetScreenColorSpace(id, colorSpace); }).get(); - return ERR_OK; - } else { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } -} - -int32_t RSRenderServiceConnection::GetScreenType(ScreenId id, RSScreenType& screenType) -{ - std::lock_guard lock(mutex_); - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - return screenManager_->GetScreenType(id, screenType); -} - -ErrCode RSRenderServiceConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) -{ - if (!mainThread_) { - success = false; + if (!mainThread_) { + success = false; return ERR_INVALID_VALUE; } std::promise result; @@ -2352,24 +1586,6 @@ ErrCode RSRenderServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr< return ERR_OK; } -bool RSRenderServiceConnection::RegisterTypeface(uint64_t globalUniqueId, - std::shared_ptr& typeface) -{ - RS_LOGI("reg typeface, pid[%{public}d], familyname:%{public}s, uniqueid:%{public}u", - RSTypefaceCache::GetTypefacePid(globalUniqueId), typeface->GetFamilyName().c_str(), - RSTypefaceCache::GetTypefaceId(globalUniqueId)); - RSTypefaceCache::Instance().CacheDrawingTypeface(globalUniqueId, typeface); - return true; -} - -bool RSRenderServiceConnection::UnRegisterTypeface(uint64_t globalUniqueId) -{ - RS_LOGW("uneg typeface: pid[%{public}d], uniqueid:%{public}u", - RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); - RSTypefaceCache::Instance().AddDelayDestroyQueue(globalUniqueId); - return true; -} - int32_t RSRenderServiceConnection::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) { @@ -2380,42 +1596,6 @@ int32_t RSRenderServiceConnection::GetDisplayIdentificationData(ScreenId id, uin return screenManager_->GetDisplayIdentificationData(id, outPort, edidData); } -ErrCode RSRenderServiceConnection::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) -{ - if (!screenManager_) { - resCode = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - resCode = RSHardwareThread::Instance().ScheduleTask( - [=]() { return screenManager_->SetScreenSkipFrameInterval(id, skipFrameInterval); }).get(); -#else - resCode = StatusCode::SCREEN_NOT_FOUND; -#endif - } else { - if (!mainThread_) { - resCode = StatusCode::INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - resCode = mainThread_->ScheduleTask( - [=]() { return screenManager_->SetScreenSkipFrameInterval(id, skipFrameInterval); }).get(); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::SetVirtualScreenRefreshRate( - ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) -{ - if (!screenManager_) { - retVal = StatusCode::SCREEN_NOT_FOUND; - return ERR_INVALID_VALUE; - } - retVal = screenManager_->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate); - return ERR_OK; -} - ErrCode RSRenderServiceConnection::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) { if (!screenManager_) { @@ -2473,242 +1653,6 @@ void RSRenderServiceConnection::SetScreenFrameGravity(ScreenId id, int32_t gravi mainThread_->PostTask(task); } -ErrCode RSRenderServiceConnection::RegisterOcclusionChangeCallback( - sptr callback, int32_t& repCode) -{ - std::lock_guard lock(mutex_); - if (!mainThread_) { - repCode = StatusCode::INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - if (!callback) { - RS_LOGD("RegisterOcclusionChangeCallback: callback is nullptr"); - repCode = StatusCode::INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - mainThread_->RegisterOcclusionChangeCallback(remotePid_, callback); - repCode = StatusCode::SUCCESS; - return ERR_OK; -} - -int32_t RSRenderServiceConnection::RegisterSurfaceOcclusionChangeCallback( - NodeId id, sptr callback, std::vector& partitionPoints) -{ - std::lock_guard lock(mutex_); - if (!mainThread_) { - return StatusCode::INVALID_ARGUMENTS; - } - if (!callback) { - RS_LOGD("RegisterSurfaceOcclusionChangeCallback: callback is nullptr"); - return StatusCode::INVALID_ARGUMENTS; - } - mainThread_->RegisterSurfaceOcclusionChangeCallback(id, remotePid_, callback, partitionPoints); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) -{ - std::lock_guard lock(mutex_); - if (!mainThread_) { - return StatusCode::INVALID_ARGUMENTS; - } - mainThread_->UnRegisterSurfaceOcclusionChangeCallback(id); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterHgmConfigChangeCallback(sptr callback) -{ - std::lock_guard lock(mutex_); - if (!callback) { - RS_LOGD("RegisterHgmConfigChangeCallback: callback is nullptr"); - return StatusCode::INVALID_ARGUMENTS; - } - - HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { - HgmConfigCallbackManager::GetInstance()->RegisterHgmConfigChangeCallback(remotePid_, callback); - }); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterHgmRefreshRateModeChangeCallback( - sptr callback) -{ - std::lock_guard lock(mutex_); - if (!callback) { - RS_LOGD("RegisterHgmRefreshRateModeChangeCallback: callback is nullptr"); - return StatusCode::INVALID_ARGUMENTS; - } - - HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { - HgmConfigCallbackManager::GetInstance()->RegisterHgmRefreshRateModeChangeCallback(remotePid_, callback); - }); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterHgmRefreshRateUpdateCallback( - sptr callback) -{ - std::lock_guard lock(mutex_); - - HgmTaskHandleThread::Instance().PostSyncTask([this, &callback] () { - HgmConfigCallbackManager::GetInstance()->RegisterHgmRefreshRateUpdateCallback(remotePid_, callback); - }); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterFirstFrameCommitCallback( - sptr callback) -{ - std::lock_guard lock(mutex_); - RSFirstFrameNotifier::GetInstance().RegisterFirstFrameCommitCallback(remotePid_, callback); - return StatusCode::SUCCESS; -} - -int32_t RSRenderServiceConnection::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, - sptr callback) -{ - if (dstPid == 0) { - return StatusCode::INVALID_ARGUMENTS; - } - - HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, dstPid, callback] () { - HgmConfigCallbackManager::GetInstance()->RegisterXComponentExpectedFrameRateCallback( - remotePid, dstPid, callback); - }); - - return StatusCode::SUCCESS; -} - -ErrCode RSRenderServiceConnection::SetAppWindowNum(uint32_t num) -{ - if (!mainThread_) { - return ERR_INVALID_VALUE; - } - auto task = [weakThis = wptr(this), num]() -> void { - sptr connection = weakThis.promote(); - if (!connection || !connection->mainThread_) { - return; - } - connection->mainThread_->SetAppWindowNum(num); - }; - mainThread_->PostTask(task); - - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::SetSystemAnimatedScenes( - SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) -{ - std::lock_guard lock(mutex_); - if (!mainThread_) { - success = false; - return ERR_INVALID_VALUE; - } -#ifdef RS_ENABLE_GPU - RSUifirstManager::Instance().OnProcessAnimateScene(systemAnimatedScenes); - success = mainThread_->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation); - return ERR_OK; -#else - success = false; - return ERR_INVALID_VALUE; -#endif -} - -void RSRenderServiceConnection::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) -{ - if (!mainThread_) { - return; - } - auto task = [weakThis = wptr(this), watermarkImg, isShow]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - connection->mainThread_->ShowWatermark(watermarkImg, isShow); - }; - mainThread_->PostTask(task); -} - -int32_t RSRenderServiceConnection::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) -{ - if (!screenManager_) { - return StatusCode::SCREEN_NOT_FOUND; - } - auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { -#ifdef RS_ENABLE_GPU - return RSHardwareThread::Instance().ScheduleTask( - [weakThis = wptr(this), id, width, height]() -> int32_t { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->screenManager_ == nullptr) { - return RS_CONNECTION_ERROR; - } - return connection->screenManager_->ResizeVirtualScreen(id, width, height); - } - ).get(); -#else - return StatusCode::SCREEN_NOT_FOUND; -#endif - } else if (mainThread_ != nullptr) { - return mainThread_->ScheduleTask( - [weakThis = wptr(this), id, width, height]() -> int32_t { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->screenManager_ == nullptr) { - return RS_CONNECTION_ERROR; - } - return connection->screenManager_->ResizeVirtualScreen(id, width, height); - } - ).get(); - } else { - return StatusCode::SCREEN_NOT_FOUND; - } -} - -ErrCode RSRenderServiceConnection::ReportJankStats() -{ -#ifdef RS_ENABLE_GPU - auto task = []() -> void { RSJankStats::GetInstance().ReportJankStats(); }; - renderThread_.PostTask(task); -#endif - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::NotifyLightFactorStatus(int32_t lightFactorStatus) -{ - HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, lightFactorStatus]() { - auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); - if (frameRateMgr != nullptr) { - frameRateMgr->HandleLightFactorStatus(pid, lightFactorStatus); - } - }); - return ERR_OK; -} - -void RSRenderServiceConnection::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) -{ - if (!mainThread_) { - return; - } - mainThread_->NotifyPackageEvent(packageList); - HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, listSize, packageList]() { - auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); - if (frameRateMgr != nullptr) { - frameRateMgr->HandlePackageEvent(pid, packageList); - } - }); -} - -void RSRenderServiceConnection::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, - const std::vector>& newConfig) -{ - HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, listSize, pkgName, newConfig] () { - auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); - if (frameRateMgr != nullptr) { - frameRateMgr->HandleAppStrategyConfigEvent(pid, pkgName, newConfig); - } - }); -} - void RSRenderServiceConnection::NotifyRefreshRateEvent(const EventInfo& eventInfo) { if (VOTER_SCENE_BLUR == eventInfo.eventName) { @@ -2754,50 +1698,13 @@ void RSRenderServiceConnection::SetWindowExpectedRefreshRate( }); } -ErrCode RSRenderServiceConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) -{ - if (!appVSyncDistributor_) { - return ERR_INVALID_VALUE; - } - appVSyncDistributor_->SetQosVSyncRateByPidPublic(pid, rateDiscount, true); - return ERR_OK; -} - -bool RSRenderServiceConnection::NotifySoftVsyncRateDiscountEvent(uint32_t pid, - const std::string &name, uint32_t rateDiscount) -{ - if (!appVSyncDistributor_) { - return false; - } - - std::vector linkerIds = appVSyncDistributor_->GetVsyncNameLinkerIds(pid, name); - if (linkerIds.empty()) { - RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d linkerIds is nullptr.", - pid); - return false; - } - - auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); - if (frameRateMgr == nullptr) { - RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d frameRateMgr is nullptr.", - pid); - return false; - } - - if (!frameRateMgr->SetVsyncRateDiscountLTPO(linkerIds, rateDiscount)) { - RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d Set LTPO fail.", - pid); - return false; - } - - VsyncError ret = appVSyncDistributor_->SetVsyncRateDiscountLTPS(pid, name, rateDiscount); - if (ret != VSYNC_ERROR_OK) { - RS_LOGW("NotifySoftVsyncRateDiscountEvent: pid=%{public}d Set LTPS fail.", - pid); - return false; - } - - return true; +ErrCode RSRenderServiceConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +{ + if (!appVSyncDistributor_) { + return ERR_INVALID_VALUE; + } + appVSyncDistributor_->SetQosVSyncRateByPidPublic(pid, rateDiscount, true); + return ERR_OK; } ErrCode RSRenderServiceConnection::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) @@ -2825,27 +1732,6 @@ void RSRenderServiceConnection::NotifyDynamicModeEvent(bool enableDynamicModeEve }); } -ErrCode RSRenderServiceConnection::NotifyHgmConfigEvent(const std::string &eventName, bool state) -{ - HgmTaskHandleThread::Instance().PostTask([eventName, state] () { - auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); - if (frameRateMgr == nullptr) { - RS_LOGW("NotifyHgmConfigEvent: frameRateMgr is nullptr."); - return; - } - RS_LOGI("NotifyHgmConfigEvent: recive notify %{public}s, %{public}d", - eventName.c_str(), state); - if (eventName == "HGMCONFIG_HIGH_TEMP") { - frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_THERMAL_SUFFIX); - } else if (eventName == "IA_DRAG_SLIDE") { - frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_DRAGSLIDE_SUFFIX); - } else if (eventName == "IL_THROW_SLIDE") { - frameRateMgr->HandleScreenExtStrategyChange(state, HGM_CONFIG_TYPE_THROWSLIDE_SUFFIX); - } - }); - return ERR_OK; -} - ErrCode RSRenderServiceConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) { HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, id, expectedFrameRate] () { @@ -2855,70 +1741,6 @@ ErrCode RSRenderServiceConnection::NotifyXComponentExpectedFrameRate(const std:: return ERR_OK; } -ErrCode RSRenderServiceConnection::ReportEventResponse(DataBaseRs info) -{ - auto task = [info]() -> void { - RSJankStats::GetInstance().SetReportEventResponse(info); - }; -#ifdef RS_ENABLE_GPU - renderThread_.PostTask(task); - RSUifirstManager::Instance().OnProcessEventResponse(info); -#endif - RSUifirstFrameRateControl::Instance().SetAnimationStartInfo(info); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::ReportEventComplete(DataBaseRs info) -{ - auto task = [info]() -> void { - RSJankStats::GetInstance().SetReportEventComplete(info); - }; -#ifdef RS_ENABLE_GPU - renderThread_.PostTask(task); - RSUifirstManager::Instance().OnProcessEventComplete(info); -#endif - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::ReportEventJankFrame(DataBaseRs info) -{ -#ifdef RS_ENABLE_GPU - bool isReportTaskDelayed = renderThread_.IsMainLooping(); - auto task = [info, isReportTaskDelayed]() -> void { - RSJankStats::GetInstance().SetReportEventJankFrame(info, isReportTaskDelayed); - }; - renderThread_.PostTask(task); -#endif - RSUifirstFrameRateControl::Instance().SetAnimationEndInfo(info); - return ERR_OK; -} - -void RSRenderServiceConnection::ReportRsSceneJankStart(AppInfo info) -{ - auto task = [info]() -> void { - RSJankStats::GetInstance().SetReportRsSceneJankStart(info); - }; - renderThread_.PostTask(task); -} - -void RSRenderServiceConnection::ReportRsSceneJankEnd(AppInfo info) -{ - auto task = [info]() -> void { - RSJankStats::GetInstance().SetReportRsSceneJankEnd(info); - }; - renderThread_.PostTask(task); -} - -ErrCode RSRenderServiceConnection::ReportGameStateData(GameStateData info) -{ - RS_LOGD("ReportGameStateData = %{public}s, uid = %{public}d, state = %{public}d, " - "pid = %{public}d renderTid = %{public}d ", - info.bundleName.c_str(), info.uid, info.state, info.pid, info.renderTid); - - FrameReport::GetInstance().SetGameScene(info.pid, info.state); - return ERR_OK; -} - ErrCode RSRenderServiceConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { @@ -2963,40 +1785,6 @@ ErrCode RSRenderServiceConnection::SetHidePrivacyContent(NodeId id, bool needHid return ERR_OK; } -ErrCode RSRenderServiceConnection::SetCacheEnabledForRotation(bool isEnabled) -{ - if (!mainThread_) { - return ERR_INVALID_VALUE; - } - auto task = [isEnabled]() { - RSSystemProperties::SetCacheEnabledForRotation(isEnabled); - }; - mainThread_->PostTask(task); - return ERR_OK; -} - -std::vector RSRenderServiceConnection::GetActiveDirtyRegionInfo() -{ -#ifdef RS_ENABLE_GPU - const auto& activeDirtyRegionInfos = GpuDirtyRegionCollection::GetInstance().GetActiveDirtyRegionInfo(); - GpuDirtyRegionCollection::GetInstance().ResetActiveDirtyRegionInfo(); - return activeDirtyRegionInfos; -#else - return {}; -#endif -} - -GlobalDirtyRegionInfo RSRenderServiceConnection::GetGlobalDirtyRegionInfo() -{ -#ifdef RS_ENABLE_GPU - const auto& globalDirtyRegionInfo = GpuDirtyRegionCollection::GetInstance().GetGlobalDirtyRegionInfo(); - GpuDirtyRegionCollection::GetInstance().ResetGlobalDirtyRegionInfo(); - return globalDirtyRegionInfo; -#else - return {}; -#endif -} - LayerComposeInfo RSRenderServiceConnection::GetLayerComposeInfo() { const auto& layerComposeInfo = LayerComposeCollection::GetInstance().GetLayerComposeInfo(); @@ -3009,25 +1797,6 @@ HwcDisabledReasonInfos RSRenderServiceConnection::GetHwcDisabledReasonInfo() return HwcDisabledReasonCollection::GetInstance().GetHwcDisabledReasonInfo(); } -ErrCode RSRenderServiceConnection::GetHdrOnDuration(int64_t& hdrOnDuration) -{ - auto rsHdrCollection = RsHdrCollection::GetInstance(); - if (rsHdrCollection == nullptr) { - return ERR_INVALID_VALUE; - } - hdrOnDuration = rsHdrCollection->GetHdrOnDuration(); - rsHdrCollection->ResetHdrOnDuration(); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::SetVmaCacheStatus(bool flag) -{ -#ifdef RS_ENABLE_GPU - renderThread_.SetVmaCacheStatus(flag); -#endif - return ERR_OK; -} - #ifdef TP_FEATURE_ENABLE ErrCode RSRenderServiceConnection::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) @@ -3056,118 +1825,6 @@ ErrCode RSRenderServiceConnection::SetTpFeatureConfig(int32_t feature, const cha } #endif -void RSRenderServiceConnection::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) -{ - if (isVirtualScreenUsingStatus) { - EventInfo event = { "VOTER_VIRTUALDISPLAY", ADD_VOTE, OLED_60_HZ, OLED_60_HZ }; - NotifyRefreshRateEvent(event); - } else { - EventInfo event = { "VOTER_VIRTUALDISPLAY", REMOVE_VOTE }; - NotifyRefreshRateEvent(event); - } - return; -} - -ErrCode RSRenderServiceConnection::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) -{ - if (!mainThread_) { - return ERR_INVALID_VALUE; - } - auto task = [weakThis = wptr(this), isCurtainScreenOn]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - connection->mainThread_->SetCurtainScreenUsingStatus(isCurtainScreenOn); - }; - mainThread_->PostTask(task); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::DropFrameByPid(const std::vector pidList) -{ - if (!mainThread_) { - return ERR_INVALID_VALUE; - } - mainThread_->ScheduleTask( - [weakThis = wptr(this), pidList]() { - // don't use 'this' directly - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - connection->mainThread_->AddPidNeedDropFrame(pidList); - } - ); - return ERR_OK; -} - -int32_t RSRenderServiceConnection::RegisterUIExtensionCallback(uint64_t userId, sptr callback, - bool unobscured) -{ - std::lock_guard lock(mutex_); - if (!mainThread_) { - return StatusCode::INVALID_ARGUMENTS; - } - if (!callback) { - RS_LOGE("RegisterUIExtensionCallback register null callback, failed."); - return StatusCode::INVALID_ARGUMENTS; - } - mainThread_->RegisterUIExtensionCallback(remotePid_, userId, callback, unobscured); - return StatusCode::SUCCESS; -} - -ErrCode RSRenderServiceConnection::SetVirtualScreenStatus(ScreenId id, - VirtualScreenStatus screenStatus, bool& success) -{ - if (!screenManager_) { - success = false; - return StatusCode::SCREEN_NOT_FOUND; - } - RS_LOGD("SetVirtualScreenStatus ScreenId:%{public}" PRIu64 " screenStatus:%{public}d", - id, screenStatus); - success = screenManager_->SetVirtualScreenStatus(id, screenStatus); - return StatusCode::SUCCESS; -} - -ErrCode RSRenderServiceConnection::SetAncoForceDoDirect(bool direct, bool& res) -{ - std::lock_guard lock(mutex_); - if (mainThread_ == nullptr) { - res = false; - return ERR_INVALID_VALUE; - } - mainThread_->SetAncoForceDoDirect(direct); - res = true; - return ERR_OK; -} - -void RSRenderServiceConnection::SetFreeMultiWindowStatus(bool enable) -{ -#ifdef RS_ENABLE_GPU - if (mainThread_ == nullptr) { - return; - } - auto task = [enable]() -> void { - RSUifirstManager::Instance().SetFreeMultiWindowStatus(enable); - }; - mainThread_->PostTask(task); -#endif -} - -ErrCode RSRenderServiceConnection::RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, - sptr callback) -{ - RSSurfaceBufferCallbackManager::Instance().RegisterSurfaceBufferCallback(pid, uid, callback); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) -{ - RSSurfaceBufferCallbackManager::Instance().UnregisterSurfaceBufferCallback(pid, uid); - return ERR_OK; -} - ErrCode RSRenderServiceConnection::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { if (mainThread_ == nullptr) { @@ -3220,61 +1877,12 @@ ErrCode RSRenderServiceConnection::SetLayerTop(const std::string &nodeIdStr, boo return ERR_OK; } -ErrCode RSRenderServiceConnection::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) -{ - if (mainThread_ == nullptr) { - return ERR_INVALID_VALUE; - } - auto task = [weakThis = wptr(this), nodeIdStr, isForceRefresh]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - auto& context = connection->mainThread_->GetContext(); - context.GetNodeMap().TraverseSurfaceNodes( - [&nodeIdStr, &isForceRefresh](const std::shared_ptr& surfaceNode) mutable { - if ((surfaceNode != nullptr) && (surfaceNode->GetName() == nodeIdStr) && - (surfaceNode->GetSurfaceNodeType() == RSSurfaceNodeType::SELF_DRAWING_NODE)) { - surfaceNode->SetForceRefresh(isForceRefresh); - return; - } - }); - }; - mainThread_->PostTask(task); - return ERR_OK; -} - void RSRenderServiceConnection::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { RSTransactionDataCallbackManager::Instance().RegisterTransactionDataCallback(token, timeStamp, callback); } -void RSRenderServiceConnection::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) -{ - if (mainThread_ == nullptr) { - return; - } - auto task = [weakThis = wptr(this), nodeIdStr, isColorFollow]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - auto& context = connection->mainThread_->GetContext(); - context.GetNodeMap().TraverseSurfaceNodes( - [&nodeIdStr, &isColorFollow](const std::shared_ptr& surfaceNode) mutable { - if ((surfaceNode != nullptr) && (surfaceNode->GetName() == nodeIdStr) && - (surfaceNode->GetSurfaceNodeType() == RSSurfaceNodeType::SELF_DRAWING_NODE)) { - surfaceNode->SetColorFollow(isColorFollow); - return; - } - }); - connection->mainThread_->SetDirtyFlag(); - connection->mainThread_->RequestNextVSync(); - }; - mainThread_->PostTask(task); -} - ErrCode RSRenderServiceConnection::NotifyScreenSwitched() { std::lock_guard lock(mutex_); @@ -3288,36 +1896,6 @@ ErrCode RSRenderServiceConnection::NotifyScreenSwitched() return ERR_OK; } -ErrCode RSRenderServiceConnection::SetWindowContainer(NodeId nodeId, bool value) -{ - if (!mainThread_) { - return ERR_INVALID_VALUE; - } - auto task = [weakThis = wptr(this), nodeId, value]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - auto& nodeMap = connection->mainThread_->GetContext().GetNodeMap(); - if (auto node = nodeMap.GetRenderNode(nodeId)) { - auto displayNodeId = node->GetLogicalDisplayNodeId(); - if (auto displayNode = nodeMap.GetRenderNode(displayNodeId)) { - RS_LOGD("SetWindowContainer nodeId: %{public}" PRIu64 ", value: %{public}d", - nodeId, value); - displayNode->SetWindowContainer(value ? node : nullptr); - } else { - RS_LOGE("SetWindowContainer displayNode is nullptr, nodeId: %{public}" - PRIu64, displayNodeId); - } - } else { - RS_LOGE("SetWindowContainer node is nullptr, nodeId: %{public}" PRIu64, - nodeId); - } - }; - mainThread_->PostTask(task); - return ERR_OK; -} - int32_t RSRenderServiceConnection::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) { @@ -3370,11 +1948,6 @@ ErrCode RSRenderServiceConnection::NotifyPageName(const std::string &packageName return StatusCode::SUCCESS; } -bool RSRenderServiceConnection::GetHighContrastTextState() -{ - return RSBaseRenderEngine::IsHighContrastEnabled(); -} - ErrCode RSRenderServiceConnection::AvcodecVideoStart( uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { @@ -3388,63 +1961,6 @@ ErrCode RSRenderServiceConnection::AvcodecVideoStop(uint64_t uniqueId, std::stri return ERR_OK; } -ErrCode RSRenderServiceConnection::SetBehindWindowFilterEnabled(bool enabled) -{ - if (!mainThread_) { - RS_LOGE("SetBehindWindowFilterEnabled mainThread_ is nullptr."); - return ERR_INVALID_VALUE; - } - auto task = [weakThis = wptr(this), enabled]() -> void { - sptr connection = weakThis.promote(); - if (connection == nullptr || connection->mainThread_ == nullptr) { - return; - } - if (RSSystemProperties::GetBehindWindowFilterEnabled() == enabled) { - return; - } - RSSystemProperties::SetBehindWindowFilterEnabled(enabled); - auto& nodeMap = connection->mainThread_->GetContext().GetNodeMap(); - bool needRequestNextVSync = false; - nodeMap.TraverseSurfaceNodes( - [&needRequestNextVSync](const std::shared_ptr& surfaceNode) mutable { - if (!surfaceNode) { - return; - } - if (!surfaceNode->NeedUpdateDrawableBehindWindow()) { - return; - } - surfaceNode->SetContentDirty(); - needRequestNextVSync = true; - }); - if (needRequestNextVSync) { - connection->mainThread_->RequestNextVSync(); - connection->mainThread_->SetForceUpdateUniRenderFlag(true); - } - }; - mainThread_->PostTask(task); - return ERR_OK; -} - -ErrCode RSRenderServiceConnection::GetBehindWindowFilterEnabled(bool& enabled) -{ - enabled = RSSystemProperties::GetBehindWindowFilterEnabled(); - return ERR_OK; -} - -int32_t RSRenderServiceConnection::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) -{ - MemorySnapshotInfo memorySnapshotInfo; - - bool ret = MemorySnapshot::Instance().GetMemorySnapshotInfoByPid(pid, memorySnapshotInfo); - if (!ret) { - RS_LOGD("RSRenderServiceConnection::GetPidGpuMemoryInMB fail to find pid!"); - return ERR_INVALID_VALUE; - } - gpuMemInMB = static_cast(memorySnapshotInfo.gpuMemory) / MEM_BYTE_TO_MB; - RS_LOGD("RSRenderServiceConnection::GetPidGpuMemoryInMB called succ"); - return ERR_OK; -} - RetCodeHrpService RSRenderServiceConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h index 76312f1fb2..47d4f9edb3 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h @@ -75,13 +75,6 @@ private: const sptr& token, VSyncConnParam vsyncConnParam = {0, 0, false}) override; - ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) override; - - ErrCode CreatePixelMapFromSurface(sptr surface, - const Rect &srcRect, std::shared_ptr &pixelMap) override; - - ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) override; - ErrCode GetDefaultScreenId(uint64_t& screenId) override; ErrCode GetActiveScreenId(uint64_t& screenId) override; @@ -97,40 +90,10 @@ private: int32_t flags = 0, std::vector whiteList = {}) override; - int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) override; - - ErrCode SetVirtualScreenTypeBlackList( - ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) override; - - ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; - - ErrCode RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; - - int32_t SetVirtualScreenSecurityExemptionList( - ScreenId id, const std::vector& securityExemptionList) override; - - int32_t SetScreenSecurityMask(ScreenId id, - std::shared_ptr securityMask) override; - - int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false) override; - - int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override; - int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) override; void RemoveVirtualScreen(ScreenId id) override; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, - int64_t interval, int32_t rangeSize) override; - - int32_t SetPointerColorInversionEnabled(bool enable) override; - - int32_t RegisterPointerLuminanceChangeCallback(sptr callback) override; - - int32_t UnRegisterPointerLuminanceChangeCallback() override; -#endif - int32_t SetScreenChangeCallback(sptr callback) override; void SetScreenActiveMode(ScreenId id, uint32_t modeId) override; @@ -139,9 +102,6 @@ private: void SetRefreshRateMode(int32_t refreshRateMode) override; - void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, - int32_t animatorExpectedFrameRate) override; - void UnregisterFrameRateLinker(FrameRateLinkerId id) override; uint32_t GetScreenCurrentRefreshRate(ScreenId id) override; @@ -163,43 +123,12 @@ private: int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; - ErrCode MarkPowerOffNeedProcessOneFrame() override; - ErrCode RepaintEverything() override; - ErrCode ForceRefreshOneFrameWithNextVSync() override; - - void DisablePowerOffRenderControl(ScreenId id) override; - void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) override; - void TakeSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, - const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; - - std::vector>> TakeSurfaceCaptureSoloNode( - NodeId id, const RSSurfaceCaptureConfig& captureConfig, - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; - - void TakeSelfSurfaceCapture( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; - - ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) override; - - void TakeUICaptureInRange( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; - - ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, - float positionZ, float positionW) override; - ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) override; - void UnRegisterApplicationAgent(sptr app); - - RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override; - ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& info) override; std::vector GetScreenSupportedModes(ScreenId id) override; @@ -232,29 +161,10 @@ private: int32_t SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) override; - bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) override; - - int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) override; - - bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) override; - ErrCode SetGlobalDarkColorMode(bool isDark) override; int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) override; - int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override; - - ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) override; - - ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) override; - - ErrCode GetScreenSupportedHDRFormats( - ScreenId id, std::vector& hdrFormats, int32_t& resCode) override; - - ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) override; - - ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) override; - ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) override; ErrCode GetScreenSupportedColorSpaces( @@ -269,77 +179,20 @@ private: ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) override; ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) override; - bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) override; - bool UnRegisterTypeface(uint64_t globalUniqueId) override; int32_t GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) override; - ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) override; - - ErrCode SetVirtualScreenRefreshRate( - ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) override; - ErrCode SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) override; void SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) override; void SetScreenFrameGravity(ScreenId id, int32_t gravity) override; - ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) override; - - int32_t RegisterSurfaceOcclusionChangeCallback( - NodeId id, sptr callback, std::vector& partitionPoints) override; - - int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) override; - - int32_t RegisterHgmConfigChangeCallback(sptr callback) override; - - int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) override; - - int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) override; - - int32_t RegisterFirstFrameCommitCallback(sptr callback) override; - - int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, - sptr callback) override; - - ErrCode SetAppWindowNum(uint32_t num) override; - - ErrCode SetSystemAnimatedScenes( - SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) override; - - void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) override; - - ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) override; - - int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) override; - - ErrCode ReportJankStats() override; - - ErrCode ReportEventResponse(DataBaseRs info) override; - - ErrCode ReportEventComplete(DataBaseRs info) override; - - ErrCode ReportEventJankFrame(DataBaseRs info) override; - - void ReportRsSceneJankStart(AppInfo info) override; - - void ReportRsSceneJankEnd(AppInfo info) override; - - ErrCode ReportGameStateData(GameStateData info) override; - ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) override; ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) override; - ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) override; - - void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) override; - - void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, - const std::vector>& newConfig) override; - void NotifyRefreshRateEvent(const EventInfo& eventInfo) override; void SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) override; @@ -348,67 +201,29 @@ private: ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) override; - bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) override; - ErrCode NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) override; void NotifyDynamicModeEvent(bool enableDynamicModeEvent) override; - ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) override; - ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) override; - ErrCode SetCacheEnabledForRotation(bool isEnabled) override; - - ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) override; - - std::vector GetActiveDirtyRegionInfo() override; - - GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() override; - LayerComposeInfo GetLayerComposeInfo() override; HwcDisabledReasonInfos GetHwcDisabledReasonInfo() override; - ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) override; - - ErrCode SetVmaCacheStatus(bool flag) override; - - int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, - bool unobscured = false) override; - #ifdef TP_FEATURE_ENABLE ErrCode SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) override; #endif - void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) override; - ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) override; - - ErrCode DropFrameByPid(const std::vector pidList) override; - - ErrCode SetAncoForceDoDirect(bool direct, bool& res) override; - - void SetFreeMultiWindowStatus(bool enable) override; - ErrCode SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) override; ErrCode SetLayerTop(const std::string &nodeIdStr, bool isTop) override; - ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) override; - void RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) override; - void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override; - - ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, - sptr callback) override; - ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) override; - ErrCode NotifyScreenSwitched() override; - ErrCode SetWindowContainer(NodeId nodeId, bool value) override; - int32_t RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) override; @@ -420,18 +235,10 @@ private: ErrCode NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) override; - bool GetHighContrastTextState() override; - - ErrCode SetBehindWindowFilterEnabled(bool enabled) override; - - ErrCode GetBehindWindowFilterEnabled(bool& enabled) override; - ErrCode AvcodecVideoStart(uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) override; ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) override; - int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) override; - RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) override; RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, diff --git a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp b/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp new file mode 100644 index 0000000000..3775b7d655 --- /dev/null +++ b/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp @@ -0,0 +1,3018 @@ +/* + * Copyright (c) 2021-2023 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. + */ + +#include "rs_render_process_connection_stub.h" +#include +#include +#include "ivsync_connection.h" +#ifdef RES_SCHED_ENABLE +#include "res_sched_client.h" +#include "res_type.h" +#include +#endif +#include "securec.h" +#include "sys_binder.h" + +#include "command/rs_command_factory.h" +#include "command/rs_command_verify_helper.h" +#include "common/rs_xcollie.h" +#include "hgm_frame_rate_manager.h" +#include "memory/rs_memory_flow_control.h" +#include "pipeline/render_thread/rs_base_render_util.h" +#include "pipeline/main_thread/rs_main_thread.h" +#include "pipeline/rs_uni_render_judgement.h" +#include "platform/common/rs_log.h" +#include "transaction/rs_ashmem_helper.h" +#include "transaction/rs_unmarshal_thread.h" +#include "transaction/rs_hrp_service.h" +#include "render/rs_typeface_cache.h" +#include "rs_trace.h" +#include "rs_profiler.h" +#include "app_mgr_client.h" + +namespace OHOS { +namespace Rosen { +namespace { +constexpr size_t MAX_DATA_SIZE_FOR_UNMARSHALLING_IN_PLACE = 1024 * 15; // 15kB +constexpr size_t FILE_DESCRIPTOR_LIMIT = 15; +constexpr size_t MAX_OBJECTNUM = 512; +constexpr size_t MAX_DATA_SIZE = 1024 * 1024; // 1MB +static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 +#ifdef RES_SCHED_ENABLE +const uint32_t RS_IPC_QOS_LEVEL = 7; +constexpr const char* RS_BUNDLE_NAME = "render_process"; +#endif +static constexpr std::array descriptorCheckList = { + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST), + static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST), + static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT), + static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE), + static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER), + static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING), + static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC), + static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP), +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK), +#endif + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE), + static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK), + static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP), + static_cast(RSIRenderServiceConnectionInterfaceCode::EXECUTE_SYNCHRONOUS_TASK), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END), + static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT), + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE), + static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE), + static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT), + static_cast(RSIRenderServiceConnectionInterfaceCode::NEED_REGISTER_TYPEFACE), + static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER), + static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK), + static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START), + static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP), + static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED), + static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB), + static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE), + static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_POPULATE_FILES), + static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN), +}; + +void CopyFileDescriptor(MessageParcel& old, MessageParcel& copied) +{ + binder_size_t* object = reinterpret_cast(old.GetObjectOffsets()); + binder_size_t* copiedObject = reinterpret_cast(copied.GetObjectOffsets()); + + size_t objectNum = old.GetOffsetsSize(); + + uintptr_t data = old.GetData(); + uintptr_t copiedData = copied.GetData(); + + for (size_t i = 0; i < objectNum; i++) { + const flat_binder_object* flat = reinterpret_cast(data + object[i]); + flat_binder_object* copiedFlat = reinterpret_cast(copiedData + copiedObject[i]); + + if (flat->hdr.type == BINDER_TYPE_FD && flat->handle >= 0) { + int32_t val = dup(flat->handle); + if (val < 0) { + ROSEN_LOGW("CopyFileDescriptor dup failed, fd:%{public}d, handle:%{public}" PRIu32, val, + static_cast(flat->handle)); + } + copiedFlat->handle = static_cast(val); + } + } +} + +std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callingPid) +{ + if (RSSystemProperties::GetCacheEnabledForRotation() && + RSMainThread::Instance()->GetDesktopPidForRotationScene() != callingPid) { + return nullptr; + } + auto dataSize = old.GetDataSize(); + if (dataSize <= MAX_DATA_SIZE_FOR_UNMARSHALLING_IN_PLACE && old.GetOffsetsSize() < FILE_DESCRIPTOR_LIMIT) { + return nullptr; + } + if (dataSize > MAX_DATA_SIZE) { + return nullptr; + } + if (dataSize == 0) { + return nullptr; + } + + if (old.GetOffsetsSize() > MAX_OBJECTNUM) { + ROSEN_LOGW("RSRenderProcessConnectionStub::CopyParcelIfNeed failed, parcel fdCnt: %{public}zu is too large", + old.GetOffsetsSize()); + return nullptr; + } + + RS_TRACE_NAME("CopyParcelForUnmarsh: size:" + std::to_string(dataSize)); + void* base = malloc(dataSize); + if (base == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed malloc failed"); + return nullptr; + } + if (memcpy_s(base, dataSize, reinterpret_cast(old.GetData()), dataSize) != 0) { + RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed copy parcel data failed"); + free(base); + return nullptr; + } + + auto parcelCopied = RS_PROFILER_COPY_PARCEL(old); + if (!parcelCopied->ParseFrom(reinterpret_cast(base), dataSize)) { + RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed ParseFrom failed"); + free(base); + return nullptr; + } + + auto objectNum = old.GetOffsetsSize(); + if (objectNum != 0) { + parcelCopied->InjectOffsets(old.GetObjectOffsets(), objectNum); + CopyFileDescriptor(old, *parcelCopied); + } + int32_t data{0}; + if (!parcelCopied->ReadInt32(data)) { + RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed parcel data Read failed"); + return nullptr; + } + if (data != 0) { + RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed parcel data not match"); + return nullptr; + } + return parcelCopied; +} + +bool CheckCreateNodeAndSurface(pid_t pid, RSSurfaceNodeType nodeType, SurfaceWindowType windowType) +{ + constexpr int nodeTypeMin = static_cast(RSSurfaceNodeType::DEFAULT); + constexpr int nodeTypeMax = static_cast(RSSurfaceNodeType::NODE_MAX); + + int typeNum = static_cast(nodeType); + if (typeNum < nodeTypeMin || typeNum > nodeTypeMax) { + RS_LOGW("CREATE_NODE_AND_SURFACE invalid RSSurfaceNodeType"); + return false; + } + if (windowType != SurfaceWindowType::DEFAULT_WINDOW && !IS_SCB_WINDOW_TYPE(windowType)) { + RS_LOGW("CREATE_NODE_AND_SURFACE invalid SurfaceWindowType"); + return false; + } + + bool isTokenTypeValid = true; + bool isNonSystemAppCalling = false; + RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemAppCalling); + if (isNonSystemAppCalling) { + if (nodeType != RSSurfaceNodeType::DEFAULT && + nodeType != RSSurfaceNodeType::APP_WINDOW_NODE && + nodeType != RSSurfaceNodeType::SELF_DRAWING_NODE && + nodeType != RSSurfaceNodeType::UI_EXTENSION_COMMON_NODE) { + RS_LOGW("CREATE_NODE_AND_SURFACE NonSystemAppCalling invalid RSSurfaceNodeType %{public}d, pid %d", + typeNum, pid); + return false; + } + if (windowType != SurfaceWindowType::DEFAULT_WINDOW) { + RS_LOGW("CREATE_NODE_AND_SURFACE NonSystemAppCalling invalid SurfaceWindowType %{public}d, pid %d", + static_cast(windowType), pid); + return false; + } + } + + return true; +} + +std::string GetBundleName(pid_t pid) +{ + std::string bundleName; + static const auto appMgrClient = std::make_shared(); + if (appMgrClient == nullptr) { + RS_LOGE("GetBundleName get appMgrClient fail."); + return bundleName; + } + int32_t uid = 0; + appMgrClient->GetBundleNameByPid(pid, bundleName, uid); + return bundleName; +} + +bool IsValidCallingPid(pid_t pid, pid_t callingPid) +{ + return (callingPid == getpid()) || (callingPid == pid); +} + +static void TypefaceXcollieCallback(void* arg) +{ + if (arg) { + bool* isTrigger = static_cast(arg); + *isTrigger = true; + } +} +} + +void RSRenderProcessConnectionStub::SetQos() +{ +#ifdef RES_SCHED_ENABLE + std::string strBundleName = RS_BUNDLE_NAME; + std::string strPid = std::to_string(getpid()); + std::string strTid = std::to_string(gettid()); + std::string strQos = std::to_string(RS_IPC_QOS_LEVEL); + std::unordered_map mapPayload; + mapPayload["pid"] = strPid; + mapPayload[strTid] = strQos; + mapPayload["bundleName"] = strBundleName; + OHOS::ResourceSchedule::ResSchedClient::GetInstance().ReportData( + OHOS::ResourceSchedule::ResType::RES_TYPE_THREAD_QOS_CHANGE, 0, mapPayload); + struct sched_param param = {0}; + param.sched_priority = 1; + if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) { + RS_LOGE("RSRenderProcessConnectionStub Couldn't set SCHED_FIFO."); + } else { + RS_LOGI("RSRenderProcessConnectionStub set SCHED_FIFO succeed."); + } +#endif +} + +int RSRenderProcessConnectionStub::OnRemoteRequest( + uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) +{ + uint32_t parcelNumber = RS_PROFILER_ON_REMOTE_REQUEST(this, code, data, reply, option); + + AshmemFdContainer::SetIsUnmarshalThread(false); + pid_t callingPid = GetCallingPid(); + RSMarshallingHelper::SetCallingPid(callingPid); + auto tid = gettid(); + { + std::lock_guard lock(mutex_); + if (tids_.find(tid) == tids_.end()) { + SetQos(); + tids_.insert(tid); + } + } + if (std::find(std::cbegin(descriptorCheckList), std::cend(descriptorCheckList), code) != + std::cend(descriptorCheckList)) { + auto token = data.ReadInterfaceToken(); + if (token != RSIRenderProcessConnection::GetDescriptor()) { + if (code == static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE)) { + if (!reply.WriteInt32(0)) { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest Write failed."); + return ERR_INVALID_REPLY; + } + } + return ERR_INVALID_STATE; + } + } + auto accessible = securityManager_.IsInterfaceCodeAccessible(code); + if (!accessible && code != static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE) && + code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC) && + code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO) && + code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER) && + code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER)) { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest no permission code:%{public}d", code); + return ERR_INVALID_STATE; + } + int ret = ERR_NONE; + switch (code) { + case static_cast(RSIRenderServiceConnectionInterfaceCode::COMMIT_TRANSACTION): { + bool isTokenTypeValid = true; + bool isNonSystemAppCalling = false; + RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemAppCalling); + if (!isTokenTypeValid) { + RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION invalid token type"); + return ERR_INVALID_STATE; + } + if (isNonSystemAppCalling) { + RsCommandVerifyHelper::GetInstance().RegisterNonSystemPid(callingPid); + } + RS_TRACE_NAME_FMT("Recv Parcel Size:%zu, fdCnt:%zu", data.GetDataSize(), data.GetOffsetsSize()); + static bool isUniRender = RSUniRenderJudgement::IsUniRender(); + std::shared_ptr parsedParcel; + std::unique_ptr ashmemFdWorker = nullptr; + std::shared_ptr ashmemFlowControlUnit = nullptr; + int32_t readData{0}; + if (!data.ReadInt32(readData)) { + RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION read parcel failed"); + return ERR_INVALID_DATA; + } + if (readData == 0) { // indicate normal parcel + if (isUniRender) { + // in uni render mode, if parcel size over threshold, + // Unmarshalling task will be post to RSUnmarshalThread, + // copy the origin parcel to maintain the parcel lifetime + parsedParcel = CopyParcelIfNeed(data, callingPid); + } + if (parsedParcel == nullptr) { + // no need to copy or copy failed, use original parcel + // execute Unmarshalling immediately + + RSMarshallingHelper::UnmarshallingTransactionVer(data); + + auto transactionData = RSBaseRenderUtil::ParseTransactionData(data, parcelNumber); + if (transactionData && isNonSystemAppCalling) { + const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); + if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { + RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + } + } + CommitTransaction(transactionData); + break; + } + } else { + // indicate ashmem parcel + // should be parsed to normal parcel before Unmarshalling + parsedParcel = RSAshmemHelper::ParseFromAshmemParcel(&data, ashmemFdWorker, ashmemFlowControlUnit, + callingPid); + if (parsedParcel) { + parcelNumber = RS_PROFILER_ON_REMOTE_REQUEST(this, code, *parsedParcel, reply, option); + } + } + if (parsedParcel == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION failed: parsed parcel is nullptr"); + return ERR_INVALID_DATA; + } + RSMarshallingHelper::UnmarshallingTransactionVer(*parsedParcel); + if (isUniRender) { + // post Unmarshalling task to RSUnmarshalThread + RSUnmarshalThread::Instance().RecvParcel(parsedParcel, isNonSystemAppCalling, callingPid, + std::move(ashmemFdWorker), ashmemFlowControlUnit, parcelNumber); + } else { + // execute Unmarshalling immediately + auto transactionData = RSBaseRenderUtil::ParseTransactionData(*parsedParcel, parcelNumber); + if (transactionData && isNonSystemAppCalling) { + const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); + if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { + RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + } + } + CommitTransaction(transactionData); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_UNI_RENDER_ENABLED): { + bool enable; + if (GetUniRenderEnabled(enable) != ERR_OK || !reply.WriteBool(enable)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_UNI_RENDER_ENABLED read enable failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE): { + uint64_t nodeId{0}; + if (!data.ReadUint64(nodeId)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE read nodeId failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool isNonSystemCalling = false; + bool isTokenTypeValid = true; + RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemCalling); + if (isNonSystemCalling && !IsValidCallingPid(ExtractPid(nodeId), callingPid)) { + RS_LOGW("CREATE_NODE invalid nodeId[%{public}" PRIu64 "] pid[%{public}d]", nodeId, callingPid); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_NODE_ID(data, nodeId); + std::string surfaceName; + if (!data.ReadString(surfaceName)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE read surfaceName failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSSurfaceRenderNodeConfig config = {.id = nodeId, .name = surfaceName}; + bool success; + if (CreateNode(config, success) != ERR_OK || !reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE Write success failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE_AND_SURFACE): { + uint64_t nodeId{0}; + if (!data.ReadUint64(nodeId)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read nodeId failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(nodeId), callingPid)) { + RS_LOGW("CREATE_NODE_AND_SURFACE invalid nodeId[%" PRIu64 "] pid[%d]", nodeId, callingPid); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_NODE_ID(data, nodeId); + std::string surfaceName; + uint8_t type { 0 }; + bool isTextureExportNode { false }; + bool isSync { false }; + uint8_t surfaceWindowType { 0 }; + bool unobscured { false }; + if (!data.ReadString(surfaceName) || !data.ReadUint8(type) || !data.ReadBool(isTextureExportNode) || + !data.ReadBool(isSync) || !data.ReadUint8(surfaceWindowType) || !data.ReadBool(unobscured)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read surfaceRenderNodeConfig failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!CheckCreateNodeAndSurface(callingPid, static_cast(type), + static_cast(surfaceWindowType))) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE CheckCreateNodeAndSurface failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool needGetBundleName = (type == static_cast(RSSurfaceNodeType::SELF_DRAWING_NODE)); + RSSurfaceRenderNodeConfig config = { .id = nodeId, + .name = surfaceName, + .nodeType = static_cast(type), + .isTextureExportNode = isTextureExportNode, + .isSync = isSync, + .surfaceWindowType = static_cast(surfaceWindowType), + .bundleName = needGetBundleName ? GetBundleName(ExtractPid(nodeId)) : "" }; + sptr surface = nullptr; + ErrCode err = CreateNodeAndSurface(config, surface, unobscured); + if ((err != ERR_OK) || (surface == nullptr)) { + ret = ERR_NULL_OBJECT; + break; + } + auto producer = surface->GetProducer(); + if (!reply.WriteRemoteObject(producer->AsObject())) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read RemoteObject failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO): { + int32_t pid{0}; + if (!data.ReadInt32(pid)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO read pid failed!"); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_PID(data, pid); + int32_t uid{0}; + std::string bundleName; + std::string abilityName; + uint64_t focusNodeId{0}; + if (!data.ReadInt32(uid) || !data.ReadString(bundleName) || !data.ReadString(abilityName) || + !RSMarshallingHelper::UnmarshallingPidPlusId(data, focusNodeId)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + FocusAppInfo info = { + .pid = pid, + .uid = uid, + .bundleName = bundleName, + .abilityName = abilityName, + .focusNodeId = focusNodeId}; + int32_t repCode; + if (SetFocusAppInfo(info, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + std::vector blackListVector; + if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetVirtualScreenBlackList(id, blackListVector); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + std::vector typeBlackListVector; + if (!data.ReadUint64(id) || !data.ReadUInt8Vector(&typeBlackListVector)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t repCode; + SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); + if (!reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST Write repCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + std::vector blackListVector; + if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { + RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t repCode; + AddVirtualScreenBlackList(id, blackListVector, repCode); + if (!reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + std::vector blackListVector; + if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { + RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t repCode; + RemoveVirtualScreenBlackList(id, blackListVector, repCode); + if (!reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::REMOVE_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + std::vector securityExemptionList; + if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&securityExemptionList)) { + RS_LOGE( + "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST" + " failed: too many lists."); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetVirtualScreenSecurityExemptionList(id, securityExemptionList); + if (!reply.WriteInt32(status)) { + RS_LOGE( + "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + bool enable{false}; + if (!data.ReadUint64(id) || !data.ReadBool(enable)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SECURITY_MASK read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + std::shared_ptr securityMask{nullptr}; + if (enable) { + securityMask = std::shared_ptr(data.ReadParcelable()); + } + int32_t result = SetScreenSecurityMask(id, std::move(securityMask)); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SECURITY_MASK Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT): { + // read the parcel data. + ScreenId id = INVALID_SCREEN_ID; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read id failed!"); + ret = ERR_INVALID_REPLY; + break; + } + int32_t x = -1; + int32_t y = -1; + int32_t w = -1; + int32_t h = -1; + if (!data.ReadInt32(x) || !data.ReadInt32(y) || + !data.ReadInt32(w) || !data.ReadInt32(h)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read parcel failed!"); + ret = ERR_INVALID_REPLY; + break; + } + auto mainScreenRect = Rect { + .x = x, + .y = y, + .w = w, + .h = h + }; + bool supportRotation{false}; + if (!data.ReadBool(supportRotation)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read supportRotation failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + bool enable{false}; + if (!data.ReadUint64(id) || !data.ReadBool(enable)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t result = SetCastScreenEnableSkipWindow(id, enable); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE): { + // read the parcel data. + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + auto bufferProducer = iface_cast(remoteObject); + sptr surface = Surface::CreateSurfaceAsProducer(bufferProducer); + if (surface == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + int32_t status = SetVirtualScreenSurface(id, surface); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::REMOVE_VIRTUAL_SCREEN Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + RemoveVirtualScreen(id); + break; + } +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG): { + float darkBuffer { 0.f }; + float brightBuffer { 0.f }; + int64_t interval { 0 }; + int32_t rangeSize { 0 }; + if (!data.ReadFloat(darkBuffer) || !data.ReadFloat(brightBuffer) || !data.ReadInt64(interval) || + !data.ReadInt32(rangeSize)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED): { + bool enable { false }; + if (!data.ReadBool(enable)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED read enable failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetPointerColorInversionEnabled(enable); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK): { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + int32_t status = RegisterPointerLuminanceChangeCallback(cb); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK): { + int32_t status = UnRegisterPointerLuminanceChangeCallback(); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } +#endif + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE): { + ScreenId id{INVALID_SCREEN_ID}; + uint32_t modeId{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(modeId)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_ACTIVE_MODE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetScreenActiveMode(id, modeId); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE): { + FrameRateLinkerId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SYNC_FRAME_RATE_RANGE Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (ExtractPid(id) != callingPid) { + RS_LOGW("The SyncFrameRateRange isn't legal, frameRateLinkerId: %{public}" PRIu64 + ", callingPid:%{public}d", id, callingPid); + ret = ERR_INVALID_DATA; + break; + } + uint32_t min{0}; + uint32_t max{0}; + uint32_t preferred{0}; + uint32_t type{0}; + uint32_t componentScene{0}; + int32_t animatorExpectedFrameRate{0}; + if (!data.ReadUint32(min) || !data.ReadUint32(max) || !data.ReadUint32(preferred) || + !data.ReadUint32(type) || !data.ReadUint32(componentScene) || + !data.ReadInt32(animatorExpectedFrameRate)) { + RS_LOGE("RSRenderProcessConnectionStub::SYNC_FRAME_RATE_RANGE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SyncFrameRateRange(id, {min, max, preferred, type, static_cast(componentScene)}, + animatorExpectedFrameRate); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER): { + FrameRateLinkerId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_FRAME_RATE_LINKER Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (ExtractPid(id) != callingPid) { + RS_LOGW("The UnregisterFrameRateLinker isn't legal, frameRateLinkerId: %{public}" PRIu64 + ", callingPid:%{public}d", id, callingPid); + ret = ERR_INVALID_DATA; + break; + } + UnregisterFrameRateLinker(id); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO): { + auto token = data.ReadInterfaceToken(); + if (token != RSIRenderProcessConnection::GetDescriptor()) { + ret = ERR_INVALID_STATE; + break; + } + int32_t pid{0}; + if (!data.ReadInt32(pid)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO Read pid failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(pid, callingPid)) { + RS_LOGW("GET_REFRESH_INFO invalid pid[%{public}d]", callingPid); + ret = ERR_INVALID_DATA; + break; + } + std::string refreshInfo; + if (GetRefreshInfo(pid, refreshInfo) != ERR_OK || !reply.WriteString(refreshInfo)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO Write refreshInfo failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP): { + uint64_t nodeId{0}; + if (!data.ReadUint64(nodeId)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO_TO_SP Read nodeId failed!"); + ret = ERR_INVALID_DATA; + break; + } + std::string refreshInfoToSP; + if (GetRefreshInfoToSP(nodeId, refreshInfoToSP) != ERR_OK || !reply.WriteString(refreshInfoToSP)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO_TO_SP Write refreshInfoToSP failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION): { + ScreenId id{INVALID_SCREEN_ID}; + uint32_t width{0}; + uint32_t height{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetPhysicalScreenResolution(id, width, height); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION): { + ScreenId id{INVALID_SCREEN_ID}; + uint32_t width{0}; + uint32_t height{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = SetVirtualScreenResolution(id, width, height); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME): { + MarkPowerOffNeedProcessOneFrame(); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING): { + RepaintEverything(); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC): { + ForceRefreshOneFrameWithNextVSync(); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::DISABLE_RENDER_CONTROL_SCREEN Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + DisablePowerOffRenderControl(id); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE): { + NodeId id{0}; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture remoteObject is nullptr"); + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture cb is nullptr"); + break; + } + RSSurfaceCaptureConfig captureConfig; + RSSurfaceCaptureBlurParam blurParam; + Drawing::Rect specifiedAreaRect; + if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read captureConfig failed"); + break; + } + if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read blurParam failed"); + break; + } + if (!ReadSurfaceCaptureAreaRect(specifiedAreaRect, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read specifiedAreaRect failed"); + break; + } + + RSSurfaceCapturePermissions permissions; + permissions.screenCapturePermission = accessible; + permissions.isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( + RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::TAKE_SURFACE_CAPTURE"); + // Since GetCallingPid interface always returns 0 in asynchronous binder in Linux kernel system, + // we temporarily add a white list to avoid abnormal functionality or abnormal display. + // The white list will be removed after GetCallingPid interface can return real PID. + permissions.selfCapture = (ExtractPid(id) == callingPid || callingPid == 0); + TakeSurfaceCapture(id, cb, captureConfig, blurParam, specifiedAreaRect, permissions); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE_SOLO): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSSurfaceCaptureConfig captureConfig; + if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO read captureConfig failed"); + break; + } + RSSurfaceCapturePermissions permissions; + permissions.isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( + RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + + "::TAKE_SURFACE_CAPTURE_SOLO"); + permissions.selfCapture = ExtractPid(id) == callingPid; + std::vector>> pixelMapIdPairVector; + pixelMapIdPairVector = TakeSurfaceCaptureSoloNode(id, captureConfig, permissions); + if (!RSMarshallingHelper::Marshalling(reply, pixelMapIdPairVector)) { + ret = ERR_INVALID_REPLY; + RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Marshalling failed"); + break; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SELF_SURFACE_CAPTURE): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + ret = ERR_INVALID_DATA; + break; + } + if (ExtractPid(id) != callingPid) { + RS_LOGW("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture failed, nodeId:[%{public}" PRIu64 + "], callingPid:[%{public}d], pid:[%{public}d]", id, callingPid, ExtractPid(id)); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture remoteObject is nullptr"); + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture cb is nullptr"); + break; + } + RSSurfaceCaptureConfig captureConfig; + if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture read captureConfig failed"); + break; + } + TakeSelfSurfaceCapture(id, cb, captureConfig); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_UI_CAPTURE_IN_RANGE): { + NodeId id{0}; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE remoteObject is nullptr"); + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE cb is nullptr"); + break; + } + RSSurfaceCaptureConfig captureConfig; + if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE read captureConfig failed"); + break; + } + TakeUICaptureInRange(id, cb, captureConfig); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_FREEZE_IMMEDIATELY): { + NodeId id{0}; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool isFreeze{false}; + if (!data.ReadBool(isFreeze)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read isFreeze failed!"); + ret = ERR_INVALID_DATA; + break; + } + sptr cb; + RSSurfaceCaptureConfig captureConfig; + RSSurfaceCaptureBlurParam blurParam; + if (isFreeze) { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY remoteObject is nullptr"); + break; + } + cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY cb is nullptr"); + break; + } + if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY write captureConfig failed"); + break; + } + if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { + ret = ERR_INVALID_DATA; + RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read blurParam failed"); + break; + } + } + SetWindowFreezeImmediately(id, isFreeze, cb, captureConfig, blurParam); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_POSITION): { + NodeId id { 0 }; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_POSITION read nodeId failed!"); + break; + } + float positionX { 0.f }; + float positionY { 0.f }; + float positionZ { 0.f }; + float positionW { 0.f }; + if (!data.ReadFloat(positionX) || !data.ReadFloat(positionY) || !data.ReadFloat(positionZ) || + !data.ReadFloat(positionW)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_POSITION read position failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetHwcNodeBounds(id, positionX, positionY, positionZ, positionW); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT): { + pid_t pid = GetCallingPid(); + RS_PROFILER_PATCH_PID(data, pid); + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + sptr app = iface_cast(remoteObject); + if (app == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + RegisterApplicationAgent(pid, app); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSVirtualScreenResolution virtualScreenResolution = GetVirtualScreenResolution(id); + if (!reply.WriteParcelable(&virtualScreenResolution)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Write virtualScreenResolution " + "failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSScreenModeInfo screenModeInfo; + if (GetScreenActiveMode(id, screenModeInfo) != ERR_OK || !reply.WriteParcelable(&screenModeInfo)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC): { + int32_t pid{0}; + if (!data.ReadInt32(pid)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_PID(data, pid); + if (!IsValidCallingPid(pid, callingPid)) { + RS_LOGW("GET_MEMORY_GRAPHIC invalid pid[%{public}d]", callingPid); + ret = ERR_INVALID_DATA; + break; + } + MemoryGraphic memoryGraphic; + if (GetMemoryGraphic(pid, memoryGraphic) != ERR_OK || !reply.WriteParcelable(&memoryGraphic)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphic failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS): { + std::vector memoryGraphics; + if (GetMemoryGraphics(memoryGraphics) != ERR_OK || + !reply.WriteUint64(static_cast(memoryGraphics.size()))) { + RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphicsSize failed!"); + ret = ERR_INVALID_REPLY; + break; + } + for (uint32_t index = 0; index < memoryGraphics.size(); index++) { + if (!reply.WriteParcelable(&memoryGraphics[index])) { + RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphics failed!"); + ret = ERR_INVALID_REPLY; + break; + } + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE): { + float cpuMemSize = 0.f; + float gpuMemSize = 0.f; + if (GetTotalAppMemSize(cpuMemSize, gpuMemSize) != ERR_OK || !reply.WriteFloat(cpuMemSize) + || !reply.WriteFloat(gpuMemSize)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_TOTAL_APP_MEM_SIZE Write parcel failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_AVAILABLE_LISTENER Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!accessible && (ExtractPid(id) != callingPid)) { + RS_LOGW("The SetBufferAvailableListener isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + auto remoteObject = data.ReadRemoteObject(); + bool isFromRenderThread{false}; + if (!data.ReadBool(isFromRenderThread)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_AVAILABLE_LISTENER read isFromRenderThread failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + RegisterBufferAvailableListener(id, cb, isFromRenderThread); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_CLEAR_LISTENER Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!accessible && (ExtractPid(id) != callingPid)) { + RS_LOGW("The SetBufferClearListener isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + sptr cb = iface_cast(remoteObject); + if (cb == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + RegisterBufferClearListener(id, cb); + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION): { + ScreenId id{INVALID_SCREEN_ID}; + bool canvasRotation{false}; + if (!data.ReadUint64(id) || !data.ReadBool(canvasRotation)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool result = SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); + if (!reply.WriteBool(result)) { + RS_LOGE( + "RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Write parcel failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION): { + ScreenId id{INVALID_SCREEN_ID}; + bool isAutoRotation{false}; + if (!data.ReadUint64(id) || !data.ReadBool(isAutoRotation)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t result = SetVirtualScreenAutoRotation(id, isAutoRotation); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Write parcel failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE): { + ScreenId id{INVALID_SCREEN_ID}; + uint32_t scaleMode{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(scaleMode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool result = SetVirtualMirrorScreenScaleMode(id, static_cast(scaleMode)); + if (!reply.WriteBool(result)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Write parcel failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE): { + bool isDark{false}; + if (!data.ReadBool(isDark)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (SetGlobalDarkColorMode(isDark) != ERR_OK) { + RS_LOGE("RSRenderProcessConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID): { + uint64_t pid; + if (!data.ReadUint64(pid)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP_BY_PROCESSID Read pid failed!"); + ret = ERR_INVALID_DATA; + break; + } + std::vector pixelMapInfoVector; + int32_t repCode; + if (GetPixelMapByProcessId(pixelMapInfoVector, static_cast(pid), repCode) != ERR_OK || + !reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP_BY_PROCESSID Write repCode failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (!RSMarshallingHelper::Marshalling(reply, pixelMapInfoVector)) { + ret = ERR_INVALID_REPLY; + break; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE): { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + if (!reply.WriteInt32(0)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write Object failed!"); + ret = ERR_INVALID_REPLY; + break; + } + ret = ERR_NULL_OBJECT; + break; + } + auto bufferProducer = iface_cast(remoteObject); + sptr surface = Surface::CreateSurfaceAsProducer(bufferProducer); + if (surface == nullptr) { + if (!reply.WriteInt32(0)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write parcel failed!"); + ret = ERR_INVALID_REPLY; + break; + } + ret = ERR_NULL_OBJECT; + break; + } + int32_t x = 0; + int32_t y = 0; + int32_t w = 0; + int32_t h = 0; + if (!data.ReadInt32(x) || !data.ReadInt32(y) || !data.ReadInt32(w) || !data.ReadInt32(h)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto srcRect = Rect { + .x = x, + .y = y, + .w = w, + .h = h + }; + std::shared_ptr pixelMap = nullptr; + CreatePixelMapFromSurface(surface, srcRect, pixelMap); + if (pixelMap) { + if (!reply.WriteBool(true)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed"); + ret = ERR_INVALID_REPLY; + break; + } + if (!pixelMap->Marshalling(reply)) { + RS_LOGE("pixelMap Marshalling fail"); + ret = ERR_INVALID_REPLY; + } + } else { + if (!reply.WriteBool(false)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); + ret = ERR_INVALID_REPLY; + break; + } + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSScreenHDRCapability screenHDRCapability; + int32_t result = GetScreenHDRCapability(id, screenHDRCapability); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Write result failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (result != StatusCode::SUCCESS) { + ret = ERR_UNKNOWN_REASON; + break; + } + if (!reply.WriteParcelable(&screenHDRCapability)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Write screenHDRCapability failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + GraphicPixelFormat pixelFormat; + int32_t resCode; + GetPixelFormat(id, pixelFormat, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Write result failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (resCode != StatusCode::SUCCESS) { + break; + } + if (!reply.WriteUint32(static_cast(pixelFormat))) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Write pixelFormat failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t pixel{0}; + if (!data.ReadInt32(pixel)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT read pixelFormat failed!"); + ret = ERR_INVALID_DATA; + break; + } + GraphicPixelFormat pixelFormat = static_cast(pixel); + int32_t resCode; + SetPixelFormat(id, pixelFormat, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + std::vector hdrFormatsSend; + std::vector hdrFormats; + int32_t resCode; + GetScreenSupportedHDRFormats(id, hdrFormats, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write result failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (resCode != StatusCode::SUCCESS) { + break; + } + std::copy(hdrFormats.begin(), hdrFormats.end(), std::back_inserter(hdrFormatsSend)); + if (!reply.WriteUInt32Vector(hdrFormatsSend)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write hdrFormatsSend failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + ScreenHDRFormat hdrFormat; + int32_t resCode; + GetScreenHDRFormat(id, hdrFormat, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Write resCode failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (resCode != StatusCode::SUCCESS) { + break; + } + if (!reply.WriteUint32(hdrFormat)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Write hdrFormat failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT): { + ScreenId id{INVALID_SCREEN_ID}; + int32_t modeIdx{0}; + if (!data.ReadUint64(id) || !data.ReadInt32(modeIdx)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_HDR_FORMAT Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t resCode; + SetScreenHDRFormat(id, modeIdx, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_HDR_FORMAT Write resCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + HdrStatus hdrStatus; + int32_t resCode; + ret = GetScreenHDRStatus(id, hdrStatus, resCode); + if (ret != ERR_OK) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); + resCode = ret; + } + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (resCode != StatusCode::SUCCESS) { + break; + } + if (!reply.WriteUint32(hdrStatus)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + std::vector colorSpacesSend; + std::vector colorSpaces; + int32_t resCode; + GetScreenSupportedColorSpaces(id, colorSpaces, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (resCode != StatusCode::SUCCESS) { + break; + } + std::copy(colorSpaces.begin(), colorSpaces.end(), std::back_inserter(colorSpacesSend)); + if (!reply.WriteUInt32Vector(colorSpacesSend)) { + RS_LOGE( + "RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_BITMAP Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The GetBitmap isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + Drawing::Bitmap bm; + bool success; + if (GetBitmap(id, bm, success) != ERR_OK || !reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_BITMAP Write success failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (success) { + RSMarshallingHelper::Marshalling(reply, bm); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP): { + NodeId id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The GetPixelmap isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + std::shared_ptr pixelmap = + std::shared_ptr(data.ReadParcelable()); + Drawing::Rect rect; + RSMarshallingHelper::Unmarshalling(data, rect); + std::shared_ptr drawCmdList; + RSMarshallingHelper::Unmarshalling(data, drawCmdList); + bool success; + if (GetPixelmap(id, pixelmap, &rect, drawCmdList, success) != ERR_OK || + !reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP Write id failed!"); + ret = ERR_INVALID_REPLY; + break; + } + if (success) { + RSMarshallingHelper::Marshalling(reply, pixelmap); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NEED_REGISTER_TYPEFACE): { + bool result = false; + uint64_t uniqueId{0}; + uint32_t hash{0}; + if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { + RS_LOGE("RSRenderProcessConnectionStub::NEED_REGISTER_TYPEFACE read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); + if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { + result = !RSTypefaceCache::Instance().HasTypeface(uniqueId, hash); + } else { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + "no permission NEED_REGISTER_TYPEFACE", callingPid); + } + if (!reply.WriteBool(result)) { + RS_LOGE("RSRenderProcessConnectionStub::NEED_REGISTER_TYPEFACE Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE): { + bool xcollieFlag = false; + bool result = false; + std::shared_ptr typeface = nullptr; + { + // timer: 3s + OHOS::Rosen::RSXCollie registerTypefaceXCollie("registerTypefaceXCollie_" + + std::to_string(callingPid), 3, TypefaceXcollieCallback, &xcollieFlag, 0); + uint64_t uniqueId{0}; + uint32_t hash{0}; + if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_TYPEFACE read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + // safe check + if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { + result = RSMarshallingHelper::Unmarshalling(data, typeface); + if (result && typeface) { + typeface->SetHash(hash); + RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); + RegisterTypeface(uniqueId, typeface); + } + } else { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + "no permission REGISTER_TYPEFACE", callingPid); + } + } + if (xcollieFlag && typeface) { + RS_LOGW("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] typeface[%{public}s] " + "size[%{public}u], too big.", callingPid, typeface->GetFamilyName().c_str(), typeface->GetSize()); + } + if (!reply.WriteBool(result)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_TYPEFACE Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE): { + uint64_t uniqueId{0}; + if (!data.ReadUint64(uniqueId)) { + RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_TYPEFACE read uniqueId failed!"); + ret = ERR_INVALID_DATA; + break; + } + // safe check + if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { + RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); + UnRegisterTypeface(uniqueId); + } else { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + "no permission UNREGISTER_TYPEFACE", callingPid); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL): { + if (!securityManager_.IsInterfaceCodeAccessible(code)) { + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest no permission to access"\ + "SET_SCREEN_SKIP_FRAME_INTERVAL"); + return ERR_INVALID_STATE; + } + ScreenId id{INVALID_SCREEN_ID}; + uint32_t skipFrameInterval{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(skipFrameInterval)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t statusCode{ SUCCESS }; + if (SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode) != ERR_OK || + !reply.WriteInt32(statusCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE): { + ScreenId id = 0; + uint32_t maxRefreshRate = 0; + if (!data.ReadUint64(id) || !data.ReadUint32(maxRefreshRate)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + uint32_t actualRefreshRate = 0; + int32_t result = 0; + SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, result); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write result failed!"); + return ERR_INVALID_REPLY; + } + if (!reply.WriteUint32(actualRefreshRate)) { + RS_LOGE( + "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write actualRefreshRate failed!"); + return ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET): { + ScreenId id = INVALID_SCREEN_ID; + int32_t offsetX = 0; + int32_t offsetY = 0; + if (!data.ReadUint64(id) || !data.ReadInt32(offsetX) || !data.ReadInt32(offsetY)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_OFFSET Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetScreenOffset(id, offsetX, offsetY); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY): { + ScreenId id = INVALID_SCREEN_ID; + int32_t gravity = 0; + if (!data.ReadUint64(id) || !data.ReadInt32(gravity)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_FRAME_GRAVITY Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetScreenFrameGravity(id, gravity); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK): { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Read remoteObject failed!"); + ret = ERR_NULL_OBJECT; + break; + } + sptr callback = iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + int32_t repCode; + if (RegisterOcclusionChangeCallback(callback, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { + NodeId id{0}; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The RegisterSurfaceOcclusionChangeCallback isn't legal, nodeId:%{public}" PRIu64 ", " + "callingPid:%{public}d", id, callingPid); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read remoteObject " + "failed!"); + ret = ERR_NULL_OBJECT; + break; + } + sptr callback = + iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + std::vector partitionPoints; + if (!data.ReadFloatVector(&partitionPoints)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read " + "partitionPoints failed!"); + ret = ERR_TRANSACTION_FAILED; + break; + } + int32_t status = RegisterSurfaceOcclusionChangeCallback(id, callback, partitionPoints); + if (!reply.WriteInt32(status)) { + RS_LOGE( + "RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { + NodeId id{0}; + if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { + RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The UnRegisterSurfaceOcclusionChangeCallback isn't legal, nodeId:%{public}" PRIu64 ", " + "callingPid:%{public}d", id, callingPid); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = UnRegisterSurfaceOcclusionChangeCallback(id); + if (!reply.WriteInt32(status)) { + RS_LOGE( + "RSRenderProcessConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM): { + uint32_t num{0}; + if (!data.ReadUint32(num)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_APP_WINDOW_NUM Read num failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetAppWindowNum(num); + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES): { + uint32_t systemAnimatedScenes{0}; + bool isRegularAnimation{false}; + if (!data.ReadUint32(systemAnimatedScenes) || !data.ReadBool(isRegularAnimation)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SYSTEM_ANIMATED_SCENES Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool success; + if (SetSystemAnimatedScenes(static_cast(systemAnimatedScenes), + isRegularAnimation, success) != ERR_OK || !reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_SYSTEM_ANIMATED_SCENES Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK): { + if (!RSSystemProperties::GetSurfaceNodeWatermarkEnabled()) { + RS_LOGI("Current disenable water mark"); + break; + } + std::string name; + if (!data.ReadString(name)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_WATERMARK Read name failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto watermark = std::shared_ptr(data.ReadParcelable()); + if (watermark == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::std::shared_ptr watermark == nullptr"); + break; + } + bool success; + if (SetWatermark(name, watermark, success) != ERR_OK || !success) { + RS_LOGE("RSRenderProcessConnectionStub::SetWatermark failed"); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK): { + std::shared_ptr watermarkImg = + std::shared_ptr(data.ReadParcelable()); + bool isShow{false}; + if (!data.ReadBool(isShow)) { + RS_LOGE("RSRenderProcessConnectionStub::SHOW_WATERMARK Read isShow failed!"); + ret = ERR_INVALID_DATA; + break; + } + ShowWatermark(watermarkImg, isShow); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN): { + ScreenId id{INVALID_SCREEN_ID}; + uint32_t width{0}; + uint32_t height{0}; + if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { + RS_LOGE("RSRenderProcessConnectionStub::RESIZE_VIRTUAL_SCREEN Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = ResizeVirtualScreen(id, width, height); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::RESIZE_VIRTUAL_SCREEN Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS): { + ReportJankStats(); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE): { + DataBaseRs info; + if (!ReadDataBaseRs(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportEventResponse(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE): { + DataBaseRs info; + if (!ReadDataBaseRs(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportEventComplete(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME): { + DataBaseRs info; + if (!ReadDataBaseRs(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportEventJankFrame(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START): { + AppInfo info; + if (!ReadAppInfo(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportRsSceneJankStart(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END): { + AppInfo info; + if (!ReadAppInfo(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportRsSceneJankEnd(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE): { + GameStateData info; + if (!ReadGameStateDataRs(info, data)) { + ret = ERR_INVALID_DATA; + break; + } + ReportGameStateData(info); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::EXECUTE_SYNCHRONOUS_TASK): { + int16_t type{0}; + int16_t subType{0}; + if (!data.ReadInt16(type) || !data.ReadInt16(subType)) { + RS_LOGE("RSRenderProcessConnectionStub::EXECUTE_SYNCHRONOUS_TASK Read parcel failed!"); + ret = ERR_INVALID_STATE; + break; + } + if (type != RS_NODE_SYNCHRONOUS_READ_PROPERTY && type != RS_NODE_SYNCHRONOUS_GET_VALUE_FRACTION) { + ret = ERR_INVALID_STATE; + break; + } + auto func = RSCommandFactory::Instance().GetUnmarshallingFunc(type, subType); + if (func == nullptr) { + ret = ERR_INVALID_STATE; + break; + } + auto command = static_cast((*func)(data)); + if (command == nullptr) { + ret = ERR_INVALID_STATE; + break; + } + std::shared_ptr task(command); + const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); + if (!task->IsCallingPidValid(callingPid, nodeMap)) { + ret = ERR_INVALID_STATE; + break; + } + ExecuteSynchronousTask(task); + if (!task->Marshalling(reply)) { + ret = ERR_INVALID_STATE; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED) : { + uint64_t id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HARDWARE_ENABLED Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The SetHardwareEnabled isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + bool isEnabled{false}; + uint8_t selfDrawingType{static_cast(SelfDrawingNodeType::DEFAULT)}; + bool dynamicHardwareEnable{false}; + if (!data.ReadBool(isEnabled) || + !data.ReadUint8(selfDrawingType) || + !data.ReadBool(dynamicHardwareEnable)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HARDWARE_ENABLED Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetHardwareEnabled(id, isEnabled, static_cast(selfDrawingType), dynamicHardwareEnable); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT) : { + uint64_t id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( + RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + + "::SET_HIDE_PRIVACY_CONTENT"); + if (!isSystemCalling) { + if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NONSYSTEM_CALLING))) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write isSystemCalling failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + if (ExtractPid(id) != callingPid) { + RS_LOGW("The SetHidePrivacyContent isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NOT_SELF_CALLING))) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write ErrorCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + bool needHidePrivacyContent{false}; + if (!data.ReadBool(needHidePrivacyContent)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT read needHidePrivacyContent failed!"); + ret = ERR_INVALID_DATA; + break; + } + uint32_t resCode; + if (SetHidePrivacyContent(id, needHidePrivacyContent, resCode) != ERR_OK || + !reply.WriteUint32(resCode)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write resCode failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS) : { + int32_t lightFactorStatus{0}; + if (!data.ReadInt32(lightFactorStatus)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_LIGHT_FACTOR_STATUS Read lightFactorStatus failed!"); + ret = ERR_INVALID_DATA; + break; + } + NotifyLightFactorStatus(lightFactorStatus); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT) : { + uint32_t listSize{0}; + if (!data.ReadUint32(listSize)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_PACKAGE_EVENT Read listSize failed!"); + ret = ERR_INVALID_DATA; + break; + } + const uint32_t MAX_LIST_SIZE = 50; + if (listSize > MAX_LIST_SIZE) { + ret = ERR_INVALID_STATE; + break; + } + std::vector packageList; + bool errFlag{false}; + for (uint32_t i = 0; i < listSize; i++) { + std::string package; + if (!data.ReadString(package)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_PACKAGE_EVENT Read package failed!"); + errFlag = true; + break; + } + packageList.push_back(package); + } + if (errFlag) { + ret = ERR_INVALID_DATA; + break; + } + NotifyPackageEvent(listSize, packageList); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT) : { + std::string pkgName; + uint32_t listSize{0}; + if (!data.ReadString(pkgName) || !data.ReadUint32(listSize)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + const uint32_t MAX_LIST_SIZE = 50; + if (listSize > MAX_LIST_SIZE) { + ret = ERR_INVALID_STATE; + break; + } + + std::vector> newConfig; + bool errFlag{false}; + for (uint32_t i = 0; i < listSize; i++) { + std::string key; + std::string value; + if (!data.ReadString(key) || !data.ReadString(value)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read newConfig " + "failed!"); + errFlag = true; + break; + } + newConfig.push_back(make_pair(key, value)); + } + if (errFlag) { + ret = ERR_INVALID_STATE; + break; + } + NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT) : { + uint32_t pid{0}; + uint32_t rateDiscount{0}; + if (!data.ReadUint32(pid) || !data.ReadUint32(rateDiscount)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + NotifySoftVsyncEvent(pid, rateDiscount); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT) : { + uint32_t pid{0}; + std::string name; + uint32_t rateDiscount{0}; + if (!data.ReadUint32(pid) || !data.ReadString(name) || !data.ReadUint32(rateDiscount)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool result = NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); + if (!reply.WriteBool(result)) { + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT) : { + std::string eventName; + bool state{false}; + if (!data.ReadString(eventName) || !data.ReadBool(state)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_HGMCONFIG_EVENT Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + NotifyHgmConfigEvent(eventName, state); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE) : { + std::string id; + int32_t expectedFrameRate; + if (!data.ReadString(id) || !data.ReadInt32(expectedFrameRate)) { + RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + NotifyXComponentExpectedFrameRate(id, expectedFrameRate); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK) : { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_HGM_CFG_CALLBACK Read remoteObject failed!"); + ret = ERR_NULL_OBJECT; + break; + } + sptr callback = iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + int32_t status = RegisterHgmConfigChangeCallback(callback); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_HGM_CFG_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK) : { + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Read remoteObject failed!"); + ret = ERR_NULL_OBJECT; + break; + } + sptr callback = + iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + int32_t status = RegisterHgmRefreshRateModeChangeCallback(callback); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK) : { + sptr callback = nullptr; + sptr remoteObject = nullptr; + bool readRemoteObject{false}; + if (!data.ReadBool(readRemoteObject)) { + RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Read remoteObject failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (readRemoteObject) { + remoteObject = data.ReadRemoteObject(); + } + if (remoteObject != nullptr) { + callback = iface_cast(remoteObject); + } + int32_t status = RegisterHgmRefreshRateUpdateCallback(callback); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT) : { + sptr callback = nullptr; + sptr remoteObject = nullptr; + bool readRemoteObject{false}; + if (!data.ReadBool(readRemoteObject)) { + ret = ERR_INVALID_DATA; + break; + } + if (readRemoteObject) { + remoteObject = data.ReadRemoteObject(); + } + if (remoteObject != nullptr) { + callback = iface_cast(remoteObject); + } + int32_t status = RegisterFirstFrameCommitCallback(callback); + if (!reply.WriteInt32(status)) { + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK) : { + sptr callback = nullptr; + sptr remoteObject = nullptr; + int32_t dstPid{0}; + bool readRemoteObject{false}; + if (!data.ReadInt32(dstPid) || !data.ReadBool(readRemoteObject)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Read parcel " + "failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (readRemoteObject) { + remoteObject = data.ReadRemoteObject(); + } + if (remoteObject != nullptr) { + callback = iface_cast(remoteObject); + } + int32_t status = RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, callback); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Write status " + "failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED) : { + bool isEnabled = false; + if (!data.ReadBool(isEnabled)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_ROTATION_CACHE_ENABLED Read isEnabled failed!"); + ret = IPC_STUB_INVALID_DATA_ERR; + break; + } + SetCacheEnabledForRotation(isEnabled); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO) : { + const auto& activeDirtyRegionInfos = GetActiveDirtyRegionInfo(); + if (!reply.WriteInt32(activeDirtyRegionInfos.size())) { + RS_LOGE("RSRenderProcessConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfosSize " + "failed!"); + ret = ERR_INVALID_REPLY; + break; + } + for (const auto& activeDirtyRegionInfo : activeDirtyRegionInfos) { + if (!reply.WriteInt64(activeDirtyRegionInfo.activeDirtyRegionArea) || + !reply.WriteInt32(activeDirtyRegionInfo.activeFramesNumber) || + !reply.WriteInt32(activeDirtyRegionInfo.pidOfBelongsApp) || + !reply.WriteString(activeDirtyRegionInfo.windowName)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfos " + "failed!"); + ret = ERR_INVALID_REPLY; + break; + } + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO) : { + const auto& globalDirtyRegionInfo = GetGlobalDirtyRegionInfo(); + if (!reply.WriteInt64(globalDirtyRegionInfo.globalDirtyRegionAreas) || + !reply.WriteInt32(globalDirtyRegionInfo.globalFramesNumber) || + !reply.WriteInt32(globalDirtyRegionInfo.skipProcessFramesNumber) || + !reply.WriteInt32(globalDirtyRegionInfo.mostSendingPidWhenDisplayNodeSkip)) { + RS_LOGE( + "RSRenderProcessConnectionStub::GET_GLOBAL_DIRTY_REGION_INFO Write globalDirtyRegionInfo failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HDR_ON_DURATION) : { + int64_t hdrOnDuration = 0; + auto errCode = GetHdrOnDuration(hdrOnDuration); + if (errCode != ERR_OK || !reply.WriteInt64(hdrOnDuration)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_HDR_ON_DURATION Write " + "hdrOnDuration failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } +#ifdef TP_FEATURE_ENABLE + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG) : { + int32_t feature{0}; + if (!data.ReadInt32(feature)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read feature failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto config = data.ReadCString(); + if (config == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read config failed!"); + ret = ERR_INVALID_DATA; + break; + } + uint8_t tpFeatureConfigType{0}; + if (!data.ReadUint8(tpFeatureConfigType)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read tpFeatureConfigType failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetTpFeatureConfig(feature, config, static_cast(tpFeatureConfigType)); + break; + } +#endif + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS) : { + bool isVirtualScreenUsingStatus{false}; + if (!data.ReadBool(isVirtualScreenUsingStatus)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_USING_STATUS Read " + "isVirtualScreenUsingStatus failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); + break; + } + + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS) : { + bool isCurtainScreenOn{false}; + if (!data.ReadBool(isCurtainScreenOn)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_CURTAIN_SCREEN_USING_STATUS Read " + "isCurtainScreenOn failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetCurtainScreenUsingStatus(isCurtainScreenOn); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID) : { + std::vector pidList; + if (!data.ReadInt32Vector(&pidList)) { + RS_LOGE("RSRenderProcessConnectionStub::DROP_FRAME_BY_PID Read " + "pidList failed!"); + ret = ERR_INVALID_REPLY; + break; + } + DropFrameByPid(pidList); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK): { + uint64_t userId{0}; + if (!data.ReadUint64(userId)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read " + "userId failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read remoteObject failed!"); + ret = ERR_NULL_OBJECT; + break; + } + sptr callback = iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + break; + } + bool unobscured{false}; + if (!data.ReadBool(unobscured)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read unobscured failed!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t status = RegisterUIExtensionCallback(userId, callback, unobscured); + if (!reply.WriteInt32(status)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS) : { + ScreenId id{INVALID_SCREEN_ID}; + uint8_t screenStatus{0}; + if (!data.ReadUint64(id) || !data.ReadUint8(screenStatus)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_STATUS Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool success; + SetVirtualScreenStatus(id, static_cast(screenStatus), success); + if (!reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_STATUS Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS) : { + bool flag{false}; + if (!data.ReadBool(flag)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_VMA_CACHE_STATUS read flag failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetVmaCacheStatus(flag); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT) : { + bool direct{false}; + if (!data.ReadBool(direct)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_ANCO_FORCE_DO_DIRECT Read direct failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool res; + if (SetAncoForceDoDirect(direct, res) != ERR_OK || !reply.WriteBool(res)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_ANCO_FORCE_DO_DIRECT Write result failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE) : { + uint64_t id{0}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Read id failed!"); + ret = ERR_INVALID_DATA; + break; + } + bool isNonSystemCalling = false; + bool isTokenTypeValid = true; + RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemCalling); + if (isNonSystemCalling && !IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("CREATE_DISPLAY_NODE invalid nodeId[%{public}" PRIu64 "] pid[%{public}d]", id, callingPid); + ret = ERR_INVALID_DATA; + break; + } + uint64_t mirroredId{0}; + uint64_t screenId{0}; + bool isMirror{false}; + if (!data.ReadUint64(mirroredId) || + !data.ReadUint64(screenId) || + !data.ReadBool(isMirror)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Read config failed!"); + ret = ERR_INVALID_DATA; + break; + } + RSDisplayNodeConfig config = { + .screenId = screenId, + .isMirrored = isMirror, + .mirrorNodeId = mirroredId, + .isSync = true, + }; + bool success; + if (CreateNode(config, id, success) != ERR_OK || reply.WriteBool(success)) { + RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Write success failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS) : { + bool enable{false}; + if (!data.ReadBool(enable)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_FREE_MULTI_WINDOW_STATUS Read enable failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetFreeMultiWindowStatus(enable); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK) : { + int32_t pid{0}; + uint64_t uid{0}; + if (!data.ReadInt32(pid) || + !data.ReadUint64(uid)) { + RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(pid, callingPid)) { + RS_LOGW("REGISTER_SURFACE_BUFFER_CALLBACK invalid pid[%{public}d]", callingPid); + ret = ERR_INVALID_DATA; + break; + } + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject == nullptr"); + break; + } + sptr callback = iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject cast error"); + break; + } + RegisterSurfaceBufferCallback(pid, uid, callback); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK) : { + int32_t pid{0}; + uint64_t uid{0}; + if (!data.ReadInt32(pid) || + !data.ReadUint64(uid)) { + RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(pid, callingPid)) { + RS_LOGW("UNREGISTER_SURFACE_BUFFER_CALLBACK invalid pid[%{public}d]", callingPid); + ret = ERR_INVALID_DATA; + break; + } + UnregisterSurfaceBufferCallback(pid, uid); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH) : { + std::string nodeIdStr; + bool isForceRefresh{false}; + if (!data.ReadString(nodeIdStr) || + !data.ReadBool(isForceRefresh)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_FORCE_REFRESH Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetForceRefresh(nodeIdStr, isForceRefresh); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW) : { + std::string nodeIdStr; + bool isColorFollow{false}; + if (!data.ReadString(nodeIdStr) || + !data.ReadBool(isColorFollow)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_COLOR_FOLLOW Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + SetColorFollow(nodeIdStr, isColorFollow); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER) : { + NodeId nodeId = {}; + bool isEnabled = {}; + if (!data.ReadUint64(nodeId) || !data.ReadBool(isEnabled)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_CONTAINER Read parcel failed!"); + ret = ERR_INVALID_DATA; + break; + } + if (!IsValidCallingPid(ExtractPid(nodeId), callingPid)) { + RS_LOGW("SET_WINDOW_CONTAINER invalid nodeId[%{public}" PRIu64 "] pid[%{public}d]", nodeId, callingPid); + ret = ERR_INVALID_DATA; + break; + } + SetWindowContainer(nodeId, isEnabled); + break; + } + case static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK): { + uint64_t token = data.ReadUint64(); + uint64_t timeStamp = data.ReadUint64(); + auto remoteObject = data.ReadRemoteObject(); + if (remoteObject == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject == nullptr"); + break; + } + sptr callback = + iface_cast(remoteObject); + if (callback == nullptr) { + ret = ERR_NULL_OBJECT; + RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callback == nullptr"); + break; + } + RS_LOGD("RSRenderProcessConnectionStub: already decode unicode, timeStamp: %{public}" + PRIu64 " token: %{public}" PRIu64, timeStamp, token); + RegisterTransactionDataCallback(token, timeStamp, callback); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HIGH_CONTRAST_TEXT_STATE) : { + bool highContrast = GetHighContrastTextState(); + if (!reply.WriteBool(highContrast)) { + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED): { + bool enabled { false }; + if (!data.ReadBool(enabled)) { + RS_LOGE("RSRenderProcessConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED read enabled failed!"); + ret = ERR_INVALID_DATA; + break; + } + auto err = SetBehindWindowFilterEnabled(enabled); + if (err != ERR_OK) { + RS_LOGE("RSRenderProcessConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED): { + bool enabled; + if (GetBehindWindowFilterEnabled(enabled) != ERR_OK || !reply.WriteBool(enabled)) { + RS_LOGE("RSRenderProcessConnectionStub::GET_BEHIND_WINDOW_FILTER_ENABLED write enabled failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB): { + int32_t pid{0}; + float gpuMemInMB{0.0}; + if (!data.ReadInt32(pid)) { + RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read data err!"); + ret = ERR_INVALID_DATA; + break; + } + ret = GetPidGpuMemoryInMB(pid, gpuMemInMB); + if (ret != 0) { + RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read ret err!"); + ret = ERR_INVALID_DATA; + break; + } + if (!reply.WriteFloat(gpuMemInMB)) { + RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB write gpuMemInMB err!"); + ret = ERR_INVALID_REPLY; + } + RS_LOGD("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB, ret: %{public}d, gpuMemInMB: %{public}f", + ret, gpuMemInMB); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START): { + uint64_t uniqueId{0}; + std::string surfaceName; + uint32_t fps{0}; + uint64_t reportTime{0}; + if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) + || !data.ReadUint32(fps) || !data.ReadUint64(reportTime)) { + RS_LOGE("RenderProcessConnectionStub::AVCODEC_VIDEO_START : read data err!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t result = AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_START Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP): { + uint64_t uniqueId{0}; + std::string surfaceName; + uint32_t fps{0}; + if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) || !data.ReadUint32(fps)) { + RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_STOP : read data err!"); + ret = ERR_INVALID_DATA; + break; + } + int32_t result = AvcodecVideoStop(uniqueId, surfaceName, fps); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_STOP Write status failed!"); + ret = ERR_INVALID_REPLY; + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE): { + HrpServiceDir baseDirType = HrpServiceGetDirType(data.ReadUint32()); + std::string subDir = data.ReadString(); + std::string subDir2 = data.ReadString(); + std::string fileName = data.ReadString(); + int32_t flags = data.ReadInt32(); + + int32_t retFd = -1; + HrpServiceDirInfo dirInfo{baseDirType, subDir, subDir2}; + RetCodeHrpService retCode = ProfilerServiceOpenFile(dirInfo, fileName, flags, retFd); + reply.WriteInt32((int32_t)retCode); + reply.WriteFileDescriptor(retFd); + if (retFd != -1) { + close(retFd); // call 'close' due to dup was invoked + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_POPULATE_FILES): { + HrpServiceDir baseDirType = HrpServiceGetDirType(data.ReadUint32()); + std::string subDir = data.ReadString(); + std::string subDir2 = data.ReadString(); + uint32_t firstFileIndex = data.ReadUint32(); + + std::vector retFiles; + HrpServiceDirInfo dirInfo{baseDirType, subDir, subDir2}; + RetCodeHrpService retCode = ProfilerServicePopulateFiles(dirInfo, firstFileIndex, retFiles); + reply.WriteInt32((int32_t)retCode); + reply.WriteUint32((uint32_t)retFiles.size()); + for (const auto& fi : retFiles) { + reply.WriteString(fi.name); + reply.WriteUint32(fi.size); + reply.WriteBool(fi.isDir); + reply.WriteUint32(fi.accessBits); + reply.WriteUint64(fi.accessTime.sec); + reply.WriteUint64(fi.accessTime.nsec); + reply.WriteUint64(fi.modifyTime.sec); + reply.WriteUint64(fi.modifyTime.nsec); + } + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN): { + bool retValue = ProfilerIsSecureScreen(); + reply.WriteBool(retValue); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE) : { + NodeId nodeId = {}; + if (!data.ReadUint64(nodeId)) { + RS_LOGE("RSRenderProcessConnectionStub::CLEAR_UIFIRST_CACHE : read data err!"); + ret = ERR_INVALID_DATA; + break; + } + ClearUifirstCache(nodeId); + break; + } + default: { + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + } + + return ret; +} + +bool RSRenderProcessConnectionStub::ReadDataBaseRs(DataBaseRs& info, MessageParcel& data) +{ + if (!data.ReadInt32(info.appPid) || !data.ReadInt32(info.eventType) || + !data.ReadInt32(info.versionCode) || !data.ReadInt64(info.uniqueId) || + !data.ReadInt64(info.inputTime) || !data.ReadInt64(info.beginVsyncTime) || + !data.ReadInt64(info.endVsyncTime) || !data.ReadBool(info.isDisplayAnimator) || + !data.ReadString(info.sceneId) || !data.ReadString(info.versionName) || + !data.ReadString(info.bundleName) || !data.ReadString(info.processName) || + !data.ReadString(info.abilityName) ||!data.ReadString(info.pageUrl) || + !data.ReadString(info.sourceType) || !data.ReadString(info.note)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadDataBaseRs Read parcel failed!"); + return false; + } + return true; +} + +bool RSRenderProcessConnectionStub::ReadAppInfo(AppInfo& info, MessageParcel& data) +{ + if (!data.ReadInt64(info.startTime)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read startTime failed!"); + return false; + } + if (!data.ReadInt64(info.endTime)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read endTime failed!"); + return false; + } + if (!data.ReadInt32(info.pid)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read pid failed!"); + return false; + } + if (!data.ReadString(info.versionName)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read versionName failed!"); + return false; + } + if (!data.ReadInt32(info.versionCode)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read versionCode failed!"); + return false; + } + if (!data.ReadString(info.bundleName)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read bundleName failed!"); + return false; + } + if (!data.ReadString(info.processName)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read processName failed!"); + return false; + } + return true; +} + +bool RSRenderProcessConnectionStub::ReadGameStateDataRs(GameStateData& info, MessageParcel& data) +{ + if (!data.ReadInt32(info.pid) || !data.ReadInt32(info.uid) || + !data.ReadInt32(info.state) || !data.ReadInt32(info.renderTid) || + !data.ReadString(info.bundleName)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadGameStateDataRs Read parcel failed!"); + return false; + } + return true; +} + +bool RSRenderProcessConnectionStub::ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) +{ + uint8_t captureType { 0 }; + if (!data.ReadFloat(captureConfig.scaleX) || !data.ReadFloat(captureConfig.scaleY) || + !data.ReadBool(captureConfig.useDma) || !data.ReadBool(captureConfig.useCurWindow) || + !data.ReadUint8(captureType) || !data.ReadBool(captureConfig.isSync) || + !data.ReadBool(captureConfig.isHdrCapture) || + !data.ReadFloat(captureConfig.mainScreenRect.left_) || + !data.ReadFloat(captureConfig.mainScreenRect.top_) || + !data.ReadFloat(captureConfig.mainScreenRect.right_) || + !data.ReadFloat(captureConfig.mainScreenRect.bottom_) || + !data.ReadUint64(captureConfig.uiCaptureInRangeParam.endNodeId) || + !data.ReadBool(captureConfig.uiCaptureInRangeParam.useBeginNodeSize) || + !data.ReadFloat(captureConfig.specifiedAreaRect.left_) || + !data.ReadFloat(captureConfig.specifiedAreaRect.top_) || + !data.ReadFloat(captureConfig.specifiedAreaRect.right_) || + !data.ReadFloat(captureConfig.specifiedAreaRect.bottom_) || + !data.ReadUInt64Vector(&captureConfig.blackList) || + !data.ReadUint32(captureConfig.backGroundColor)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureConfig Read captureType failed!"); + return false; + } + captureConfig.captureType = static_cast(captureType); + return true; +} + +bool RSRenderProcessConnectionStub::ReadSurfaceCaptureBlurParam( + RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) +{ + if (!data.ReadBool(blurParam.isNeedBlur) || !data.ReadFloat(blurParam.blurRadius)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureBlurParam Read blurParam failed!"); + return false; + } + return true; +} + +bool RSRenderProcessConnectionStub::ReadSurfaceCaptureAreaRect( + Drawing::Rect& specifiedAreaRect, MessageParcel& data) +{ + if (!data.ReadFloat(specifiedAreaRect.left_) || !data.ReadFloat(specifiedAreaRect.top_) || + !data.ReadFloat(specifiedAreaRect.right_) || !data.ReadFloat(specifiedAreaRect.bottom_)) { + RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureAreaRect Read specifiedAreaRect failed!"); + return false; + } + return true; +} + +const RSInterfaceCodeSecurityManager RSRenderProcessConnectionStub::securityManager_ = \ + RSInterfaceCodeSecurityManager::CreateInstance(); +} // namespace Rosen +} // namespace OHOS diff --git a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h b/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h new file mode 100644 index 0000000000..35bdc39041 --- /dev/null +++ b/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021 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 ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H + +#include +#include +#include +#include + +#include "platform/ohos/rs_irender_process_connection.h" +#include "platform/ohos/rs_irender_service_connection_ipc_interface_code_access_verifier.h" +#include "ipc_security/rs_ipc_interface_code_security_manager.h" +#include "rs_render_service_security_utils.h" + +namespace OHOS { +namespace Rosen { +class RSRenderProcessConnectionStub : public IRemoteStub { +public: + RSRenderProcessConnectionStub() = default; + ~RSRenderProcessConnectionStub() noexcept = default; + + int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; + + void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) override {}; + void RunOnRemoteDiedCallback() override {}; + +private: + static const RSInterfaceCodeSecurityManager securityManager_; + + bool ReadDataBaseRs(DataBaseRs& info, MessageParcel& data); + bool ReadAppInfo(AppInfo& info, MessageParcel& data); + bool ReadGameStateDataRs(GameStateData& info, MessageParcel& data); + bool ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data); + bool ReadSurfaceCaptureBlurParam(RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data); + bool ReadSurfaceCaptureAreaRect(Drawing::Rect& specifiedAreaRect, MessageParcel& data); + void SetQos(); + std::unordered_set tids_; + std::mutex mutex_; +}; +} // namespace Rosen +} // namespace OHOS + +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H \ No newline at end of file diff --git a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp b/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp index 1a8a08a4c8..7ad7010a64 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp +++ b/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp @@ -49,7 +49,6 @@ constexpr size_t MAX_DATA_SIZE_FOR_UNMARSHALLING_IN_PLACE = 1024 * 15; // 15kB constexpr size_t FILE_DESCRIPTOR_LIMIT = 15; constexpr size_t MAX_OBJECTNUM = 512; constexpr size_t MAX_DATA_SIZE = 1024 * 1024; // 1MB -static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 const uint32_t MAX_VOTER_SIZE = 100; constexpr uint32_t MAX_PID_SIZE_NUMBER = 100000; #ifdef RES_SCHED_ENABLE @@ -57,7 +56,6 @@ const uint32_t RS_IPC_QOS_LEVEL = 7; constexpr const char* RS_BUNDLE_NAME = "render_service"; #endif static constexpr std::array descriptorCheckList = { - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DEFAULT_SCREEN_ID), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_SCREEN_ID), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ALL_SCREEN_IDS), @@ -65,19 +63,11 @@ static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST), - static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST), - static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT), static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CHANGE_CALLBACK), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_REFRESH_RATE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_REFRESH_RATE_MODE), - static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE), static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CURRENT_REFRESH_RATE), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_CURRENT_REFRESH_RATE_MODE), @@ -85,18 +75,9 @@ static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SHOW_REFRESH_RATE_ENABLED), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SHOW_REFRESH_RATE_ENABLED), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REALTIME_REFRESH_RATE), - static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME), static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING), - static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC), - static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DISPLAY_IDENTIFICATION_DATA), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP), -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK), -#endif static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_POWER_STATUS), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_BACK_LIGHT), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE), @@ -105,7 +86,6 @@ static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_POWER_STATUS), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_BACK_LIGHT), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_DATA), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_GAMUTS), @@ -114,93 +94,38 @@ static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT_MAP), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CORRECTION), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT_MAP), - static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_RECT), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK), - static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP), static_cast(RSIRenderServiceConnectionInterfaceCode::EXECUTE_SYNCHRONOUS_TASK), - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_REFRESH_RATE_EVENT), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT), - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END), - static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT), - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED), static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SCREEN_SWITCHED), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE), - static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE), - static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO), static_cast(RSIRenderServiceConnectionInterfaceCode::GET_LAYER_COMPOSE_INFO), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT), static_cast(RSIRenderServiceConnectionInterfaceCode::NEED_REGISTER_TYPEFACE), static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS), - static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK), - static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_LAYER_TOP_FOR_HARDWARE_COMPOSER), static_cast(RSIRenderServiceConnectionInterfaceCode::SET_LAYER_TOP), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER), static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK), static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK), static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK), @@ -210,9 +135,6 @@ static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::SET_OVERLAY_DISPLAY_MODE), #endif static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PAGE_NAME), - static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED), - static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB), static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE), static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_POPULATE_FILES), static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN), @@ -356,14 +278,6 @@ bool IsValidCallingPid(pid_t pid, pid_t callingPid) { return (callingPid == getpid()) || (callingPid == pid); } - -static void TypefaceXcollieCallback(void* arg) -{ - if (arg) { - bool* isTrigger = static_cast(arg); - *isTrigger = true; - } -} } void RSRenderServiceConnectionStub::SetQos() @@ -409,18 +323,11 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::cend(descriptorCheckList)) { auto token = data.ReadInterfaceToken(); if (token != RSIRenderServiceConnection::GetDescriptor()) { - if (code == static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE)) { - if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest Write failed."); - return ERR_INVALID_REPLY; - } - } return ERR_INVALID_STATE; } } auto accessible = securityManager_.IsInterfaceCodeAccessible(code); - if (!accessible && code != static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE) && - code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC) && + if (!accessible && code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER)) { @@ -594,37 +501,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO): { - int32_t pid{0}; - if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_FOCUS_APP_INFO read pid failed!"); - ret = ERR_INVALID_DATA; - break; - } - RS_PROFILER_PATCH_PID(data, pid); - int32_t uid{0}; - std::string bundleName; - std::string abilityName; - uint64_t focusNodeId{0}; - if (!data.ReadInt32(uid) || !data.ReadString(bundleName) || !data.ReadString(abilityName) || - !RSMarshallingHelper::UnmarshallingPidPlusId(data, focusNodeId)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_FOCUS_APP_INFO read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - FocusAppInfo info = { - .pid = pid, - .uid = uid, - .bundleName = bundleName, - .abilityName = abilityName, - .focusNodeId = focusNodeId}; - int32_t repCode; - if (SetFocusAppInfo(info, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_FOCUS_APP_INFO Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DEFAULT_SCREEN_ID): { uint64_t screenId = INVALID_SCREEN_ID; if (GetDefaultScreenId(screenId) != ERR_OK || !reply.WriteUint64(screenId)) { @@ -692,173 +568,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - std::vector blackListVector; - if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = SetVirtualScreenBlackList(id, blackListVector); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - std::vector typeBlackListVector; - if (!data.ReadUint64(id) || !data.ReadUInt8Vector(&typeBlackListVector)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t repCode; - SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); - if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST Write repCode failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - std::vector blackListVector; - if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderServiceConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t repCode; - AddVirtualScreenBlackList(id, blackListVector, repCode); - if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - std::vector blackListVector; - if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderServiceConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t repCode; - RemoveVirtualScreenBlackList(id, blackListVector, repCode); - if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::REMOVE_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - std::vector securityExemptionList; - if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&securityExemptionList)) { - RS_LOGE( - "RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST" - " failed: too many lists."); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = SetVirtualScreenSecurityExemptionList(id, securityExemptionList); - if (!reply.WriteInt32(status)) { - RS_LOGE( - "RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - bool enable{false}; - if (!data.ReadUint64(id) || !data.ReadBool(enable)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_SECURITY_MASK read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - std::shared_ptr securityMask{nullptr}; - if (enable) { - securityMask = std::shared_ptr(data.ReadParcelable()); - } - int32_t result = SetScreenSecurityMask(id, std::move(securityMask)); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_SECURITY_MASK Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT): { - // read the parcel data. - ScreenId id = INVALID_SCREEN_ID; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read id failed!"); - ret = ERR_INVALID_REPLY; - break; - } - int32_t x = -1; - int32_t y = -1; - int32_t w = -1; - int32_t h = -1; - if (!data.ReadInt32(x) || !data.ReadInt32(y) || - !data.ReadInt32(w) || !data.ReadInt32(h)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read parcel failed!"); - ret = ERR_INVALID_REPLY; - break; - } - auto mainScreenRect = Rect { - .x = x, - .y = y, - .w = w, - .h = h - }; - bool supportRotation{false}; - if (!data.ReadBool(supportRotation)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read supportRotation failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW): { - // read the parcel data. - ScreenId id{INVALID_SCREEN_ID}; - bool enable{false}; - if (!data.ReadUint64(id) || !data.ReadBool(enable)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t result = SetCastScreenEnableSkipWindow(id, enable); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE): { // read the parcel data. ScreenId id{INVALID_SCREEN_ID}; @@ -916,66 +625,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG): { - float darkBuffer { 0.f }; - float brightBuffer { 0.f }; - int64_t interval { 0 }; - int32_t rangeSize { 0 }; - if (!data.ReadFloat(darkBuffer) || !data.ReadFloat(brightBuffer) || !data.ReadInt64(interval) || - !data.ReadInt32(rangeSize)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED): { - bool enable { false }; - if (!data.ReadBool(enable)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED read enable failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = SetPointerColorInversionEnabled(enable); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK): { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - sptr cb = iface_cast(remoteObject); - if (cb == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - int32_t status = RegisterPointerLuminanceChangeCallback(cb); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK): { - int32_t status = UnRegisterPointerLuminanceChangeCallback(); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::UNREGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } -#endif case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE): { ScreenId id{INVALID_SCREEN_ID}; uint32_t modeId{0}; @@ -1009,36 +658,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( SetRefreshRateMode(mode); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE): { - FrameRateLinkerId id{0}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SYNC_FRAME_RATE_RANGE Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (ExtractPid(id) != callingPid) { - RS_LOGW("The SyncFrameRateRange isn't legal, frameRateLinkerId: %{public}" PRIu64 - ", callingPid:%{public}d", id, callingPid); - ret = ERR_INVALID_DATA; - break; - } - uint32_t min{0}; - uint32_t max{0}; - uint32_t preferred{0}; - uint32_t type{0}; - uint32_t componentScene{0}; - int32_t animatorExpectedFrameRate{0}; - if (!data.ReadUint32(min) || !data.ReadUint32(max) || !data.ReadUint32(preferred) || - !data.ReadUint32(type) || !data.ReadUint32(componentScene) || - !data.ReadInt32(animatorExpectedFrameRate)) { - RS_LOGE("RSRenderServiceConnectionStub::SYNC_FRAME_RATE_RANGE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - SyncFrameRateRange(id, {min, max, preferred, type, static_cast(componentScene)}, - animatorExpectedFrameRate); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER): { FrameRateLinkerId id{0}; if (!data.ReadUint64(id)) { @@ -1230,28 +849,10 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME): { - MarkPowerOffNeedProcessOneFrame(); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING): { RepaintEverything(); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC): { - ForceRefreshOneFrameWithNextVSync(); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::DISABLE_RENDER_CONTROL_SCREEN Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - DisablePowerOffRenderControl(id); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_POWER_STATUS): { ScreenId id{INVALID_SCREEN_ID}; uint32_t status{0}; @@ -1263,286 +864,71 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( SetScreenPowerStatus(id, static_cast(status)); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE): { - NodeId id{0}; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::TAKE_SURFACE_CAPTURE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } + case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT): { + pid_t pid = GetCallingPid(); + RS_PROFILER_PATCH_PID(data, pid); auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture remoteObject is nullptr"); break; } - sptr cb = iface_cast(remoteObject); - if (cb == nullptr) { + sptr app = iface_cast(remoteObject); + if (app == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture cb is nullptr"); - break; - } - RSSurfaceCaptureConfig captureConfig; - RSSurfaceCaptureBlurParam blurParam; - Drawing::Rect specifiedAreaRect; - if (!ReadSurfaceCaptureConfig(captureConfig, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture read captureConfig failed"); - break; - } - if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture read blurParam failed"); - break; - } - if (!ReadSurfaceCaptureAreaRect(specifiedAreaRect, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture read specifiedAreaRect failed"); break; } - - RSSurfaceCapturePermissions permissions; - permissions.screenCapturePermission = accessible; - permissions.isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( - RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + "::TAKE_SURFACE_CAPTURE"); - // Since GetCallingPid interface always returns 0 in asynchronous binder in Linux kernel system, - // we temporarily add a white list to avoid abnormal functionality or abnormal display. - // The white list will be removed after GetCallingPid interface can return real PID. - permissions.selfCapture = (ExtractPid(id) == callingPid || callingPid == 0); - TakeSurfaceCapture(id, cb, captureConfig, blurParam, specifiedAreaRect, permissions); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE_SOLO): { - NodeId id{0}; + RegisterApplicationAgent(pid, app); + break; + } + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE): { + ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - RSSurfaceCaptureConfig captureConfig; - if (!ReadSurfaceCaptureConfig(captureConfig, data)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TAKE_SURFACE_CAPTURE_SOLO read captureConfig failed"); break; } - RSSurfaceCapturePermissions permissions; - permissions.isSystemCalling = RSInterfaceCodeAccessVerifierBase::IsSystemCalling( - RSIRenderServiceConnectionInterfaceCodeAccessVerifier::codeEnumTypeName_ + - "::TAKE_SURFACE_CAPTURE_SOLO"); - permissions.selfCapture = ExtractPid(id) == callingPid; - std::vector>> pixelMapIdPairVector; - pixelMapIdPairVector = TakeSurfaceCaptureSoloNode(id, captureConfig, permissions); - if (!RSMarshallingHelper::Marshalling(reply, pixelMapIdPairVector)) { + RSScreenModeInfo screenModeInfo; + if (GetScreenActiveMode(id, screenModeInfo) != ERR_OK || !reply.WriteParcelable(&screenModeInfo)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); ret = ERR_INVALID_REPLY; - RS_LOGE("RSRenderServiceConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Marshalling failed"); - break; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SELF_SURFACE_CAPTURE): { - NodeId id{0}; + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_MODES): { + ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Read id failed!"); ret = ERR_INVALID_DATA; break; } - if (ExtractPid(id) != callingPid) { - RS_LOGW("RSRenderServiceConnectionStub::TakeSelfSurfaceCapture failed, nodeId:[%{public}" PRIu64 - "], callingPid:[%{public}d], pid:[%{public}d]", id, callingPid, ExtractPid(id)); - ret = ERR_INVALID_DATA; - break; - } - RS_PROFILER_PATCH_NODE_ID(data, id); - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TakeSelfSurfaceCapture remoteObject is nullptr"); - break; - } - sptr cb = iface_cast(remoteObject); - if (cb == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TakeSelfSurfaceCapture cb is nullptr"); + std::vector screenSupportedModes = GetScreenSupportedModes(id); + if (!reply.WriteUint64(static_cast(screenSupportedModes.size()))) { + RS_LOGE( + "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModesSize failed!"); + ret = ERR_INVALID_REPLY; break; } - RSSurfaceCaptureConfig captureConfig; - if (!ReadSurfaceCaptureConfig(captureConfig, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TakeSelfSurfaceCapture read captureConfig failed"); - break; + for (uint32_t modeIndex = 0; modeIndex < screenSupportedModes.size(); modeIndex++) { + if (!reply.WriteParcelable(&screenSupportedModes[modeIndex])) { + RS_LOGE( + "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModes failed!"); + ret = ERR_INVALID_REPLY; + break; + } } - TakeSelfSurfaceCapture(id, cb, captureConfig); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_UI_CAPTURE_IN_RANGE): { - NodeId id{0}; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::TAKE_UI_CAPTURE_IN_RANGE Read parcel failed!"); + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC): { + int32_t pid{0}; + if (!data.ReadInt32(pid)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); ret = ERR_INVALID_DATA; break; } - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TAKE_UI_CAPTURE_IN_RANGE remoteObject is nullptr"); - break; - } - sptr cb = iface_cast(remoteObject); - if (cb == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::TAKE_UI_CAPTURE_IN_RANGE cb is nullptr"); - break; - } - RSSurfaceCaptureConfig captureConfig; - if (!ReadSurfaceCaptureConfig(captureConfig, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TAKE_UI_CAPTURE_IN_RANGE read captureConfig failed"); - break; - } - TakeUICaptureInRange(id, cb, captureConfig); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_FREEZE_IMMEDIATELY): { - NodeId id{0}; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool isFreeze{false}; - if (!data.ReadBool(isFreeze)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read isFreeze failed!"); - ret = ERR_INVALID_DATA; - break; - } - sptr cb; - RSSurfaceCaptureConfig captureConfig; - RSSurfaceCaptureBlurParam blurParam; - if (isFreeze) { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY remoteObject is nullptr"); - break; - } - cb = iface_cast(remoteObject); - if (cb == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY cb is nullptr"); - break; - } - if (!ReadSurfaceCaptureConfig(captureConfig, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY write captureConfig failed"); - break; - } - if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { - ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderServiceConnectionStub::TakeSurfaceCapture read blurParam failed"); - break; - } - } - SetWindowFreezeImmediately(id, isFreeze, cb, captureConfig, blurParam); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_POSITION): { - NodeId id { 0 }; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_POSITION read nodeId failed!"); - break; - } - float positionX { 0.f }; - float positionY { 0.f }; - float positionZ { 0.f }; - float positionW { 0.f }; - if (!data.ReadFloat(positionX) || !data.ReadFloat(positionY) || !data.ReadFloat(positionZ) || - !data.ReadFloat(positionW)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_POINTER_POSITION read position failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetHwcNodeBounds(id, positionX, positionY, positionZ, positionW); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT): { - pid_t pid = GetCallingPid(); - RS_PROFILER_PATCH_PID(data, pid); - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - sptr app = iface_cast(remoteObject); - if (app == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - RegisterApplicationAgent(pid, app); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - RSVirtualScreenResolution virtualScreenResolution = GetVirtualScreenResolution(id); - if (!reply.WriteParcelable(&virtualScreenResolution)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Write virtualScreenResolution " - "failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - RSScreenModeInfo screenModeInfo; - if (GetScreenActiveMode(id, screenModeInfo) != ERR_OK || !reply.WriteParcelable(&screenModeInfo)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_MODES): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - std::vector screenSupportedModes = GetScreenSupportedModes(id); - if (!reply.WriteUint64(static_cast(screenSupportedModes.size()))) { - RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModesSize failed!"); - ret = ERR_INVALID_REPLY; - break; - } - for (uint32_t modeIndex = 0; modeIndex < screenSupportedModes.size(); modeIndex++) { - if (!reply.WriteParcelable(&screenSupportedModes[modeIndex])) { - RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModes failed!"); - ret = ERR_INVALID_REPLY; - break; - } - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC): { - int32_t pid{0}; - if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); - ret = ERR_INVALID_DATA; - break; - } - RS_PROFILER_PATCH_PID(data, pid); - if (!IsValidCallingPid(pid, callingPid)) { - RS_LOGW("GET_MEMORY_GRAPHIC invalid pid[%{public}d]", callingPid); - ret = ERR_INVALID_DATA; + RS_PROFILER_PATCH_PID(data, pid); + if (!IsValidCallingPid(pid, callingPid)) { + RS_LOGW("GET_MEMORY_GRAPHIC invalid pid[%{public}d]", callingPid); + ret = ERR_INVALID_DATA; break; } MemoryGraphic memoryGraphic; @@ -1827,55 +1213,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION): { - ScreenId id{INVALID_SCREEN_ID}; - bool canvasRotation{false}; - if (!data.ReadUint64(id) || !data.ReadBool(canvasRotation)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool result = SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); - if (!reply.WriteBool(result)) { - RS_LOGE( - "RSRenderServiceConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Write parcel failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION): { - ScreenId id{INVALID_SCREEN_ID}; - bool isAutoRotation{false}; - if (!data.ReadUint64(id) || !data.ReadBool(isAutoRotation)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t result = SetVirtualScreenAutoRotation(id, isAutoRotation); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Write parcel failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE): { - ScreenId id{INVALID_SCREEN_ID}; - uint32_t scaleMode{0}; - if (!data.ReadUint64(id) || !data.ReadUint32(scaleMode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool result = SetVirtualMirrorScreenScaleMode(id, static_cast(scaleMode)); - if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Write parcel failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } case static_cast( RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE): { bool isDark{false}; @@ -1958,363 +1295,148 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID): { - uint64_t pid; - if (!data.ReadUint64(pid)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXELMAP_BY_PROCESSID Read pid failed!"); + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS): { + ScreenId id{INVALID_SCREEN_ID}; + if (!data.ReadUint64(id)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); ret = ERR_INVALID_DATA; break; } - std::vector pixelMapInfoVector; - int32_t repCode; - if (GetPixelMapByProcessId(pixelMapInfoVector, static_cast(pid), repCode) != ERR_OK || - !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXELMAP_BY_PROCESSID Write repCode failed!"); - ret = ERR_INVALID_REPLY; - break; + HdrStatus hdrStatus; + int32_t resCode; + ret = GetScreenHDRStatus(id, hdrStatus, resCode); + if (ret != ERR_OK) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); + resCode = ret; } - if (!RSMarshallingHelper::Marshalling(reply, pixelMapInfoVector)) { + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE): { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write Object failed!"); - ret = ERR_INVALID_REPLY; - break; - } - ret = ERR_NULL_OBJECT; - break; - } - auto bufferProducer = iface_cast(remoteObject); - sptr surface = Surface::CreateSurfaceAsProducer(bufferProducer); - if (surface == nullptr) { - if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write parcel failed!"); - ret = ERR_INVALID_REPLY; - break; - } - ret = ERR_NULL_OBJECT; - break; - } - int32_t x = 0; - int32_t y = 0; - int32_t w = 0; - int32_t h = 0; - if (!data.ReadInt32(x) || !data.ReadInt32(y) || !data.ReadInt32(w) || !data.ReadInt32(h)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); - ret = ERR_INVALID_DATA; + if (resCode != StatusCode::SUCCESS) { break; } - auto srcRect = Rect { - .x = x, - .y = y, - .w = w, - .h = h - }; - std::shared_ptr pixelMap = nullptr; - CreatePixelMapFromSurface(surface, srcRect, pixelMap); - if (pixelMap) { - if (!reply.WriteBool(true)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed"); - ret = ERR_INVALID_REPLY; - break; - } - if (!pixelMap->Marshalling(reply)) { - RS_LOGE("pixelMap Marshalling fail"); - ret = ERR_INVALID_REPLY; - } - } else { - if (!reply.WriteBool(false)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); - ret = ERR_INVALID_REPLY; - break; - } + if (!reply.WriteUint32(hdrStatus)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); + ret = ERR_INVALID_REPLY; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY): { + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_CAPABILITY Read id failed!"); + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); ret = ERR_INVALID_DATA; break; } - RSScreenHDRCapability screenHDRCapability; - int32_t result = GetScreenHDRCapability(id, screenHDRCapability); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_CAPABILITY Write result failed!"); + std::vector colorSpacesSend; + std::vector colorSpaces; + int32_t resCode; + GetScreenSupportedColorSpaces(id, colorSpaces, resCode); + if (!reply.WriteInt32(resCode)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } - if (result != StatusCode::SUCCESS) { - ret = ERR_UNKNOWN_REASON; + if (resCode != StatusCode::SUCCESS) { break; } - if (!reply.WriteParcelable(&screenHDRCapability)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_CAPABILITY Write screenHDRCapability failed!"); + std::copy(colorSpaces.begin(), colorSpaces.end(), std::back_inserter(colorSpacesSend)); + if (!reply.WriteUInt32Vector(colorSpacesSend)) { + RS_LOGE( + "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); ret = ERR_INVALID_REPLY; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT): { + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXEL_FORMAT Read id failed!"); + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } - GraphicPixelFormat pixelFormat; + GraphicCM_ColorSpaceType colorSpace; int32_t resCode; - GetPixelFormat(id, pixelFormat, resCode); + GetScreenColorSpace(id, colorSpace, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXEL_FORMAT Write result failed!"); + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write result failed!"); ret = ERR_INVALID_REPLY; break; } if (resCode != StatusCode::SUCCESS) { break; } - if (!reply.WriteUint32(static_cast(pixelFormat))) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXEL_FORMAT Write pixelFormat failed!"); + if (!reply.WriteUint32(colorSpace)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write colorSpace failed!"); ret = ERR_INVALID_REPLY; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT): { + case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_PIXEL_FORMAT Read id failed!"); + RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Read id failed!"); ret = ERR_INVALID_DATA; break; } - int32_t pixel{0}; - if (!data.ReadInt32(pixel)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_PIXEL_FORMAT read pixelFormat failed!"); + int32_t color{0}; + if (!data.ReadInt32(color)) { + RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE read colorSpace failed!"); ret = ERR_INVALID_DATA; break; } - GraphicPixelFormat pixelFormat = static_cast(pixel); + GraphicCM_ColorSpaceType colorSpace = static_cast(color); int32_t resCode; - SetPixelFormat(id, pixelFormat, resCode); + SetScreenColorSpace(id, colorSpace, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_PIXEL_FORMAT Write result failed!"); + RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Write result failed!"); ret = ERR_INVALID_REPLY; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS): { + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Read id failed!"); + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Read id failed!"); ret = ERR_INVALID_DATA; break; } - std::vector hdrFormatsSend; - std::vector hdrFormats; - int32_t resCode; - GetScreenSupportedHDRFormats(id, hdrFormats, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write result failed!"); + RSScreenType type; + int32_t result = GetScreenType(id, type); + if (!reply.WriteInt32(result)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write result failed!"); ret = ERR_INVALID_REPLY; break; } - if (resCode != StatusCode::SUCCESS) { + if (result != StatusCode::SUCCESS) { + ret = ERR_UNKNOWN_REASON; break; } - std::copy(hdrFormats.begin(), hdrFormats.end(), std::back_inserter(hdrFormatsSend)); - if (!reply.WriteUInt32Vector(hdrFormatsSend)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write hdrFormatsSend failed!"); + if (!reply.WriteUint32(type)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write type failed!"); ret = ERR_INVALID_REPLY; } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT): { - ScreenId id{INVALID_SCREEN_ID}; + case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP): { + NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_FORMAT Read id failed!"); + RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Read id failed!"); ret = ERR_INVALID_DATA; break; } - ScreenHDRFormat hdrFormat; - int32_t resCode; - GetScreenHDRFormat(id, hdrFormat, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_FORMAT Write resCode failed!"); - ret = ERR_INVALID_REPLY; - break; - } - if (resCode != StatusCode::SUCCESS) { - break; - } - if (!reply.WriteUint32(hdrFormat)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_FORMAT Write hdrFormat failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT): { - ScreenId id{INVALID_SCREEN_ID}; - int32_t modeIdx{0}; - if (!data.ReadUint64(id) || !data.ReadInt32(modeIdx)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_HDR_FORMAT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t resCode; - SetScreenHDRFormat(id, modeIdx, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_HDR_FORMAT Write resCode failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - HdrStatus hdrStatus; - int32_t resCode; - ret = GetScreenHDRStatus(id, hdrStatus, resCode); - if (ret != ERR_OK) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); - resCode = ret; - } - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); - ret = ERR_INVALID_REPLY; - break; - } - if (resCode != StatusCode::SUCCESS) { - break; - } - if (!reply.WriteUint32(hdrStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - std::vector colorSpacesSend; - std::vector colorSpaces; - int32_t resCode; - GetScreenSupportedColorSpaces(id, colorSpaces, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); - ret = ERR_INVALID_REPLY; - break; - } - if (resCode != StatusCode::SUCCESS) { - break; - } - std::copy(colorSpaces.begin(), colorSpaces.end(), std::back_inserter(colorSpacesSend)); - if (!reply.WriteUInt32Vector(colorSpacesSend)) { - RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - GraphicCM_ColorSpaceType colorSpace; - int32_t resCode; - GetScreenColorSpace(id, colorSpace, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write result failed!"); - ret = ERR_INVALID_REPLY; - break; - } - if (resCode != StatusCode::SUCCESS) { - break; - } - if (!reply.WriteUint32(colorSpace)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write colorSpace failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t color{0}; - if (!data.ReadInt32(color)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE read colorSpace failed!"); - ret = ERR_INVALID_DATA; - break; - } - GraphicCM_ColorSpaceType colorSpace = static_cast(color); - int32_t resCode; - SetScreenColorSpace(id, colorSpace, resCode); - if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE): { - ScreenId id{INVALID_SCREEN_ID}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - RSScreenType type; - int32_t result = GetScreenType(id, type); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write result failed!"); - ret = ERR_INVALID_REPLY; - break; - } - if (result != StatusCode::SUCCESS) { - ret = ERR_UNKNOWN_REASON; - break; - } - if (!reply.WriteUint32(type)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write type failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP): { - NodeId id{0}; - if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(ExtractPid(id), callingPid)) { - RS_LOGW("The GetBitmap isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", - id, callingPid); - break; - } - RS_PROFILER_PATCH_NODE_ID(data, id); - Drawing::Bitmap bm; - bool success; - if (GetBitmap(id, bm, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Write success failed!"); + if (!IsValidCallingPid(ExtractPid(id), callingPid)) { + RS_LOGW("The GetBitmap isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", + id, callingPid); + break; + } + RS_PROFILER_PATCH_NODE_ID(data, id); + Drawing::Bitmap bm; + bool success; + if (GetBitmap(id, bm, success) != ERR_OK || !reply.WriteBool(success)) { + RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Write success failed!"); ret = ERR_INVALID_REPLY; break; } @@ -2376,104 +1498,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE): { - bool xcollieFlag = false; - bool result = false; - std::shared_ptr typeface = nullptr; - { - // timer: 3s - OHOS::Rosen::RSXCollie registerTypefaceXCollie("registerTypefaceXCollie_" + - std::to_string(callingPid), 3, TypefaceXcollieCallback, &xcollieFlag, 0); - uint64_t uniqueId{0}; - uint32_t hash{0}; - if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_TYPEFACE read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - // safe check - if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { - result = RSMarshallingHelper::Unmarshalling(data, typeface); - if (result && typeface) { - typeface->SetHash(hash); - RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); - RegisterTypeface(uniqueId, typeface); - } - } else { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest callingPid[%{public}d] " - "no permission REGISTER_TYPEFACE", callingPid); - } - } - if (xcollieFlag && typeface) { - RS_LOGW("RSRenderServiceConnectionStub::OnRemoteRequest callingPid[%{public}d] typeface[%{public}s] " - "size[%{public}u], too big.", callingPid, typeface->GetFamilyName().c_str(), typeface->GetSize()); - } - if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_TYPEFACE Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE): { - uint64_t uniqueId{0}; - if (!data.ReadUint64(uniqueId)) { - RS_LOGE("RSRenderServiceConnectionStub::UNREGISTER_TYPEFACE read uniqueId failed!"); - ret = ERR_INVALID_DATA; - break; - } - // safe check - if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { - RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); - UnRegisterTypeface(uniqueId); - } else { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest callingPid[%{public}d] " - "no permission UNREGISTER_TYPEFACE", callingPid); - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL): { - if (!securityManager_.IsInterfaceCodeAccessible(code)) { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest no permission to access"\ - "SET_SCREEN_SKIP_FRAME_INTERVAL"); - return ERR_INVALID_STATE; - } - ScreenId id{INVALID_SCREEN_ID}; - uint32_t skipFrameInterval{0}; - if (!data.ReadUint64(id) || !data.ReadUint32(skipFrameInterval)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t statusCode{ SUCCESS }; - if (SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode) != ERR_OK || - !reply.WriteInt32(statusCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE): { - ScreenId id = 0; - uint32_t maxRefreshRate = 0; - if (!data.ReadUint64(id) || !data.ReadUint32(maxRefreshRate)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - uint32_t actualRefreshRate = 0; - int32_t result = 0; - SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, result); - if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write result failed!"); - return ERR_INVALID_REPLY; - } - if (!reply.WriteUint32(actualRefreshRate)) { - RS_LOGE( - "RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write actualRefreshRate failed!"); - return ERR_INVALID_REPLY; - } - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_RECT): { ScreenId id{INVALID_SCREEN_ID}; int32_t x{0}; @@ -2522,225 +1546,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( SetScreenFrameGravity(id, gravity); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK): { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Read remoteObject failed!"); - ret = ERR_NULL_OBJECT; - break; - } - sptr callback = iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - int32_t repCode; - if (RegisterOcclusionChangeCallback(callback, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { - NodeId id{0}; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(ExtractPid(id), callingPid)) { - RS_LOGW("The RegisterSurfaceOcclusionChangeCallback isn't legal, nodeId:%{public}" PRIu64 ", " - "callingPid:%{public}d", id, callingPid); - ret = ERR_INVALID_DATA; - break; - } - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read remoteObject " - "failed!"); - ret = ERR_NULL_OBJECT; - break; - } - sptr callback = - iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - std::vector partitionPoints; - if (!data.ReadFloatVector(&partitionPoints)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read " - "partitionPoints failed!"); - ret = ERR_TRANSACTION_FAILED; - break; - } - int32_t status = RegisterSurfaceOcclusionChangeCallback(id, callback, partitionPoints); - if (!reply.WriteInt32(status)) { - RS_LOGE( - "RSRenderServiceConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { - NodeId id{0}; - if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderServiceConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(ExtractPid(id), callingPid)) { - RS_LOGW("The UnRegisterSurfaceOcclusionChangeCallback isn't legal, nodeId:%{public}" PRIu64 ", " - "callingPid:%{public}d", id, callingPid); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = UnRegisterSurfaceOcclusionChangeCallback(id); - if (!reply.WriteInt32(status)) { - RS_LOGE( - "RSRenderServiceConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM): { - uint32_t num{0}; - if (!data.ReadUint32(num)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_APP_WINDOW_NUM Read num failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetAppWindowNum(num); - break; - } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES): { - uint32_t systemAnimatedScenes{0}; - bool isRegularAnimation{false}; - if (!data.ReadUint32(systemAnimatedScenes) || !data.ReadBool(isRegularAnimation)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SYSTEM_ANIMATED_SCENES Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool success; - if (SetSystemAnimatedScenes(static_cast(systemAnimatedScenes), - isRegularAnimation, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SYSTEM_ANIMATED_SCENES Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK): { - if (!RSSystemProperties::GetSurfaceNodeWatermarkEnabled()) { - RS_LOGI("Current disenable water mark"); - break; - } - std::string name; - if (!data.ReadString(name)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_WATERMARK Read name failed!"); - ret = ERR_INVALID_DATA; - break; - } - auto watermark = std::shared_ptr(data.ReadParcelable()); - if (watermark == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::std::shared_ptr watermark == nullptr"); - break; - } - bool success; - if (SetWatermark(name, watermark, success) != ERR_OK || !success) { - RS_LOGE("RSRenderServiceConnectionStub::SetWatermark failed"); - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK): { - std::shared_ptr watermarkImg = - std::shared_ptr(data.ReadParcelable()); - bool isShow{false}; - if (!data.ReadBool(isShow)) { - RS_LOGE("RSRenderServiceConnectionStub::SHOW_WATERMARK Read isShow failed!"); - ret = ERR_INVALID_DATA; - break; - } - ShowWatermark(watermarkImg, isShow); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN): { - ScreenId id{INVALID_SCREEN_ID}; - uint32_t width{0}; - uint32_t height{0}; - if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderServiceConnectionStub::RESIZE_VIRTUAL_SCREEN Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = ResizeVirtualScreen(id, width, height); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::RESIZE_VIRTUAL_SCREEN Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS): { - ReportJankStats(); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE): { - DataBaseRs info; - if (!ReadDataBaseRs(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportEventResponse(info); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE): { - DataBaseRs info; - if (!ReadDataBaseRs(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportEventComplete(info); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME): { - DataBaseRs info; - if (!ReadDataBaseRs(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportEventJankFrame(info); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START): { - AppInfo info; - if (!ReadAppInfo(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportRsSceneJankStart(info); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END): { - AppInfo info; - if (!ReadAppInfo(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportRsSceneJankEnd(info); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE): { - GameStateData info; - if (!ReadGameStateDataRs(info, data)) { - ret = ERR_INVALID_DATA; - break; - } - ReportGameStateData(info); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::EXECUTE_SYNCHRONOUS_TASK): { int16_t type{0}; int16_t subType{0}; @@ -2840,80 +1645,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS) : { - int32_t lightFactorStatus{0}; - if (!data.ReadInt32(lightFactorStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_LIGHT_FACTOR_STATUS Read lightFactorStatus failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifyLightFactorStatus(lightFactorStatus); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT) : { - uint32_t listSize{0}; - if (!data.ReadUint32(listSize)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_PACKAGE_EVENT Read listSize failed!"); - ret = ERR_INVALID_DATA; - break; - } - const uint32_t MAX_LIST_SIZE = 50; - if (listSize > MAX_LIST_SIZE) { - ret = ERR_INVALID_STATE; - break; - } - std::vector packageList; - bool errFlag{false}; - for (uint32_t i = 0; i < listSize; i++) { - std::string package; - if (!data.ReadString(package)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_PACKAGE_EVENT Read package failed!"); - errFlag = true; - break; - } - packageList.push_back(package); - } - if (errFlag) { - ret = ERR_INVALID_DATA; - break; - } - NotifyPackageEvent(listSize, packageList); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT) : { - std::string pkgName; - uint32_t listSize{0}; - if (!data.ReadString(pkgName) || !data.ReadUint32(listSize)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - const uint32_t MAX_LIST_SIZE = 50; - if (listSize > MAX_LIST_SIZE) { - ret = ERR_INVALID_STATE; - break; - } - - std::vector> newConfig; - bool errFlag{false}; - for (uint32_t i = 0; i < listSize; i++) { - std::string key; - std::string value; - if (!data.ReadString(key) || !data.ReadString(value)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read newConfig " - "failed!"); - errFlag = true; - break; - } - newConfig.push_back(make_pair(key, value)); - } - if (errFlag) { - ret = ERR_INVALID_STATE; - break; - } - NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_REFRESH_RATE_EVENT) : { std::string eventName; bool eventStatus{false}; @@ -2999,228 +1730,52 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } eventInfos[vsyncName] = eventInfo; } - if (!shouldBreak) { - SetWindowExpectedRefreshRate(eventInfos); - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT) : { - uint32_t pid{0}; - uint32_t rateDiscount{0}; - if (!data.ReadUint32(pid) || !data.ReadUint32(rateDiscount)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifySoftVsyncEvent(pid, rateDiscount); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT) : { - uint32_t pid{0}; - std::string name; - uint32_t rateDiscount{0}; - if (!data.ReadUint32(pid) || !data.ReadString(name) || !data.ReadUint32(rateDiscount)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool result = NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); - if (!reply.WriteBool(result)) { - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT) : { - bool enableDynamicMode{false}; - if (!data.ReadBool(enableDynamicMode)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_DYNAMIC_MODE_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifyDynamicModeEvent(enableDynamicMode); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT) : { - int32_t touchStatus{0}; - int32_t touchCnt{0}; - if (!data.ReadInt32(touchStatus) || !data.ReadInt32(touchCnt)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_TOUCH_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifyTouchEvent(touchStatus, touchCnt); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT) : { - std::string eventName; - bool state{false}; - if (!data.ReadString(eventName) || !data.ReadBool(state)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_HGMCONFIG_EVENT Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifyHgmConfigEvent(eventName, state); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE) : { - std::string id; - int32_t expectedFrameRate; - if (!data.ReadString(id) || !data.ReadInt32(expectedFrameRate)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - NotifyXComponentExpectedFrameRate(id, expectedFrameRate); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK) : { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_HGM_CFG_CALLBACK Read remoteObject failed!"); - ret = ERR_NULL_OBJECT; - break; - } - sptr callback = iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - int32_t status = RegisterHgmConfigChangeCallback(callback); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_HGM_CFG_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK) : { - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Read remoteObject failed!"); - ret = ERR_NULL_OBJECT; - break; - } - sptr callback = - iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - int32_t status = RegisterHgmRefreshRateModeChangeCallback(callback); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; + if (!shouldBreak) { + SetWindowExpectedRefreshRate(eventInfos); } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK) : { - sptr callback = nullptr; - sptr remoteObject = nullptr; - bool readRemoteObject{false}; - if (!data.ReadBool(readRemoteObject)) { - RS_LOGE("RSRenderServiceConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Read remoteObject failed!"); + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT) : { + uint32_t pid{0}; + uint32_t rateDiscount{0}; + if (!data.ReadUint32(pid) || !data.ReadUint32(rateDiscount)) { + RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } - if (readRemoteObject) { - remoteObject = data.ReadRemoteObject(); - } - if (remoteObject != nullptr) { - callback = iface_cast(remoteObject); - } - int32_t status = RegisterHgmRefreshRateUpdateCallback(callback); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } + NotifySoftVsyncEvent(pid, rateDiscount); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT) : { - sptr callback = nullptr; - sptr remoteObject = nullptr; - bool readRemoteObject{false}; - if (!data.ReadBool(readRemoteObject)) { + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT) : { + bool enableDynamicMode{false}; + if (!data.ReadBool(enableDynamicMode)) { + RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_DYNAMIC_MODE_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } - if (readRemoteObject) { - remoteObject = data.ReadRemoteObject(); - } - if (remoteObject != nullptr) { - callback = iface_cast(remoteObject); - } - int32_t status = RegisterFirstFrameCommitCallback(callback); - if (!reply.WriteInt32(status)) { - ret = ERR_INVALID_REPLY; - } + NotifyDynamicModeEvent(enableDynamicMode); break; } - case static_cast( - RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK) : { - sptr callback = nullptr; - sptr remoteObject = nullptr; - int32_t dstPid{0}; - bool readRemoteObject{false}; - if (!data.ReadInt32(dstPid) || !data.ReadBool(readRemoteObject)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Read parcel " - "failed!"); + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT) : { + int32_t touchStatus{0}; + int32_t touchCnt{0}; + if (!data.ReadInt32(touchStatus) || !data.ReadInt32(touchCnt)) { + RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_TOUCH_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } - if (readRemoteObject) { - remoteObject = data.ReadRemoteObject(); - } - if (remoteObject != nullptr) { - callback = iface_cast(remoteObject); - } - int32_t status = RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, callback); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Write status " - "failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED) : { - bool isEnabled = false; - if (!data.ReadBool(isEnabled)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_ROTATION_CACHE_ENABLED Read isEnabled failed!"); - ret = IPC_STUB_INVALID_DATA_ERR; - break; - } - SetCacheEnabledForRotation(isEnabled); + NotifyTouchEvent(touchStatus, touchCnt); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO) : { - const auto& activeDirtyRegionInfos = GetActiveDirtyRegionInfo(); - if (!reply.WriteInt32(activeDirtyRegionInfos.size())) { - RS_LOGE("RSRenderServiceConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfosSize " - "failed!"); - ret = ERR_INVALID_REPLY; + case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE) : { + std::string id; + int32_t expectedFrameRate; + if (!data.ReadString(id) || !data.ReadInt32(expectedFrameRate)) { + RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); + ret = ERR_INVALID_DATA; break; } - for (const auto& activeDirtyRegionInfo : activeDirtyRegionInfos) { - if (!reply.WriteInt64(activeDirtyRegionInfo.activeDirtyRegionArea) || - !reply.WriteInt32(activeDirtyRegionInfo.activeFramesNumber) || - !reply.WriteInt32(activeDirtyRegionInfo.pidOfBelongsApp) || - !reply.WriteString(activeDirtyRegionInfo.windowName)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfos " - "failed!"); - ret = ERR_INVALID_REPLY; - break; - } - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO) : { - const auto& globalDirtyRegionInfo = GetGlobalDirtyRegionInfo(); - if (!reply.WriteInt64(globalDirtyRegionInfo.globalDirtyRegionAreas) || - !reply.WriteInt32(globalDirtyRegionInfo.globalFramesNumber) || - !reply.WriteInt32(globalDirtyRegionInfo.skipProcessFramesNumber) || - !reply.WriteInt32(globalDirtyRegionInfo.mostSendingPidWhenDisplayNodeSkip)) { - RS_LOGE( - "RSRenderServiceConnectionStub::GET_GLOBAL_DIRTY_REGION_INFO Write globalDirtyRegionInfo failed!"); - ret = ERR_INVALID_REPLY; - } + NotifyXComponentExpectedFrameRate(id, expectedFrameRate); break; } case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_LAYER_COMPOSE_INFO) : { @@ -3264,16 +1819,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HDR_ON_DURATION) : { - int64_t hdrOnDuration = 0; - auto errCode = GetHdrOnDuration(hdrOnDuration); - if (errCode != ERR_OK || !reply.WriteInt64(hdrOnDuration)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_HDR_ON_DURATION Write " - "hdrOnDuration failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } #ifdef TP_FEATURE_ENABLE case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG) : { int32_t feature{0}; @@ -3298,88 +1843,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } #endif - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS) : { - bool isVirtualScreenUsingStatus{false}; - if (!data.ReadBool(isVirtualScreenUsingStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_USING_STATUS Read " - "isVirtualScreenUsingStatus failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); - break; - } - - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS) : { - bool isCurtainScreenOn{false}; - if (!data.ReadBool(isCurtainScreenOn)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_CURTAIN_SCREEN_USING_STATUS Read " - "isCurtainScreenOn failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetCurtainScreenUsingStatus(isCurtainScreenOn); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID) : { - std::vector pidList; - if (!data.ReadInt32Vector(&pidList)) { - RS_LOGE("RSRenderServiceConnectionStub::DROP_FRAME_BY_PID Read " - "pidList failed!"); - ret = ERR_INVALID_REPLY; - break; - } - DropFrameByPid(pidList); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK): { - uint64_t userId{0}; - if (!data.ReadUint64(userId)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read " - "userId failed!"); - ret = ERR_INVALID_DATA; - break; - } - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read remoteObject failed!"); - ret = ERR_NULL_OBJECT; - break; - } - sptr callback = iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - break; - } - bool unobscured{false}; - if (!data.ReadBool(unobscured)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read unobscured failed!"); - ret = ERR_INVALID_DATA; - break; - } - int32_t status = RegisterUIExtensionCallback(userId, callback, unobscured); - if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_UIEXTENSION_CALLBACK Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS) : { - ScreenId id{INVALID_SCREEN_ID}; - uint8_t screenStatus{0}; - if (!data.ReadUint64(id) || !data.ReadUint8(screenStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_STATUS Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool success; - SetVirtualScreenStatus(id, static_cast(screenStatus), success); - if (!reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_STATUS Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PAGE_NAME) : { std::string packageName; std::string pageName; @@ -3392,30 +1855,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( NotifyPageName(packageName, pageName, isEnter); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS) : { - bool flag{false}; - if (!data.ReadBool(flag)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VMA_CACHE_STATUS read flag failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetVmaCacheStatus(flag); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT) : { - bool direct{false}; - if (!data.ReadBool(direct)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_ANCO_FORCE_DO_DIRECT Read direct failed!"); - ret = ERR_INVALID_DATA; - break; - } - bool res; - if (SetAncoForceDoDirect(direct, res) != ERR_OK || !reply.WriteBool(res)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_ANCO_FORCE_DO_DIRECT Write result failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE) : { uint64_t id{0}; if (!data.ReadUint64(id)) { @@ -3454,62 +1893,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS) : { - bool enable{false}; - if (!data.ReadBool(enable)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_FREE_MULTI_WINDOW_STATUS Read enable failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetFreeMultiWindowStatus(enable); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK) : { - int32_t pid{0}; - uint64_t uid{0}; - if (!data.ReadInt32(pid) || - !data.ReadUint64(uid)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(pid, callingPid)) { - RS_LOGW("REGISTER_SURFACE_BUFFER_CALLBACK invalid pid[%{public}d]", callingPid); - ret = ERR_INVALID_DATA; - break; - } - auto remoteObject = data.ReadRemoteObject(); - if (remoteObject == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest remoteObject == nullptr"); - break; - } - sptr callback = iface_cast(remoteObject); - if (callback == nullptr) { - ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest remoteObject cast error"); - break; - } - RegisterSurfaceBufferCallback(pid, uid, callback); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK) : { - int32_t pid{0}; - uint64_t uid{0}; - if (!data.ReadInt32(pid) || - !data.ReadUint64(uid)) { - RS_LOGE("RSRenderServiceConnectionStub::UNREGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(pid, callingPid)) { - RS_LOGW("UNREGISTER_SURFACE_BUFFER_CALLBACK invalid pid[%{public}d]", callingPid); - ret = ERR_INVALID_DATA; - break; - } - UnregisterSurfaceBufferCallback(pid, uid); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_LAYER_TOP_FOR_HARDWARE_COMPOSER) : { NodeId nodeId = {}; bool isTop{false}; @@ -3534,50 +1917,10 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( SetLayerTop(nodeIdStr, isTop); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH) : { - std::string nodeIdStr; - bool isForceRefresh{false}; - if (!data.ReadString(nodeIdStr) || - !data.ReadBool(isForceRefresh)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_FORCE_REFRESH Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetForceRefresh(nodeIdStr, isForceRefresh); - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW) : { - std::string nodeIdStr; - bool isColorFollow{false}; - if (!data.ReadString(nodeIdStr) || - !data.ReadBool(isColorFollow)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_COLOR_FOLLOW Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - SetColorFollow(nodeIdStr, isColorFollow); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SCREEN_SWITCHED) : { NotifyScreenSwitched(); break; } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER) : { - NodeId nodeId = {}; - bool isEnabled = {}; - if (!data.ReadUint64(nodeId) || !data.ReadBool(isEnabled)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_WINDOW_CONTAINER Read parcel failed!"); - ret = ERR_INVALID_DATA; - break; - } - if (!IsValidCallingPid(ExtractPid(nodeId), callingPid)) { - RS_LOGW("SET_WINDOW_CONTAINER invalid nodeId[%{public}" PRIu64 "] pid[%{public}d]", nodeId, callingPid); - ret = ERR_INVALID_DATA; - break; - } - SetWindowContainer(nodeId, isEnabled); - break; - } case static_cast( RSIRenderServiceConnectionInterfaceCode::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK): { uint32_t size; @@ -3678,57 +2021,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } #endif - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HIGH_CONTRAST_TEXT_STATE) : { - bool highContrast = GetHighContrastTextState(); - if (!reply.WriteBool(highContrast)) { - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED): { - bool enabled { false }; - if (!data.ReadBool(enabled)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED read enabled failed!"); - ret = ERR_INVALID_DATA; - break; - } - auto err = SetBehindWindowFilterEnabled(enabled); - if (err != ERR_OK) { - RS_LOGE("RSRenderServiceConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED Write status failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED): { - bool enabled; - if (GetBehindWindowFilterEnabled(enabled) != ERR_OK || !reply.WriteBool(enabled)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_BEHIND_WINDOW_FILTER_ENABLED write enabled failed!"); - ret = ERR_INVALID_REPLY; - } - break; - } - case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB): { - int32_t pid{0}; - float gpuMemInMB{0.0}; - if (!data.ReadInt32(pid)) { - RS_LOGE("RenderServiceConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read data err!"); - ret = ERR_INVALID_DATA; - break; - } - ret = GetPidGpuMemoryInMB(pid, gpuMemInMB); - if (ret != 0) { - RS_LOGE("RenderServiceConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read ret err!"); - ret = ERR_INVALID_DATA; - break; - } - if (!reply.WriteFloat(gpuMemInMB)) { - RS_LOGE("RenderServiceConnectionStub::GET_PID_GPU_MEMORY_IN_MB write gpuMemInMB err!"); - ret = ERR_INVALID_REPLY; - } - RS_LOGD("RenderServiceConnectionStub::GET_PID_GPU_MEMORY_IN_MB, ret: %{public}d, gpuMemInMB: %{public}f", - ret, gpuMemInMB); - break; - } case static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START): { uint64_t uniqueId{0}; std::string surfaceName; @@ -3826,113 +2118,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( return ret; } -bool RSRenderServiceConnectionStub::ReadDataBaseRs(DataBaseRs& info, MessageParcel& data) -{ - if (!data.ReadInt32(info.appPid) || !data.ReadInt32(info.eventType) || - !data.ReadInt32(info.versionCode) || !data.ReadInt64(info.uniqueId) || - !data.ReadInt64(info.inputTime) || !data.ReadInt64(info.beginVsyncTime) || - !data.ReadInt64(info.endVsyncTime) || !data.ReadBool(info.isDisplayAnimator) || - !data.ReadString(info.sceneId) || !data.ReadString(info.versionName) || - !data.ReadString(info.bundleName) || !data.ReadString(info.processName) || - !data.ReadString(info.abilityName) ||!data.ReadString(info.pageUrl) || - !data.ReadString(info.sourceType) || !data.ReadString(info.note)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadDataBaseRs Read parcel failed!"); - return false; - } - return true; -} - -bool RSRenderServiceConnectionStub::ReadAppInfo(AppInfo& info, MessageParcel& data) -{ - if (!data.ReadInt64(info.startTime)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read startTime failed!"); - return false; - } - if (!data.ReadInt64(info.endTime)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read endTime failed!"); - return false; - } - if (!data.ReadInt32(info.pid)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read pid failed!"); - return false; - } - if (!data.ReadString(info.versionName)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read versionName failed!"); - return false; - } - if (!data.ReadInt32(info.versionCode)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read versionCode failed!"); - return false; - } - if (!data.ReadString(info.bundleName)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read bundleName failed!"); - return false; - } - if (!data.ReadString(info.processName)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadAppInfo Read processName failed!"); - return false; - } - return true; -} - -bool RSRenderServiceConnectionStub::ReadGameStateDataRs(GameStateData& info, MessageParcel& data) -{ - if (!data.ReadInt32(info.pid) || !data.ReadInt32(info.uid) || - !data.ReadInt32(info.state) || !data.ReadInt32(info.renderTid) || - !data.ReadString(info.bundleName)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadGameStateDataRs Read parcel failed!"); - return false; - } - return true; -} - -bool RSRenderServiceConnectionStub::ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) -{ - uint8_t captureType { 0 }; - if (!data.ReadFloat(captureConfig.scaleX) || !data.ReadFloat(captureConfig.scaleY) || - !data.ReadBool(captureConfig.useDma) || !data.ReadBool(captureConfig.useCurWindow) || - !data.ReadUint8(captureType) || !data.ReadBool(captureConfig.isSync) || - !data.ReadBool(captureConfig.isHdrCapture) || - !data.ReadFloat(captureConfig.mainScreenRect.left_) || - !data.ReadFloat(captureConfig.mainScreenRect.top_) || - !data.ReadFloat(captureConfig.mainScreenRect.right_) || - !data.ReadFloat(captureConfig.mainScreenRect.bottom_) || - !data.ReadUint64(captureConfig.uiCaptureInRangeParam.endNodeId) || - !data.ReadBool(captureConfig.uiCaptureInRangeParam.useBeginNodeSize) || - !data.ReadFloat(captureConfig.specifiedAreaRect.left_) || - !data.ReadFloat(captureConfig.specifiedAreaRect.top_) || - !data.ReadFloat(captureConfig.specifiedAreaRect.right_) || - !data.ReadFloat(captureConfig.specifiedAreaRect.bottom_) || - !data.ReadUInt64Vector(&captureConfig.blackList) || - !data.ReadUint32(captureConfig.backGroundColor)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadSurfaceCaptureConfig Read captureType failed!"); - return false; - } - captureConfig.captureType = static_cast(captureType); - return true; -} - -bool RSRenderServiceConnectionStub::ReadSurfaceCaptureBlurParam( - RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) -{ - if (!data.ReadBool(blurParam.isNeedBlur) || !data.ReadFloat(blurParam.blurRadius)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadSurfaceCaptureBlurParam Read blurParam failed!"); - return false; - } - return true; -} - -bool RSRenderServiceConnectionStub::ReadSurfaceCaptureAreaRect( - Drawing::Rect& specifiedAreaRect, MessageParcel& data) -{ - if (!data.ReadFloat(specifiedAreaRect.left_) || !data.ReadFloat(specifiedAreaRect.top_) || - !data.ReadFloat(specifiedAreaRect.right_) || !data.ReadFloat(specifiedAreaRect.bottom_)) { - RS_LOGE("RSRenderServiceConnectionStub::ReadSurfaceCaptureAreaRect Read specifiedAreaRect failed!"); - return false; - } - return true; -} - const RSInterfaceCodeSecurityManager RSRenderServiceConnectionStub::securityManager_ = \ RSInterfaceCodeSecurityManager::CreateInstance(); } // namespace Rosen diff --git a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h b/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h index c871a503ec..e737d2551b 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h +++ b/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h @@ -35,18 +35,9 @@ public: int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; - void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) override {}; - void RunOnRemoteDiedCallback() override {}; - private: static const RSInterfaceCodeSecurityManager securityManager_; - bool ReadDataBaseRs(DataBaseRs& info, MessageParcel& data); - bool ReadAppInfo(AppInfo& info, MessageParcel& data); - bool ReadGameStateDataRs(GameStateData& info, MessageParcel& data); - bool ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data); - bool ReadSurfaceCaptureBlurParam(RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data); - bool ReadSurfaceCaptureAreaRect(Drawing::Rect& specifiedAreaRect, MessageParcel& data); void SetQos(); RSRenderServiceSecurityUtils securityUtils_; std::unordered_set tids_; diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h index 64a7678c03..21b913a3db 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h @@ -13,18 +13,48 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H +#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H +#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H -#include "rs_irender_connection_token.h" -#include "rs_irender_render_connection.h" +#include +#include +#include + +#include "command/rs_command.h" +#include "command/rs_node_showing_command.h" +#include "feature/capture/rs_ui_capture.h" +#include "ipc_callbacks/buffer_available_callback.h" +#include "ipc_callbacks/buffer_clear_callback.h" +#include "ipc_callbacks/iapplication_agent.h" +#include "ipc_callbacks/rs_iself_drawing_node_rect_change_callback.h" +#include "ipc_callbacks/rs_isurface_occlusion_change_callback.h" +#include "ipc_callbacks/rs_surface_buffer_callback.h" +#include "ipc_callbacks/rs_iframe_rate_linker_expected_fps_update_callback.h" +#include "ipc_callbacks/screen_change_callback.h" +#include "ipc_callbacks/surface_capture_callback.h" +#include "ipc_callbacks/rs_transaction_data_callback.h" +#include "memory/rs_memory_graphic.h" +#include "screen_manager/rs_screen_capability.h" +#include "screen_manager/rs_screen_data.h" +#include "screen_manager/rs_screen_hdr_capability.h" +#include "screen_manager/rs_screen_mode_info.h" +#include "screen_manager/screen_types.h" +#include "screen_manager/rs_virtual_screen_resolution.h" +#include "transaction/rs_transaction_data.h" +#include "transaction/rs_render_service_client.h" +#include "ivsync_connection.h" +#include "ipc_callbacks/rs_ihgm_config_change_callback.h" +#include "ipc_callbacks/rs_ifirst_frame_commit_callback.h" +#include "ipc_callbacks/rs_iocclusion_change_callback.h" +#include "ipc_callbacks/rs_iuiextension_callback.h" +#include "vsync_iconnection_token.h" namespace OHOS { namespace Rosen { class RSIRenderProcessConnection : public IRemoteBroker { public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.IRenderProcessConnection"); + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.RenderProcessConnection"); RSIRenderProcessConnection() = default; virtual ~RSIRenderProcessConnection() noexcept = default; @@ -33,9 +63,296 @@ public: virtual sptr CreateRenderConnection(const sptr& token, pid_t remotePid) = 0; -}; + virtual ErrCode CommitTransaction(std::unique_ptr& transactionData) = 0; + virtual ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) = 0; + + virtual ErrCode GetUniRenderEnabled(bool& enable) = 0; + + virtual ErrCode CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) = 0; + virtual ErrCode CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) = 0; + virtual ErrCode CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, + bool unobscured = false) = 0; + + virtual ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, + int32_t& repCode) = 0; + + virtual ErrCode CreatePixelMapFromSurface(sptr surface, + const Rect &srcRect, std::shared_ptr &pixelMap) = 0; + + virtual ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) = 0; + + virtual int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) = 0; + + virtual ErrCode SetVirtualScreenTypeBlackList( + ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) = 0; + + virtual ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) = 0; + + virtual ErrCode RemoveVirtualScreenBlackList( + ScreenId id, std::vector& blackListVector, int32_t& repCode) = 0; + + virtual ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, + bool& success) = 0; + + virtual int32_t SetVirtualScreenSecurityExemptionList( + ScreenId id, const std::vector& securityExemptionList) = 0; + + virtual int32_t SetScreenSecurityMask(ScreenId id, + std::shared_ptr securityMask) = 0; + + virtual int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, + bool supportRotation = false) = 0; + + virtual int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) = 0; + + virtual int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) = 0; + + virtual void RemoveVirtualScreen(ScreenId id) = 0; + +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR + virtual int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, + int64_t interval, int32_t rangeSize) = 0; + + virtual int32_t SetPointerColorInversionEnabled(bool enable) = 0; + + virtual int32_t RegisterPointerLuminanceChangeCallback(sptr callback) = 0; + + virtual int32_t UnRegisterPointerLuminanceChangeCallback() = 0; +#endif + + virtual void SetScreenActiveMode(ScreenId id, uint32_t modeId) = 0; + + virtual void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, + int32_t animatorExpectedFrameRate) = 0; + + virtual void UnregisterFrameRateLinker(FrameRateLinkerId id) = 0; + + virtual ErrCode GetRefreshInfo(pid_t pid, std::string& enable) = 0; + virtual ErrCode GetRefreshInfoToSP(NodeId id, std::string& enable) = 0; + + virtual int32_t SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) = 0; + + virtual int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) = 0; + + virtual ErrCode MarkPowerOffNeedProcessOneFrame() = 0; + + virtual ErrCode RepaintEverything() = 0; + + virtual ErrCode ForceRefreshOneFrameWithNextVSync() = 0; + + virtual void DisablePowerOffRenderControl(ScreenId id) = 0; + + virtual void TakeSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam = {}, + const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) = 0; + + virtual std::vector>> TakeSurfaceCaptureSoloNode( + NodeId id, const RSSurfaceCaptureConfig& captureConfig, + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) = 0; + + virtual void TakeSelfSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig) = 0; + + virtual ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam = {}) = 0; + + virtual void TakeUICaptureInRange( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) = 0; + + virtual ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, + float positionZ, float positionW) = 0; + + virtual ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) = 0; + + virtual RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) = 0; + + virtual ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) = 0; + + virtual ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) = 0; + + virtual ErrCode GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) = 0; + + virtual ErrCode GetMemoryGraphics(std::vector& memoryGraphics) = 0; + + virtual ErrCode RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) = 0; + + virtual ErrCode RegisterBufferClearListener( + NodeId id, sptr callback) = 0; + + virtual bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) = 0; + + virtual int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) = 0; + + virtual bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) = 0; + + virtual ErrCode SetGlobalDarkColorMode(bool isDark) = 0; + + virtual int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) = 0; + + virtual ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) = 0; + + virtual ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) = 0; + + virtual ErrCode GetScreenSupportedHDRFormats( + ScreenId id, std::vector& hdrFormats, int32_t& resCode) = 0; + + virtual ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) = 0; + + virtual ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) = 0; + + virtual ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) = 0; + + virtual ErrCode GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) = 0; + + virtual ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) = 0; + virtual ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) = 0; + virtual bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) = 0; + virtual bool UnRegisterTypeface(uint64_t globalUniqueId) = 0; + + virtual ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) = 0; + + virtual ErrCode SetVirtualScreenRefreshRate( + ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) = 0; + + virtual void SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) = 0; + + virtual void SetScreenFrameGravity(ScreenId id, int32_t gravity) = 0; + + virtual ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) = 0; + + virtual int32_t RegisterSurfaceOcclusionChangeCallback( + NodeId id, sptr callback, std::vector& partitionPoints) = 0; + + virtual int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) = 0; + + virtual int32_t RegisterHgmConfigChangeCallback(sptr callback) = 0; + + virtual int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) = 0; + + virtual ErrCode SetAppWindowNum(uint32_t num) = 0; + + virtual int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) = 0; + + virtual int32_t RegisterFirstFrameCommitCallback(sptr callback) = 0; + + virtual int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t pid, + sptr callback) = 0; + + virtual ErrCode SetSystemAnimatedScenes( + SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) = 0; + + virtual void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) = 0; + + virtual int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) = 0; + + virtual ErrCode ReportJankStats() = 0; + + virtual ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) = 0; + + virtual void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) = 0; + + virtual void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, + const std::vector>& newConfig) = 0; + + virtual ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) = 0; + + virtual bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) = 0; + + virtual ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) = 0; + + virtual ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) = 0; + + virtual ErrCode ReportEventResponse(DataBaseRs info) = 0; + + virtual ErrCode ReportEventComplete(DataBaseRs info) = 0; + + virtual ErrCode ReportEventJankFrame(DataBaseRs info) = 0; + + virtual ErrCode ReportGameStateData(GameStateData info) = 0; + + virtual void ReportRsSceneJankStart(AppInfo info) = 0; + + virtual void ReportRsSceneJankEnd(AppInfo info) = 0; + + virtual ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, + bool dynamicHardwareEnable) = 0; + + virtual ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) = 0; + + virtual ErrCode SetCacheEnabledForRotation(bool isEnabled) = 0; + + virtual void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) = 0; + + virtual void RunOnRemoteDiedCallback() = 0; + + virtual void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) = 0; + + virtual ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) = 0; + + virtual ErrCode DropFrameByPid(const std::vector pidList) = 0; + + virtual std::vector GetActiveDirtyRegionInfo() = 0; + + virtual GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() = 0; + + virtual ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) = 0; + + virtual ErrCode SetVmaCacheStatus(bool flag) = 0; + + virtual int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, + bool unobscured = false) = 0; + + virtual ErrCode SetAncoForceDoDirect(bool direct, bool& res) = 0; + + virtual ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) = 0; + + virtual void SetFreeMultiWindowStatus(bool enable) = 0; + + virtual ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) = 0; + + virtual void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) = 0; +#ifdef TP_FEATURE_ENABLE + virtual ErrCode SetTpFeatureConfig( + int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) = 0; +#endif + + virtual ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, + sptr callback) = 0; + + virtual ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) = 0; + + virtual void RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, + sptr callback) = 0; + + virtual ErrCode SetWindowContainer(NodeId nodeId, bool value) = 0; + + virtual ErrCode AvcodecVideoStart( + uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) = 0; + + virtual ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) = 0; + + virtual bool GetHighContrastTextState() = 0; + + virtual ErrCode SetBehindWindowFilterEnabled(bool enabled) = 0; + + virtual ErrCode GetBehindWindowFilterEnabled(bool& enabled) = 0; + + virtual int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) = 0; + + virtual RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, + const std::string& fileName, int32_t flags, int& outFd) = 0; + virtual RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, + uint32_t firstFileIndex, std::vector& outFiles) = 0; + virtual bool ProfilerIsSecureScreen() = 0; + + virtual void ClearUifirstCache(NodeId id) = 0; +}; } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H \ No newline at end of file +#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h index 9ddf269a5f..b20b5303d5 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h @@ -16,11 +16,12 @@ #ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_H #define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_H +#include "rs_irender_compose_connection.h" #include "rs_irender_connection_token.h" -#include "rs_irender_service_connection.h" +#include "rs_irender_process_connection.h" #include "rs_irender_proocess_connection.h" -#include "rs_irender_compose_connection.h" #include "rs_irender_render_connection.h" +#include "rs_irender_service_connection.h" namespace OHOS { namespace Rosen { diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h index 81eb3471a6..5d03bf6335 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h @@ -74,14 +74,6 @@ public: const sptr& token = nullptr, VSyncConnParam vsyncConnParam = {0, 0, false}) = 0; - virtual ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, - int32_t& repCode) = 0; - - virtual ErrCode CreatePixelMapFromSurface(sptr surface, - const Rect &srcRect, std::shared_ptr &pixelMap) = 0; - - virtual ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) = 0; - virtual ErrCode GetDefaultScreenId(uint64_t& screenId) = 0; virtual ErrCode GetActiveScreenId(uint64_t& screenId) = 0; @@ -98,45 +90,10 @@ public: int32_t flags = 0, std::vector whiteList = {}) = 0; - virtual int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) = 0; - - virtual ErrCode SetVirtualScreenTypeBlackList( - ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) = 0; - - virtual ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) = 0; - - virtual ErrCode RemoveVirtualScreenBlackList( - ScreenId id, std::vector& blackListVector, int32_t& repCode) = 0; - - virtual ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, - bool& success) = 0; - - virtual int32_t SetVirtualScreenSecurityExemptionList( - ScreenId id, const std::vector& securityExemptionList) = 0; - - virtual int32_t SetScreenSecurityMask(ScreenId id, - std::shared_ptr securityMask) = 0; - - virtual int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, - bool supportRotation = false) = 0; - - virtual int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) = 0; - virtual int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) = 0; virtual void RemoveVirtualScreen(ScreenId id) = 0; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - virtual int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, - int64_t interval, int32_t rangeSize) = 0; - - virtual int32_t SetPointerColorInversionEnabled(bool enable) = 0; - - virtual int32_t RegisterPointerLuminanceChangeCallback(sptr callback) = 0; - - virtual int32_t UnRegisterPointerLuminanceChangeCallback() = 0; -#endif - virtual int32_t SetScreenChangeCallback(sptr callback) = 0; virtual void SetScreenActiveMode(ScreenId id, uint32_t modeId) = 0; @@ -145,9 +102,6 @@ public: virtual void SetRefreshRateMode(int32_t refreshRateMode) = 0; - virtual void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, - int32_t animatorExpectedFrameRate) = 0; - virtual void UnregisterFrameRateLinker(FrameRateLinkerId id) = 0; virtual uint32_t GetScreenCurrentRefreshRate(ScreenId id) = 0; @@ -169,41 +123,12 @@ public: virtual int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) = 0; - virtual ErrCode MarkPowerOffNeedProcessOneFrame() = 0; - virtual ErrCode RepaintEverything() = 0; - virtual ErrCode ForceRefreshOneFrameWithNextVSync() = 0; - - virtual void DisablePowerOffRenderControl(ScreenId id) = 0; - virtual void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) = 0; - virtual void TakeSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam = {}, - const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) = 0; - - virtual std::vector>> TakeSurfaceCaptureSoloNode( - NodeId id, const RSSurfaceCaptureConfig& captureConfig, - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) = 0; - - virtual void TakeSelfSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig) = 0; - - virtual ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam = {}) = 0; - - virtual void TakeUICaptureInRange( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) = 0; - - virtual ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, - float positionZ, float positionW) = 0; - virtual ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) = 0; - virtual RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) = 0; - virtual ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) = 0; virtual std::vector GetScreenSupportedModes(ScreenId id) = 0; @@ -242,29 +167,10 @@ public: virtual int32_t SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) = 0; - virtual bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) = 0; - - virtual int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) = 0; - - virtual bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) = 0; - virtual ErrCode SetGlobalDarkColorMode(bool isDark) = 0; virtual int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) = 0; - virtual int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) = 0; - - virtual ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) = 0; - - virtual ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) = 0; - - virtual ErrCode GetScreenSupportedHDRFormats( - ScreenId id, std::vector& hdrFormats, int32_t& resCode) = 0; - - virtual ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) = 0; - - virtual ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) = 0; - virtual ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) = 0; virtual ErrCode GetScreenSupportedColorSpaces( @@ -279,13 +185,6 @@ public: virtual ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) = 0; virtual ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) = 0; - virtual bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) = 0; - virtual bool UnRegisterTypeface(uint64_t globalUniqueId) = 0; - - virtual ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) = 0; - - virtual ErrCode SetVirtualScreenRefreshRate( - ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) = 0; virtual ErrCode SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) = 0; @@ -293,42 +192,6 @@ public: virtual void SetScreenFrameGravity(ScreenId id, int32_t gravity) = 0; - virtual ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) = 0; - - virtual int32_t RegisterSurfaceOcclusionChangeCallback( - NodeId id, sptr callback, std::vector& partitionPoints) = 0; - - virtual int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) = 0; - - virtual int32_t RegisterHgmConfigChangeCallback(sptr callback) = 0; - - virtual int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) = 0; - - virtual ErrCode SetAppWindowNum(uint32_t num) = 0; - - virtual int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) = 0; - - virtual int32_t RegisterFirstFrameCommitCallback(sptr callback) = 0; - - virtual int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t pid, - sptr callback) = 0; - - virtual ErrCode SetSystemAnimatedScenes( - SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) = 0; - - virtual void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) = 0; - - virtual int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) = 0; - - virtual ErrCode ReportJankStats() = 0; - - virtual ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) = 0; - - virtual void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) = 0; - - virtual void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, - const std::vector>& newConfig) = 0; - virtual void NotifyRefreshRateEvent(const EventInfo& eventInfo) = 0; virtual void SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) = 0; @@ -337,66 +200,21 @@ public: virtual ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) = 0; - virtual bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) = 0; - virtual ErrCode NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) = 0; virtual void NotifyDynamicModeEvent(bool enableDynamicMode) = 0; - virtual ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) = 0; - virtual ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) = 0; - virtual ErrCode ReportEventResponse(DataBaseRs info) = 0; - - virtual ErrCode ReportEventComplete(DataBaseRs info) = 0; - - virtual ErrCode ReportEventJankFrame(DataBaseRs info) = 0; - - virtual ErrCode ReportGameStateData(GameStateData info) = 0; - - virtual void ReportRsSceneJankStart(AppInfo info) = 0; - - virtual void ReportRsSceneJankEnd(AppInfo info) = 0; - virtual ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) = 0; virtual ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) = 0; - virtual ErrCode SetCacheEnabledForRotation(bool isEnabled) = 0; - - virtual void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) = 0; - - virtual void RunOnRemoteDiedCallback() = 0; - - virtual void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) = 0; - - virtual ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) = 0; - - virtual ErrCode DropFrameByPid(const std::vector pidList) = 0; - - virtual std::vector GetActiveDirtyRegionInfo() = 0; - - virtual GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() = 0; - virtual LayerComposeInfo GetLayerComposeInfo() = 0; virtual HwcDisabledReasonInfos GetHwcDisabledReasonInfo() = 0; - virtual ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) = 0; - - virtual ErrCode SetVmaCacheStatus(bool flag) = 0; - - virtual int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, - bool unobscured = false) = 0; - - virtual ErrCode SetAncoForceDoDirect(bool direct, bool& res) = 0; - - virtual ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) = 0; - - virtual void SetFreeMultiWindowStatus(bool enable) = 0; - virtual int32_t GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) = 0; #ifdef RS_ENABLE_OVERLAY_DISPLAY @@ -407,26 +225,16 @@ public: virtual ErrCode SetLayerTop(const std::string &nodeIdStr, bool isTop) = 0; - virtual ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) = 0; - - virtual void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) = 0; #ifdef TP_FEATURE_ENABLE virtual ErrCode SetTpFeatureConfig( int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) = 0; #endif - virtual ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, - sptr callback) = 0; - - virtual ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) = 0; - virtual void RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) = 0; virtual ErrCode NotifyScreenSwitched() = 0; - virtual ErrCode SetWindowContainer(NodeId nodeId, bool value) = 0; - virtual int32_t RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) = 0; @@ -439,14 +247,6 @@ public: virtual ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) = 0; - virtual bool GetHighContrastTextState() = 0; - - virtual ErrCode SetBehindWindowFilterEnabled(bool enabled) = 0; - - virtual ErrCode GetBehindWindowFilterEnabled(bool& enabled) = 0; - - virtual int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) = 0; - virtual RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) = 0; virtual RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, diff --git a/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h b/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h index 2a6973d095..e1fe641e1d 100644 --- a/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h +++ b/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h @@ -511,6 +511,10 @@ private: void TriggerOnFinish(const FinishCallbackRet& ret) const; void TriggerOnAfterAcquireBuffer(const AfterAcquireBufferRet& ret) const; void TriggerTransactionDataCallbackAndErase(uint64_t token, uint64_t timeStamp); + + std::shared_ptr GetRenderServiceConnection(); + std::shared_ptr GetRenderProcessConnection(); + struct RectHash { std::size_t operator()(const Drawing::Rect& rect) const { std::size_t h1 = std::hash()(rect.left_); diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp index 8661677425..5ea108851c 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -15,10 +15,4211 @@ #include "rs_render_process_connection_proxy.h" +#include +#include +#include +#include +#include +#include "platform/common/rs_log.h" +#include "platform/common/rs_system_properties.h" +#include "transaction/rs_ashmem_helper.h" +#include "transaction/rs_hrp_service.h" +#include "transaction/rs_marshalling_helper.h" +#include "rs_trace.h" + namespace OHOS { namespace Rosen { -RSRenderProcessConnectionProxy::RSRenderProcessConnectionProxy(const sptr& impl) : - IRemoteProxy(impl) {} +namespace { +static constexpr size_t ASHMEM_SIZE_THRESHOLD = 200 * 1024; // cannot > 500K in TF_ASYNC mode +static constexpr int MAX_RETRY_COUNT = 20; +static constexpr int RETRY_WAIT_TIME_US = 1000; // wait 1ms before retry SendRequest +static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 +} + +RSRenderProcessConnectionProxy::RSRenderProcessConnectionProxy(const sptr& impl) + : IRemoteProxy(impl) +{ +} + +ErrCode RSRenderProcessConnectionProxy::CommitTransaction(std::unique_ptr& transactionData) +{ + if (!transactionData) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CommitTransaction transactionData nullptr!"); + return ERR_INVALID_VALUE; + } + bool isUniMode = RSSystemProperties::GetUniRenderEnabled(); + transactionData->SetSendingPid(pid_); + + // split to several parcels if parcel size > PARCEL_SPLIT_THRESHOLD during marshalling + std::vector> parcelVector; + auto func = [isUniMode, &parcelVector, &transactionData, this]() -> bool { + if (isUniMode) { + ++transactionDataIndex_; + } + transactionData->SetIndex(transactionDataIndex_); + std::shared_ptr parcel = std::make_shared(); + if (!FillParcelWithTransactionData(transactionData, parcel)) { + ROSEN_LOGE("FillParcelWithTransactionData failed!"); + return false; + } + parcelVector.emplace_back(parcel); + return true; + }; + if (transactionData->IsNeedSync() && transactionData->IsEmpty()) { + RS_TRACE_NAME("Commit empty syncTransaction"); + func(); + } else { + while (transactionData->GetMarshallingIndex() < transactionData->GetCommandCount()) { + if (!func()) { + return ERR_INVALID_VALUE; + } + } + } + + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + for (const auto& parcel : parcelVector) { + MessageParcel reply; + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::COMMIT_TRANSACTION); + int retryCount = 0; + int32_t err = NO_ERROR; + do { + err = SendRequest(code, *parcel, reply, option); + if (err != NO_ERROR && retryCount < MAX_RETRY_COUNT) { + retryCount++; + usleep(RETRY_WAIT_TIME_US); + } else if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CommitTransaction SendRequest failed, " + "err = %{public}d, retryCount = %{public}d, data size:%{public}zu", err, retryCount, + parcel->GetDataSize()); + return ERR_INVALID_VALUE; + } + } while (err != NO_ERROR); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::ExecuteSynchronousTask(const std::shared_ptr& task) +{ + if (task == nullptr) { + return ERR_INVALID_VALUE; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSRenderProcessConnectionProxy::GetDescriptor())) { + ROSEN_LOGE("ExecuteSynchronousTask WriteInterfaceToken failed"); + return ERR_INVALID_VALUE; + } + if (!task->Marshalling(data)) { + ROSEN_LOGE("ExecuteSynchronousTask Marshalling failed"); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::EXECUTE_SYNCHRONOUS_TASK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + + if (task->CheckHeader(reply)) { + task->ReadFromParcel(reply); + } + return ERR_OK; +} + +bool RSRenderProcessConnectionProxy::FillParcelWithTransactionData( + std::unique_ptr& transactionData, std::shared_ptr& data) +{ + // write a flag at the begin of parcel to identify parcel type + // 0: indicate normal parcel + // 1: indicate ashmem parcel + if (!data->WriteInt32(0)) { + ROSEN_LOGE("FillParcelWithTransactionData WriteInt32 failed"); + return false; + } + + if (!RSMarshallingHelper::MarshallingTransactionVer(*data)) { + ROSEN_LOGE("FillParcelWithTransactionData WriteVersionHeader failed!"); + return false; + } + + { + // 1. marshalling RSTransactionData +#ifdef RS_ENABLE_VK + RS_TRACE_NAME_FMT("MarshRSTransactionData cmdCount: %lu, transactionFlag:[%d,%" PRIu64 "], tid:%d, " + "timestamp:%ld", transactionData->GetCommandCount(), pid_, transactionData->GetIndex(), + transactionData->GetSendingTid(), transactionData->GetTimestamp()); +#else + RS_TRACE_NAME_FMT("MarshRSTransactionData cmdCount: %lu, transactionFlag:[%d,%" PRIu64 "], timestamp:%ld", + transactionData->GetCommandCount(), pid_, transactionData->GetIndex(), transactionData->GetTimestamp()); +#endif + ROSEN_LOGI_IF(DEBUG_PIPELINE, + "MarshRSTransactionData cmdCount:%{public}lu transactionFlag:[pid:%{public}d index:%{public}" PRIu64 "]", + transactionData->GetCommandCount(), pid_, transactionData->GetIndex()); + bool success = data->WriteParcelable(transactionData.get()); + if (!success) { + ROSEN_LOGE("FillParcelWithTransactionData data.WriteParcelable failed!"); + return false; + } + } + + // 2. convert data to new ashmem parcel if size over threshold + std::shared_ptr ashmemParcel = nullptr; + if (data->GetDataSize() > ASHMEM_SIZE_THRESHOLD) { + ashmemParcel = RSAshmemHelper::CreateAshmemParcel(data); + } + if (ashmemParcel != nullptr) { + data = ashmemParcel; + } + return true; +} + +ErrCode RSRenderProcessConnectionProxy::GetUniRenderEnabled(bool& enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_UNI_RENDER_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return false; + } + if (!reply.ReadBool(enable)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetUniRenderEnabled Read enable failed!"); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, + bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteInterfaceToken err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(nodeId)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 NodeId err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(displayNodeConfig.mirrorNodeId)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 Config.MirrorNodeId err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(displayNodeConfig.screenId)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 Config.ScreenId err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(displayNodeConfig.isMirrored)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteBool Config.IsMirrored err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadBool(success)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode Read success failed!"); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteUint64(config.id)) { + ROSEN_LOGE("CreateNode: WriteUint64 Config.id err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteString(config.name)) { + ROSEN_LOGE("CreateNode: WriteString Config.name err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadBool(success)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode Read success failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, + sptr& sfc, bool unobscured) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteUint64(config.id)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint64 config.id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString(config.name)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteString config.name err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint8(static_cast(config.nodeType))) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint8 config.nodeType err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(config.isTextureExportNode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool config.isTextureExportNode err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(config.isSync)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool config.isSync err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint8(static_cast(config.surfaceWindowType))) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint8 config.surfaceWindowType err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(unobscured)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool unobscured err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE_AND_SURFACE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + sptr surfaceObject = reply.ReadRemoteObject(); + sptr bp = iface_cast(surfaceObject); + if (bp == nullptr) { + return ERR_INVALID_VALUE; + } + sfc = Surface::CreateSurfaceAsProducer(bp); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetPixelMapByProcessId( + std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteUint64(pid)) { + ROSEN_LOGE("GetPixelMapByProcessId: WriteUint64 pid err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Send Request err"); + repCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(repCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId Read repCode failed"); + return ERR_INVALID_VALUE; + } + if (repCode == SUCCESS) { + pixelMapInfoVector.clear(); + if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapInfoVector)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Unmarshalling failed"); + } + } else { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Invalid reply"); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::CreatePixelMapFromSurface(sptr surface, + const Rect &srcRect, std::shared_ptr &pixelMap) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (surface == nullptr) { + return ERR_INVALID_VALUE; + } + + auto producer = surface->GetProducer(); + if (producer == nullptr) { + return ERR_INVALID_VALUE; + } + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("CreatePixelMapFromSurface: WriteInterfaceToken RSIRenderProcessConnection::GetDescriptor() err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(producer->AsObject())) { + ROSEN_LOGE("CreatePixelMapFromSurface: WriteRemoteObject producer->AsObject() err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32(srcRect.x) || !data.WriteInt32(srcRect.y) || + !data.WriteInt32(srcRect.w) || !data.WriteInt32(srcRect.h)) { + ROSEN_LOGE("CreatePixelMapFromSurface: WriteInt32 srcRect err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::CreatePixelMapFromSurface: Send Request err."); + return ERR_INVALID_VALUE; + } + + if (reply.ReadBool()) { + pixelMap.reset(Media::PixelMap::Unmarshalling(reply)); + } else { + ROSEN_LOGE("CreatePixelMapFromSurface: ReadBool err."); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInterfaceToken err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteInt32(info.pid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInt32 pid err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32(info.uid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInt32 uid err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteString(info.bundleName)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteString bundleName err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteString(info.abilityName)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteString abilityName err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(info.focusNodeId)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteUint64 focusNodeId err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: Send Request err."); + repCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + repCode = reply.ReadInt32(); + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenBlackList: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUInt64Vector(blackListVector)) { + ROSEN_LOGE("SetVirtualScreenBlackList: WriteUInt64Vector blackListVector err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenBlackList: Send Request err."); + return RS_CONNECTION_ERROR; + } + + int32_t status = reply.ReadInt32(); + return status; +} + +ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList( + ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteInterfaceToken GetDescriptor err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteUint64 id err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUInt8Vector(typeBlackListVector)) { + ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteUInt8Vector typeBlackListVector err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList: Send Request err."); + return ERR_INVALID_VALUE; + } + + repCode = reply.ReadInt32(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::AddVirtualScreenBlackList( + ScreenId id, std::vector& blackListVector, int32_t& repCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("AddVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("AddVirtualScreenBlackList: WriteUint64 id err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUInt64Vector(blackListVector)) { + ROSEN_LOGE("AddVirtualScreenBlackList: WriteUInt64Vector id err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::AddVirtualScreenBlackList: Send Request err."); + return ERR_INVALID_VALUE; + } + + repCode = reply.ReadInt32(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList( + ScreenId id, std::vector& blackListVector, int32_t& repCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteUint64 id err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUInt64Vector(blackListVector)) { + ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteUInt64Vector blackListVector err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList: Send Request err."); + return ERR_INVALID_VALUE; + } + + repCode = reply.ReadInt32(); + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList( + ScreenId id, + const std::vector& securityExemptionList) +{ + if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList: too many lists."); + return INVALID_ARGUMENTS; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUInt64Vector(securityExemptionList)) { + ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteUInt64Vector securityExemptionList err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList: Send Request err."); + return RS_CONNECTION_ERROR; + } + + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList Read status failed"); + return READ_PARCEL_ERR; + } + return status; +} + +int32_t RSRenderProcessConnectionProxy::SetScreenSecurityMask(ScreenId id, + std::shared_ptr securityMask) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenSecurityMask: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenSecurityMask: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + + if (securityMask) { + if (!data.WriteBool(true) || !data.WriteParcelable(securityMask.get())) { + ROSEN_LOGE("SetScreenSecurityMask: WriteBool[true] OR WriteParcelable[securityMask.get()] err."); + return WRITE_PARCEL_ERR; + } + } else { + if (!data.WriteBool(false)) { + ROSEN_LOGE("SetScreenSecurityMask: WriteBool [false] err."); + return WRITE_PARCEL_ERR; + } + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenSecurityMask: Send Request err."); + return RS_CONNECTION_ERROR; + } + return SUCCESS; +} + +int32_t RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect( + ScreenId id, const Rect& mainScreenRect, bool supportRotation) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteInt32(mainScreenRect.x) || !data.WriteInt32(mainScreenRect.y) || + !data.WriteInt32(mainScreenRect.w) || !data.WriteInt32(mainScreenRect.h)) { + ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteInt32 mainScreenRect err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteBool(supportRotation)) { + ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteBool supportRotation err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect: Send Request err."); + return RS_CONNECTION_ERROR; + } + + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect Read status failed"); + return READ_PARCEL_ERR; + } + return status; +} + +int32_t RSRenderProcessConnectionProxy::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteUint64 MessageOption::TF_ASYNC err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteBool(enable)) { + ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteBool enable err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCastScreenEnableSkipWindow: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} + +int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) +{ + if (surface == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); + return INVALID_ARGUMENTS; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenSurface: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenSurface: WriteUint64 MessageOption::TF_ASYNC err."); + return WRITE_PARCEL_ERR; + } + auto producer = surface->GetProducer(); + if (!data.WriteRemoteObject(producer->AsObject())) { + ROSEN_LOGE("SetVirtualScreenSurface: WriteRemoteObject producer->AsObject() err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSurface: Send Request err."); + return RS_CONNECTION_ERROR; + } + + int32_t status = reply.ReadInt32(); + return status; +} + +void RSRenderProcessConnectionProxy::RemoveVirtualScreen(ScreenId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RemoveVirtualScreen: WriteInterfaceToken GetDescriptor err."); + return; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RemoveVirtualScreen: WriteUint64 id err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RemoveVirtualScreen: Send Request err."); + return; + } +} + +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR +int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionConfig(float darkBuffer, + float brightBuffer, int64_t interval, int32_t rangeSize) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetPointerColorInversionConfig: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteFloat(darkBuffer)) { + ROSEN_LOGE("SetPointerColorInversionConfig: WriteFloat darkBuffer err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteFloat(brightBuffer)) { + ROSEN_LOGE("SetPointerColorInversionConfig: WriteFloat brightBuffer err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteInt64(interval)) { + ROSEN_LOGE("SetPointerColorInversionConfig: WriteInt64 interval err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteInt32(rangeSize)) { + ROSEN_LOGE("SetPointerColorInversionConfig: WriteInt32 rangeSize err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPointerColorInversionConfig: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} + +int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionEnabled(bool enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetPointerColorInversionEnabled: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteBool(enable)) { + ROSEN_LOGE("SetPointerColorInversionEnabled: WriteBool enable err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::DisableCursorInvert: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback( + sptr callback) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback: callback is nullptr."); + return INVALID_ARGUMENTS; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterPointerLuminanceChangeCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} + +int32_t RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("UnRegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} +#endif + +void RSRenderProcessConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); + return; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenActiveMode: WriteUint64 id err."); + return; + } + if (!data.WriteUint32(modeId)) { + ROSEN_LOGE("SetScreenActiveMode: WriteUint32 modeId err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return; + } +} + +void RSRenderProcessConnectionProxy::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, + int32_t animatorExpectedFrameRate) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SyncFrameRateRange: WriteInterfaceToken GetDescriptor err."); + return; + } + + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SyncFrameRateRange: WriteUint64 id err."); + return; + } + if (!data.WriteUint32(range.min_) || !data.WriteUint32(range.max_) || + !data.WriteUint32(range.preferred_) || !data.WriteUint32(range.type_) || + !data.WriteUint32(range.componentScene_)) { + ROSEN_LOGE("SyncFrameRateRange: WriteUint32 range err."); + return; + } + if (!data.WriteInt32(animatorExpectedFrameRate)) { + ROSEN_LOGE("SyncFrameRateRange: WriteInt32 animatorExpectedFrameRate err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + return; + } +} +void RSRenderProcessConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("UnregisterFrameRateLinker: WriteInterfaceToken GetDescriptor err."); + return; + } + + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("UnregisterFrameRateLinker: WriteUint64 id err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetRefreshInfo: WriteInterfaceToken GetDescriptor err."); + enable = ""; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("GetRefreshInfo: WriteInt32 pid err."); + enable = ""; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + enable = ""; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadString(enable)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetRefreshInfo Read enable failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetRefreshInfoToSP: WriteInterfaceToken GetDescriptor err."); + enable = ""; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetRefreshInfoToSP: WriteUint64 id err."); + enable = ""; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + enable = ""; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadString(enable)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetRefreshInfo Read enable failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_SYNC); + if (!data.WriteInterfaceToken(GetDescriptor())) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(width)) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 width err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(height)) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 height err."); + return WRITE_PARCEL_ERR; + } + auto code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION); + if (SendRequest(code, data, reply, option) != ERR_NONE) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); + return RS_CONNECTION_ERROR; + } + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPhysicalScreenResolution Read status failed"); + return READ_PARCEL_ERR; + } + return status; +} + +int32_t RSRenderProcessConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(width)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 width err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(height)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 height err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenResolution: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenResolution Read status failed"); + return READ_PARCEL_ERR; + } + return status; +} + +ErrCode RSRenderProcessConnectionProxy::MarkPowerOffNeedProcessOneFrame() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::MarkPowerOffNeedProcessOneFrame: Send Request err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME); + int32_t err = SendRequest(code, data, reply, option); + return err != NO_ERROR ? ERR_INVALID_VALUE : ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::RepaintEverything() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RepaintEverything: Send Request err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::ForceRefreshOneFrameWithNextVSync() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ForceRefreshOneFrameWithNextVSync: Send Request err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::DisablePowerOffRenderControl(ScreenId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("DisablePowerOffRenderControl: WriteInterfaceToken GetDescriptor err."); + return; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("DisablePowerOffRenderControl: WriteUint64 id err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) +{ + if (app == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return ERR_INVALID_VALUE; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteRemoteObject(app->AsObject())) { + ROSEN_LOGE("%{public}s WriteRemoteObject failed", __func__); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::TakeSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, + const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions /* permissions */) +{ + if (callback == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("%{public}s write id failed", __func__); + return; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("%{public}s write callback failed", __func__); + return; + } + if (!WriteSurfaceCaptureConfig(captureConfig, data)) { + ROSEN_LOGE("%{public}s write captureConfig failed", __func__); + return; + } + if (!WriteSurfaceCaptureBlurParam(blurParam, data)) { + ROSEN_LOGE("%{public}s write blurParam failed", __func__); + return; + } + if (!WriteSurfaceCaptureAreaRect(specifiedAreaRect, data)) { + ROSEN_LOGE("%{public}s write specifiedAreaRect failed", __func__); + return; + } + + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return; + } +} + +std::vector>> RSRenderProcessConnectionProxy::TakeSurfaceCaptureSoloNode( + NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + std::vector>> pixelMapIdPairVector; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("%{public}s write id failed", __func__); + return pixelMapIdPairVector; + } + if (!WriteSurfaceCaptureConfig(captureConfig, data)) { + ROSEN_LOGE("%{public}s write captureConfig failed", __func__); + return pixelMapIdPairVector; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE_SOLO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return pixelMapIdPairVector; + } + if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapIdPairVector)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::TakeSurfaceCaptureSoloNode Unmarshalling failed"); + } + return pixelMapIdPairVector; +} + +void RSRenderProcessConnectionProxy::TakeSelfSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig) +{ + if (callback == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("%{public}s write id failed", __func__); + return; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("%{public}s write callback failed", __func__); + return; + } + if (!WriteSurfaceCaptureConfig(captureConfig, data)) { + ROSEN_LOGE("%{public}s write captureConfig failed", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SELF_SURFACE_CAPTURE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::SetWindowFreezeImmediately(NodeId id, bool isFreeze, + sptr callback, const RSSurfaceCaptureConfig& captureConfig, + const RSSurfaceCaptureBlurParam& blurParam) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("%{public}s write id failed", __func__); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isFreeze)) { + ROSEN_LOGE("%{public}s write isFreeze failed", __func__); + return ERR_INVALID_VALUE; + } + if (isFreeze) { + if (callback == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("%{public}s write callback failed", __func__); + return ERR_INVALID_VALUE; + } + if (!WriteSurfaceCaptureConfig(captureConfig, data)) { + ROSEN_LOGE("%{public}s write captureConfig failed", __func__); + return ERR_INVALID_VALUE; + } + if (!WriteSurfaceCaptureBlurParam(blurParam, data)) { + ROSEN_LOGE("%{public}s write blurParam failed", __func__); + return ERR_INVALID_VALUE; + } + } + + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_FREEZE_IMMEDIATELY); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::TakeUICaptureInRange( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) +{ + if (callback == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("%{public}s write id failed", __func__); + return; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("%{public}s write callback failed", __func__); + return; + } + if (!WriteSurfaceCaptureConfig(captureConfig, data)) { + ROSEN_LOGE("%{public}s write captureConfig failed", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_UI_CAPTURE_IN_RANGE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return; + } +} + +bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureConfig( + const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) +{ + if (!data.WriteFloat(captureConfig.scaleX) || !data.WriteFloat(captureConfig.scaleY) || + !data.WriteBool(captureConfig.useDma) || !data.WriteBool(captureConfig.useCurWindow) || + !data.WriteUint8(static_cast(captureConfig.captureType)) || !data.WriteBool(captureConfig.isSync) || + !data.WriteBool(captureConfig.isHdrCapture) || + !data.WriteFloat(captureConfig.mainScreenRect.left_) || + !data.WriteFloat(captureConfig.mainScreenRect.top_) || + !data.WriteFloat(captureConfig.mainScreenRect.right_) || + !data.WriteFloat(captureConfig.mainScreenRect.bottom_) || + !data.WriteUint64(captureConfig.uiCaptureInRangeParam.endNodeId) || + !data.WriteBool(captureConfig.uiCaptureInRangeParam.useBeginNodeSize) || + !data.WriteFloat(captureConfig.specifiedAreaRect.left_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.top_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.right_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.bottom_) || + !data.WriteUInt64Vector(captureConfig.blackList) || + !data.WriteUint32(captureConfig.backGroundColor)) { + ROSEN_LOGE("WriteSurfaceCaptureConfig: WriteSurfaceCaptureConfig captureConfig err."); + return false; + } + return true; +} + +bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureBlurParam( + const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) +{ + if (!data.WriteBool(blurParam.isNeedBlur) || !data.WriteFloat(blurParam.blurRadius)) { + ROSEN_LOGE("WriteSurfaceCaptureBlurParam: WriteBool OR WriteFloat [blurParam] err."); + return false; + } + return true; +} + +bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureAreaRect( + const Drawing::Rect& specifiedAreaRect, MessageParcel& data) +{ + if (!data.WriteFloat(specifiedAreaRect.left_) || !data.WriteFloat(specifiedAreaRect.top_) || + !data.WriteFloat(specifiedAreaRect.right_) || !data.WriteFloat(specifiedAreaRect.bottom_)) { + ROSEN_LOGE("WriteSurfaceCaptureAreaRect: WriteFloat specifiedAreaRect err."); + return false; + } + return true; +} + +ErrCode RSRenderProcessConnectionProxy::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, + float positionZ, float positionW) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(rsNodeId)) { + ROSEN_LOGE("SetHwcNodeBounds write id failed"); + return ERR_INVALID_VALUE; + } + if (!data.WriteFloat(positionX) || !data.WriteFloat(positionY) || !data.WriteFloat(positionZ) || + !data.WriteFloat(positionW)) { + ROSEN_LOGE("SetHwcNodeBounds write bound failed"); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_POSITION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("SetHwcNodeBounds SendRequest() error[%{public}d]", err); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +RSVirtualScreenResolution RSRenderProcessConnectionProxy::GetVirtualScreenResolution(ScreenId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + RSVirtualScreenResolution virtualScreenResolution; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); + return virtualScreenResolution; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetVirtualScreenResolution: WriteUint64 id err."); + return virtualScreenResolution; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return virtualScreenResolution; + } + + sptr pVirtualScreenResolution(reply.ReadParcelable()); + if (pVirtualScreenResolution == nullptr) { + return virtualScreenResolution; + } + virtualScreenResolution = *pVirtualScreenResolution; + return virtualScreenResolution; +} + +ErrCode RSRenderProcessConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenActiveMode: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s: sendrequest error : %{public}d", __func__, err); + return ERR_INVALID_VALUE; + } + + sptr pScreenModeInfo(reply.ReadParcelable()); + if (pScreenModeInfo == nullptr) { + ROSEN_LOGE("%{public}s: ScreenModeInfo is null", __func__); + return ERR_INVALID_VALUE; + } + screenModeInfo = *pScreenModeInfo; + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetMemoryGraphics: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + + uint64_t count{0}; + if (!reply.ReadUint64(count)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetMemoryGraphics Read count failed"); + return ERR_INVALID_VALUE; + } + size_t readableSize = reply.GetReadableBytes(); + size_t len = static_cast(count); + if (len > readableSize || len > memoryGraphics.max_size()) { + RS_LOGE("RSRenderProcessConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," + " readableSize:%{public}zu", len, readableSize); + return ERR_INVALID_VALUE; + } + memoryGraphics.resize(count); + for (uint64_t index = 0; index < count; index++) { + sptr item = reply.ReadParcelable(); + if (item == nullptr) { + continue; + } else { + memoryGraphics[index] = *item; + } + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + MemoryGraphic memoryGraphic; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetTotalAppMemSize: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + + if (!reply.ReadFloat(cpuMemSize) || !reply.ReadFloat(gpuMemSize)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetTotalAppMemSize Read MemSize failed"); + return READ_PARCEL_ERR; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetMemoryGraphic: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("GetMemoryGraphic: WriteInt32 pid err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + sptr pMemoryGraphic(reply.ReadParcelable()); + if (pMemoryGraphic == nullptr) { + return ERR_INVALID_VALUE; + } + memoryGraphic = *pMemoryGraphic; + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::RegisterBufferClearListener( + NodeId id, sptr callback) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferClearListener: callback is nullptr."); + return ERR_INVALID_VALUE; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterBufferClearListener: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RegisterBufferClearListener: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterBufferClearListener: WriteRemoteObject callback->AsObject() err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferClearListener: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); + return ERR_INVALID_VALUE; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteRemoteObject callback->AsObject() err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isFromRenderThread)) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteBool isFromRenderThread err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferAvailableListener: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenHDRCapability: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenHDRCapability: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRCapability Read result failed"); + return READ_PARCEL_ERR; + } + if (result != SUCCESS) { + return result; + } + sptr pScreenCapability = reply.ReadParcelable(); + if (pScreenCapability == nullptr) { + return RS_CONNECTION_ERROR; + } + screenHdrCapability = *pScreenCapability; + return SUCCESS; +} + +ErrCode RSRenderProcessConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetPixelFormat: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelFormat Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + uint32_t readFormat{0}; + if (!reply.ReadUint32(readFormat)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelFormat Read readFormat failed"); + return READ_PARCEL_ERR; + } + pixelFormat = static_cast(readFormat); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetPixelFormat: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(static_cast(pixelFormat))) { + ROSEN_LOGE("GetPixelFormat: WriteUint32 pixelFormat err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + resCode = reply.ReadInt32(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats( + ScreenId id, std::vector& hdrFormats, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenSupportedHDRFormats: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenSupportedHDRFormats: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + hdrFormats.clear(); + std::vector hdrFormatsRecv; + reply.ReadUInt32Vector(&hdrFormatsRecv); + std::transform(hdrFormatsRecv.begin(), hdrFormatsRecv.end(), back_inserter(hdrFormats), + [](uint32_t i) -> ScreenHDRFormat {return static_cast(i);}); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenHDRFormat: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRFormat Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + uint32_t readFormat{0}; + if (!reply.ReadUint32(readFormat)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRFormat1 Read readFormat failed"); + return READ_PARCEL_ERR; + } + hdrFormat = static_cast(readFormat); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenHDRFormat: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32(modeIdx)) { + ROSEN_LOGE("SetScreenHDRFormat: WriteInt32 modeIdx err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + resCode = reply.ReadInt32(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); + return RS_CONNECTION_ERROR; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + uint32_t readHdrStatus{0}; + if (!reply.ReadUint32(readHdrStatus)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus Read HDR status failed"); + return READ_PARCEL_ERR; + } + hdrStatus = static_cast(readHdrStatus); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + colorSpaces.clear(); + std::vector colorSpacesRecv; + reply.ReadUInt32Vector(&colorSpacesRecv); + std::transform(colorSpacesRecv.begin(), colorSpacesRecv.end(), back_inserter(colorSpaces), + [](uint32_t i) -> GraphicCM_ColorSpaceType {return static_cast(i);}); + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetBitmap: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetBitmap: WriteUint64 id err."); + success = false; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBitmap Read result failed"); + return READ_PARCEL_ERR; + } + if (!result || !RSMarshallingHelper::Unmarshalling(reply, bitmap)) { + RS_LOGE("RSRenderProcessConnectionProxy::GetBitmap: Unmarshalling failed"); + success = false; + return ERR_INVALID_VALUE; + } + success = true; + return ERR_OK; +} + +bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteInterfaceToken GetDescriptor err."); + return false; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteUint64 id err."); + return false; + } + if (!data.WriteBool(canvasRotation)) { + ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteBool canvasRotation err."); + return false; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return false; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualMirrorScreenCanvasRotation Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteBool(isAutoRotation)) { + ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteBool isAutoRotation err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::%{public}s: Send Request err.", __func__); + return RS_CONNECTION_ERROR; + } + int32_t result{-1}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::%{public}s Read result failed", __func__); + return READ_PARCEL_ERR; + } + return result; +} + +bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteInterfaceToken GetDescriptor err."); + return false; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteUint64 id err."); + return false; + } + if (!data.WriteUint32(static_cast(scaleMode))) { + ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteUint32 scaleMode err."); + return false; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return false; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualMirrorScreenScaleMode Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +ErrCode RSRenderProcessConnectionProxy::SetGlobalDarkColorMode(bool isDark) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetGlobalDarkColorMode: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteBool(isDark)) { + ROSEN_LOGE("SetGlobalDarkColorMode: WriteBool isDark err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetPixelmap: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetPixelmap: WriteUint64 id err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteParcelable(pixelmap.get())) { + ROSEN_LOGE("GetPixelmap: WriteParcelable pixelmap.get() err."); + success = false; + return ERR_INVALID_VALUE; + } + RSMarshallingHelper::Marshalling(data, *rect); + RSMarshallingHelper::Marshalling(data, drawCmdList); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelmap Read result failed"); + return READ_PARCEL_ERR; + } + if (!result || !RSMarshallingHelper::Unmarshalling(reply, pixelmap)) { + RS_LOGD("RSRenderProcessConnectionProxy::GetPixelmap: GetPixelmap failed"); + success = false; + return ERR_INVALID_VALUE; + } + success = true; + return ERR_OK; +} + +bool RSRenderProcessConnectionProxy::RegisterTypeface(uint64_t globalUniqueId, + std::shared_ptr& typeface) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterTypeface: WriteInterfaceToken GetDescriptor err."); + return false; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t hash = typeface->GetHash(); + if (!data.WriteUint64(globalUniqueId)) { + ROSEN_LOGE("RegisterTypeface: WriteUint64 globalUniqueId err."); + return false; + } + if (!data.WriteUint32(hash)) { + ROSEN_LOGE("RegisterTypeface: WriteUint32 hash err."); + return false; + } + + if (hash) { // if adapter does not provide hash, use old path + MessageParcel reply2; + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NEED_REGISTER_TYPEFACE); + int32_t err = SendRequest(code, data, reply2, option); + if (err != NO_ERROR) { + RS_LOGW("Check if RegisterTypeface is needed failed, err:%{public}d", err); + return false; + } + if (!reply2.ReadBool()) { + return true; // the hash exists on server, no need to resend full data + } + } + + RSMarshallingHelper::Marshalling(data, typeface); + + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + RS_LOGD("RSRenderProcessConnectionProxy::RegisterTypeface: RegisterTypeface failed"); + return false; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTypeface Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +bool RSRenderProcessConnectionProxy::UnRegisterTypeface(uint64_t globalUniqueId) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("UnRegisterTypeface: WriteInterfaceToken GetDescriptor err."); + return false; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(globalUniqueId)) { + ROSEN_LOGE("UnRegisterTypeface: WriteUint64 globalUniqueId err."); + return false; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + RS_LOGD("RSRenderProcessConnectionProxy::UnRegisterTypeface: send request failed"); + return false; + } + + return true; +} + +ErrCode RSRenderProcessConnectionProxy::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, + int32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenSkipFrameInterval: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenSkipFrameInterval: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(skipFrameInterval)) { + ROSEN_LOGE("SetScreenSkipFrameInterval: WriteUint32 skipFrameInterval err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + resCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPixelFormat Read result failed"); + resCode = READ_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate( + ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); + retVal = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteUint64 id err."); + retVal = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(maxRefreshRate)) { + ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteUint32 maxRefreshRate err."); + retVal = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + retVal = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate Read result failed"); + retVal = READ_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + if (result == SUCCESS) { + if (!reply.ReadUint32(actualRefreshRate)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate Read actualRefreshRate failed"); + retVal = READ_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + } + retVal = result; + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); + return; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id) || !data.WriteInt32(offSetX) || !data.WriteInt32(offSetY)) { + ROSEN_LOGE("%{public}s: write error.", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s: Send Request err.", __func__); + } +} + +void RSRenderProcessConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + + if (!data.WriteUint64(id) || !data.WriteInt32(gravity)) { + ROSEN_LOGE("%{public}s: write error.", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("%{public}s: Send Request err.", __func__); + } +} + +ErrCode RSRenderProcessConnectionProxy::RegisterOcclusionChangeCallback( + sptr callback, int32_t& repCode) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterOcclusionChangeCallback: callback is nullptr."); + repCode = INVALID_ARGUMENTS; + return ERR_INVALID_VALUE; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); + repCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterOcclusionChangeCallback: WriteRemoteObject callback->AsObject() err."); + repCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + repCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + repCode = reply.ReadInt32(); + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::RegisterSurfaceOcclusionChangeCallback( + NodeId id, sptr callback, std::vector& partitionPoints) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceOcclusionChangeCallback: callback is nullptr."); + return INVALID_ARGUMENTS; + } + + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteFloatVector(partitionPoints)) { + ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteFloatVector partitionPoints err."); + return WRITE_PARCEL_ERR; + } + + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenHDRFormat Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("UnRegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("UnRegisterSurfaceOcclusionChangeCallback: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenColorSpace Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback(sptr callback) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterHgmConfigChangeCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterHgmConfigChangeCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback( + sptr callback) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterHgmRefreshRateModeChangeCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterHgmRefreshRateModeChangeCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateUpdateCallback( + sptr callback) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (callback) { + if (!data.WriteBool(true)) { + ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteBool [true] err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + } else { + if (!data.WriteBool(false)) { + ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteBool [false] err."); + return WRITE_PARCEL_ERR; + } + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterFirstFrameCommitCallback( + sptr callback) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (callback) { + if (!data.WriteBool(true)) { + ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteBool [true] err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; + } + } else { + if (!data.WriteBool(false)) { + ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteBool [false] err."); + return WRITE_PARCEL_ERR; + } + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterFirstFrameCommitCallback: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + return result; +} + +ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStart( + uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("AvcodecVideoStart: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(uniqueId)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint64 uniqueId err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString(surfaceName)) { + ROSEN_LOGE("AvcodecVideoStart: WriteString surfaceName err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(fps)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint32 fps err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(reportTime)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint64 reportTime err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStart: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStart Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("AvcodecVideoStop: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(uniqueId)) { + ROSEN_LOGE("AvcodecVideoStop: WriteUint64 uniqueId err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString(surfaceName)) { + ROSEN_LOGE("AvcodecVideoStop: WriteString surfaceName err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(fps)) { + ROSEN_LOGE("AvcodecVideoStop: WriteUint32 fps err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStop: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStop Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +int32_t RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, + sptr callback) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteInt32(dstPid)) { + ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteInt32 dstPid err."); + return WRITE_PARCEL_ERR; + } + if (callback) { + if (!data.WriteBool(true) || !data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteBool[T] OR WriteRemoteObject[CB] err"); + return WRITE_PARCEL_ERR; + } + } else { + if (!data.WriteBool(false)) { + ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteBool [false] err."); + return WRITE_PARCEL_ERR; + } + } + + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback: " + "Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE( + "RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback Read result failed"); + return READ_PARCEL_ERR; + } + return result; +} + +ErrCode RSRenderProcessConnectionProxy::SetAppWindowNum(uint32_t num) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetAppWindowNum: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint32(num)) { + ROSEN_LOGE("SetAppWindowNum: WriteUint32 num err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetAppWindowNum: Send Request err."); + return ERR_INVALID_VALUE; + } + + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetSystemAnimatedScenes( + SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetSystemAnimatedScenes: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint32(static_cast(systemAnimatedScenes))) { + ROSEN_LOGE("SetSystemAnimatedScenes: WriteUint32 systemAnimatedScenes err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isRegularAnimation)) { + ROSEN_LOGE("SetSystemAnimatedScenes: WriteBool isRegularAnimation err."); + success = false; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + if (!reply.ReadBool(success)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetSystemAnimatedScenes Read result failed"); + success = READ_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetWatermark(const std::string& name, + std::shared_ptr watermark, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetWatermark: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteString(name)) { + ROSEN_LOGE("SetWatermark: WriteString name err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteParcelable(watermark.get())) { + ROSEN_LOGE("SetWatermark: WriteParcelable watermark.get() err."); + success = false; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWatermark: Send Request err."); + success = false; + return ERR_INVALID_VALUE; + } + success = true; + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) +{ + if (watermarkImg == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ShowWatermark: watermarkImg is nullptr."); + return; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ShowWatermark: WriteInterfaceToken GetDescriptor err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteParcelable(watermarkImg.get())) { + ROSEN_LOGE("ShowWatermark: WriteParcelable watermarkImg.get() err."); + return; + } + if (!data.WriteBool(isShow)) { + ROSEN_LOGE("ShowWatermark: WriteBool isShow err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ShowWatermark: Send Request err."); + return; + } +} + +int32_t RSRenderProcessConnectionProxy::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ResizeVirtualScreen: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("ResizeVirtualScreen: WriteUint64 id err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(width)) { + ROSEN_LOGE("ResizeVirtualScreen: WriteUint32 width err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(height)) { + ROSEN_LOGE("ResizeVirtualScreen: WriteUint32 height err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ResizeVirtualScreen: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ResizeVirtualScreen Read status failed"); + return READ_PARCEL_ERR; + } + return status; +} + +ErrCode RSRenderProcessConnectionProxy::ReportJankStats() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportJankStats: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportJankStats: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::ReportEventResponse(DataBaseRs info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportEventResponse: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + ReportDataBaseRs(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventResponse: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::ReportEventComplete(DataBaseRs info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportEventComplete: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + ReportDataBaseRs(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventComplete: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::ReportEventJankFrame(DataBaseRs info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportEventJankFrame: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + ReportDataBaseRs(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventJankFrame: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::ReportRsSceneJankStart(AppInfo info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportRsSceneJankStart: WriteInterfaceToken GetDescriptor err."); + return; + } + WriteAppInfo(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportRsSceneJankStart: Send Request err."); + return; + } +} + +void RSRenderProcessConnectionProxy::ReportRsSceneJankEnd(AppInfo info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportRsSceneJankEnd: WriteInterfaceToken GetDescriptor err."); + return; + } + WriteAppInfo(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportRsSceneJankEnd: Send Request err."); + return; + } +} + +void RSRenderProcessConnectionProxy::ReportDataBaseRs( + MessageParcel& data, MessageParcel& reply, MessageOption& option, DataBaseRs info) +{ + if (!data.WriteInt32(info.appPid)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.appPid err."); + return; + } + if (!data.WriteInt32(info.eventType)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.eventType err."); + return; + } + if (!data.WriteInt32(info.versionCode)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.versionCode err."); + return; + } + if (!data.WriteInt64(info.uniqueId)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.uniqueId err."); + return; + } + if (!data.WriteInt64(info.inputTime)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.inputTime err."); + return; + } + if (!data.WriteInt64(info.beginVsyncTime) || !data.WriteInt64(info.endVsyncTime)) { + ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.beginVsyncTime OR info.endVsyncTime err."); + return; + } + if (!data.WriteBool(info.isDisplayAnimator)) { + ROSEN_LOGE("ReportDataBaseRs: WriteBool info.isDisplayAnimator err."); + return; + } + if (!data.WriteString(info.sceneId)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.sceneId err."); + return; + } + if (!data.WriteString(info.versionName)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.versionName err."); + return; + } + if (!data.WriteString(info.bundleName)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.bundleName err."); + return; + } + if (!data.WriteString(info.processName)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.processName err."); + return; + } + if (!data.WriteString(info.abilityName)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.abilityName err."); + return; + } + if (!data.WriteString(info.pageUrl)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.pageUrl err."); + return; + } + if (!data.WriteString(info.sourceType)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.sourceType err."); + return; + } + if (!data.WriteString(info.note)) { + ROSEN_LOGE("ReportDataBaseRs: WriteString info.note err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); +} + +void RSRenderProcessConnectionProxy::WriteAppInfo( + MessageParcel& data, MessageParcel& reply, MessageOption& option, AppInfo info) +{ + if (!data.WriteInt64(info.startTime)) { + ROSEN_LOGE("WriteAppInfo: WriteInt64 info.startTime err."); + return; + } + if (!data.WriteInt64(info.endTime)) { + ROSEN_LOGE("WriteAppInfo: WriteInt64 info.endTime err."); + return; + } + if (!data.WriteInt32(info.pid)) { + ROSEN_LOGE("WriteAppInfo: WriteInt32 info.pid err."); + return; + } + if (!data.WriteString(info.versionName)) { + ROSEN_LOGE("WriteAppInfo: WriteString info.versionName err."); + return; + } + if (!data.WriteInt32(info.versionCode)) { + ROSEN_LOGE("WriteAppInfo: WriteInt32 info.versionCode err."); + return; + } + if (!data.WriteString(info.bundleName)) { + ROSEN_LOGE("WriteAppInfo: WriteString info.bundleName err."); + return; + } + if (!data.WriteString(info.processName)) { + ROSEN_LOGE("WriteAppInfo: WriteString info.processName err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); +} + +void RSRenderProcessConnectionProxy::ReportGameStateDataRs( + MessageParcel& data, MessageParcel& reply, MessageOption& option, GameStateData info) +{ + if (!data.WriteInt32(info.pid)) { + ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.pid err."); + return; + } + if (!data.WriteInt32(info.uid)) { + ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.uid err."); + return; + } + if (!data.WriteInt32(info.state)) { + ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.state err."); + return; + } + if (!data.WriteInt32(info.renderTid)) { + ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.renderTid err."); + return; + } + if (!data.WriteString(info.bundleName)) { + ROSEN_LOGE("ReportGameStateDataRs: WriteString info.bundleName err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); +} + +ErrCode RSRenderProcessConnectionProxy::ReportGameStateData(GameStateData info) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("ReportGameStateData: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + ReportGameStateDataRs(data, reply, option, info); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportGameStateData: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, + SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetHardwareEnabled: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetHardwareEnabled: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isEnabled)) { + ROSEN_LOGE("SetHardwareEnabled: WriteBool isEnabled err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint8(static_cast(selfDrawingType))) { + ROSEN_LOGE("SetHardwareEnabled: WriteUint8 selfDrawingType err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(dynamicHardwareEnable)) { + ROSEN_LOGE("SetHardwareEnabled: WriteBool dynamicHardwareEnable err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetHardwareEnabled: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetHidePrivacyContent: WriteInterfaceToken GetDescriptor err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetHidePrivacyContent: WriteUint64 id err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(needHidePrivacyContent)) { + ROSEN_LOGE("SetHidePrivacyContent: WriteBool needHidePrivacyContent err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetHidePrivacyContent: Send Request err."); + resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); + return ERR_INVALID_VALUE; + } + resCode = reply.ReadUint32(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::NotifyLightFactorStatus(int32_t lightFactorStatus) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifyLightFactorStatus: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32(lightFactorStatus)) { + ROSEN_LOGE("NotifyLightFactorStatus: WriteInt32 lightFactorStatus err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyLightFactorStatus: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifyPackageEvent: WriteInterfaceToken GetDescriptor err."); + return; + } + if (listSize != packageList.size()) { + ROSEN_LOGE("input size doesn't match"); + return; + } + if (!data.WriteUint32(listSize)) { + ROSEN_LOGE("NotifyPackageEvent: WriteUint32 listSize err."); + return; + } + for (auto pkg : packageList) { + if (!data.WriteString(pkg)) { + ROSEN_LOGE("NotifyPackageEvent: WriteString pkg err."); + return; + } + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyPackageEvent: Send Request err."); + return; + } +} + +void RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, + const std::vector>& newConfig) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + return; + } + + if (listSize != newConfig.size()) { + ROSEN_LOGE("input size doesn't match"); + return; + } + + if (!data.WriteString(pkgName) || !data.WriteUint32(listSize)) { + ROSEN_LOGE( + "RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent Write pakName or listSize failed."); + return; + } + + for (const auto& [key, value] : newConfig) { + if (!data.WriteString(key) || !data.WriteString(value)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent Write key or value failed."); + return; + } + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent: Send Request err."); + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifySoftVsyncEvent: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(pid)) { + ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 pid err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(rateDiscount)) { + ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 rateDiscount err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncEvent: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +bool RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, + uint32_t rateDiscount) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteInterfaceToken GetDescriptor err."); + return false; + } + if (!data.WriteUint32(pid)) { + ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteUint32 pid err."); + return false; + } + if (!data.WriteString(name)) { + ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteString rateDiscount err."); + return false; + } + if (!data.WriteUint32(rateDiscount)) { + ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteUint32 rateDiscount err."); + return false; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent: Send Request err."); + return false; + } + bool enable{false}; + if (!reply.ReadBool(enable)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent: Read enable failed"); + return false; + } + return enable; +} + +ErrCode RSRenderProcessConnectionProxy::NotifyHgmConfigEvent(const std::string &eventName, bool state) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifyHgmConfigEvent: GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString(eventName)) { + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(state)) { + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyHgmConfigEvent: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::NotifyXComponentExpectedFrameRate( + const std::string& id, int32_t expectedFrameRate) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("NotifyXComponentExpectedFrameRate: GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString(id)) { + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32(expectedFrameRate)) { + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetCacheEnabledForRotation(bool isEnabled) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetCacheEnabledForRotation: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isEnabled)) { + ROSEN_LOGE("SetCacheEnabledForRotation: WriteBool isEnabled err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCacheEnabledForRotation: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) +{ + OnRemoteDiedCallback_ = callback; +} + +void RSRenderProcessConnectionProxy::RunOnRemoteDiedCallback() +{ + if (OnRemoteDiedCallback_) { + OnRemoteDiedCallback_(); + } +} + +std::vector RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + std::vector activeDirtyRegionInfos; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetActiveDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); + return activeDirtyRegionInfos; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo: Send Request err."); + return activeDirtyRegionInfos; + } + int32_t activeDirtyRegionInfosSize{0}; + if (!reply.ReadInt32(activeDirtyRegionInfosSize)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo Read activeDirtyRegionInfosSize failed"); + return activeDirtyRegionInfos; + } + while (activeDirtyRegionInfosSize--) { + int64_t activeDirtyRegionArea{0}; + int32_t activeFramesNumber{0}; + int32_t pidOfBelongsApp{0}; + std::string windowName; + if (!reply.ReadInt64(activeDirtyRegionArea) || !reply.ReadInt32(activeFramesNumber) || + !reply.ReadInt32(pidOfBelongsApp) || !reply.ReadString(windowName)) { + ROSEN_LOGE( + "RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo Read parcel failed"); + return activeDirtyRegionInfos; + } + activeDirtyRegionInfos.emplace_back( + ActiveDirtyRegionInfo(activeDirtyRegionArea, activeFramesNumber, pidOfBelongsApp, windowName)); + } + return activeDirtyRegionInfos; +} + +GlobalDirtyRegionInfo RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + GlobalDirtyRegionInfo globalDirtyRegionInfo; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetGlobalDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); + return globalDirtyRegionInfo; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo: Send Request err."); + return globalDirtyRegionInfo; + } + int64_t globalDirtyRegionAreas{0}; + int32_t globalFramesNumber{0}; + int32_t skipProcessFramesNumber{0}; + int32_t mostSendingPidWhenDisplayNodeSkip{0}; + if (!reply.ReadInt64(globalDirtyRegionAreas) || !reply.ReadInt32(globalFramesNumber) || + !reply.ReadInt32(skipProcessFramesNumber) || !reply.ReadInt32(mostSendingPidWhenDisplayNodeSkip)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo Read parcel failed"); + return globalDirtyRegionInfo; + } + return GlobalDirtyRegionInfo( + globalDirtyRegionAreas, globalFramesNumber, skipProcessFramesNumber, mostSendingPidWhenDisplayNodeSkip); +} + +ErrCode RSRenderProcessConnectionProxy::GetHdrOnDuration(int64_t& hdrOnDuration) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("GetHdrOnDuration: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HDR_ON_DURATION); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + hdrOnDuration = reply.ReadInt64(); + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetVmaCacheStatus(bool flag) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVmaCacheStatus: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(flag)) { + ROSEN_LOGE("SetVmaCacheStatus: WriteBool flag err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVmaCacheStatus %d: Send Request err.", flag); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +#ifdef TP_FEATURE_ENABLE +EErrCode RSRenderProcessConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, + TpFeatureConfigType tpFeatureConfigType) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetTpFeatureConfig: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + + if (!data.WriteInt32(feature)) { + ROSEN_LOGE("SetTpFeatureConfig: WriteInt32 feature err."); + return ERR_INVALID_VALUE; + } + + if (!data.WriteCString(config)) { + ROSEN_LOGE("SetTpFeatureConfig: WriteCString config err."); + return ERR_INVALID_VALUE; + } + + if (!data.WriteUint8(static_cast(tpFeatureConfigType))) { + ROSEN_LOGE("SetTpFeatureConfig: WriteUint8 tpFeatureConfigType err."); + return ERR_INVALID_VALUE; + } + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return ERR_INVALID_VALUE; + } + return ERR_OK; +} +#endif + +void RSRenderProcessConnectionProxy::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); + return; + } + if (!data.WriteBool(isVirtualScreenUsingStatus)) { + ROSEN_LOGE("SetVirtualScreenUsingStatus: WriteBool isVirtualScreenUsingStatus err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenUsingStatus: Send Request err."); + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetCurtainScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isCurtainScreenOn)) { + ROSEN_LOGE("SetCurtainScreenUsingStatus: WriteBool isCurtainScreenOn err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCurtainScreenUsingStatus: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::DropFrameByPid(const std::vector pidList) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("DropFrameByPid: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteInt32Vector(pidList)) { + ROSEN_LOGE("DropFrameByPid: WriteInt32Vector pidList err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::DropFrameByPid: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::RegisterUIExtensionCallback( + uint64_t userId, sptr callback, bool unobscured) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterUIExtensionCallback: callback is nullptr."); + return INVALID_ARGUMENTS; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RegisterUIExtensionCallback: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (data.WriteUint64(userId) && data.WriteRemoteObject(callback->AsObject()) && data.WriteBool(unobscured)) { + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterUIExtensionCallback Read result failed"); + return READ_PARCEL_ERR; + } + return result; + } else { + ROSEN_LOGE("RegisterUIExtensionCallback: WriteUint64[userId] OR WriteRemoteObject[callback] err."); + return RS_CONNECTION_ERROR; + } +} + +ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenStatus(ScreenId id, + VirtualScreenStatus screenStatus, bool& success) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetVirtualScreenStatus: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenStatus: WriteUint64 id err."); + success = false; + return ERR_INVALID_VALUE; + } + if (!data.WriteUint8(static_cast(screenStatus))) { + ROSEN_LOGE("SetVirtualScreenStatus: WriteUint8 screenStatus err."); + success = false; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + success = false; + return ERR_INVALID_VALUE; + } + if (!reply.ReadBool(success)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenStatus Read result failed"); + return READ_PARCEL_ERR; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetAncoForceDoDirect(bool direct, bool& res) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("SetAncoForceDoDirect: WriteInterfaceToken GetDescriptor err."); + res = false; + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (data.WriteBool(direct)) { + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + res = false; + return ERR_INVALID_VALUE; + } + res = reply.ReadBool(); + return ERR_OK; + } else { + ROSEN_LOGE("SetAncoForceDoDirect: WriteBool direct err."); + res = false; + return ERR_INVALID_VALUE; + } +} + +void RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus(bool enable) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: write token err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteBool(enable)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: write bool val err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: Send Request err."); + } +} +void RSRenderProcessConnectionProxy::RegisterTransactionDataCallback(uint64_t token, + uint64_t timeStamp, sptr callback) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback callback == nullptr."); + return; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write token err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); + if (!data.WriteUint64(token)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write multi token val err."); + return; + } + if (!data.WriteUint64(timeStamp)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write timeStamp val err."); + return; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write Callback val err."); + return; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK); + RS_LOGD("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: timeStamp: %{public}" + PRIu64 " token: %{public}" PRIu64, timeStamp, token); + int32_t err = Remote()->SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: Send Request err."); + return; + } +} + +ErrCode RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback( + pid_t pid, uint64_t uid, sptr callback) +{ + if (callback == nullptr) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback callback == nullptr"); + return ERR_INVALID_VALUE; + } + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write token err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write Int32 val err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(uid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write Uint64 val err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write RemoteObject val err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write token err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write Int32 val err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(uid)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write Uint64 val err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetForceRefresh: write token err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (data.WriteString(nodeIdStr) && data.WriteBool(isForceRefresh)) { + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetForceRefresh: Send Request err."); + return ERR_INVALID_VALUE; + } + } + return ERR_OK; +} + +void RSRenderProcessConnectionProxy::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetColorFollow: write token err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (data.WriteString(nodeIdStr) && data.WriteBool(isColorFollow)) { + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetColorFollow: Send Request err."); + return; + } + } +} + +ErrCode RSRenderProcessConnectionProxy::SetWindowContainer(NodeId nodeId, bool value) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write token err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(nodeId)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write Uint64 val err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(value)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write Bool val err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: Send Request err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +bool RSRenderProcessConnectionProxy::GetHighContrastTextState() +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HIGH_CONTRAST_TEXT_STATE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetHighContrastTextState: Send Request err."); + return false; + } + return reply.ReadBool(); +} + +int32_t RSRenderProcessConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + if (!Remote()) { + return static_cast(RSInterfaceErrorCode::NULLPTR_ERROR); + } + return Remote()->SendRequest(code, data, reply, option); +} + +ErrCode RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled(bool enabled) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled WriteInterfaceToken err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteBool(enabled)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled WriteBool err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled sendrequest error : %{public}d", err); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +ErrCode RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled(bool& enabled) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled WriteInterfaceToken err."); + return ERR_INVALID_VALUE; + } + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled sendrequest error : %{public}d", err); + return ERR_INVALID_VALUE; + } + if (!reply.ReadBool(enabled)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled ReadBool err."); + return ERR_INVALID_VALUE; + } + return ERR_OK; +} + +int32_t RSRenderProcessConnectionProxy::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + return RS_CONNECTION_ERROR; + } + + if (!data.WriteInt32(pid)) { + return WRITE_PARCEL_ERR; + } + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; + } + if (!reply.ReadFloat(gpuMemInMB)) { + return READ_PARCEL_ERR; + } + + return err; +} + +RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, + const std::string& fileName, int32_t flags, int& outFd) +{ + const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE); + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServiceOpenFile WriteInterfaceToken err."); + return RET_HRP_SERVICE_ERR_UNKNOWN; + } + option.SetFlags(MessageOption::TF_SYNC); + data.WriteUint32((uint32_t)dirInfo.baseDirType); + data.WriteString(dirInfo.subDir); + data.WriteString(dirInfo.subDir2); + data.WriteString(fileName); + data.WriteInt32(flags); + + int32_t err = SendRequest(code, data, reply, option); + if (err != ERR_NONE) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServiceOpenFile sendrequest error : %{public}d", err); + return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; + } + + int32_t retCode = RET_HRP_SERVICE_ERR_UNKNOWN; + if (!reply.ReadInt32(retCode)) { + return RET_HRP_SERVICE_ERR_PROXY_INVALID_RESULT; + } + + int retFd = reply.ReadFileDescriptor(); + if (retFd == -1) { + return retCode < 0 ? (RetCodeHrpService)retCode : RET_HRP_SERVICE_ERR_INVALID_FILE_DESCRIPTOR; + } + + outFd = retFd; + return (RetCodeHrpService)retCode; +} + +RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, + uint32_t firstFileIndex, std::vector& outFiles) +{ + const uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_POPULATE_FILES); + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles WriteInterfaceToken err."); + return RET_HRP_SERVICE_ERR_UNKNOWN; + } + option.SetFlags(MessageOption::TF_SYNC); + data.WriteUint32((uint32_t)dirInfo.baseDirType); + data.WriteString(dirInfo.subDir); + data.WriteString(dirInfo.subDir2); + data.WriteUint32(firstFileIndex); + + int32_t err = SendRequest(code, data, reply, option); + if (err != ERR_NONE) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles sendrequest error : %{public}d", err); + return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; + } + + int32_t retCode = RET_HRP_SERVICE_ERR_UNKNOWN; + if (!reply.ReadInt32(retCode)) { + return RET_HRP_SERVICE_ERR_PROXY_INVALID_RESULT; + } + if (retCode < RET_HRP_SERVICE_SUCCESS) { + return (RetCodeHrpService)retCode; + } + + uint32_t retCount = 0; + if (!reply.ReadUint32(retCount)) { + return RET_HRP_SERVICE_ERR_PROXY_INVALID_RESULT; + } + + std::vector retFiles; + for (uint32_t i = 0; i < retCount; i++) { + HrpServiceFileInfo fi {}; + if (!reply.ReadString(fi.name) || !reply.ReadUint32(fi.size) || !reply.ReadBool(fi.isDir) || + !reply.ReadUint32(fi.accessBits) || !reply.ReadUint64(fi.accessTime.sec) || + !reply.ReadUint64(fi.accessTime.nsec) || !reply.ReadUint64(fi.modifyTime.sec) || + !reply.ReadUint64(fi.modifyTime.nsec)) { + return RET_HRP_SERVICE_ERR_PROXY_INVALID_RESULT_DATA; + } + retFiles.emplace_back(fi); + } + outFiles.swap(retFiles); + return (RetCodeHrpService)retCode; +} + +bool RSRenderProcessConnectionProxy::ProfilerIsSecureScreen() +{ + const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN); + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen WriteInterfaceToken err."); + return false; + } + option.SetFlags(MessageOption::TF_SYNC); + int32_t err = SendRequest(code, data, reply, option); + if (err != ERR_NONE) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen sendrequest error : %{public}d", err); + return false; + } + + bool retValue = false; + if (!reply.ReadBool(retValue)) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen ReadBool err."); + return false; + } + return retValue; +} +void RSRenderProcessConnectionProxy::ClearUifirstCache(NodeId id) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ClearUifirstCache: write token err."); + return; + } + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("ClearUifirstCache: WriteUint64 id err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderProcessConnectionProxy::ClearUifirstCache sendrequest error : %{public}d", err); + return; + } +} } // namespace Rosen -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h index f0d1293b44..83ec8b9781 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -13,12 +13,15 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_PROXY_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_PROXY_H +#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H +#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H +#include "command/rs_node_showing_command.h" #include -#include -#include +#include +#include +#include +#include "sandbox_utils.h" namespace OHOS { namespace Rosen { @@ -27,13 +30,317 @@ public: explicit RSRenderProcessConnectionProxy(const sptr& impl); virtual ~RSRenderProcessConnectionProxy() noexcept = default; - sptr CreateRenderConnection(const sptr& token, pid_t remotePid) override { return nullptr; } + sptr CreateRenderConnection( + const sptr& token, pid_t remotePid) override + { + return nullptr; + } + ErrCode CommitTransaction(std::unique_ptr& transactionData) override; + ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) override; + + ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) override; + ErrCode GetMemoryGraphics(std::vector& memoryGraphics) override; + ErrCode GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) override; + + ErrCode GetUniRenderEnabled(bool& enable) override; + + ErrCode CreateNode(const RSSurfaceRenderNodeConfig& configg, bool& success) override; + ErrCode CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeIdg, bool& success) override; + ErrCode CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, + bool unobscured = false) override; + + ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, + int32_t& repCode) override; + + ErrCode CreatePixelMapFromSurface(sptr surface, const Rect &srcRect, + std::shared_ptr &pixelMap) override; + + ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode)override; + + int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) override; + + int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) override; + + ErrCode SetVirtualScreenTypeBlackList( + ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) override; + + ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; + + ErrCode RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; + + ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) override; + + int32_t SetVirtualScreenSecurityExemptionList( + ScreenId id, const std::vector& securityExemptionList) override; + + int32_t SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) override; + + int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false) override; + + int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override; + + void RemoveVirtualScreen(ScreenId id) override; + +#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR + int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, + int64_t interval, int32_t rangeSize) override; + + int32_t SetPointerColorInversionEnabled(bool enable) override; + + int32_t RegisterPointerLuminanceChangeCallback(sptr callback) override; + + int32_t UnRegisterPointerLuminanceChangeCallback() override; +#endif + + void SetScreenActiveMode(ScreenId id, uint32_t modeId) override; + + void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, + int32_t animatorExpectedFrameRate) override; + + void UnregisterFrameRateLinker(FrameRateLinkerId id) override; + + ErrCode GetRefreshInfo(pid_t pid, std::string& enable) override; + + ErrCode GetRefreshInfoToSP(NodeId id, std::string& enable) override; + + int32_t SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; + + int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; + + ErrCode MarkPowerOffNeedProcessOneFrame() override; + + ErrCode RepaintEverything() override; + + ErrCode ForceRefreshOneFrameWithNextVSync() override; + + void DisablePowerOffRenderControl(ScreenId id) override; + + ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) override; + + void TakeSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, + const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; + + std::vector>> + TakeSurfaceCaptureSoloNode(NodeId id, const RSSurfaceCaptureConfig& captureConfig, + RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; + + void TakeSelfSurfaceCapture(NodeId id, sptr callback, + const RSSurfaceCaptureConfig& captureConfig) override; + + ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, + const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) override; + + void TakeUICaptureInRange( + NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; + + bool WriteSurfaceCaptureConfig(const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data); + + bool WriteSurfaceCaptureBlurParam(const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data); + + bool WriteSurfaceCaptureAreaRect(const Drawing::Rect& specifiedAreaRect, MessageParcel& data); + + ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, + float positionZ, float positionW) override; + + RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override; + + ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) override; + + ErrCode RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) override; + + ErrCode RegisterBufferClearListener( + NodeId id, sptr callback) override; + + bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) override; + + int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) override; + + bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) override; + + ErrCode SetGlobalDarkColorMode(bool isDark) override; + + int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override; + + ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) override; + + ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) override; + + ErrCode GetScreenSupportedHDRFormats( + ScreenId id, std::vector& hdrFormats, int32_t& resCode) override; + + ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) override; + + ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) override; + + ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) override; + + ErrCode GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) override; + + ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) override; + ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) override; + bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) override; + bool UnRegisterTypeface(uint64_t globalUniqueId) override; + + ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) override; + + ErrCode SetVirtualScreenRefreshRate( + ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) override; + + void SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) override; + + void SetScreenFrameGravity(ScreenId id, int32_t gravity) override; + + ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) override; + + int32_t RegisterSurfaceOcclusionChangeCallback( + NodeId id, sptr callback, std::vector& partitionPoints) override; + + int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) override; + + int32_t RegisterHgmConfigChangeCallback(sptr callback) override; + + int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) override; + + int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) override; + + int32_t RegisterFirstFrameCommitCallback(sptr callback) override; + + ErrCode AvcodecVideoStart(uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) override; + + ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) override; + + int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, + sptr callback) override; + + ErrCode SetAppWindowNum(uint32_t num) override; + + ErrCode SetSystemAnimatedScenes( + SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) override; + + void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) override; + + int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) override; + + ErrCode ReportJankStats() override; + + ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) override; + + void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) override; + + void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, + const std::vector>& newConfig) override; + + ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) override; + + bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) override; + + ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) override; + + ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) override; + + ErrCode ReportEventResponse(DataBaseRs info) override; + + ErrCode ReportEventComplete(DataBaseRs info) override; + + ErrCode ReportEventJankFrame(DataBaseRs info) override; + + void ReportRsSceneJankStart(AppInfo info) override; + + void ReportRsSceneJankEnd(AppInfo info) override; + + ErrCode ReportGameStateData(GameStateData info) override; + + ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, + bool dynamicHardwareEnable) override; + + ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) override; + + ErrCode SetCacheEnabledForRotation(bool isEnabled) override; + + void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) override; + + void RunOnRemoteDiedCallback() override; + + std::vector GetActiveDirtyRegionInfo() override; + + GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() override; + + ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) override; + + ErrCode SetVmaCacheStatus(bool flag) override; + + int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, + bool unobscured = false) override; + +#ifdef TP_FEATURE_ENABLE + ErrCode SetTpFeatureConfig(int32_t feature, const char* config, + TpFeatureConfigType tpFeatureConfigType = TpFeatureConfigType::DEFAULT_TP_FEATURE) override; +#endif + void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) override; + ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) override; + + ErrCode DropFrameByPid(const std::vector pidList) override; + + ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) override; + + void SetFreeMultiWindowStatus(bool enable) override; + + ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, + sptr callback) override; + + ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) override; + + void RegisterTransactionDataCallback(uint64_t token, + uint64_t timeStamp, sptr callback) override; + + ErrCode SetWindowContainer(NodeId nodeId, bool value) override; + + bool GetHighContrastTextState() override; + + ErrCode SetBehindWindowFilterEnabled(bool enabled) override; + + ErrCode GetBehindWindowFilterEnabled(bool& enabled) override; + + int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) override; + + RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, + const std::string& fileName, int32_t flags, int& outFd) override; + RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, + uint32_t firstFileIndex, std::vector& outFiles) override; + bool ProfilerIsSecureScreen() override; + + void ClearUifirstCache(NodeId id) override; private: + bool FillParcelWithTransactionData( + std::unique_ptr& transactionData, std::shared_ptr& data); + + void ReportDataBaseRs(MessageParcel& data, MessageParcel& reply, MessageOption& option, DataBaseRs info); + + void WriteAppInfo(MessageParcel& data, MessageParcel& reply, MessageOption& option, AppInfo info); + + void ReportGameStateDataRs(MessageParcel& data, MessageParcel& reply, MessageOption& option, GameStateData info); + + int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + + ErrCode SetAncoForceDoDirect(bool direct, bool& res) override; + + ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) override; + + void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override; + static inline BrokerDelegator delegator_; -}; + pid_t pid_ = GetRealPid(); + uint32_t transactionDataIndex_ = 0; + OnRemoteDiedCallback OnRemoteDiedCallback_; +}; } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_PROXY_H \ No newline at end of file +#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp index b85c726723..b910ca0d83 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp @@ -64,7 +64,7 @@ std::shared_ptr RSIRenderClient::CreateRenderServiceClient() void RSRenderServiceClient::CommitTransaction(std::unique_ptr& transactionData) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->CommitTransaction(transactionData); } else { @@ -78,7 +78,7 @@ void RSRenderServiceClient::ExecuteSynchronousTask(const std::shared_ptrExecuteSynchronousTask(task); } @@ -86,7 +86,7 @@ void RSRenderServiceClient::ExecuteSynchronousTask(const std::shared_ptr RSRenderServiceClient::GetMemoryGraphics() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return {}; } @@ -118,7 +118,7 @@ std::vector RSRenderServiceClient::GetMemoryGraphics() bool RSRenderServiceClient::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return false; } @@ -127,7 +127,7 @@ bool RSRenderServiceClient::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemS bool RSRenderServiceClient::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return false; } @@ -138,7 +138,7 @@ bool RSRenderServiceClient::CreateNode(const RSDisplayNodeConfig& displayNodeCon bool RSRenderServiceClient::CreateNode(const RSSurfaceRenderNodeConfig& config) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return false; } @@ -150,7 +150,7 @@ bool RSRenderServiceClient::CreateNode(const RSSurfaceRenderNodeConfig& config) std::shared_ptr RSRenderServiceClient::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, bool unobscured) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return nullptr; } @@ -195,7 +195,7 @@ std::shared_ptr RSRenderServiceClient::CreateVSyncReceiver( bool fromXcomponent) { ROSEN_LOGD("RSRenderServiceClient::CreateVSyncReceiver Start"); - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return nullptr; } @@ -212,20 +212,20 @@ std::shared_ptr RSRenderServiceClient::CreateVSyncReceiver( int32_t RSRenderServiceClient::GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->GetPixelMapByProcessId(pixelMapInfoVector, pid, repCode); + renderService->GetPixelMapByProcessId(pixelMapInfoVector, pid, repCode); //TODO return repCode; } std::shared_ptr RSRenderServiceClient::CreatePixelMapFromSurfaceId(uint64_t surfaceId, const Rect &srcRect) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return nullptr; } sptr surface = SurfaceUtils::GetInstance()->GetSurface(surfaceId); @@ -233,7 +233,7 @@ std::shared_ptr RSRenderServiceClient::CreatePixelMapFromSurfac return nullptr; } std::shared_ptr pixelMap = nullptr; - return renderService->CreatePixelMapFromSurface(surface, srcRect, pixelMap) == ERR_OK ? pixelMap : nullptr; + return renderProcess->CreatePixelMapFromSurface(surface, srcRect, pixelMap) == ERR_OK ? pixelMap : nullptr; } void RSRenderServiceClient::TriggerSurfaceCaptureCallback(NodeId id, const RSSurfaceCaptureConfig& captureConfig, @@ -307,9 +307,9 @@ bool RSRenderServiceClient::TakeSurfaceCapture(NodeId id, std::shared_ptrTakeSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig, blurParam, specifiedAreaRect); + renderProcess->TakeSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig, blurParam, specifiedAreaRect); return true; } std::vector>> RSRenderServiceClient::TakeSurfaceCaptureSoloNode( NodeId id, const RSSurfaceCaptureConfig& captureConfig) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderProcess = GetRenderProcessConnection(); std::vector>> pixelMapIdPairVector; - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeSurfaceCaptureSoloNode renderService == nullptr!"); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeSurfaceCaptureSoloNode renderProcess == nullptr!"); return pixelMapIdPairVector; } - pixelMapIdPairVector = renderService->TakeSurfaceCaptureSoloNode(id, captureConfig); + pixelMapIdPairVector = renderProcess->TakeSurfaceCaptureSoloNode(id, captureConfig); return pixelMapIdPairVector; } bool RSRenderServiceClient::TakeSelfSurfaceCapture(NodeId id, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeSelfSurfaceCapture renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeSelfSurfaceCapture renderProcess == nullptr!"); return false; } if (callback == nullptr) { @@ -375,7 +375,7 @@ bool RSRenderServiceClient::TakeSelfSurfaceCapture(NodeId id, std::shared_ptrTakeSelfSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig); + renderProcess->TakeSelfSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig); return true; } @@ -383,13 +383,13 @@ bool RSRenderServiceClient::SetWindowFreezeImmediately(NodeId id, bool isFreeze, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetWindowFreezeImmediately renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetWindowFreezeImmediately renderProcess == nullptr!"); return false; } if (!isFreeze) { - renderService->SetWindowFreezeImmediately(id, isFreeze, nullptr, captureConfig, blurParam); + renderProcess->SetWindowFreezeImmediately(id, isFreeze, nullptr, captureConfig, blurParam); return true; } if (callback == nullptr) { @@ -411,16 +411,16 @@ bool RSRenderServiceClient::SetWindowFreezeImmediately(NodeId id, bool isFreeze, if (surfaceCaptureCbDirector_ == nullptr) { surfaceCaptureCbDirector_ = new SurfaceCaptureCallbackDirector(this); } - renderService->SetWindowFreezeImmediately(id, isFreeze, surfaceCaptureCbDirector_, captureConfig, blurParam); + renderProcess->SetWindowFreezeImmediately(id, isFreeze, surfaceCaptureCbDirector_, captureConfig, blurParam); return true; } bool RSRenderServiceClient::TakeUICaptureInRange( NodeId id, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeUICaptureInRange renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeUICaptureInRange renderProcess == nullptr!"); return false; } if (callback == nullptr) { @@ -443,36 +443,36 @@ bool RSRenderServiceClient::TakeUICaptureInRange( if (surfaceCaptureCbDirector_ == nullptr) { surfaceCaptureCbDirector_ = new SurfaceCaptureCallbackDirector(this); } - renderService->TakeUICaptureInRange(id, surfaceCaptureCbDirector_, captureConfig); + renderProcess->TakeUICaptureInRange(id, surfaceCaptureCbDirector_, captureConfig); return true; } bool RSRenderServiceClient::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, float positionZ, float positionW) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - RS_LOGE("RSRenderServiceClient::SetHwcNodeBounds renderService is null!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + RS_LOGE("RSRenderServiceClient::SetHwcNodeBounds renderProcess is null!"); return false; } - renderService->SetHwcNodeBounds(rsNodeId, positionX, positionY, positionZ, positionW); + renderProcess->SetHwcNodeBounds(rsNodeId, positionX, positionY, positionZ, positionW); return true; } int32_t RSRenderServiceClient::SetFocusAppInfo(const FocusAppInfo& info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->SetFocusAppInfo(info, repCode); + renderProcess->SetFocusAppInfo(info, repCode); return repCode; } ScreenId RSRenderServiceClient::GetDefaultScreenId() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return INVALID_SCREEN_ID; } @@ -484,7 +484,7 @@ ScreenId RSRenderServiceClient::GetDefaultScreenId() ScreenId RSRenderServiceClient::GetActiveScreenId() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return INVALID_SCREEN_ID; } @@ -496,7 +496,7 @@ ScreenId RSRenderServiceClient::GetActiveScreenId() std::vector RSRenderServiceClient::GetAllScreenIds() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return std::vector(); } @@ -513,7 +513,7 @@ ScreenId RSRenderServiceClient::CreateVirtualScreen( int32_t flags, std::vector whiteList) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { RS_LOGE("RSRenderServiceClient::%{public}s renderService is null!", __func__); return INVALID_SCREEN_ID; @@ -524,58 +524,58 @@ ScreenId RSRenderServiceClient::CreateVirtualScreen( int32_t RSRenderServiceClient::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderService is null!", __func__); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); return RENDER_SERVICE_NULL; } - return renderService->SetVirtualScreenBlackList(id, blackListVector); + return renderProcess->SetVirtualScreenBlackList(id, blackListVector); } int32_t RSRenderServiceClient::SetVirtualScreenTypeBlackList(ScreenId id, std::vector& typeBlackListVector) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); + renderProcess->SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); return repCode; } int32_t RSRenderServiceClient::AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderService is null!", __func__); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->AddVirtualScreenBlackList(id, blackListVector, repCode); + renderProcess->AddVirtualScreenBlackList(id, blackListVector, repCode); return repCode; } int32_t RSRenderServiceClient::RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderService is null!", __func__); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->RemoveVirtualScreenBlackList(id, blackListVector, repCode); + renderProcess->RemoveVirtualScreenBlackList(id, blackListVector, repCode); return repCode; } bool RSRenderServiceClient::SetWatermark(const std::string& name, std::shared_ptr watermark) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return false; } bool success; - renderService->SetWatermark(name, watermark, success); + renderProcess->SetWatermark(name, watermark, success); return success; } @@ -583,48 +583,48 @@ int32_t RSRenderServiceClient::SetVirtualScreenSecurityExemptionList( ScreenId id, const std::vector& securityExemptionList) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); + return renderProcess->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); } int32_t RSRenderServiceClient::SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetScreenSecurityMask(id, std::move(securityMask)); + return renderProcess->SetScreenSecurityMask(id, std::move(securityMask)); } int32_t RSRenderServiceClient::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); + return renderProcess->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); } int32_t RSRenderServiceClient::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetCastScreenEnableSkipWindow(id, enable); + return renderProcess->SetCastScreenEnableSkipWindow(id, enable); } int32_t RSRenderServiceClient::SetVirtualScreenSurface(ScreenId id, sptr surface) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -634,7 +634,7 @@ int32_t RSRenderServiceClient::SetVirtualScreenSurface(ScreenId id, sptrSetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); + return renderProcess->SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); } int32_t RSRenderServiceClient::SetPointerColorInversionEnabled(bool enable) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetPointerColorInversionEnabled(enable); + return renderProcess->SetPointerColorInversionEnabled(enable); } class CustomPointerLuminanceChangeCallback : public RSPointerLuminanceChangeCallbackStub @@ -683,22 +683,22 @@ private: int32_t RSRenderServiceClient::RegisterPointerLuminanceChangeCallback(const PointerLuminanceChangeCallback &callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } sptr cb = new CustomPointerLuminanceChangeCallback(callback); - return renderService->RegisterPointerLuminanceChangeCallback(cb); + return renderProcess->RegisterPointerLuminanceChangeCallback(cb); } int32_t RSRenderServiceClient::UnRegisterPointerLuminanceChangeCallback() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->UnRegisterPointerLuminanceChangeCallback(); + return renderProcess->UnRegisterPointerLuminanceChangeCallback(); } #endif @@ -722,7 +722,7 @@ private: int32_t RSRenderServiceClient::SetScreenChangeCallback(const ScreenChangeCallback &callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is null", __func__); return RENDER_SERVICE_NULL; @@ -734,7 +734,7 @@ int32_t RSRenderServiceClient::SetScreenChangeCallback(const ScreenChangeCallbac void RSRenderServiceClient::SetScreenActiveMode(ScreenId id, uint32_t modeId) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return; } @@ -744,7 +744,7 @@ void RSRenderServiceClient::SetScreenActiveMode(ScreenId id, uint32_t modeId) void RSRenderServiceClient::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return; @@ -755,7 +755,7 @@ void RSRenderServiceClient::SetScreenRefreshRate(ScreenId id, int32_t sceneId, i void RSRenderServiceClient::SetRefreshRateMode(int32_t refreshRateMode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return; @@ -767,18 +767,18 @@ void RSRenderServiceClient::SetRefreshRateMode(int32_t refreshRateMode) void RSRenderServiceClient::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, int32_t animatorExpectedFrameRate) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGW("RSRenderServiceClient renderProcess == nullptr!"); return; } - return renderService->SyncFrameRateRange(id, range, animatorExpectedFrameRate); + return renderProcess->SyncFrameRateRange(id, range, animatorExpectedFrameRate); } void RSRenderServiceClient::UnregisterFrameRateLinker(FrameRateLinkerId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return; @@ -788,7 +788,7 @@ void RSRenderServiceClient::UnregisterFrameRateLinker(FrameRateLinkerId id) uint32_t RSRenderServiceClient::GetScreenCurrentRefreshRate(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -799,7 +799,7 @@ uint32_t RSRenderServiceClient::GetScreenCurrentRefreshRate(ScreenId id) int32_t RSRenderServiceClient::GetCurrentRefreshRateMode() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -810,7 +810,7 @@ int32_t RSRenderServiceClient::GetCurrentRefreshRateMode() std::vector RSRenderServiceClient::GetScreenSupportedRefreshRates(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return {}; @@ -821,7 +821,7 @@ std::vector RSRenderServiceClient::GetScreenSupportedRefreshRates(Scree bool RSRenderServiceClient::GetShowRefreshRateEnabled() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return false; @@ -834,7 +834,7 @@ bool RSRenderServiceClient::GetShowRefreshRateEnabled() std::string RSRenderServiceClient::GetRefreshInfo(pid_t pid) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return ""; @@ -846,7 +846,7 @@ std::string RSRenderServiceClient::GetRefreshInfo(pid_t pid) std::string RSRenderServiceClient::GetRefreshInfoToSP(NodeId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return ""; @@ -858,7 +858,7 @@ std::string RSRenderServiceClient::GetRefreshInfoToSP(NodeId id) void RSRenderServiceClient::SetShowRefreshRateEnabled(bool enabled, int32_t type) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return; @@ -869,7 +869,7 @@ void RSRenderServiceClient::SetShowRefreshRateEnabled(bool enabled, int32_t type uint32_t RSRenderServiceClient::GetRealtimeRefreshRate(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -880,7 +880,7 @@ uint32_t RSRenderServiceClient::GetRealtimeRefreshRate(ScreenId id) int32_t RSRenderServiceClient::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("%{public}s: render service is null", __func__); return RENDER_SERVICE_NULL; @@ -891,7 +891,7 @@ int32_t RSRenderServiceClient::SetPhysicalScreenResolution(ScreenId id, uint32_t int32_t RSRenderServiceClient::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenResolution renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -902,27 +902,27 @@ int32_t RSRenderServiceClient::SetVirtualScreenResolution(ScreenId id, uint32_t RSVirtualScreenResolution RSRenderServiceClient::GetVirtualScreenResolution(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RSVirtualScreenResolution {}; // return empty RSVirtualScreenResolution. } - return renderService->GetVirtualScreenResolution(id); + return renderProcess->GetVirtualScreenResolution(id); } void RSRenderServiceClient::MarkPowerOffNeedProcessOneFrame() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return; } - renderService->MarkPowerOffNeedProcessOneFrame(); + renderProcess->MarkPowerOffNeedProcessOneFrame(); } void RSRenderServiceClient::RepaintEverything() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RepaintEverything renderService is null, return"); return; @@ -933,28 +933,28 @@ void RSRenderServiceClient::RepaintEverything() void RSRenderServiceClient::ForceRefreshOneFrameWithNextVSync() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("ForceRefreshOneFrameWithNextVSync renderService is nullptr, return"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("ForceRefreshOneFrameWithNextVSync renderProcess is nullptr, return"); return; } - renderService->ForceRefreshOneFrameWithNextVSync(); + renderProcess->ForceRefreshOneFrameWithNextVSync(); } void RSRenderServiceClient::DisablePowerOffRenderControl(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return; } - renderService->DisablePowerOffRenderControl(id); + renderProcess->DisablePowerOffRenderControl(id); } void RSRenderServiceClient::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); return; @@ -965,7 +965,7 @@ void RSRenderServiceClient::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus RSScreenModeInfo RSRenderServiceClient::GetScreenActiveMode(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RSScreenModeInfo {}; // return empty RSScreenModeInfo. } @@ -977,7 +977,7 @@ RSScreenModeInfo RSRenderServiceClient::GetScreenActiveMode(ScreenId id) std::vector RSRenderServiceClient::GetScreenSupportedModes(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return {}; } @@ -987,7 +987,7 @@ std::vector RSRenderServiceClient::GetScreenSupportedModes(Scr RSScreenCapability RSRenderServiceClient::GetScreenCapability(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RSScreenCapability {}; } @@ -997,7 +997,7 @@ RSScreenCapability RSRenderServiceClient::GetScreenCapability(ScreenId id) ScreenPowerStatus RSRenderServiceClient::GetScreenPowerStatus(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return ScreenPowerStatus::INVALID_POWER_STATUS; } @@ -1008,7 +1008,7 @@ ScreenPowerStatus RSRenderServiceClient::GetScreenPowerStatus(ScreenId id) RSScreenData RSRenderServiceClient::GetScreenData(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RSScreenData {}; } @@ -1018,7 +1018,7 @@ RSScreenData RSRenderServiceClient::GetScreenData(ScreenId id) int32_t RSRenderServiceClient::GetScreenBacklight(ScreenId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); return INVALID_BACKLIGHT_VALUE; @@ -1030,7 +1030,7 @@ int32_t RSRenderServiceClient::GetScreenBacklight(ScreenId id) void RSRenderServiceClient::SetScreenBacklight(ScreenId id, uint32_t level) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); return; @@ -1076,7 +1076,7 @@ private: bool RSRenderServiceClient::RegisterBufferAvailableListener( NodeId id, const BufferAvailableCallback &callback, bool isFromRenderThread) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return false; } @@ -1105,7 +1105,7 @@ bool RSRenderServiceClient::RegisterBufferAvailableListener( bool RSRenderServiceClient::RegisterBufferClearListener(NodeId id, const BufferClearCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return false; } @@ -1137,7 +1137,7 @@ bool RSRenderServiceClient::UnregisterBufferAvailableListener(NodeId id) int32_t RSRenderServiceClient::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1146,7 +1146,7 @@ int32_t RSRenderServiceClient::GetScreenSupportedColorGamuts(ScreenId id, std::v int32_t RSRenderServiceClient::GetScreenSupportedMetaDataKeys(ScreenId id, std::vector& keys) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::RequestRotation renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -1156,7 +1156,7 @@ int32_t RSRenderServiceClient::GetScreenSupportedMetaDataKeys(ScreenId id, std:: int32_t RSRenderServiceClient::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1165,7 +1165,7 @@ int32_t RSRenderServiceClient::GetScreenColorGamut(ScreenId id, ScreenColorGamut int32_t RSRenderServiceClient::SetScreenColorGamut(ScreenId id, int32_t modeIdx) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1174,7 +1174,7 @@ int32_t RSRenderServiceClient::SetScreenColorGamut(ScreenId id, int32_t modeIdx) int32_t RSRenderServiceClient::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1183,7 +1183,7 @@ int32_t RSRenderServiceClient::SetScreenGamutMap(ScreenId id, ScreenGamutMap mod int32_t RSRenderServiceClient::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1192,37 +1192,37 @@ int32_t RSRenderServiceClient::SetScreenCorrection(ScreenId id, ScreenRotation s bool RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation: renderService is nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation: renderProcess is nullptr"); return false; } - return renderService->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); + return renderProcess->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); } int32_t RSRenderServiceClient::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenAutoRotation: renderService is nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenAutoRotation: renderProcess is nullptr"); return RENDER_SERVICE_NULL; } - return renderService->SetVirtualScreenAutoRotation(id, isAutoRotation); + return renderProcess->SetVirtualScreenAutoRotation(id, isAutoRotation); } bool RSRenderServiceClient::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenScaleMode: renderService is nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenScaleMode: renderProcess is nullptr"); return false; } - return renderService->SetVirtualMirrorScreenScaleMode(id, scaleMode); + return renderProcess->SetVirtualMirrorScreenScaleMode(id, scaleMode); } bool RSRenderServiceClient::SetGlobalDarkColorMode(bool isDark) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::SetGlobalDarkColorMode: renderService is nullptr"); return false; @@ -1232,7 +1232,7 @@ bool RSRenderServiceClient::SetGlobalDarkColorMode(bool isDark) int32_t RSRenderServiceClient::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1241,74 +1241,74 @@ int32_t RSRenderServiceClient::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mo int32_t RSRenderServiceClient::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetScreenHDRCapability renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetScreenHDRCapability renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetScreenHDRCapability(id, screenHdrCapability); + return renderProcess->GetScreenHDRCapability(id, screenHdrCapability); } int32_t RSRenderServiceClient::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetPixelFormat renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetPixelFormat renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->GetPixelFormat(id, pixelFormat, resCode); + renderProcess->GetPixelFormat(id, pixelFormat, resCode); return resCode; } int32_t RSRenderServiceClient::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetPixelFormat renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetPixelFormat renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->SetPixelFormat(id, pixelFormat, resCode); + renderProcess->SetPixelFormat(id, pixelFormat, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenSupportedHDRFormats(ScreenId id, std::vector& hdrFormats) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->GetScreenSupportedHDRFormats(id, hdrFormats, resCode); + renderProcess->GetScreenSupportedHDRFormats(id, hdrFormats, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->GetScreenHDRFormat(id, hdrFormat, resCode); + renderProcess->GetScreenHDRFormat(id, hdrFormat, resCode); return resCode; } int32_t RSRenderServiceClient::SetScreenHDRFormat(ScreenId id, int32_t modeIdx) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->SetScreenHDRFormat(id, modeIdx, resCode); + renderProcess->SetScreenHDRFormat(id, modeIdx, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1324,7 +1324,7 @@ int32_t RSRenderServiceClient::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrSta int32_t RSRenderServiceClient::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1335,7 +1335,7 @@ int32_t RSRenderServiceClient::GetScreenSupportedColorSpaces( int32_t RSRenderServiceClient::GetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType& colorSpace) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1346,7 +1346,7 @@ int32_t RSRenderServiceClient::GetScreenColorSpace(ScreenId id, GraphicCM_ColorS int32_t RSRenderServiceClient::SetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType colorSpace) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1357,7 +1357,7 @@ int32_t RSRenderServiceClient::SetScreenColorSpace(ScreenId id, GraphicCM_ColorS int32_t RSRenderServiceClient::GetScreenType(ScreenId id, RSScreenType& screenType) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::GetScreenType renderService == nullptr!"); return RENDER_SERVICE_NULL; @@ -1367,7 +1367,7 @@ int32_t RSRenderServiceClient::GetScreenType(ScreenId id, RSScreenType& screenTy bool RSRenderServiceClient::GetBitmap(NodeId id, Drawing::Bitmap& bitmap) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::GetBitmap renderService == nullptr!"); return false; @@ -1380,7 +1380,7 @@ bool RSRenderServiceClient::GetBitmap(NodeId id, Drawing::Bitmap& bitmap) bool RSRenderServiceClient::GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::GetPixelmap: renderService is nullptr"); return false; @@ -1392,9 +1392,9 @@ bool RSRenderServiceClient::GetPixelmap(NodeId id, std::shared_ptr& typeface) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterTypeface: renderService is nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterTypeface: renderProcess is nullptr"); return false; } uint64_t globalUniqueId = RSTypefaceCache::GenGlobalUniqueId(typeface->GetUniqueID()); @@ -1402,26 +1402,26 @@ bool RSRenderServiceClient::RegisterTypeface(std::shared_ptr& RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); // timer: 3s OHOS::Rosen::RSXCollie registerTypefaceXCollie("registerTypefaceXCollie_" + typeface->GetFamilyName(), 3); - return renderService->RegisterTypeface(globalUniqueId, typeface); + return renderProcess->RegisterTypeface(globalUniqueId, typeface); } bool RSRenderServiceClient::UnRegisterTypeface(std::shared_ptr& typeface) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnRegisterTypeface: renderService is nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnRegisterTypeface: renderProcess is nullptr"); return false; } uint64_t globalUniqueId = RSTypefaceCache::GenGlobalUniqueId(typeface->GetUniqueID()); ROSEN_LOGD("RSRenderServiceClient::UnRegisterTypeface: pid[%{public}d] unregister typface[%{public}u]", RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); - return renderService->UnRegisterTypeface(globalUniqueId); + return renderProcess->UnRegisterTypeface(globalUniqueId); } int32_t RSRenderServiceClient::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1430,30 +1430,30 @@ int32_t RSRenderServiceClient::GetDisplayIdentificationData(ScreenId id, uint8_t int32_t RSRenderServiceClient::SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFrameInterval) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } int32_t statusCode = SUCCESS; - renderService->SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode); + renderProcess->SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode); return statusCode; } int32_t RSRenderServiceClient::SetVirtualScreenRefreshRate( ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderProcess = GetRenderProcessConnection(); int32_t resCode = RENDER_SERVICE_NULL; - if (renderService == nullptr) { + if (renderProcess == nullptr) { return RENDER_SERVICE_NULL; } - renderService->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, resCode); + renderProcess->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, resCode); return resCode; } uint32_t RSRenderServiceClient::SetScreenActiveRect(ScreenId id, const Rect& activeRect) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -1464,7 +1464,7 @@ uint32_t RSRenderServiceClient::SetScreenActiveRect(ScreenId id, const Rect& act void RSRenderServiceClient::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return; } @@ -1473,7 +1473,7 @@ void RSRenderServiceClient::SetScreenOffset(ScreenId id, int32_t offSetX, int32_ void RSRenderServiceClient::SetScreenFrameGravity(ScreenId id, int32_t gravity) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return; } @@ -1499,14 +1499,14 @@ private: int32_t RSRenderServiceClient::RegisterOcclusionChangeCallback(const OcclusionChangeCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterOcclusionChangeCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterOcclusionChangeCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomOcclusionChangeCallback(callback); int32_t repCode; - renderService->RegisterOcclusionChangeCallback(cb, repCode); + renderProcess->RegisterOcclusionChangeCallback(cb, repCode); return repCode; } @@ -1530,23 +1530,23 @@ private: int32_t RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback( NodeId id, const SurfaceOcclusionChangeCallback& callback, std::vector& partitionPoints) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomSurfaceOcclusionChangeCallback(callback); - return renderService->RegisterSurfaceOcclusionChangeCallback(id, cb, partitionPoints); + return renderProcess->RegisterSurfaceOcclusionChangeCallback(id, cb, partitionPoints); } int32_t RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->UnRegisterSurfaceOcclusionChangeCallback(id); + return renderProcess->UnRegisterSurfaceOcclusionChangeCallback(id); } class CustomHgmConfigChangeCallback : public RSHgmConfigChangeCallbackStub @@ -1575,13 +1575,13 @@ private: int32_t RSRenderServiceClient::RegisterHgmConfigChangeCallback(const HgmConfigChangeCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmConfigChangeCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmConfigChangeCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomHgmConfigChangeCallback(callback); - return renderService->RegisterHgmConfigChangeCallback(cb); + return renderProcess->RegisterHgmConfigChangeCallback(cb); } class CustomHgmRefreshRateModeChangeCallback : public RSHgmConfigChangeCallbackStub @@ -1611,13 +1611,13 @@ private: int32_t RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback( const HgmRefreshRateModeChangeCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomHgmRefreshRateModeChangeCallback(callback); - return renderService->RegisterHgmRefreshRateModeChangeCallback(cb); + return renderProcess->RegisterHgmRefreshRateModeChangeCallback(cb); } class CustomHgmRefreshRateUpdateCallback : public RSHgmConfigChangeCallbackStub @@ -1650,9 +1650,9 @@ int32_t RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback( const HgmRefreshRateUpdateCallback& callback) { sptr cb = nullptr; - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } @@ -1661,7 +1661,7 @@ int32_t RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback called"); - return renderService->RegisterHgmRefreshRateUpdateCallback(cb); + return renderProcess->RegisterHgmRefreshRateUpdateCallback(cb); } class CustomFirstFrameCommitCallback : public RSFirstFrameCommitCallbackStub @@ -1686,9 +1686,9 @@ int32_t RSRenderServiceClient::RegisterFirstFrameCommitCallback( const FirstFrameCommitCallback& callback) { sptr cb = nullptr; - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterFirstFrameCommitCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterFirstFrameCommitCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } @@ -1697,7 +1697,7 @@ int32_t RSRenderServiceClient::RegisterFirstFrameCommitCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterFirstFrameCommitCallback called"); - return renderService->RegisterFirstFrameCommitCallback(cb); + return renderProcess->RegisterFirstFrameCommitCallback(cb); } class CustomFrameRateLinkerExpectedFpsUpdateCallback : public RSFrameRateLinkerExpectedFpsUpdateCallbackStub @@ -1723,9 +1723,9 @@ private: int32_t RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback( int32_t dstPid, const FrameRateLinkerExpectedFpsUpdateCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback renderService == nullptr"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback renderProcess == nullptr"); return RENDER_SERVICE_NULL; } @@ -1735,109 +1735,109 @@ int32_t RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback called"); - return renderService->RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, cb); + return renderProcess->RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, cb); } void RSRenderServiceClient::SetAppWindowNum(uint32_t num) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetAppWindowNum(num); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetAppWindowNum(num); } } bool RSRenderServiceClient::SetSystemAnimatedScenes(SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetSystemAnimatedScenes renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetSystemAnimatedScenes renderProcess == nullptr!"); return false; } bool success; - renderService->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation, success); + renderProcess->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation, success); return success; } void RSRenderServiceClient::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ShowWatermark(watermarkImg, isShow); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ShowWatermark(watermarkImg, isShow); } } int32_t RSRenderServiceClient::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::ResizeVirtualScreen renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::ResizeVirtualScreen renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } ROSEN_LOGI("RSRenderServiceClient::ResizeVirtualScreen, width:%{public}u, height:%{public}u", width, height); - return renderService->ResizeVirtualScreen(id, width, height); + return renderProcess->ResizeVirtualScreen(id, width, height); } void RSRenderServiceClient::ReportJankStats() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportJankStats(); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportJankStats(); } } void RSRenderServiceClient::ReportEventResponse(DataBaseRs info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportEventResponse(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportEventResponse(info); } } void RSRenderServiceClient::ReportEventComplete(DataBaseRs info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportEventComplete(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportEventComplete(info); } } void RSRenderServiceClient::ReportEventJankFrame(DataBaseRs info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportEventJankFrame(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportEventJankFrame(info); } } void RSRenderServiceClient::ReportRsSceneJankStart(AppInfo info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportRsSceneJankStart(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportRsSceneJankStart(info); } } void RSRenderServiceClient::ReportRsSceneJankEnd(AppInfo info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportRsSceneJankEnd(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportRsSceneJankEnd(info); } } void RSRenderServiceClient::ReportGameStateData(GameStateData info) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->ReportGameStateData(info); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->ReportGameStateData(info); } } void RSRenderServiceClient::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->SetHardwareEnabled(id, isEnabled, selfDrawingType, dynamicHardwareEnable); } @@ -1845,7 +1845,7 @@ void RSRenderServiceClient::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDr uint32_t RSRenderServiceClient::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { uint32_t resCode; renderService->SetHidePrivacyContent(id, needHidePrivacyContent, resCode); @@ -1856,32 +1856,32 @@ uint32_t RSRenderServiceClient::SetHidePrivacyContent(NodeId id, bool needHidePr void RSRenderServiceClient::NotifyLightFactorStatus(int32_t lightFactorStatus) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->NotifyLightFactorStatus(lightFactorStatus); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->NotifyLightFactorStatus(lightFactorStatus); } } void RSRenderServiceClient::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->NotifyPackageEvent(listSize, packageList); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->NotifyPackageEvent(listSize, packageList); } } void RSRenderServiceClient::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, const std::vector>& newConfig) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); } } void RSRenderServiceClient::NotifyRefreshRateEvent(const EventInfo& eventInfo) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->NotifyRefreshRateEvent(eventInfo); } @@ -1889,7 +1889,7 @@ void RSRenderServiceClient::NotifyRefreshRateEvent(const EventInfo& eventInfo) void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->SetWindowExpectedRefreshRate(eventInfos); } @@ -1897,7 +1897,7 @@ void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_ma void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->SetWindowExpectedRefreshRate(eventInfos); } @@ -1906,24 +1906,24 @@ void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_ma bool RSRenderServiceClient::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - return renderService->NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + return renderProcess->NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); } return false; } void RSRenderServiceClient::NotifyHgmConfigEvent(const std::string &eventName, bool state) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->NotifyHgmConfigEvent(eventName, state); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->NotifyHgmConfigEvent(eventName, state); } } void RSRenderServiceClient::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->NotifyXComponentExpectedFrameRate(id, expectedFrameRate); } @@ -1931,7 +1931,7 @@ void RSRenderServiceClient::NotifyXComponentExpectedFrameRate(const std::string& void RSRenderServiceClient::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->NotifyTouchEvent(touchStatus, touchCnt); } @@ -1939,7 +1939,7 @@ void RSRenderServiceClient::NotifyTouchEvent(int32_t touchStatus, int32_t touchC void RSRenderServiceClient::NotifyDynamicModeEvent(bool enableDynamicMode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->NotifyDynamicModeEvent(enableDynamicMode); } @@ -1947,41 +1947,41 @@ void RSRenderServiceClient::NotifyDynamicModeEvent(bool enableDynamicMode) void RSRenderServiceClient::SetCacheEnabledForRotation(bool isEnabled) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetCacheEnabledForRotation(isEnabled); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetCacheEnabledForRotation(isEnabled); } } void RSRenderServiceClient::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetOnRemoteDiedCallback(callback); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetOnRemoteDiedCallback(callback); } } std::vector RSRenderServiceClient::GetActiveDirtyRegionInfo() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return {}; } - return renderService->GetActiveDirtyRegionInfo(); + return renderProcess->GetActiveDirtyRegionInfo(); } GlobalDirtyRegionInfo RSRenderServiceClient::GetGlobalDirtyRegionInfo() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return GlobalDirtyRegionInfo {}; } - return renderService->GetGlobalDirtyRegionInfo(); + return renderProcess->GetGlobalDirtyRegionInfo(); } LayerComposeInfo RSRenderServiceClient::GetLayerComposeInfo() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return LayerComposeInfo {}; } @@ -1990,7 +1990,7 @@ LayerComposeInfo RSRenderServiceClient::GetLayerComposeInfo() HwcDisabledReasonInfos RSRenderServiceClient::GetHwcDisabledReasonInfo() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return {}; } @@ -1999,12 +1999,12 @@ HwcDisabledReasonInfos RSRenderServiceClient::GetHwcDisabledReasonInfo() int64_t RSRenderServiceClient::GetHdrOnDuration() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return 0; } int64_t hdrOnDuration = 0; - auto ret = renderService->GetHdrOnDuration(hdrOnDuration); + auto ret = renderProcess->GetHdrOnDuration(hdrOnDuration); if (ret != ERR_OK) { ROSEN_LOGE("Failed to get HdrOnDuration, ret=%{public}d", ret); } @@ -2013,18 +2013,18 @@ int64_t RSRenderServiceClient::GetHdrOnDuration() void RSRenderServiceClient::SetVmaCacheStatus(bool flag) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { return; } - renderService->SetVmaCacheStatus(flag); + renderProcess->SetVmaCacheStatus(flag); } #ifdef TP_FEATURE_ENABLE void RSRenderServiceClient::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return; } @@ -2034,25 +2034,25 @@ void RSRenderServiceClient::SetTpFeatureConfig(int32_t feature, const char* conf void RSRenderServiceClient::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); } } void RSRenderServiceClient::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetCurtainScreenUsingStatus(isCurtainScreenOn); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetCurtainScreenUsingStatus(isCurtainScreenOn); } } void RSRenderServiceClient::DropFrameByPid(const std::vector pidList) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->DropFrameByPid(pidList); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->DropFrameByPid(pidList); } } @@ -2076,45 +2076,45 @@ private: int32_t RSRenderServiceClient::RegisterUIExtensionCallback(uint64_t userId, const UIExtensionCallback& callback, bool unobscured) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterUIExtensionCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterUIExtensionCallback renderProcess == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomUIExtensionCallback(callback); - return renderService->RegisterUIExtensionCallback(userId, cb, unobscured); + return renderProcess->RegisterUIExtensionCallback(userId, cb, unobscured); } bool RSRenderServiceClient::SetAncoForceDoDirect(bool direct) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { bool res; - renderService->SetAncoForceDoDirect(direct, res); + renderProcess->SetAncoForceDoDirect(direct, res); return res; } - ROSEN_LOGE("RSRenderServiceClient::SetAncoForceDoDirect renderService is null"); + ROSEN_LOGE("RSRenderServiceClient::SetAncoForceDoDirect renderProcess is null"); return false; } bool RSRenderServiceClient::SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderProcess = GetRenderProcessConnection(); bool success = false; - if (renderService != nullptr) { - renderService->SetVirtualScreenStatus(id, screenStatus, success); + if (renderProcess != nullptr) { + renderProcess->SetVirtualScreenStatus(id, screenStatus, success); } return success; } void RSRenderServiceClient::SetFreeMultiWindowStatus(bool enable) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetFreeMultiWindowStatus renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetFreeMultiWindowStatus renderProcess == nullptr!"); return; } - renderService->SetFreeMultiWindowStatus(enable); + renderProcess->SetFreeMultiWindowStatus(enable); } class SurfaceBufferCallbackDirector : public RSSurfaceBufferCallbackStub { @@ -2138,9 +2138,9 @@ private: bool RSRenderServiceClient::RegisterSurfaceBufferCallback( pid_t pid, uint64_t uid, std::shared_ptr callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceBufferCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceBufferCallback renderProcess == nullptr!"); return false; } if (callback == nullptr) { @@ -2160,15 +2160,15 @@ bool RSRenderServiceClient::RegisterSurfaceBufferCallback( surfaceBufferCbDirector_ = new SurfaceBufferCallbackDirector(this); } } - renderService->RegisterSurfaceBufferCallback(pid, uid, surfaceBufferCbDirector_); + renderProcess->RegisterSurfaceBufferCallback(pid, uid, surfaceBufferCbDirector_); return true; } bool RSRenderServiceClient::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnregisterSurfaceBufferCallback renderService == nullptr!"); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnregisterSurfaceBufferCallback renderProcess == nullptr!"); return false; } { @@ -2180,7 +2180,7 @@ bool RSRenderServiceClient::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t } surfaceBufferCallbacks_.erase(iter); } - renderService->UnregisterSurfaceBufferCallback(pid, uid); + renderProcess->UnregisterSurfaceBufferCallback(pid, uid); return true; } @@ -2216,7 +2216,7 @@ void RSRenderServiceClient::TriggerOnAfterAcquireBuffer(const AfterAcquireBuffer void RSRenderServiceClient::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->SetLayerTopForHWC(nodeId, isTop, zOrder); } @@ -2224,7 +2224,7 @@ void RSRenderServiceClient::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_ void RSRenderServiceClient::SetLayerTop(const std::string &nodeIdStr, bool isTop) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { renderService->SetLayerTop(nodeIdStr, isTop); } @@ -2232,9 +2232,9 @@ void RSRenderServiceClient::SetLayerTop(const std::string &nodeIdStr, bool isTop void RSRenderServiceClient::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetForceRefresh(nodeIdStr, isForceRefresh); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetForceRefresh(nodeIdStr, isForceRefresh); } } @@ -2256,7 +2256,7 @@ private: bool RSRenderServiceClient::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, std::function callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::RegisterTransactionDataCallback renderService == nullptr!"); return false; @@ -2304,15 +2304,15 @@ void RSRenderServiceClient::TriggerTransactionDataCallbackAndErase(uint64_t toke void RSRenderServiceClient::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetColorFollow(nodeIdStr, isColorFollow); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetColorFollow(nodeIdStr, isColorFollow); } } void RSRenderServiceClient::NotifyScreenSwitched() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); return; @@ -2322,9 +2322,9 @@ void RSRenderServiceClient::NotifyScreenSwitched() void RSRenderServiceClient::SetWindowContainer(NodeId nodeId, bool value) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - renderService->SetWindowContainer(nodeId, value); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + renderProcess->SetWindowContainer(nodeId, value); } } @@ -2349,7 +2349,7 @@ private: int32_t RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, const SelfDrawingNodeRectChangeCallback& callback) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback renderService == nullptr"); return RENDER_SERVICE_NULL; @@ -2365,7 +2365,7 @@ int32_t RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback( int32_t RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback renderService == nullptr"); return RENDER_SERVICE_NULL; @@ -2376,7 +2376,7 @@ int32_t RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback() #ifdef RS_ENABLE_OVERLAY_DISPLAY int32_t RSRenderServiceClient::SetOverlayDisplayMode(int32_t mode) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RENDER_SERVICE_NULL; } @@ -2387,7 +2387,7 @@ int32_t RSRenderServiceClient::SetOverlayDisplayMode(int32_t mode) void RSRenderServiceClient::NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { ROSEN_LOGE("RSRenderServiceClient::NotifyPageName renderService == nullptr!"); return; @@ -2397,20 +2397,20 @@ void RSRenderServiceClient::NotifyPageName(const std::string &packageName, bool RSRenderServiceClient::GetHighContrastTextState() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (renderService != nullptr) { - return renderService->GetHighContrastTextState(); + auto renderProcess = GetRenderProcessConnection(); + if (renderProcess != nullptr) { + return renderProcess->GetHighContrastTextState(); } return false; } bool RSRenderServiceClient::SetBehindWindowFilterEnabled(bool enabled) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (!renderService) { + auto renderProcess = GetRenderProcessConnection(); + if (!renderProcess) { return false; } - auto ret = renderService->SetBehindWindowFilterEnabled(enabled); + auto ret = renderProcess->SetBehindWindowFilterEnabled(enabled); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::SetBehindWindowFilterEnabled fail, ret[%{public}d]", ret); return false; @@ -2420,11 +2420,11 @@ bool RSRenderServiceClient::SetBehindWindowFilterEnabled(bool enabled) bool RSRenderServiceClient::GetBehindWindowFilterEnabled(bool& enabled) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (!renderService) { + auto renderProcess = GetRenderProcessConnection(); + if (!renderProcess) { return false; } - auto ret = renderService->GetBehindWindowFilterEnabled(enabled); + auto ret = renderProcess->GetBehindWindowFilterEnabled(enabled); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::GetBehindWindowFilterEnabled fail, ret[%{public}d]", ret); return false; @@ -2434,11 +2434,11 @@ bool RSRenderServiceClient::GetBehindWindowFilterEnabled(bool& enabled) int32_t RSRenderServiceClient::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); - if (!renderService) { + auto renderProcess = GetRenderProcessConnection(); + if (!renderProcess) { return ERR_INVALID_DATA; } - auto ret = renderService->GetPidGpuMemoryInMB(pid, gpuMemInMB); + auto ret = renderProcess->GetPidGpuMemoryInMB(pid, gpuMemInMB); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::GetPidGpuMemoryInMB fail, ret[%{public}d]", ret); } @@ -2447,7 +2447,7 @@ int32_t RSRenderServiceClient::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) RetCodeHrpService RSRenderServiceClient::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& fd) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RET_HRP_SERVICE_ERR_UNKNOWN; } @@ -2463,7 +2463,7 @@ RetCodeHrpService RSRenderServiceClient::ProfilerServiceOpenFile(const HrpServic RetCodeHrpService RSRenderServiceClient::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService == nullptr) { return RET_HRP_SERVICE_ERR_UNKNOWN; } @@ -2475,7 +2475,7 @@ RetCodeHrpService RSRenderServiceClient::ProfilerServicePopulateFiles(const HrpS bool RSRenderServiceClient::ProfilerIsSecureScreen() { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (renderService != nullptr) { return renderService->ProfilerIsSecureScreen(); } @@ -2484,11 +2484,21 @@ bool RSRenderServiceClient::ProfilerIsSecureScreen() void RSRenderServiceClient::ClearUifirstCache(NodeId id) { - auto renderService = RSRenderServiceConnectHub::GetRenderService(); + auto renderService = GetRenderServiceConnection(); if (!renderService) { return; } renderService->ClearUifirstCache(id); } + +std::shared_ptr RSRenderServiceClient::GetRenderServiceConnection() +{ + return RSRenderServiceConnectHub::GetRenderService().first; +} + +std::shared_ptr RSRenderServiceClient::GetRenderProcessConnection() +{ + return RSRenderServiceConnectHub::GetRenderService().second; +} } // namespace Rosen } // namespace OHOS diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp index 8a6074dc48..e97fc05bc5 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp @@ -33,7 +33,6 @@ namespace { static constexpr size_t ASHMEM_SIZE_THRESHOLD = 200 * 1024; // cannot > 500K in TF_ASYNC mode static constexpr int MAX_RETRY_COUNT = 20; static constexpr int RETRY_WAIT_TIME_US = 1000; // wait 1ms before retry SendRequest -static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 static constexpr uint32_t EDID_DATA_MAX_SIZE = 64 * 1024; static constexpr int MAX_VOTER_SIZE = 100; // SetWindowExpectedRefreshRate map size not exceed 100 static constexpr int ZERO = 0; // empty map size @@ -381,132 +380,6 @@ ErrCode RSRenderServiceConnectionProxy::CreateVSyncConnection(sptr& pixelMapInfoVector, pid_t pid, int32_t& repCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteUint64(pid)) { - ROSEN_LOGE("GetPixelMapByProcessId: WriteUint64 pid err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelMapByProcessId: Send Request err"); - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(repCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelMapByProcessId Read repCode failed"); - return ERR_INVALID_VALUE; - } - if (repCode == SUCCESS) { - pixelMapInfoVector.clear(); - if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapInfoVector)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelMapByProcessId: Unmarshalling failed"); - } - } else { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelMapByProcessId: Invalid reply"); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::CreatePixelMapFromSurface(sptr surface, - const Rect &srcRect, std::shared_ptr &pixelMap) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (surface == nullptr) { - return ERR_INVALID_VALUE; - } - - auto producer = surface->GetProducer(); - if (producer == nullptr) { - return ERR_INVALID_VALUE; - } - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("CreatePixelMapFromSurface: WriteInterfaceToken RSIRenderServiceConnection::GetDescriptor() err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(producer->AsObject())) { - ROSEN_LOGE("CreatePixelMapFromSurface: WriteRemoteObject producer->AsObject() err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(srcRect.x) || !data.WriteInt32(srcRect.y) || - !data.WriteInt32(srcRect.w) || !data.WriteInt32(srcRect.h)) { - ROSEN_LOGE("CreatePixelMapFromSurface: WriteInt32 srcRect err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreatePixelMapFromSurface: Send Request err."); - return ERR_INVALID_VALUE; - } - - if (reply.ReadBool()) { - pixelMap.reset(Media::PixelMap::Unmarshalling(reply)); - } else { - ROSEN_LOGE("CreatePixelMapFromSurface: ReadBool err."); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteInterfaceToken err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteInt32(info.pid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteInt32 pid err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(info.uid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteInt32 uid err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteString(info.bundleName)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteString bundleName err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteString(info.abilityName)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteString abilityName err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUint64(info.focusNodeId)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: WriteUint64 focusNodeId err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFocusAppInfo: Send Request err."); - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - repCode = reply.ReadInt32(); - return ERR_OK; -} - ErrCode RSRenderServiceConnectionProxy::GetDefaultScreenId(uint64_t& screenId) { MessageParcel data; @@ -682,30 +555,36 @@ ScreenId RSRenderServiceConnectionProxy::CreateVirtualScreen( return id; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) +int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) { + if (surface == nullptr) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); + return INVALID_ARGUMENTS; + } + MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("SetVirtualScreenSurface: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenBlackList: WriteUint64 id err."); + ROSEN_LOGE("SetVirtualScreenSurface: WriteUint64 MessageOption::TF_ASYNC err."); return WRITE_PARCEL_ERR; } - if (!data.WriteUInt64Vector(blackListVector)) { - ROSEN_LOGE("SetVirtualScreenBlackList: WriteUInt64Vector blackListVector err."); + auto producer = surface->GetProducer(); + if (!data.WriteRemoteObject(producer->AsObject())) { + ROSEN_LOGE("SetVirtualScreenSurface: WriteRemoteObject producer->AsObject() err."); return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenBlackList: Send Request err."); + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send Request err."); return RS_CONNECTION_ERROR; } @@ -713,4460 +592,2079 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenBlackList(ScreenId id, s return status; } -ErrCode RSRenderServiceConnectionProxy::SetVirtualScreenTypeBlackList( - ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) +void RSRenderServiceConnectionProxy::RemoveVirtualScreen(ScreenId id) { MessageParcel data; MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - + MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteInterfaceToken GetDescriptor err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + ROSEN_LOGE("RemoveVirtualScreen: WriteInterfaceToken GetDescriptor err."); + return; } + option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteUint64 id err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUInt8Vector(typeBlackListVector)) { - ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteUInt8Vector typeBlackListVector err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + ROSEN_LOGE("RemoveVirtualScreen: WriteUint64 id err."); + return; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenTypeBlackList: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::RemoveVirtualScreen: Send Request err."); + return; } - - repCode = reply.ReadInt32(); - return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::AddVirtualScreenBlackList( - ScreenId id, std::vector& blackListVector, int32_t& repCode) +int32_t RSRenderServiceConnectionProxy::SetScreenChangeCallback(sptr callback) { + if (callback == nullptr) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: callback is nullptr."); + return INVALID_ARGUMENTS; + } + MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("AddVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + ROSEN_LOGE("SetScreenChangeCallback: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; } option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("AddVirtualScreenBlackList: WriteUint64 id err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUInt64Vector(blackListVector)) { - ROSEN_LOGE("AddVirtualScreenBlackList: WriteUInt64Vector id err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("SetScreenChangeCallback: WriteRemoteObject callback->AsObject() err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CHANGE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AddVirtualScreenBlackList: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: Send Request err."); + return RS_CONNECTION_ERROR; } - - repCode = reply.ReadInt32(); - return ERR_OK; + int32_t result = reply.ReadInt32(); + return result; } -ErrCode RSRenderServiceConnectionProxy::RemoveVirtualScreenBlackList( - ScreenId id, std::vector& blackListVector, int32_t& repCode) +void RSRenderServiceConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + ROSEN_LOGE("SetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); + return; } - - option.SetFlags(MessageOption::TF_ASYNC); + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteUint64 id err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + ROSEN_LOGE("SetScreenActiveMode: WriteUint64 id err."); + return; } - if (!data.WriteUInt64Vector(blackListVector)) { - ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteUInt64Vector blackListVector err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; + if (!data.WriteUint32(modeId)) { + ROSEN_LOGE("SetScreenActiveMode: WriteUint32 modeId err."); + return; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RemoveVirtualScreenBlackList: Send Request err."); - return ERR_INVALID_VALUE; + return; } - - repCode = reply.ReadInt32(); - return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSecurityExemptionList( - ScreenId id, - const std::vector& securityExemptionList) +void RSRenderServiceConnectionProxy::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) { - if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSecurityExemptionList: too many lists."); - return INVALID_ARGUMENTS; - } MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("SetScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteUint64 id err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("SetScreenRefreshRate: WriteUint64 id err."); + return; } - if (!data.WriteUInt64Vector(securityExemptionList)) { - ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteUInt64Vector securityExemptionList err."); - return WRITE_PARCEL_ERR; + if (!data.WriteInt32(sceneId)) { + ROSEN_LOGE("SetScreenRefreshRate: WriteInt32 sceneId err."); + return; } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST); + if (!data.WriteInt32(rate)) { + ROSEN_LOGE("SetScreenRefreshRate: WriteInt32 rate err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSecurityExemptionList: Send Request err."); - return RS_CONNECTION_ERROR; - } - - int32_t status{0}; - if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSecurityExemptionList Read status failed"); - return READ_PARCEL_ERR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return; } - return status; } -int32_t RSRenderServiceConnectionProxy::SetScreenSecurityMask(ScreenId id, - std::shared_ptr securityMask) +void RSRenderServiceConnectionProxy::SetRefreshRateMode(int32_t refreshRateMode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenSecurityMask: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenSecurityMask: WriteUint64 id err."); - return WRITE_PARCEL_ERR; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("SetRefreshRateMode: WriteInterfaceToken GetDescriptor err."); + return; } - - if (securityMask) { - if (!data.WriteBool(true) || !data.WriteParcelable(securityMask.get())) { - ROSEN_LOGE("SetScreenSecurityMask: WriteBool[true] OR WriteParcelable[securityMask.get()] err."); - return WRITE_PARCEL_ERR; - } - } else { - if (!data.WriteBool(false)) { - ROSEN_LOGE("SetScreenSecurityMask: WriteBool [false] err."); - return WRITE_PARCEL_ERR; - } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteInt32(refreshRateMode)) { + ROSEN_LOGE("SetRefreshRateMode: WriteInt32 refreshRateMode err."); + return; } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_REFRESH_RATE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenSecurityMask: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return; } - return SUCCESS; } -int32_t RSRenderServiceConnectionProxy::SetMirrorScreenVisibleRect( - ScreenId id, const Rect& mainScreenRect, bool supportRotation) +void RSRenderServiceConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("UnregisterFrameRateLinker: WriteInterfaceToken GetDescriptor err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); + option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteInt32(mainScreenRect.x) || !data.WriteInt32(mainScreenRect.y) || - !data.WriteInt32(mainScreenRect.w) || !data.WriteInt32(mainScreenRect.h)) { - ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteInt32 mainScreenRect err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteBool(supportRotation)) { - ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteBool supportRotation err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("UnregisterFrameRateLinker: WriteUint64 id err."); + return; } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetMirrorScreenVisibleRect: Send Request err."); - return RS_CONNECTION_ERROR; - } - - int32_t status{0}; - if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetMirrorScreenVisibleRect Read status failed"); - return READ_PARCEL_ERR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return; } - return status; } -int32_t RSRenderServiceConnectionProxy::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) +uint32_t RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetScreenCurrentRefreshRate: WriteInterfaceToken GetDescriptor err."); + return SUCCESS; } - - option.SetFlags(MessageOption::TF_ASYNC); + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteUint64 MessageOption::TF_ASYNC err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteBool(enable)) { - ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteBool enable err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetScreenCurrentRefreshRate: WriteUint64 id err."); + return SUCCESS; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CURRENT_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetCastScreenEnableSkipWindow: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return SUCCESS; } - int32_t result = reply.ReadInt32(); - return result; + uint32_t rate{0}; + if (!reply.ReadUint32(rate)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate Read rate failed"); + return READ_PARCEL_ERR; + } + return rate; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) +int32_t RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode() { - if (surface == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); - return INVALID_ARGUMENTS; - } - MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenSurface: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenSurface: WriteUint64 MessageOption::TF_ASYNC err."); - return WRITE_PARCEL_ERR; - } - auto producer = surface->GetProducer(); - if (!data.WriteRemoteObject(producer->AsObject())) { - ROSEN_LOGE("SetVirtualScreenSurface: WriteRemoteObject producer->AsObject() err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); + return SUCCESS; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE); + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_CURRENT_REFRESH_RATE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return SUCCESS; } - - int32_t status = reply.ReadInt32(); - return status; + int32_t refreshRateMode{0}; + if (!reply.ReadInt32(refreshRateMode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read refreshRateMode failed"); + return READ_PARCEL_ERR; + } + return refreshRateMode; } -void RSRenderServiceConnectionProxy::RemoveVirtualScreen(ScreenId id) +std::vector RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; + std::vector screenSupportedRates; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RemoveVirtualScreen: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("GetScreenSupportedRefreshRates: WriteInterfaceToken GetDescriptor err."); + return screenSupportedRates; } - - option.SetFlags(MessageOption::TF_ASYNC); + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("RemoveVirtualScreen: WriteUint64 id err."); - return; + ROSEN_LOGE("GetScreenSupportedRefreshRates: WriteUint64 id err."); + return screenSupportedRates; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_REFRESH_RATES); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RemoveVirtualScreen: Send Request err."); - return; - } -} - -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR -int32_t RSRenderServiceConnectionProxy::SetPointerColorInversionConfig(float darkBuffer, - float brightBuffer, int64_t interval, int32_t rangeSize) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetPointerColorInversionConfig: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteFloat(darkBuffer)) { - ROSEN_LOGE("SetPointerColorInversionConfig: WriteFloat darkBuffer err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteFloat(brightBuffer)) { - ROSEN_LOGE("SetPointerColorInversionConfig: WriteFloat brightBuffer err."); - return WRITE_PARCEL_ERR; + return screenSupportedRates; } - if (!data.WriteInt64(interval)) { - ROSEN_LOGE("SetPointerColorInversionConfig: WriteInt64 interval err."); - return WRITE_PARCEL_ERR; + uint64_t rateCount{0}; + if (!reply.ReadUint64(rateCount)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates Read rateCount failed"); + return screenSupportedRates; } - if (!data.WriteInt32(rangeSize)) { - ROSEN_LOGE("SetPointerColorInversionConfig: WriteInt32 rangeSize err."); - return WRITE_PARCEL_ERR; + size_t readableSize = reply.GetReadableBytes(); + size_t len = static_cast(rateCount); + if (len > readableSize || len > screenSupportedRates.max_size()) { + RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedRefreshRates " + "fail read vector, size : %{public}zu, readableSize : %{public}zu", len, readableSize); + return screenSupportedRates; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPointerColorInversionConfig: Send Request err."); - return RS_CONNECTION_ERROR; + screenSupportedRates.resize(rateCount); + for (uint64_t rateIndex = 0; rateIndex < rateCount; rateIndex++) { + screenSupportedRates[rateIndex] = reply.ReadInt32(); } - int32_t result = reply.ReadInt32(); - return result; + return screenSupportedRates; } - -int32_t RSRenderServiceConnectionProxy::SetPointerColorInversionEnabled(bool enable) + +ErrCode RSRenderServiceConnectionProxy::GetShowRefreshRateEnabled(bool& enable) { MessageParcel data; MessageParcel reply; MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetPointerColorInversionEnabled: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteBool(enable)) { - ROSEN_LOGE("SetPointerColorInversionEnabled: WriteBool enable err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED); + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SHOW_REFRESH_RATE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::DisableCursorInvert: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return ERR_INVALID_VALUE; } - int32_t result = reply.ReadInt32(); - return result; + if (!reply.ReadBool(enable)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read enable failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; } - -int32_t RSRenderServiceConnectionProxy::RegisterPointerLuminanceChangeCallback( - sptr callback) + +void RSRenderServiceConnectionProxy::SetShowRefreshRateEnabled(bool enabled, int32_t type) { - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterPointerLuminanceChangeCallback: callback is nullptr."); - return INVALID_ARGUMENTS; - } - MessageParcel data; MessageParcel reply; MessageOption option; - + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("SetShowRefreshRateEnabled: WriteInterfaceToken GetDescriptor err."); + return; } - - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterPointerLuminanceChangeCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteBool(enabled) || !data.WriteInt32(type)) { + ROSEN_LOGE("SetShowRefreshRateEnabled: WriteBool[enable] OR WriteInt32[type] err."); + return; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SHOW_REFRESH_RATE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterPointerLuminanceChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return; } - int32_t result = reply.ReadInt32(); - return result; } - -int32_t RSRenderServiceConnectionProxy::UnRegisterPointerLuminanceChangeCallback() + +uint32_t RSRenderServiceConnectionProxy::GetRealtimeRefreshRate(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("UnRegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetRealtimeRefreshRate: WriteInterfaceToken GetDescriptor err."); + return SUCCESS; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK); + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetRealtimeRefreshRate: WriteUint64 id err."); + return SUCCESS; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REALTIME_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnRegisterPointerLuminanceChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + return SUCCESS; } - int32_t result = reply.ReadInt32(); - return result; + uint32_t rate{0}; + if (!reply.ReadUint32(rate)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRealtimeRefreshRate Read rate failed"); + return READ_PARCEL_ERR; + } + return rate; } -#endif -int32_t RSRenderServiceConnectionProxy::SetScreenChangeCallback(sptr callback) +ErrCode RSRenderServiceConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) { - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: callback is nullptr."); - return INVALID_ARGUMENTS; - } - MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenChangeCallback: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetRefreshInfo: WriteInterfaceToken GetDescriptor err."); + enable = ""; + return ERR_INVALID_VALUE; } - - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("SetScreenChangeCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("GetRefreshInfo: WriteInt32 pid err."); + enable = ""; + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CHANGE_CALLBACK); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + enable = ""; + return ERR_INVALID_VALUE; } - int32_t result = reply.ReadInt32(); - return result; + + if (!reply.ReadString(enable)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); + return ERR_INVALID_VALUE; + } + return ERR_OK; } -void RSRenderServiceConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) +ErrCode RSRenderServiceConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("GetRefreshInfoToSP: WriteInterfaceToken GetDescriptor err."); + enable = ""; + return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenActiveMode: WriteUint64 id err."); - return; - } - if (!data.WriteUint32(modeId)) { - ROSEN_LOGE("SetScreenActiveMode: WriteUint32 modeId err."); - return; + ROSEN_LOGE("GetRefreshInfoToSP: WriteUint64 id err."); + enable = ""; + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_MODE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - return; + ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + enable = ""; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadString(enable)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); + return ERR_INVALID_VALUE; } + return ERR_OK; } -void RSRenderServiceConnectionProxy::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) +int32_t RSRenderServiceConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); - return; + MessageOption option(MessageOption::TF_SYNC); + if (!data.WriteInterfaceToken(GetDescriptor())) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; } - option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenRefreshRate: WriteUint64 id err."); - return; + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - if (!data.WriteInt32(sceneId)) { - ROSEN_LOGE("SetScreenRefreshRate: WriteInt32 sceneId err."); - return; + if (!data.WriteUint32(width)) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 width err."); + return WRITE_PARCEL_ERR; } - if (!data.WriteInt32(rate)) { - ROSEN_LOGE("SetScreenRefreshRate: WriteInt32 rate err."); - return; + if (!data.WriteUint32(height)) { + ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 height err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_REFRESH_RATE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return; + auto code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION); + if (SendRequest(code, data, reply, option) != ERR_NONE) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); + return RS_CONNECTION_ERROR; + } + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution Read status failed"); + return READ_PARCEL_ERR; } + return status; } -void RSRenderServiceConnectionProxy::SetRefreshRateMode(int32_t refreshRateMode) +int32_t RSRenderServiceConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetRefreshRateMode: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("SetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; } option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteInt32(refreshRateMode)) { - ROSEN_LOGE("SetRefreshRateMode: WriteInt32 refreshRateMode err."); - return; + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_REFRESH_RATE_MODE); + if (!data.WriteUint32(width)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 width err."); + return WRITE_PARCEL_ERR; + } + if (!data.WriteUint32(height)) { + ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 height err."); + return WRITE_PARCEL_ERR; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return; + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t status{0}; + if (!reply.ReadInt32(status)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution Read status failed"); + return READ_PARCEL_ERR; } + return status; } -void RSRenderServiceConnectionProxy::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, - int32_t animatorExpectedFrameRate) +ErrCode RSRenderServiceConnectionProxy::RepaintEverything() { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SyncFrameRateRange: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("RSRenderServiceConnectionProxy::RepaintEverything: Send Request err."); + return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SyncFrameRateRange: WriteUint64 id err."); - return; - } - if (!data.WriteUint32(range.min_) || !data.WriteUint32(range.max_) || - !data.WriteUint32(range.preferred_) || !data.WriteUint32(range.type_) || - !data.WriteUint32(range.componentScene_)) { - ROSEN_LOGE("SyncFrameRateRange: WriteUint32 range err."); - return; - } - if (!data.WriteInt32(animatorExpectedFrameRate)) { - ROSEN_LOGE("SyncFrameRateRange: WriteInt32 animatorExpectedFrameRate err."); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return; + return ERR_INVALID_VALUE; } + return ERR_OK; } -void RSRenderServiceConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) + +void RSRenderServiceConnectionProxy::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("UnregisterFrameRateLinker: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("SetScreenPowerStatus: WriteInterfaceToken GetDescriptor err."); return; } - - option.SetFlags(MessageOption::TF_ASYNC); + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("UnregisterFrameRateLinker: WriteUint64 id err."); + ROSEN_LOGE("SetScreenPowerStatus: WriteUint64 id err."); return; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER); + if (!data.WriteUint32(static_cast(status))) { + ROSEN_LOGE("SetScreenPowerStatus: WriteUint32 status err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_POWER_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("SetScreenPowerStatus: SendRequest failed %{public}d", err); return; } } -uint32_t RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate(ScreenId id) +ErrCode RSRenderServiceConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) { + if (app == nullptr) { + ROSEN_LOGE("%{public}s callback == nullptr", __func__); + return ERR_INVALID_VALUE; + } + MessageParcel data; MessageParcel reply; MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenCurrentRefreshRate: WriteInterfaceToken GetDescriptor err."); - return SUCCESS; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenCurrentRefreshRate: WriteUint64 id err."); - return SUCCESS; + option.SetFlags(MessageOption::TF_ASYNC); + if (!data.WriteRemoteObject(app->AsObject())) { + ROSEN_LOGE("%{public}s WriteRemoteObject failed", __func__); + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CURRENT_REFRESH_RATE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return SUCCESS; + ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); + return ERR_INVALID_VALUE; } - uint32_t rate{0}; - if (!reply.ReadUint32(rate)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate Read rate failed"); - return READ_PARCEL_ERR; + return ERR_OK; +} + +bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureConfig( + const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) +{ + if (!data.WriteFloat(captureConfig.scaleX) || !data.WriteFloat(captureConfig.scaleY) || + !data.WriteBool(captureConfig.useDma) || !data.WriteBool(captureConfig.useCurWindow) || + !data.WriteUint8(static_cast(captureConfig.captureType)) || !data.WriteBool(captureConfig.isSync) || + !data.WriteBool(captureConfig.isHdrCapture) || + !data.WriteFloat(captureConfig.mainScreenRect.left_) || + !data.WriteFloat(captureConfig.mainScreenRect.top_) || + !data.WriteFloat(captureConfig.mainScreenRect.right_) || + !data.WriteFloat(captureConfig.mainScreenRect.bottom_) || + !data.WriteUint64(captureConfig.uiCaptureInRangeParam.endNodeId) || + !data.WriteBool(captureConfig.uiCaptureInRangeParam.useBeginNodeSize) || + !data.WriteFloat(captureConfig.specifiedAreaRect.left_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.top_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.right_) || + !data.WriteFloat(captureConfig.specifiedAreaRect.bottom_) || + !data.WriteUInt64Vector(captureConfig.blackList) || + !data.WriteUint32(captureConfig.backGroundColor)) { + ROSEN_LOGE("WriteSurfaceCaptureConfig: WriteSurfaceCaptureConfig captureConfig err."); + return false; } - return rate; + return true; } -int32_t RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode() +bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureBlurParam( + const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) +{ + if (!data.WriteBool(blurParam.isNeedBlur) || !data.WriteFloat(blurParam.blurRadius)) { + ROSEN_LOGE("WriteSurfaceCaptureBlurParam: WriteBool OR WriteFloat [blurParam] err."); + return false; + } + return true; +} + +bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureAreaRect( + const Drawing::Rect& specifiedAreaRect, MessageParcel& data) +{ + if (!data.WriteFloat(specifiedAreaRect.left_) || !data.WriteFloat(specifiedAreaRect.top_) || + !data.WriteFloat(specifiedAreaRect.right_) || !data.WriteFloat(specifiedAreaRect.bottom_)) { + ROSEN_LOGE("WriteSurfaceCaptureAreaRect: WriteFloat specifiedAreaRect err."); + return false; + } + return true; +} + +ErrCode RSRenderServiceConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); - return SUCCESS; + ROSEN_LOGE("GetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_CURRENT_REFRESH_RATE_MODE); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenActiveMode: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return SUCCESS; + ROSEN_LOGE("%{public}s: sendrequest error : %{public}d", __func__, err); + return ERR_INVALID_VALUE; } - int32_t refreshRateMode{0}; - if (!reply.ReadInt32(refreshRateMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read refreshRateMode failed"); - return READ_PARCEL_ERR; + + sptr pScreenModeInfo(reply.ReadParcelable()); + if (pScreenModeInfo == nullptr) { + ROSEN_LOGE("%{public}s: ScreenModeInfo is null", __func__); + return ERR_INVALID_VALUE; } - return refreshRateMode; + screenModeInfo = *pScreenModeInfo; + return ERR_OK; } -std::vector RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates(ScreenId id) +std::vector RSRenderServiceConnectionProxy::GetScreenSupportedModes(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - std::vector screenSupportedRates; + std::vector screenSupportedModes; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedRefreshRates: WriteInterfaceToken GetDescriptor err."); - return screenSupportedRates; + ROSEN_LOGE("GetScreenSupportedModes: WriteInterfaceToken GetDescriptor err."); + return screenSupportedModes; } + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedRefreshRates: WriteUint64 id err."); - return screenSupportedRates; + ROSEN_LOGE("GetScreenSupportedModes: WriteUint64 id err."); + return screenSupportedModes; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_REFRESH_RATES); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_MODES); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - return screenSupportedRates; + return screenSupportedModes; } - uint64_t rateCount{0}; - if (!reply.ReadUint64(rateCount)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates Read rateCount failed"); - return screenSupportedRates; + + uint64_t modeCount{0}; + if (!reply.ReadUint64(modeCount)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedModes Read modeCount failed"); + return screenSupportedModes; } size_t readableSize = reply.GetReadableBytes(); - size_t len = static_cast(rateCount); - if (len > readableSize || len > screenSupportedRates.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedRefreshRates " - "fail read vector, size : %{public}zu, readableSize : %{public}zu", len, readableSize); - return screenSupportedRates; + size_t len = static_cast(modeCount); + if (len > readableSize || len > screenSupportedModes.max_size()) { + RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedModes Fail read vector, size:%{public}zu," + "readableSize:%{public}zu", len, readableSize); + return screenSupportedModes; } - screenSupportedRates.resize(rateCount); - for (uint64_t rateIndex = 0; rateIndex < rateCount; rateIndex++) { - screenSupportedRates[rateIndex] = reply.ReadInt32(); + screenSupportedModes.resize(modeCount); + for (uint64_t modeIndex = 0; modeIndex < modeCount; modeIndex++) { + sptr itemScreenMode = reply.ReadParcelable(); + if (itemScreenMode == nullptr) { + continue; + } else { + screenSupportedModes[modeIndex] = *itemScreenMode; + } } - return screenSupportedRates; + return screenSupportedModes; } -ErrCode RSRenderServiceConnectionProxy::GetShowRefreshRateEnabled(bool& enable) +ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); + ROSEN_LOGE("GetMemoryGraphics: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SHOW_REFRESH_RATE_ENABLED); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); return ERR_INVALID_VALUE; } - if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read enable failed"); + + uint64_t count{0}; + if (!reply.ReadUint64(count)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetMemoryGraphics Read count failed"); + return ERR_INVALID_VALUE; + } + size_t readableSize = reply.GetReadableBytes(); + size_t len = static_cast(count); + if (len > readableSize || len > memoryGraphics.max_size()) { + RS_LOGE("RSRenderServiceConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," + " readableSize:%{public}zu", len, readableSize); return ERR_INVALID_VALUE; } + memoryGraphics.resize(count); + for (uint64_t index = 0; index < count; index++) { + sptr item = reply.ReadParcelable(); + if (item == nullptr) { + continue; + } else { + memoryGraphics[index] = *item; + } + } return ERR_OK; } -void RSRenderServiceConnectionProxy::SetShowRefreshRateEnabled(bool enabled, int32_t type) +ErrCode RSRenderServiceConnectionProxy::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) { MessageParcel data; MessageParcel reply; MessageOption option; - + MemoryGraphic memoryGraphic; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetShowRefreshRateEnabled: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("GetTotalAppMemSize: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteBool(enabled) || !data.WriteInt32(type)) { - ROSEN_LOGE("SetShowRefreshRateEnabled: WriteBool[enable] OR WriteInt32[type] err."); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SHOW_REFRESH_RATE_ENABLED); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return; + return ERR_INVALID_VALUE; + } + + if (!reply.ReadFloat(cpuMemSize) || !reply.ReadFloat(gpuMemSize)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetTotalAppMemSize Read MemSize failed"); + return READ_PARCEL_ERR; } + return ERR_OK; } -uint32_t RSRenderServiceConnectionProxy::GetRealtimeRefreshRate(ScreenId id) +ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetRealtimeRefreshRate: WriteInterfaceToken GetDescriptor err."); - return SUCCESS; + ROSEN_LOGE("GetMemoryGraphic: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetRealtimeRefreshRate: WriteUint64 id err."); - return SUCCESS; + if (!data.WriteInt32(pid)) { + ROSEN_LOGE("GetMemoryGraphic: WriteInt32 pid err."); + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REALTIME_REFRESH_RATE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - return SUCCESS; + return ERR_INVALID_VALUE; } - uint32_t rate{0}; - if (!reply.ReadUint32(rate)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRealtimeRefreshRate Read rate failed"); - return READ_PARCEL_ERR; + sptr pMemoryGraphic(reply.ReadParcelable()); + if (pMemoryGraphic == nullptr) { + return ERR_INVALID_VALUE; } - return rate; + memoryGraphic = *pMemoryGraphic; + return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) +RSScreenCapability RSRenderServiceConnectionProxy::GetScreenCapability(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - + RSScreenCapability screenCapability; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetRefreshInfo: WriteInterfaceToken GetDescriptor err."); - enable = ""; - return ERR_INVALID_VALUE; + ROSEN_LOGE("GetScreenCapability: WriteInterfaceToken GetDescriptor err."); + return screenCapability; } option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteInt32(pid)) { - ROSEN_LOGE("GetRefreshInfo: WriteInt32 pid err."); - enable = ""; - return ERR_INVALID_VALUE; + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenCapability: WriteUint64 id err."); + return screenCapability; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CAPABILITY); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - enable = ""; - return ERR_INVALID_VALUE; + return screenCapability; } - if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); - return ERR_INVALID_VALUE; + sptr pScreenCapability(reply.ReadParcelable()); + if (pScreenCapability == nullptr) { + return screenCapability; } - return ERR_OK; + screenCapability = *pScreenCapability; + return screenCapability; } -ErrCode RSRenderServiceConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) +ErrCode RSRenderServiceConnectionProxy::GetScreenPowerStatus(uint64_t screenId, uint32_t& status) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetRefreshInfoToSP: WriteInterfaceToken GetDescriptor err."); - enable = ""; + ROSEN_LOGE("GetScreenPowerStatus: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetRefreshInfoToSP: WriteUint64 id err."); - enable = ""; + if (!data.WriteUint64(screenId)) { + ROSEN_LOGE("GetScreenPowerStatus: WriteUint64 id err."); return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_POWER_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); - enable = ""; - return ERR_INVALID_VALUE; - } - - if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); return ERR_INVALID_VALUE; } + status = reply.ReadUint32(); return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +RSScreenData RSRenderServiceConnectionProxy::GetScreenData(ScreenId id) { MessageParcel data; MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - if (!data.WriteInterfaceToken(GetDescriptor())) { - ROSEN_LOGE("SetPhysicalScreenResolution: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + MessageOption option; + RSScreenData screenData; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenData: WriteInterfaceToken GetDescriptor err."); + return screenData; } + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(width)) { - ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 width err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(height)) { - ROSEN_LOGE("SetPhysicalScreenResolution: WriteUint32 height err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetScreenData: WriteUint64 id err."); + return screenData; } - auto code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION); - if (SendRequest(code, data, reply, option) != ERR_NONE) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); - return RS_CONNECTION_ERROR; + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_DATA); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return screenData; } - int32_t status{0}; - if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution Read status failed"); - return READ_PARCEL_ERR; + sptr pScreenData(reply.ReadParcelable()); + if (pScreenData == nullptr) { + return screenData; } - return status; + screenData = *pScreenData; + return screenData; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +ErrCode RSRenderServiceConnectionProxy::GetScreenBacklight(uint64_t id, int32_t& level) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetScreenBacklight: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenResolution: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(width)) { - ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 width err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(height)) { - ROSEN_LOGE("SetVirtualScreenResolution: WriteUint32 height err."); - return WRITE_PARCEL_ERR; + ROSEN_LOGE("GetScreenBacklight: WriteUint64 id err."); + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_BACK_LIGHT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution: Send Request err."); - return RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; } - int32_t status{0}; - if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution Read status failed"); - return READ_PARCEL_ERR; + if (!reply.ReadInt32(level)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenBacklight Read level failed"); + return ERR_INVALID_VALUE; } - return status; + return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::MarkPowerOffNeedProcessOneFrame() +void RSRenderServiceConnectionProxy::SetScreenBacklight(ScreenId id, uint32_t level) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::MarkPowerOffNeedProcessOneFrame: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("SetScreenBacklight: WriteInterfaceToken GetDescriptor err."); + return; } option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = - static_cast(RSIRenderServiceConnectionInterfaceCode::MARK_POWER_OFF_NEED_PROCESS_ONE_FRAME); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenBacklight: WriteUint64 id err."); + return; + } + if (!data.WriteUint32(level)) { + ROSEN_LOGE("SetScreenBacklight: WriteUint32 level err."); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_BACK_LIGHT); int32_t err = SendRequest(code, data, reply, option); - return err != NO_ERROR ? ERR_INVALID_VALUE : ERR_OK; + if (err != NO_ERROR) { + ROSEN_LOGE("SetScreenBacklight: SendRequest failed"); + return; + } } -ErrCode RSRenderServiceConnectionProxy::RepaintEverything() +ErrCode RSRenderServiceConnectionProxy::RegisterBufferClearListener( + NodeId id, sptr callback) { + if (callback == nullptr) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: callback is nullptr."); + return ERR_INVALID_VALUE; + } + MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RepaintEverything: Send Request err."); + ROSEN_LOGE("RegisterBufferClearListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = - static_cast(RSIRenderServiceConnectionInterfaceCode::REPAINT_EVERYTHING); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RegisterBufferClearListener: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterBufferClearListener: WriteRemoteObject callback->AsObject() err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::ForceRefreshOneFrameWithNextVSync() +ErrCode RSRenderServiceConnectionProxy::RegisterBufferAvailableListener( + NodeId id, sptr callback, bool isFromRenderThread) { + if (callback == nullptr) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); + return ERR_INVALID_VALUE; + } + MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ForceRefreshOneFrameWithNextVSync: Send Request err."); + ROSEN_LOGE("RegisterBufferAvailableListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = - static_cast(RSIRenderServiceConnectionInterfaceCode::FORCE_REFRESH_ONE_FRAME_WITH_NEXT_VSYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteUint64 id err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteRemoteObject(callback->AsObject())) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteRemoteObject callback->AsObject() err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(isFromRenderThread)) { + ROSEN_LOGE("RegisterBufferAvailableListener: WriteBool isFromRenderThread err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderServiceConnectionProxy::DisablePowerOffRenderControl(ScreenId id) +int32_t RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("DisablePowerOffRenderControl: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("GetScreenSupportedColorGamuts: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("DisablePowerOffRenderControl: WriteUint64 id err."); - return; + ROSEN_LOGE("GetScreenSupportedColorGamuts: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_GAMUTS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - return; + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts Read result failed"); + return READ_PARCEL_ERR; + } + if (result == SUCCESS) { + mode.clear(); + std::vector modeRecv; + reply.ReadUInt32Vector(&modeRecv); + for (auto i : modeRecv) { + mode.push_back(static_cast(i)); + } } + return result; } -void RSRenderServiceConnectionProxy::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) +int32_t RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys( + ScreenId id, std::vector& keys) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenPowerStatus: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("GetScreenSupportedMetaDataKeys: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenPowerStatus: WriteUint64 id err."); - return; - } - if (!data.WriteUint32(static_cast(status))) { - ROSEN_LOGE("SetScreenPowerStatus: WriteUint32 status err."); - return; + ROSEN_LOGE("GetScreenSupportedMetaDataKeys: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_POWER_STATUS); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_METADATAKEYS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("SetScreenPowerStatus: SendRequest failed %{public}d", err); - return; - } -} - -ErrCode RSRenderServiceConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) -{ - if (app == nullptr) { - ROSEN_LOGE("%{public}s callback == nullptr", __func__); - return ERR_INVALID_VALUE; + return RS_CONNECTION_ERROR; } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteRemoteObject(app->AsObject())) { - ROSEN_LOGE("%{public}s WriteRemoteObject failed", __func__); - return ERR_INVALID_VALUE; + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys Read result failed"); + return READ_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_APPLICATION_AGENT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return ERR_INVALID_VALUE; + if (result == SUCCESS) { + keys.clear(); + std::vector keyRecv; + reply.ReadUInt32Vector(&keyRecv); + for (auto i : keyRecv) { + keys.push_back(static_cast(i)); + } } - return ERR_OK; + return result; } -void RSRenderServiceConnectionProxy::TakeSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, - const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions /* permissions */) +int32_t RSRenderServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) { - if (callback == nullptr) { - ROSEN_LOGE("%{public}s callback == nullptr", __func__); - return; - } - MessageParcel data; MessageParcel reply; MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("%{public}s write id failed", __func__); - return; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("%{public}s write callback failed", __func__); - return; - } - if (!WriteSurfaceCaptureConfig(captureConfig, data)) { - ROSEN_LOGE("%{public}s write captureConfig failed", __func__); - return; - } - if (!WriteSurfaceCaptureBlurParam(blurParam, data)) { - ROSEN_LOGE("%{public}s write blurParam failed", __func__); - return; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - if (!WriteSurfaceCaptureAreaRect(specifiedAreaRect, data)) { - ROSEN_LOGE("%{public}s write specifiedAreaRect failed", __func__); - return; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenColorGamut: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return; + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read result failed"); + return READ_PARCEL_ERR; + } + if (result == SUCCESS) { + uint32_t readMode{0}; + if (!reply.ReadUint32(readMode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read mode failed"); + return READ_PARCEL_ERR; + } + mode = static_cast(readMode); } + return result; } -std::vector>> RSRenderServiceConnectionProxy::TakeSurfaceCaptureSoloNode( - NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions) +int32_t RSRenderServiceConnectionProxy::SetScreenColorGamut(ScreenId id, int32_t modeIdx) { MessageParcel data; MessageParcel reply; MessageOption option; - std::vector>> pixelMapIdPairVector; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("%{public}s write id failed", __func__); - return pixelMapIdPairVector; + ROSEN_LOGE("SetScreenColorGamut: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - if (!WriteSurfaceCaptureConfig(captureConfig, data)) { - ROSEN_LOGE("%{public}s write captureConfig failed", __func__); - return pixelMapIdPairVector; + if (!data.WriteInt32(modeIdx)) { + ROSEN_LOGE("SetScreenColorGamut: WriteInt32 modeIdx err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE_SOLO); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return pixelMapIdPairVector; + return RS_CONNECTION_ERROR; } - if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapIdPairVector)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::TakeSurfaceCaptureSoloNode Unmarshalling failed"); + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenColorGamut Read result failed"); + return READ_PARCEL_ERR; } - return pixelMapIdPairVector; + return result; } -void RSRenderServiceConnectionProxy::TakeSelfSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig) +int32_t RSRenderServiceConnectionProxy::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) { - if (callback == nullptr) { - ROSEN_LOGE("%{public}s callback == nullptr", __func__); - return; - } - MessageParcel data; MessageParcel reply; MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("%{public}s write id failed", __func__); - return; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("%{public}s write callback failed", __func__); - return; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenGamutMap: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - if (!WriteSurfaceCaptureConfig(captureConfig, data)) { - ROSEN_LOGE("%{public}s write captureConfig failed", __func__); - return; + if (!data.WriteUint32(mode)) { + ROSEN_LOGE("SetScreenGamutMap: WriteUint32 mode err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SELF_SURFACE_CAPTURE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT_MAP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return; + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenGamutMap Read result failed"); + return READ_PARCEL_ERR; } + return result; } -ErrCode RSRenderServiceConnectionProxy::SetWindowFreezeImmediately(NodeId id, bool isFreeze, - sptr callback, const RSSurfaceCaptureConfig& captureConfig, - const RSSurfaceCaptureBlurParam& blurParam) +int32_t RSRenderServiceConnectionProxy::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) { MessageParcel data; MessageParcel reply; MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("%{public}s write id failed", __func__); - return ERR_INVALID_VALUE; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("SetScreenCorrection: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - if (!data.WriteBool(isFreeze)) { - ROSEN_LOGE("%{public}s write isFreeze failed", __func__); - return ERR_INVALID_VALUE; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenCorrection: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - if (isFreeze) { - if (callback == nullptr) { - ROSEN_LOGE("%{public}s callback == nullptr", __func__); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("%{public}s write callback failed", __func__); - return ERR_INVALID_VALUE; - } - if (!WriteSurfaceCaptureConfig(captureConfig, data)) { - ROSEN_LOGE("%{public}s write captureConfig failed", __func__); - return ERR_INVALID_VALUE; - } - if (!WriteSurfaceCaptureBlurParam(blurParam, data)) { - ROSEN_LOGE("%{public}s write blurParam failed", __func__); - return ERR_INVALID_VALUE; - } + if (!data.WriteUint32(static_cast(screenRotation))) { + ROSEN_LOGE("SetScreenCorrection: WriteUint32 screenRotation err."); + return WRITE_PARCEL_ERR; } - - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_FREEZE_IMMEDIATELY); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CORRECTION); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return ERR_INVALID_VALUE; + return RS_CONNECTION_ERROR; } - return ERR_OK; + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenCorrection Read result failed"); + return READ_PARCEL_ERR; + } + return result; } -void RSRenderServiceConnectionProxy::TakeUICaptureInRange( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) +int32_t RSRenderServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { - if (callback == nullptr) { - ROSEN_LOGE("%{public}s callback == nullptr", __func__); - return; - } - MessageParcel data; MessageParcel reply; MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("%{public}s write id failed", __func__); - return; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("%{public}s write callback failed", __func__); - return; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + ROSEN_LOGE("GetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - if (!WriteSurfaceCaptureConfig(captureConfig, data)) { - ROSEN_LOGE("%{public}s write captureConfig failed", __func__); - return; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenGamutMap: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_UI_CAPTURE_IN_RANGE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT_MAP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s SendRequest() error[%{public}d]", __func__, err); - return; + return RS_CONNECTION_ERROR; } -} - -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureConfig( - const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) -{ - if (!data.WriteFloat(captureConfig.scaleX) || !data.WriteFloat(captureConfig.scaleY) || - !data.WriteBool(captureConfig.useDma) || !data.WriteBool(captureConfig.useCurWindow) || - !data.WriteUint8(static_cast(captureConfig.captureType)) || !data.WriteBool(captureConfig.isSync) || - !data.WriteBool(captureConfig.isHdrCapture) || - !data.WriteFloat(captureConfig.mainScreenRect.left_) || - !data.WriteFloat(captureConfig.mainScreenRect.top_) || - !data.WriteFloat(captureConfig.mainScreenRect.right_) || - !data.WriteFloat(captureConfig.mainScreenRect.bottom_) || - !data.WriteUint64(captureConfig.uiCaptureInRangeParam.endNodeId) || - !data.WriteBool(captureConfig.uiCaptureInRangeParam.useBeginNodeSize) || - !data.WriteFloat(captureConfig.specifiedAreaRect.left_) || - !data.WriteFloat(captureConfig.specifiedAreaRect.top_) || - !data.WriteFloat(captureConfig.specifiedAreaRect.right_) || - !data.WriteFloat(captureConfig.specifiedAreaRect.bottom_) || - !data.WriteUInt64Vector(captureConfig.blackList) || - !data.WriteUint32(captureConfig.backGroundColor)) { - ROSEN_LOGE("WriteSurfaceCaptureConfig: WriteSurfaceCaptureConfig captureConfig err."); - return false; - } - return true; -} - -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureBlurParam( - const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) -{ - if (!data.WriteBool(blurParam.isNeedBlur) || !data.WriteFloat(blurParam.blurRadius)) { - ROSEN_LOGE("WriteSurfaceCaptureBlurParam: WriteBool OR WriteFloat [blurParam] err."); - return false; - } - return true; -} - -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureAreaRect( - const Drawing::Rect& specifiedAreaRect, MessageParcel& data) -{ - if (!data.WriteFloat(specifiedAreaRect.left_) || !data.WriteFloat(specifiedAreaRect.top_) || - !data.WriteFloat(specifiedAreaRect.right_) || !data.WriteFloat(specifiedAreaRect.bottom_)) { - ROSEN_LOGE("WriteSurfaceCaptureAreaRect: WriteFloat specifiedAreaRect err."); - return false; - } - return true; -} - -ErrCode RSRenderServiceConnectionProxy::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, - float positionZ, float positionW) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(rsNodeId)) { - ROSEN_LOGE("SetHwcNodeBounds write id failed"); - return ERR_INVALID_VALUE; - } - if (!data.WriteFloat(positionX) || !data.WriteFloat(positionY) || !data.WriteFloat(positionZ) || - !data.WriteFloat(positionW)) { - ROSEN_LOGE("SetHwcNodeBounds write bound failed"); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_POSITION); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("SetHwcNodeBounds SendRequest() error[%{public}d]", err); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -RSVirtualScreenResolution RSRenderServiceConnectionProxy::GetVirtualScreenResolution(ScreenId id) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - RSVirtualScreenResolution virtualScreenResolution; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); - return virtualScreenResolution; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetVirtualScreenResolution: WriteUint64 id err."); - return virtualScreenResolution; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return virtualScreenResolution; - } - - sptr pVirtualScreenResolution(reply.ReadParcelable()); - if (pVirtualScreenResolution == nullptr) { - return virtualScreenResolution; - } - virtualScreenResolution = *pVirtualScreenResolution; - return virtualScreenResolution; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenActiveMode: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s: sendrequest error : %{public}d", __func__, err); - return ERR_INVALID_VALUE; - } - - sptr pScreenModeInfo(reply.ReadParcelable()); - if (pScreenModeInfo == nullptr) { - ROSEN_LOGE("%{public}s: ScreenModeInfo is null", __func__); - return ERR_INVALID_VALUE; - } - screenModeInfo = *pScreenModeInfo; - return ERR_OK; -} - -std::vector RSRenderServiceConnectionProxy::GetScreenSupportedModes(ScreenId id) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - std::vector screenSupportedModes; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedModes: WriteInterfaceToken GetDescriptor err."); - return screenSupportedModes; - } - - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedModes: WriteUint64 id err."); - return screenSupportedModes; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_MODES); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return screenSupportedModes; - } - - uint64_t modeCount{0}; - if (!reply.ReadUint64(modeCount)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedModes Read modeCount failed"); - return screenSupportedModes; - } - size_t readableSize = reply.GetReadableBytes(); - size_t len = static_cast(modeCount); - if (len > readableSize || len > screenSupportedModes.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedModes Fail read vector, size:%{public}zu," - "readableSize:%{public}zu", len, readableSize); - return screenSupportedModes; - } - screenSupportedModes.resize(modeCount); - for (uint64_t modeIndex = 0; modeIndex < modeCount; modeIndex++) { - sptr itemScreenMode = reply.ReadParcelable(); - if (itemScreenMode == nullptr) { - continue; - } else { - screenSupportedModes[modeIndex] = *itemScreenMode; - } - } - return screenSupportedModes; -} - -ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetMemoryGraphics: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHICS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - - uint64_t count{0}; - if (!reply.ReadUint64(count)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetMemoryGraphics Read count failed"); - return ERR_INVALID_VALUE; - } - size_t readableSize = reply.GetReadableBytes(); - size_t len = static_cast(count); - if (len > readableSize || len > memoryGraphics.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," - " readableSize:%{public}zu", len, readableSize); - return ERR_INVALID_VALUE; - } - memoryGraphics.resize(count); - for (uint64_t index = 0; index < count; index++) { - sptr item = reply.ReadParcelable(); - if (item == nullptr) { - continue; - } else { - memoryGraphics[index] = *item; - } - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - MemoryGraphic memoryGraphic; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetTotalAppMemSize: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_TOTAL_APP_MEM_SIZE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - - if (!reply.ReadFloat(cpuMemSize) || !reply.ReadFloat(gpuMemSize)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetTotalAppMemSize Read MemSize failed"); - return READ_PARCEL_ERR; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetMemoryGraphic: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteInt32(pid)) { - ROSEN_LOGE("GetMemoryGraphic: WriteInt32 pid err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - sptr pMemoryGraphic(reply.ReadParcelable()); - if (pMemoryGraphic == nullptr) { - return ERR_INVALID_VALUE; - } - memoryGraphic = *pMemoryGraphic; - return ERR_OK; -} - -RSScreenCapability RSRenderServiceConnectionProxy::GetScreenCapability(ScreenId id) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - RSScreenCapability screenCapability; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenCapability: WriteInterfaceToken GetDescriptor err."); - return screenCapability; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenCapability: WriteUint64 id err."); - return screenCapability; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CAPABILITY); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return screenCapability; - } - - sptr pScreenCapability(reply.ReadParcelable()); - if (pScreenCapability == nullptr) { - return screenCapability; - } - screenCapability = *pScreenCapability; - return screenCapability; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenPowerStatus(uint64_t screenId, uint32_t& status) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenPowerStatus: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(screenId)) { - ROSEN_LOGE("GetScreenPowerStatus: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_POWER_STATUS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - status = reply.ReadUint32(); - return ERR_OK; -} - -RSScreenData RSRenderServiceConnectionProxy::GetScreenData(ScreenId id) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - RSScreenData screenData; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenData: WriteInterfaceToken GetDescriptor err."); - return screenData; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenData: WriteUint64 id err."); - return screenData; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_DATA); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return screenData; - } - sptr pScreenData(reply.ReadParcelable()); - if (pScreenData == nullptr) { - return screenData; - } - screenData = *pScreenData; - return screenData; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenBacklight(uint64_t id, int32_t& level) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenBacklight: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenBacklight: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_BACK_LIGHT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(level)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenBacklight Read level failed"); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -void RSRenderServiceConnectionProxy::SetScreenBacklight(ScreenId id, uint32_t level) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenBacklight: WriteInterfaceToken GetDescriptor err."); - return; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenBacklight: WriteUint64 id err."); - return; - } - if (!data.WriteUint32(level)) { - ROSEN_LOGE("SetScreenBacklight: WriteUint32 level err."); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_BACK_LIGHT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("SetScreenBacklight: SendRequest failed"); - return; - } -} - -ErrCode RSRenderServiceConnectionProxy::RegisterBufferClearListener( - NodeId id, sptr callback) -{ - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: callback is nullptr."); - return ERR_INVALID_VALUE; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterBufferClearListener: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("RegisterBufferClearListener: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterBufferClearListener: WriteRemoteObject callback->AsObject() err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::RegisterBufferAvailableListener( - NodeId id, sptr callback, bool isFromRenderThread) -{ - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); - return ERR_INVALID_VALUE; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterBufferAvailableListener: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("RegisterBufferAvailableListener: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterBufferAvailableListener: WriteRemoteObject callback->AsObject() err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(isFromRenderThread)) { - ROSEN_LOGE("RegisterBufferAvailableListener: WriteBool isFromRenderThread err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedColorGamuts: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedColorGamuts: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_GAMUTS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts Read result failed"); - return READ_PARCEL_ERR; - } - if (result == SUCCESS) { - mode.clear(); - std::vector modeRecv; - reply.ReadUInt32Vector(&modeRecv); - for (auto i : modeRecv) { - mode.push_back(static_cast(i)); - } - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys( - ScreenId id, std::vector& keys) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedMetaDataKeys: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedMetaDataKeys: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_METADATAKEYS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys Read result failed"); - return READ_PARCEL_ERR; - } - if (result == SUCCESS) { - keys.clear(); - std::vector keyRecv; - reply.ReadUInt32Vector(&keyRecv); - for (auto i : keyRecv) { - keys.push_back(static_cast(i)); - } - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenColorGamut: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read result failed"); - return READ_PARCEL_ERR; - } - if (result == SUCCESS) { - uint32_t readMode{0}; - if (!reply.ReadUint32(readMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read mode failed"); - return READ_PARCEL_ERR; - } - mode = static_cast(readMode); - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::SetScreenColorGamut(ScreenId id, int32_t modeIdx) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenColorGamut: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteInt32(modeIdx)) { - ROSEN_LOGE("SetScreenColorGamut: WriteInt32 modeIdx err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenColorGamut Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenGamutMap: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(mode)) { - ROSEN_LOGE("SetScreenGamutMap: WriteUint32 mode err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_GAMUT_MAP); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenGamutMap Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenCorrection: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenCorrection: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(static_cast(screenRotation))) { - ROSEN_LOGE("SetScreenCorrection: WriteUint32 screenRotation err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CORRECTION); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenCorrection Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenGamutMap: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT_MAP); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read result failed"); - return READ_PARCEL_ERR; - } - if (result == SUCCESS) { - uint32_t readMode{0}; - if (!reply.ReadUint32(readMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read mode failed"); - return READ_PARCEL_ERR; - } - mode = static_cast(readMode); - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenHDRCapability: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenHDRCapability: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRCapability Read result failed"); - return READ_PARCEL_ERR; - } - if (result != SUCCESS) { - return result; - } - sptr pScreenCapability = reply.ReadParcelable(); - if (pScreenCapability == nullptr) { - return RS_CONNECTION_ERROR; - } - screenHdrCapability = *pScreenCapability; - return SUCCESS; -} - -ErrCode RSRenderServiceConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetPixelFormat: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelFormat Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - uint32_t readFormat{0}; - if (!reply.ReadUint32(readFormat)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelFormat Read readFormat failed"); - return READ_PARCEL_ERR; - } - pixelFormat = static_cast(readFormat); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetPixelFormat: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUint32(static_cast(pixelFormat))) { - ROSEN_LOGE("GetPixelFormat: WriteUint32 pixelFormat err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - resCode = reply.ReadInt32(); - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedHDRFormats( - ScreenId id, std::vector& hdrFormats, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedHDRFormats: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedHDRFormats: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedHDRFormats Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - hdrFormats.clear(); - std::vector hdrFormatsRecv; - reply.ReadUInt32Vector(&hdrFormatsRecv); - std::transform(hdrFormatsRecv.begin(), hdrFormatsRecv.end(), back_inserter(hdrFormats), - [](uint32_t i) -> ScreenHDRFormat {return static_cast(i);}); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenHDRFormat: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRFormat Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - uint32_t readFormat{0}; - if (!reply.ReadUint32(readFormat)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRFormat1 Read readFormat failed"); - return READ_PARCEL_ERR; - } - hdrFormat = static_cast(readFormat); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenHDRFormat: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(modeIdx)) { - ROSEN_LOGE("SetScreenHDRFormat: WriteInt32 modeIdx err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_HDR_FORMAT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - resCode = reply.ReadInt32(); - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); - return RS_CONNECTION_ERROR; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - uint32_t readHdrStatus{0}; - if (!reply.ReadUint32(readHdrStatus)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read HDR status failed"); - return READ_PARCEL_ERR; - } - hdrStatus = static_cast(readHdrStatus); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces( - ScreenId id, std::vector& colorSpaces, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - colorSpaces.clear(); - std::vector colorSpacesRecv; - reply.ReadUInt32Vector(&colorSpacesRecv); - std::transform(colorSpacesRecv.begin(), colorSpacesRecv.end(), back_inserter(colorSpaces), - [](uint32_t i) -> GraphicCM_ColorSpaceType {return static_cast(i);}); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetScreenColorSpace( - ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenColorSpace: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read resCode failed"); - return READ_PARCEL_ERR; - } - if (resCode == SUCCESS) { - uint32_t type{0}; - if (!reply.ReadUint32(type)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read type failed"); - return READ_PARCEL_ERR; - } - colorSpace = static_cast(type); - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetScreenColorSpace( - ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenColorSpace: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(colorSpace)) { - ROSEN_LOGE("SetScreenColorSpace: WriteInt32 colorSpace err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - resCode = reply.ReadInt32(); - return ERR_OK; -} - -int32_t RSRenderServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& screenType) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetScreenType: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetScreenType: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result = reply.ReadInt32(); - if (result == SUCCESS) { - uint32_t type{0}; - if (!reply.ReadUint32(type)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenType Read type failed"); - return READ_PARCEL_ERR; - } - screenType = static_cast(type); - } - return result; -} - -ErrCode RSRenderServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetBitmap: WriteInterfaceToken GetDescriptor err."); - success = false; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetBitmap: WriteUint64 id err."); - success = false; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - success = false; - return ERR_INVALID_VALUE; - } - bool result{false}; - if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetBitmap Read result failed"); - return READ_PARCEL_ERR; - } - if (!result || !RSMarshallingHelper::Unmarshalling(reply, bitmap)) { - RS_LOGE("RSRenderServiceConnectionProxy::GetBitmap: Unmarshalling failed"); - success = false; - return ERR_INVALID_VALUE; - } - success = true; - return ERR_OK; -} - -bool RSRenderServiceConnectionProxy::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteInterfaceToken GetDescriptor err."); - return false; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteUint64 id err."); - return false; - } - if (!data.WriteBool(canvasRotation)) { - ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteBool canvasRotation err."); - return false; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return false; - } - bool result{false}; - if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualMirrorScreenCanvasRotation Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteBool(isAutoRotation)) { - ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteBool isAutoRotation err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::%{public}s: Send Request err.", __func__); - return RS_CONNECTION_ERROR; - } - int32_t result{-1}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::%{public}s Read result failed", __func__); - return READ_PARCEL_ERR; - } - return result; -} - -bool RSRenderServiceConnectionProxy::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteInterfaceToken GetDescriptor err."); - return false; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteUint64 id err."); - return false; - } - if (!data.WriteUint32(static_cast(scaleMode))) { - ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteUint32 scaleMode err."); - return false; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return false; - } - bool result{false}; - if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualMirrorScreenScaleMode Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -ErrCode RSRenderServiceConnectionProxy::SetGlobalDarkColorMode(bool isDark) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetGlobalDarkColorMode: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteBool(isDark)) { - ROSEN_LOGE("SetGlobalDarkColorMode: WriteBool isDark err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, - const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetPixelmap: WriteInterfaceToken GetDescriptor err."); - success = false; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("GetPixelmap: WriteUint64 id err."); - success = false; - return ERR_INVALID_VALUE; - } - if (!data.WriteParcelable(pixelmap.get())) { - ROSEN_LOGE("GetPixelmap: WriteParcelable pixelmap.get() err."); - success = false; - return ERR_INVALID_VALUE; - } - RSMarshallingHelper::Marshalling(data, *rect); - RSMarshallingHelper::Marshalling(data, drawCmdList); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - success = false; - return ERR_INVALID_VALUE; - } - bool result{false}; - if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelmap Read result failed"); - return READ_PARCEL_ERR; - } - if (!result || !RSMarshallingHelper::Unmarshalling(reply, pixelmap)) { - RS_LOGD("RSRenderServiceConnectionProxy::GetPixelmap: GetPixelmap failed"); - success = false; - return ERR_INVALID_VALUE; - } - success = true; - return ERR_OK; -} - -bool RSRenderServiceConnectionProxy::RegisterTypeface(uint64_t globalUniqueId, - std::shared_ptr& typeface) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterTypeface: WriteInterfaceToken GetDescriptor err."); - return false; - } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t hash = typeface->GetHash(); - if (!data.WriteUint64(globalUniqueId)) { - ROSEN_LOGE("RegisterTypeface: WriteUint64 globalUniqueId err."); - return false; - } - if (!data.WriteUint32(hash)) { - ROSEN_LOGE("RegisterTypeface: WriteUint32 hash err."); - return false; - } - - if (hash) { // if adapter does not provide hash, use old path - MessageParcel reply2; - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NEED_REGISTER_TYPEFACE); - int32_t err = SendRequest(code, data, reply2, option); - if (err != NO_ERROR) { - RS_LOGW("Check if RegisterTypeface is needed failed, err:%{public}d", err); - return false; - } - if (!reply2.ReadBool()) { - return true; // the hash exists on server, no need to resend full data - } - } - - RSMarshallingHelper::Marshalling(data, typeface); - - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - RS_LOGD("RSRenderServiceConnectionProxy::RegisterTypeface: RegisterTypeface failed"); - return false; - } - bool result{false}; - if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTypeface Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -bool RSRenderServiceConnectionProxy::UnRegisterTypeface(uint64_t globalUniqueId) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("UnRegisterTypeface: WriteInterfaceToken GetDescriptor err."); - return false; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(globalUniqueId)) { - ROSEN_LOGE("UnRegisterTypeface: WriteUint64 globalUniqueId err."); - return false; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - RS_LOGD("RSRenderServiceConnectionProxy::UnRegisterTypeface: send request failed"); - return false; - } - - return true; -} - -int32_t RSRenderServiceConnectionProxy::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, - std::vector& edidData) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - return RS_CONNECTION_ERROR; - } - if (!data.WriteUint64(id)) { - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DISPLAY_IDENTIFICATION_DATA); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData Read result failed"); - return READ_PARCEL_ERR; - } - if (result != SUCCESS) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: failed"); - return result; - } - if (!reply.ReadUint8(outPort)) { - return READ_PARCEL_ERR; - } - uint32_t edidSize = reply.ReadUint32(); - if (edidSize == 0 || edidSize > EDID_DATA_MAX_SIZE) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize failed"); - return READ_PARCEL_ERR; - } - edidData.resize(edidSize); - const uint8_t *editpnt = reply.ReadBuffer(edidSize); - if (editpnt == nullptr) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: ReadBuffer failed"); - return READ_PARCEL_ERR; - } - RS_LOGD("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize: %{public}u", edidSize); - edidData.assign(editpnt, editpnt + edidSize); - - return result; -} - -ErrCode RSRenderServiceConnectionProxy::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, - int32_t& resCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenSkipFrameInterval: WriteInterfaceToken GetDescriptor err."); - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenSkipFrameInterval: WriteUint64 id err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUint32(skipFrameInterval)) { - ROSEN_LOGE("SetScreenSkipFrameInterval: WriteUint32 skipFrameInterval err."); - resCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - resCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPixelFormat Read result failed"); - resCode = READ_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetVirtualScreenRefreshRate( - ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); - retVal = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteUint64 id err."); - retVal = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteUint32(maxRefreshRate)) { - ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteUint32 maxRefreshRate err."); - retVal = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_REFRESH_RATE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - retVal = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenRefreshRate Read result failed"); - retVal = READ_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (result == SUCCESS) { - if (!reply.ReadUint32(actualRefreshRate)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenRefreshRate Read actualRefreshRate failed"); - retVal = READ_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - } - retVal = result; - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetScreenActiveRect: WriteInterfaceToken GetDescriptor err."); - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetScreenActiveRect: WriteUint64 id err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(activeRect.x) || !data.WriteInt32(activeRect.y) || - !data.WriteInt32(activeRect.w) || !data.WriteInt32(activeRect.h)) { - ROSEN_LOGE("SetScreenActiveRect: WriteInt32 activeRect err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_RECT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - if (!reply.ReadUint32(repCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenActiveRect Read result failed"); - repCode = READ_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -void RSRenderServiceConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); - return; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id) || !data.WriteInt32(offSetX) || !data.WriteInt32(offSetY)) { - ROSEN_LOGE("%{public}s: write error.", __func__); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s: Send Request err.", __func__); - } -} - -void RSRenderServiceConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); - return; - } - option.SetFlags(MessageOption::TF_ASYNC); - - if (!data.WriteUint64(id) || !data.WriteInt32(gravity)) { - ROSEN_LOGE("%{public}s: write error.", __func__); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("%{public}s: Send Request err.", __func__); - } -} - -ErrCode RSRenderServiceConnectionProxy::RegisterOcclusionChangeCallback( - sptr callback, int32_t& repCode) -{ - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterOcclusionChangeCallback: callback is nullptr."); - repCode = INVALID_ARGUMENTS; - return ERR_INVALID_VALUE; - } - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterOcclusionChangeCallback: WriteRemoteObject callback->AsObject() err."); - repCode = WRITE_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - repCode = RS_CONNECTION_ERROR; - return ERR_INVALID_VALUE; - } - repCode = reply.ReadInt32(); - return ERR_OK; -} - -int32_t RSRenderServiceConnectionProxy::RegisterSurfaceOcclusionChangeCallback( - NodeId id, sptr callback, std::vector& partitionPoints) -{ - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceOcclusionChangeCallback: callback is nullptr."); - return INVALID_ARGUMENTS; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteFloatVector(partitionPoints)) { - ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteFloatVector partitionPoints err."); - return WRITE_PARCEL_ERR; - } - - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenHDRFormat Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("UnRegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("UnRegisterSurfaceOcclusionChangeCallback: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenColorSpace Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::RegisterHgmConfigChangeCallback(sptr callback) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterHgmConfigChangeCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterHgmConfigChangeCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmConfigChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmConfigChangeCallback Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::RegisterHgmRefreshRateModeChangeCallback( - sptr callback) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterHgmRefreshRateModeChangeCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterHgmRefreshRateModeChangeCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::RegisterHgmRefreshRateUpdateCallback( - sptr callback) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (callback) { - if (!data.WriteBool(true)) { - ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteBool [true] err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; - } - } else { - if (!data.WriteBool(false)) { - ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteBool [false] err."); - return WRITE_PARCEL_ERR; - } - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::RegisterFirstFrameCommitCallback( - sptr callback) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (callback) { - if (!data.WriteBool(true)) { - ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteBool [true] err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteRemoteObject callback->AsObject() err."); - return WRITE_PARCEL_ERR; - } - } else { - if (!data.WriteBool(false)) { - ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteBool [false] err."); - return WRITE_PARCEL_ERR; - } - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterFirstFrameCommitCallback: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result = reply.ReadInt32(); - return result; -} - -ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStart( - uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("AvcodecVideoStart: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(uniqueId)) { - ROSEN_LOGE("AvcodecVideoStart: WriteUint64 uniqueId err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteString(surfaceName)) { - ROSEN_LOGE("AvcodecVideoStart: WriteString surfaceName err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint32(fps)) { - ROSEN_LOGE("AvcodecVideoStart: WriteUint32 fps err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint64(reportTime)) { - ROSEN_LOGE("AvcodecVideoStart: WriteUint64 reportTime err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("AvcodecVideoStop: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(uniqueId)) { - ROSEN_LOGE("AvcodecVideoStop: WriteUint64 uniqueId err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteString(surfaceName)) { - ROSEN_LOGE("AvcodecVideoStop: WriteString surfaceName err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint32(fps)) { - ROSEN_LOGE("AvcodecVideoStop: WriteUint32 fps err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -int32_t RSRenderServiceConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, - sptr callback) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteInt32(dstPid)) { - ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteInt32 dstPid err."); - return WRITE_PARCEL_ERR; - } - if (callback) { - if (!data.WriteBool(true) || !data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteBool[T] OR WriteRemoteObject[CB] err"); - return WRITE_PARCEL_ERR; - } - } else { - if (!data.WriteBool(false)) { - ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteBool [false] err."); - return WRITE_PARCEL_ERR; - } - } - - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback: " - "Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE( - "RSRenderServiceConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback Read result failed"); - return READ_PARCEL_ERR; - } - return result; -} - -ErrCode RSRenderServiceConnectionProxy::SetAppWindowNum(uint32_t num) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetAppWindowNum: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint32(num)) { - ROSEN_LOGE("SetAppWindowNum: WriteUint32 num err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetAppWindowNum: Send Request err."); - return ERR_INVALID_VALUE; - } - - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetSystemAnimatedScenes( - SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetSystemAnimatedScenes: WriteInterfaceToken GetDescriptor err."); - success = false; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint32(static_cast(systemAnimatedScenes))) { - ROSEN_LOGE("SetSystemAnimatedScenes: WriteUint32 systemAnimatedScenes err."); - success = false; - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(isRegularAnimation)) { - ROSEN_LOGE("SetSystemAnimatedScenes: WriteBool isRegularAnimation err."); - success = false; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::SET_SYSTEM_ANIMATED_SCENES); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - success = false; - return ERR_INVALID_VALUE; - } - if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetSystemAnimatedScenes Read result failed"); - success = READ_PARCEL_ERR; - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::SetWatermark(const std::string& name, - std::shared_ptr watermark, bool& success) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetWatermark: WriteInterfaceToken GetDescriptor err."); - success = false; - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteString(name)) { - ROSEN_LOGE("SetWatermark: WriteString name err."); - success = false; - return ERR_INVALID_VALUE; - } - if (!data.WriteParcelable(watermark.get())) { - ROSEN_LOGE("SetWatermark: WriteParcelable watermark.get() err."); - success = false; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWatermark: Send Request err."); - success = false; - return ERR_INVALID_VALUE; - } - success = true; - return ERR_OK; -} - -void RSRenderServiceConnectionProxy::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) -{ - if (watermarkImg == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ShowWatermark: watermarkImg is nullptr."); - return; - } - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ShowWatermark: WriteInterfaceToken GetDescriptor err."); - return; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteParcelable(watermarkImg.get())) { - ROSEN_LOGE("ShowWatermark: WriteParcelable watermarkImg.get() err."); - return; - } - if (!data.WriteBool(isShow)) { - ROSEN_LOGE("ShowWatermark: WriteBool isShow err."); - return; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ShowWatermark: Send Request err."); - return; - } -} - -int32_t RSRenderServiceConnectionProxy::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ResizeVirtualScreen: WriteInterfaceToken GetDescriptor err."); - return WRITE_PARCEL_ERR; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("ResizeVirtualScreen: WriteUint64 id err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(width)) { - ROSEN_LOGE("ResizeVirtualScreen: WriteUint32 width err."); - return WRITE_PARCEL_ERR; - } - if (!data.WriteUint32(height)) { - ROSEN_LOGE("ResizeVirtualScreen: WriteUint32 height err."); - return WRITE_PARCEL_ERR; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ResizeVirtualScreen: Send Request err."); - return RS_CONNECTION_ERROR; - } - int32_t status{0}; - if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ResizeVirtualScreen Read status failed"); + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read result failed"); return READ_PARCEL_ERR; } - return status; -} - -ErrCode RSRenderServiceConnectionProxy::ReportJankStats() -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportJankStats: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportJankStats: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::ReportEventResponse(DataBaseRs info) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportEventResponse: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - ReportDataBaseRs(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportEventResponse: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::ReportEventComplete(DataBaseRs info) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportEventComplete: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - ReportDataBaseRs(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportEventComplete: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::ReportEventJankFrame(DataBaseRs info) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportEventJankFrame: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - ReportDataBaseRs(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportEventJankFrame: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -void RSRenderServiceConnectionProxy::ReportRsSceneJankStart(AppInfo info) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportRsSceneJankStart: WriteInterfaceToken GetDescriptor err."); - return; - } - WriteAppInfo(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportRsSceneJankStart: Send Request err."); - return; - } -} - -void RSRenderServiceConnectionProxy::ReportRsSceneJankEnd(AppInfo info) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportRsSceneJankEnd: WriteInterfaceToken GetDescriptor err."); - return; - } - WriteAppInfo(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportRsSceneJankEnd: Send Request err."); - return; - } -} - -void RSRenderServiceConnectionProxy::ReportDataBaseRs( - MessageParcel& data, MessageParcel& reply, MessageOption& option, DataBaseRs info) -{ - if (!data.WriteInt32(info.appPid)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.appPid err."); - return; - } - if (!data.WriteInt32(info.eventType)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.eventType err."); - return; - } - if (!data.WriteInt32(info.versionCode)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt32 info.versionCode err."); - return; - } - if (!data.WriteInt64(info.uniqueId)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.uniqueId err."); - return; - } - if (!data.WriteInt64(info.inputTime)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.inputTime err."); - return; - } - if (!data.WriteInt64(info.beginVsyncTime) || !data.WriteInt64(info.endVsyncTime)) { - ROSEN_LOGE("ReportDataBaseRs: WriteInt64 info.beginVsyncTime OR info.endVsyncTime err."); - return; - } - if (!data.WriteBool(info.isDisplayAnimator)) { - ROSEN_LOGE("ReportDataBaseRs: WriteBool info.isDisplayAnimator err."); - return; - } - if (!data.WriteString(info.sceneId)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.sceneId err."); - return; - } - if (!data.WriteString(info.versionName)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.versionName err."); - return; - } - if (!data.WriteString(info.bundleName)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.bundleName err."); - return; - } - if (!data.WriteString(info.processName)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.processName err."); - return; - } - if (!data.WriteString(info.abilityName)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.abilityName err."); - return; - } - if (!data.WriteString(info.pageUrl)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.pageUrl err."); - return; - } - if (!data.WriteString(info.sourceType)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.sourceType err."); - return; - } - if (!data.WriteString(info.note)) { - ROSEN_LOGE("ReportDataBaseRs: WriteString info.note err."); - return; - } - option.SetFlags(MessageOption::TF_ASYNC); -} - -void RSRenderServiceConnectionProxy::WriteAppInfo( - MessageParcel& data, MessageParcel& reply, MessageOption& option, AppInfo info) -{ - if (!data.WriteInt64(info.startTime)) { - ROSEN_LOGE("WriteAppInfo: WriteInt64 info.startTime err."); - return; - } - if (!data.WriteInt64(info.endTime)) { - ROSEN_LOGE("WriteAppInfo: WriteInt64 info.endTime err."); - return; - } - if (!data.WriteInt32(info.pid)) { - ROSEN_LOGE("WriteAppInfo: WriteInt32 info.pid err."); - return; - } - if (!data.WriteString(info.versionName)) { - ROSEN_LOGE("WriteAppInfo: WriteString info.versionName err."); - return; - } - if (!data.WriteInt32(info.versionCode)) { - ROSEN_LOGE("WriteAppInfo: WriteInt32 info.versionCode err."); - return; - } - if (!data.WriteString(info.bundleName)) { - ROSEN_LOGE("WriteAppInfo: WriteString info.bundleName err."); - return; - } - if (!data.WriteString(info.processName)) { - ROSEN_LOGE("WriteAppInfo: WriteString info.processName err."); - return; - } - option.SetFlags(MessageOption::TF_ASYNC); -} - -void RSRenderServiceConnectionProxy::ReportGameStateDataRs( - MessageParcel& data, MessageParcel& reply, MessageOption& option, GameStateData info) -{ - if (!data.WriteInt32(info.pid)) { - ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.pid err."); - return; - } - if (!data.WriteInt32(info.uid)) { - ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.uid err."); - return; - } - if (!data.WriteInt32(info.state)) { - ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.state err."); - return; - } - if (!data.WriteInt32(info.renderTid)) { - ROSEN_LOGE("ReportGameStateDataRs: WriteInt32 info.renderTid err."); - return; - } - if (!data.WriteString(info.bundleName)) { - ROSEN_LOGE("ReportGameStateDataRs: WriteString info.bundleName err."); - return; + if (result == SUCCESS) { + uint32_t readMode{0}; + if (!reply.ReadUint32(readMode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read mode failed"); + return READ_PARCEL_ERR; + } + mode = static_cast(readMode); } - option.SetFlags(MessageOption::TF_ASYNC); + return result; } -ErrCode RSRenderServiceConnectionProxy::ReportGameStateData(GameStateData info) +ErrCode RSRenderServiceConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("ReportGameStateData: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); + return WRITE_PARCEL_ERR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - ReportGameStateDataRs(data, reply, option, info); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ReportGameStateData: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); + return RS_CONNECTION_ERROR; + } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + uint32_t readHdrStatus{0}; + if (!reply.ReadUint32(readHdrStatus)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read HDR status failed"); + return READ_PARCEL_ERR; + } + hdrStatus = static_cast(readHdrStatus); } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, - SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) +ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces( + ScreenId id, std::vector& colorSpaces, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetHardwareEnabled: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetHardwareEnabled: WriteUint64 id err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(isEnabled)) { - ROSEN_LOGE("SetHardwareEnabled: WriteBool isEnabled err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint8(static_cast(selfDrawingType))) { - ROSEN_LOGE("SetHardwareEnabled: WriteUint8 selfDrawingType err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(dynamicHardwareEnable)) { - ROSEN_LOGE("SetHardwareEnabled: WriteBool dynamicHardwareEnable err."); + ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHardwareEnabled: Send Request err."); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + colorSpaces.clear(); + std::vector colorSpacesRecv; + reply.ReadUInt32Vector(&colorSpacesRecv); + std::transform(colorSpacesRecv.begin(), colorSpacesRecv.end(), back_inserter(colorSpaces), + [](uint32_t i) -> GraphicCM_ColorSpaceType {return static_cast(i);}); + } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +ErrCode RSRenderServiceConnectionProxy::GetScreenColorSpace( + ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetHidePrivacyContent: WriteInterfaceToken GetDescriptor err."); - resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + ROSEN_LOGE("GetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } + option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetHidePrivacyContent: WriteUint64 id err."); - resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(needHidePrivacyContent)) { - ROSEN_LOGE("SetHidePrivacyContent: WriteBool needHidePrivacyContent err."); - resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + ROSEN_LOGE("GetScreenColorSpace: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHidePrivacyContent: Send Request err."); - resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } - resCode = reply.ReadUint32(); + if (!reply.ReadInt32(resCode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read resCode failed"); + return READ_PARCEL_ERR; + } + if (resCode == SUCCESS) { + uint32_t type{0}; + if (!reply.ReadUint32(type)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read type failed"); + return READ_PARCEL_ERR; + } + colorSpace = static_cast(type); + } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::NotifyLightFactorStatus(int32_t lightFactorStatus) +ErrCode RSRenderServiceConnectionProxy::SetScreenColorSpace( + ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyLightFactorStatus: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("SetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } - if (!data.WriteInt32(lightFactorStatus)) { - ROSEN_LOGE("NotifyLightFactorStatus: WriteInt32 lightFactorStatus err."); + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenColorSpace: WriteUint64 id err."); + resCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS); + if (!data.WriteInt32(colorSpace)) { + ROSEN_LOGE("SetScreenColorSpace: WriteInt32 colorSpace err."); + resCode = WRITE_PARCEL_ERR; + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyLightFactorStatus: Send Request err."); + resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } + resCode = reply.ReadInt32(); return ERR_OK; } -void RSRenderServiceConnectionProxy::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) +int32_t RSRenderServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& screenType) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyPackageEvent: WriteInterfaceToken GetDescriptor err."); - return; - } - if (listSize != packageList.size()) { - ROSEN_LOGE("input size doesn't match"); - return; - } - if (!data.WriteUint32(listSize)) { - ROSEN_LOGE("NotifyPackageEvent: WriteUint32 listSize err."); - return; + ROSEN_LOGE("GetScreenType: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - for (auto pkg : packageList) { - if (!data.WriteString(pkg)) { - ROSEN_LOGE("NotifyPackageEvent: WriteString pkg err."); - return; - } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetScreenType: WriteUint64 id err."); + return WRITE_PARCEL_ERR; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyPackageEvent: Send Request err."); - return; + return RS_CONNECTION_ERROR; + } + int32_t result = reply.ReadInt32(); + if (result == SUCCESS) { + uint32_t type{0}; + if (!reply.ReadUint32(type)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenType Read type failed"); + return READ_PARCEL_ERR; + } + screenType = static_cast(type); } + return result; } -void RSRenderServiceConnectionProxy::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, - const std::vector>& newConfig) +ErrCode RSRenderServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - return; - } - - if (listSize != newConfig.size()) { - ROSEN_LOGE("input size doesn't match"); - return; - } - - if (!data.WriteString(pkgName) || !data.WriteUint32(listSize)) { - ROSEN_LOGE( - "RSRenderServiceConnectionProxy::NotifyAppStrategyConfigChangeEvent Write pakName or listSize failed."); - return; + ROSEN_LOGE("GetBitmap: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; } - - for (const auto& [key, value] : newConfig) { - if (!data.WriteString(key) || !data.WriteString(value)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyAppStrategyConfigChangeEvent Write key or value failed."); - return; - } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetBitmap: WriteUint64 id err."); + success = false; + return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyAppStrategyConfigChangeEvent: Send Request err."); - return; + success = false; + return ERR_INVALID_VALUE; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetBitmap Read result failed"); + return READ_PARCEL_ERR; + } + if (!result || !RSMarshallingHelper::Unmarshalling(reply, bitmap)) { + RS_LOGE("RSRenderServiceConnectionProxy::GetBitmap: Unmarshalling failed"); + success = false; + return ERR_INVALID_VALUE; } + success = true; + return ERR_OK; } -void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( - const std::unordered_map& eventInfos -) +ErrCode RSRenderServiceConnectionProxy::SetGlobalDarkColorMode(bool isDark) { - auto mapSize = eventInfos.size(); - if (mapSize <= ZERO || mapSize > MAX_VOTER_SIZE) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: map size err."); - return; - } - MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); - return; - } - if (!data.WriteUint32(mapSize)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint32 mapSize err."); - return; - } - for (const auto& [key, eventInfo] : eventInfos) { - if (!data.WriteUint64(key)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint64 key err."); - return; - } - if (!eventInfo.Serialize(data)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: Write eventInfo err."); - return; - } + ROSEN_LOGE("SetGlobalDarkColorMode: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID); + if (!data.WriteBool(isDark)) { + ROSEN_LOGE("SetGlobalDarkColorMode: WriteBool isDark err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); - return; + return ERR_INVALID_VALUE; } + return ERR_OK; } -void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( - const std::unordered_map& eventInfos -) +ErrCode RSRenderServiceConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, + const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) { - auto mapSize = eventInfos.size(); - if (mapSize <= ZERO || mapSize > MAX_VOTER_SIZE) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: map size err."); - return; - } - MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); - return; - } - if (!data.WriteUint32(mapSize)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint32 mapSize err."); - return; + ROSEN_LOGE("GetPixelmap: WriteInterfaceToken GetDescriptor err."); + success = false; + return ERR_INVALID_VALUE; } - for (const auto& [key, eventInfo] : eventInfos) { - if (!data.WriteString(key)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteString key err."); - return; - } - if (!eventInfo.Serialize(data)) { - ROSEN_LOGE("SetWindowExpectedRefreshRate: Write eventInfo err."); - return; - } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("GetPixelmap: WriteUint64 id err."); + success = false; + return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = - static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME); + if (!data.WriteParcelable(pixelmap.get())) { + ROSEN_LOGE("GetPixelmap: WriteParcelable pixelmap.get() err."); + success = false; + return ERR_INVALID_VALUE; + } + RSMarshallingHelper::Marshalling(data, *rect); + RSMarshallingHelper::Marshalling(data, drawCmdList); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); - return; + success = false; + return ERR_INVALID_VALUE; + } + bool result{false}; + if (!reply.ReadBool(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetPixelmap Read result failed"); + return READ_PARCEL_ERR; + } + if (!result || !RSMarshallingHelper::Unmarshalling(reply, pixelmap)) { + RS_LOGD("RSRenderServiceConnectionProxy::GetPixelmap: GetPixelmap failed"); + success = false; + return ERR_INVALID_VALUE; } + success = true; + return ERR_OK; } -void RSRenderServiceConnectionProxy::NotifyRefreshRateEvent(const EventInfo& eventInfo) +int32_t RSRenderServiceConnectionProxy::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, + std::vector& edidData) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteInterfaceToken GetDescriptor err."); - return; + return RS_CONNECTION_ERROR; } - if (!data.WriteString(eventInfo.eventName)) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteString eventInfo.eventName err."); - return; + if (!data.WriteUint64(id)) { + return WRITE_PARCEL_ERR; } - if (!data.WriteBool(eventInfo.eventStatus)) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteBool eventInfo.eventStatus err."); - return; + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DISPLAY_IDENTIFICATION_DATA); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + return RS_CONNECTION_ERROR; } - if (!data.WriteUint32(eventInfo.minRefreshRate)) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteUint32 eventInfo.minRefreshRate err."); - return; + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData Read result failed"); + return READ_PARCEL_ERR; } - if (!data.WriteUint32(eventInfo.maxRefreshRate)) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteUint32 eventInfo.maxRefreshRate err."); - return; + if (result != SUCCESS) { + RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: failed"); + return result; } - if (!data.WriteString(eventInfo.description)) { - ROSEN_LOGE("NotifyRefreshRateEvent: WriteString eventInfo.description err."); - return; + if (!reply.ReadUint8(outPort)) { + return READ_PARCEL_ERR; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_REFRESH_RATE_EVENT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyRefreshRateEvent: Send Request err."); - return; + uint32_t edidSize = reply.ReadUint32(); + if (edidSize == 0 || edidSize > EDID_DATA_MAX_SIZE) { + RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize failed"); + return READ_PARCEL_ERR; + } + edidData.resize(edidSize); + const uint8_t *editpnt = reply.ReadBuffer(edidSize); + if (editpnt == nullptr) { + RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: ReadBuffer failed"); + return READ_PARCEL_ERR; } + RS_LOGD("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize: %{public}u", edidSize); + edidData.assign(editpnt, editpnt + edidSize); + + return result; } -ErrCode RSRenderServiceConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +ErrCode RSRenderServiceConnectionProxy::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifySoftVsyncEvent: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("SetScreenActiveRect: WriteInterfaceToken GetDescriptor err."); + repCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } - if (!data.WriteUint32(pid)) { - ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 pid err."); + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetScreenActiveRect: WriteUint64 id err."); + repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } - if (!data.WriteUint32(rateDiscount)) { - ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 rateDiscount err."); + if (!data.WriteInt32(activeRect.x) || !data.WriteInt32(activeRect.y) || + !data.WriteInt32(activeRect.w) || !data.WriteInt32(activeRect.h)) { + ROSEN_LOGE("SetScreenActiveRect: WriteInt32 activeRect err."); + repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_ACTIVE_RECT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifySoftVsyncEvent: Send Request err."); + repCode = RS_CONNECTION_ERROR; + return ERR_INVALID_VALUE; + } + if (!reply.ReadUint32(repCode)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenActiveRect Read result failed"); + repCode = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } return ERR_OK; } -bool RSRenderServiceConnectionProxy::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, - uint32_t rateDiscount) +void RSRenderServiceConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteInterfaceToken GetDescriptor err."); - return false; - } - if (!data.WriteUint32(pid)) { - ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteUint32 pid err."); - return false; - } - if (!data.WriteString(name)) { - ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteString rateDiscount err."); - return false; - } - if (!data.WriteUint32(rateDiscount)) { - ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteUint32 rateDiscount err."); - return false; + ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); + return; } option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT); + if (!data.WriteUint64(id) || !data.WriteInt32(offSetX) || !data.WriteInt32(offSetY)) { + ROSEN_LOGE("%{public}s: write error.", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_OFFSET); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifySoftVsyncRateDiscountEvent: Send Request err."); - return false; - } - bool enable{false}; - if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifySoftVsyncRateDiscountEvent: Read enable failed"); - return false; + ROSEN_LOGE("%{public}s: Send Request err.", __func__); } - return enable; } -ErrCode RSRenderServiceConnectionProxy::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) +void RSRenderServiceConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyTouchEvent: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(touchStatus)) { - ROSEN_LOGE("NotifyTouchEvent: WriteInt32 touchStatus err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteInt32(touchCnt)) { - ROSEN_LOGE("NotifyTouchEvent: WriteInt32 touchCnt err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); + return; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT); + + if (!data.WriteUint64(id) || !data.WriteInt32(gravity)) { + ROSEN_LOGE("%{public}s: write error.", __func__); + return; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_FRAME_GRAVITY); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyTouchEvent: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("%{public}s: Send Request err.", __func__); } - return ERR_OK; } -void RSRenderServiceConnectionProxy::NotifyDynamicModeEvent(bool enableDynamicMode) +ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStart( + uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { MessageParcel data; MessageParcel reply; MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyDynamicModeEvent: WriteInterfaceToken GetDescriptor err."); - return; + ROSEN_LOGE("AvcodecVideoStart: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; } - if (!data.WriteBool(enableDynamicMode)) { - ROSEN_LOGE("NotifyDynamicModeEvent: WriteBool enableDynamicMode err."); - return; + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(uniqueId)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint64 uniqueId err."); + return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT); + if (!data.WriteString(surfaceName)) { + ROSEN_LOGE("AvcodecVideoStart: WriteString surfaceName err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(fps)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint32 fps err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(reportTime)) { + ROSEN_LOGE("AvcodecVideoStart: WriteUint64 reportTime err."); + return ERR_INVALID_VALUE; + } + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyDynamicModeEvent: Send Request err."); - return; + ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart: Send Request err."); + return RS_CONNECTION_ERROR; + } + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart Read result failed"); + return READ_PARCEL_ERR; } + return result; } -ErrCode RSRenderServiceConnectionProxy::NotifyHgmConfigEvent(const std::string &eventName, bool state) +ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) { MessageParcel data; MessageParcel reply; MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyHgmConfigEvent: GetDescriptor err."); + ROSEN_LOGE("AvcodecVideoStop: WriteInterfaceToken GetDescriptor err."); + return RS_CONNECTION_ERROR; + } + option.SetFlags(MessageOption::TF_SYNC); + if (!data.WriteUint64(uniqueId)) { + ROSEN_LOGE("AvcodecVideoStop: WriteUint64 uniqueId err."); return ERR_INVALID_VALUE; } - if (!data.WriteString(eventName)) { + if (!data.WriteString(surfaceName)) { + ROSEN_LOGE("AvcodecVideoStop: WriteString surfaceName err."); return ERR_INVALID_VALUE; } - if (!data.WriteBool(state)) { + if (!data.WriteUint32(fps)) { + ROSEN_LOGE("AvcodecVideoStop: WriteUint32 fps err."); return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyHgmConfigEvent: Send Request err."); - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop: Send Request err."); + return RS_CONNECTION_ERROR; } - return ERR_OK; + int32_t result{0}; + if (!reply.ReadInt32(result)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop Read result failed"); + return READ_PARCEL_ERR; + } + return result; } -ErrCode RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate( - const std::string& id, int32_t expectedFrameRate) +ErrCode RSRenderServiceConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, + SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("NotifyXComponentExpectedFrameRate: GetDescriptor err."); + ROSEN_LOGE("SetHardwareEnabled: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } - if (!data.WriteString(id)) { + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetHardwareEnabled: WriteUint64 id err."); return ERR_INVALID_VALUE; } - if (!data.WriteInt32(expectedFrameRate)) { + if (!data.WriteBool(isEnabled)) { + ROSEN_LOGE("SetHardwareEnabled: WriteBool isEnabled err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint8(static_cast(selfDrawingType))) { + ROSEN_LOGE("SetHardwareEnabled: WriteUint8 selfDrawingType err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteBool(dynamicHardwareEnable)) { + ROSEN_LOGE("SetHardwareEnabled: WriteBool dynamicHardwareEnable err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHardwareEnabled: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetCacheEnabledForRotation(bool isEnabled) +ErrCode RSRenderServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetCacheEnabledForRotation: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("SetHidePrivacyContent: WriteInterfaceToken GetDescriptor err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint64(id)) { + ROSEN_LOGE("SetHidePrivacyContent: WriteUint64 id err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); return ERR_INVALID_VALUE; } - if (!data.WriteBool(isEnabled)) { - ROSEN_LOGE("SetCacheEnabledForRotation: WriteBool isEnabled err."); + if (!data.WriteBool(needHidePrivacyContent)) { + ROSEN_LOGE("SetHidePrivacyContent: WriteBool needHidePrivacyContent err."); + resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED); + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetCacheEnabledForRotation: Send Request err."); + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHidePrivacyContent: Send Request err."); + resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); return ERR_INVALID_VALUE; } + resCode = reply.ReadUint32(); return ERR_OK; } -void RSRenderServiceConnectionProxy::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) -{ - OnRemoteDiedCallback_ = callback; -} - -void RSRenderServiceConnectionProxy::RunOnRemoteDiedCallback() +void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( + const std::unordered_map& eventInfos +) { - if (OnRemoteDiedCallback_) { - OnRemoteDiedCallback_(); + auto mapSize = eventInfos.size(); + if (mapSize <= ZERO || mapSize > MAX_VOTER_SIZE) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: map size err."); + return; } -} -std::vector RSRenderServiceConnectionProxy::GetActiveDirtyRegionInfo() -{ MessageParcel data; MessageParcel reply; MessageOption option; - std::vector activeDirtyRegionInfos; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetActiveDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); - return activeDirtyRegionInfos; + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO); + if (!data.WriteUint32(mapSize)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint32 mapSize err."); + return; + } + for (const auto& [key, eventInfo] : eventInfos) { + if (!data.WriteUint64(key)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint64 key err."); + return; + } + if (!eventInfo.Serialize(data)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: Write eventInfo err."); + return; + } + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetActiveDirtyRegionInfo: Send Request err."); - return activeDirtyRegionInfos; - } - int32_t activeDirtyRegionInfosSize{0}; - if (!reply.ReadInt32(activeDirtyRegionInfosSize)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetActiveDirtyRegionInfo Read activeDirtyRegionInfosSize failed"); - return activeDirtyRegionInfos; - } - while (activeDirtyRegionInfosSize--) { - int64_t activeDirtyRegionArea{0}; - int32_t activeFramesNumber{0}; - int32_t pidOfBelongsApp{0}; - std::string windowName; - if (!reply.ReadInt64(activeDirtyRegionArea) || !reply.ReadInt32(activeFramesNumber) || - !reply.ReadInt32(pidOfBelongsApp) || !reply.ReadString(windowName)) { - ROSEN_LOGE( - "RSRenderServiceConnectionProxy::GetActiveDirtyRegionInfo Read parcel failed"); - return activeDirtyRegionInfos; - } - activeDirtyRegionInfos.emplace_back( - ActiveDirtyRegionInfo(activeDirtyRegionArea, activeFramesNumber, pidOfBelongsApp, windowName)); + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); + return; } - return activeDirtyRegionInfos; } -GlobalDirtyRegionInfo RSRenderServiceConnectionProxy::GetGlobalDirtyRegionInfo() +void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( + const std::unordered_map& eventInfos +) { - MessageParcel data; - MessageParcel reply; - MessageOption option; - GlobalDirtyRegionInfo globalDirtyRegionInfo; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetGlobalDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); - return globalDirtyRegionInfo; + auto mapSize = eventInfos.size(); + if (mapSize <= ZERO || mapSize > MAX_VOTER_SIZE) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: map size err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetGlobalDirtyRegionInfo: Send Request err."); - return globalDirtyRegionInfo; - } - int64_t globalDirtyRegionAreas{0}; - int32_t globalFramesNumber{0}; - int32_t skipProcessFramesNumber{0}; - int32_t mostSendingPidWhenDisplayNodeSkip{0}; - if (!reply.ReadInt64(globalDirtyRegionAreas) || !reply.ReadInt32(globalFramesNumber) || - !reply.ReadInt32(skipProcessFramesNumber) || !reply.ReadInt32(mostSendingPidWhenDisplayNodeSkip)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetGlobalDirtyRegionInfo Read parcel failed"); - return globalDirtyRegionInfo; - } - return GlobalDirtyRegionInfo( - globalDirtyRegionAreas, globalFramesNumber, skipProcessFramesNumber, mostSendingPidWhenDisplayNodeSkip); -} -LayerComposeInfo RSRenderServiceConnectionProxy::GetLayerComposeInfo() -{ MessageParcel data; MessageParcel reply; MessageOption option; - LayerComposeInfo layerComposeInfo; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetLayerComposeInfo: WriteInterfaceToken GetDescriptor err."); - return layerComposeInfo; + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_LAYER_COMPOSE_INFO); + if (!data.WriteUint32(mapSize)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteUint32 mapSize err."); + return; + } + for (const auto& [key, eventInfo] : eventInfos) { + if (!data.WriteString(key)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteString key err."); + return; + } + if (!eventInfo.Serialize(data)) { + ROSEN_LOGE("SetWindowExpectedRefreshRate: Write eventInfo err."); + return; + } + } + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = + static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo: Send Request err."); - return layerComposeInfo; - } - int32_t uniformRenderFrameNumber{0}; - int32_t offlineComposeFrameNumber{0}; - int32_t redrawFrameNumber{0}; - if (!reply.ReadInt32(uniformRenderFrameNumber) || !reply.ReadInt32(offlineComposeFrameNumber) || - !reply.ReadInt32(redrawFrameNumber)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo Read parcel failed"); - return layerComposeInfo; + ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); + return; } - return LayerComposeInfo(uniformRenderFrameNumber, offlineComposeFrameNumber, redrawFrameNumber); } -HwcDisabledReasonInfos RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo() +void RSRenderServiceConnectionProxy::NotifyRefreshRateEvent(const EventInfo& eventInfo) { MessageParcel data; MessageParcel reply; MessageOption option; - HwcDisabledReasonInfos hwcDisabledReasonInfos; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetHwcDisabledReasonInfo: WriteInterfaceToken GetDescriptor err."); - return hwcDisabledReasonInfos; + ROSEN_LOGE("NotifyRefreshRateEvent: WriteInterfaceToken GetDescriptor err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode:: - GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo: Send Request err."); - return hwcDisabledReasonInfos; + if (!data.WriteString(eventInfo.eventName)) { + ROSEN_LOGE("NotifyRefreshRateEvent: WriteString eventInfo.eventName err."); + return; } - int32_t size{0}; - if (!reply.ReadInt32(size)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo Read size failed"); - return hwcDisabledReasonInfos; + if (!data.WriteBool(eventInfo.eventStatus)) { + ROSEN_LOGE("NotifyRefreshRateEvent: WriteBool eventInfo.eventStatus err."); + return; } - size_t readableSize = reply.GetReadableBytes() / HWC_DISABLED_REASON_INFO_MINIMUM_SIZE; - size_t len = static_cast(size); - if (len > readableSize || len > hwcDisabledReasonInfos.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetHwcDisabledReasonInfo Failed read vector, size:%{public}zu," - " readableSize:%{public}zu", len, readableSize); - return hwcDisabledReasonInfos; + if (!data.WriteUint32(eventInfo.minRefreshRate)) { + ROSEN_LOGE("NotifyRefreshRateEvent: WriteUint32 eventInfo.minRefreshRate err."); + return; } - - HwcDisabledReasonInfo hwcDisabledReasonInfo; - while (size--) { - for (int32_t pos = 0; pos < HwcDisabledReasons::DISABLED_REASON_LENGTH; pos++) { - hwcDisabledReasonInfo.disabledReasonStatistics[pos] = reply.ReadInt32(); - } - hwcDisabledReasonInfo.pidOfBelongsApp = reply.ReadInt32(); - hwcDisabledReasonInfo.nodeName = reply.ReadString(); - hwcDisabledReasonInfos.emplace_back(hwcDisabledReasonInfo); + if (!data.WriteUint32(eventInfo.maxRefreshRate)) { + ROSEN_LOGE("NotifyRefreshRateEvent: WriteUint32 eventInfo.maxRefreshRate err."); + return; } - return hwcDisabledReasonInfos; -} - -ErrCode RSRenderServiceConnectionProxy::GetHdrOnDuration(int64_t& hdrOnDuration) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetHdrOnDuration: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; + if (!data.WriteString(eventInfo.description)) { + ROSEN_LOGE("NotifyRefreshRateEvent: WriteString eventInfo.description err."); + return; } - option.SetFlags(MessageOption::TF_SYNC); - - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HDR_ON_DURATION); + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_REFRESH_RATE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyRefreshRateEvent: Send Request err."); + return; } - hdrOnDuration = reply.ReadInt64(); - return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetVmaCacheStatus(bool flag) +ErrCode RSRenderServiceConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVmaCacheStatus: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("NotifySoftVsyncEvent: WriteInterfaceToken GetDescriptor err."); + return ERR_INVALID_VALUE; + } + if (!data.WriteUint32(pid)) { + ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 pid err."); return ERR_INVALID_VALUE; } - if (!data.WriteBool(flag)) { - ROSEN_LOGE("SetVmaCacheStatus: WriteBool flag err."); + if (!data.WriteUint32(rateDiscount)) { + ROSEN_LOGE("NotifySoftVsyncEvent: WriteUint32 rateDiscount err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVmaCacheStatus %d: Send Request err.", flag); + ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifySoftVsyncEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -#ifdef TP_FEATURE_ENABLE -EErrCode RSRenderServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, - TpFeatureConfigType tpFeatureConfigType) +ErrCode RSRenderServiceConnectionProxy::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetTpFeatureConfig: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - - if (!data.WriteInt32(feature)) { - ROSEN_LOGE("SetTpFeatureConfig: WriteInt32 feature err."); + ROSEN_LOGE("NotifyTouchEvent: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } - - if (!data.WriteCString(config)) { - ROSEN_LOGE("SetTpFeatureConfig: WriteCString config err."); + if (!data.WriteInt32(touchStatus)) { + ROSEN_LOGE("NotifyTouchEvent: WriteInt32 touchStatus err."); return ERR_INVALID_VALUE; } - - if (!data.WriteUint8(static_cast(tpFeatureConfigType))) { - ROSEN_LOGE("SetTpFeatureConfig: WriteUint8 tpFeatureConfigType err."); + if (!data.WriteInt32(touchCnt)) { + ROSEN_LOGE("NotifyTouchEvent: WriteInt32 touchCnt err."); return ERR_INVALID_VALUE; } - - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG); + option.SetFlags(MessageOption::TF_ASYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyTouchEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -#endif -void RSRenderServiceConnectionProxy::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) +void RSRenderServiceConnectionProxy::NotifyDynamicModeEvent(bool enableDynamicMode) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); + ROSEN_LOGE("NotifyDynamicModeEvent: WriteInterfaceToken GetDescriptor err."); return; } - if (!data.WriteBool(isVirtualScreenUsingStatus)) { - ROSEN_LOGE("SetVirtualScreenUsingStatus: WriteBool isVirtualScreenUsingStatus err."); + if (!data.WriteBool(enableDynamicMode)) { + ROSEN_LOGE("NotifyDynamicModeEvent: WriteBool enableDynamicMode err."); return; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenUsingStatus: Send Request err."); + ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyDynamicModeEvent: Send Request err."); return; } } -ErrCode RSRenderServiceConnectionProxy::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) +ErrCode RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate( + const std::string& id, int32_t expectedFrameRate) { MessageParcel data; MessageParcel reply; MessageOption option; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetCurtainScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(isCurtainScreenOn)) { - ROSEN_LOGE("SetCurtainScreenUsingStatus: WriteBool isCurtainScreenOn err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetCurtainScreenUsingStatus: Send Request err."); + ROSEN_LOGE("NotifyXComponentExpectedFrameRate: GetDescriptor err."); return ERR_INVALID_VALUE; } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::DropFrameByPid(const std::vector pidList) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("DropFrameByPid: WriteInterfaceToken GetDescriptor err."); + if (!data.WriteString(id)) { return ERR_INVALID_VALUE; } - if (!data.WriteInt32Vector(pidList)) { - ROSEN_LOGE("DropFrameByPid: WriteInt32Vector pidList err."); + if (!data.WriteInt32(expectedFrameRate)) { return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID); + uint32_t code = static_cast( + RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::DropFrameByPid: Send Request err."); + ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::RegisterUIExtensionCallback( - uint64_t userId, sptr callback, bool unobscured) +LayerComposeInfo RSRenderServiceConnectionProxy::GetLayerComposeInfo() { - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterUIExtensionCallback: callback is nullptr."); - return INVALID_ARGUMENTS; - } MessageParcel data; MessageParcel reply; MessageOption option; + LayerComposeInfo layerComposeInfo; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RegisterUIExtensionCallback: WriteInterfaceToken GetDescriptor err."); - return RS_CONNECTION_ERROR; + ROSEN_LOGE("GetLayerComposeInfo: WriteInterfaceToken GetDescriptor err."); + return layerComposeInfo; } option.SetFlags(MessageOption::TF_SYNC); - if (data.WriteUint64(userId) && data.WriteRemoteObject(callback->AsObject()) && data.WriteBool(unobscured)) { - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - int32_t result{0}; - if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterUIExtensionCallback Read result failed"); - return READ_PARCEL_ERR; - } - return result; - } else { - ROSEN_LOGE("RegisterUIExtensionCallback: WriteUint64[userId] OR WriteRemoteObject[callback] err."); - return RS_CONNECTION_ERROR; + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_LAYER_COMPOSE_INFO); + int32_t err = SendRequest(code, data, reply, option); + if (err != NO_ERROR) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo: Send Request err."); + return layerComposeInfo; + } + int32_t uniformRenderFrameNumber{0}; + int32_t offlineComposeFrameNumber{0}; + int32_t redrawFrameNumber{0}; + if (!reply.ReadInt32(uniformRenderFrameNumber) || !reply.ReadInt32(offlineComposeFrameNumber) || + !reply.ReadInt32(redrawFrameNumber)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo Read parcel failed"); + return layerComposeInfo; } + return LayerComposeInfo(uniformRenderFrameNumber, offlineComposeFrameNumber, redrawFrameNumber); } -ErrCode RSRenderServiceConnectionProxy::SetVirtualScreenStatus(ScreenId id, - VirtualScreenStatus screenStatus, bool& success) +HwcDisabledReasonInfos RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo() { MessageParcel data; MessageParcel reply; MessageOption option; + HwcDisabledReasonInfos hwcDisabledReasonInfos; if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetVirtualScreenStatus: WriteInterfaceToken GetDescriptor err."); - success = false; - return ERR_INVALID_VALUE; + ROSEN_LOGE("GetHwcDisabledReasonInfo: WriteInterfaceToken GetDescriptor err."); + return hwcDisabledReasonInfos; } option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteUint64(id)) { - ROSEN_LOGE("SetVirtualScreenStatus: WriteUint64 id err."); - success = false; - return ERR_INVALID_VALUE; - } - if (!data.WriteUint8(static_cast(screenStatus))) { - ROSEN_LOGE("SetVirtualScreenStatus: WriteUint8 screenStatus err."); - success = false; - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_STATUS); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode:: + GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - success = false; - return ERR_INVALID_VALUE; + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo: Send Request err."); + return hwcDisabledReasonInfos; } - if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenStatus Read result failed"); - return READ_PARCEL_ERR; + int32_t size{0}; + if (!reply.ReadInt32(size)) { + ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo Read size failed"); + return hwcDisabledReasonInfos; } - return ERR_OK; + size_t readableSize = reply.GetReadableBytes() / HWC_DISABLED_REASON_INFO_MINIMUM_SIZE; + size_t len = static_cast(size); + if (len > readableSize || len > hwcDisabledReasonInfos.max_size()) { + RS_LOGE("RSRenderServiceConnectionProxy GetHwcDisabledReasonInfo Failed read vector, size:%{public}zu," + " readableSize:%{public}zu", len, readableSize); + return hwcDisabledReasonInfos; + } + + HwcDisabledReasonInfo hwcDisabledReasonInfo; + while (size--) { + for (int32_t pos = 0; pos < HwcDisabledReasons::DISABLED_REASON_LENGTH; pos++) { + hwcDisabledReasonInfo.disabledReasonStatistics[pos] = reply.ReadInt32(); + } + hwcDisabledReasonInfo.pidOfBelongsApp = reply.ReadInt32(); + hwcDisabledReasonInfo.nodeName = reply.ReadString(); + hwcDisabledReasonInfos.emplace_back(hwcDisabledReasonInfo); + } + return hwcDisabledReasonInfos; } -ErrCode RSRenderServiceConnectionProxy::SetAncoForceDoDirect(bool direct, bool& res) +#ifdef TP_FEATURE_ENABLE +EErrCode RSRenderServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, + TpFeatureConfigType tpFeatureConfigType) { MessageParcel data; MessageParcel reply; MessageOption option; + if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("SetAncoForceDoDirect: WriteInterfaceToken GetDescriptor err."); - res = false; + ROSEN_LOGE("SetTpFeatureConfig: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_SYNC); - if (data.WriteBool(direct)) { - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - res = false; - return ERR_INVALID_VALUE; - } - res = reply.ReadBool(); - return ERR_OK; - } else { - ROSEN_LOGE("SetAncoForceDoDirect: WriteBool direct err."); - res = false; + + if (!data.WriteInt32(feature)) { + ROSEN_LOGE("SetTpFeatureConfig: WriteInt32 feature err."); return ERR_INVALID_VALUE; } -} -void RSRenderServiceConnectionProxy::SetFreeMultiWindowStatus(bool enable) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFreeMultiWindowStatus: write token err."); - return; + if (!data.WriteCString(config)) { + ROSEN_LOGE("SetTpFeatureConfig: WriteCString config err."); + return ERR_INVALID_VALUE; } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteBool(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFreeMultiWindowStatus: write bool val err."); - return; + + if (!data.WriteUint8(static_cast(tpFeatureConfigType))) { + ROSEN_LOGE("SetTpFeatureConfig: WriteUint8 tpFeatureConfigType err."); + return ERR_INVALID_VALUE; } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS); + + option.SetFlags(MessageOption::TF_SYNC); + uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetFreeMultiWindowStatus: Send Request err."); + return ERR_INVALID_VALUE; } + return ERR_OK; } +#endif + void RSRenderServiceConnectionProxy::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { @@ -5206,73 +2704,6 @@ void RSRenderServiceConnectionProxy::RegisterTransactionDataCallback(uint64_t to } } -ErrCode RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback( - pid_t pid, uint64_t uid, sptr callback) -{ - if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback callback == nullptr"); - return ERR_INVALID_VALUE; - } - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback: write token err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); - if (!data.WriteInt32(pid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback: write Int32 val err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint64(uid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback: write Uint64 val err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback: write RemoteObject val err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSurfaceBufferCallback: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnregisterSurfaceBufferCallback: write token err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); - if (!data.WriteInt32(pid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnregisterSurfaceBufferCallback: write Int32 val err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteUint64(uid)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnregisterSurfaceBufferCallback: write Uint64 val err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast( - RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnregisterSurfaceBufferCallback: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - ErrCode RSRenderServiceConnectionProxy::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { MessageParcel data; @@ -5316,74 +2747,6 @@ ErrCode RSRenderServiceConnectionProxy::SetLayerTop(const std::string &nodeIdStr return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetForceRefresh: write token err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (data.WriteString(nodeIdStr) && data.WriteBool(isForceRefresh)) { - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetForceRefresh: Send Request err."); - return ERR_INVALID_VALUE; - } - } - return ERR_OK; -} - -void RSRenderServiceConnectionProxy::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetColorFollow: write token err."); - return; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (data.WriteString(nodeIdStr) && data.WriteBool(isColorFollow)) { - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetColorFollow: Send Request err."); - return; - } - } -} - -ErrCode RSRenderServiceConnectionProxy::SetWindowContainer(NodeId nodeId, bool value) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowContainer: write token err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_ASYNC); - if (!data.WriteUint64(nodeId)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowContainer: write Uint64 val err."); - return ERR_INVALID_VALUE; - } - if (!data.WriteBool(value)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowContainer: write Bool val err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowContainer: Send Request err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - int32_t RSRenderServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) { @@ -5464,20 +2827,6 @@ int32_t RSRenderServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallb return result; } -bool RSRenderServiceConnectionProxy::GetHighContrastTextState() -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HIGH_CONTRAST_TEXT_STATE); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHighContrastTextState: Send Request err."); - return false; - } - return reply.ReadBool(); -} - int32_t RSRenderServiceConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { @@ -5562,79 +2911,6 @@ ErrCode RSRenderServiceConnectionProxy::NotifyPageName(const std::string &packag return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetBehindWindowFilterEnabled(bool enabled) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetBehindWindowFilterEnabled WriteInterfaceToken err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - if (!data.WriteBool(enabled)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetBehindWindowFilterEnabled WriteBool err."); - return ERR_INVALID_VALUE; - } - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetBehindWindowFilterEnabled sendrequest error : %{public}d", err); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -ErrCode RSRenderServiceConnectionProxy::GetBehindWindowFilterEnabled(bool& enabled) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetBehindWindowFilterEnabled WriteInterfaceToken err."); - return ERR_INVALID_VALUE; - } - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetBehindWindowFilterEnabled sendrequest error : %{public}d", err); - return ERR_INVALID_VALUE; - } - if (!reply.ReadBool(enabled)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetBehindWindowFilterEnabled ReadBool err."); - return ERR_INVALID_VALUE; - } - return ERR_OK; -} - -int32_t RSRenderServiceConnectionProxy::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - return RS_CONNECTION_ERROR; - } - - if (!data.WriteInt32(pid)) { - return WRITE_PARCEL_ERR; - } - - option.SetFlags(MessageOption::TF_SYNC); - uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PID_GPU_MEMORY_IN_MB); - int32_t err = SendRequest(code, data, reply, option); - if (err != NO_ERROR) { - return RS_CONNECTION_ERROR; - } - if (!reply.ReadFloat(gpuMemInMB)) { - return READ_PARCEL_ERR; - } - - return err; -} - RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h index 5bdb678961..fba4c90a6c 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h @@ -49,14 +49,6 @@ public: const sptr& token, VSyncConnParam vsyncConnParam = {0, 0, false}) override; - ErrCode GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid, - int32_t& repCode) override; - - ErrCode CreatePixelMapFromSurface(sptr surface, const Rect &srcRect, - std::shared_ptr &pixelMap) override; - - ErrCode SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode)override; - ErrCode GetDefaultScreenId(uint64_t& screenId) override; ErrCode GetActiveScreenId(uint64_t& screenId) override; @@ -74,39 +66,8 @@ public: int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) override; - int32_t SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) override; - - ErrCode SetVirtualScreenTypeBlackList( - ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) override; - - ErrCode AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; - - ErrCode RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector, int32_t& repCode) override; - - ErrCode SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) override; - - int32_t SetVirtualScreenSecurityExemptionList( - ScreenId id, const std::vector& securityExemptionList) override; - - int32_t SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) override; - - int32_t SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation = false) override; - - int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override; - void RemoveVirtualScreen(ScreenId id) override; -#ifdef OHOS_BUILD_ENABLE_MAGICCURSOR - int32_t SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, - int64_t interval, int32_t rangeSize) override; - - int32_t SetPointerColorInversionEnabled(bool enable) override; - - int32_t RegisterPointerLuminanceChangeCallback(sptr callback) override; - - int32_t UnRegisterPointerLuminanceChangeCallback() override; -#endif - int32_t SetScreenChangeCallback(sptr callback) override; void SetScreenActiveMode(ScreenId id, uint32_t modeId) override; @@ -115,9 +76,6 @@ public: void SetRefreshRateMode(int32_t refreshRateMode) override; - void SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, - int32_t animatorExpectedFrameRate) override; - void UnregisterFrameRateLinker(FrameRateLinkerId id) override; uint32_t GetScreenCurrentRefreshRate(ScreenId id) override; @@ -139,47 +97,18 @@ public: int32_t SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) override; - ErrCode MarkPowerOffNeedProcessOneFrame() override; - ErrCode RepaintEverything() override; - ErrCode ForceRefreshOneFrameWithNextVSync() override; - - void DisablePowerOffRenderControl(ScreenId id) override; - void SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) override; ErrCode RegisterApplicationAgent(uint32_t pid, sptr app) override; - void TakeSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, - const Drawing::Rect& specifiedAreaRect = Drawing::Rect(0.f, 0.f, 0.f, 0.f), - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; - - std::vector>> - TakeSurfaceCaptureSoloNode(NodeId id, const RSSurfaceCaptureConfig& captureConfig, - RSSurfaceCapturePermissions permissions = RSSurfaceCapturePermissions()) override; - - void TakeSelfSurfaceCapture(NodeId id, sptr callback, - const RSSurfaceCaptureConfig& captureConfig) override; - - ErrCode SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, - const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) override; - - void TakeUICaptureInRange( - NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) override; - bool WriteSurfaceCaptureConfig(const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data); bool WriteSurfaceCaptureBlurParam(const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data); bool WriteSurfaceCaptureAreaRect(const Drawing::Rect& specifiedAreaRect, MessageParcel& data); - ErrCode SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, - float positionZ, float positionW) override; - - RSVirtualScreenResolution GetVirtualScreenResolution(ScreenId id) override; - ErrCode GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) override; std::vector GetScreenSupportedModes(ScreenId id) override; @@ -212,29 +141,10 @@ public: int32_t SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) override; - bool SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) override; - - int32_t SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) override; - - bool SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) override; - ErrCode SetGlobalDarkColorMode(bool isDark) override; int32_t GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) override; - int32_t GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) override; - - ErrCode GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) override; - - ErrCode SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) override; - - ErrCode GetScreenSupportedHDRFormats( - ScreenId id, std::vector& hdrFormats, int32_t& resCode) override; - - ErrCode GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) override; - - ErrCode SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) override; - ErrCode GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) override; ErrCode GetScreenSupportedColorSpaces( @@ -249,62 +159,19 @@ public: ErrCode GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) override; ErrCode GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) override; - bool RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) override; - bool UnRegisterTypeface(uint64_t globalUniqueId) override; int32_t GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) override; - ErrCode SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) override; - - ErrCode SetVirtualScreenRefreshRate( - ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) override; - ErrCode SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) override; void SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) override; void SetScreenFrameGravity(ScreenId id, int32_t gravity) override; - ErrCode RegisterOcclusionChangeCallback(sptr callback, int32_t& repCode) override; - - int32_t RegisterSurfaceOcclusionChangeCallback( - NodeId id, sptr callback, std::vector& partitionPoints) override; - - int32_t UnRegisterSurfaceOcclusionChangeCallback(NodeId id) override; - - int32_t RegisterHgmConfigChangeCallback(sptr callback) override; - - int32_t RegisterHgmRefreshRateModeChangeCallback(sptr callback) override; - - int32_t RegisterHgmRefreshRateUpdateCallback(sptr callback) override; - - int32_t RegisterFirstFrameCommitCallback(sptr callback) override; - ErrCode AvcodecVideoStart(uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) override; ErrCode AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) override; - int32_t RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, - sptr callback) override; - - ErrCode SetAppWindowNum(uint32_t num) override; - - ErrCode SetSystemAnimatedScenes( - SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) override; - - void ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) override; - - int32_t ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) override; - - ErrCode ReportJankStats() override; - - ErrCode NotifyLightFactorStatus(int32_t lightFactorStatus) override; - - void NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) override; - - void NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, - const std::vector>& newConfig) override; - void NotifyRefreshRateEvent(const EventInfo& eventInfo) override; void SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) override; @@ -313,79 +180,31 @@ public: ErrCode NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) override; - bool NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) override; - ErrCode NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) override; void NotifyDynamicModeEvent(bool enableDynamicMode) override; - ErrCode NotifyHgmConfigEvent(const std::string &eventName, bool state) override; - ErrCode NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) override; - ErrCode ReportEventResponse(DataBaseRs info) override; - - ErrCode ReportEventComplete(DataBaseRs info) override; - - ErrCode ReportEventJankFrame(DataBaseRs info) override; - - void ReportRsSceneJankStart(AppInfo info) override; - - void ReportRsSceneJankEnd(AppInfo info) override; - - ErrCode ReportGameStateData(GameStateData info) override; - ErrCode SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) override; ErrCode SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) override; - ErrCode SetCacheEnabledForRotation(bool isEnabled) override; - - void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) override; - - void RunOnRemoteDiedCallback() override; - - std::vector GetActiveDirtyRegionInfo() override; - - GlobalDirtyRegionInfo GetGlobalDirtyRegionInfo() override; - LayerComposeInfo GetLayerComposeInfo() override; HwcDisabledReasonInfos GetHwcDisabledReasonInfo() override; - ErrCode GetHdrOnDuration(int64_t& hdrOnDuration) override; - - ErrCode SetVmaCacheStatus(bool flag) override; - - int32_t RegisterUIExtensionCallback(uint64_t userId, sptr callback, - bool unobscured = false) override; - #ifdef TP_FEATURE_ENABLE ErrCode SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType = TpFeatureConfigType::DEFAULT_TP_FEATURE) override; #endif - void SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) override; - ErrCode SetCurtainScreenUsingStatus(bool isCurtainScreenOn) override; - - ErrCode DropFrameByPid(const std::vector pidList) override; - - ErrCode SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) override; - - void SetFreeMultiWindowStatus(bool enable) override; - - ErrCode RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, - sptr callback) override; - - ErrCode UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) override; void RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) override; ErrCode NotifyScreenSwitched() override; - ErrCode SetWindowContainer(NodeId nodeId, bool value) override; - int32_t RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) override; @@ -393,14 +212,6 @@ public: ErrCode NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) override; - bool GetHighContrastTextState() override; - - ErrCode SetBehindWindowFilterEnabled(bool enabled) override; - - ErrCode GetBehindWindowFilterEnabled(bool& enabled) override; - - int32_t GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) override; - RetCodeHrpService ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) override; RetCodeHrpService ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, @@ -412,24 +223,12 @@ private: bool FillParcelWithTransactionData( std::unique_ptr& transactionData, std::shared_ptr& data); - void ReportDataBaseRs(MessageParcel& data, MessageParcel& reply, MessageOption& option, DataBaseRs info); - - void WriteAppInfo(MessageParcel& data, MessageParcel& reply, MessageOption& option, AppInfo info); - - void ReportGameStateDataRs(MessageParcel& data, MessageParcel& reply, MessageOption& option, GameStateData info); - int32_t SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - ErrCode SetAncoForceDoDirect(bool direct, bool& res) override; - ErrCode SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) override; ErrCode SetLayerTop(const std::string &nodeIdStr, bool isTop) override; - ErrCode SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) override; - - void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override; - #ifdef RS_ENABLE_OVERLAY_DISPLAY ErrCode SetOverlayDisplayMode(int32_t mode) override; #endif @@ -438,7 +237,6 @@ private: pid_t pid_ = GetRealPid(); uint32_t transactionDataIndex_ = 0; - OnRemoteDiedCallback OnRemoteDiedCallback_; }; } // namespace Rosen } // namespace OHOS -- Gitee From 3bc60ce07c701a6539f65053e43f07b1e51e2630 Mon Sep 17 00:00:00 2001 From: zhanglitao Date: Mon, 28 Jul 2025 15:52:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Node=E3=80=81Interface=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglitao --- .../include/platform/ohos/rs_irender_service.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h index b20b5303d5..9ddf269a5f 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service.h @@ -16,12 +16,11 @@ #ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_H #define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_H -#include "rs_irender_compose_connection.h" #include "rs_irender_connection_token.h" -#include "rs_irender_process_connection.h" +#include "rs_irender_service_connection.h" #include "rs_irender_proocess_connection.h" +#include "rs_irender_compose_connection.h" #include "rs_irender_render_connection.h" -#include "rs_irender_service_connection.h" namespace OHOS { namespace Rosen { -- Gitee From 5cdb0ede510b5975f2ed04e4c9984a7e78be86e8 Mon Sep 17 00:00:00 2001 From: zhanglitao Date: Mon, 28 Jul 2025 17:16:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Node=E3=80=81Interface=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglitao --- ...cpp => rs_client_to_render_connection.cpp} | 446 +++---- ...ion.h => rs_client_to_render_connection.h} | 28 +- ...pp => rs_client_to_service_connection.cpp} | 332 ++--- ...on.h => rs_client_to_service_connection.h} | 28 +- ...> rs_client_to_render_connection_stub.cpp} | 554 ++++---- ... => rs_client_to_render_connection_stub.h} | 14 +- ... rs_client_to_service_connection_stub.cpp} | 376 +++--- ...=> rs_client_to_service_connection_stub.h} | 14 +- ...on.h => rs_iclient_to_render_connection.h} | 14 +- ...n.h => rs_iclient_to_service_connection.h} | 14 +- .../transaction/rs_render_service_client.h | 4 +- ... rs_client_to_render_connection_proxy.cpp} | 894 ++++++------- ...=> rs_client_to_render_connection_proxy.h} | 16 +- ...rs_client_to_service_connection_proxy.cpp} | 634 ++++----- ...> rs_client_to_service_connection_proxy.h} | 16 +- .../ohos/rs_render_service_client.cpp | 1152 ++++++++--------- 16 files changed, 2268 insertions(+), 2268 deletions(-) rename rosen/modules/render_service/core/pipeline/main_thread/{rs_render_process_connection.cpp => rs_client_to_render_connection.cpp} (81%) rename rosen/modules/render_service/core/pipeline/main_thread/{rs_render_process_connection.h => rs_client_to_render_connection.h} (95%) rename rosen/modules/render_service/core/pipeline/main_thread/{rs_render_service_connection.cpp => rs_client_to_service_connection.cpp} (81%) rename rosen/modules/render_service/core/pipeline/main_thread/{rs_render_service_connection.h => rs_client_to_service_connection.h} (93%) rename rosen/modules/render_service/core/transaction/{rs_render_process_connection_stub.cpp => rs_client_to_render_connection_stub.cpp} (80%) rename rosen/modules/render_service/core/transaction/{rs_render_process_connection_stub.h => rs_client_to_render_connection_stub.h} (78%) rename rosen/modules/render_service/core/transaction/{rs_render_service_connection_stub.cpp => rs_client_to_service_connection_stub.cpp} (80%) rename rosen/modules/render_service/core/transaction/{rs_render_service_connection_stub.h => rs_client_to_service_connection_stub.h} (72%) rename rosen/modules/render_service_base/include/platform/ohos/{rs_irender_process_connection.h => rs_iclient_to_render_connection.h} (96%) rename rosen/modules/render_service_base/include/platform/ohos/{rs_irender_service_connection.h => rs_iclient_to_service_connection.h} (95%) rename rosen/modules/render_service_base/src/platform/ohos/{rs_render_process_connection_proxy.cpp => rs_client_to_render_connection_proxy.cpp} (74%) rename rosen/modules/render_service_base/src/platform/ohos/{rs_render_process_connection_proxy.h => rs_client_to_render_connection_proxy.h} (95%) rename rosen/modules/render_service_base/src/platform/ohos/{rs_render_service_connection_proxy.cpp => rs_client_to_service_connection_proxy.cpp} (75%) rename rosen/modules/render_service_base/src/platform/ohos/{rs_render_service_connection_proxy.h => rs_client_to_service_connection_proxy.h} (93%) diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.cpp similarity index 81% rename from rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp rename to rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.cpp index b23e782b8f..d65436cd64 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.cpp +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_process_connection.h" +#include "rs_client_to_render_connection.h" #include #include "frame_report.h" @@ -95,7 +95,7 @@ #endif #undef LOG_TAG -#define LOG_TAG "RSRenderProcessConnection" +#define LOG_TAG "RSClientToRenderConnection" namespace OHOS { namespace Rosen { @@ -107,7 +107,7 @@ constexpr uint32_t MEM_BYTE_TO_MB = 1024 * 1024; } // we guarantee that when constructing this object, // all these pointers are valid, so will not check them. -RSRenderProcessConnection::RSRenderProcessConnection( +RSClientToRenderConnection::RSClientToRenderConnection( pid_t remotePid, wptr renderService, RSMainThread* mainThread, @@ -127,23 +127,23 @@ RSRenderProcessConnection::RSRenderProcessConnection( appVSyncDistributor_(distributor) { if (token_ == nullptr || !token_->AddDeathRecipient(connDeathRecipient_)) { - RS_LOGW("RSRenderProcessConnection: Failed to set death recipient."); + RS_LOGW("RSClientToRenderConnection: Failed to set death recipient."); } if (renderService_ == nullptr) { - RS_LOGW("RSRenderProcessConnection: renderService_ is nullptr"); + RS_LOGW("RSClientToRenderConnection: renderService_ is nullptr"); } if (mainThread_ == nullptr) { - RS_LOGW("RSRenderProcessConnection: mainThread_ is nullptr"); + RS_LOGW("RSClientToRenderConnection: mainThread_ is nullptr"); } if (screenManager_ == nullptr) { - RS_LOGW("RSRenderProcessConnection: screenManager_ is nullptr"); + RS_LOGW("RSClientToRenderConnection: screenManager_ is nullptr"); } if (appVSyncDistributor_ == nullptr) { - RS_LOGW("RSRenderProcessConnection: appVSyncDistributor_ is nullptr"); + RS_LOGW("RSClientToRenderConnection: appVSyncDistributor_ is nullptr"); } } -RSRenderProcessConnection::~RSRenderProcessConnection() noexcept +RSClientToRenderConnection::~RSClientToRenderConnection() noexcept { if (token_ && connDeathRecipient_) { token_->RemoveDeathRecipient(connDeathRecipient_); @@ -151,7 +151,7 @@ RSRenderProcessConnection::~RSRenderProcessConnection() noexcept CleanAll(); } -void RSRenderProcessConnection::CleanVirtualScreens() noexcept +void RSClientToRenderConnection::CleanVirtualScreens() noexcept { std::lock_guard lock(mutex_); @@ -168,7 +168,7 @@ void RSRenderProcessConnection::CleanVirtualScreens() noexcept } } -void RSRenderProcessConnection::CleanRenderNodes() noexcept +void RSClientToRenderConnection::CleanRenderNodes() noexcept { if (mainThread_ == nullptr) { return; @@ -179,7 +179,7 @@ void RSRenderProcessConnection::CleanRenderNodes() noexcept nodeMap.FilterNodeByPid(remotePid_); } -void RSRenderProcessConnection::CleanFrameRateLinkers() noexcept +void RSClientToRenderConnection::CleanFrameRateLinkers() noexcept { if (mainThread_ == nullptr) { return; @@ -190,7 +190,7 @@ void RSRenderProcessConnection::CleanFrameRateLinkers() noexcept frameRateLinkerMap.FilterFrameRateLinkerByPid(remotePid_); } -void RSRenderProcessConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexcept +void RSClientToRenderConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexcept { if (mainThread_ == nullptr) { return; @@ -200,7 +200,7 @@ void RSRenderProcessConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexc frameRateLinkerMap.UnRegisterExpectedFpsUpdateCallbackByListener(remotePid_); } -void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept +void RSClientToRenderConnection::CleanAll(bool toDelete) noexcept { { std::lock_guard lock(mutex_); @@ -212,11 +212,11 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept return; } RS_LOGD("CleanAll() start."); - RS_TRACE_NAME("RSRenderProcessConnection CleanAll begin, remotePid: " + std::to_string(remotePid_)); + RS_TRACE_NAME("RSClientToRenderConnection CleanAll begin, remotePid: " + std::to_string(remotePid_)); RsCommandVerifyHelper::GetInstance().RemoveCntWithPid(remotePid_); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (!connection) { return; } @@ -224,8 +224,8 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept connection->CleanVirtualScreens(); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (!connection) { return; } @@ -235,8 +235,8 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept connection->CleanFrameRateLinkerExpectedFpsCallbacks(); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -244,8 +244,8 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept connection->mainThread_->ClearTransactionDataPidInfo(connection->remotePid_); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -256,8 +256,8 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept }).wait(); if (SelfDrawingNodeMonitor::GetInstance().IsListeningEnabled()) { mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -290,15 +290,15 @@ void RSRenderProcessConnection::CleanAll(bool toDelete) noexcept } RS_LOGD("CleanAll() end."); - RS_TRACE_NAME("RSRenderProcessConnection CleanAll end, remotePid: " + std::to_string(remotePid_)); + RS_TRACE_NAME("RSClientToRenderConnection CleanAll end, remotePid: " + std::to_string(remotePid_)); } -RSRenderProcessConnection::RSConnectionDeathRecipient::RSConnectionDeathRecipient( - wptr conn) : conn_(conn) +RSClientToRenderConnection::RSConnectionDeathRecipient::RSConnectionDeathRecipient( + wptr conn) : conn_(conn) { } -void RSRenderProcessConnection::RSConnectionDeathRecipient::OnRemoteDied(const wptr& token) +void RSClientToRenderConnection::RSConnectionDeathRecipient::OnRemoteDied(const wptr& token) { auto tokenSptr = token.promote(); if (tokenSptr == nullptr) { @@ -308,7 +308,7 @@ void RSRenderProcessConnection::RSConnectionDeathRecipient::OnRemoteDied(const w auto rsConn = conn_.promote(); if (rsConn == nullptr) { - RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: RSRenderProcessConnection was dead, do nothing."); + RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: RSClientToRenderConnection was dead, do nothing."); return; } @@ -320,11 +320,11 @@ void RSRenderProcessConnection::RSConnectionDeathRecipient::OnRemoteDied(const w rsConn->CleanAll(true); } -RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::RSApplicationRenderThreadDeathRecipient( - wptr conn) : conn_(conn) +RSClientToRenderConnection::RSApplicationRenderThreadDeathRecipient::RSApplicationRenderThreadDeathRecipient( + wptr conn) : conn_(conn) {} -void RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::OnRemoteDied(const wptr& token) +void RSClientToRenderConnection::RSApplicationRenderThreadDeathRecipient::OnRemoteDied(const wptr& token) { auto tokenSptr = token.promote(); if (tokenSptr == nullptr) { @@ -335,7 +335,7 @@ void RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::OnRemot auto rsConn = conn_.promote(); if (rsConn == nullptr) { RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: " - "RSRenderProcessConnection was dead, do nothing."); + "RSClientToRenderConnection was dead, do nothing."); return; } @@ -344,7 +344,7 @@ void RSRenderProcessConnection::RSApplicationRenderThreadDeathRecipient::OnRemot rsConn->UnRegisterApplicationAgent(app); } -ErrCode RSRenderProcessConnection::CommitTransaction(std::unique_ptr& transactionData) +ErrCode RSClientToRenderConnection::CommitTransaction(std::unique_ptr& transactionData) { if (!mainThread_) { return ERR_INVALID_VALUE; @@ -371,7 +371,7 @@ ErrCode RSRenderProcessConnection::CommitTransaction(std::unique_ptr& task) +ErrCode RSClientToRenderConnection::ExecuteSynchronousTask(const std::shared_ptr& task) { if (task == nullptr || mainThread_ == nullptr) { RS_LOGW("ExecuteSynchronousTask, task or main thread is null!"); @@ -391,13 +391,13 @@ ErrCode RSRenderProcessConnection::ExecuteSynchronousTask(const std::shared_ptr< return ERR_OK; } -ErrCode RSRenderProcessConnection::GetUniRenderEnabled(bool& enable) +ErrCode RSClientToRenderConnection::GetUniRenderEnabled(bool& enable) { enable = RSUniRenderJudgement::IsUniRender(); return ERR_OK; } -ErrCode RSRenderProcessConnection::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, +ErrCode RSClientToRenderConnection::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) { if (!mainThread_) { @@ -431,7 +431,7 @@ ErrCode RSRenderProcessConnection::CreateNode(const RSDisplayNodeConfig& display return ERR_OK; } -ErrCode RSRenderProcessConnection::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +ErrCode RSClientToRenderConnection::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) { if (!mainThread_) { success = false; @@ -444,8 +444,8 @@ ErrCode RSRenderProcessConnection::CreateNode(const RSSurfaceRenderNodeConfig& c success = false; return ERR_INVALID_VALUE; } - std::function registerNode = [node, weakThis = wptr(this)]() -> void { - sptr connection = weakThis.promote(); + std::function registerNode = [node, weakThis = wptr(this)]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -456,7 +456,7 @@ ErrCode RSRenderProcessConnection::CreateNode(const RSSurfaceRenderNodeConfig& c return ERR_OK; } -ErrCode RSRenderProcessConnection::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, +ErrCode RSClientToRenderConnection::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, bool unobscured) { if (!mainThread_) { @@ -514,7 +514,7 @@ ErrCode RSRenderProcessConnection::CreateNodeAndSurface(const RSSurfaceRenderNod return ERR_OK; } -ErrCode RSRenderProcessConnection::GetPixelMapByProcessId( +ErrCode RSClientToRenderConnection::GetPixelMapByProcessId( std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) { if (mainThread_ == nullptr) { @@ -522,13 +522,13 @@ ErrCode RSRenderProcessConnection::GetPixelMapByProcessId( return ERR_INVALID_VALUE; } std::vector, std::string, RectI>> sfBufferInfoVector; - std::function getSurfaceBufferByPidTask = [weakThis = wptr(this), + std::function getSurfaceBufferByPidTask = [weakThis = wptr(this), &sfBufferInfoVector, pid]() -> void { - sptr connection = weakThis.promote(); + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } - RS_TRACE_NAME_FMT("RSRenderProcessConnection::GetPixelMapByProcessId getSurfaceBufferByPidTask pid: %d", pid); + RS_TRACE_NAME_FMT("RSClientToRenderConnection::GetPixelMapByProcessId getSurfaceBufferByPidTask pid: %d", pid); auto selfDrawingNodeVector = connection->mainThread_->GetContext().GetMutableNodeMap().GetSelfDrawingNodeInProcess(pid); for (auto iter = selfDrawingNodeVector.rbegin(); iter != selfDrawingNodeVector.rend(); ++iter) { @@ -565,7 +565,7 @@ ErrCode RSRenderProcessConnection::GetPixelMapByProcessId( return ERR_OK; } -ErrCode RSRenderProcessConnection::CreatePixelMapFromSurface(sptr surface, +ErrCode RSClientToRenderConnection::CreatePixelMapFromSurface(sptr surface, const Rect &srcRect, std::shared_ptr &pixelMap) { OHOS::Media::Rect rect = { @@ -580,7 +580,7 @@ ErrCode RSRenderProcessConnection::CreatePixelMapFromSurface(sptr surfa return ERR_OK; } -ErrCode RSRenderProcessConnection::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) +ErrCode RSClientToRenderConnection::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) { if (mainThread_ == nullptr) { repCode = INVALID_ARGUMENTS; @@ -596,7 +596,7 @@ ErrCode RSRenderProcessConnection::SetFocusAppInfo(const FocusAppInfo& info, int return ERR_OK; } -ErrCode RSRenderProcessConnection::SetWatermark(const std::string& name, std::shared_ptr watermark, +ErrCode RSClientToRenderConnection::SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) { if (!mainThread_) { @@ -608,7 +608,7 @@ ErrCode RSRenderProcessConnection::SetWatermark(const std::string& name, std::sh return ERR_OK; } -int32_t RSRenderProcessConnection::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) +int32_t RSClientToRenderConnection::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { if (blackListVector.empty()) { RS_LOGW("SetVirtualScreenBlackList blackList is empty."); @@ -620,7 +620,7 @@ int32_t RSRenderProcessConnection::SetVirtualScreenBlackList(ScreenId id, std::v return screenManager_->SetVirtualScreenBlackList(id, blackListVector); } -ErrCode RSRenderProcessConnection::SetVirtualScreenTypeBlackList( +ErrCode RSClientToRenderConnection::SetVirtualScreenTypeBlackList( ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) { if (typeBlackListVector.empty()) { @@ -635,7 +635,7 @@ ErrCode RSRenderProcessConnection::SetVirtualScreenTypeBlackList( return ERR_OK; } -ErrCode RSRenderProcessConnection::AddVirtualScreenBlackList( +ErrCode RSClientToRenderConnection::AddVirtualScreenBlackList( ScreenId id, std::vector& blackListVector, int32_t& repCode) { if (blackListVector.empty()) { @@ -652,7 +652,7 @@ ErrCode RSRenderProcessConnection::AddVirtualScreenBlackList( return ERR_OK; } -ErrCode RSRenderProcessConnection::RemoveVirtualScreenBlackList( +ErrCode RSClientToRenderConnection::RemoveVirtualScreenBlackList( ScreenId id, std::vector& blackListVector, int32_t& repCode) { if (blackListVector.empty()) { @@ -669,7 +669,7 @@ ErrCode RSRenderProcessConnection::RemoveVirtualScreenBlackList( return ERR_OK; } -int32_t RSRenderProcessConnection::SetVirtualScreenSecurityExemptionList( +int32_t RSClientToRenderConnection::SetVirtualScreenSecurityExemptionList( ScreenId id, const std::vector& securityExemptionList) { @@ -679,7 +679,7 @@ int32_t RSRenderProcessConnection::SetVirtualScreenSecurityExemptionList( return screenManager_->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); } -int32_t RSRenderProcessConnection::SetScreenSecurityMask(ScreenId id, +int32_t RSClientToRenderConnection::SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) { if (!screenManager_) { @@ -688,7 +688,7 @@ int32_t RSRenderProcessConnection::SetScreenSecurityMask(ScreenId id, return screenManager_->SetScreenSecurityMask(id, std::move(securityMask)); } -int32_t RSRenderProcessConnection::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, +int32_t RSClientToRenderConnection::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation) { if (screenManager_ == nullptr) { @@ -697,7 +697,7 @@ int32_t RSRenderProcessConnection::SetMirrorScreenVisibleRect(ScreenId id, const return screenManager_->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); } -int32_t RSRenderProcessConnection::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) +int32_t RSClientToRenderConnection::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -706,7 +706,7 @@ int32_t RSRenderProcessConnection::SetCastScreenEnableSkipWindow(ScreenId id, bo return screenManager_->SetCastScreenEnableSkipWindow(id, enable); } -int32_t RSRenderProcessConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) +int32_t RSClientToRenderConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -716,7 +716,7 @@ int32_t RSRenderProcessConnection::SetVirtualScreenSurface(ScreenId id, sptr callback) { if (!callback) { @@ -741,14 +741,14 @@ int32_t RSRenderProcessConnection::RegisterPointerLuminanceChangeCallback( return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::UnRegisterPointerLuminanceChangeCallback() +int32_t RSClientToRenderConnection::UnRegisterPointerLuminanceChangeCallback() { RSMagicPointerRenderManager::GetInstance().UnRegisterPointerLuminanceChangeCallback(remotePid_); return StatusCode::SUCCESS; } #endif -void RSRenderProcessConnection::RemoveVirtualScreen(ScreenId id) +void RSClientToRenderConnection::RemoveVirtualScreen(ScreenId id) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -760,7 +760,7 @@ void RSRenderProcessConnection::RemoveVirtualScreen(ScreenId id) NotifyRefreshRateEvent(event); } -void RSRenderProcessConnection::SetScreenActiveMode(ScreenId id, uint32_t modeId) +void RSClientToRenderConnection::SetScreenActiveMode(ScreenId id, uint32_t modeId) { if (!screenManager_) { return; @@ -777,15 +777,15 @@ void RSRenderProcessConnection::SetScreenActiveMode(ScreenId id, uint32_t modeId } } -void RSRenderProcessConnection::SyncFrameRateRange(FrameRateLinkerId id, +void RSClientToRenderConnection::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, int32_t animatorExpectedFrameRate) { if (!mainThread_) { return; } mainThread_->ScheduleTask( - [weakThis = wptr(this), id, &range, animatorExpectedFrameRate]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id, &range, animatorExpectedFrameRate]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -821,14 +821,14 @@ void RSRenderProcessConnection::SyncFrameRateRange(FrameRateLinkerId id, }).wait(); } -void RSRenderProcessConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) +void RSClientToRenderConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) { if (!mainThread_) { return; } mainThread_->ScheduleTask( - [weakThis = wptr(this), id]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -843,7 +843,7 @@ void RSRenderProcessConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) }).wait(); } -ErrCode RSRenderProcessConnection::GetRefreshInfo(pid_t pid, std::string& enable) +ErrCode RSClientToRenderConnection::GetRefreshInfo(pid_t pid, std::string& enable) { if (!mainThread_) { enable = ""; @@ -861,8 +861,8 @@ ErrCode RSRenderProcessConnection::GetRefreshInfo(pid_t pid, std::string& enable if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU RSHardwareThread::Instance().ScheduleTask( - [weakThis = wptr(this), &dumpString, &surfaceName]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -871,8 +871,8 @@ ErrCode RSRenderProcessConnection::GetRefreshInfo(pid_t pid, std::string& enable #endif } else { mainThread_->ScheduleTask( - [weakThis = wptr(this), &dumpString, &surfaceName]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -883,7 +883,7 @@ ErrCode RSRenderProcessConnection::GetRefreshInfo(pid_t pid, std::string& enable return ERR_OK; } -ErrCode RSRenderProcessConnection::GetRefreshInfoToSP(NodeId id, std::string& enable) +ErrCode RSClientToRenderConnection::GetRefreshInfoToSP(NodeId id, std::string& enable) { if (!mainThread_) { enable = ""; @@ -891,8 +891,8 @@ ErrCode RSRenderProcessConnection::GetRefreshInfoToSP(NodeId id, std::string& en } std::string dumpString; auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - auto dumpTask = [weakThis = wptr(this), &dumpString, &id]() { - sptr connection = weakThis.promote(); + auto dumpTask = [weakThis = wptr(this), &dumpString, &id]() { + sptr connection = weakThis.promote(); if (connection == nullptr) { RS_LOGE("GetRefreshInfoToSP connection is nullptr"); return; @@ -914,7 +914,7 @@ ErrCode RSRenderProcessConnection::GetRefreshInfoToSP(NodeId id, std::string& en return ERR_OK; } -int32_t RSRenderProcessConnection::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnection::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { if (!screenManager_) { return StatusCode::SCREEN_MANAGER_NULL; @@ -922,7 +922,7 @@ int32_t RSRenderProcessConnection::SetPhysicalScreenResolution(ScreenId id, uint return screenManager_->SetPhysicalScreenResolution(id, width, height); } -int32_t RSRenderProcessConnection::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnection::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -943,7 +943,7 @@ int32_t RSRenderProcessConnection::SetVirtualScreenResolution(ScreenId id, uint3 } } -ErrCode RSRenderProcessConnection::MarkPowerOffNeedProcessOneFrame() +ErrCode RSClientToRenderConnection::MarkPowerOffNeedProcessOneFrame() { auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); if (renderType != UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { @@ -951,8 +951,8 @@ ErrCode RSRenderProcessConnection::MarkPowerOffNeedProcessOneFrame() } #ifdef RS_ENABLE_GPU renderThread_.PostTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -963,7 +963,7 @@ ErrCode RSRenderProcessConnection::MarkPowerOffNeedProcessOneFrame() return ERR_OK; } -ErrCode RSRenderProcessConnection::RepaintEverything() +ErrCode RSClientToRenderConnection::RepaintEverything() { if (mainThread_ == nullptr) { RS_LOGE("RepaintEverything, mainThread_ is null, return"); @@ -978,15 +978,15 @@ ErrCode RSRenderProcessConnection::RepaintEverything() return ERR_OK; } -ErrCode RSRenderProcessConnection::ForceRefreshOneFrameWithNextVSync() +ErrCode RSClientToRenderConnection::ForceRefreshOneFrameWithNextVSync() { if (!mainThread_) { RS_LOGE("%{public}s mainThread_ is nullptr, return", __func__); return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this)]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this)]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -999,14 +999,14 @@ ErrCode RSRenderProcessConnection::ForceRefreshOneFrameWithNextVSync() return ERR_OK; } -void RSRenderProcessConnection::DisablePowerOffRenderControl(ScreenId id) +void RSClientToRenderConnection::DisablePowerOffRenderControl(ScreenId id) { auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU renderThread_.PostTask( - [weakThis = wptr(this), id]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -1078,7 +1078,7 @@ void TakeSurfaceCaptureForUIWithUni(NodeId id, sptr c } } -void RSRenderProcessConnection::TakeSurfaceCapture(NodeId id, sptr callback, +void RSClientToRenderConnection::TakeSurfaceCapture(NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions permissions) { @@ -1091,7 +1091,7 @@ void RSRenderProcessConnection::TakeSurfaceCapture(NodeId id, sptr void { - RS_TRACE_NAME_FMT("RSRenderProcessConnection::TakeSurfaceCapture captureTask nodeId:[%" PRIu64 "]", id); + RS_TRACE_NAME_FMT("RSClientToRenderConnection::TakeSurfaceCapture captureTask nodeId:[%" PRIu64 "]", id); RS_LOGD("TakeSurfaceCapture captureTask begin nodeId:[%{public}" PRIu64 "]", id); if (captureConfig.captureType == SurfaceCaptureType::UICAPTURE) { // When the isSync flag in captureConfig is true, UI capture processes commands before capture. @@ -1151,7 +1151,7 @@ void RSRenderProcessConnection::TakeSurfaceCapture(NodeId id, sptrPostTask(captureTask); } -std::vector>> RSRenderProcessConnection::TakeSurfaceCaptureSoloNode( +std::vector>> RSClientToRenderConnection::TakeSurfaceCaptureSoloNode( NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions permissions) { RS_LOGI("TakeSurfaceCaptureSoloNode nodeId:[%{public}" PRIu64 "]", id); @@ -1159,7 +1159,7 @@ std::vector>> RSRenderProcess std::function captureTask = [id, captureConfig, &pixelMapIdPairVector, isSystemCalling = permissions.isSystemCalling, selfCapture = permissions.selfCapture]() { - RS_TRACE_NAME_FMT("RSRenderProcessConnection::TakeSurfaceCaptureSoloNode captureTask" + RS_TRACE_NAME_FMT("RSClientToRenderConnection::TakeSurfaceCaptureSoloNode captureTask" " nodeId:[%" PRIu64 "]", id); RS_LOGI("TakeSurfaceCaptureSoloNode captureTask begin " "nodeId:[%{public}" PRIu64 "]", id); @@ -1176,7 +1176,7 @@ std::vector>> RSRenderProcess return pixelMapIdPairVector; } -void RSRenderProcessConnection::TakeSelfSurfaceCapture( +void RSClientToRenderConnection::TakeSelfSurfaceCapture( NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) { if (!mainThread_) { @@ -1205,7 +1205,7 @@ void RSRenderProcessConnection::TakeSelfSurfaceCapture( mainThread_->PostTask(selfCaptureTask); } -ErrCode RSRenderProcessConnection::SetWindowFreezeImmediately(NodeId id, bool isFreeze, +ErrCode RSClientToRenderConnection::SetWindowFreezeImmediately(NodeId id, bool isFreeze, sptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) { @@ -1243,13 +1243,13 @@ ErrCode RSRenderProcessConnection::SetWindowFreezeImmediately(NodeId id, bool is return ERR_OK; } -void RSRenderProcessConnection::TakeUICaptureInRange( +void RSClientToRenderConnection::TakeUICaptureInRange( NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) { TakeSurfaceCaptureForUiParallel(id, callback, captureConfig, {}); } -ErrCode RSRenderProcessConnection::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, +ErrCode RSClientToRenderConnection::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, float positionZ, float positionW) { if (mainThread_ == nullptr || screenManager_ == nullptr) { @@ -1271,14 +1271,14 @@ ErrCode RSRenderProcessConnection::SetHwcNodeBounds(int64_t rsNodeId, float posi return ERR_OK; } -ErrCode RSRenderProcessConnection::RegisterApplicationAgent(uint32_t pid, sptr app) +ErrCode RSClientToRenderConnection::RegisterApplicationAgent(uint32_t pid, sptr app) { if (!mainThread_) { RS_LOGE("RegisterApplicationAgent mainThread_ is nullptr"); return ERR_INVALID_VALUE; } - auto captureTask = [weakThis = wptr(this), pid, app]() -> void { - sptr connection = weakThis.promote(); + auto captureTask = [weakThis = wptr(this), pid, app]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { RS_LOGE("RegisterApplicationAgent connection or mainThread_ is nullptr"); return; @@ -1291,7 +1291,7 @@ ErrCode RSRenderProcessConnection::RegisterApplicationAgent(uint32_t pid, sptrGetAppMemoryInMB(cpuMemSize, gpuMemSize); @@ -1330,7 +1330,7 @@ ErrCode RSRenderProcessConnection::GetTotalAppMemSize(float& cpuMemSize, float& return ERR_OK; } -ErrCode RSRenderProcessConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) +ErrCode RSClientToRenderConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) { if (!mainThread_ || !mainThread_->GetContext().GetNodeMap().ContainPid(pid)) { return ERR_INVALID_VALUE; @@ -1338,8 +1338,8 @@ ErrCode RSRenderProcessConnection::GetMemoryGraphic(int pid, MemoryGraphic& memo bool enable; if (GetUniRenderEnabled(enable) == ERR_OK && enable) { renderThread_.PostSyncTask( - [weakThis = wptr(this), &memoryGraphic, &pid] { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &memoryGraphic, &pid] { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -1352,7 +1352,7 @@ ErrCode RSRenderProcessConnection::GetMemoryGraphic(int pid, MemoryGraphic& memo } } -ErrCode RSRenderProcessConnection::GetMemoryGraphics(std::vector& memoryGraphics) +ErrCode RSClientToRenderConnection::GetMemoryGraphics(std::vector& memoryGraphics) { bool res; if (!mainThread_ || GetUniRenderEnabled(res) != ERR_OK || !res) { @@ -1368,8 +1368,8 @@ ErrCode RSRenderProcessConnection::GetMemoryGraphics(std::vector& } }); renderThread_.PostSyncTask( - [weakThis = wptr(this), &memoryGraphics, &pids] { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &memoryGraphics, &pids] { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -1379,15 +1379,15 @@ ErrCode RSRenderProcessConnection::GetMemoryGraphics(std::vector& return ERR_OK; } -ErrCode RSRenderProcessConnection::RegisterBufferClearListener( +ErrCode RSClientToRenderConnection::RegisterBufferClearListener( NodeId id, sptr callback) { if (!mainThread_) { return ERR_INVALID_VALUE; } auto registerBufferClearListener = - [id, callback, weakThis = wptr(this)]() -> bool { - sptr connection = weakThis.promote(); + [id, callback, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return false; } @@ -1401,15 +1401,15 @@ ErrCode RSRenderProcessConnection::RegisterBufferClearListener( return ERR_OK; } -ErrCode RSRenderProcessConnection::RegisterBufferAvailableListener( +ErrCode RSClientToRenderConnection::RegisterBufferAvailableListener( NodeId id, sptr callback, bool isFromRenderThread) { if (!mainThread_) { return ERR_INVALID_VALUE; } auto registerBufferAvailableListener = - [id, callback, isFromRenderThread, weakThis = wptr(this)]() -> bool { - sptr connection = weakThis.promote(); + [id, callback, isFromRenderThread, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return false; } @@ -1423,7 +1423,7 @@ ErrCode RSRenderProcessConnection::RegisterBufferAvailableListener( return ERR_OK; } -bool RSRenderProcessConnection::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) +bool RSClientToRenderConnection::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1432,7 +1432,7 @@ bool RSRenderProcessConnection::SetVirtualMirrorScreenCanvasRotation(ScreenId id return screenManager_->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); } -int32_t RSRenderProcessConnection::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) +int32_t RSClientToRenderConnection::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) { if (!screenManager_) { return StatusCode::SCREEN_MANAGER_NULL; @@ -1440,14 +1440,14 @@ int32_t RSRenderProcessConnection::SetVirtualScreenAutoRotation(ScreenId id, boo return screenManager_->SetVirtualScreenAutoRotation(id, isAutoRotation); } -ErrCode RSRenderProcessConnection::SetGlobalDarkColorMode(bool isDark) +ErrCode RSClientToRenderConnection::SetGlobalDarkColorMode(bool isDark) { std::lock_guard lock(mutex_); if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), isDark]() { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), isDark]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { RS_LOGE("SetGlobalDarkColorMode fail"); return; @@ -1458,7 +1458,7 @@ ErrCode RSRenderProcessConnection::SetGlobalDarkColorMode(bool isDark) return ERR_OK; } -bool RSRenderProcessConnection::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) +bool RSClientToRenderConnection::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1467,7 +1467,7 @@ bool RSRenderProcessConnection::SetVirtualMirrorScreenScaleMode(ScreenId id, Scr return screenManager_->SetVirtualMirrorScreenScaleMode(id, scaleMode); } -int32_t RSRenderProcessConnection::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) +int32_t RSClientToRenderConnection::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1476,7 +1476,7 @@ int32_t RSRenderProcessConnection::GetScreenHDRCapability(ScreenId id, RSScreenH return screenManager_->GetScreenHDRCapability(id, screenHdrCapability); } -ErrCode RSRenderProcessConnection::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) +ErrCode RSClientToRenderConnection::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -1502,7 +1502,7 @@ ErrCode RSRenderProcessConnection::GetPixelFormat(ScreenId id, GraphicPixelForma } } -ErrCode RSRenderProcessConnection::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) +ErrCode RSClientToRenderConnection::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -1528,7 +1528,7 @@ ErrCode RSRenderProcessConnection::SetPixelFormat(ScreenId id, GraphicPixelForma } } -ErrCode RSRenderProcessConnection::GetScreenSupportedHDRFormats( +ErrCode RSClientToRenderConnection::GetScreenSupportedHDRFormats( ScreenId id, std::vector& hdrFormats, int32_t& resCode) { if (!screenManager_) { @@ -1555,7 +1555,7 @@ ErrCode RSRenderProcessConnection::GetScreenSupportedHDRFormats( } } -ErrCode RSRenderProcessConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) +ErrCode RSClientToRenderConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -1581,7 +1581,7 @@ ErrCode RSRenderProcessConnection::GetScreenHDRFormat(ScreenId id, ScreenHDRForm } } -ErrCode RSRenderProcessConnection::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) +ErrCode RSClientToRenderConnection::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -1607,7 +1607,7 @@ ErrCode RSRenderProcessConnection::SetScreenHDRFormat(ScreenId id, int32_t modeI } } -ErrCode RSRenderProcessConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +ErrCode RSClientToRenderConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; @@ -1649,7 +1649,7 @@ ErrCode RSRenderProcessConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hd return ERR_OK; } -ErrCode RSRenderProcessConnection::GetScreenSupportedColorSpaces( +ErrCode RSClientToRenderConnection::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces, int32_t& resCode) { if (!screenManager_) { @@ -1676,7 +1676,7 @@ ErrCode RSRenderProcessConnection::GetScreenSupportedColorSpaces( } } -ErrCode RSRenderProcessConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +ErrCode RSClientToRenderConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { if (!mainThread_) { success = false; @@ -1714,7 +1714,7 @@ ErrCode RSRenderProcessConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, return ERR_OK; } -ErrCode RSRenderProcessConnection::GetPixelmap(NodeId id, const std::shared_ptr pixelmap, +ErrCode RSClientToRenderConnection::GetPixelmap(NodeId id, const std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) { if (!mainThread_) { @@ -1774,7 +1774,7 @@ ErrCode RSRenderProcessConnection::GetPixelmap(NodeId id, const std::shared_ptr< return ERR_OK; } -bool RSRenderProcessConnection::RegisterTypeface(uint64_t globalUniqueId, +bool RSClientToRenderConnection::RegisterTypeface(uint64_t globalUniqueId, std::shared_ptr& typeface) { RS_LOGI("reg typeface, pid[%{public}d], familyname:%{public}s, uniqueid:%{public}u", @@ -1784,7 +1784,7 @@ bool RSRenderProcessConnection::RegisterTypeface(uint64_t globalUniqueId, return true; } -bool RSRenderProcessConnection::UnRegisterTypeface(uint64_t globalUniqueId) +bool RSClientToRenderConnection::UnRegisterTypeface(uint64_t globalUniqueId) { RS_LOGW("uneg typeface: pid[%{public}d], uniqueid:%{public}u", RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); @@ -1792,7 +1792,7 @@ bool RSRenderProcessConnection::UnRegisterTypeface(uint64_t globalUniqueId) return true; } -ErrCode RSRenderProcessConnection::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) +ErrCode RSClientToRenderConnection::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) { if (!screenManager_) { resCode = StatusCode::SCREEN_NOT_FOUND; @@ -1817,7 +1817,7 @@ ErrCode RSRenderProcessConnection::SetScreenSkipFrameInterval(uint64_t id, uint3 return ERR_OK; } -ErrCode RSRenderProcessConnection::SetVirtualScreenRefreshRate( +ErrCode RSClientToRenderConnection::SetVirtualScreenRefreshRate( ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) { if (!screenManager_) { @@ -1828,7 +1828,7 @@ ErrCode RSRenderProcessConnection::SetVirtualScreenRefreshRate( return ERR_OK; } -void RSRenderProcessConnection::SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) +void RSClientToRenderConnection::SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) { if (!screenManager_) { return; @@ -1836,10 +1836,10 @@ void RSRenderProcessConnection::SetScreenOffset(ScreenId id, int32_t offsetX, in screenManager_->SetScreenOffset(id, offsetX, offsetY); } -void RSRenderProcessConnection::SetScreenFrameGravity(ScreenId id, int32_t gravity) +void RSClientToRenderConnection::SetScreenFrameGravity(ScreenId id, int32_t gravity) { - auto task = [weakThis = wptr(this), id, gravity]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), id, gravity]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1853,7 +1853,7 @@ void RSRenderProcessConnection::SetScreenFrameGravity(ScreenId id, int32_t gravi mainThread_->PostTask(task); } -ErrCode RSRenderProcessConnection::RegisterOcclusionChangeCallback( +ErrCode RSClientToRenderConnection::RegisterOcclusionChangeCallback( sptr callback, int32_t& repCode) { std::lock_guard lock(mutex_); @@ -1871,7 +1871,7 @@ ErrCode RSRenderProcessConnection::RegisterOcclusionChangeCallback( return ERR_OK; } -int32_t RSRenderProcessConnection::RegisterSurfaceOcclusionChangeCallback( +int32_t RSClientToRenderConnection::RegisterSurfaceOcclusionChangeCallback( NodeId id, sptr callback, std::vector& partitionPoints) { std::lock_guard lock(mutex_); @@ -1886,7 +1886,7 @@ int32_t RSRenderProcessConnection::RegisterSurfaceOcclusionChangeCallback( return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) +int32_t RSClientToRenderConnection::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) { std::lock_guard lock(mutex_); if (!mainThread_) { @@ -1896,7 +1896,7 @@ int32_t RSRenderProcessConnection::UnRegisterSurfaceOcclusionChangeCallback(Node return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::RegisterHgmConfigChangeCallback(sptr callback) +int32_t RSClientToRenderConnection::RegisterHgmConfigChangeCallback(sptr callback) { std::lock_guard lock(mutex_); if (!callback) { @@ -1910,7 +1910,7 @@ int32_t RSRenderProcessConnection::RegisterHgmConfigChangeCallback(sptr callback) { std::lock_guard lock(mutex_); @@ -1925,7 +1925,7 @@ int32_t RSRenderProcessConnection::RegisterHgmRefreshRateModeChangeCallback( return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::RegisterHgmRefreshRateUpdateCallback( +int32_t RSClientToRenderConnection::RegisterHgmRefreshRateUpdateCallback( sptr callback) { std::lock_guard lock(mutex_); @@ -1936,7 +1936,7 @@ int32_t RSRenderProcessConnection::RegisterHgmRefreshRateUpdateCallback( return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::RegisterFirstFrameCommitCallback( +int32_t RSClientToRenderConnection::RegisterFirstFrameCommitCallback( sptr callback) { std::lock_guard lock(mutex_); @@ -1944,7 +1944,7 @@ int32_t RSRenderProcessConnection::RegisterFirstFrameCommitCallback( return StatusCode::SUCCESS; } -int32_t RSRenderProcessConnection::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, +int32_t RSClientToRenderConnection::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, sptr callback) { if (dstPid == 0) { @@ -1959,13 +1959,13 @@ int32_t RSRenderProcessConnection::RegisterFrameRateLinkerExpectedFpsUpdateCallb return StatusCode::SUCCESS; } -ErrCode RSRenderProcessConnection::SetAppWindowNum(uint32_t num) +ErrCode RSClientToRenderConnection::SetAppWindowNum(uint32_t num) { if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), num]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), num]() -> void { + sptr connection = weakThis.promote(); if (!connection || !connection->mainThread_) { return; } @@ -1976,7 +1976,7 @@ ErrCode RSRenderProcessConnection::SetAppWindowNum(uint32_t num) return ERR_OK; } -ErrCode RSRenderProcessConnection::SetSystemAnimatedScenes( +ErrCode RSClientToRenderConnection::SetSystemAnimatedScenes( SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) { std::lock_guard lock(mutex_); @@ -1994,13 +1994,13 @@ ErrCode RSRenderProcessConnection::SetSystemAnimatedScenes( #endif } -void RSRenderProcessConnection::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) +void RSClientToRenderConnection::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) { if (!mainThread_) { return; } - auto task = [weakThis = wptr(this), watermarkImg, isShow]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), watermarkImg, isShow]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2009,7 +2009,7 @@ void RSRenderProcessConnection::ShowWatermark(const std::shared_ptrPostTask(task); } -int32_t RSRenderProcessConnection::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnection::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -2018,8 +2018,8 @@ int32_t RSRenderProcessConnection::ResizeVirtualScreen(ScreenId id, uint32_t wid if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU return RSHardwareThread::Instance().ScheduleTask( - [weakThis = wptr(this), id, width, height]() -> int32_t { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id, width, height]() -> int32_t { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return RS_CONNECTION_ERROR; } @@ -2031,8 +2031,8 @@ int32_t RSRenderProcessConnection::ResizeVirtualScreen(ScreenId id, uint32_t wid #endif } else if (mainThread_ != nullptr) { return mainThread_->ScheduleTask( - [weakThis = wptr(this), id, width, height]() -> int32_t { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id, width, height]() -> int32_t { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return RS_CONNECTION_ERROR; } @@ -2044,7 +2044,7 @@ int32_t RSRenderProcessConnection::ResizeVirtualScreen(ScreenId id, uint32_t wid } } -ErrCode RSRenderProcessConnection::ReportJankStats() +ErrCode RSClientToRenderConnection::ReportJankStats() { #ifdef RS_ENABLE_GPU auto task = []() -> void { RSJankStats::GetInstance().ReportJankStats(); }; @@ -2053,7 +2053,7 @@ ErrCode RSRenderProcessConnection::ReportJankStats() return ERR_OK; } -ErrCode RSRenderProcessConnection::NotifyLightFactorStatus(int32_t lightFactorStatus) +ErrCode RSClientToRenderConnection::NotifyLightFactorStatus(int32_t lightFactorStatus) { HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, lightFactorStatus]() { auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); @@ -2064,7 +2064,7 @@ ErrCode RSRenderProcessConnection::NotifyLightFactorStatus(int32_t lightFactorSt return ERR_OK; } -void RSRenderProcessConnection::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) +void RSClientToRenderConnection::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) { if (!mainThread_) { return; @@ -2078,7 +2078,7 @@ void RSRenderProcessConnection::NotifyPackageEvent(uint32_t listSize, const std: }); } -void RSRenderProcessConnection::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, +void RSClientToRenderConnection::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, const std::vector>& newConfig) { HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, listSize, pkgName, newConfig] () { @@ -2089,7 +2089,7 @@ void RSRenderProcessConnection::NotifyAppStrategyConfigChangeEvent(const std::st }); } -ErrCode RSRenderProcessConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +ErrCode RSClientToRenderConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) { if (!appVSyncDistributor_) { return ERR_INVALID_VALUE; @@ -2098,7 +2098,7 @@ ErrCode RSRenderProcessConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t r return ERR_OK; } -bool RSRenderProcessConnection::NotifySoftVsyncRateDiscountEvent(uint32_t pid, +bool RSClientToRenderConnection::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) { if (!appVSyncDistributor_) { @@ -2135,7 +2135,7 @@ bool RSRenderProcessConnection::NotifySoftVsyncRateDiscountEvent(uint32_t pid, return true; } -ErrCode RSRenderProcessConnection::NotifyHgmConfigEvent(const std::string &eventName, bool state) +ErrCode RSClientToRenderConnection::NotifyHgmConfigEvent(const std::string &eventName, bool state) { HgmTaskHandleThread::Instance().PostTask([eventName, state] () { auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); @@ -2156,7 +2156,7 @@ ErrCode RSRenderProcessConnection::NotifyHgmConfigEvent(const std::string &event return ERR_OK; } -ErrCode RSRenderProcessConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) +ErrCode RSClientToRenderConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) { HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, id, expectedFrameRate] () { HgmConfigCallbackManager::GetInstance()->SyncXComponentExpectedFrameRateCallback( @@ -2165,7 +2165,7 @@ ErrCode RSRenderProcessConnection::NotifyXComponentExpectedFrameRate(const std:: return ERR_OK; } -ErrCode RSRenderProcessConnection::ReportEventResponse(DataBaseRs info) +ErrCode RSClientToRenderConnection::ReportEventResponse(DataBaseRs info) { auto task = [info]() -> void { RSJankStats::GetInstance().SetReportEventResponse(info); @@ -2178,7 +2178,7 @@ ErrCode RSRenderProcessConnection::ReportEventResponse(DataBaseRs info) return ERR_OK; } -ErrCode RSRenderProcessConnection::ReportEventComplete(DataBaseRs info) +ErrCode RSClientToRenderConnection::ReportEventComplete(DataBaseRs info) { auto task = [info]() -> void { RSJankStats::GetInstance().SetReportEventComplete(info); @@ -2190,7 +2190,7 @@ ErrCode RSRenderProcessConnection::ReportEventComplete(DataBaseRs info) return ERR_OK; } -ErrCode RSRenderProcessConnection::ReportEventJankFrame(DataBaseRs info) +ErrCode RSClientToRenderConnection::ReportEventJankFrame(DataBaseRs info) { #ifdef RS_ENABLE_GPU bool isReportTaskDelayed = renderThread_.IsMainLooping(); @@ -2203,7 +2203,7 @@ ErrCode RSRenderProcessConnection::ReportEventJankFrame(DataBaseRs info) return ERR_OK; } -void RSRenderProcessConnection::ReportRsSceneJankStart(AppInfo info) +void RSClientToRenderConnection::ReportRsSceneJankStart(AppInfo info) { auto task = [info]() -> void { RSJankStats::GetInstance().SetReportRsSceneJankStart(info); @@ -2211,7 +2211,7 @@ void RSRenderProcessConnection::ReportRsSceneJankStart(AppInfo info) renderThread_.PostTask(task); } -void RSRenderProcessConnection::ReportRsSceneJankEnd(AppInfo info) +void RSClientToRenderConnection::ReportRsSceneJankEnd(AppInfo info) { auto task = [info]() -> void { RSJankStats::GetInstance().SetReportRsSceneJankEnd(info); @@ -2219,7 +2219,7 @@ void RSRenderProcessConnection::ReportRsSceneJankEnd(AppInfo info) renderThread_.PostTask(task); } -ErrCode RSRenderProcessConnection::ReportGameStateData(GameStateData info) +ErrCode RSClientToRenderConnection::ReportGameStateData(GameStateData info) { RS_LOGD("ReportGameStateData = %{public}s, uid = %{public}d, state = %{public}d, " "pid = %{public}d renderTid = %{public}d ", @@ -2229,15 +2229,15 @@ ErrCode RSRenderProcessConnection::ReportGameStateData(GameStateData info) return ERR_OK; } -ErrCode RSRenderProcessConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, +ErrCode RSClientToRenderConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), id, isEnabled, selfDrawingType, + auto task = [weakThis = wptr(this), id, isEnabled, selfDrawingType, dynamicHardwareEnable]() -> void { - sptr connection = weakThis.promote(); + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2251,14 +2251,14 @@ ErrCode RSRenderProcessConnection::SetHardwareEnabled(NodeId id, bool isEnabled, return ERR_OK; } -ErrCode RSRenderProcessConnection::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +ErrCode RSClientToRenderConnection::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) { if (!mainThread_) { resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), id, needHidePrivacyContent]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), id, needHidePrivacyContent]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2273,7 +2273,7 @@ ErrCode RSRenderProcessConnection::SetHidePrivacyContent(NodeId id, bool needHid return ERR_OK; } -ErrCode RSRenderProcessConnection::SetCacheEnabledForRotation(bool isEnabled) +ErrCode RSClientToRenderConnection::SetCacheEnabledForRotation(bool isEnabled) { if (!mainThread_) { return ERR_INVALID_VALUE; @@ -2285,7 +2285,7 @@ ErrCode RSRenderProcessConnection::SetCacheEnabledForRotation(bool isEnabled) return ERR_OK; } -std::vector RSRenderProcessConnection::GetActiveDirtyRegionInfo() +std::vector RSClientToRenderConnection::GetActiveDirtyRegionInfo() { #ifdef RS_ENABLE_GPU const auto& activeDirtyRegionInfos = GpuDirtyRegionCollection::GetInstance().GetActiveDirtyRegionInfo(); @@ -2296,7 +2296,7 @@ std::vector RSRenderProcessConnection::GetActiveDirtyRegi #endif } -GlobalDirtyRegionInfo RSRenderProcessConnection::GetGlobalDirtyRegionInfo() +GlobalDirtyRegionInfo RSClientToRenderConnection::GetGlobalDirtyRegionInfo() { #ifdef RS_ENABLE_GPU const auto& globalDirtyRegionInfo = GpuDirtyRegionCollection::GetInstance().GetGlobalDirtyRegionInfo(); @@ -2307,7 +2307,7 @@ GlobalDirtyRegionInfo RSRenderProcessConnection::GetGlobalDirtyRegionInfo() #endif } -ErrCode RSRenderProcessConnection::GetHdrOnDuration(int64_t& hdrOnDuration) +ErrCode RSClientToRenderConnection::GetHdrOnDuration(int64_t& hdrOnDuration) { auto rsHdrCollection = RsHdrCollection::GetInstance(); if (rsHdrCollection == nullptr) { @@ -2318,7 +2318,7 @@ ErrCode RSRenderProcessConnection::GetHdrOnDuration(int64_t& hdrOnDuration) return ERR_OK; } -ErrCode RSRenderProcessConnection::SetVmaCacheStatus(bool flag) +ErrCode RSClientToRenderConnection::SetVmaCacheStatus(bool flag) { #ifdef RS_ENABLE_GPU renderThread_.SetVmaCacheStatus(flag); @@ -2327,7 +2327,7 @@ ErrCode RSRenderProcessConnection::SetVmaCacheStatus(bool flag) } #ifdef TP_FEATURE_ENABLE -ErrCode RSRenderProcessConnection::SetTpFeatureConfig(int32_t feature, const char* config, +ErrCode RSClientToRenderConnection::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { switch (tpFeatureConfigType) { @@ -2354,7 +2354,7 @@ ErrCode RSRenderProcessConnection::SetTpFeatureConfig(int32_t feature, const cha } #endif -void RSRenderProcessConnection::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) +void RSClientToRenderConnection::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) { if (isVirtualScreenUsingStatus) { EventInfo event = { "VOTER_VIRTUALDISPLAY", ADD_VOTE, OLED_60_HZ, OLED_60_HZ }; @@ -2366,13 +2366,13 @@ void RSRenderProcessConnection::SetVirtualScreenUsingStatus(bool isVirtualScreen return; } -ErrCode RSRenderProcessConnection::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) +ErrCode RSClientToRenderConnection::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) { if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), isCurtainScreenOn]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), isCurtainScreenOn]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2382,15 +2382,15 @@ ErrCode RSRenderProcessConnection::SetCurtainScreenUsingStatus(bool isCurtainScr return ERR_OK; } -ErrCode RSRenderProcessConnection::DropFrameByPid(const std::vector pidList) +ErrCode RSClientToRenderConnection::DropFrameByPid(const std::vector pidList) { if (!mainThread_) { return ERR_INVALID_VALUE; } mainThread_->ScheduleTask( - [weakThis = wptr(this), pidList]() { + [weakThis = wptr(this), pidList]() { // don't use 'this' directly - sptr connection = weakThis.promote(); + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2400,7 +2400,7 @@ ErrCode RSRenderProcessConnection::DropFrameByPid(const std::vector pid return ERR_OK; } -int32_t RSRenderProcessConnection::RegisterUIExtensionCallback(uint64_t userId, sptr callback, +int32_t RSClientToRenderConnection::RegisterUIExtensionCallback(uint64_t userId, sptr callback, bool unobscured) { std::lock_guard lock(mutex_); @@ -2415,7 +2415,7 @@ int32_t RSRenderProcessConnection::RegisterUIExtensionCallback(uint64_t userId, return StatusCode::SUCCESS; } -ErrCode RSRenderProcessConnection::SetVirtualScreenStatus(ScreenId id, +ErrCode RSClientToRenderConnection::SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) { if (!screenManager_) { @@ -2428,7 +2428,7 @@ ErrCode RSRenderProcessConnection::SetVirtualScreenStatus(ScreenId id, return StatusCode::SUCCESS; } -ErrCode RSRenderProcessConnection::SetAncoForceDoDirect(bool direct, bool& res) +ErrCode RSClientToRenderConnection::SetAncoForceDoDirect(bool direct, bool& res) { std::lock_guard lock(mutex_); if (mainThread_ == nullptr) { @@ -2440,7 +2440,7 @@ ErrCode RSRenderProcessConnection::SetAncoForceDoDirect(bool direct, bool& res) return ERR_OK; } -void RSRenderProcessConnection::SetFreeMultiWindowStatus(bool enable) +void RSClientToRenderConnection::SetFreeMultiWindowStatus(bool enable) { #ifdef RS_ENABLE_GPU if (mainThread_ == nullptr) { @@ -2453,26 +2453,26 @@ void RSRenderProcessConnection::SetFreeMultiWindowStatus(bool enable) #endif } -ErrCode RSRenderProcessConnection::RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, +ErrCode RSClientToRenderConnection::RegisterSurfaceBufferCallback(pid_t pid, uint64_t uid, sptr callback) { RSSurfaceBufferCallbackManager::Instance().RegisterSurfaceBufferCallback(pid, uid, callback); return ERR_OK; } -ErrCode RSRenderProcessConnection::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) +ErrCode RSClientToRenderConnection::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) { RSSurfaceBufferCallbackManager::Instance().UnregisterSurfaceBufferCallback(pid, uid); return ERR_OK; } -ErrCode RSRenderProcessConnection::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) +ErrCode RSClientToRenderConnection::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) { if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), nodeIdStr, isForceRefresh]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), nodeIdStr, isForceRefresh]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2490,19 +2490,19 @@ ErrCode RSRenderProcessConnection::SetForceRefresh(const std::string &nodeIdStr, return ERR_OK; } -void RSRenderProcessConnection::RegisterTransactionDataCallback(uint64_t token, +void RSClientToRenderConnection::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { RSTransactionDataCallbackManager::Instance().RegisterTransactionDataCallback(token, timeStamp, callback); } -void RSRenderProcessConnection::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) +void RSClientToRenderConnection::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) { if (mainThread_ == nullptr) { return; } - auto task = [weakThis = wptr(this), nodeIdStr, isColorFollow]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), nodeIdStr, isColorFollow]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2521,13 +2521,13 @@ void RSRenderProcessConnection::SetColorFollow(const std::string &nodeIdStr, boo mainThread_->PostTask(task); } -ErrCode RSRenderProcessConnection::SetWindowContainer(NodeId nodeId, bool value) +ErrCode RSClientToRenderConnection::SetWindowContainer(NodeId nodeId, bool value) { if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), nodeId, value]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), nodeId, value]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2551,32 +2551,32 @@ ErrCode RSRenderProcessConnection::SetWindowContainer(NodeId nodeId, bool value) return ERR_OK; } -bool RSRenderProcessConnection::GetHighContrastTextState() +bool RSClientToRenderConnection::GetHighContrastTextState() { return RSBaseRenderEngine::IsHighContrastEnabled(); } -ErrCode RSRenderProcessConnection::AvcodecVideoStart( +ErrCode RSClientToRenderConnection::AvcodecVideoStart( uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { RSJankStats::GetInstance().AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); return ERR_OK; } -ErrCode RSRenderProcessConnection::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +ErrCode RSClientToRenderConnection::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) { RSJankStats::GetInstance().AvcodecVideoStop(uniqueId, surfaceName, fps); return ERR_OK; } -ErrCode RSRenderProcessConnection::SetBehindWindowFilterEnabled(bool enabled) +ErrCode RSClientToRenderConnection::SetBehindWindowFilterEnabled(bool enabled) { if (!mainThread_) { RS_LOGE("SetBehindWindowFilterEnabled mainThread_ is nullptr."); return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), enabled]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), enabled]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -2606,27 +2606,27 @@ ErrCode RSRenderProcessConnection::SetBehindWindowFilterEnabled(bool enabled) return ERR_OK; } -ErrCode RSRenderProcessConnection::GetBehindWindowFilterEnabled(bool& enabled) +ErrCode RSClientToRenderConnection::GetBehindWindowFilterEnabled(bool& enabled) { enabled = RSSystemProperties::GetBehindWindowFilterEnabled(); return ERR_OK; } -int32_t RSRenderProcessConnection::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) +int32_t RSClientToRenderConnection::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) { MemorySnapshotInfo memorySnapshotInfo; bool ret = MemorySnapshot::Instance().GetMemorySnapshotInfoByPid(pid, memorySnapshotInfo); if (!ret) { - RS_LOGD("RSRenderProcessConnection::GetPidGpuMemoryInMB fail to find pid!"); + RS_LOGD("RSClientToRenderConnection::GetPidGpuMemoryInMB fail to find pid!"); return ERR_INVALID_VALUE; } gpuMemInMB = static_cast(memorySnapshotInfo.gpuMemory) / MEM_BYTE_TO_MB; - RS_LOGD("RSRenderProcessConnection::GetPidGpuMemoryInMB called succ"); + RS_LOGD("RSClientToRenderConnection::GetPidGpuMemoryInMB called succ"); return ERR_OK; } -RetCodeHrpService RSRenderProcessConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToRenderConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { #ifdef RS_PROFILER_ENABLED @@ -2641,7 +2641,7 @@ RetCodeHrpService RSRenderProcessConnection::ProfilerServiceOpenFile(const HrpSe #endif } -RetCodeHrpService RSRenderProcessConnection::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToRenderConnection::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { #ifdef RS_PROFILER_ENABLED @@ -2652,7 +2652,7 @@ RetCodeHrpService RSRenderProcessConnection::ProfilerServicePopulateFiles(const #endif } -bool RSRenderProcessConnection::ProfilerIsSecureScreen() +bool RSClientToRenderConnection::ProfilerIsSecureScreen() { #ifdef RS_PROFILER_ENABLED if (!RSSystemProperties::GetProfilerEnabled()) { @@ -2664,7 +2664,7 @@ bool RSRenderProcessConnection::ProfilerIsSecureScreen() #endif } -void RSRenderProcessConnection::ClearUifirstCache(NodeId id) +void RSClientToRenderConnection::ClearUifirstCache(NodeId id) { if (!mainThread_) { return; diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.h similarity index 95% rename from rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h rename to rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.h index 331ee6aa20..86f4c095aa 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_process_connection.h +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_render_connection.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H -#define RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H +#ifndef RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_RENDER_CONNECTION_H +#define RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_RENDER_CONNECTION_H #include #include @@ -26,24 +26,24 @@ #include "pipeline/render_thread/rs_uni_render_thread.h" #include "pipeline/main_thread/rs_render_service.h" #include "screen_manager/rs_screen_manager.h" -#include "transaction/rs_render_process_connection_stub.h" +#include "transaction/rs_client_to_render_connection_stub.h" #include "vsync_distributor.h" namespace OHOS { namespace Rosen { class HgmFrameRateManager; -class RSRenderProcessConnection : public RSRenderProcessConnectionStub { +class RSClientToRenderConnection : public RSClientToRenderConnectionStub { public: - RSRenderProcessConnection( + RSClientToRenderConnection( pid_t remotePid, wptr renderService, RSMainThread* mainThread, sptr screenManager, sptr token, sptr distributor); - ~RSRenderProcessConnection() noexcept; - RSRenderProcessConnection(const RSRenderProcessConnection&) = delete; - RSRenderProcessConnection& operator=(const RSRenderProcessConnection&) = delete; + ~RSClientToRenderConnection() noexcept; + RSClientToRenderConnection(const RSClientToRenderConnection&) = delete; + RSClientToRenderConnection& operator=(const RSClientToRenderConnection&) = delete; sptr GetToken() const { @@ -57,7 +57,7 @@ private: void CleanFrameRateLinkerExpectedFpsCallbacks() noexcept; void CleanAll(bool toDelete = false) noexcept; - // IPC RSIRenderProcessConnection Interfaces + // IPC RSIClientToRenderConnection Interfaces ErrCode CommitTransaction(std::unique_ptr& transactionData) override; ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) override; ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) override; @@ -342,26 +342,26 @@ private: class RSConnectionDeathRecipient : public IRemoteObject::DeathRecipient { public: - explicit RSConnectionDeathRecipient(wptr conn); + explicit RSConnectionDeathRecipient(wptr conn); virtual ~RSConnectionDeathRecipient() = default; void OnRemoteDied(const wptr& token) override; private: - wptr conn_; + wptr conn_; }; friend class RSConnectionDeathRecipient; sptr connDeathRecipient_; class RSApplicationRenderThreadDeathRecipient : public IRemoteObject::DeathRecipient { public: - explicit RSApplicationRenderThreadDeathRecipient(wptr conn); + explicit RSApplicationRenderThreadDeathRecipient(wptr conn); virtual ~RSApplicationRenderThreadDeathRecipient() = default; void OnRemoteDied(const wptr& token) override; private: - wptr conn_; + wptr conn_; }; friend class RSApplicationRenderThreadDeathRecipient; sptr applicationDeathRecipient_ = nullptr; @@ -383,4 +383,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // RENDER_SERVICE_PIPELINE_RS_RENDER_PROCESS_CONNECTION_H +#endif // RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_RENDER_CONNECTION_H diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.cpp similarity index 81% rename from rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp rename to rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.cpp index 4dec606552..a4eb29dfab 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.cpp +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_service_connection.h" +#include "rs_client_to_service_connection.h" #include #include "frame_report.h" @@ -90,7 +90,7 @@ #endif #undef LOG_TAG -#define LOG_TAG "RSRenderServiceConnection" +#define LOG_TAG "RSClientToServiceConnection" namespace OHOS { namespace Rosen { @@ -102,7 +102,7 @@ constexpr uint32_t MEM_BYTE_TO_MB = 1024 * 1024; } // we guarantee that when constructing this object, // all these pointers are valid, so will not check them. -RSRenderServiceConnection::RSRenderServiceConnection( +RSClientToServiceConnection::RSClientToServiceConnection( pid_t remotePid, wptr renderService, RSMainThread* mainThread, @@ -122,23 +122,23 @@ RSRenderServiceConnection::RSRenderServiceConnection( appVSyncDistributor_(distributor) { if (token_ == nullptr || !token_->AddDeathRecipient(connDeathRecipient_)) { - RS_LOGW("RSRenderServiceConnection: Failed to set death recipient."); + RS_LOGW("RSClientToServiceConnection: Failed to set death recipient."); } if (renderService_ == nullptr) { - RS_LOGW("RSRenderServiceConnection: renderService_ is nullptr"); + RS_LOGW("RSClientToServiceConnection: renderService_ is nullptr"); } if (mainThread_ == nullptr) { - RS_LOGW("RSRenderServiceConnection: mainThread_ is nullptr"); + RS_LOGW("RSClientToServiceConnection: mainThread_ is nullptr"); } if (screenManager_ == nullptr) { - RS_LOGW("RSRenderServiceConnection: screenManager_ is nullptr"); + RS_LOGW("RSClientToServiceConnection: screenManager_ is nullptr"); } if (appVSyncDistributor_ == nullptr) { - RS_LOGW("RSRenderServiceConnection: appVSyncDistributor_ is nullptr"); + RS_LOGW("RSClientToServiceConnection: appVSyncDistributor_ is nullptr"); } } -RSRenderServiceConnection::~RSRenderServiceConnection() noexcept +RSClientToServiceConnection::~RSClientToServiceConnection() noexcept { if (token_ && connDeathRecipient_) { token_->RemoveDeathRecipient(connDeathRecipient_); @@ -146,7 +146,7 @@ RSRenderServiceConnection::~RSRenderServiceConnection() noexcept CleanAll(); } -void RSRenderServiceConnection::CleanVirtualScreens() noexcept +void RSClientToServiceConnection::CleanVirtualScreens() noexcept { std::lock_guard lock(mutex_); @@ -163,7 +163,7 @@ void RSRenderServiceConnection::CleanVirtualScreens() noexcept } } -void RSRenderServiceConnection::CleanRenderNodes() noexcept +void RSClientToServiceConnection::CleanRenderNodes() noexcept { if (mainThread_ == nullptr) { return; @@ -174,7 +174,7 @@ void RSRenderServiceConnection::CleanRenderNodes() noexcept nodeMap.FilterNodeByPid(remotePid_); } -void RSRenderServiceConnection::CleanFrameRateLinkers() noexcept +void RSClientToServiceConnection::CleanFrameRateLinkers() noexcept { if (mainThread_ == nullptr) { return; @@ -185,7 +185,7 @@ void RSRenderServiceConnection::CleanFrameRateLinkers() noexcept frameRateLinkerMap.FilterFrameRateLinkerByPid(remotePid_); } -void RSRenderServiceConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexcept +void RSClientToServiceConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexcept { if (mainThread_ == nullptr) { return; @@ -195,7 +195,7 @@ void RSRenderServiceConnection::CleanFrameRateLinkerExpectedFpsCallbacks() noexc frameRateLinkerMap.UnRegisterExpectedFpsUpdateCallbackByListener(remotePid_); } -void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept +void RSClientToServiceConnection::CleanAll(bool toDelete) noexcept { { std::lock_guard lock(mutex_); @@ -207,11 +207,11 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept return; } RS_LOGD("CleanAll() start."); - RS_TRACE_NAME("RSRenderServiceConnection CleanAll begin, remotePid: " + std::to_string(remotePid_)); + RS_TRACE_NAME("RSClientToServiceConnection CleanAll begin, remotePid: " + std::to_string(remotePid_)); RsCommandVerifyHelper::GetInstance().RemoveCntWithPid(remotePid_); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (!connection) { return; } @@ -219,8 +219,8 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept connection->CleanVirtualScreens(); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (!connection) { return; } @@ -230,8 +230,8 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept connection->CleanFrameRateLinkerExpectedFpsCallbacks(); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -239,8 +239,8 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept connection->mainThread_->ClearTransactionDataPidInfo(connection->remotePid_); }).wait(); mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -251,8 +251,8 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept }).wait(); if (SelfDrawingNodeMonitor::GetInstance().IsListeningEnabled()) { mainThread_->ScheduleTask( - [weakThis = wptr(this)]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this)]() { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -285,15 +285,15 @@ void RSRenderServiceConnection::CleanAll(bool toDelete) noexcept } RS_LOGD("CleanAll() end."); - RS_TRACE_NAME("RSRenderServiceConnection CleanAll end, remotePid: " + std::to_string(remotePid_)); + RS_TRACE_NAME("RSClientToServiceConnection CleanAll end, remotePid: " + std::to_string(remotePid_)); } -RSRenderServiceConnection::RSConnectionDeathRecipient::RSConnectionDeathRecipient( - wptr conn) : conn_(conn) +RSClientToServiceConnection::RSConnectionDeathRecipient::RSConnectionDeathRecipient( + wptr conn) : conn_(conn) { } -void RSRenderServiceConnection::RSConnectionDeathRecipient::OnRemoteDied(const wptr& token) +void RSClientToServiceConnection::RSConnectionDeathRecipient::OnRemoteDied(const wptr& token) { auto tokenSptr = token.promote(); if (tokenSptr == nullptr) { @@ -303,7 +303,7 @@ void RSRenderServiceConnection::RSConnectionDeathRecipient::OnRemoteDied(const w auto rsConn = conn_.promote(); if (rsConn == nullptr) { - RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: RSRenderServiceConnection was dead, do nothing."); + RS_LOGW("RSConnectionDeathRecipient::OnRemoteDied: RSClientToServiceConnection was dead, do nothing."); return; } @@ -315,11 +315,11 @@ void RSRenderServiceConnection::RSConnectionDeathRecipient::OnRemoteDied(const w rsConn->CleanAll(true); } -RSRenderServiceConnection::RSApplicationRenderThreadDeathRecipient::RSApplicationRenderThreadDeathRecipient( - wptr conn) : conn_(conn) +RSClientToServiceConnection::RSApplicationRenderThreadDeathRecipient::RSApplicationRenderThreadDeathRecipient( + wptr conn) : conn_(conn) {} -void RSRenderServiceConnection::RSApplicationRenderThreadDeathRecipient::OnRemoteDied(const wptr& token) +void RSClientToServiceConnection::RSApplicationRenderThreadDeathRecipient::OnRemoteDied(const wptr& token) { auto tokenSptr = token.promote(); if (tokenSptr == nullptr) { @@ -330,7 +330,7 @@ void RSRenderServiceConnection::RSApplicationRenderThreadDeathRecipient::OnRemot auto rsConn = conn_.promote(); if (rsConn == nullptr) { RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: " - "RSRenderServiceConnection was dead, do nothing."); + "RSClientToServiceConnection was dead, do nothing."); return; } @@ -339,7 +339,7 @@ void RSRenderServiceConnection::RSApplicationRenderThreadDeathRecipient::OnRemot rsConn->UnRegisterApplicationAgent(app); } -ErrCode RSRenderServiceConnection::CommitTransaction(std::unique_ptr& transactionData) +ErrCode RSClientToServiceConnection::CommitTransaction(std::unique_ptr& transactionData) { if (!mainThread_) { return ERR_INVALID_VALUE; @@ -366,7 +366,7 @@ ErrCode RSRenderServiceConnection::CommitTransaction(std::unique_ptr& task) +ErrCode RSClientToServiceConnection::ExecuteSynchronousTask(const std::shared_ptr& task) { if (task == nullptr || mainThread_ == nullptr) { RS_LOGW("ExecuteSynchronousTask, task or main thread is null!"); @@ -386,13 +386,13 @@ ErrCode RSRenderServiceConnection::ExecuteSynchronousTask(const std::shared_ptr< return ERR_OK; } -ErrCode RSRenderServiceConnection::GetUniRenderEnabled(bool& enable) +ErrCode RSClientToServiceConnection::GetUniRenderEnabled(bool& enable) { enable = RSUniRenderJudgement::IsUniRender(); return ERR_OK; } -ErrCode RSRenderServiceConnection::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, +ErrCode RSClientToServiceConnection::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) { if (!mainThread_) { @@ -401,7 +401,7 @@ ErrCode RSRenderServiceConnection::CreateNode(const RSDisplayNodeConfig& display } auto node = DisplayNodeCommandHelper::CreateWithConfigInRS(mainThread_->GetContext(), nodeId, displayNodeConfig); if (node == nullptr) { - RS_LOGE("RSRenderService::CreateDisplayNode fail"); + RS_LOGE("RSClientToServiceConnection::CreateDisplayNode fail"); success = false; return ERR_INVALID_VALUE; } @@ -426,7 +426,7 @@ ErrCode RSRenderServiceConnection::CreateNode(const RSDisplayNodeConfig& display return ERR_OK; } -ErrCode RSRenderServiceConnection::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +ErrCode RSClientToServiceConnection::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) { if (!mainThread_) { success = false; @@ -435,12 +435,12 @@ ErrCode RSRenderServiceConnection::CreateNode(const RSSurfaceRenderNodeConfig& c std::shared_ptr node = SurfaceNodeCommandHelper::CreateWithConfigInRS(config, mainThread_->GetContext()); if (node == nullptr) { - RS_LOGE("RSRenderService::CreateNode fail"); + RS_LOGE("RSClientToServiceConnection::CreateNode fail"); success = false; return ERR_INVALID_VALUE; } - std::function registerNode = [node, weakThis = wptr(this)]() -> void { - sptr connection = weakThis.promote(); + std::function registerNode = [node, weakThis = wptr(this)]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -451,7 +451,7 @@ ErrCode RSRenderServiceConnection::CreateNode(const RSSurfaceRenderNodeConfig& c return ERR_OK; } -ErrCode RSRenderServiceConnection::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, +ErrCode RSClientToServiceConnection::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, bool unobscured) { if (!mainThread_) { @@ -460,16 +460,16 @@ ErrCode RSRenderServiceConnection::CreateNodeAndSurface(const RSSurfaceRenderNod std::shared_ptr node = SurfaceNodeCommandHelper::CreateWithConfigInRS(config, mainThread_->GetContext(), unobscured); if (node == nullptr) { - RS_LOGE("RSRenderService::CreateNodeAndSurface CreateNode fail"); + RS_LOGE("RSClientToServiceConnection::CreateNodeAndSurface CreateNode fail"); return ERR_INVALID_VALUE; } sptr surface = IConsumerSurface::Create(config.name); if (surface == nullptr) { - RS_LOGE("RSRenderService::CreateNodeAndSurface get consumer surface fail"); + RS_LOGE("RSClientToServiceConnection::CreateNodeAndSurface get consumer surface fail"); return ERR_INVALID_VALUE; } const std::string& surfaceName = surface->GetName(); - RS_LOGI("RsDebug RSRenderService::CreateNodeAndSurface node" + RS_LOGI("RsDebug RSClientToServiceConnection::CreateNodeAndSurface node" "id:%{public}" PRIu64 " name:%{public}s surface id:%{public}" PRIu64 " name:%{public}s", node->GetId(), node->GetName().c_str(), surface->GetUniqueId(), surfaceName.c_str()); @@ -501,7 +501,7 @@ ErrCode RSRenderServiceConnection::CreateNodeAndSurface(const RSSurfaceRenderNod sptr listener = new RSRenderServiceListener(surfaceRenderNode); SurfaceError ret = surface->RegisterConsumerListener(listener); if (ret != SURFACE_ERROR_OK) { - RS_LOGE("RSRenderService::CreateNodeAndSurface Register Consumer Listener fail"); + RS_LOGE("RSClientToServiceConnection::CreateNodeAndSurface Register Consumer Listener fail"); return ERR_INVALID_VALUE; } sptr producer = surface->GetProducer(); @@ -509,7 +509,7 @@ ErrCode RSRenderServiceConnection::CreateNodeAndSurface(const RSSurfaceRenderNod return ERR_OK; } -ErrCode RSRenderServiceConnection::CreateVSyncConnection(sptr& vsyncConn, +ErrCode RSClientToServiceConnection::CreateVSyncConnection(sptr& vsyncConn, const std::string& name, const sptr& token, VSyncConnParam vsyncConnParam) @@ -538,9 +538,9 @@ ErrCode RSRenderServiceConnection::CreateVSyncConnection(sptr& HgmCore::Instance().SetHgmTaskFlag(true); } }; - mainThread_->ScheduleTask([weakThis = wptr(this), + mainThread_->ScheduleTask([weakThis = wptr(this), id, observer, name, windowNodeId]() { - sptr connection = weakThis.promote(); + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -563,7 +563,7 @@ ErrCode RSRenderServiceConnection::CreateVSyncConnection(sptr& return ERR_OK; } -ErrCode RSRenderServiceConnection::GetDefaultScreenId(uint64_t& screenId) +ErrCode RSClientToServiceConnection::GetDefaultScreenId(uint64_t& screenId) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -574,7 +574,7 @@ ErrCode RSRenderServiceConnection::GetDefaultScreenId(uint64_t& screenId) return ERR_OK; } -ErrCode RSRenderServiceConnection::GetActiveScreenId(uint64_t& screenId) +ErrCode RSClientToServiceConnection::GetActiveScreenId(uint64_t& screenId) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -585,7 +585,7 @@ ErrCode RSRenderServiceConnection::GetActiveScreenId(uint64_t& screenId) return ERR_OK; } -std::vector RSRenderServiceConnection::GetAllScreenIds() +std::vector RSClientToServiceConnection::GetAllScreenIds() { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -594,7 +594,7 @@ std::vector RSRenderServiceConnection::GetAllScreenIds() return screenManager_->GetAllScreenIds(); } -ScreenId RSRenderServiceConnection::CreateVirtualScreen( +ScreenId RSClientToServiceConnection::CreateVirtualScreen( const std::string &name, uint32_t width, uint32_t height, @@ -618,7 +618,7 @@ ScreenId RSRenderServiceConnection::CreateVirtualScreen( return newVirtualScreenId; } -int32_t RSRenderServiceConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) +int32_t RSClientToServiceConnection::SetVirtualScreenSurface(ScreenId id, sptr surface) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -627,7 +627,7 @@ int32_t RSRenderServiceConnection::SetVirtualScreenSurface(ScreenId id, sptrSetVirtualScreenSurface(id, surface); } -void RSRenderServiceConnection::RemoveVirtualScreen(ScreenId id) +void RSClientToServiceConnection::RemoveVirtualScreen(ScreenId id) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -639,7 +639,7 @@ void RSRenderServiceConnection::RemoveVirtualScreen(ScreenId id) NotifyRefreshRateEvent(event); } -int32_t RSRenderServiceConnection::SetScreenChangeCallback(sptr callback) +int32_t RSClientToServiceConnection::SetScreenChangeCallback(sptr callback) { if (!callback) { RS_LOGE("%{public}s: callback is nullptr", __func__); @@ -667,7 +667,7 @@ int32_t RSRenderServiceConnection::SetScreenChangeCallback(sptrScheduleTask( - [weakThis = wptr(this), id]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -733,7 +733,7 @@ void RSRenderServiceConnection::UnregisterFrameRateLinker(FrameRateLinkerId id) }).wait(); } -uint32_t RSRenderServiceConnection::GetScreenCurrentRefreshRate(ScreenId id) +uint32_t RSClientToServiceConnection::GetScreenCurrentRefreshRate(ScreenId id) { uint32_t rate = HgmTaskHandleThread::Instance().ScheduleTask([id] () -> uint32_t { return HgmCore::Instance().GetScreenCurrentRefreshRate(id); @@ -745,30 +745,30 @@ uint32_t RSRenderServiceConnection::GetScreenCurrentRefreshRate(ScreenId id) return rate; } -std::vector RSRenderServiceConnection::GetScreenSupportedRefreshRates(ScreenId id) +std::vector RSClientToServiceConnection::GetScreenSupportedRefreshRates(ScreenId id) { return HgmTaskHandleThread::Instance().ScheduleTask([id] () -> std::vector { return HgmCore::Instance().GetScreenComponentRefreshRates(id); }).get(); } -ErrCode RSRenderServiceConnection::GetShowRefreshRateEnabled(bool& enable) +ErrCode RSClientToServiceConnection::GetShowRefreshRateEnabled(bool& enable) { enable = RSRealtimeRefreshRateManager::Instance().GetShowRefreshRateEnabled(); return ERR_OK; } -void RSRenderServiceConnection::SetShowRefreshRateEnabled(bool enabled, int32_t type) +void RSClientToServiceConnection::SetShowRefreshRateEnabled(bool enabled, int32_t type) { return RSRealtimeRefreshRateManager::Instance().SetShowRefreshRateEnabled(enabled, type); } -uint32_t RSRenderServiceConnection::GetRealtimeRefreshRate(ScreenId screenId) +uint32_t RSClientToServiceConnection::GetRealtimeRefreshRate(ScreenId screenId) { return RSRealtimeRefreshRateManager::Instance().GetRealtimeRefreshRate(screenId); } -ErrCode RSRenderServiceConnection::GetRefreshInfo(pid_t pid, std::string& enable) +ErrCode RSClientToServiceConnection::GetRefreshInfo(pid_t pid, std::string& enable) { if (!mainThread_) { enable = ""; @@ -786,8 +786,8 @@ ErrCode RSRenderServiceConnection::GetRefreshInfo(pid_t pid, std::string& enable if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) { #ifdef RS_ENABLE_GPU RSHardwareThread::Instance().ScheduleTask( - [weakThis = wptr(this), &dumpString, &surfaceName]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -796,8 +796,8 @@ ErrCode RSRenderServiceConnection::GetRefreshInfo(pid_t pid, std::string& enable #endif } else { mainThread_->ScheduleTask( - [weakThis = wptr(this), &dumpString, &surfaceName]() { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &dumpString, &surfaceName]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->screenManager_ == nullptr) { return; } @@ -808,7 +808,7 @@ ErrCode RSRenderServiceConnection::GetRefreshInfo(pid_t pid, std::string& enable return ERR_OK; } -ErrCode RSRenderServiceConnection::GetRefreshInfoToSP(NodeId id, std::string& enable) +ErrCode RSClientToServiceConnection::GetRefreshInfoToSP(NodeId id, std::string& enable) { if (!mainThread_) { enable = ""; @@ -816,8 +816,8 @@ ErrCode RSRenderServiceConnection::GetRefreshInfoToSP(NodeId id, std::string& en } std::string dumpString; auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType(); - auto dumpTask = [weakThis = wptr(this), &dumpString, &id]() { - sptr connection = weakThis.promote(); + auto dumpTask = [weakThis = wptr(this), &dumpString, &id]() { + sptr connection = weakThis.promote(); if (connection == nullptr) { RS_LOGE("GetRefreshInfoToSP connection is nullptr"); return; @@ -839,14 +839,14 @@ ErrCode RSRenderServiceConnection::GetRefreshInfoToSP(NodeId id, std::string& en return ERR_OK; } -int32_t RSRenderServiceConnection::GetCurrentRefreshRateMode() +int32_t RSClientToServiceConnection::GetCurrentRefreshRateMode() { return HgmTaskHandleThread::Instance().ScheduleTask([] () -> int32_t { return HgmCore::Instance().GetCurrentRefreshRateMode(); }).get(); } -int32_t RSRenderServiceConnection::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToServiceConnection::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { if (!screenManager_) { return StatusCode::SCREEN_MANAGER_NULL; @@ -854,7 +854,7 @@ int32_t RSRenderServiceConnection::SetPhysicalScreenResolution(ScreenId id, uint return screenManager_->SetPhysicalScreenResolution(id, width, height); } -int32_t RSRenderServiceConnection::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToServiceConnection::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -875,7 +875,7 @@ int32_t RSRenderServiceConnection::SetVirtualScreenResolution(ScreenId id, uint3 } } -ErrCode RSRenderServiceConnection::RepaintEverything() +ErrCode RSClientToServiceConnection::RepaintEverything() { if (mainThread_ == nullptr) { RS_LOGE("RepaintEverything, mainThread_ is null, return"); @@ -890,7 +890,7 @@ ErrCode RSRenderServiceConnection::RepaintEverything() return ERR_OK; } -void RSRenderServiceConnection::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) +void RSClientToServiceConnection::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { if (screenManager_ == nullptr || mainThread_ == nullptr) { RS_LOGE("%{public}s screenManager or mainThread is null, id: %{public}" PRIu64, __func__, id); @@ -915,14 +915,14 @@ void RSRenderServiceConnection::SetScreenPowerStatus(ScreenId id, ScreenPowerSta } } -ErrCode RSRenderServiceConnection::RegisterApplicationAgent(uint32_t pid, sptr app) +ErrCode RSClientToServiceConnection::RegisterApplicationAgent(uint32_t pid, sptr app) { if (!mainThread_) { RS_LOGE("RegisterApplicationAgent mainThread_ is nullptr"); return ERR_INVALID_VALUE; } - auto captureTask = [weakThis = wptr(this), pid, app]() -> void { - sptr connection = weakThis.promote(); + auto captureTask = [weakThis = wptr(this), pid, app]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { RS_LOGE("RegisterApplicationAgent connection or mainThread_ is nullptr"); return; @@ -935,7 +935,7 @@ ErrCode RSRenderServiceConnection::RegisterApplicationAgent(uint32_t pid, sptrGetAppMemoryInMB(cpuMemSize, gpuMemSize); @@ -964,7 +964,7 @@ ErrCode RSRenderServiceConnection::GetTotalAppMemSize(float& cpuMemSize, float& return ERR_OK; } -ErrCode RSRenderServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) +ErrCode RSClientToServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) { if (!mainThread_ || !mainThread_->GetContext().GetNodeMap().ContainPid(pid)) { return ERR_INVALID_VALUE; @@ -972,8 +972,8 @@ ErrCode RSRenderServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memo bool enable; if (GetUniRenderEnabled(enable) == ERR_OK && enable) { renderThread_.PostSyncTask( - [weakThis = wptr(this), &memoryGraphic, &pid] { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &memoryGraphic, &pid] { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -986,7 +986,7 @@ ErrCode RSRenderServiceConnection::GetMemoryGraphic(int pid, MemoryGraphic& memo } } -ErrCode RSRenderServiceConnection::GetMemoryGraphics(std::vector& memoryGraphics) +ErrCode RSClientToServiceConnection::GetMemoryGraphics(std::vector& memoryGraphics) { bool res; if (!mainThread_ || GetUniRenderEnabled(res) != ERR_OK || !res) { @@ -1002,8 +1002,8 @@ ErrCode RSRenderServiceConnection::GetMemoryGraphics(std::vector& } }); renderThread_.PostSyncTask( - [weakThis = wptr(this), &memoryGraphics, &pids] { - sptr connection = weakThis.promote(); + [weakThis = wptr(this), &memoryGraphics, &pids] { + sptr connection = weakThis.promote(); if (connection == nullptr) { return; } @@ -1013,7 +1013,7 @@ ErrCode RSRenderServiceConnection::GetMemoryGraphics(std::vector& return ERR_OK; } -std::vector RSRenderServiceConnection::GetScreenSupportedModes(ScreenId id) +std::vector RSClientToServiceConnection::GetScreenSupportedModes(ScreenId id) { if (!screenManager_) { return std::vector(); @@ -1034,7 +1034,7 @@ std::vector RSRenderServiceConnection::GetScreenSupportedModes } } -RSScreenCapability RSRenderServiceConnection::GetScreenCapability(ScreenId id) +RSScreenCapability RSClientToServiceConnection::GetScreenCapability(ScreenId id) { RSScreenCapability screenCapability; if (!screenManager_) { @@ -1056,7 +1056,7 @@ RSScreenCapability RSRenderServiceConnection::GetScreenCapability(ScreenId id) } } -ErrCode RSRenderServiceConnection::GetScreenPowerStatus(uint64_t screenId, uint32_t& status) +ErrCode RSClientToServiceConnection::GetScreenPowerStatus(uint64_t screenId, uint32_t& status) { if (!screenManager_) { status = ScreenPowerStatus::INVALID_POWER_STATUS; @@ -1080,7 +1080,7 @@ ErrCode RSRenderServiceConnection::GetScreenPowerStatus(uint64_t screenId, uint3 return ERR_OK; } -RSScreenData RSRenderServiceConnection::GetScreenData(ScreenId id) +RSScreenData RSClientToServiceConnection::GetScreenData(ScreenId id) { RSScreenData screenData; if (!screenManager_) { @@ -1102,7 +1102,7 @@ RSScreenData RSRenderServiceConnection::GetScreenData(ScreenId id) } } -ErrCode RSRenderServiceConnection::GetScreenBacklight(uint64_t id, int32_t& level) +ErrCode RSClientToServiceConnection::GetScreenBacklight(uint64_t id, int32_t& level) { if (!screenManager_) { level = INVALID_BACKLIGHT_VALUE; @@ -1126,7 +1126,7 @@ ErrCode RSRenderServiceConnection::GetScreenBacklight(uint64_t id, int32_t& leve return ERR_OK; } -void RSRenderServiceConnection::SetScreenBacklight(ScreenId id, uint32_t level) +void RSClientToServiceConnection::SetScreenBacklight(ScreenId id, uint32_t level) { if (!screenManager_) { RS_LOGE("%{public}s screenManager_ is nullptr.", __func__); @@ -1134,8 +1134,8 @@ void RSRenderServiceConnection::SetScreenBacklight(ScreenId id, uint32_t level) } RSLuminanceControl::Get().SetSdrLuminance(id, level); if (RSLuminanceControl::Get().IsHdrOn(id) && level > 0 && mainThread_ != nullptr) { - auto task = [weakThis = wptr(this), id]() { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), id]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { RS_LOGE("SetScreenBacklight fail"); return; @@ -1159,15 +1159,15 @@ void RSRenderServiceConnection::SetScreenBacklight(ScreenId id, uint32_t level) } } -ErrCode RSRenderServiceConnection::RegisterBufferClearListener( +ErrCode RSClientToServiceConnection::RegisterBufferClearListener( NodeId id, sptr callback) { if (!mainThread_) { return ERR_INVALID_VALUE; } auto registerBufferClearListener = - [id, callback, weakThis = wptr(this)]() -> bool { - sptr connection = weakThis.promote(); + [id, callback, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return false; } @@ -1181,15 +1181,15 @@ ErrCode RSRenderServiceConnection::RegisterBufferClearListener( return ERR_OK; } -ErrCode RSRenderServiceConnection::RegisterBufferAvailableListener( +ErrCode RSClientToServiceConnection::RegisterBufferAvailableListener( NodeId id, sptr callback, bool isFromRenderThread) { if (!mainThread_) { return ERR_INVALID_VALUE; } auto registerBufferAvailableListener = - [id, callback, isFromRenderThread, weakThis = wptr(this)]() -> bool { - sptr connection = weakThis.promote(); + [id, callback, isFromRenderThread, weakThis = wptr(this)]() -> bool { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return false; } @@ -1203,7 +1203,7 @@ ErrCode RSRenderServiceConnection::RegisterBufferAvailableListener( return ERR_OK; } -int32_t RSRenderServiceConnection::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) +int32_t RSClientToServiceConnection::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1224,7 +1224,7 @@ int32_t RSRenderServiceConnection::GetScreenSupportedColorGamuts(ScreenId id, st } } -int32_t RSRenderServiceConnection::GetScreenSupportedMetaDataKeys(ScreenId id, std::vector& keys) +int32_t RSClientToServiceConnection::GetScreenSupportedMetaDataKeys(ScreenId id, std::vector& keys) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1245,7 +1245,7 @@ int32_t RSRenderServiceConnection::GetScreenSupportedMetaDataKeys(ScreenId id, s } } -int32_t RSRenderServiceConnection::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) +int32_t RSClientToServiceConnection::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1266,7 +1266,7 @@ int32_t RSRenderServiceConnection::GetScreenColorGamut(ScreenId id, ScreenColorG } } -int32_t RSRenderServiceConnection::SetScreenColorGamut(ScreenId id, int32_t modeIdx) +int32_t RSClientToServiceConnection::SetScreenColorGamut(ScreenId id, int32_t modeIdx) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1287,7 +1287,7 @@ int32_t RSRenderServiceConnection::SetScreenColorGamut(ScreenId id, int32_t mode } } -int32_t RSRenderServiceConnection::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) +int32_t RSClientToServiceConnection::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1308,7 +1308,7 @@ int32_t RSRenderServiceConnection::SetScreenGamutMap(ScreenId id, ScreenGamutMap } } -int32_t RSRenderServiceConnection::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) +int32_t RSClientToServiceConnection::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1317,14 +1317,14 @@ int32_t RSRenderServiceConnection::SetScreenCorrection(ScreenId id, ScreenRotati return screenManager_->SetScreenCorrection(id, screenRotation); } -ErrCode RSRenderServiceConnection::SetGlobalDarkColorMode(bool isDark) +ErrCode RSClientToServiceConnection::SetGlobalDarkColorMode(bool isDark) { std::lock_guard lock(mutex_); if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), isDark]() { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), isDark]() { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { RS_LOGE("SetGlobalDarkColorMode fail"); return; @@ -1335,7 +1335,7 @@ ErrCode RSRenderServiceConnection::SetGlobalDarkColorMode(bool isDark) return ERR_OK; } -int32_t RSRenderServiceConnection::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) +int32_t RSClientToServiceConnection::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { if (!screenManager_) { return StatusCode::SCREEN_NOT_FOUND; @@ -1356,7 +1356,7 @@ int32_t RSRenderServiceConnection::GetScreenGamutMap(ScreenId id, ScreenGamutMap } } -ErrCode RSRenderServiceConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +ErrCode RSClientToServiceConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; @@ -1398,7 +1398,7 @@ ErrCode RSRenderServiceConnection::GetScreenHDRStatus(ScreenId id, HdrStatus& hd return ERR_OK; } -ErrCode RSRenderServiceConnection::GetScreenSupportedColorSpaces( +ErrCode RSClientToServiceConnection::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces, int32_t& resCode) { if (!screenManager_) { @@ -1425,7 +1425,7 @@ ErrCode RSRenderServiceConnection::GetScreenSupportedColorSpaces( } } -ErrCode RSRenderServiceConnection::GetScreenColorSpace( +ErrCode RSClientToServiceConnection::GetScreenColorSpace( ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) { if (!screenManager_) { @@ -1452,7 +1452,7 @@ ErrCode RSRenderServiceConnection::GetScreenColorSpace( } } -ErrCode RSRenderServiceConnection::SetScreenColorSpace( +ErrCode RSClientToServiceConnection::SetScreenColorSpace( ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) { if (!screenManager_) { @@ -1479,7 +1479,7 @@ ErrCode RSRenderServiceConnection::SetScreenColorSpace( } } -int32_t RSRenderServiceConnection::GetScreenType(ScreenId id, RSScreenType& screenType) +int32_t RSClientToServiceConnection::GetScreenType(ScreenId id, RSScreenType& screenType) { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1488,7 +1488,7 @@ int32_t RSRenderServiceConnection::GetScreenType(ScreenId id, RSScreenType& scre return screenManager_->GetScreenType(id, screenType); } -ErrCode RSRenderServiceConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +ErrCode RSClientToServiceConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { if (!mainThread_) { success = false; @@ -1526,7 +1526,7 @@ ErrCode RSRenderServiceConnection::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, return ERR_OK; } -ErrCode RSRenderServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr pixelmap, +ErrCode RSClientToServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) { if (!mainThread_) { @@ -1586,7 +1586,7 @@ ErrCode RSRenderServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr< return ERR_OK; } -int32_t RSRenderServiceConnection::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, +int32_t RSClientToServiceConnection::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) { std::lock_guard lock(mutex_); @@ -1596,7 +1596,7 @@ int32_t RSRenderServiceConnection::GetDisplayIdentificationData(ScreenId id, uin return screenManager_->GetDisplayIdentificationData(id, outPort, edidData); } -ErrCode RSRenderServiceConnection::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) +ErrCode RSClientToServiceConnection::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) { if (!screenManager_) { repCode = StatusCode::SCREEN_NOT_FOUND; @@ -1628,7 +1628,7 @@ ErrCode RSRenderServiceConnection::SetScreenActiveRect(ScreenId id, const Rect& return ERR_OK; } -void RSRenderServiceConnection::SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) +void RSClientToServiceConnection::SetScreenOffset(ScreenId id, int32_t offsetX, int32_t offsetY) { if (!screenManager_) { return; @@ -1636,10 +1636,10 @@ void RSRenderServiceConnection::SetScreenOffset(ScreenId id, int32_t offsetX, in screenManager_->SetScreenOffset(id, offsetX, offsetY); } -void RSRenderServiceConnection::SetScreenFrameGravity(ScreenId id, int32_t gravity) +void RSClientToServiceConnection::SetScreenFrameGravity(ScreenId id, int32_t gravity) { - auto task = [weakThis = wptr(this), id, gravity]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), id, gravity]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1653,7 +1653,7 @@ void RSRenderServiceConnection::SetScreenFrameGravity(ScreenId id, int32_t gravi mainThread_->PostTask(task); } -void RSRenderServiceConnection::NotifyRefreshRateEvent(const EventInfo& eventInfo) +void RSClientToServiceConnection::NotifyRefreshRateEvent(const EventInfo& eventInfo) { if (VOTER_SCENE_BLUR == eventInfo.eventName) { RsFrameBlurPredict::GetInstance().TakeEffectBlurScene(eventInfo); @@ -1672,7 +1672,7 @@ void RSRenderServiceConnection::NotifyRefreshRateEvent(const EventInfo& eventInf }); } -void RSRenderServiceConnection::SetWindowExpectedRefreshRate( +void RSClientToServiceConnection::SetWindowExpectedRefreshRate( const std::unordered_map& eventInfos ) { @@ -1685,7 +1685,7 @@ void RSRenderServiceConnection::SetWindowExpectedRefreshRate( }); } -void RSRenderServiceConnection::SetWindowExpectedRefreshRate( +void RSClientToServiceConnection::SetWindowExpectedRefreshRate( const std::unordered_map& eventInfos ) { @@ -1698,7 +1698,7 @@ void RSRenderServiceConnection::SetWindowExpectedRefreshRate( }); } -ErrCode RSRenderServiceConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +ErrCode RSClientToServiceConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) { if (!appVSyncDistributor_) { return ERR_INVALID_VALUE; @@ -1707,7 +1707,7 @@ ErrCode RSRenderServiceConnection::NotifySoftVsyncEvent(uint32_t pid, uint32_t r return ERR_OK; } -ErrCode RSRenderServiceConnection::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) +ErrCode RSClientToServiceConnection::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) { if (mainThread_ != nullptr) { mainThread_->HandleTouchEvent(touchStatus, touchCnt); @@ -1720,7 +1720,7 @@ ErrCode RSRenderServiceConnection::NotifyTouchEvent(int32_t touchStatus, int32_t return ERR_OK; } -void RSRenderServiceConnection::NotifyDynamicModeEvent(bool enableDynamicModeEvent) +void RSClientToServiceConnection::NotifyDynamicModeEvent(bool enableDynamicModeEvent) { HgmTaskHandleThread::Instance().PostTask([enableDynamicModeEvent] () { auto frameRateMgr = HgmCore::Instance().GetFrameRateMgr(); @@ -1732,7 +1732,7 @@ void RSRenderServiceConnection::NotifyDynamicModeEvent(bool enableDynamicModeEve }); } -ErrCode RSRenderServiceConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) +ErrCode RSClientToServiceConnection::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) { HgmTaskHandleThread::Instance().PostTask([remotePid = remotePid_, id, expectedFrameRate] () { HgmConfigCallbackManager::GetInstance()->SyncXComponentExpectedFrameRateCallback( @@ -1741,15 +1741,15 @@ ErrCode RSRenderServiceConnection::NotifyXComponentExpectedFrameRate(const std:: return ERR_OK; } -ErrCode RSRenderServiceConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, +ErrCode RSClientToServiceConnection::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { if (!mainThread_) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), id, isEnabled, selfDrawingType, + auto task = [weakThis = wptr(this), id, isEnabled, selfDrawingType, dynamicHardwareEnable]() -> void { - sptr connection = weakThis.promote(); + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1763,14 +1763,14 @@ ErrCode RSRenderServiceConnection::SetHardwareEnabled(NodeId id, bool isEnabled, return ERR_OK; } -ErrCode RSRenderServiceConnection::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +ErrCode RSClientToServiceConnection::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) { if (!mainThread_) { resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), id, needHidePrivacyContent]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), id, needHidePrivacyContent]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1785,20 +1785,20 @@ ErrCode RSRenderServiceConnection::SetHidePrivacyContent(NodeId id, bool needHid return ERR_OK; } -LayerComposeInfo RSRenderServiceConnection::GetLayerComposeInfo() +LayerComposeInfo RSClientToServiceConnection::GetLayerComposeInfo() { const auto& layerComposeInfo = LayerComposeCollection::GetInstance().GetLayerComposeInfo(); LayerComposeCollection::GetInstance().ResetLayerComposeInfo(); return layerComposeInfo; } -HwcDisabledReasonInfos RSRenderServiceConnection::GetHwcDisabledReasonInfo() +HwcDisabledReasonInfos RSClientToServiceConnection::GetHwcDisabledReasonInfo() { return HwcDisabledReasonCollection::GetInstance().GetHwcDisabledReasonInfo(); } #ifdef TP_FEATURE_ENABLE -ErrCode RSRenderServiceConnection::SetTpFeatureConfig(int32_t feature, const char* config, +ErrCode RSClientToServiceConnection::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { switch (tpFeatureConfigType) { @@ -1825,13 +1825,13 @@ ErrCode RSRenderServiceConnection::SetTpFeatureConfig(int32_t feature, const cha } #endif -ErrCode RSRenderServiceConnection::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) +ErrCode RSClientToServiceConnection::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), nodeId, isTop, zOrder]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), nodeId, isTop, zOrder]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1850,13 +1850,13 @@ ErrCode RSRenderServiceConnection::SetLayerTopForHWC(NodeId nodeId, bool isTop, return ERR_OK; } -ErrCode RSRenderServiceConnection::SetLayerTop(const std::string &nodeIdStr, bool isTop) +ErrCode RSClientToServiceConnection::SetLayerTop(const std::string &nodeIdStr, bool isTop) { if (mainThread_ == nullptr) { return ERR_INVALID_VALUE; } - auto task = [weakThis = wptr(this), nodeIdStr, isTop]() -> void { - sptr connection = weakThis.promote(); + auto task = [weakThis = wptr(this), nodeIdStr, isTop]() -> void { + sptr connection = weakThis.promote(); if (connection == nullptr || connection->mainThread_ == nullptr) { return; } @@ -1877,13 +1877,13 @@ ErrCode RSRenderServiceConnection::SetLayerTop(const std::string &nodeIdStr, boo return ERR_OK; } -void RSRenderServiceConnection::RegisterTransactionDataCallback(uint64_t token, +void RSClientToServiceConnection::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { RSTransactionDataCallbackManager::Instance().RegisterTransactionDataCallback(token, timeStamp, callback); } -ErrCode RSRenderServiceConnection::NotifyScreenSwitched() +ErrCode RSClientToServiceConnection::NotifyScreenSwitched() { std::lock_guard lock(mutex_); if (!screenManager_) { @@ -1896,7 +1896,7 @@ ErrCode RSRenderServiceConnection::NotifyScreenSwitched() return ERR_OK; } -int32_t RSRenderServiceConnection::RegisterSelfDrawingNodeRectChangeCallback( +int32_t RSClientToServiceConnection::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) { std::lock_guard lock(mutex_); @@ -1916,7 +1916,7 @@ int32_t RSRenderServiceConnection::RegisterSelfDrawingNodeRectChangeCallback( return StatusCode::SUCCESS; } -int32_t RSRenderServiceConnection::UnRegisterSelfDrawingNodeRectChangeCallback() +int32_t RSClientToServiceConnection::UnRegisterSelfDrawingNodeRectChangeCallback() { std::lock_guard lock(mutex_); @@ -1929,14 +1929,14 @@ int32_t RSRenderServiceConnection::UnRegisterSelfDrawingNodeRectChangeCallback() } #ifdef RS_ENABLE_OVERLAY_DISPLAY -ErrCode RSRenderServiceConnection::SetOverlayDisplayMode(int32_t mode) +ErrCode RSClientToServiceConnection::SetOverlayDisplayMode(int32_t mode) { RS_LOGI("SetOverlayDisplayMode: mode: [%{public}d]", mode); return RSOverlayDisplayManager::Instance().SetOverlayDisplayMode(mode) == 0 ? ERR_OK : ERR_INVALID_VALUE; } #endif -ErrCode RSRenderServiceConnection::NotifyPageName(const std::string &packageName, +ErrCode RSClientToServiceConnection::NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) { HgmTaskHandleThread::Instance().PostTask([pid = remotePid_, packageName, pageName, isEnter]() { @@ -1948,20 +1948,20 @@ ErrCode RSRenderServiceConnection::NotifyPageName(const std::string &packageName return StatusCode::SUCCESS; } -ErrCode RSRenderServiceConnection::AvcodecVideoStart( +ErrCode RSClientToServiceConnection::AvcodecVideoStart( uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { RSJankStats::GetInstance().AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); return ERR_OK; } -ErrCode RSRenderServiceConnection::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +ErrCode RSClientToServiceConnection::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) { RSJankStats::GetInstance().AvcodecVideoStop(uniqueId, surfaceName, fps); return ERR_OK; } -RetCodeHrpService RSRenderServiceConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToServiceConnection::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { #ifdef RS_PROFILER_ENABLED @@ -1976,7 +1976,7 @@ RetCodeHrpService RSRenderServiceConnection::ProfilerServiceOpenFile(const HrpSe #endif } -RetCodeHrpService RSRenderServiceConnection::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToServiceConnection::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { #ifdef RS_PROFILER_ENABLED @@ -1987,7 +1987,7 @@ RetCodeHrpService RSRenderServiceConnection::ProfilerServicePopulateFiles(const #endif } -bool RSRenderServiceConnection::ProfilerIsSecureScreen() +bool RSClientToServiceConnection::ProfilerIsSecureScreen() { #ifdef RS_PROFILER_ENABLED if (!RSSystemProperties::GetProfilerEnabled()) { @@ -1999,7 +1999,7 @@ bool RSRenderServiceConnection::ProfilerIsSecureScreen() #endif } -void RSRenderServiceConnection::ClearUifirstCache(NodeId id) +void RSClientToServiceConnection::ClearUifirstCache(NodeId id) { if (!mainThread_) { return; diff --git a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.h similarity index 93% rename from rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h rename to rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.h index 47d4f9edb3..89dc758929 100644 --- a/rosen/modules/render_service/core/pipeline/main_thread/rs_render_service_connection.h +++ b/rosen/modules/render_service/core/pipeline/main_thread/rs_client_to_service_connection.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H -#define RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H +#ifndef RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_SERVICE_CONNECTION_H +#define RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_SERVICE_CONNECTION_H #include #include @@ -26,24 +26,24 @@ #include "pipeline/render_thread/rs_uni_render_thread.h" #include "../../main/server/rs_render_service.h" #include "screen_manager/rs_screen_manager.h" -#include "transaction/rs_render_service_connection_stub.h" +#include "transaction/rs_client_to_service_connection_stub.h" #include "vsync_distributor.h" namespace OHOS { namespace Rosen { class HgmFrameRateManager; -class RSRenderServiceConnection : public RSRenderServiceConnectionStub { +class RSClientToServiceConnection : public RSClientToServiceConnectionStub { public: - RSRenderServiceConnection( + RSClientToServiceConnection( pid_t remotePid, wptr renderService, RSMainThread* mainThread, sptr screenManager, sptr token, sptr distributor); - ~RSRenderServiceConnection() noexcept; - RSRenderServiceConnection(const RSRenderServiceConnection&) = delete; - RSRenderServiceConnection& operator=(const RSRenderServiceConnection&) = delete; + ~RSClientToServiceConnection() noexcept; + RSClientToServiceConnection(const RSClientToServiceConnection&) = delete; + RSClientToServiceConnection& operator=(const RSClientToServiceConnection&) = delete; sptr GetToken() const { @@ -57,7 +57,7 @@ private: void CleanFrameRateLinkerExpectedFpsCallbacks() noexcept; void CleanAll(bool toDelete = false) noexcept; - // IPC RSIRenderServiceConnection Interfaces + // IPC RSIClientToServiceConnection Interfaces ErrCode CommitTransaction(std::unique_ptr& transactionData) override; ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) override; ErrCode GetMemoryGraphic(int pid, MemoryGraphic& memoryGraphic) override; @@ -258,26 +258,26 @@ private: class RSConnectionDeathRecipient : public IRemoteObject::DeathRecipient { public: - explicit RSConnectionDeathRecipient(wptr conn); + explicit RSConnectionDeathRecipient(wptr conn); virtual ~RSConnectionDeathRecipient() = default; void OnRemoteDied(const wptr& token) override; private: - wptr conn_; + wptr conn_; }; friend class RSConnectionDeathRecipient; sptr connDeathRecipient_; class RSApplicationRenderThreadDeathRecipient : public IRemoteObject::DeathRecipient { public: - explicit RSApplicationRenderThreadDeathRecipient(wptr conn); + explicit RSApplicationRenderThreadDeathRecipient(wptr conn); virtual ~RSApplicationRenderThreadDeathRecipient() = default; void OnRemoteDied(const wptr& token) override; private: - wptr conn_; + wptr conn_; }; friend class RSApplicationRenderThreadDeathRecipient; sptr applicationDeathRecipient_ = nullptr; @@ -299,4 +299,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // RENDER_SERVICE_PIPELINE_RS_RENDER_SERVICE_CONNECTION_H +#endif // RENDER_SERVICE_PIPELINE_RS_CLIENT_TO_SERVICE_CONNECTION_H diff --git a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp b/rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.cpp similarity index 80% rename from rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp rename to rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.cpp index 3775b7d655..80e37932b6 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.cpp +++ b/rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_process_connection_stub.h" +#include "rs_client_to_render_connection_stub.h" #include #include #include "ivsync_connection.h" @@ -52,7 +52,7 @@ constexpr size_t MAX_DATA_SIZE = 1024 * 1024; // 1MB static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 #ifdef RES_SCHED_ENABLE const uint32_t RS_IPC_QOS_LEVEL = 7; -constexpr const char* RS_BUNDLE_NAME = "render_process"; +constexpr const char* RS_BUNDLE_NAME = "client_to_render"; #endif static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO), @@ -212,7 +212,7 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin } if (old.GetOffsetsSize() > MAX_OBJECTNUM) { - ROSEN_LOGW("RSRenderProcessConnectionStub::CopyParcelIfNeed failed, parcel fdCnt: %{public}zu is too large", + ROSEN_LOGW("RSClientToRenderConnectionStub::CopyParcelIfNeed failed, parcel fdCnt: %{public}zu is too large", old.GetOffsetsSize()); return nullptr; } @@ -220,18 +220,18 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin RS_TRACE_NAME("CopyParcelForUnmarsh: size:" + std::to_string(dataSize)); void* base = malloc(dataSize); if (base == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed malloc failed"); + RS_LOGE("RSClientToRenderConnectionStub::CopyParcelIfNeed malloc failed"); return nullptr; } if (memcpy_s(base, dataSize, reinterpret_cast(old.GetData()), dataSize) != 0) { - RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed copy parcel data failed"); + RS_LOGE("RSClientToRenderConnectionStub::CopyParcelIfNeed copy parcel data failed"); free(base); return nullptr; } auto parcelCopied = RS_PROFILER_COPY_PARCEL(old); if (!parcelCopied->ParseFrom(reinterpret_cast(base), dataSize)) { - RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed ParseFrom failed"); + RS_LOGE("RSClientToRenderConnectionStub::CopyParcelIfNeed ParseFrom failed"); free(base); return nullptr; } @@ -243,11 +243,11 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin } int32_t data{0}; if (!parcelCopied->ReadInt32(data)) { - RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed parcel data Read failed"); + RS_LOGE("RSClientToRenderConnectionStub::CopyParcelIfNeed parcel data Read failed"); return nullptr; } if (data != 0) { - RS_LOGE("RSRenderProcessConnectionStub::CopyParcelIfNeed parcel data not match"); + RS_LOGE("RSClientToRenderConnectionStub::CopyParcelIfNeed parcel data not match"); return nullptr; } return parcelCopied; @@ -317,7 +317,7 @@ static void TypefaceXcollieCallback(void* arg) } } -void RSRenderProcessConnectionStub::SetQos() +void RSClientToRenderConnectionStub::SetQos() { #ifdef RES_SCHED_ENABLE std::string strBundleName = RS_BUNDLE_NAME; @@ -333,14 +333,14 @@ void RSRenderProcessConnectionStub::SetQos() struct sched_param param = {0}; param.sched_priority = 1; if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) { - RS_LOGE("RSRenderProcessConnectionStub Couldn't set SCHED_FIFO."); + RS_LOGE("RSClientToRenderConnectionStub Couldn't set SCHED_FIFO."); } else { - RS_LOGI("RSRenderProcessConnectionStub set SCHED_FIFO succeed."); + RS_LOGI("RSClientToRenderConnectionStub set SCHED_FIFO succeed."); } #endif } -int RSRenderProcessConnectionStub::OnRemoteRequest( +int RSClientToRenderConnectionStub::OnRemoteRequest( uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { uint32_t parcelNumber = RS_PROFILER_ON_REMOTE_REQUEST(this, code, data, reply, option); @@ -359,10 +359,10 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (std::find(std::cbegin(descriptorCheckList), std::cend(descriptorCheckList), code) != std::cend(descriptorCheckList)) { auto token = data.ReadInterfaceToken(); - if (token != RSIRenderProcessConnection::GetDescriptor()) { + if (token != RSIClientToRenderConnection::GetDescriptor()) { if (code == static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE)) { if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest Write failed."); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest Write failed."); return ERR_INVALID_REPLY; } } @@ -375,7 +375,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER)) { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest no permission code:%{public}d", code); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest no permission code:%{public}d", code); return ERR_INVALID_STATE; } int ret = ERR_NONE; @@ -385,7 +385,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( bool isNonSystemAppCalling = false; RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemAppCalling); if (!isTokenTypeValid) { - RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION invalid token type"); + RS_LOGE("RSClientToRenderConnectionStub::COMMIT_TRANSACTION invalid token type"); return ERR_INVALID_STATE; } if (isNonSystemAppCalling) { @@ -398,7 +398,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::shared_ptr ashmemFlowControlUnit = nullptr; int32_t readData{0}; if (!data.ReadInt32(readData)) { - RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION read parcel failed"); + RS_LOGE("RSClientToRenderConnectionStub::COMMIT_TRANSACTION read parcel failed"); return ERR_INVALID_DATA; } if (readData == 0) { // indicate normal parcel @@ -418,7 +418,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (transactionData && isNonSystemAppCalling) { const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { - RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + RS_LOGE("RSClientToRenderConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); } } CommitTransaction(transactionData); @@ -434,7 +434,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } } if (parsedParcel == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION failed: parsed parcel is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::COMMIT_TRANSACTION failed: parsed parcel is nullptr"); return ERR_INVALID_DATA; } RSMarshallingHelper::UnmarshallingTransactionVer(*parsedParcel); @@ -448,7 +448,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (transactionData && isNonSystemAppCalling) { const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { - RS_LOGE("RSRenderProcessConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + RS_LOGE("RSClientToRenderConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); } } CommitTransaction(transactionData); @@ -458,7 +458,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_UNI_RENDER_ENABLED): { bool enable; if (GetUniRenderEnabled(enable) != ERR_OK || !reply.WriteBool(enable)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_UNI_RENDER_ENABLED read enable failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_UNI_RENDER_ENABLED read enable failed!"); ret = ERR_INVALID_REPLY; } break; @@ -466,7 +466,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE read nodeId failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE read nodeId failed!"); ret = ERR_INVALID_DATA; break; } @@ -481,14 +481,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RS_PROFILER_PATCH_NODE_ID(data, nodeId); std::string surfaceName; if (!data.ReadString(surfaceName)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE read surfaceName failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE read surfaceName failed!"); ret = ERR_INVALID_DATA; break; } RSSurfaceRenderNodeConfig config = {.id = nodeId, .name = surfaceName}; bool success; if (CreateNode(config, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE Write success failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE Write success failed!"); ret = ERR_INVALID_REPLY; } break; @@ -496,7 +496,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE_AND_SURFACE): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read nodeId failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE_AND_SURFACE read nodeId failed!"); ret = ERR_INVALID_DATA; break; } @@ -514,13 +514,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( bool unobscured { false }; if (!data.ReadString(surfaceName) || !data.ReadUint8(type) || !data.ReadBool(isTextureExportNode) || !data.ReadBool(isSync) || !data.ReadUint8(surfaceWindowType) || !data.ReadBool(unobscured)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read surfaceRenderNodeConfig failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE_AND_SURFACE read surfaceRenderNodeConfig failed!"); ret = ERR_INVALID_DATA; break; } if (!CheckCreateNodeAndSurface(callingPid, static_cast(type), static_cast(surfaceWindowType))) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE CheckCreateNodeAndSurface failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE_AND_SURFACE CheckCreateNodeAndSurface failed!"); ret = ERR_INVALID_DATA; break; } @@ -540,7 +540,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } auto producer = surface->GetProducer(); if (!reply.WriteRemoteObject(producer->AsObject())) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_NODE_AND_SURFACE read RemoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_NODE_AND_SURFACE read RemoteObject failed!"); ret = ERR_INVALID_REPLY; } break; @@ -548,7 +548,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO): { int32_t pid{0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO read pid failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_FOCUS_APP_INFO read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -559,7 +559,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t focusNodeId{0}; if (!data.ReadInt32(uid) || !data.ReadString(bundleName) || !data.ReadString(abilityName) || !RSMarshallingHelper::UnmarshallingPidPlusId(data, focusNodeId)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_FOCUS_APP_INFO read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -571,7 +571,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( .focusNodeId = focusNodeId}; int32_t repCode; if (SetFocusAppInfo(info, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_FOCUS_APP_INFO Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_FOCUS_APP_INFO Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -581,13 +581,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; std::vector blackListVector; if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetVirtualScreenBlackList(id, blackListVector); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_BLACKLIST Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -597,14 +597,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; std::vector typeBlackListVector; if (!data.ReadUint64(id) || !data.ReadUInt8Vector(&typeBlackListVector)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t repCode; SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST Write repCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST Write repCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -614,14 +614,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; std::vector blackListVector; if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t repCode; AddVirtualScreenBlackList(id, blackListVector, repCode); if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -631,14 +631,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; std::vector blackListVector; if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&blackListVector)) { - RS_LOGE("RSRenderProcessConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ADD_VIRTUAL_SCREEN_BLACKLIST read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t repCode; RemoveVirtualScreenBlackList(id, blackListVector, repCode); if (!reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::REMOVE_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REMOVE_VIRTUAL_SCREEN_BLACKLIST Write repCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -650,12 +650,12 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::vector securityExemptionList; if (!data.ReadUint64(id) || !data.ReadUInt64Vector(&securityExemptionList)) { RS_LOGE( - "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST read parcel failed!"); + "RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST read parcel failed!"); ret = ERR_INVALID_DATA; break; } if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST" + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST" " failed: too many lists."); ret = ERR_INVALID_DATA; break; @@ -663,7 +663,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t status = SetVirtualScreenSecurityExemptionList(id, securityExemptionList); if (!reply.WriteInt32(status)) { RS_LOGE( - "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST Write status failed!"); + "RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -674,7 +674,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; bool enable{false}; if (!data.ReadUint64(id) || !data.ReadBool(enable)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SECURITY_MASK read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_SECURITY_MASK read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -684,7 +684,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t result = SetScreenSecurityMask(id, std::move(securityMask)); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SECURITY_MASK Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_SECURITY_MASK Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -694,7 +694,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( // read the parcel data. ScreenId id = INVALID_SCREEN_ID; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read id failed!"); ret = ERR_INVALID_REPLY; break; } @@ -704,7 +704,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t h = -1; if (!data.ReadInt32(x) || !data.ReadInt32(y) || !data.ReadInt32(w) || !data.ReadInt32(h)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read parcel failed!"); ret = ERR_INVALID_REPLY; break; } @@ -716,13 +716,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( }; bool supportRotation{false}; if (!data.ReadBool(supportRotation)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read supportRotation failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Read supportRotation failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -732,13 +732,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; bool enable{false}; if (!data.ReadUint64(id) || !data.ReadBool(enable)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetCastScreenEnableSkipWindow(id, enable); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_MIRROR_SCREEN_VISIBLE_RECT Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -747,7 +747,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( // read the parcel data. ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -764,7 +764,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = SetVirtualScreenSurface(id, surface); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -772,7 +772,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::REMOVE_VIRTUAL_SCREEN Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REMOVE_VIRTUAL_SCREEN Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -787,13 +787,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t rangeSize { 0 }; if (!data.ReadFloat(darkBuffer) || !data.ReadFloat(brightBuffer) || !data.ReadInt64(interval) || !data.ReadInt32(rangeSize)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_COLOR_INVERSION_CONFIG Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -801,13 +801,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED): { bool enable { false }; if (!data.ReadBool(enable)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED read enable failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED read enable failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetPointerColorInversionEnabled(enable); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_COLOR_INVERSION_ENABLED Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -825,7 +825,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = RegisterPointerLuminanceChangeCallback(cb); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -833,7 +833,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK): { int32_t status = UnRegisterPointerLuminanceChangeCallback(); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::UNREGISTER_POINTER_LUMINANCE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -843,7 +843,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint32_t modeId{0}; if (!data.ReadUint64(id) || !data.ReadUint32(modeId)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_ACTIVE_MODE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_ACTIVE_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -853,7 +853,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE): { FrameRateLinkerId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SYNC_FRAME_RATE_RANGE Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SYNC_FRAME_RATE_RANGE Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -872,7 +872,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (!data.ReadUint32(min) || !data.ReadUint32(max) || !data.ReadUint32(preferred) || !data.ReadUint32(type) || !data.ReadUint32(componentScene) || !data.ReadInt32(animatorExpectedFrameRate)) { - RS_LOGE("RSRenderProcessConnectionStub::SYNC_FRAME_RATE_RANGE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SYNC_FRAME_RATE_RANGE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -883,7 +883,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER): { FrameRateLinkerId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_FRAME_RATE_LINKER Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::UNREGISTER_FRAME_RATE_LINKER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -898,13 +898,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO): { auto token = data.ReadInterfaceToken(); - if (token != RSIRenderProcessConnection::GetDescriptor()) { + if (token != RSIClientToRenderConnection::GetDescriptor()) { ret = ERR_INVALID_STATE; break; } int32_t pid{0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO Read pid failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_REFRESH_INFO Read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -915,7 +915,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } std::string refreshInfo; if (GetRefreshInfo(pid, refreshInfo) != ERR_OK || !reply.WriteString(refreshInfo)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO Write refreshInfo failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_REFRESH_INFO Write refreshInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -924,13 +924,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO_TO_SP Read nodeId failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_REFRESH_INFO_TO_SP Read nodeId failed!"); ret = ERR_INVALID_DATA; break; } std::string refreshInfoToSP; if (GetRefreshInfoToSP(nodeId, refreshInfoToSP) != ERR_OK || !reply.WriteString(refreshInfoToSP)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_REFRESH_INFO_TO_SP Write refreshInfoToSP failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_REFRESH_INFO_TO_SP Write refreshInfoToSP failed!"); ret = ERR_INVALID_REPLY; } break; @@ -940,13 +940,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint32_t width{0}; uint32_t height{0}; if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetPhysicalScreenResolution(id, width, height); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -956,13 +956,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint32_t width{0}; uint32_t height{0}; if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetVirtualScreenResolution(id, width, height); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -982,7 +982,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::DISABLE_RENDER_CONTROL_SCREEN): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::DISABLE_RENDER_CONTROL_SCREEN Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::DISABLE_RENDER_CONTROL_SCREEN Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -992,20 +992,20 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE): { NodeId id{0}; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_SURFACE_CAPTURE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture remoteObject is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture remoteObject is nullptr"); break; } sptr cb = iface_cast(remoteObject); if (cb == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture cb is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture cb is nullptr"); break; } RSSurfaceCaptureConfig captureConfig; @@ -1013,17 +1013,17 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( Drawing::Rect specifiedAreaRect; if (!ReadSurfaceCaptureConfig(captureConfig, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read captureConfig failed"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture read captureConfig failed"); break; } if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read blurParam failed"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture read blurParam failed"); break; } if (!ReadSurfaceCaptureAreaRect(specifiedAreaRect, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read specifiedAreaRect failed"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture read specifiedAreaRect failed"); break; } @@ -1041,14 +1041,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_SURFACE_CAPTURE_SOLO): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Read parcel failed!"); ret = ERR_INVALID_DATA; break; } RSSurfaceCaptureConfig captureConfig; if (!ReadSurfaceCaptureConfig(captureConfig, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO read captureConfig failed"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_SURFACE_CAPTURE_SOLO read captureConfig failed"); break; } RSSurfaceCapturePermissions permissions; @@ -1060,7 +1060,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( pixelMapIdPairVector = TakeSurfaceCaptureSoloNode(id, captureConfig, permissions); if (!RSMarshallingHelper::Marshalling(reply, pixelMapIdPairVector)) { ret = ERR_INVALID_REPLY; - RS_LOGE("RSRenderProcessConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Marshalling failed"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_SURFACE_CAPTURE_SOLO Marshalling failed"); break; } break; @@ -1072,7 +1072,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( break; } if (ExtractPid(id) != callingPid) { - RS_LOGW("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture failed, nodeId:[%{public}" PRIu64 + RS_LOGW("RSClientToRenderConnectionStub::TakeSelfSurfaceCapture failed, nodeId:[%{public}" PRIu64 "], callingPid:[%{public}d], pid:[%{public}d]", id, callingPid, ExtractPid(id)); ret = ERR_INVALID_DATA; break; @@ -1081,19 +1081,19 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture remoteObject is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSelfSurfaceCapture remoteObject is nullptr"); break; } sptr cb = iface_cast(remoteObject); if (cb == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture cb is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSelfSurfaceCapture cb is nullptr"); break; } RSSurfaceCaptureConfig captureConfig; if (!ReadSurfaceCaptureConfig(captureConfig, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TakeSelfSurfaceCapture read captureConfig failed"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSelfSurfaceCapture read captureConfig failed"); break; } TakeSelfSurfaceCapture(id, cb, captureConfig); @@ -1102,26 +1102,26 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::TAKE_UI_CAPTURE_IN_RANGE): { NodeId id{0}; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_UI_CAPTURE_IN_RANGE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE remoteObject is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_UI_CAPTURE_IN_RANGE remoteObject is nullptr"); break; } sptr cb = iface_cast(remoteObject); if (cb == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE cb is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_UI_CAPTURE_IN_RANGE cb is nullptr"); break; } RSSurfaceCaptureConfig captureConfig; if (!ReadSurfaceCaptureConfig(captureConfig, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TAKE_UI_CAPTURE_IN_RANGE read captureConfig failed"); + RS_LOGE("RSClientToRenderConnectionStub::TAKE_UI_CAPTURE_IN_RANGE read captureConfig failed"); break; } TakeUICaptureInRange(id, cb, captureConfig); @@ -1130,13 +1130,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_FREEZE_IMMEDIATELY): { NodeId id{0}; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read id failed!"); ret = ERR_INVALID_DATA; break; } bool isFreeze{false}; if (!data.ReadBool(isFreeze)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read isFreeze failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY Read isFreeze failed!"); ret = ERR_INVALID_DATA; break; } @@ -1147,23 +1147,23 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY remoteObject is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY remoteObject is nullptr"); break; } cb = iface_cast(remoteObject); if (cb == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY cb is nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY cb is nullptr"); break; } if (!ReadSurfaceCaptureConfig(captureConfig, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY write captureConfig failed"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_FREEZE_IMMEDIATELY write captureConfig failed"); break; } if (!ReadSurfaceCaptureBlurParam(blurParam, data)) { ret = ERR_INVALID_DATA; - RS_LOGE("RSRenderProcessConnectionStub::TakeSurfaceCapture read blurParam failed"); + RS_LOGE("RSClientToRenderConnectionStub::TakeSurfaceCapture read blurParam failed"); break; } } @@ -1173,7 +1173,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_POSITION): { NodeId id { 0 }; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_POSITION read nodeId failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_POSITION read nodeId failed!"); break; } float positionX { 0.f }; @@ -1182,7 +1182,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( float positionW { 0.f }; if (!data.ReadFloat(positionX) || !data.ReadFloat(positionY) || !data.ReadFloat(positionZ) || !data.ReadFloat(positionW)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_POINTER_POSITION read position failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_POINTER_POSITION read position failed!"); ret = ERR_INVALID_DATA; break; } @@ -1208,13 +1208,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_VIRTUAL_SCREEN_RESOLUTION): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Read id failed!"); ret = ERR_INVALID_DATA; break; } RSVirtualScreenResolution virtualScreenResolution = GetVirtualScreenResolution(id); if (!reply.WriteParcelable(&virtualScreenResolution)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Write virtualScreenResolution " + RS_LOGE("RSClientToRenderConnectionStub::GET_VIRTUAL_SCREEN_RESOLUTION Write virtualScreenResolution " "failed!"); ret = ERR_INVALID_REPLY; } @@ -1223,13 +1223,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenModeInfo screenModeInfo; if (GetScreenActiveMode(id, screenModeInfo) != ERR_OK || !reply.WriteParcelable(&screenModeInfo)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1237,7 +1237,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC): { int32_t pid{0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -1249,7 +1249,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } MemoryGraphic memoryGraphic; if (GetMemoryGraphic(pid, memoryGraphic) != ERR_OK || !reply.WriteParcelable(&memoryGraphic)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphic failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphic failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1258,13 +1258,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::vector memoryGraphics; if (GetMemoryGraphics(memoryGraphics) != ERR_OK || !reply.WriteUint64(static_cast(memoryGraphics.size()))) { - RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphicsSize failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphicsSize failed!"); ret = ERR_INVALID_REPLY; break; } for (uint32_t index = 0; index < memoryGraphics.size(); index++) { if (!reply.WriteParcelable(&memoryGraphics[index])) { - RS_LOGE("RSRenderProcessConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphics failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphics failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1276,7 +1276,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( float gpuMemSize = 0.f; if (GetTotalAppMemSize(cpuMemSize, gpuMemSize) != ERR_OK || !reply.WriteFloat(cpuMemSize) || !reply.WriteFloat(gpuMemSize)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_TOTAL_APP_MEM_SIZE Write parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_TOTAL_APP_MEM_SIZE Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1284,7 +1284,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_AVAILABLE_LISTENER Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_BUFFER_AVAILABLE_LISTENER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1297,7 +1297,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); bool isFromRenderThread{false}; if (!data.ReadBool(isFromRenderThread)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_AVAILABLE_LISTENER read isFromRenderThread failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_BUFFER_AVAILABLE_LISTENER read isFromRenderThread failed!"); ret = ERR_INVALID_DATA; break; } @@ -1316,7 +1316,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_BUFFER_CLEAR_LISTENER Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_BUFFER_CLEAR_LISTENER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1344,14 +1344,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; bool canvasRotation{false}; if (!data.ReadUint64(id) || !data.ReadBool(canvasRotation)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } bool result = SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); if (!reply.WriteBool(result)) { RS_LOGE( - "RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Write parcel failed!"); + "RSClientToRenderConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_CANVAS_ROTATION Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1361,13 +1361,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; bool isAutoRotation{false}; if (!data.ReadUint64(id) || !data.ReadBool(isAutoRotation)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetVirtualScreenAutoRotation(id, isAutoRotation); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Write parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_AUTO_ROTATION Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1377,13 +1377,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint32_t scaleMode{0}; if (!data.ReadUint64(id) || !data.ReadUint32(scaleMode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } bool result = SetVirtualMirrorScreenScaleMode(id, static_cast(scaleMode)); if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Write parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_MIRROR_SCREEN_SCALE_MODE Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1392,12 +1392,12 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE): { bool isDark{false}; if (!data.ReadBool(isDark)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } if (SetGlobalDarkColorMode(isDark) != ERR_OK) { - RS_LOGE("RSRenderProcessConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1405,7 +1405,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID): { uint64_t pid; if (!data.ReadUint64(pid)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP_BY_PROCESSID Read pid failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXELMAP_BY_PROCESSID Read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -1413,7 +1413,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t repCode; if (GetPixelMapByProcessId(pixelMapInfoVector, static_cast(pid), repCode) != ERR_OK || !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP_BY_PROCESSID Write repCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXELMAP_BY_PROCESSID Write repCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1427,7 +1427,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write Object failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write Object failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1438,7 +1438,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( sptr surface = Surface::CreateSurfaceAsProducer(bufferProducer); if (surface == nullptr) { if (!reply.WriteInt32(0)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Write parcel failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1450,7 +1450,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t w = 0; int32_t h = 0; if (!data.ReadInt32(x) || !data.ReadInt32(y) || !data.ReadInt32(w) || !data.ReadInt32(h)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1464,7 +1464,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( CreatePixelMapFromSurface(surface, srcRect, pixelMap); if (pixelMap) { if (!reply.WriteBool(true)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed"); ret = ERR_INVALID_REPLY; break; } @@ -1474,7 +1474,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } } else { if (!reply.WriteBool(false)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_PIXEL_MAP_FROM_SURFACE Read parcel failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1484,14 +1484,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_CAPABILITY): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_CAPABILITY Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenHDRCapability screenHDRCapability; int32_t result = GetScreenHDRCapability(id, screenHDRCapability); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_CAPABILITY Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1500,7 +1500,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( break; } if (!reply.WriteParcelable(&screenHDRCapability)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_CAPABILITY Write screenHDRCapability failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_CAPABILITY Write screenHDRCapability failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1508,7 +1508,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXEL_FORMAT): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXEL_FORMAT Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1516,7 +1516,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; GetPixelFormat(id, pixelFormat, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXEL_FORMAT Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1524,7 +1524,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(static_cast(pixelFormat))) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXEL_FORMAT Write pixelFormat failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXEL_FORMAT Write pixelFormat failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1532,13 +1532,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PIXEL_FORMAT): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_PIXEL_FORMAT Read id failed!"); ret = ERR_INVALID_DATA; break; } int32_t pixel{0}; if (!data.ReadInt32(pixel)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT read pixelFormat failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_PIXEL_FORMAT read pixelFormat failed!"); ret = ERR_INVALID_DATA; break; } @@ -1546,7 +1546,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; SetPixelFormat(id, pixelFormat, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_PIXEL_FORMAT Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_PIXEL_FORMAT Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1554,7 +1554,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_HDR_FORMATS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1563,7 +1563,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; GetScreenSupportedHDRFormats(id, hdrFormats, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1572,7 +1572,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } std::copy(hdrFormats.begin(), hdrFormats.end(), std::back_inserter(hdrFormatsSend)); if (!reply.WriteUInt32Vector(hdrFormatsSend)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write hdrFormatsSend failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_HDR_FORMATS Write hdrFormatsSend failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1580,7 +1580,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_FORMAT): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_FORMAT Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1588,7 +1588,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; GetScreenHDRFormat(id, hdrFormat, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Write resCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_FORMAT Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1596,7 +1596,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(hdrFormat)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_FORMAT Write hdrFormat failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_FORMAT Write hdrFormat failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1605,14 +1605,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; int32_t modeIdx{0}; if (!data.ReadUint64(id) || !data.ReadInt32(modeIdx)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_HDR_FORMAT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_HDR_FORMAT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t resCode; SetScreenHDRFormat(id, modeIdx, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_HDR_FORMAT Write resCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_HDR_FORMAT Write resCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1620,7 +1620,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1628,11 +1628,11 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; ret = GetScreenHDRStatus(id, hdrStatus, resCode); if (ret != ERR_OK) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); resCode = ret; } if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1640,7 +1640,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(hdrStatus)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1648,7 +1648,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1657,7 +1657,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t resCode; GetScreenSupportedColorSpaces(id, colorSpaces, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1667,7 +1667,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::copy(colorSpaces.begin(), colorSpaces.end(), std::back_inserter(colorSpacesSend)); if (!reply.WriteUInt32Vector(colorSpacesSend)) { RS_LOGE( - "RSRenderProcessConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); + "RSClientToRenderConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1675,7 +1675,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_BITMAP Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_BITMAP Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1688,7 +1688,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( Drawing::Bitmap bm; bool success; if (GetBitmap(id, bm, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_BITMAP Write success failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_BITMAP Write success failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1700,7 +1700,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXELMAP Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1719,7 +1719,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( bool success; if (GetPixelmap(id, pixelmap, &rect, drawCmdList, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_PIXELMAP Write id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PIXELMAP Write id failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1733,7 +1733,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t uniqueId{0}; uint32_t hash{0}; if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { - RS_LOGE("RSRenderProcessConnectionStub::NEED_REGISTER_TYPEFACE read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NEED_REGISTER_TYPEFACE read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1741,11 +1741,11 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { result = !RSTypefaceCache::Instance().HasTypeface(uniqueId, hash); } else { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest callingPid[%{public}d] " "no permission NEED_REGISTER_TYPEFACE", callingPid); } if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderProcessConnectionStub::NEED_REGISTER_TYPEFACE Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NEED_REGISTER_TYPEFACE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1761,7 +1761,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t uniqueId{0}; uint32_t hash{0}; if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_TYPEFACE read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_TYPEFACE read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1774,16 +1774,16 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RegisterTypeface(uniqueId, typeface); } } else { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest callingPid[%{public}d] " "no permission REGISTER_TYPEFACE", callingPid); } } if (xcollieFlag && typeface) { - RS_LOGW("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] typeface[%{public}s] " + RS_LOGW("RSClientToRenderConnectionStub::OnRemoteRequest callingPid[%{public}d] typeface[%{public}s] " "size[%{public}u], too big.", callingPid, typeface->GetFamilyName().c_str(), typeface->GetSize()); } if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_TYPEFACE Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_TYPEFACE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1791,7 +1791,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE): { uint64_t uniqueId{0}; if (!data.ReadUint64(uniqueId)) { - RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_TYPEFACE read uniqueId failed!"); + RS_LOGE("RSClientToRenderConnectionStub::UNREGISTER_TYPEFACE read uniqueId failed!"); ret = ERR_INVALID_DATA; break; } @@ -1800,28 +1800,28 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RS_PROFILER_PATCH_TYPEFACE_GLOBALID(data, uniqueId); UnRegisterTypeface(uniqueId); } else { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callingPid[%{public}d] " + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest callingPid[%{public}d] " "no permission UNREGISTER_TYPEFACE", callingPid); } break; } case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SKIP_FRAME_INTERVAL): { if (!securityManager_.IsInterfaceCodeAccessible(code)) { - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest no permission to access"\ + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest no permission to access"\ "SET_SCREEN_SKIP_FRAME_INTERVAL"); return ERR_INVALID_STATE; } ScreenId id{INVALID_SCREEN_ID}; uint32_t skipFrameInterval{0}; if (!data.ReadUint64(id) || !data.ReadUint32(skipFrameInterval)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t statusCode{ SUCCESS }; if (SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode) != ERR_OK || !reply.WriteInt32(statusCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_SKIP_FRAME_INTERVAL Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1830,7 +1830,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id = 0; uint32_t maxRefreshRate = 0; if (!data.ReadUint64(id) || !data.ReadUint32(maxRefreshRate)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1838,12 +1838,12 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t result = 0; SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, result); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write result failed!"); return ERR_INVALID_REPLY; } if (!reply.WriteUint32(actualRefreshRate)) { RS_LOGE( - "RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write actualRefreshRate failed!"); + "RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_REFRESH_RATE Write actualRefreshRate failed!"); return ERR_INVALID_REPLY; } break; @@ -1853,7 +1853,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t offsetX = 0; int32_t offsetY = 0; if (!data.ReadUint64(id) || !data.ReadInt32(offsetX) || !data.ReadInt32(offsetY)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_OFFSET Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_OFFSET Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1864,7 +1864,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id = INVALID_SCREEN_ID; int32_t gravity = 0; if (!data.ReadUint64(id) || !data.ReadInt32(gravity)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SCREEN_FRAME_GRAVITY Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SCREEN_FRAME_GRAVITY Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1874,7 +1874,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_OCCLUSION_CHANGE_CALLBACK): { auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Read remoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Read remoteObject failed!"); ret = ERR_NULL_OBJECT; break; } @@ -1885,7 +1885,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t repCode; if (RegisterOcclusionChangeCallback(callback, repCode) != ERR_OK || !reply.WriteInt32(repCode)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_OCCLUSION_CHANGE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1894,7 +1894,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { NodeId id{0}; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1906,7 +1906,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read remoteObject " + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read remoteObject " "failed!"); ret = ERR_NULL_OBJECT; break; @@ -1919,7 +1919,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } std::vector partitionPoints; if (!data.ReadFloatVector(&partitionPoints)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read " + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read " "partitionPoints failed!"); ret = ERR_TRANSACTION_FAILED; break; @@ -1927,7 +1927,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t status = RegisterSurfaceOcclusionChangeCallback(id, callback, partitionPoints); if (!reply.WriteInt32(status)) { RS_LOGE( - "RSRenderProcessConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + "RSClientToRenderConnectionStub::REGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1936,7 +1936,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK): { NodeId id{0}; if (!RSMarshallingHelper::UnmarshallingPidPlusId(data, id)) { - RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1949,7 +1949,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t status = UnRegisterSurfaceOcclusionChangeCallback(id); if (!reply.WriteInt32(status)) { RS_LOGE( - "RSRenderProcessConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); + "RSClientToRenderConnectionStub::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1957,7 +1957,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM): { uint32_t num{0}; if (!data.ReadUint32(num)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_APP_WINDOW_NUM Read num failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_APP_WINDOW_NUM Read num failed!"); ret = ERR_INVALID_DATA; break; } @@ -1969,14 +1969,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint32_t systemAnimatedScenes{0}; bool isRegularAnimation{false}; if (!data.ReadUint32(systemAnimatedScenes) || !data.ReadBool(isRegularAnimation)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SYSTEM_ANIMATED_SCENES Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SYSTEM_ANIMATED_SCENES Read parcel failed!"); ret = ERR_INVALID_DATA; break; } bool success; if (SetSystemAnimatedScenes(static_cast(systemAnimatedScenes), isRegularAnimation, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_SYSTEM_ANIMATED_SCENES Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_SYSTEM_ANIMATED_SCENES Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1988,19 +1988,19 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } std::string name; if (!data.ReadString(name)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_WATERMARK Read name failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WATERMARK Read name failed!"); ret = ERR_INVALID_DATA; break; } auto watermark = std::shared_ptr(data.ReadParcelable()); if (watermark == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::std::shared_ptr watermark == nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::std::shared_ptr watermark == nullptr"); break; } bool success; if (SetWatermark(name, watermark, success) != ERR_OK || !success) { - RS_LOGE("RSRenderProcessConnectionStub::SetWatermark failed"); + RS_LOGE("RSClientToRenderConnectionStub::SetWatermark failed"); } break; } @@ -2009,7 +2009,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::shared_ptr(data.ReadParcelable()); bool isShow{false}; if (!data.ReadBool(isShow)) { - RS_LOGE("RSRenderProcessConnectionStub::SHOW_WATERMARK Read isShow failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SHOW_WATERMARK Read isShow failed!"); ret = ERR_INVALID_DATA; break; } @@ -2021,13 +2021,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint32_t width{0}; uint32_t height{0}; if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderProcessConnectionStub::RESIZE_VIRTUAL_SCREEN Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::RESIZE_VIRTUAL_SCREEN Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = ResizeVirtualScreen(id, width, height); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::RESIZE_VIRTUAL_SCREEN Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::RESIZE_VIRTUAL_SCREEN Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2094,7 +2094,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int16_t type{0}; int16_t subType{0}; if (!data.ReadInt16(type) || !data.ReadInt16(subType)) { - RS_LOGE("RSRenderProcessConnectionStub::EXECUTE_SYNCHRONOUS_TASK Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::EXECUTE_SYNCHRONOUS_TASK Read parcel failed!"); ret = ERR_INVALID_STATE; break; } @@ -2127,7 +2127,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HARDWARE_ENABLED Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HARDWARE_ENABLED Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -2142,7 +2142,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (!data.ReadBool(isEnabled) || !data.ReadUint8(selfDrawingType) || !data.ReadBool(dynamicHardwareEnable)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HARDWARE_ENABLED Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HARDWARE_ENABLED Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2152,7 +2152,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HIDE_PRIVACY_CONTENT Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -2161,7 +2161,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( "::SET_HIDE_PRIVACY_CONTENT"); if (!isSystemCalling) { if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NONSYSTEM_CALLING))) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write isSystemCalling failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HIDE_PRIVACY_CONTENT Write isSystemCalling failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2170,21 +2170,21 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( RS_LOGW("The SetHidePrivacyContent isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", id, callingPid); if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NOT_SELF_CALLING))) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write ErrorCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HIDE_PRIVACY_CONTENT Write ErrorCode failed!"); ret = ERR_INVALID_REPLY; } break; } bool needHidePrivacyContent{false}; if (!data.ReadBool(needHidePrivacyContent)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT read needHidePrivacyContent failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HIDE_PRIVACY_CONTENT read needHidePrivacyContent failed!"); ret = ERR_INVALID_DATA; break; } uint32_t resCode; if (SetHidePrivacyContent(id, needHidePrivacyContent, resCode) != ERR_OK || !reply.WriteUint32(resCode)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_HIDE_PRIVACY_CONTENT Write resCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_HIDE_PRIVACY_CONTENT Write resCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2192,7 +2192,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS) : { int32_t lightFactorStatus{0}; if (!data.ReadInt32(lightFactorStatus)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_LIGHT_FACTOR_STATUS Read lightFactorStatus failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_LIGHT_FACTOR_STATUS Read lightFactorStatus failed!"); ret = ERR_INVALID_DATA; break; } @@ -2202,7 +2202,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT) : { uint32_t listSize{0}; if (!data.ReadUint32(listSize)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_PACKAGE_EVENT Read listSize failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_PACKAGE_EVENT Read listSize failed!"); ret = ERR_INVALID_DATA; break; } @@ -2216,7 +2216,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( for (uint32_t i = 0; i < listSize; i++) { std::string package; if (!data.ReadString(package)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_PACKAGE_EVENT Read package failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_PACKAGE_EVENT Read package failed!"); errFlag = true; break; } @@ -2233,7 +2233,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string pkgName; uint32_t listSize{0}; if (!data.ReadString(pkgName) || !data.ReadUint32(listSize)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2249,7 +2249,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string key; std::string value; if (!data.ReadString(key) || !data.ReadString(value)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read newConfig " + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT Read newConfig " "failed!"); errFlag = true; break; @@ -2267,7 +2267,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint32_t pid{0}; uint32_t rateDiscount{0}; if (!data.ReadUint32(pid) || !data.ReadUint32(rateDiscount)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2279,7 +2279,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string name; uint32_t rateDiscount{0}; if (!data.ReadUint32(pid) || !data.ReadString(name) || !data.ReadUint32(rateDiscount)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2293,7 +2293,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string eventName; bool state{false}; if (!data.ReadString(eventName) || !data.ReadBool(state)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_HGMCONFIG_EVENT Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_HGMCONFIG_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2304,7 +2304,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string id; int32_t expectedFrameRate; if (!data.ReadString(id) || !data.ReadInt32(expectedFrameRate)) { - RS_LOGE("RSRenderProcessConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2314,7 +2314,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK) : { auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_HGM_CFG_CALLBACK Read remoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_HGM_CFG_CALLBACK Read remoteObject failed!"); ret = ERR_NULL_OBJECT; break; } @@ -2325,7 +2325,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = RegisterHgmConfigChangeCallback(callback); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_HGM_CFG_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_HGM_CFG_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2333,7 +2333,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK) : { auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Read remoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Read remoteObject failed!"); ret = ERR_NULL_OBJECT; break; } @@ -2345,7 +2345,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = RegisterHgmRefreshRateModeChangeCallback(callback); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REFRESH_RATE_MODE_CHANGE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2355,7 +2355,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( sptr remoteObject = nullptr; bool readRemoteObject{false}; if (!data.ReadBool(readRemoteObject)) { - RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Read remoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Read remoteObject failed!"); ret = ERR_INVALID_DATA; break; } @@ -2367,7 +2367,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = RegisterHgmRefreshRateUpdateCallback(callback); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REFRESH_RATE_UPDATE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2399,7 +2399,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t dstPid{0}; bool readRemoteObject{false}; if (!data.ReadInt32(dstPid) || !data.ReadBool(readRemoteObject)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Read parcel " + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Read parcel " "failed!"); ret = ERR_INVALID_DATA; break; @@ -2412,7 +2412,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } int32_t status = RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, callback); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Write status " + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK Write status " "failed!"); ret = ERR_INVALID_REPLY; } @@ -2421,7 +2421,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED) : { bool isEnabled = false; if (!data.ReadBool(isEnabled)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_ROTATION_CACHE_ENABLED Read isEnabled failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_ROTATION_CACHE_ENABLED Read isEnabled failed!"); ret = IPC_STUB_INVALID_DATA_ERR; break; } @@ -2431,7 +2431,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO) : { const auto& activeDirtyRegionInfos = GetActiveDirtyRegionInfo(); if (!reply.WriteInt32(activeDirtyRegionInfos.size())) { - RS_LOGE("RSRenderProcessConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfosSize " + RS_LOGE("RSClientToRenderConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfosSize " "failed!"); ret = ERR_INVALID_REPLY; break; @@ -2441,7 +2441,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( !reply.WriteInt32(activeDirtyRegionInfo.activeFramesNumber) || !reply.WriteInt32(activeDirtyRegionInfo.pidOfBelongsApp) || !reply.WriteString(activeDirtyRegionInfo.windowName)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfos " + RS_LOGE("RSClientToRenderConnectionStub::GET_ACTIVE_DIRTY_REGION_INFO Write activeDirtyRegionInfos " "failed!"); ret = ERR_INVALID_REPLY; break; @@ -2456,7 +2456,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( !reply.WriteInt32(globalDirtyRegionInfo.skipProcessFramesNumber) || !reply.WriteInt32(globalDirtyRegionInfo.mostSendingPidWhenDisplayNodeSkip)) { RS_LOGE( - "RSRenderProcessConnectionStub::GET_GLOBAL_DIRTY_REGION_INFO Write globalDirtyRegionInfo failed!"); + "RSClientToRenderConnectionStub::GET_GLOBAL_DIRTY_REGION_INFO Write globalDirtyRegionInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2465,7 +2465,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int64_t hdrOnDuration = 0; auto errCode = GetHdrOnDuration(hdrOnDuration); if (errCode != ERR_OK || !reply.WriteInt64(hdrOnDuration)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_HDR_ON_DURATION Write " + RS_LOGE("RSClientToRenderConnectionStub::GET_HDR_ON_DURATION Write " "hdrOnDuration failed!"); ret = ERR_INVALID_REPLY; } @@ -2475,19 +2475,19 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG) : { int32_t feature{0}; if (!data.ReadInt32(feature)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read feature failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_TP_FEATURE_CONFIG Read feature failed!"); ret = ERR_INVALID_DATA; break; } auto config = data.ReadCString(); if (config == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read config failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_TP_FEATURE_CONFIG Read config failed!"); ret = ERR_INVALID_DATA; break; } uint8_t tpFeatureConfigType{0}; if (!data.ReadUint8(tpFeatureConfigType)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_TP_FEATURE_CONFIG Read tpFeatureConfigType failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_TP_FEATURE_CONFIG Read tpFeatureConfigType failed!"); ret = ERR_INVALID_DATA; break; } @@ -2498,7 +2498,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS) : { bool isVirtualScreenUsingStatus{false}; if (!data.ReadBool(isVirtualScreenUsingStatus)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_USING_STATUS Read " + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_USING_STATUS Read " "isVirtualScreenUsingStatus failed!"); ret = ERR_INVALID_DATA; break; @@ -2510,7 +2510,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS) : { bool isCurtainScreenOn{false}; if (!data.ReadBool(isCurtainScreenOn)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_CURTAIN_SCREEN_USING_STATUS Read " + RS_LOGE("RSClientToRenderConnectionStub::SET_CURTAIN_SCREEN_USING_STATUS Read " "isCurtainScreenOn failed!"); ret = ERR_INVALID_DATA; break; @@ -2521,7 +2521,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID) : { std::vector pidList; if (!data.ReadInt32Vector(&pidList)) { - RS_LOGE("RSRenderProcessConnectionStub::DROP_FRAME_BY_PID Read " + RS_LOGE("RSClientToRenderConnectionStub::DROP_FRAME_BY_PID Read " "pidList failed!"); ret = ERR_INVALID_REPLY; break; @@ -2532,14 +2532,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_UIEXTENSION_CALLBACK): { uint64_t userId{0}; if (!data.ReadUint64(userId)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read " + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read " "userId failed!"); ret = ERR_INVALID_DATA; break; } auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read remoteObject failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read remoteObject failed!"); ret = ERR_NULL_OBJECT; break; } @@ -2550,13 +2550,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( } bool unobscured{false}; if (!data.ReadBool(unobscured)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read unobscured failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_UIEXTENSION_CALLBACK Read unobscured failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = RegisterUIExtensionCallback(userId, callback, unobscured); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_UIEXTENSION_CALLBACK Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_UIEXTENSION_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2565,14 +2565,14 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint8_t screenStatus{0}; if (!data.ReadUint64(id) || !data.ReadUint8(screenStatus)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_STATUS Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_STATUS Read parcel failed!"); ret = ERR_INVALID_DATA; break; } bool success; SetVirtualScreenStatus(id, static_cast(screenStatus), success); if (!reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VIRTUAL_SCREEN_STATUS Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VIRTUAL_SCREEN_STATUS Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2580,7 +2580,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS) : { bool flag{false}; if (!data.ReadBool(flag)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_VMA_CACHE_STATUS read flag failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_VMA_CACHE_STATUS read flag failed!"); ret = ERR_INVALID_DATA; break; } @@ -2590,13 +2590,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ANCO_FORCE_DO_DIRECT) : { bool direct{false}; if (!data.ReadBool(direct)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_ANCO_FORCE_DO_DIRECT Read direct failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_ANCO_FORCE_DO_DIRECT Read direct failed!"); ret = ERR_INVALID_DATA; break; } bool res; if (SetAncoForceDoDirect(direct, res) != ERR_OK || !reply.WriteBool(res)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_ANCO_FORCE_DO_DIRECT Write result failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_ANCO_FORCE_DO_DIRECT Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2604,7 +2604,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Read id failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_DISPLAY_NODE Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -2622,7 +2622,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( if (!data.ReadUint64(mirroredId) || !data.ReadUint64(screenId) || !data.ReadBool(isMirror)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Read config failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_DISPLAY_NODE Read config failed!"); ret = ERR_INVALID_DATA; break; } @@ -2634,7 +2634,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( }; bool success; if (CreateNode(config, id, success) != ERR_OK || reply.WriteBool(success)) { - RS_LOGE("RSRenderProcessConnectionStub::CREATE_DISPLAY_NODE Write success failed!"); + RS_LOGE("RSClientToRenderConnectionStub::CREATE_DISPLAY_NODE Write success failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2642,7 +2642,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS) : { bool enable{false}; if (!data.ReadBool(enable)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_FREE_MULTI_WINDOW_STATUS Read enable failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_FREE_MULTI_WINDOW_STATUS Read enable failed!"); ret = ERR_INVALID_DATA; break; } @@ -2654,7 +2654,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t uid{0}; if (!data.ReadInt32(pid) || !data.ReadUint64(uid)) { - RS_LOGE("RSRenderProcessConnectionStub::REGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::REGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2666,13 +2666,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject == nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest remoteObject == nullptr"); break; } sptr callback = iface_cast(remoteObject); if (callback == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject cast error"); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest remoteObject cast error"); break; } RegisterSurfaceBufferCallback(pid, uid, callback); @@ -2683,7 +2683,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t uid{0}; if (!data.ReadInt32(pid) || !data.ReadUint64(uid)) { - RS_LOGE("RSRenderProcessConnectionStub::UNREGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::UNREGISTER_SURFACE_BUFFER_CALLBACK Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2700,7 +2700,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( bool isForceRefresh{false}; if (!data.ReadString(nodeIdStr) || !data.ReadBool(isForceRefresh)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_FORCE_REFRESH Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_FORCE_REFRESH Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2712,7 +2712,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( bool isColorFollow{false}; if (!data.ReadString(nodeIdStr) || !data.ReadBool(isColorFollow)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_COLOR_FOLLOW Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_COLOR_FOLLOW Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2723,7 +2723,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( NodeId nodeId = {}; bool isEnabled = {}; if (!data.ReadUint64(nodeId) || !data.ReadBool(isEnabled)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_WINDOW_CONTAINER Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_WINDOW_CONTAINER Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -2742,17 +2742,17 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest remoteObject == nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest remoteObject == nullptr"); break; } sptr callback = iface_cast(remoteObject); if (callback == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderProcessConnectionStub::OnRemoteRequest callback == nullptr"); + RS_LOGE("RSClientToRenderConnectionStub::OnRemoteRequest callback == nullptr"); break; } - RS_LOGD("RSRenderProcessConnectionStub: already decode unicode, timeStamp: %{public}" + RS_LOGD("RSClientToRenderConnectionStub: already decode unicode, timeStamp: %{public}" PRIu64 " token: %{public}" PRIu64, timeStamp, token); RegisterTransactionDataCallback(token, timeStamp, callback); break; @@ -2767,13 +2767,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED): { bool enabled { false }; if (!data.ReadBool(enabled)) { - RS_LOGE("RSRenderProcessConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED read enabled failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED read enabled failed!"); ret = ERR_INVALID_DATA; break; } auto err = SetBehindWindowFilterEnabled(enabled); if (err != ERR_OK) { - RS_LOGE("RSRenderProcessConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::SET_BEHIND_WINDOW_FILTER_ENABLED Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2781,7 +2781,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED): { bool enabled; if (GetBehindWindowFilterEnabled(enabled) != ERR_OK || !reply.WriteBool(enabled)) { - RS_LOGE("RSRenderProcessConnectionStub::GET_BEHIND_WINDOW_FILTER_ENABLED write enabled failed!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_BEHIND_WINDOW_FILTER_ENABLED write enabled failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2790,21 +2790,21 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( int32_t pid{0}; float gpuMemInMB{0.0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read data err!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read data err!"); ret = ERR_INVALID_DATA; break; } ret = GetPidGpuMemoryInMB(pid, gpuMemInMB); if (ret != 0) { - RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read ret err!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PID_GPU_MEMORY_IN_MB : read ret err!"); ret = ERR_INVALID_DATA; break; } if (!reply.WriteFloat(gpuMemInMB)) { - RS_LOGE("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB write gpuMemInMB err!"); + RS_LOGE("RSClientToRenderConnectionStub::GET_PID_GPU_MEMORY_IN_MB write gpuMemInMB err!"); ret = ERR_INVALID_REPLY; } - RS_LOGD("RenderProcessConnectionStub::GET_PID_GPU_MEMORY_IN_MB, ret: %{public}d, gpuMemInMB: %{public}f", + RS_LOGD("RSClientToRenderConnectionStub::GET_PID_GPU_MEMORY_IN_MB, ret: %{public}d, gpuMemInMB: %{public}f", ret, gpuMemInMB); break; } @@ -2815,13 +2815,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( uint64_t reportTime{0}; if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) || !data.ReadUint32(fps) || !data.ReadUint64(reportTime)) { - RS_LOGE("RenderProcessConnectionStub::AVCODEC_VIDEO_START : read data err!"); + RS_LOGE("RSClientToRenderConnectionStub::AVCODEC_VIDEO_START : read data err!"); ret = ERR_INVALID_DATA; break; } int32_t result = AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_START Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::AVCODEC_VIDEO_START Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2831,13 +2831,13 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( std::string surfaceName; uint32_t fps{0}; if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) || !data.ReadUint32(fps)) { - RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_STOP : read data err!"); + RS_LOGE("RSClientToRenderConnectionStub::AVCODEC_VIDEO_STOP : read data err!"); ret = ERR_INVALID_DATA; break; } int32_t result = AvcodecVideoStop(uniqueId, surfaceName, fps); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderProcessConnectionStub::AVCODEC_VIDEO_STOP Write status failed!"); + RS_LOGE("RSClientToRenderConnectionStub::AVCODEC_VIDEO_STOP Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2890,7 +2890,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE) : { NodeId nodeId = {}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderProcessConnectionStub::CLEAR_UIFIRST_CACHE : read data err!"); + RS_LOGE("RSClientToRenderConnectionStub::CLEAR_UIFIRST_CACHE : read data err!"); ret = ERR_INVALID_DATA; break; } @@ -2905,7 +2905,7 @@ int RSRenderProcessConnectionStub::OnRemoteRequest( return ret; } -bool RSRenderProcessConnectionStub::ReadDataBaseRs(DataBaseRs& info, MessageParcel& data) +bool RSClientToRenderConnectionStub::ReadDataBaseRs(DataBaseRs& info, MessageParcel& data) { if (!data.ReadInt32(info.appPid) || !data.ReadInt32(info.eventType) || !data.ReadInt32(info.versionCode) || !data.ReadInt64(info.uniqueId) || @@ -2915,57 +2915,57 @@ bool RSRenderProcessConnectionStub::ReadDataBaseRs(DataBaseRs& info, MessageParc !data.ReadString(info.bundleName) || !data.ReadString(info.processName) || !data.ReadString(info.abilityName) ||!data.ReadString(info.pageUrl) || !data.ReadString(info.sourceType) || !data.ReadString(info.note)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadDataBaseRs Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadDataBaseRs Read parcel failed!"); return false; } return true; } -bool RSRenderProcessConnectionStub::ReadAppInfo(AppInfo& info, MessageParcel& data) +bool RSClientToRenderConnectionStub::ReadAppInfo(AppInfo& info, MessageParcel& data) { if (!data.ReadInt64(info.startTime)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read startTime failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read startTime failed!"); return false; } if (!data.ReadInt64(info.endTime)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read endTime failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read endTime failed!"); return false; } if (!data.ReadInt32(info.pid)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read pid failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read pid failed!"); return false; } if (!data.ReadString(info.versionName)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read versionName failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read versionName failed!"); return false; } if (!data.ReadInt32(info.versionCode)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read versionCode failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read versionCode failed!"); return false; } if (!data.ReadString(info.bundleName)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read bundleName failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read bundleName failed!"); return false; } if (!data.ReadString(info.processName)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadAppInfo Read processName failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadAppInfo Read processName failed!"); return false; } return true; } -bool RSRenderProcessConnectionStub::ReadGameStateDataRs(GameStateData& info, MessageParcel& data) +bool RSClientToRenderConnectionStub::ReadGameStateDataRs(GameStateData& info, MessageParcel& data) { if (!data.ReadInt32(info.pid) || !data.ReadInt32(info.uid) || !data.ReadInt32(info.state) || !data.ReadInt32(info.renderTid) || !data.ReadString(info.bundleName)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadGameStateDataRs Read parcel failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadGameStateDataRs Read parcel failed!"); return false; } return true; } -bool RSRenderProcessConnectionStub::ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) +bool RSClientToRenderConnectionStub::ReadSurfaceCaptureConfig(RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) { uint8_t captureType { 0 }; if (!data.ReadFloat(captureConfig.scaleX) || !data.ReadFloat(captureConfig.scaleY) || @@ -2984,35 +2984,35 @@ bool RSRenderProcessConnectionStub::ReadSurfaceCaptureConfig(RSSurfaceCaptureCon !data.ReadFloat(captureConfig.specifiedAreaRect.bottom_) || !data.ReadUInt64Vector(&captureConfig.blackList) || !data.ReadUint32(captureConfig.backGroundColor)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureConfig Read captureType failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadSurfaceCaptureConfig Read captureType failed!"); return false; } captureConfig.captureType = static_cast(captureType); return true; } -bool RSRenderProcessConnectionStub::ReadSurfaceCaptureBlurParam( +bool RSClientToRenderConnectionStub::ReadSurfaceCaptureBlurParam( RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) { if (!data.ReadBool(blurParam.isNeedBlur) || !data.ReadFloat(blurParam.blurRadius)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureBlurParam Read blurParam failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadSurfaceCaptureBlurParam Read blurParam failed!"); return false; } return true; } -bool RSRenderProcessConnectionStub::ReadSurfaceCaptureAreaRect( +bool RSClientToRenderConnectionStub::ReadSurfaceCaptureAreaRect( Drawing::Rect& specifiedAreaRect, MessageParcel& data) { if (!data.ReadFloat(specifiedAreaRect.left_) || !data.ReadFloat(specifiedAreaRect.top_) || !data.ReadFloat(specifiedAreaRect.right_) || !data.ReadFloat(specifiedAreaRect.bottom_)) { - RS_LOGE("RSRenderProcessConnectionStub::ReadSurfaceCaptureAreaRect Read specifiedAreaRect failed!"); + RS_LOGE("RSClientToRenderConnectionStub::ReadSurfaceCaptureAreaRect Read specifiedAreaRect failed!"); return false; } return true; } -const RSInterfaceCodeSecurityManager RSRenderProcessConnectionStub::securityManager_ = \ +const RSInterfaceCodeSecurityManager RSClientToRenderConnectionStub::securityManager_ = \ RSInterfaceCodeSecurityManager::CreateInstance(); } // namespace Rosen } // namespace OHOS diff --git a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h b/rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.h similarity index 78% rename from rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h rename to rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.h index 35bdc39041..f089faaea8 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_process_connection_stub.h +++ b/rosen/modules/render_service/core/transaction/rs_client_to_render_connection_stub.h @@ -13,25 +13,25 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H +#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_RENDER_CONNECTION_STUB_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_RENDER_CONNECTION_STUB_H #include #include #include #include -#include "platform/ohos/rs_irender_process_connection.h" +#include "platform/ohos/rs_iclient_to_render_connection.h" #include "platform/ohos/rs_irender_service_connection_ipc_interface_code_access_verifier.h" #include "ipc_security/rs_ipc_interface_code_security_manager.h" #include "rs_render_service_security_utils.h" namespace OHOS { namespace Rosen { -class RSRenderProcessConnectionStub : public IRemoteStub { +class RSClientToRenderConnectionStub : public IRemoteStub { public: - RSRenderProcessConnectionStub() = default; - ~RSRenderProcessConnectionStub() noexcept = default; + RSClientToRenderConnectionStub() = default; + ~RSClientToRenderConnectionStub() noexcept = default; int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; @@ -54,4 +54,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_PROCESS_CONNECTION_STUB_H \ No newline at end of file +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_RENDER_CONNECTION_STUB_H \ No newline at end of file diff --git a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp b/rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.cpp similarity index 80% rename from rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp rename to rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.cpp index 7ad7010a64..18ef5accfc 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.cpp +++ b/rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_service_connection_stub.h" +#include "rs_client_to_service_connection_stub.h" #include #include #include "ivsync_connection.h" @@ -53,7 +53,7 @@ const uint32_t MAX_VOTER_SIZE = 100; constexpr uint32_t MAX_PID_SIZE_NUMBER = 100000; #ifdef RES_SCHED_ENABLE const uint32_t RS_IPC_QOS_LEVEL = 7; -constexpr const char* RS_BUNDLE_NAME = "render_service"; +constexpr const char* RS_BUNDLE_NAME = "client_to_service"; #endif static constexpr std::array descriptorCheckList = { static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DEFAULT_SCREEN_ID), @@ -183,7 +183,7 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin } if (old.GetOffsetsSize() > MAX_OBJECTNUM) { - ROSEN_LOGW("RSRenderServiceConnectionStub::CopyParcelIfNeed failed, parcel fdCnt: %{public}zu is too large", + ROSEN_LOGW("RSClientToServiceConnectionStub::CopyParcelIfNeed failed, parcel fdCnt: %{public}zu is too large", old.GetOffsetsSize()); return nullptr; } @@ -191,18 +191,18 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin RS_TRACE_NAME("CopyParcelForUnmarsh: size:" + std::to_string(dataSize)); void* base = malloc(dataSize); if (base == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::CopyParcelIfNeed malloc failed"); + RS_LOGE("RSClientToServiceConnectionStub::CopyParcelIfNeed malloc failed"); return nullptr; } if (memcpy_s(base, dataSize, reinterpret_cast(old.GetData()), dataSize) != 0) { - RS_LOGE("RSRenderServiceConnectionStub::CopyParcelIfNeed copy parcel data failed"); + RS_LOGE("RSClientToServiceConnectionStub::CopyParcelIfNeed copy parcel data failed"); free(base); return nullptr; } auto parcelCopied = RS_PROFILER_COPY_PARCEL(old); if (!parcelCopied->ParseFrom(reinterpret_cast(base), dataSize)) { - RS_LOGE("RSRenderServiceConnectionStub::CopyParcelIfNeed ParseFrom failed"); + RS_LOGE("RSClientToServiceConnectionStub::CopyParcelIfNeed ParseFrom failed"); free(base); return nullptr; } @@ -214,11 +214,11 @@ std::shared_ptr CopyParcelIfNeed(MessageParcel& old, pid_t callin } int32_t data{0}; if (!parcelCopied->ReadInt32(data)) { - RS_LOGE("RSRenderServiceConnectionStub::CopyParcelIfNeed parcel data Read failed"); + RS_LOGE("RSClientToServiceConnectionStub::CopyParcelIfNeed parcel data Read failed"); return nullptr; } if (data != 0) { - RS_LOGE("RSRenderServiceConnectionStub::CopyParcelIfNeed parcel data not match"); + RS_LOGE("RSClientToServiceConnectionStub::CopyParcelIfNeed parcel data not match"); return nullptr; } return parcelCopied; @@ -280,7 +280,7 @@ bool IsValidCallingPid(pid_t pid, pid_t callingPid) } } -void RSRenderServiceConnectionStub::SetQos() +void RSClientToServiceConnectionStub::SetQos() { #ifdef RES_SCHED_ENABLE std::string strBundleName = RS_BUNDLE_NAME; @@ -296,14 +296,14 @@ void RSRenderServiceConnectionStub::SetQos() struct sched_param param = {0}; param.sched_priority = 1; if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) { - RS_LOGE("RSRenderServiceConnectionStub Couldn't set SCHED_FIFO."); + RS_LOGE("RSClientToServiceConnectionStub Couldn't set SCHED_FIFO."); } else { - RS_LOGI("RSRenderServiceConnectionStub set SCHED_FIFO succeed."); + RS_LOGI("RSClientToServiceConnectionStub set SCHED_FIFO succeed."); } #endif } -int RSRenderServiceConnectionStub::OnRemoteRequest( +int RSClientToServiceConnectionStub::OnRemoteRequest( uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { uint32_t parcelNumber = RS_PROFILER_ON_REMOTE_REQUEST(this, code, data, reply, option); @@ -322,7 +322,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (std::find(std::cbegin(descriptorCheckList), std::cend(descriptorCheckList), code) != std::cend(descriptorCheckList)) { auto token = data.ReadInterfaceToken(); - if (token != RSIRenderServiceConnection::GetDescriptor()) { + if (token != RSIClientToServiceConnection::GetDescriptor()) { return ERR_INVALID_STATE; } } @@ -331,7 +331,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( code != static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER) && code != static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER)) { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest no permission code:%{public}d", code); + RS_LOGE("RSClientToServiceConnectionStub::OnRemoteRequest no permission code:%{public}d", code); return ERR_INVALID_STATE; } int ret = ERR_NONE; @@ -341,7 +341,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool isNonSystemAppCalling = false; RSInterfaceCodeAccessVerifierBase::GetAccessType(isTokenTypeValid, isNonSystemAppCalling); if (!isTokenTypeValid) { - RS_LOGE("RSRenderServiceConnectionStub::COMMIT_TRANSACTION invalid token type"); + RS_LOGE("RSClientToServiceConnectionStub::COMMIT_TRANSACTION invalid token type"); return ERR_INVALID_STATE; } if (isNonSystemAppCalling) { @@ -354,7 +354,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::shared_ptr ashmemFlowControlUnit = nullptr; int32_t readData{0}; if (!data.ReadInt32(readData)) { - RS_LOGE("RSRenderServiceConnectionStub::COMMIT_TRANSACTION read parcel failed"); + RS_LOGE("RSClientToServiceConnectionStub::COMMIT_TRANSACTION read parcel failed"); return ERR_INVALID_DATA; } if (readData == 0) { // indicate normal parcel @@ -374,7 +374,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (transactionData && isNonSystemAppCalling) { const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { - RS_LOGE("RSRenderServiceConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + RS_LOGE("RSClientToServiceConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); } } CommitTransaction(transactionData); @@ -390,7 +390,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } } if (parsedParcel == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::COMMIT_TRANSACTION failed: parsed parcel is nullptr"); + RS_LOGE("RSClientToServiceConnectionStub::COMMIT_TRANSACTION failed: parsed parcel is nullptr"); return ERR_INVALID_DATA; } RSMarshallingHelper::UnmarshallingTransactionVer(*parsedParcel); @@ -404,7 +404,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (transactionData && isNonSystemAppCalling) { const auto& nodeMap = RSMainThread::Instance()->GetContext().GetNodeMap(); if (!transactionData->IsCallingPidValid(callingPid, nodeMap)) { - RS_LOGE("RSRenderServiceConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); + RS_LOGE("RSClientToServiceConnectionStub::COMMIT_TRANSACTION IsCallingPidValid check failed"); } } CommitTransaction(transactionData); @@ -414,7 +414,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_UNI_RENDER_ENABLED): { bool enable; if (GetUniRenderEnabled(enable) != ERR_OK || !reply.WriteBool(enable)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_UNI_RENDER_ENABLED read enable failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_UNI_RENDER_ENABLED read enable failed!"); ret = ERR_INVALID_REPLY; } break; @@ -422,7 +422,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE read nodeId failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE read nodeId failed!"); ret = ERR_INVALID_DATA; break; } @@ -437,14 +437,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( RS_PROFILER_PATCH_NODE_ID(data, nodeId); std::string surfaceName; if (!data.ReadString(surfaceName)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE read surfaceName failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE read surfaceName failed!"); ret = ERR_INVALID_DATA; break; } RSSurfaceRenderNodeConfig config = {.id = nodeId, .name = surfaceName}; bool success; if (CreateNode(config, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE Write success failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE Write success failed!"); ret = ERR_INVALID_REPLY; } break; @@ -452,7 +452,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_NODE_AND_SURFACE): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE_AND_SURFACE read nodeId failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE_AND_SURFACE read nodeId failed!"); ret = ERR_INVALID_DATA; break; } @@ -470,13 +470,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool unobscured { false }; if (!data.ReadString(surfaceName) || !data.ReadUint8(type) || !data.ReadBool(isTextureExportNode) || !data.ReadBool(isSync) || !data.ReadUint8(surfaceWindowType) || !data.ReadBool(unobscured)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE_AND_SURFACE read surfaceRenderNodeConfig failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE_AND_SURFACE read surfaceRenderNodeConfig failed!"); ret = ERR_INVALID_DATA; break; } if (!CheckCreateNodeAndSurface(callingPid, static_cast(type), static_cast(surfaceWindowType))) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE_AND_SURFACE CheckCreateNodeAndSurface failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE_AND_SURFACE CheckCreateNodeAndSurface failed!"); ret = ERR_INVALID_DATA; break; } @@ -496,7 +496,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } auto producer = surface->GetProducer(); if (!reply.WriteRemoteObject(producer->AsObject())) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_NODE_AND_SURFACE read RemoteObject failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_NODE_AND_SURFACE read RemoteObject failed!"); ret = ERR_INVALID_REPLY; } break; @@ -504,7 +504,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_DEFAULT_SCREEN_ID): { uint64_t screenId = INVALID_SCREEN_ID; if (GetDefaultScreenId(screenId) != ERR_OK || !reply.WriteUint64(screenId)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_DEFAULT_SCREEN_ID Write id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_DEFAULT_SCREEN_ID Write id failed!"); ret = ERR_INVALID_REPLY; } break; @@ -512,7 +512,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_SCREEN_ID): { uint64_t screenId = INVALID_SCREEN_ID; if (GetActiveScreenId(screenId) != ERR_OK || !reply.WriteUint64(screenId)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_ACTIVE_SCREEN_ID Write id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_ACTIVE_SCREEN_ID Write id failed!"); ret = ERR_INVALID_REPLY; } break; @@ -520,13 +520,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ALL_SCREEN_IDS): { std::vector ids = GetAllScreenIds(); if (!reply.WriteUint32(ids.size())) { - RS_LOGE("RSRenderServiceConnectionStub::GET_ALL_SCREEN_IDS Write idsSize failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_ALL_SCREEN_IDS Write idsSize failed!"); ret = ERR_INVALID_REPLY; break; } for (uint32_t i = 0; i < ids.size(); i++) { if (!reply.WriteUint64(ids[i])) { - RS_LOGE("RSRenderServiceConnectionStub::GET_ALL_SCREEN_IDS Write ids failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_ALL_SCREEN_IDS Write ids failed!"); ret = ERR_INVALID_REPLY; break; } @@ -541,7 +541,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool useSurface{false}; if (!data.ReadString(name) || !data.ReadUint32(width) || !data.ReadUint32(height) || !data.ReadBool(useSurface)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VIRTUAL_SCREEN read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VIRTUAL_SCREEN read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -557,13 +557,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t flags{0}; std::vector whiteList; if (!data.ReadUint64(mirrorId) || !data.ReadInt32(flags) || !data.ReadUInt64Vector(&whiteList)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VIRTUAL_SCREEN read ScreenId failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VIRTUAL_SCREEN read ScreenId failed!"); ret = ERR_INVALID_DATA; break; } ScreenId id = CreateVirtualScreen(name, width, height, surface, mirrorId, flags, whiteList); if (!reply.WriteUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VIRTUAL_SCREEN Write id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VIRTUAL_SCREEN Write id failed!"); ret = ERR_INVALID_REPLY; } break; @@ -572,7 +572,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( // read the parcel data. ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -589,7 +589,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } int32_t status = SetVirtualScreenSurface(id, surface); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_VIRTUAL_SCREEN_SURFACE Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -597,7 +597,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::REMOVE_VIRTUAL_SCREEN Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::REMOVE_VIRTUAL_SCREEN Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -607,20 +607,20 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CHANGE_CALLBACK): { auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK remoteObject is nullptr"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK remoteObject is nullptr"); ret = ERR_NULL_OBJECT; break; } sptr cb = iface_cast(remoteObject); if (cb == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK callback is nullptr"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK callback is nullptr"); ret = ERR_NULL_OBJECT; break; } - RS_LOGI("RSRenderServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK"); + RS_LOGI("RSClientToServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK"); int32_t status = SetScreenChangeCallback(cb); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_CHANGE_CALLBACK Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -629,7 +629,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint32_t modeId{0}; if (!data.ReadUint64(id) || !data.ReadUint32(modeId)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_ACTIVE_MODE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_ACTIVE_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -641,7 +641,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t sceneId{0}; int32_t rate{0}; if (!data.ReadUint64(id) || !data.ReadInt32(sceneId) || !data.ReadInt32(rate)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_REFRESH_RATE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_REFRESH_RATE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -651,7 +651,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_REFRESH_RATE_MODE): { int32_t mode{0}; if (!data.ReadInt32(mode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_REFRESH_RATE_MODE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_REFRESH_RATE_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -661,7 +661,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER): { FrameRateLinkerId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::UNREGISTER_FRAME_RATE_LINKER Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::UNREGISTER_FRAME_RATE_LINKER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -677,13 +677,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CURRENT_REFRESH_RATE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_CURRENT_REFRESH_RATE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_CURRENT_REFRESH_RATE Read id failed!"); ret = ERR_INVALID_DATA; break; } uint32_t refreshRate = GetScreenCurrentRefreshRate(id); if (!reply.WriteUint32(refreshRate)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_CURRENT_REFRESH_RATE Write refreshRate failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_CURRENT_REFRESH_RATE Write refreshRate failed!"); ret = ERR_INVALID_REPLY; } break; @@ -691,7 +691,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_CURRENT_REFRESH_RATE_MODE): { int32_t refreshRateMode = GetCurrentRefreshRateMode(); if (!reply.WriteInt32(refreshRateMode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_CURRENT_REFRESH_RATE_MODE Write refreshRateMode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_CURRENT_REFRESH_RATE_MODE Write refreshRateMode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -699,20 +699,20 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_REFRESH_RATES): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Read id failed!"); ret = ERR_INVALID_DATA; break; } std::vector rates = GetScreenSupportedRefreshRates(id); if (!reply.WriteUint64(static_cast(rates.size()))) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Write rates failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Write rates failed!"); ret = ERR_INVALID_REPLY; break; } for (auto ratesIter : rates) { if (!reply.WriteInt32(ratesIter)) { RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Write ratesIter failed!"); + "RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_REFRESH_RATES Write ratesIter failed!"); ret = ERR_INVALID_REPLY; break; } @@ -722,7 +722,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SHOW_REFRESH_RATE_ENABLED): { bool enabled = false; if (GetShowRefreshRateEnabled(enabled) != ERR_OK || !reply.WriteBool(enabled)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SHOW_REFRESH_RATE_ENABLED Write enabled failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SHOW_REFRESH_RATE_ENABLED Write enabled failed!"); ret = ERR_INVALID_REPLY; } break; @@ -731,7 +731,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool enabled{false}; int32_t type{0}; if (!data.ReadBool(enabled) || !data.ReadInt32(type)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SHOW_REFRESH_RATE_ENABLED Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SHOW_REFRESH_RATE_ENABLED Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -741,26 +741,26 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REALTIME_REFRESH_RATE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REALTIME_REFRESH_RATE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REALTIME_REFRESH_RATE Read id failed!"); ret = ERR_INVALID_DATA; break; } uint32_t refreshRate = GetRealtimeRefreshRate(id); if (!reply.WriteUint32(refreshRate)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REALTIME_REFRESH_RATE Read refreshRate failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REALTIME_REFRESH_RATE Read refreshRate failed!"); ret = ERR_INVALID_REPLY; } break; } case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO): { auto token = data.ReadInterfaceToken(); - if (token != RSIRenderServiceConnection::GetDescriptor()) { + if (token != RSIClientToServiceConnection::GetDescriptor()) { ret = ERR_INVALID_STATE; break; } int32_t pid{0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REFRESH_INFO Read pid failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REFRESH_INFO Read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -771,7 +771,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } std::string refreshInfo; if (GetRefreshInfo(pid, refreshInfo) != ERR_OK || !reply.WriteString(refreshInfo)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REFRESH_INFO Write refreshInfo failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REFRESH_INFO Write refreshInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -780,13 +780,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP): { uint64_t nodeId{0}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REFRESH_INFO_TO_SP Read nodeId failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REFRESH_INFO_TO_SP Read nodeId failed!"); ret = ERR_INVALID_DATA; break; } std::string refreshInfoToSP; if (GetRefreshInfoToSP(nodeId, refreshInfoToSP) != ERR_OK || !reply.WriteString(refreshInfoToSP)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_REFRESH_INFO_TO_SP Write refreshInfoToSP failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_REFRESH_INFO_TO_SP Write refreshInfoToSP failed!"); ret = ERR_INVALID_REPLY; } break; @@ -796,13 +796,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t width{0}; uint32_t height{0}; if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetPhysicalScreenResolution(id, width, height); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_PHYSICAL_SCREEN_RESOLUTION Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -812,13 +812,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t width{0}; uint32_t height{0}; if (!data.ReadUint64(id) || !data.ReadUint32(width) || !data.ReadUint32(height)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t status = SetVirtualScreenResolution(id, width, height); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_VIRTUAL_SCREEN_RESOLUTION Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -828,13 +828,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint8_t outPort{0}; std::vector edidData{}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = GetDisplayIdentificationData(id, outPort, edidData); if (!reply.WriteUint8(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Write result failed!"); ret = IPC_STUB_WRITE_PARCEL_ERR; break; } @@ -844,7 +844,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (!reply.WriteUint8(outPort) || !reply.WriteUint32(static_cast(edidData.size())) || !reply.WriteBuffer(edidData.data(), edidData.size())) { - RS_LOGE("RSRenderServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Write parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_DISPLAY_IDENTIFICATION_DATA Write parcel failed!"); ret = IPC_STUB_WRITE_PARCEL_ERR; } break; @@ -857,7 +857,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint32_t status{0}; if (!data.ReadUint64(id) || !data.ReadUint32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_POWER_STATUS Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_POWER_STATUS Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -883,13 +883,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_ACTIVE_MODE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenModeInfo screenModeInfo; if (GetScreenActiveMode(id, screenModeInfo) != ERR_OK || !reply.WriteParcelable(&screenModeInfo)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_ACTIVE_MODE Write screenModeInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -897,21 +897,21 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_MODES): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Read id failed!"); ret = ERR_INVALID_DATA; break; } std::vector screenSupportedModes = GetScreenSupportedModes(id); if (!reply.WriteUint64(static_cast(screenSupportedModes.size()))) { RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModesSize failed!"); + "RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModesSize failed!"); ret = ERR_INVALID_REPLY; break; } for (uint32_t modeIndex = 0; modeIndex < screenSupportedModes.size(); modeIndex++) { if (!reply.WriteParcelable(&screenSupportedModes[modeIndex])) { RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModes failed!"); + "RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_MODES Write screenSupportedModes failed!"); ret = ERR_INVALID_REPLY; break; } @@ -921,7 +921,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_MEMORY_GRAPHIC): { int32_t pid{0}; if (!data.ReadInt32(pid)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_MEMORY_GRAPHIC Read pid failed!"); ret = ERR_INVALID_DATA; break; } @@ -933,7 +933,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } MemoryGraphic memoryGraphic; if (GetMemoryGraphic(pid, memoryGraphic) != ERR_OK || !reply.WriteParcelable(&memoryGraphic)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphic failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphic failed!"); ret = ERR_INVALID_REPLY; } break; @@ -942,13 +942,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::vector memoryGraphics; if (GetMemoryGraphics(memoryGraphics) != ERR_OK || !reply.WriteUint64(static_cast(memoryGraphics.size()))) { - RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphicsSize failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphicsSize failed!"); ret = ERR_INVALID_REPLY; break; } for (uint32_t index = 0; index < memoryGraphics.size(); index++) { if (!reply.WriteParcelable(&memoryGraphics[index])) { - RS_LOGE("RSRenderServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphics failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_MEMORY_GRAPHIC Write memoryGraphics failed!"); ret = ERR_INVALID_REPLY; break; } @@ -960,7 +960,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( float gpuMemSize = 0.f; if (GetTotalAppMemSize(cpuMemSize, gpuMemSize) != ERR_OK || !reply.WriteFloat(cpuMemSize) || !reply.WriteFloat(gpuMemSize)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_TOTAL_APP_MEM_SIZE Write parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_TOTAL_APP_MEM_SIZE Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -968,13 +968,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CAPABILITY): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_CAPABILITY Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_CAPABILITY Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenCapability screenCapability = GetScreenCapability(id); if (!reply.WriteParcelable(&screenCapability)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_CAPABILITY Write screenCapability failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_CAPABILITY Write screenCapability failed!"); ret = ERR_INVALID_REPLY; } break; @@ -982,13 +982,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_POWER_STATUS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_POWER_STATUS Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_POWER_STATUS Read id failed!"); ret = ERR_INVALID_DATA; break; } uint32_t powerStatus{static_cast(INVALID_POWER_STATUS)}; if (GetScreenPowerStatus(id, powerStatus) != ERR_OK || !reply.WriteUint32(powerStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_POWER_STATUS Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_POWER_STATUS Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -996,13 +996,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_DATA): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_DATA Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_DATA Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenData screenData = GetScreenData(id); if (!reply.WriteParcelable(&screenData)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_DATA Write screenData failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_DATA Write screenData failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1010,13 +1010,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_BACK_LIGHT): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_BACK_LIGHT Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_BACK_LIGHT Read id failed!"); ret = ERR_INVALID_DATA; break; } int32_t backLightLevel{static_cast(INVALID_BACKLIGHT_VALUE)}; if (GetScreenBacklight(id, backLightLevel) != ERR_OK || !reply.WriteInt32(backLightLevel)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_BACK_LIGHT Write level failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_BACK_LIGHT Write level failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1025,7 +1025,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; uint32_t level{0}; if (!data.ReadUint64(id) || !data.ReadUint32(level)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_BACK_LIGHT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_BACK_LIGHT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1035,7 +1035,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_BUFFER_AVAILABLE_LISTENER Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_BUFFER_AVAILABLE_LISTENER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1048,7 +1048,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); bool isFromRenderThread{false}; if (!data.ReadBool(isFromRenderThread)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_BUFFER_AVAILABLE_LISTENER read isFromRenderThread failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_BUFFER_AVAILABLE_LISTENER read isFromRenderThread failed!"); ret = ERR_INVALID_DATA; break; } @@ -1067,7 +1067,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_BUFFER_CLEAR_LISTENER Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_BUFFER_CLEAR_LISTENER Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1093,7 +1093,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_GAMUTS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1101,7 +1101,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::vector mode; int32_t result = GetScreenSupportedColorGamuts(id, mode); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1111,7 +1111,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } std::copy(mode.begin(), mode.end(), std::back_inserter(modeSend)); if (!reply.WriteUInt32Vector(modeSend)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Write modeSend failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_GAMUTS Write modeSend failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1119,7 +1119,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_METADATAKEYS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1127,7 +1127,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::vector keys; int32_t result = GetScreenSupportedMetaDataKeys(id, keys); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1139,7 +1139,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( keySend.push_back(i); } if (!reply.WriteUInt32Vector(keySend)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Write keySend failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_METADATAKEYS Write keySend failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1147,14 +1147,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT Read id failed!"); ret = ERR_INVALID_DATA; break; } ScreenColorGamut mode; int32_t result = GetScreenColorGamut(id, mode); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1163,7 +1163,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(mode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT Write mode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT Write mode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1172,13 +1172,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; int32_t modeIdx{0}; if (!data.ReadUint64(id) || !data.ReadInt32(modeIdx)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_GAMUT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_GAMUT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetScreenColorGamut(id, modeIdx); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_GAMUT Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_GAMUT Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1187,13 +1187,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; int32_t mode{0}; if (!data.ReadUint64(id) || !data.ReadInt32(mode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_GAMUT_MAP Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_GAMUT_MAP Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetScreenGamutMap(id, static_cast(mode)); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_GAMUT_MAP Write parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_GAMUT_MAP Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1202,13 +1202,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id{INVALID_SCREEN_ID}; int32_t screenRotation{0}; if (!data.ReadUint64(id) || !data.ReadInt32(screenRotation)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_CORRECTION Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_CORRECTION Read parcel failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetScreenCorrection(id, static_cast(screenRotation)); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_CORRECTION Write parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_CORRECTION Write parcel failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1217,12 +1217,12 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( RSIRenderServiceConnectionInterfaceCode::SET_GLOBAL_DARK_COLOR_MODE): { bool isDark{false}; if (!data.ReadBool(isDark)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } if (SetGlobalDarkColorMode(isDark) != ERR_OK) { - RS_LOGE("RSRenderServiceConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_GLOBAL_DARK_COLOR_MODE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1230,14 +1230,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_GAMUT_MAP): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT_MAP Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT_MAP Read parcel failed!"); ret = ERR_INVALID_DATA; break; } ScreenGamutMap mode; int32_t result = GetScreenGamutMap(id, mode); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT_MAP Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT_MAP Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1246,7 +1246,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(mode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_GAMUT_MAP Write mode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_GAMUT_MAP Write mode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1254,7 +1254,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_VSYNC_CONNECTION): { std::string name; if (!data.ReadString(name)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VSYNC_CONNECTION read name failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VSYNC_CONNECTION read name failed!"); ret = ERR_INVALID_DATA; break; } @@ -1262,7 +1262,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint64_t id{0}; NodeId windowNodeID{0}; if (!data.ReadUint64(id) || !data.ReadUint64(windowNodeID)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VSYNC_CONNECTION read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VSYNC_CONNECTION read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1290,7 +1290,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( securityUtils_.IncreaseAccessCounter(code); #endif if (!reply.WriteRemoteObject(conn->AsObject())) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_VSYNC_CONNECTION Write Object failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_VSYNC_CONNECTION Write Object failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1298,7 +1298,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_HDR_STATUS Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1306,11 +1306,11 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t resCode; ret = GetScreenHDRStatus(id, hdrStatus, resCode); if (ret != ERR_OK) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_HDR_STATUS Business error(%{public}d)!", ret); resCode = ret; } if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_HDR_STATUS Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1318,7 +1318,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(hdrStatus)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_HDR_STATUS Write hdrStatus failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1326,7 +1326,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_SUPPORTED_COLORSPACES): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1335,7 +1335,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t resCode; GetScreenSupportedColorSpaces(id, colorSpaces, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write resCode failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1345,7 +1345,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::copy(colorSpaces.begin(), colorSpaces.end(), std::back_inserter(colorSpacesSend)); if (!reply.WriteUInt32Vector(colorSpacesSend)) { RS_LOGE( - "RSRenderServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); + "RSClientToServiceConnectionStub::GET_SCREEN_SUPPORTED_COLORSPACES Write colorSpacesSend failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1353,7 +1353,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_COLORSPACE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_COLORSPACE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1361,7 +1361,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t resCode; GetScreenColorSpace(id, colorSpace, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_COLORSPACE Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1369,7 +1369,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(colorSpace)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_COLORSPACE Write colorSpace failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_COLORSPACE Write colorSpace failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1377,13 +1377,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_COLORSPACE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_COLORSPACE Read id failed!"); ret = ERR_INVALID_DATA; break; } int32_t color{0}; if (!data.ReadInt32(color)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE read colorSpace failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_COLORSPACE read colorSpace failed!"); ret = ERR_INVALID_DATA; break; } @@ -1391,7 +1391,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t resCode; SetScreenColorSpace(id, colorSpace, resCode); if (!reply.WriteInt32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_COLORSPACE Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_COLORSPACE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1399,14 +1399,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_TYPE): { ScreenId id{INVALID_SCREEN_ID}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_TYPE Read id failed!"); ret = ERR_INVALID_DATA; break; } RSScreenType type; int32_t result = GetScreenType(id, type); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_TYPE Write result failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1415,7 +1415,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( break; } if (!reply.WriteUint32(type)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_SCREEN_TYPE Write type failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_SCREEN_TYPE Write type failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1423,7 +1423,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BITMAP): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_BITMAP Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1436,7 +1436,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( Drawing::Bitmap bm; bool success; if (GetBitmap(id, bm, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_BITMAP Write success failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_BITMAP Write success failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1448,7 +1448,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP): { NodeId id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXELMAP Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_PIXELMAP Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1467,7 +1467,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool success; if (GetPixelmap(id, pixelmap, &rect, drawCmdList, success) != ERR_OK || !reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_PIXELMAP Write id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_PIXELMAP Write id failed!"); ret = ERR_INVALID_REPLY; break; } @@ -1481,7 +1481,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint64_t uniqueId{0}; uint32_t hash{0}; if (!data.ReadUint64(uniqueId) || !data.ReadUint32(hash)) { - RS_LOGE("RSRenderServiceConnectionStub::NEED_REGISTER_TYPEFACE read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NEED_REGISTER_TYPEFACE read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1489,11 +1489,11 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (IsValidCallingPid(ExtractPid(uniqueId), callingPid)) { result = !RSTypefaceCache::Instance().HasTypeface(uniqueId, hash); } else { - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest callingPid[%{public}d] " + RS_LOGE("RSClientToServiceConnectionStub::OnRemoteRequest callingPid[%{public}d] " "no permission NEED_REGISTER_TYPEFACE", callingPid); } if (!reply.WriteBool(result)) { - RS_LOGE("RSRenderServiceConnectionStub::NEED_REGISTER_TYPEFACE Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NEED_REGISTER_TYPEFACE Write result failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1506,7 +1506,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t h{0}; if (!data.ReadUint64(id) || !data.ReadInt32(x) || !data.ReadInt32(y) || !data.ReadInt32(w) || !data.ReadInt32(h)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_ACTIVE_RECT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_ACTIVE_RECT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1518,7 +1518,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( }; uint32_t repCode; if (SetScreenActiveRect(id, activeRect, repCode) != ERR_OK || !reply.WriteUint32(repCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_ACTIVE_RECT Write result failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_ACTIVE_RECT Write result failed!"); return ERR_INVALID_REPLY; } break; @@ -1528,7 +1528,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t offsetX = 0; int32_t offsetY = 0; if (!data.ReadUint64(id) || !data.ReadInt32(offsetX) || !data.ReadInt32(offsetY)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_OFFSET Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_OFFSET Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1539,7 +1539,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( ScreenId id = INVALID_SCREEN_ID; int32_t gravity = 0; if (!data.ReadUint64(id) || !data.ReadInt32(gravity)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_SCREEN_FRAME_GRAVITY Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_SCREEN_FRAME_GRAVITY Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1550,7 +1550,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int16_t type{0}; int16_t subType{0}; if (!data.ReadInt16(type) || !data.ReadInt16(subType)) { - RS_LOGE("RSRenderServiceConnectionStub::EXECUTE_SYNCHRONOUS_TASK Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::EXECUTE_SYNCHRONOUS_TASK Read parcel failed!"); ret = ERR_INVALID_STATE; break; } @@ -1583,7 +1583,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HARDWARE_ENABLED Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HARDWARE_ENABLED Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1598,7 +1598,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (!data.ReadBool(isEnabled) || !data.ReadUint8(selfDrawingType) || !data.ReadBool(dynamicHardwareEnable)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HARDWARE_ENABLED Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HARDWARE_ENABLED Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1608,7 +1608,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1617,7 +1617,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( "::SET_HIDE_PRIVACY_CONTENT"); if (!isSystemCalling) { if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NONSYSTEM_CALLING))) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write isSystemCalling failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write isSystemCalling failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1626,21 +1626,21 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( RS_LOGW("The SetHidePrivacyContent isn't legal, nodeId:%{public}" PRIu64 ", callingPid:%{public}d", id, callingPid); if (!reply.WriteUint32(static_cast(RSInterfaceErrorCode::NOT_SELF_CALLING))) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write ErrorCode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write ErrorCode failed!"); ret = ERR_INVALID_REPLY; } break; } bool needHidePrivacyContent{false}; if (!data.ReadBool(needHidePrivacyContent)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT read needHidePrivacyContent failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT read needHidePrivacyContent failed!"); ret = ERR_INVALID_DATA; break; } uint32_t resCode; if (SetHidePrivacyContent(id, needHidePrivacyContent, resCode) != ERR_OK || !reply.WriteUint32(resCode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write resCode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_HIDE_PRIVACY_CONTENT Write resCode failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1653,7 +1653,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::string description; if (!data.ReadString(eventName) || !data.ReadBool(eventStatus) || !data.ReadUint32(minRefreshRate) || !data.ReadUint32(maxRefreshRate) || !data.ReadString(description)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_REFRESH_RATE_EVENT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_REFRESH_RATE_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1668,7 +1668,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t mapSize{0}; if (!data.ReadUint32(mapSize)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read mapSize failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read mapSize failed!"); ret = ERR_INVALID_DATA; break; } @@ -1680,14 +1680,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( for (uint32_t i = 0; i < mapSize; ++i) { uint64_t windowId{0}; if (!data.ReadUint64(windowId)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read parcel failed!"); ret = ERR_INVALID_DATA; shouldBreak = true; break; } EventInfo eventInfo; if (!EventInfo::Deserialize(data, eventInfo)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID Read parcel failed!"); ret = ERR_INVALID_DATA; shouldBreak = true; break; @@ -1704,7 +1704,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t mapSize{0}; if (!data.ReadUint32(mapSize)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read mapSize failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read mapSize failed!"); ret = ERR_INVALID_DATA; break; } @@ -1716,14 +1716,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( for (uint32_t i = 0; i < mapSize; ++i) { std::string vsyncName; if (!data.ReadString(vsyncName)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read parcel failed!"); ret = ERR_INVALID_DATA; shouldBreak = true; break; } EventInfo eventInfo; if (!EventInfo::Deserialize(data, eventInfo)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME Read parcel failed!"); ret = ERR_INVALID_DATA; shouldBreak = true; break; @@ -1739,7 +1739,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t pid{0}; uint32_t rateDiscount{0}; if (!data.ReadUint32(pid) || !data.ReadUint32(rateDiscount)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_SOFT_VSYNC_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1749,7 +1749,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT) : { bool enableDynamicMode{false}; if (!data.ReadBool(enableDynamicMode)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_DYNAMIC_MODE_EVENT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_DYNAMIC_MODE_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1760,7 +1760,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( int32_t touchStatus{0}; int32_t touchCnt{0}; if (!data.ReadInt32(touchStatus) || !data.ReadInt32(touchCnt)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_TOUCH_EVENT Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_TOUCH_EVENT Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1771,7 +1771,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::string id; int32_t expectedFrameRate; if (!data.ReadString(id) || !data.ReadInt32(expectedFrameRate)) { - RS_LOGE("RSRenderServiceConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1783,7 +1783,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (!reply.WriteInt32(LayerComposeInfo.uniformRenderFrameNumber) || !reply.WriteInt32(LayerComposeInfo.offlineComposeFrameNumber) || !reply.WriteInt32(LayerComposeInfo.redrawFrameNumber)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_LAYER_COMPOSE_INFO Write LayerComposeInfo failed!"); + RS_LOGE("RSClientToServiceConnectionStub::GET_LAYER_COMPOSE_INFO Write LayerComposeInfo failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1792,7 +1792,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO) : { const auto& hwcDisabledReasonInfos = GetHwcDisabledReasonInfo(); if (!reply.WriteInt32(hwcDisabledReasonInfos.size())) { - RS_LOGE("RSRenderServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " + RS_LOGE("RSClientToServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " "hwcDisabledReasonInfos failed!"); ret = ERR_INVALID_REPLY; break; @@ -1800,7 +1800,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( for (const auto& hwcDisabledReasonInfo : hwcDisabledReasonInfos) { for (const auto& disabledReasonCount : hwcDisabledReasonInfo.disabledReasonStatistics) { if (!reply.WriteInt32(disabledReasonCount)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " + RS_LOGE("RSClientToServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " "disabledReasonCount failed!"); ret = ERR_INVALID_REPLY; break; @@ -1811,7 +1811,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } if (!reply.WriteInt32(hwcDisabledReasonInfo.pidOfBelongsApp) || !reply.WriteString(hwcDisabledReasonInfo.nodeName)) { - RS_LOGE("RSRenderServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " + RS_LOGE("RSClientToServiceConnectionStub::GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO Write " "hwcDisabledReasonInfo failed!"); ret = ERR_INVALID_REPLY; break; @@ -1823,19 +1823,19 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG) : { int32_t feature{0}; if (!data.ReadInt32(feature)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_TP_FEATURE_CONFIG Read feature failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_TP_FEATURE_CONFIG Read feature failed!"); ret = ERR_INVALID_DATA; break; } auto config = data.ReadCString(); if (config == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::SET_TP_FEATURE_CONFIG Read config failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_TP_FEATURE_CONFIG Read config failed!"); ret = ERR_INVALID_DATA; break; } uint8_t tpFeatureConfigType{0}; if (!data.ReadUint8(tpFeatureConfigType)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_TP_FEATURE_CONFIG Read tpFeatureConfigType failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_TP_FEATURE_CONFIG Read tpFeatureConfigType failed!"); ret = ERR_INVALID_DATA; break; } @@ -1858,7 +1858,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_DISPLAY_NODE) : { uint64_t id{0}; if (!data.ReadUint64(id)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_DISPLAY_NODE Read id failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_DISPLAY_NODE Read id failed!"); ret = ERR_INVALID_DATA; break; } @@ -1876,7 +1876,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (!data.ReadUint64(mirroredId) || !data.ReadUint64(screenId) || !data.ReadBool(isMirror)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_DISPLAY_NODE Read config failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_DISPLAY_NODE Read config failed!"); ret = ERR_INVALID_DATA; break; } @@ -1888,7 +1888,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( }; bool success; if (CreateNode(config, id, success) != ERR_OK || reply.WriteBool(success)) { - RS_LOGE("RSRenderServiceConnectionStub::CREATE_DISPLAY_NODE Write success failed!"); + RS_LOGE("RSClientToServiceConnectionStub::CREATE_DISPLAY_NODE Write success failed!"); ret = ERR_INVALID_REPLY; } break; @@ -1898,7 +1898,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool isTop{false}; uint32_t topLayerZOrder = 0; if (!data.ReadUint64(nodeId) || !data.ReadBool(isTop) || !data.ReadUint32(topLayerZOrder)) { - RS_LOGE("RSRenderServiceConntionStub::SET_LAYER_TOP_FOR_HARDWARE_COMPOSER Read parcel failed"); + RS_LOGE("RSClientToServiceConnectionStub::SET_LAYER_TOP_FOR_HARDWARE_COMPOSER Read parcel failed"); ret = ERR_INVALID_DATA; break; } @@ -1910,7 +1910,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( bool isTop{false}; if (!data.ReadString(nodeIdStr) || !data.ReadBool(isTop)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_LAYER_TOP Read parcel failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_LAYER_TOP Read parcel failed!"); ret = ERR_INVALID_DATA; break; } @@ -1926,20 +1926,20 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint32_t size; if (!data.ReadUint32(size)) { ROSEN_LOGE( - "RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read size failed"); + "RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read size failed"); ret = ERR_INVALID_REPLY; break; } RectConstraint constraint; if (size > MAX_PID_SIZE_NUMBER) { - ROSEN_LOGE("RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK " + ROSEN_LOGE("RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK " "size number is too large."); break; } for (uint32_t i = 0; i < size; ++i) { pid_t pid; if (!data.ReadInt32(pid)) { - ROSEN_LOGE("RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " + ROSEN_LOGE("RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " "pid failed"); ret = ERR_INVALID_REPLY; break; @@ -1949,14 +1949,14 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( if (!data.ReadInt32(constraint.range.lowLimit.width) || !data.ReadInt32(constraint.range.lowLimit.height) || !data.ReadInt32(constraint.range.highLimit.width) || !data.ReadInt32(constraint.range.highLimit.height)) { - ROSEN_LOGE("RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " + ROSEN_LOGE("RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " "rectRange failed"); ret = ERR_INVALID_REPLY; break; } auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " + RS_LOGE("RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Read " "remoteObject failed!"); ret = ERR_NULL_OBJECT; break; @@ -1969,7 +1969,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( } int32_t status = RegisterSelfDrawingNodeRectChangeCallback(constraint, callback); if (!reply.WriteInt32(status)) { - RS_LOGE("RSRenderServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Write status " + RS_LOGE("RSClientToServiceConnectionStub::REGISTER_SELF_DRAWING_NODE_RECT_CHANGE_CALLBACK Write status " "failed!"); ret = ERR_INVALID_REPLY; } @@ -1989,17 +1989,17 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest remoteObject == nullptr"); + RS_LOGE("RSClientToServiceConnectionStub::OnRemoteRequest remoteObject == nullptr"); break; } sptr callback = iface_cast(remoteObject); if (callback == nullptr) { ret = ERR_NULL_OBJECT; - RS_LOGE("RSRenderServiceConnectionStub::OnRemoteRequest callback == nullptr"); + RS_LOGE("RSClientToServiceConnectionStub::OnRemoteRequest callback == nullptr"); break; } - RS_LOGD("RSRenderServiceConnectionStub: already decode unicode, timeStamp: %{public}" + RS_LOGD("RSClientToServiceConnectionStub: already decode unicode, timeStamp: %{public}" PRIu64 " token: %{public}" PRIu64, timeStamp, token); RegisterTransactionDataCallback(token, timeStamp, callback); break; @@ -2009,13 +2009,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( RS_LOGI("RSRenderServicrConnectionStub::OnRemoteRequest SET_OVERLAY_DISPLAY_MODE"); int32_t mode{0}; if (!data.ReadInt32(mode)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_OVERLAY_DISPLAY_MODE Read mode failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_OVERLAY_DISPLAY_MODE Read mode failed!"); ret = ERR_INVALID_DATA; break; } int32_t result = SetOverlayDisplayMode(mode); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::SET_OVERLAY_DISPLAY_MODE Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::SET_OVERLAY_DISPLAY_MODE Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2028,13 +2028,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( uint64_t reportTime{0}; if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) || !data.ReadUint32(fps) || !data.ReadUint64(reportTime)) { - RS_LOGE("RenderServiceConnectionStub::AVCODEC_VIDEO_START : read data err!"); + RS_LOGE("RSClientToServiceConnectionStub::AVCODEC_VIDEO_START : read data err!"); ret = ERR_INVALID_DATA; break; } int32_t result = AvcodecVideoStart(uniqueId, surfaceName, fps, reportTime); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::AVCODEC_VIDEO_START Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::AVCODEC_VIDEO_START Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2044,13 +2044,13 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( std::string surfaceName; uint32_t fps{0}; if (!data.ReadUint64(uniqueId) || !data.ReadString(surfaceName) || !data.ReadUint32(fps)) { - RS_LOGE("RSRenderServiceConnectionStub::AVCODEC_VIDEO_STOP : read data err!"); + RS_LOGE("RSClientToServiceConnectionStub::AVCODEC_VIDEO_STOP : read data err!"); ret = ERR_INVALID_DATA; break; } int32_t result = AvcodecVideoStop(uniqueId, surfaceName, fps); if (!reply.WriteInt32(result)) { - RS_LOGE("RSRenderServiceConnectionStub::AVCODEC_VIDEO_STOP Write status failed!"); + RS_LOGE("RSClientToServiceConnectionStub::AVCODEC_VIDEO_STOP Write status failed!"); ret = ERR_INVALID_REPLY; } break; @@ -2103,7 +2103,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( case static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE) : { NodeId nodeId = {}; if (!data.ReadUint64(nodeId)) { - RS_LOGE("RSRenderServiceConnectionStub::CLEAR_UIFIRST_CACHE : read data err!"); + RS_LOGE("RSClientToServiceConnectionStub::CLEAR_UIFIRST_CACHE : read data err!"); ret = ERR_INVALID_DATA; break; } @@ -2118,7 +2118,7 @@ int RSRenderServiceConnectionStub::OnRemoteRequest( return ret; } -const RSInterfaceCodeSecurityManager RSRenderServiceConnectionStub::securityManager_ = \ +const RSInterfaceCodeSecurityManager RSClientToServiceConnectionStub::securityManager_ = \ RSInterfaceCodeSecurityManager::CreateInstance(); } // namespace Rosen } // namespace OHOS diff --git a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h b/rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.h similarity index 72% rename from rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h rename to rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.h index e737d2551b..e8022c92be 100644 --- a/rosen/modules/render_service/core/transaction/rs_render_service_connection_stub.h +++ b/rosen/modules/render_service/core/transaction/rs_client_to_service_connection_stub.h @@ -13,25 +13,25 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_STUB_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_STUB_H +#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_STUB_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_STUB_H #include #include #include #include -#include "platform/ohos/rs_irender_service_connection.h" +#include "platform/ohos/rs_iclient_to_service_connection.h" #include "platform/ohos/rs_irender_service_connection_ipc_interface_code_access_verifier.h" #include "ipc_security/rs_ipc_interface_code_security_manager.h" #include "rs_render_service_security_utils.h" namespace OHOS { namespace Rosen { -class RSRenderServiceConnectionStub : public IRemoteStub { +class RSClientToServiceConnectionStub : public IRemoteStub { public: - RSRenderServiceConnectionStub() = default; - ~RSRenderServiceConnectionStub() noexcept = default; + RSClientToServiceConnectionStub() = default; + ~RSClientToServiceConnectionStub() noexcept = default; int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; @@ -46,4 +46,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_STUB_H \ No newline at end of file +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_STUB_H \ No newline at end of file diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h b/rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_render_connection.h similarity index 96% rename from rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h rename to rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_render_connection.h index 21b913a3db..fa273e80e2 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_render_connection.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H -#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H +#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_ICLIENT_TO_RENDER_CONNECTION_H +#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_ICLIENT_TO_RENDER_CONNECTION_H #include #include @@ -52,12 +52,12 @@ namespace OHOS { namespace Rosen { -class RSIRenderProcessConnection : public IRemoteBroker { +class RSIClientToRenderConnection : public IRemoteBroker { public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.RenderProcessConnection"); + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.ClientToRenderConnection"); - RSIRenderProcessConnection() = default; - virtual ~RSIRenderProcessConnection() noexcept = default; + RSIClientToRenderConnection() = default; + virtual ~RSIClientToRenderConnection() noexcept = default; virtual bool SendMessage() = 0; @@ -355,4 +355,4 @@ public: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_IRENDER_PROCESS_CONNECTION_H +#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_ICLIENT_TO_RENDER_CONNECTION_H diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h b/rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_service_connection.h similarity index 95% rename from rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h rename to rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_service_connection.h index 5d03bf6335..743d41025f 100644 --- a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_service_connection.h +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_iclient_to_service_connection.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_CONNECTION_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_CONNECTION_H +#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_ICLIENT_TO_SERVICE_CONNECTION_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_ICLIENT_TO_SERVICE_CONNECTION_H #include #include @@ -52,12 +52,12 @@ namespace OHOS { namespace Rosen { -class RSIRenderServiceConnection : public IRemoteBroker { +class RSIClientToServiceConnection : public IRemoteBroker { public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.RenderServiceConnection"); + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.ClientToServiceConnection"); - RSIRenderServiceConnection() = default; - virtual ~RSIRenderServiceConnection() noexcept = default; + RSIClientToServiceConnection() = default; + virtual ~RSIClientToServiceConnection() noexcept = default; virtual ErrCode CommitTransaction(std::unique_ptr& transactionData) = 0; virtual ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) = 0; @@ -258,4 +258,4 @@ public: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_SERVICE_CONNECTION_H +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_ICLIENT_TO_SERVICE_CONNECTION_H diff --git a/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h b/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h index e1fe641e1d..2d70262349 100644 --- a/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h +++ b/rosen/modules/render_service_base/include/transaction/rs_render_service_client.h @@ -512,8 +512,8 @@ private: void TriggerOnAfterAcquireBuffer(const AfterAcquireBufferRet& ret) const; void TriggerTransactionDataCallbackAndErase(uint64_t token, uint64_t timeStamp); - std::shared_ptr GetRenderServiceConnection(); - std::shared_ptr GetRenderProcessConnection(); + std::shared_ptr GetClientToServiceConnection(); + std::shared_ptr GetClientToRenderConnection(); struct RectHash { std::size_t operator()(const Drawing::Rect& rect) const { diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.cpp similarity index 74% rename from rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp rename to rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.cpp index 5ea108851c..77edcb76f1 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_process_connection_proxy.h" +#include "rs_client_to_render_connection_proxy.h" #include #include @@ -36,15 +36,15 @@ static constexpr int RETRY_WAIT_TIME_US = 1000; // wait 1ms before retry SendReq static constexpr int MAX_SECURITY_EXEMPTION_LIST_NUMBER = 1024; // securityExemptionList size not exceed 1024 } -RSRenderProcessConnectionProxy::RSRenderProcessConnectionProxy(const sptr& impl) - : IRemoteProxy(impl) +RSClientToRenderConnectionProxy::RSClientToRenderConnectionProxy(const sptr& impl) + : IRemoteProxy(impl) { } -ErrCode RSRenderProcessConnectionProxy::CommitTransaction(std::unique_ptr& transactionData) +ErrCode RSClientToRenderConnectionProxy::CommitTransaction(std::unique_ptr& transactionData) { if (!transactionData) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CommitTransaction transactionData nullptr!"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CommitTransaction transactionData nullptr!"); return ERR_INVALID_VALUE; } bool isUniMode = RSSystemProperties::GetUniRenderEnabled(); @@ -89,7 +89,7 @@ ErrCode RSRenderProcessConnectionProxy::CommitTransaction(std::unique_ptrGetDataSize()); return ERR_INVALID_VALUE; @@ -99,7 +99,7 @@ ErrCode RSRenderProcessConnectionProxy::CommitTransaction(std::unique_ptr& task) +ErrCode RSClientToRenderConnectionProxy::ExecuteSynchronousTask(const std::shared_ptr& task) { if (task == nullptr) { return ERR_INVALID_VALUE; @@ -108,7 +108,7 @@ ErrCode RSRenderProcessConnectionProxy::ExecuteSynchronousTask(const std::shared MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSRenderProcessConnectionProxy::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSClientToRenderConnectionProxy::GetDescriptor())) { ROSEN_LOGE("ExecuteSynchronousTask WriteInterfaceToken failed"); return ERR_INVALID_VALUE; } @@ -129,7 +129,7 @@ ErrCode RSRenderProcessConnectionProxy::ExecuteSynchronousTask(const std::shared return ERR_OK; } -bool RSRenderProcessConnectionProxy::FillParcelWithTransactionData( +bool RSClientToRenderConnectionProxy::FillParcelWithTransactionData( std::unique_ptr& transactionData, std::shared_ptr& data) { // write a flag at the begin of parcel to identify parcel type @@ -176,7 +176,7 @@ bool RSRenderProcessConnectionProxy::FillParcelWithTransactionData( return true; } -ErrCode RSRenderProcessConnectionProxy::GetUniRenderEnabled(bool& enable) +ErrCode RSClientToRenderConnectionProxy::GetUniRenderEnabled(bool& enable) { MessageParcel data; MessageParcel reply; @@ -189,41 +189,41 @@ ErrCode RSRenderProcessConnectionProxy::GetUniRenderEnabled(bool& enable) return false; } if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetUniRenderEnabled Read enable failed!"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetUniRenderEnabled Read enable failed!"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, +ErrCode RSClientToRenderConnectionProxy::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode: WriteInterfaceToken err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(nodeId)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 NodeId err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode: WriteUint64 NodeId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(displayNodeConfig.mirrorNodeId)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 Config.MirrorNodeId err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode: WriteUint64 Config.MirrorNodeId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(displayNodeConfig.screenId)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteUint64 Config.ScreenId err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode: WriteUint64 Config.ScreenId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteBool(displayNodeConfig.isMirrored)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode: WriteBool Config.IsMirrored err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode: WriteBool Config.IsMirrored err."); success = false; return ERR_INVALID_VALUE; } @@ -236,13 +236,13 @@ ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSDisplayNodeConfig& di } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode Read success failed!"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode Read success failed!"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +ErrCode RSClientToRenderConnectionProxy::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) { MessageParcel data; MessageParcel reply; @@ -267,13 +267,13 @@ ErrCode RSRenderProcessConnectionProxy::CreateNode(const RSSurfaceRenderNodeConf } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNode Read success failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNode Read success failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, +ErrCode RSClientToRenderConnectionProxy::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, bool unobscured) { MessageParcel data; @@ -281,31 +281,31 @@ ErrCode RSRenderProcessConnectionProxy::CreateNodeAndSurface(const RSSurfaceRend MessageOption option; if (!data.WriteUint64(config.id)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint64 config.id err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteUint64 config.id err."); return ERR_INVALID_VALUE; } if (!data.WriteString(config.name)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteString config.name err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteString config.name err."); return ERR_INVALID_VALUE; } if (!data.WriteUint8(static_cast(config.nodeType))) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint8 config.nodeType err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteUint8 config.nodeType err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(config.isTextureExportNode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool config.isTextureExportNode err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteBool config.isTextureExportNode err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(config.isSync)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool config.isSync err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteBool config.isSync err."); return ERR_INVALID_VALUE; } if (!data.WriteUint8(static_cast(config.surfaceWindowType))) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteUint8 config.surfaceWindowType err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteUint8 config.surfaceWindowType err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(unobscured)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreateNodeAndSurface: WriteBool unobscured err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreateNodeAndSurface: WriteBool unobscured err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -323,7 +323,7 @@ ErrCode RSRenderProcessConnectionProxy::CreateNodeAndSurface(const RSSurfaceRend return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetPixelMapByProcessId( +ErrCode RSClientToRenderConnectionProxy::GetPixelMapByProcessId( std::vector& pixelMapInfoVector, pid_t pid, int32_t& repCode) { MessageParcel data; @@ -337,26 +337,26 @@ ErrCode RSRenderProcessConnectionProxy::GetPixelMapByProcessId( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_PIXELMAP_BY_PROCESSID); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Send Request err"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelMapByProcessId: Send Request err"); repCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } if (!reply.ReadInt32(repCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId Read repCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelMapByProcessId Read repCode failed"); return ERR_INVALID_VALUE; } if (repCode == SUCCESS) { pixelMapInfoVector.clear(); if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapInfoVector)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Unmarshalling failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelMapByProcessId: Unmarshalling failed"); } } else { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelMapByProcessId: Invalid reply"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelMapByProcessId: Invalid reply"); } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::CreatePixelMapFromSurface(sptr surface, +ErrCode RSClientToRenderConnectionProxy::CreatePixelMapFromSurface(sptr surface, const Rect &srcRect, std::shared_ptr &pixelMap) { MessageParcel data; @@ -371,8 +371,8 @@ ErrCode RSRenderProcessConnectionProxy::CreatePixelMapFromSurface(sptr return ERR_INVALID_VALUE; } - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("CreatePixelMapFromSurface: WriteInterfaceToken RSIRenderProcessConnection::GetDescriptor() err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("CreatePixelMapFromSurface: WriteInterfaceToken RSIClientToRenderConnection::GetDescriptor() err."); return ERR_INVALID_VALUE; } if (!data.WriteRemoteObject(producer->AsObject())) { @@ -388,7 +388,7 @@ ErrCode RSRenderProcessConnectionProxy::CreatePixelMapFromSurface(sptr uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_PIXEL_MAP_FROM_SURFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::CreatePixelMapFromSurface: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::CreatePixelMapFromSurface: Send Request err."); return ERR_INVALID_VALUE; } @@ -400,48 +400,48 @@ ErrCode RSRenderProcessConnectionProxy::CreatePixelMapFromSurface(sptr return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) +ErrCode RSClientToRenderConnectionProxy::SetFocusAppInfo(const FocusAppInfo& info, int32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteInterfaceToken err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteInt32(info.pid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInt32 pid err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteInt32 pid err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } if (!data.WriteInt32(info.uid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteInt32 uid err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteInt32 uid err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } if (!data.WriteString(info.bundleName)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteString bundleName err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteString bundleName err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } if (!data.WriteString(info.abilityName)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteString abilityName err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteString abilityName err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } if (!data.WriteUint64(info.focusNodeId)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: WriteUint64 focusNodeId err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: WriteUint64 focusNodeId err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FOCUS_APP_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFocusAppInfo: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFocusAppInfo: Send Request err."); repCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; } @@ -449,13 +449,13 @@ ErrCode RSRenderProcessConnectionProxy::SetFocusAppInfo(const FocusAppInfo& info return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) +int32_t RSClientToRenderConnectionProxy::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -472,7 +472,7 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenBlackList(ScreenId id, s uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_BLACKLIST); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenBlackList: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenBlackList: Send Request err."); return RS_CONNECTION_ERROR; } @@ -480,14 +480,14 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenBlackList(ScreenId id, s return status; } -ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList( +ErrCode RSClientToRenderConnectionProxy::SetVirtualScreenTypeBlackList( ScreenId id, std::vector& typeBlackListVector, int32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option(MessageOption::TF_ASYNC); - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenTypeBlackList: WriteInterfaceToken GetDescriptor err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; @@ -506,7 +506,7 @@ ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_TYPE_BLACKLIST); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenTypeBlackList: Send Request err."); return ERR_INVALID_VALUE; } @@ -514,14 +514,14 @@ ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenTypeBlackList( return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::AddVirtualScreenBlackList( +ErrCode RSClientToRenderConnectionProxy::AddVirtualScreenBlackList( ScreenId id, std::vector& blackListVector, int32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("AddVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; @@ -541,7 +541,7 @@ ErrCode RSRenderProcessConnectionProxy::AddVirtualScreenBlackList( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ADD_VIRTUAL_SCREEN_BLACKLIST); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::AddVirtualScreenBlackList: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::AddVirtualScreenBlackList: Send Request err."); return ERR_INVALID_VALUE; } @@ -549,14 +549,14 @@ ErrCode RSRenderProcessConnectionProxy::AddVirtualScreenBlackList( return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList( +ErrCode RSClientToRenderConnectionProxy::RemoveVirtualScreenBlackList( ScreenId id, std::vector& blackListVector, int32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RemoveVirtualScreenBlackList: WriteInterfaceToken GetDescriptor err."); repCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; @@ -576,7 +576,7 @@ ErrCode RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN_BLACKLIST); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RemoveVirtualScreenBlackList: Send Request err."); return ERR_INVALID_VALUE; } @@ -584,19 +584,19 @@ ErrCode RSRenderProcessConnectionProxy::RemoveVirtualScreenBlackList( return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList( +int32_t RSClientToRenderConnectionProxy::SetVirtualScreenSecurityExemptionList( ScreenId id, const std::vector& securityExemptionList) { if (securityExemptionList.size() > MAX_SECURITY_EXEMPTION_LIST_NUMBER) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList: too many lists."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenSecurityExemptionList: too many lists."); return INVALID_ARGUMENTS; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenSecurityExemptionList: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -614,25 +614,25 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList( RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION_LIST); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenSecurityExemptionList: Send Request err."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSecurityExemptionList Read status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenSecurityExemptionList Read status failed"); return READ_PARCEL_ERR; } return status; } -int32_t RSRenderProcessConnectionProxy::SetScreenSecurityMask(ScreenId id, +int32_t RSClientToRenderConnectionProxy::SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenSecurityMask: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -658,20 +658,20 @@ int32_t RSRenderProcessConnectionProxy::SetScreenSecurityMask(ScreenId id, RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_SECURITY_MASK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenSecurityMask: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetScreenSecurityMask: Send Request err."); return RS_CONNECTION_ERROR; } return SUCCESS; } -int32_t RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect( +int32_t RSClientToRenderConnectionProxy::SetMirrorScreenVisibleRect( ScreenId id, const Rect& mainScreenRect, bool supportRotation) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetMirrorScreenVisibleRect: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -694,25 +694,25 @@ int32_t RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect( RSIRenderServiceConnectionInterfaceCode::SET_MIRROR_SCREEN_VISIBLE_RECT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetMirrorScreenVisibleRect: Send Request err."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetMirrorScreenVisibleRect Read status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetMirrorScreenVisibleRect Read status failed"); return READ_PARCEL_ERR; } return status; } -int32_t RSRenderProcessConnectionProxy::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) +int32_t RSClientToRenderConnectionProxy::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetCastScreenEnableSkipWindow: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -729,17 +729,17 @@ int32_t RSRenderProcessConnectionProxy::SetCastScreenEnableSkipWindow(ScreenId i uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CAST_SCREEN_ENABLE_SKIP_WINDOW); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCastScreenEnableSkipWindow: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetCastScreenEnableSkipWindow: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) +int32_t RSClientToRenderConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) { if (surface == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); return INVALID_ARGUMENTS; } @@ -747,7 +747,7 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenSurface: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -765,7 +765,7 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenSurface: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenSurface: Send Request err."); return RS_CONNECTION_ERROR; } @@ -773,12 +773,12 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt return status; } -void RSRenderProcessConnectionProxy::RemoveVirtualScreen(ScreenId id) +void RSClientToRenderConnectionProxy::RemoveVirtualScreen(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RemoveVirtualScreen: WriteInterfaceToken GetDescriptor err."); return; } @@ -791,19 +791,19 @@ void RSRenderProcessConnectionProxy::RemoveVirtualScreen(ScreenId id) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RemoveVirtualScreen: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RemoveVirtualScreen: Send Request err."); return; } } #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR -int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionConfig(float darkBuffer, +int32_t RSClientToRenderConnectionProxy::SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, int64_t interval, int32_t rangeSize) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetPointerColorInversionConfig: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -827,19 +827,19 @@ int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionConfig(float dar uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_CONFIG); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPointerColorInversionConfig: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetPointerColorInversionConfig: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionEnabled(bool enable) +int32_t RSClientToRenderConnectionProxy::SetPointerColorInversionEnabled(bool enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetPointerColorInversionEnabled: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -851,18 +851,18 @@ int32_t RSRenderProcessConnectionProxy::SetPointerColorInversionEnabled(bool ena uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_POINTER_COLOR_INVERSION_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::DisableCursorInvert: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::DisableCursorInvert: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -int32_t RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback( +int32_t RSClientToRenderConnectionProxy::RegisterPointerLuminanceChangeCallback( sptr callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterPointerLuminanceChangeCallback: callback is nullptr."); return INVALID_ARGUMENTS; } @@ -870,7 +870,7 @@ int32_t RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -883,19 +883,19 @@ int32_t RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_POINTER_LUMINANCE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterPointerLuminanceChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterPointerLuminanceChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -int32_t RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback() +int32_t RSClientToRenderConnectionProxy::UnRegisterPointerLuminanceChangeCallback() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("UnRegisterPointerLuminanceChangeCallback: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -904,7 +904,7 @@ int32_t RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback RSIRenderServiceConnectionInterfaceCode::UNREGISTER_POINTER_LUMINANCE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::UnRegisterPointerLuminanceChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); @@ -912,13 +912,13 @@ int32_t RSRenderProcessConnectionProxy::UnRegisterPointerLuminanceChangeCallback } #endif -void RSRenderProcessConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) +void RSClientToRenderConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); return; } @@ -938,14 +938,14 @@ void RSRenderProcessConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t m } } -void RSRenderProcessConnectionProxy::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, +void RSClientToRenderConnectionProxy::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, int32_t animatorExpectedFrameRate) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SyncFrameRateRange: WriteInterfaceToken GetDescriptor err."); return; } @@ -968,17 +968,17 @@ void RSRenderProcessConnectionProxy::SyncFrameRateRange(FrameRateLinkerId id, co uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SYNC_FRAME_RATE_RANGE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy sendrequest error : %{public}d", err); return; } } -void RSRenderProcessConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) +void RSClientToRenderConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("UnregisterFrameRateLinker: WriteInterfaceToken GetDescriptor err."); return; } @@ -991,18 +991,18 @@ void RSRenderProcessConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy sendrequest error : %{public}d", err); return; } } -ErrCode RSRenderProcessConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) +ErrCode RSClientToRenderConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetRefreshInfo: WriteInterfaceToken GetDescriptor err."); enable = ""; return ERR_INVALID_VALUE; @@ -1016,25 +1016,25 @@ ErrCode RSRenderProcessConnectionProxy::GetRefreshInfo(pid_t pid, std::string& e uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy sendrequest error : %{public}d", err); enable = ""; return ERR_INVALID_VALUE; } if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetRefreshInfo Read enable failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetRefreshInfo Read enable failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) +ErrCode RSClientToRenderConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetRefreshInfoToSP: WriteInterfaceToken GetDescriptor err."); enable = ""; return ERR_INVALID_VALUE; @@ -1048,19 +1048,19 @@ ErrCode RSRenderProcessConnectionProxy::GetRefreshInfoToSP(NodeId id, std::strin uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy sendrequest error : %{public}d", err); enable = ""; return ERR_INVALID_VALUE; } if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetRefreshInfo Read enable failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetRefreshInfo Read enable failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; @@ -1083,24 +1083,24 @@ int32_t RSRenderProcessConnectionProxy::SetPhysicalScreenResolution(ScreenId id, } auto code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION); if (SendRequest(code, data, reply, option) != ERR_NONE) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPhysicalScreenResolution Read status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetPhysicalScreenResolution Read status failed"); return READ_PARCEL_ERR; } return status; } -int32_t RSRenderProcessConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -1120,25 +1120,25 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenResolution: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenResolution: Send Request err."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenResolution Read status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenResolution Read status failed"); return READ_PARCEL_ERR; } return status; } -ErrCode RSRenderProcessConnectionProxy::MarkPowerOffNeedProcessOneFrame() +ErrCode RSClientToRenderConnectionProxy::MarkPowerOffNeedProcessOneFrame() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::MarkPowerOffNeedProcessOneFrame: Send Request err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::MarkPowerOffNeedProcessOneFrame: Send Request err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -1148,14 +1148,14 @@ ErrCode RSRenderProcessConnectionProxy::MarkPowerOffNeedProcessOneFrame() return err != NO_ERROR ? ERR_INVALID_VALUE : ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::RepaintEverything() +ErrCode RSClientToRenderConnectionProxy::RepaintEverything() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RepaintEverything: Send Request err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::RepaintEverything: Send Request err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -1168,14 +1168,14 @@ ErrCode RSRenderProcessConnectionProxy::RepaintEverything() return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::ForceRefreshOneFrameWithNextVSync() +ErrCode RSClientToRenderConnectionProxy::ForceRefreshOneFrameWithNextVSync() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ForceRefreshOneFrameWithNextVSync: Send Request err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::ForceRefreshOneFrameWithNextVSync: Send Request err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -1188,13 +1188,13 @@ ErrCode RSRenderProcessConnectionProxy::ForceRefreshOneFrameWithNextVSync() return ERR_OK; } -void RSRenderProcessConnectionProxy::DisablePowerOffRenderControl(ScreenId id) +void RSClientToRenderConnectionProxy::DisablePowerOffRenderControl(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("DisablePowerOffRenderControl: WriteInterfaceToken GetDescriptor err."); return; } @@ -1210,7 +1210,7 @@ void RSRenderProcessConnectionProxy::DisablePowerOffRenderControl(ScreenId id) } } -ErrCode RSRenderProcessConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) +ErrCode RSClientToRenderConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) { if (app == nullptr) { ROSEN_LOGE("%{public}s callback == nullptr", __func__); @@ -1234,7 +1234,7 @@ ErrCode RSRenderProcessConnectionProxy::RegisterApplicationAgent(uint32_t pid, s return ERR_OK; } -void RSRenderProcessConnectionProxy::TakeSurfaceCapture(NodeId id, sptr callback, +void RSClientToRenderConnectionProxy::TakeSurfaceCapture(NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam, const Drawing::Rect& specifiedAreaRect, RSSurfaceCapturePermissions /* permissions */) { @@ -1276,7 +1276,7 @@ void RSRenderProcessConnectionProxy::TakeSurfaceCapture(NodeId id, sptr>> RSRenderProcessConnectionProxy::TakeSurfaceCaptureSoloNode( +std::vector>> RSClientToRenderConnectionProxy::TakeSurfaceCaptureSoloNode( NodeId id, const RSSurfaceCaptureConfig& captureConfig, RSSurfaceCapturePermissions) { MessageParcel data; @@ -1299,12 +1299,12 @@ std::vector>> RSRenderProcess return pixelMapIdPairVector; } if (!RSMarshallingHelper::Unmarshalling(reply, pixelMapIdPairVector)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::TakeSurfaceCaptureSoloNode Unmarshalling failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::TakeSurfaceCaptureSoloNode Unmarshalling failed"); } return pixelMapIdPairVector; } -void RSRenderProcessConnectionProxy::TakeSelfSurfaceCapture(NodeId id, sptr callback, +void RSClientToRenderConnectionProxy::TakeSelfSurfaceCapture(NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) { if (callback == nullptr) { @@ -1336,7 +1336,7 @@ void RSRenderProcessConnectionProxy::TakeSelfSurfaceCapture(NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) { @@ -1380,7 +1380,7 @@ ErrCode RSRenderProcessConnectionProxy::SetWindowFreezeImmediately(NodeId id, bo return ERR_OK; } -void RSRenderProcessConnectionProxy::TakeUICaptureInRange( +void RSClientToRenderConnectionProxy::TakeUICaptureInRange( NodeId id, sptr callback, const RSSurfaceCaptureConfig& captureConfig) { if (callback == nullptr) { @@ -1412,7 +1412,7 @@ void RSRenderProcessConnectionProxy::TakeUICaptureInRange( } } -bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureConfig( +bool RSClientToRenderConnectionProxy::WriteSurfaceCaptureConfig( const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) { if (!data.WriteFloat(captureConfig.scaleX) || !data.WriteFloat(captureConfig.scaleY) || @@ -1437,7 +1437,7 @@ bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureConfig( return true; } -bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureBlurParam( +bool RSClientToRenderConnectionProxy::WriteSurfaceCaptureBlurParam( const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) { if (!data.WriteBool(blurParam.isNeedBlur) || !data.WriteFloat(blurParam.blurRadius)) { @@ -1447,7 +1447,7 @@ bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureBlurParam( return true; } -bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureAreaRect( +bool RSClientToRenderConnectionProxy::WriteSurfaceCaptureAreaRect( const Drawing::Rect& specifiedAreaRect, MessageParcel& data) { if (!data.WriteFloat(specifiedAreaRect.left_) || !data.WriteFloat(specifiedAreaRect.top_) || @@ -1458,7 +1458,7 @@ bool RSRenderProcessConnectionProxy::WriteSurfaceCaptureAreaRect( return true; } -ErrCode RSRenderProcessConnectionProxy::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, +ErrCode RSClientToRenderConnectionProxy::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, float positionZ, float positionW) { MessageParcel data; @@ -1483,14 +1483,14 @@ ErrCode RSRenderProcessConnectionProxy::SetHwcNodeBounds(int64_t rsNodeId, float return ERR_OK; } -RSVirtualScreenResolution RSRenderProcessConnectionProxy::GetVirtualScreenResolution(ScreenId id) +RSVirtualScreenResolution RSClientToRenderConnectionProxy::GetVirtualScreenResolution(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; RSVirtualScreenResolution virtualScreenResolution; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); return virtualScreenResolution; } @@ -1513,13 +1513,13 @@ RSVirtualScreenResolution RSRenderProcessConnectionProxy::GetVirtualScreenResolu return virtualScreenResolution; } -ErrCode RSRenderProcessConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) +ErrCode RSClientToRenderConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1544,13 +1544,13 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenActiveMode(uint64_t id, RSScree return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) +ErrCode RSClientToRenderConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetMemoryGraphics: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1564,13 +1564,13 @@ ErrCode RSRenderProcessConnectionProxy::GetMemoryGraphics(std::vector(count); if (len > readableSize || len > memoryGraphics.max_size()) { - RS_LOGE("RSRenderProcessConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," + RS_LOGE("RSClientToRenderConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," " readableSize:%{public}zu", len, readableSize); return ERR_INVALID_VALUE; } @@ -1586,13 +1586,13 @@ ErrCode RSRenderProcessConnectionProxy::GetMemoryGraphics(std::vector callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferClearListener: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterBufferClearListener: callback is nullptr."); return ERR_INVALID_VALUE; } @@ -1651,7 +1651,7 @@ ErrCode RSRenderProcessConnectionProxy::RegisterBufferClearListener( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterBufferClearListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1667,17 +1667,17 @@ ErrCode RSRenderProcessConnectionProxy::RegisterBufferClearListener( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferClearListener: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterBufferClearListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::RegisterBufferAvailableListener( +ErrCode RSClientToRenderConnectionProxy::RegisterBufferAvailableListener( NodeId id, sptr callback, bool isFromRenderThread) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); return ERR_INVALID_VALUE; } @@ -1685,7 +1685,7 @@ ErrCode RSRenderProcessConnectionProxy::RegisterBufferAvailableListener( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterBufferAvailableListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1706,18 +1706,18 @@ ErrCode RSRenderProcessConnectionProxy::RegisterBufferAvailableListener( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterBufferAvailableListener: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterBufferAvailableListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) +int32_t RSClientToRenderConnectionProxy::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenHDRCapability: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1733,7 +1733,7 @@ int32_t RSRenderProcessConnectionProxy::GetScreenHDRCapability(ScreenId id, RSSc } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRCapability Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRCapability Read result failed"); return READ_PARCEL_ERR; } if (result != SUCCESS) { @@ -1747,13 +1747,13 @@ int32_t RSRenderProcessConnectionProxy::GetScreenHDRCapability(ScreenId id, RSSc return SUCCESS; } -ErrCode RSRenderProcessConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); resCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; @@ -1771,13 +1771,13 @@ ErrCode RSRenderProcessConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixel return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelFormat Read resCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelFormat Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { uint32_t readFormat{0}; if (!reply.ReadUint32(readFormat)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetPixelFormat Read readFormat failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetPixelFormat Read readFormat failed"); return READ_PARCEL_ERR; } pixelFormat = static_cast(readFormat); @@ -1785,13 +1785,13 @@ ErrCode RSRenderProcessConnectionProxy::GetPixelFormat(ScreenId id, GraphicPixel return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetPixelFormat: WriteInterfaceToken GetDescriptor err."); resCode = WRITE_PARCEL_ERR; return ERR_INVALID_VALUE; @@ -1817,13 +1817,13 @@ ErrCode RSRenderProcessConnectionProxy::SetPixelFormat(ScreenId id, GraphicPixel return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats( +ErrCode RSClientToRenderConnectionProxy::GetScreenSupportedHDRFormats( ScreenId id, std::vector& hdrFormats, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedHDRFormats: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1841,7 +1841,7 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats( return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats Read resCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenSupportedHDRFormats Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { @@ -1854,12 +1854,12 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedHDRFormats( return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1877,13 +1877,13 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHD return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRFormat Read resCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRFormat Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { uint32_t readFormat{0}; if (!reply.ReadUint32(readFormat)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRFormat1 Read readFormat failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRFormat1 Read readFormat failed"); return READ_PARCEL_ERR; } hdrFormat = static_cast(readFormat); @@ -1891,12 +1891,12 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenHDRFormat(ScreenId id, ScreenHD return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::SetScreenHDRFormat(ScreenId id, int32_t modeIdx, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenHDRFormat: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1922,34 +1922,34 @@ ErrCode RSRenderProcessConnectionProxy::SetScreenHDRFormat(ScreenId id, int32_t return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); return WRITE_PARCEL_ERR; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); return RS_CONNECTION_ERROR; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus Read resCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRStatus Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { uint32_t readHdrStatus{0}; if (!reply.ReadUint32(readHdrStatus)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenHDRStatus Read HDR status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenHDRStatus Read HDR status failed"); return READ_PARCEL_ERR; } hdrStatus = static_cast(readHdrStatus); @@ -1957,13 +1957,13 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatu return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces( +ErrCode RSClientToRenderConnectionProxy::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1981,7 +1981,7 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces( return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { @@ -1994,12 +1994,12 @@ ErrCode RSRenderProcessConnectionProxy::GetScreenSupportedColorSpaces( return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +ErrCode RSClientToRenderConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetBitmap: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -2018,11 +2018,11 @@ ErrCode RSRenderProcessConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bi } bool result{false}; if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBitmap Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetBitmap Read result failed"); return READ_PARCEL_ERR; } if (!result || !RSMarshallingHelper::Unmarshalling(reply, bitmap)) { - RS_LOGE("RSRenderProcessConnectionProxy::GetBitmap: Unmarshalling failed"); + RS_LOGE("RSClientToRenderConnectionProxy::GetBitmap: Unmarshalling failed"); success = false; return ERR_INVALID_VALUE; } @@ -2030,12 +2030,12 @@ ErrCode RSRenderProcessConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bi return ERR_OK; } -bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) +bool RSClientToRenderConnectionProxy::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualMirrorScreenCanvasRotation: WriteInterfaceToken GetDescriptor err."); return false; } @@ -2056,18 +2056,18 @@ bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenCanvasRotation(Screen } bool result{false}; if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualMirrorScreenCanvasRotation Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualMirrorScreenCanvasRotation Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) +int32_t RSClientToRenderConnectionProxy::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenAutoRotation: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2083,23 +2083,23 @@ int32_t RSRenderProcessConnectionProxy::SetVirtualScreenAutoRotation(ScreenId id uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_AUTO_ROTATION); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::%{public}s: Send Request err.", __func__); + ROSEN_LOGE("RSClientToRenderConnectionProxy::%{public}s: Send Request err.", __func__); return RS_CONNECTION_ERROR; } int32_t result{-1}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::%{public}s Read result failed", __func__); + ROSEN_LOGE("RSClientToRenderConnectionProxy::%{public}s Read result failed", __func__); return READ_PARCEL_ERR; } return result; } -bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) +bool RSClientToRenderConnectionProxy::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualMirrorScreenScaleMode: WriteInterfaceToken GetDescriptor err."); return false; } @@ -2120,18 +2120,18 @@ bool RSRenderProcessConnectionProxy::SetVirtualMirrorScreenScaleMode(ScreenId id } bool result{false}; if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualMirrorScreenScaleMode Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualMirrorScreenScaleMode Read result failed"); return READ_PARCEL_ERR; } return result; } -ErrCode RSRenderProcessConnectionProxy::SetGlobalDarkColorMode(bool isDark) +ErrCode RSClientToRenderConnectionProxy::SetGlobalDarkColorMode(bool isDark) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetGlobalDarkColorMode: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2149,13 +2149,13 @@ ErrCode RSRenderProcessConnectionProxy::SetGlobalDarkColorMode(bool isDark) return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, +ErrCode RSClientToRenderConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetPixelmap: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -2181,11 +2181,11 @@ ErrCode RSRenderProcessConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr& typeface) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterTypeface: WriteInterfaceToken GetDescriptor err."); return false; } @@ -2232,23 +2232,23 @@ bool RSRenderProcessConnectionProxy::RegisterTypeface(uint64_t globalUniqueId, uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REGISTER_TYPEFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - RS_LOGD("RSRenderProcessConnectionProxy::RegisterTypeface: RegisterTypeface failed"); + RS_LOGD("RSClientToRenderConnectionProxy::RegisterTypeface: RegisterTypeface failed"); return false; } bool result{false}; if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTypeface Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTypeface Read result failed"); return READ_PARCEL_ERR; } return result; } -bool RSRenderProcessConnectionProxy::UnRegisterTypeface(uint64_t globalUniqueId) +bool RSClientToRenderConnectionProxy::UnRegisterTypeface(uint64_t globalUniqueId) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("UnRegisterTypeface: WriteInterfaceToken GetDescriptor err."); return false; } @@ -2260,20 +2260,20 @@ bool RSRenderProcessConnectionProxy::UnRegisterTypeface(uint64_t globalUniqueId) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_TYPEFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - RS_LOGD("RSRenderProcessConnectionProxy::UnRegisterTypeface: send request failed"); + RS_LOGD("RSClientToRenderConnectionProxy::UnRegisterTypeface: send request failed"); return false; } return true; } -ErrCode RSRenderProcessConnectionProxy::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, +ErrCode RSClientToRenderConnectionProxy::SetScreenSkipFrameInterval(uint64_t id, uint32_t skipFrameInterval, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenSkipFrameInterval: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -2296,20 +2296,20 @@ ErrCode RSRenderProcessConnectionProxy::SetScreenSkipFrameInterval(uint64_t id, return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetPixelFormat Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetPixelFormat Read result failed"); resCode = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate( +ErrCode RSClientToRenderConnectionProxy::SetVirtualScreenRefreshRate( ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate, int32_t& retVal) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); retVal = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -2333,13 +2333,13 @@ ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate( } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenRefreshRate Read result failed"); retVal = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } if (result == SUCCESS) { if (!reply.ReadUint32(actualRefreshRate)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate Read actualRefreshRate failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenRefreshRate Read actualRefreshRate failed"); retVal = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } @@ -2348,12 +2348,12 @@ ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenRefreshRate( return ERR_OK; } -void RSRenderProcessConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) +void RSClientToRenderConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); return; } @@ -2369,12 +2369,12 @@ void RSRenderProcessConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSet } } -void RSRenderProcessConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) +void RSClientToRenderConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); return; } @@ -2391,18 +2391,18 @@ void RSRenderProcessConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t } } -ErrCode RSRenderProcessConnectionProxy::RegisterOcclusionChangeCallback( +ErrCode RSClientToRenderConnectionProxy::RegisterOcclusionChangeCallback( sptr callback, int32_t& repCode) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterOcclusionChangeCallback: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterOcclusionChangeCallback: callback is nullptr."); repCode = INVALID_ARGUMENTS; return ERR_INVALID_VALUE; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); repCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -2423,18 +2423,18 @@ ErrCode RSRenderProcessConnectionProxy::RegisterOcclusionChangeCallback( return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::RegisterSurfaceOcclusionChangeCallback( +int32_t RSClientToRenderConnectionProxy::RegisterSurfaceOcclusionChangeCallback( NodeId id, sptr callback, std::vector& partitionPoints) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceOcclusionChangeCallback: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceOcclusionChangeCallback: callback is nullptr."); return INVALID_ARGUMENTS; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2460,18 +2460,18 @@ int32_t RSRenderProcessConnectionProxy::RegisterSurfaceOcclusionChangeCallback( } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenHDRFormat Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetScreenHDRFormat Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) +int32_t RSClientToRenderConnectionProxy::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("UnRegisterSurfaceOcclusionChangeCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2489,18 +2489,18 @@ int32_t RSRenderProcessConnectionProxy::UnRegisterSurfaceOcclusionChangeCallback } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetScreenColorSpace Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetScreenColorSpace Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback(sptr callback) +int32_t RSClientToRenderConnectionProxy::RegisterHgmConfigChangeCallback(sptr callback) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterHgmConfigChangeCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2512,24 +2512,24 @@ int32_t RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback(sptr(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmConfigChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmConfigChangeCallback Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmConfigChangeCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback( +int32_t RSClientToRenderConnectionProxy::RegisterHgmRefreshRateModeChangeCallback( sptr callback) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterHgmRefreshRateModeChangeCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2541,24 +2541,24 @@ int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateUpdateCallback( +int32_t RSClientToRenderConnectionProxy::RegisterHgmRefreshRateUpdateCallback( sptr callback) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterHgmRefreshRateUpdateCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2581,24 +2581,24 @@ int32_t RSRenderProcessConnectionProxy::RegisterHgmRefreshRateUpdateCallback( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_UPDATE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmRefreshRateModeChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterHgmRefreshRateModeChangeCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::RegisterFirstFrameCommitCallback( +int32_t RSClientToRenderConnectionProxy::RegisterFirstFrameCommitCallback( sptr callback) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterFirstFrameCommitCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2621,21 +2621,21 @@ int32_t RSRenderProcessConnectionProxy::RegisterFirstFrameCommitCallback( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::ON_FIRST_FRAME_COMMIT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterFirstFrameCommitCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterFirstFrameCommitCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStart( +ErrCode RSClientToRenderConnectionProxy::AvcodecVideoStart( uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("AvcodecVideoStart: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2659,24 +2659,24 @@ ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStart( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStart: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::AvcodecVideoStart: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStart Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::AvcodecVideoStart Read result failed"); return READ_PARCEL_ERR; } return result; } -ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +ErrCode RSClientToRenderConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("AvcodecVideoStop: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2696,25 +2696,25 @@ ErrCode RSRenderProcessConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std: uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStop: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::AvcodecVideoStop: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::AvcodecVideoStop Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::AvcodecVideoStop Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, +int32_t RSClientToRenderConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback(int32_t dstPid, sptr callback) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterFrameRateLinkerExpectedFpsUpdateCallback: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -2739,25 +2739,25 @@ int32_t RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdate RSIRenderServiceConnectionInterfaceCode::REGISTER_FRAME_RATE_LINKER_EXPECTED_FPS_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback: " + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback: " "Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { ROSEN_LOGE( - "RSRenderProcessConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback Read result failed"); + "RSClientToRenderConnectionProxy::RegisterFrameRateLinkerExpectedFpsUpdateCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -ErrCode RSRenderProcessConnectionProxy::SetAppWindowNum(uint32_t num) +ErrCode RSClientToRenderConnectionProxy::SetAppWindowNum(uint32_t num) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetAppWindowNum: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2769,20 +2769,20 @@ ErrCode RSRenderProcessConnectionProxy::SetAppWindowNum(uint32_t num) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_APP_WINDOW_NUM); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetAppWindowNum: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetAppWindowNum: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetSystemAnimatedScenes( +ErrCode RSClientToRenderConnectionProxy::SetSystemAnimatedScenes( SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetSystemAnimatedScenes: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -2806,20 +2806,20 @@ ErrCode RSRenderProcessConnectionProxy::SetSystemAnimatedScenes( return ERR_INVALID_VALUE; } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetSystemAnimatedScenes Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetSystemAnimatedScenes Read result failed"); success = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetWatermark(const std::string& name, +ErrCode RSClientToRenderConnectionProxy::SetWatermark(const std::string& name, std::shared_ptr watermark, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetWatermark: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -2838,7 +2838,7 @@ ErrCode RSRenderProcessConnectionProxy::SetWatermark(const std::string& name, uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WATERMARK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWatermark: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetWatermark: Send Request err."); success = false; return ERR_INVALID_VALUE; } @@ -2846,16 +2846,16 @@ ErrCode RSRenderProcessConnectionProxy::SetWatermark(const std::string& name, return ERR_OK; } -void RSRenderProcessConnectionProxy::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) +void RSClientToRenderConnectionProxy::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) { if (watermarkImg == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ShowWatermark: watermarkImg is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ShowWatermark: watermarkImg is nullptr."); return; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ShowWatermark: WriteInterfaceToken GetDescriptor err."); return; } @@ -2871,18 +2871,18 @@ void RSRenderProcessConnectionProxy::ShowWatermark(const std::shared_ptr(RSIRenderServiceConnectionInterfaceCode::SHOW_WATERMARK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ShowWatermark: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ShowWatermark: Send Request err."); return; } } -int32_t RSRenderProcessConnectionProxy::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToRenderConnectionProxy::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ResizeVirtualScreen: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -2902,23 +2902,23 @@ int32_t RSRenderProcessConnectionProxy::ResizeVirtualScreen(ScreenId id, uint32_ uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::RESIZE_VIRTUAL_SCREEN); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ResizeVirtualScreen: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ResizeVirtualScreen: Send Request err."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ResizeVirtualScreen Read status failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ResizeVirtualScreen Read status failed"); return READ_PARCEL_ERR; } return status; } -ErrCode RSRenderProcessConnectionProxy::ReportJankStats() +ErrCode RSClientToRenderConnectionProxy::ReportJankStats() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportJankStats: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2926,18 +2926,18 @@ ErrCode RSRenderProcessConnectionProxy::ReportJankStats() uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_JANK_STATS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportJankStats: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportJankStats: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::ReportEventResponse(DataBaseRs info) +ErrCode RSClientToRenderConnectionProxy::ReportEventResponse(DataBaseRs info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportEventResponse: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2945,18 +2945,18 @@ ErrCode RSRenderProcessConnectionProxy::ReportEventResponse(DataBaseRs info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_RESPONSE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventResponse: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportEventResponse: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::ReportEventComplete(DataBaseRs info) +ErrCode RSClientToRenderConnectionProxy::ReportEventComplete(DataBaseRs info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportEventComplete: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2964,18 +2964,18 @@ ErrCode RSRenderProcessConnectionProxy::ReportEventComplete(DataBaseRs info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_COMPLETE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventComplete: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportEventComplete: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::ReportEventJankFrame(DataBaseRs info) +ErrCode RSClientToRenderConnectionProxy::ReportEventJankFrame(DataBaseRs info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportEventJankFrame: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2983,18 +2983,18 @@ ErrCode RSRenderProcessConnectionProxy::ReportEventJankFrame(DataBaseRs info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_JANK_FRAME); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportEventJankFrame: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportEventJankFrame: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderProcessConnectionProxy::ReportRsSceneJankStart(AppInfo info) +void RSClientToRenderConnectionProxy::ReportRsSceneJankStart(AppInfo info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportRsSceneJankStart: WriteInterfaceToken GetDescriptor err."); return; } @@ -3002,17 +3002,17 @@ void RSRenderProcessConnectionProxy::ReportRsSceneJankStart(AppInfo info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_START); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportRsSceneJankStart: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportRsSceneJankStart: Send Request err."); return; } } -void RSRenderProcessConnectionProxy::ReportRsSceneJankEnd(AppInfo info) +void RSClientToRenderConnectionProxy::ReportRsSceneJankEnd(AppInfo info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportRsSceneJankEnd: WriteInterfaceToken GetDescriptor err."); return; } @@ -3020,12 +3020,12 @@ void RSRenderProcessConnectionProxy::ReportRsSceneJankEnd(AppInfo info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_RS_SCENE_JANK_END); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportRsSceneJankEnd: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportRsSceneJankEnd: Send Request err."); return; } } -void RSRenderProcessConnectionProxy::ReportDataBaseRs( +void RSClientToRenderConnectionProxy::ReportDataBaseRs( MessageParcel& data, MessageParcel& reply, MessageOption& option, DataBaseRs info) { if (!data.WriteInt32(info.appPid)) { @@ -3091,7 +3091,7 @@ void RSRenderProcessConnectionProxy::ReportDataBaseRs( option.SetFlags(MessageOption::TF_ASYNC); } -void RSRenderProcessConnectionProxy::WriteAppInfo( +void RSClientToRenderConnectionProxy::WriteAppInfo( MessageParcel& data, MessageParcel& reply, MessageOption& option, AppInfo info) { if (!data.WriteInt64(info.startTime)) { @@ -3125,7 +3125,7 @@ void RSRenderProcessConnectionProxy::WriteAppInfo( option.SetFlags(MessageOption::TF_ASYNC); } -void RSRenderProcessConnectionProxy::ReportGameStateDataRs( +void RSClientToRenderConnectionProxy::ReportGameStateDataRs( MessageParcel& data, MessageParcel& reply, MessageOption& option, GameStateData info) { if (!data.WriteInt32(info.pid)) { @@ -3151,12 +3151,12 @@ void RSRenderProcessConnectionProxy::ReportGameStateDataRs( option.SetFlags(MessageOption::TF_ASYNC); } -ErrCode RSRenderProcessConnectionProxy::ReportGameStateData(GameStateData info) +ErrCode RSClientToRenderConnectionProxy::ReportGameStateData(GameStateData info) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("ReportGameStateData: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3164,19 +3164,19 @@ ErrCode RSRenderProcessConnectionProxy::ReportGameStateData(GameStateData info) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REPORT_EVENT_GAMESTATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ReportGameStateData: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ReportGameStateData: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, +ErrCode RSClientToRenderConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetHardwareEnabled: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3200,18 +3200,18 @@ ErrCode RSRenderProcessConnectionProxy::SetHardwareEnabled(NodeId id, bool isEna uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetHardwareEnabled: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetHardwareEnabled: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +ErrCode RSClientToRenderConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetHidePrivacyContent: WriteInterfaceToken GetDescriptor err."); resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); return ERR_INVALID_VALUE; @@ -3230,7 +3230,7 @@ ErrCode RSRenderProcessConnectionProxy::SetHidePrivacyContent(NodeId id, bool ne uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetHidePrivacyContent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetHidePrivacyContent: Send Request err."); resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); return ERR_INVALID_VALUE; } @@ -3238,12 +3238,12 @@ ErrCode RSRenderProcessConnectionProxy::SetHidePrivacyContent(NodeId id, bool ne return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::NotifyLightFactorStatus(int32_t lightFactorStatus) +ErrCode RSClientToRenderConnectionProxy::NotifyLightFactorStatus(int32_t lightFactorStatus) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifyLightFactorStatus: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3255,18 +3255,18 @@ ErrCode RSRenderProcessConnectionProxy::NotifyLightFactorStatus(int32_t lightFac uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_LIGHT_FACTOR_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyLightFactorStatus: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyLightFactorStatus: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderProcessConnectionProxy::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) +void RSClientToRenderConnectionProxy::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifyPackageEvent: WriteInterfaceToken GetDescriptor err."); return; } @@ -3288,18 +3288,18 @@ void RSRenderProcessConnectionProxy::NotifyPackageEvent(uint32_t listSize, const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PACKAGE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyPackageEvent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyPackageEvent: Send Request err."); return; } } -void RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, +void RSClientToRenderConnectionProxy::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, const std::vector>& newConfig) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { return; } @@ -3310,13 +3310,13 @@ void RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent(const st if (!data.WriteString(pkgName) || !data.WriteUint32(listSize)) { ROSEN_LOGE( - "RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent Write pakName or listSize failed."); + "RSClientToRenderConnectionProxy::NotifyAppStrategyConfigChangeEvent Write pakName or listSize failed."); return; } for (const auto& [key, value] : newConfig) { if (!data.WriteString(key) || !data.WriteString(value)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent Write key or value failed."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyAppStrategyConfigChangeEvent Write key or value failed."); return; } } @@ -3325,17 +3325,17 @@ void RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent(const st RSIRenderServiceConnectionInterfaceCode::NOTIFY_APP_STRATEGY_CONFIG_CHANGE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyAppStrategyConfigChangeEvent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyAppStrategyConfigChangeEvent: Send Request err."); return; } } -ErrCode RSRenderProcessConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +ErrCode RSClientToRenderConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifySoftVsyncEvent: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3351,19 +3351,19 @@ ErrCode RSRenderProcessConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint3 uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncEvent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifySoftVsyncEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -bool RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, +bool RSClientToRenderConnectionProxy::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifySoftVsyncRateDiscountEvent: WriteInterfaceToken GetDescriptor err."); return false; } @@ -3384,23 +3384,23 @@ bool RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent(uint32_t p RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_RATE_DISCOUNT_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifySoftVsyncRateDiscountEvent: Send Request err."); return false; } bool enable{false}; if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifySoftVsyncRateDiscountEvent: Read enable failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifySoftVsyncRateDiscountEvent: Read enable failed"); return false; } return enable; } -ErrCode RSRenderProcessConnectionProxy::NotifyHgmConfigEvent(const std::string &eventName, bool state) +ErrCode RSClientToRenderConnectionProxy::NotifyHgmConfigEvent(const std::string &eventName, bool state) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifyHgmConfigEvent: GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3414,19 +3414,19 @@ ErrCode RSRenderProcessConnectionProxy::NotifyHgmConfigEvent(const std::string & uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_HGMCONFIG_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyHgmConfigEvent: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyHgmConfigEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::NotifyXComponentExpectedFrameRate( +ErrCode RSClientToRenderConnectionProxy::NotifyXComponentExpectedFrameRate( const std::string& id, int32_t expectedFrameRate) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("NotifyXComponentExpectedFrameRate: GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3441,18 +3441,18 @@ ErrCode RSRenderProcessConnectionProxy::NotifyXComponentExpectedFrameRate( RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetCacheEnabledForRotation(bool isEnabled) +ErrCode RSClientToRenderConnectionProxy::SetCacheEnabledForRotation(bool isEnabled) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetCacheEnabledForRotation: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3464,31 +3464,31 @@ ErrCode RSRenderProcessConnectionProxy::SetCacheEnabledForRotation(bool isEnable uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCacheEnabledForRotation: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetCacheEnabledForRotation: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderProcessConnectionProxy::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) +void RSClientToRenderConnectionProxy::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) { OnRemoteDiedCallback_ = callback; } -void RSRenderProcessConnectionProxy::RunOnRemoteDiedCallback() +void RSClientToRenderConnectionProxy::RunOnRemoteDiedCallback() { if (OnRemoteDiedCallback_) { OnRemoteDiedCallback_(); } } -std::vector RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo() +std::vector RSClientToRenderConnectionProxy::GetActiveDirtyRegionInfo() { MessageParcel data; MessageParcel reply; MessageOption option; std::vector activeDirtyRegionInfos; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetActiveDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); return activeDirtyRegionInfos; } @@ -3496,12 +3496,12 @@ std::vector RSRenderProcessConnectionProxy::GetActiveDirt uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetActiveDirtyRegionInfo: Send Request err."); return activeDirtyRegionInfos; } int32_t activeDirtyRegionInfosSize{0}; if (!reply.ReadInt32(activeDirtyRegionInfosSize)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo Read activeDirtyRegionInfosSize failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetActiveDirtyRegionInfo Read activeDirtyRegionInfosSize failed"); return activeDirtyRegionInfos; } while (activeDirtyRegionInfosSize--) { @@ -3512,7 +3512,7 @@ std::vector RSRenderProcessConnectionProxy::GetActiveDirt if (!reply.ReadInt64(activeDirtyRegionArea) || !reply.ReadInt32(activeFramesNumber) || !reply.ReadInt32(pidOfBelongsApp) || !reply.ReadString(windowName)) { ROSEN_LOGE( - "RSRenderProcessConnectionProxy::GetActiveDirtyRegionInfo Read parcel failed"); + "RSClientToRenderConnectionProxy::GetActiveDirtyRegionInfo Read parcel failed"); return activeDirtyRegionInfos; } activeDirtyRegionInfos.emplace_back( @@ -3521,13 +3521,13 @@ std::vector RSRenderProcessConnectionProxy::GetActiveDirt return activeDirtyRegionInfos; } -GlobalDirtyRegionInfo RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo() +GlobalDirtyRegionInfo RSClientToRenderConnectionProxy::GetGlobalDirtyRegionInfo() { MessageParcel data; MessageParcel reply; MessageOption option; GlobalDirtyRegionInfo globalDirtyRegionInfo; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetGlobalDirtyRegionInfo: WriteInterfaceToken GetDescriptor err."); return globalDirtyRegionInfo; } @@ -3535,7 +3535,7 @@ GlobalDirtyRegionInfo RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo() uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_GLOBAL_DIRTY_REGION_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetGlobalDirtyRegionInfo: Send Request err."); return globalDirtyRegionInfo; } int64_t globalDirtyRegionAreas{0}; @@ -3544,19 +3544,19 @@ GlobalDirtyRegionInfo RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo() int32_t mostSendingPidWhenDisplayNodeSkip{0}; if (!reply.ReadInt64(globalDirtyRegionAreas) || !reply.ReadInt32(globalFramesNumber) || !reply.ReadInt32(skipProcessFramesNumber) || !reply.ReadInt32(mostSendingPidWhenDisplayNodeSkip)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetGlobalDirtyRegionInfo Read parcel failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetGlobalDirtyRegionInfo Read parcel failed"); return globalDirtyRegionInfo; } return GlobalDirtyRegionInfo( globalDirtyRegionAreas, globalFramesNumber, skipProcessFramesNumber, mostSendingPidWhenDisplayNodeSkip); } -ErrCode RSRenderProcessConnectionProxy::GetHdrOnDuration(int64_t& hdrOnDuration) +ErrCode RSClientToRenderConnectionProxy::GetHdrOnDuration(int64_t& hdrOnDuration) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("GetHdrOnDuration: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3571,12 +3571,12 @@ ErrCode RSRenderProcessConnectionProxy::GetHdrOnDuration(int64_t& hdrOnDuration) return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetVmaCacheStatus(bool flag) +ErrCode RSClientToRenderConnectionProxy::SetVmaCacheStatus(bool flag) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVmaCacheStatus: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3588,21 +3588,21 @@ ErrCode RSRenderProcessConnectionProxy::SetVmaCacheStatus(bool flag) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VMA_CACHE_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVmaCacheStatus %d: Send Request err.", flag); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVmaCacheStatus %d: Send Request err.", flag); return ERR_INVALID_VALUE; } return ERR_OK; } #ifdef TP_FEATURE_ENABLE -EErrCode RSRenderProcessConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, +EErrCode RSClientToRenderConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetTpFeatureConfig: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3632,12 +3632,12 @@ EErrCode RSRenderProcessConnectionProxy::SetTpFeatureConfig(int32_t feature, con } #endif -void RSRenderProcessConnectionProxy::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) +void RSClientToRenderConnectionProxy::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); return; } @@ -3649,17 +3649,17 @@ void RSRenderProcessConnectionProxy::SetVirtualScreenUsingStatus(bool isVirtualS uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenUsingStatus: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenUsingStatus: Send Request err."); return; } } -ErrCode RSRenderProcessConnectionProxy::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) +ErrCode RSClientToRenderConnectionProxy::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetCurtainScreenUsingStatus: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3671,18 +3671,18 @@ ErrCode RSRenderProcessConnectionProxy::SetCurtainScreenUsingStatus(bool isCurta uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_CURTAIN_SCREEN_USING_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetCurtainScreenUsingStatus: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetCurtainScreenUsingStatus: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::DropFrameByPid(const std::vector pidList) +ErrCode RSClientToRenderConnectionProxy::DropFrameByPid(const std::vector pidList) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("DropFrameByPid: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -3694,23 +3694,23 @@ ErrCode RSRenderProcessConnectionProxy::DropFrameByPid(const std::vector(RSIRenderServiceConnectionInterfaceCode::DROP_FRAME_BY_PID); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::DropFrameByPid: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::DropFrameByPid: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::RegisterUIExtensionCallback( +int32_t RSClientToRenderConnectionProxy::RegisterUIExtensionCallback( uint64_t userId, sptr callback, bool unobscured) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterUIExtensionCallback: callback is nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterUIExtensionCallback: callback is nullptr."); return INVALID_ARGUMENTS; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("RegisterUIExtensionCallback: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -3723,7 +3723,7 @@ int32_t RSRenderProcessConnectionProxy::RegisterUIExtensionCallback( } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterUIExtensionCallback Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterUIExtensionCallback Read result failed"); return READ_PARCEL_ERR; } return result; @@ -3733,13 +3733,13 @@ int32_t RSRenderProcessConnectionProxy::RegisterUIExtensionCallback( } } -ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenStatus(ScreenId id, +ErrCode RSClientToRenderConnectionProxy::SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenStatus: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -3762,18 +3762,18 @@ ErrCode RSRenderProcessConnectionProxy::SetVirtualScreenStatus(ScreenId id, return ERR_INVALID_VALUE; } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetVirtualScreenStatus Read result failed"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetVirtualScreenStatus Read result failed"); return READ_PARCEL_ERR; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetAncoForceDoDirect(bool direct, bool& res) +ErrCode RSClientToRenderConnectionProxy::SetAncoForceDoDirect(bool direct, bool& res) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { ROSEN_LOGE("SetAncoForceDoDirect: WriteInterfaceToken GetDescriptor err."); res = false; return ERR_INVALID_VALUE; @@ -3795,139 +3795,139 @@ ErrCode RSRenderProcessConnectionProxy::SetAncoForceDoDirect(bool direct, bool& } } -void RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus(bool enable) +void RSClientToRenderConnectionProxy::SetFreeMultiWindowStatus(bool enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFreeMultiWindowStatus: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteBool(enable)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: write bool val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFreeMultiWindowStatus: write bool val err."); return; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FREE_MULTI_WINDOW_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetFreeMultiWindowStatus: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetFreeMultiWindowStatus: Send Request err."); } } -void RSRenderProcessConnectionProxy::RegisterTransactionDataCallback(uint64_t token, +void RSClientToRenderConnectionProxy::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback callback == nullptr."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback callback == nullptr."); return; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); if (!data.WriteUint64(token)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write multi token val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: write multi token val err."); return; } if (!data.WriteUint64(timeStamp)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write timeStamp val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: write timeStamp val err."); return; } if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: write Callback val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: write Callback val err."); return; } uint32_t code = static_cast( RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK); - RS_LOGD("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: timeStamp: %{public}" + RS_LOGD("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: timeStamp: %{public}" PRIu64 " token: %{public}" PRIu64, timeStamp, token); int32_t err = Remote()->SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterTransactionDataCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterTransactionDataCallback: Send Request err."); return; } } -ErrCode RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback( +ErrCode RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback( pid_t pid, uint64_t uid, sptr callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback callback == nullptr"); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback callback == nullptr"); return ERR_INVALID_VALUE; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); if (!data.WriteInt32(pid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write Int32 val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback: write Int32 val err."); return ERR_INVALID_VALUE; } if (!data.WriteUint64(uid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write Uint64 val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback: write Uint64 val err."); return ERR_INVALID_VALUE; } if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: write RemoteObject val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback: write RemoteObject val err."); return ERR_INVALID_VALUE; } uint32_t code = static_cast( RSIRenderServiceConnectionInterfaceCode::REGISTER_SURFACE_BUFFER_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::RegisterSurfaceBufferCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::RegisterSurfaceBufferCallback: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) +ErrCode RSClientToRenderConnectionProxy::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::UnregisterSurfaceBufferCallback: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); if (!data.WriteInt32(pid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write Int32 val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::UnregisterSurfaceBufferCallback: write Int32 val err."); return ERR_INVALID_VALUE; } if (!data.WriteUint64(uid)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: write Uint64 val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::UnregisterSurfaceBufferCallback: write Uint64 val err."); return ERR_INVALID_VALUE; } uint32_t code = static_cast( RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_BUFFER_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::UnregisterSurfaceBufferCallback: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::UnregisterSurfaceBufferCallback: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) +ErrCode RSClientToRenderConnectionProxy::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetForceRefresh: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetForceRefresh: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); @@ -3935,20 +3935,20 @@ ErrCode RSRenderProcessConnectionProxy::SetForceRefresh(const std::string &nodeI uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_FORCE_REFRESH); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetForceRefresh: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetForceRefresh: Send Request err."); return ERR_INVALID_VALUE; } } return ERR_OK; } -void RSRenderProcessConnectionProxy::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) +void RSClientToRenderConnectionProxy::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetColorFollow: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetColorFollow: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); @@ -3956,40 +3956,40 @@ void RSRenderProcessConnectionProxy::SetColorFollow(const std::string &nodeIdStr uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_COLOR_FOLLOW); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetColorFollow: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetColorFollow: Send Request err."); return; } } } -ErrCode RSRenderProcessConnectionProxy::SetWindowContainer(NodeId nodeId, bool value) +ErrCode RSClientToRenderConnectionProxy::SetWindowContainer(NodeId nodeId, bool value) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetWindowContainer: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); if (!data.WriteUint64(nodeId)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write Uint64 val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetWindowContainer: write Uint64 val err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(value)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: write Bool val err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetWindowContainer: write Bool val err."); return ERR_INVALID_VALUE; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_WINDOW_CONTAINER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetWindowContainer: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetWindowContainer: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -bool RSRenderProcessConnectionProxy::GetHighContrastTextState() +bool RSClientToRenderConnectionProxy::GetHighContrastTextState() { MessageParcel data; MessageParcel reply; @@ -3997,13 +3997,13 @@ bool RSRenderProcessConnectionProxy::GetHighContrastTextState() uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_HIGH_CONTRAST_TEXT_STATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetHighContrastTextState: Send Request err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetHighContrastTextState: Send Request err."); return false; } return reply.ReadBool(); } -int32_t RSRenderProcessConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, +int32_t RSClientToRenderConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { if (!Remote()) { @@ -4012,59 +4012,59 @@ int32_t RSRenderProcessConnectionProxy::SendRequest(uint32_t code, MessageParcel return Remote()->SendRequest(code, data, reply, option); } -ErrCode RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled(bool enabled) +ErrCode RSClientToRenderConnectionProxy::SetBehindWindowFilterEnabled(bool enabled) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetBehindWindowFilterEnabled WriteInterfaceToken err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteBool(enabled)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled WriteBool err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetBehindWindowFilterEnabled WriteBool err."); return ERR_INVALID_VALUE; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BEHIND_WINDOW_FILTER_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetBehindWindowFilterEnabled sendrequest error : %{public}d", err); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled(bool& enabled) +ErrCode RSClientToRenderConnectionProxy::GetBehindWindowFilterEnabled(bool& enabled) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetBehindWindowFilterEnabled WriteInterfaceToken err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_BEHIND_WINDOW_FILTER_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::GetBehindWindowFilterEnabled sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::GetBehindWindowFilterEnabled sendrequest error : %{public}d", err); return ERR_INVALID_VALUE; } if (!reply.ReadBool(enabled)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::SetBehindWindowFilterEnabled ReadBool err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::SetBehindWindowFilterEnabled ReadBool err."); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderProcessConnectionProxy::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) +int32_t RSClientToRenderConnectionProxy::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { return RS_CONNECTION_ERROR; } @@ -4085,15 +4085,15 @@ int32_t RSRenderProcessConnectionProxy::GetPidGpuMemoryInMB(pid_t pid, float &gp return err; } -RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToRenderConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE); MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServiceOpenFile WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerServiceOpenFile WriteInterfaceToken err."); return RET_HRP_SERVICE_ERR_UNKNOWN; } option.SetFlags(MessageOption::TF_SYNC); @@ -4105,7 +4105,7 @@ RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServiceOpenFile(const int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServiceOpenFile sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerServiceOpenFile sendrequest error : %{public}d", err); return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; } @@ -4123,7 +4123,7 @@ RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServiceOpenFile(const return (RetCodeHrpService)retCode; } -RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToRenderConnectionProxy::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { const uint32_t code = @@ -4131,8 +4131,8 @@ RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles(c MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerServicePopulateFiles WriteInterfaceToken err."); return RET_HRP_SERVICE_ERR_UNKNOWN; } option.SetFlags(MessageOption::TF_SYNC); @@ -4143,7 +4143,7 @@ RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles(c int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerServicePopulateFiles sendrequest error : %{public}d", err); return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; } @@ -4175,38 +4175,38 @@ RetCodeHrpService RSRenderProcessConnectionProxy::ProfilerServicePopulateFiles(c return (RetCodeHrpService)retCode; } -bool RSRenderProcessConnectionProxy::ProfilerIsSecureScreen() +bool RSClientToRenderConnectionProxy::ProfilerIsSecureScreen() { const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN); MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerIsSecureScreen WriteInterfaceToken err."); return false; } option.SetFlags(MessageOption::TF_SYNC); int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerIsSecureScreen sendrequest error : %{public}d", err); return false; } bool retValue = false; if (!reply.ReadBool(retValue)) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ProfilerIsSecureScreen ReadBool err."); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ProfilerIsSecureScreen ReadBool err."); return false; } return retValue; } -void RSRenderProcessConnectionProxy::ClearUifirstCache(NodeId id) +void RSClientToRenderConnectionProxy::ClearUifirstCache(NodeId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderProcessConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ClearUifirstCache: write token err."); + if (!data.WriteInterfaceToken(RSIClientToRenderConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToRenderConnectionProxy::ClearUifirstCache: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); @@ -4217,7 +4217,7 @@ void RSRenderProcessConnectionProxy::ClearUifirstCache(NodeId id) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderProcessConnectionProxy::ClearUifirstCache sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToRenderConnectionProxy::ClearUifirstCache sendrequest error : %{public}d", err); return; } } diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.h similarity index 95% rename from rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h rename to rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.h index 83ec8b9781..8d3b8201a0 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.h +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_render_connection_proxy.h @@ -13,22 +13,22 @@ * limitations under the License. */ -#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H -#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H +#ifndef ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_CLIENT_TO_RENDER_CONNECTION_PROXY_H +#define ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_CLIENT_TO_RENDER_CONNECTION_PROXY_H #include "command/rs_node_showing_command.h" #include #include -#include +#include #include #include "sandbox_utils.h" namespace OHOS { namespace Rosen { -class RSRenderProcessConnectionProxy : public IRemoteProxy { +class RSClientToRenderConnectionProxy : public IRemoteProxy { public: - explicit RSRenderProcessConnectionProxy(const sptr& impl); - virtual ~RSRenderProcessConnectionProxy() noexcept = default; + explicit RSClientToRenderConnectionProxy(const sptr& impl); + virtual ~RSClientToRenderConnectionProxy() noexcept = default; sptr CreateRenderConnection( const sptr& token, pid_t remotePid) override @@ -334,7 +334,7 @@ private: void SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) override; - static inline BrokerDelegator delegator_; + static inline BrokerDelegator delegator_; pid_t pid_ = GetRealPid(); uint32_t transactionDataIndex_ = 0; @@ -343,4 +343,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_RENDER_PROCESS_CONNECTION_PROXY_H +#endif // ROSEN_MODULES_RENDER_SERVICE_BASE_PLATFORM_OHOS_RS_CLIENT_TO_RENDER_CONNECTION_PROXY_H diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.cpp similarity index 75% rename from rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp rename to rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.cpp index e97fc05bc5..74724a615b 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "rs_render_service_connection_proxy.h" +#include "rs_client_to_service_connection_proxy.h" #include #include @@ -38,15 +38,15 @@ static constexpr int MAX_VOTER_SIZE = 100; // SetWindowExpectedRefreshRate map s static constexpr int ZERO = 0; // empty map size } -RSRenderServiceConnectionProxy::RSRenderServiceConnectionProxy(const sptr& impl) - : IRemoteProxy(impl) +RSClientToServiceConnectionProxy::RSClientToServiceConnectionProxy(const sptr& impl) + : IRemoteProxy(impl) { } -ErrCode RSRenderServiceConnectionProxy::CommitTransaction(std::unique_ptr& transactionData) +ErrCode RSClientToServiceConnectionProxy::CommitTransaction(std::unique_ptr& transactionData) { if (!transactionData) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CommitTransaction transactionData nullptr!"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CommitTransaction transactionData nullptr!"); return ERR_INVALID_VALUE; } bool isUniMode = RSSystemProperties::GetUniRenderEnabled(); @@ -91,7 +91,7 @@ ErrCode RSRenderServiceConnectionProxy::CommitTransaction(std::unique_ptrGetDataSize()); return ERR_INVALID_VALUE; @@ -101,7 +101,7 @@ ErrCode RSRenderServiceConnectionProxy::CommitTransaction(std::unique_ptr& task) +ErrCode RSClientToServiceConnectionProxy::ExecuteSynchronousTask(const std::shared_ptr& task) { if (task == nullptr) { return ERR_INVALID_VALUE; @@ -110,7 +110,7 @@ ErrCode RSRenderServiceConnectionProxy::ExecuteSynchronousTask(const std::shared MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSRenderServiceConnectionProxy::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSClientToServiceConnectionProxy::GetDescriptor())) { ROSEN_LOGE("ExecuteSynchronousTask WriteInterfaceToken failed"); return ERR_INVALID_VALUE; } @@ -131,7 +131,7 @@ ErrCode RSRenderServiceConnectionProxy::ExecuteSynchronousTask(const std::shared return ERR_OK; } -bool RSRenderServiceConnectionProxy::FillParcelWithTransactionData( +bool RSClientToServiceConnectionProxy::FillParcelWithTransactionData( std::unique_ptr& transactionData, std::shared_ptr& data) { // write a flag at the begin of parcel to identify parcel type @@ -178,7 +178,7 @@ bool RSRenderServiceConnectionProxy::FillParcelWithTransactionData( return true; } -ErrCode RSRenderServiceConnectionProxy::GetUniRenderEnabled(bool& enable) +ErrCode RSClientToServiceConnectionProxy::GetUniRenderEnabled(bool& enable) { MessageParcel data; MessageParcel reply; @@ -191,41 +191,41 @@ ErrCode RSRenderServiceConnectionProxy::GetUniRenderEnabled(bool& enable) return false; } if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetUniRenderEnabled Read enable failed!"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetUniRenderEnabled Read enable failed!"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, +ErrCode RSClientToServiceConnectionProxy::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode: WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode: WriteInterfaceToken err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(nodeId)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode: WriteUint64 NodeId err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode: WriteUint64 NodeId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(displayNodeConfig.mirrorNodeId)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode: WriteUint64 Config.MirrorNodeId err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode: WriteUint64 Config.MirrorNodeId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteUint64(displayNodeConfig.screenId)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode: WriteUint64 Config.ScreenId err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode: WriteUint64 Config.ScreenId err."); success = false; return ERR_INVALID_VALUE; } if (!data.WriteBool(displayNodeConfig.isMirrored)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode: WriteBool Config.IsMirrored err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode: WriteBool Config.IsMirrored err."); success = false; return ERR_INVALID_VALUE; } @@ -238,13 +238,13 @@ ErrCode RSRenderServiceConnectionProxy::CreateNode(const RSDisplayNodeConfig& di } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode Read success failed!"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode Read success failed!"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) +ErrCode RSClientToServiceConnectionProxy::CreateNode(const RSSurfaceRenderNodeConfig& config, bool& success) { MessageParcel data; MessageParcel reply; @@ -269,13 +269,13 @@ ErrCode RSRenderServiceConnectionProxy::CreateNode(const RSSurfaceRenderNodeConf } if (!reply.ReadBool(success)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNode Read success failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNode Read success failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, +ErrCode RSClientToServiceConnectionProxy::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, sptr& sfc, bool unobscured) { MessageParcel data; @@ -283,31 +283,31 @@ ErrCode RSRenderServiceConnectionProxy::CreateNodeAndSurface(const RSSurfaceRend MessageOption option; if (!data.WriteUint64(config.id)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteUint64 config.id err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteUint64 config.id err."); return ERR_INVALID_VALUE; } if (!data.WriteString(config.name)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteString config.name err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteString config.name err."); return ERR_INVALID_VALUE; } if (!data.WriteUint8(static_cast(config.nodeType))) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteUint8 config.nodeType err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteUint8 config.nodeType err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(config.isTextureExportNode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteBool config.isTextureExportNode err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteBool config.isTextureExportNode err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(config.isSync)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteBool config.isSync err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteBool config.isSync err."); return ERR_INVALID_VALUE; } if (!data.WriteUint8(static_cast(config.surfaceWindowType))) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteUint8 config.surfaceWindowType err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteUint8 config.surfaceWindowType err."); return ERR_INVALID_VALUE; } if (!data.WriteBool(unobscured)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateNodeAndSurface: WriteBool unobscured err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateNodeAndSurface: WriteBool unobscured err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -325,13 +325,13 @@ ErrCode RSRenderServiceConnectionProxy::CreateNodeAndSurface(const RSSurfaceRend return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::CreateVSyncConnection(sptr& vsyncConn, +ErrCode RSClientToServiceConnectionProxy::CreateVSyncConnection(sptr& vsyncConn, const std::string& name, const sptr& token, VSyncConnParam vsyncConnParam) { if (token == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateVSyncConnection: token is nullptr."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateVSyncConnection: token is nullptr."); vsyncConn = nullptr; return ERR_INVALID_VALUE; } @@ -380,14 +380,14 @@ ErrCode RSRenderServiceConnectionProxy::CreateVSyncConnection(sptr RSRenderServiceConnectionProxy::GetAllScreenIds() +std::vector RSClientToServiceConnectionProxy::GetAllScreenIds() { MessageParcel data; MessageParcel reply; MessageOption option; std::vector screenIds; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("GetAllScreenIds: WriteInterfaceToken RSIRenderServiceConnection::GetDescriptor() err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("GetAllScreenIds: WriteInterfaceToken RSIClientToServiceConnection::GetDescriptor() err."); return std::vector(); } @@ -457,13 +457,13 @@ std::vector RSRenderServiceConnectionProxy::GetAllScreenIds() uint32_t size{0}; if (!reply.ReadUint32(size)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetAllScreenIds Read size failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetAllScreenIds Read size failed"); return std::vector(); } size_t readableSize = reply.GetReadableBytes() / sizeof(ScreenId); size_t len = static_cast(size); if (len > readableSize || len > screenIds.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetAllScreenIds Failed read vector, size:%{public}zu," + RS_LOGE("RSClientToServiceConnectionProxy GetAllScreenIds Failed read vector, size:%{public}zu," " readableSize:%{public}zu", len, readableSize); return screenIds; } @@ -474,7 +474,7 @@ std::vector RSRenderServiceConnectionProxy::GetAllScreenIds() return screenIds; } -ScreenId RSRenderServiceConnectionProxy::CreateVirtualScreen( +ScreenId RSClientToServiceConnectionProxy::CreateVirtualScreen( const std::string &name, uint32_t width, uint32_t height, @@ -487,8 +487,8 @@ ScreenId RSRenderServiceConnectionProxy::CreateVirtualScreen( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("CreateVirtualScreen: WriteInterfaceToken RSIRenderServiceConnection::GetDescriptor() err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("CreateVirtualScreen: WriteInterfaceToken RSIClientToServiceConnection::GetDescriptor() err."); return INVALID_SCREEN_ID; } @@ -543,22 +543,22 @@ ScreenId RSRenderServiceConnectionProxy::CreateVirtualScreen( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CREATE_VIRTUAL_SCREEN); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::%{public}s: Send Request err.", __func__); + ROSEN_LOGE("RSClientToServiceConnectionProxy::%{public}s: Send Request err.", __func__); return INVALID_SCREEN_ID; } uint64_t id{0}; if (!reply.ReadUint64(id)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::CreateVirtualScreen Read id failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::CreateVirtualScreen Read id failed"); return INVALID_SCREEN_ID; } return id; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) +int32_t RSClientToServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, sptr surface) { if (surface == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!"); return INVALID_ARGUMENTS; } @@ -566,7 +566,7 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenSurface: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -584,7 +584,7 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_SURFACE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetVirtualScreenSurface: Send Request err."); return RS_CONNECTION_ERROR; } @@ -592,12 +592,12 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt return status; } -void RSRenderServiceConnectionProxy::RemoveVirtualScreen(ScreenId id) +void RSClientToServiceConnectionProxy::RemoveVirtualScreen(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("RemoveVirtualScreen: WriteInterfaceToken GetDescriptor err."); return; } @@ -610,15 +610,15 @@ void RSRenderServiceConnectionProxy::RemoveVirtualScreen(ScreenId id) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::REMOVE_VIRTUAL_SCREEN); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RemoveVirtualScreen: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RemoveVirtualScreen: Send Request err."); return; } } -int32_t RSRenderServiceConnectionProxy::SetScreenChangeCallback(sptr callback) +int32_t RSClientToServiceConnectionProxy::SetScreenChangeCallback(sptr callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: callback is nullptr."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenChangeCallback: callback is nullptr."); return INVALID_ARGUMENTS; } @@ -626,7 +626,7 @@ int32_t RSRenderServiceConnectionProxy::SetScreenChangeCallback(sptr(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_CHANGE_CALLBACK); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenChangeCallback: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenChangeCallback: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result = reply.ReadInt32(); return result; } -void RSRenderServiceConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) +void RSClientToServiceConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t modeId) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); return; } @@ -672,13 +672,13 @@ void RSRenderServiceConnectionProxy::SetScreenActiveMode(ScreenId id, uint32_t m } } -void RSRenderServiceConnectionProxy::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) +void RSClientToServiceConnectionProxy::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenRefreshRate: WriteInterfaceToken GetDescriptor err."); return; } @@ -698,18 +698,18 @@ void RSRenderServiceConnectionProxy::SetScreenRefreshRate(ScreenId id, int32_t s uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SCREEN_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return; } } -void RSRenderServiceConnectionProxy::SetRefreshRateMode(int32_t refreshRateMode) +void RSClientToServiceConnectionProxy::SetRefreshRateMode(int32_t refreshRateMode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetRefreshRateMode: WriteInterfaceToken GetDescriptor err."); return; } @@ -721,18 +721,18 @@ void RSRenderServiceConnectionProxy::SetRefreshRateMode(int32_t refreshRateMode) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_REFRESH_RATE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return; } } -void RSRenderServiceConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) +void RSClientToServiceConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("UnregisterFrameRateLinker: WriteInterfaceToken GetDescriptor err."); return; } @@ -745,18 +745,18 @@ void RSRenderServiceConnectionProxy::UnregisterFrameRateLinker(FrameRateLinkerId uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_FRAME_RATE_LINKER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return; } } -uint32_t RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate(ScreenId id) +uint32_t RSClientToServiceConnectionProxy::GetScreenCurrentRefreshRate(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenCurrentRefreshRate: WriteInterfaceToken GetDescriptor err."); return SUCCESS; } @@ -768,50 +768,50 @@ uint32_t RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate(ScreenId id uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_CURRENT_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return SUCCESS; } uint32_t rate{0}; if (!reply.ReadUint32(rate)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenCurrentRefreshRate Read rate failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenCurrentRefreshRate Read rate failed"); return READ_PARCEL_ERR; } return rate; } -int32_t RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode() +int32_t RSClientToServiceConnectionProxy::GetCurrentRefreshRateMode() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy failed to get descriptor"); return SUCCESS; } option.SetFlags(MessageOption::TF_SYNC); uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_CURRENT_REFRESH_RATE_MODE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return SUCCESS; } int32_t refreshRateMode{0}; if (!reply.ReadInt32(refreshRateMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read refreshRateMode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetCurrentRefreshRateMode Read refreshRateMode failed"); return READ_PARCEL_ERR; } return refreshRateMode; } -std::vector RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates(ScreenId id) +std::vector RSClientToServiceConnectionProxy::GetScreenSupportedRefreshRates(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; std::vector screenSupportedRates; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedRefreshRates: WriteInterfaceToken GetDescriptor err."); return screenSupportedRates; } @@ -827,13 +827,13 @@ std::vector RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRa } uint64_t rateCount{0}; if (!reply.ReadUint64(rateCount)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRates Read rateCount failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenSupportedRefreshRates Read rateCount failed"); return screenSupportedRates; } size_t readableSize = reply.GetReadableBytes(); size_t len = static_cast(rateCount); if (len > readableSize || len > screenSupportedRates.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedRefreshRates " + RS_LOGE("RSClientToServiceConnectionProxy GetScreenSupportedRefreshRates " "fail read vector, size : %{public}zu, readableSize : %{public}zu", len, readableSize); return screenSupportedRates; } @@ -844,37 +844,37 @@ std::vector RSRenderServiceConnectionProxy::GetScreenSupportedRefreshRa return screenSupportedRates; } -ErrCode RSRenderServiceConnectionProxy::GetShowRefreshRateEnabled(bool& enable) +ErrCode RSClientToServiceConnectionProxy::GetShowRefreshRateEnabled(bool& enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceProxy failed to get descriptor"); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy failed to get descriptor"); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SHOW_REFRESH_RATE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return ERR_INVALID_VALUE; } if (!reply.ReadBool(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetCurrentRefreshRateMode Read enable failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetCurrentRefreshRateMode Read enable failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderServiceConnectionProxy::SetShowRefreshRateEnabled(bool enabled, int32_t type) +void RSClientToServiceConnectionProxy::SetShowRefreshRateEnabled(bool enabled, int32_t type) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetShowRefreshRateEnabled: WriteInterfaceToken GetDescriptor err."); return; } @@ -886,18 +886,18 @@ void RSRenderServiceConnectionProxy::SetShowRefreshRateEnabled(bool enabled, int uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_SHOW_REFRESH_RATE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return; } } -uint32_t RSRenderServiceConnectionProxy::GetRealtimeRefreshRate(ScreenId id) +uint32_t RSClientToServiceConnectionProxy::GetRealtimeRefreshRate(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetRealtimeRefreshRate: WriteInterfaceToken GetDescriptor err."); return SUCCESS; } @@ -909,24 +909,24 @@ uint32_t RSRenderServiceConnectionProxy::GetRealtimeRefreshRate(ScreenId id) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REALTIME_REFRESH_RATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); return SUCCESS; } uint32_t rate{0}; if (!reply.ReadUint32(rate)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRealtimeRefreshRate Read rate failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetRealtimeRefreshRate Read rate failed"); return READ_PARCEL_ERR; } return rate; } -ErrCode RSRenderServiceConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) +ErrCode RSClientToServiceConnectionProxy::GetRefreshInfo(pid_t pid, std::string& enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetRefreshInfo: WriteInterfaceToken GetDescriptor err."); enable = ""; return ERR_INVALID_VALUE; @@ -940,25 +940,25 @@ ErrCode RSRenderServiceConnectionProxy::GetRefreshInfo(pid_t pid, std::string& e uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); enable = ""; return ERR_INVALID_VALUE; } if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetRefreshInfo Read enable failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) +ErrCode RSClientToServiceConnectionProxy::GetRefreshInfoToSP(NodeId id, std::string& enable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetRefreshInfoToSP: WriteInterfaceToken GetDescriptor err."); enable = ""; return ERR_INVALID_VALUE; @@ -972,19 +972,19 @@ ErrCode RSRenderServiceConnectionProxy::GetRefreshInfoToSP(NodeId id, std::strin uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_REFRESH_INFO_TO_SP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceProxy sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy sendrequest error : %{public}d", err); enable = ""; return ERR_INVALID_VALUE; } if (!reply.ReadString(enable)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetRefreshInfo Read enable failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetRefreshInfo Read enable failed"); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToServiceConnectionProxy::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; @@ -1007,24 +1007,24 @@ int32_t RSRenderServiceConnectionProxy::SetPhysicalScreenResolution(ScreenId id, } auto code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_PHYSICAL_SCREEN_RESOLUTION); if (SendRequest(code, data, reply, option) != ERR_NONE) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetPhysicalScreenResolution: SendRequest error."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetPhysicalScreenResolution Read status failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetPhysicalScreenResolution Read status failed"); return READ_PARCEL_ERR; } return status; } -int32_t RSRenderServiceConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) +int32_t RSClientToServiceConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetVirtualScreenResolution: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -1044,25 +1044,25 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenResolution(ScreenId id, uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_RESOLUTION); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetVirtualScreenResolution: Send Request err."); return RS_CONNECTION_ERROR; } int32_t status{0}; if (!reply.ReadInt32(status)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenResolution Read status failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetVirtualScreenResolution Read status failed"); return READ_PARCEL_ERR; } return status; } -ErrCode RSRenderServiceConnectionProxy::RepaintEverything() +ErrCode RSClientToServiceConnectionProxy::RepaintEverything() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RepaintEverything: Send Request err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::RepaintEverything: Send Request err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_SYNC); @@ -1075,13 +1075,13 @@ ErrCode RSRenderServiceConnectionProxy::RepaintEverything() return ERR_OK; } -void RSRenderServiceConnectionProxy::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) +void RSClientToServiceConnectionProxy::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenPowerStatus: WriteInterfaceToken GetDescriptor err."); return; } @@ -1102,7 +1102,7 @@ void RSRenderServiceConnectionProxy::SetScreenPowerStatus(ScreenId id, ScreenPow } } -ErrCode RSRenderServiceConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) +ErrCode RSClientToServiceConnectionProxy::RegisterApplicationAgent(uint32_t pid, sptr app) { if (app == nullptr) { ROSEN_LOGE("%{public}s callback == nullptr", __func__); @@ -1126,7 +1126,7 @@ ErrCode RSRenderServiceConnectionProxy::RegisterApplicationAgent(uint32_t pid, s return ERR_OK; } -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureConfig( +bool RSClientToServiceConnectionProxy::WriteSurfaceCaptureConfig( const RSSurfaceCaptureConfig& captureConfig, MessageParcel& data) { if (!data.WriteFloat(captureConfig.scaleX) || !data.WriteFloat(captureConfig.scaleY) || @@ -1151,7 +1151,7 @@ bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureConfig( return true; } -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureBlurParam( +bool RSClientToServiceConnectionProxy::WriteSurfaceCaptureBlurParam( const RSSurfaceCaptureBlurParam& blurParam, MessageParcel& data) { if (!data.WriteBool(blurParam.isNeedBlur) || !data.WriteFloat(blurParam.blurRadius)) { @@ -1161,7 +1161,7 @@ bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureBlurParam( return true; } -bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureAreaRect( +bool RSClientToServiceConnectionProxy::WriteSurfaceCaptureAreaRect( const Drawing::Rect& specifiedAreaRect, MessageParcel& data) { if (!data.WriteFloat(specifiedAreaRect.left_) || !data.WriteFloat(specifiedAreaRect.top_) || @@ -1172,13 +1172,13 @@ bool RSRenderServiceConnectionProxy::WriteSurfaceCaptureAreaRect( return true; } -ErrCode RSRenderServiceConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) +ErrCode RSClientToServiceConnectionProxy::GetScreenActiveMode(uint64_t id, RSScreenModeInfo& screenModeInfo) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenActiveMode: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1203,14 +1203,14 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenActiveMode(uint64_t id, RSScree return ERR_OK; } -std::vector RSRenderServiceConnectionProxy::GetScreenSupportedModes(ScreenId id) +std::vector RSClientToServiceConnectionProxy::GetScreenSupportedModes(ScreenId id) { MessageParcel data; MessageParcel reply; MessageOption option; std::vector screenSupportedModes; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedModes: WriteInterfaceToken GetDescriptor err."); return screenSupportedModes; } @@ -1228,13 +1228,13 @@ std::vector RSRenderServiceConnectionProxy::GetScreenSupported uint64_t modeCount{0}; if (!reply.ReadUint64(modeCount)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedModes Read modeCount failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenSupportedModes Read modeCount failed"); return screenSupportedModes; } size_t readableSize = reply.GetReadableBytes(); size_t len = static_cast(modeCount); if (len > readableSize || len > screenSupportedModes.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetScreenSupportedModes Fail read vector, size:%{public}zu," + RS_LOGE("RSClientToServiceConnectionProxy GetScreenSupportedModes Fail read vector, size:%{public}zu," "readableSize:%{public}zu", len, readableSize); return screenSupportedModes; } @@ -1250,13 +1250,13 @@ std::vector RSRenderServiceConnectionProxy::GetScreenSupported return screenSupportedModes; } -ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) +ErrCode RSClientToServiceConnectionProxy::GetMemoryGraphics(std::vector& memoryGraphics) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetMemoryGraphics: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1270,13 +1270,13 @@ ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphics(std::vector(count); if (len > readableSize || len > memoryGraphics.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," + RS_LOGE("RSClientToServiceConnectionProxy GetMemoryGraphics Failed to read vector, size:%{public}zu," " readableSize:%{public}zu", len, readableSize); return ERR_INVALID_VALUE; } @@ -1292,13 +1292,13 @@ ErrCode RSRenderServiceConnectionProxy::GetMemoryGraphics(std::vector callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: callback is nullptr."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterBufferClearListener: callback is nullptr."); return ERR_INVALID_VALUE; } @@ -1489,7 +1489,7 @@ ErrCode RSRenderServiceConnectionProxy::RegisterBufferClearListener( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("RegisterBufferClearListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1505,17 +1505,17 @@ ErrCode RSRenderServiceConnectionProxy::RegisterBufferClearListener( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_CLEAR_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferClearListener: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterBufferClearListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::RegisterBufferAvailableListener( +ErrCode RSClientToServiceConnectionProxy::RegisterBufferAvailableListener( NodeId id, sptr callback, bool isFromRenderThread) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterBufferAvailableListener: callback is nullptr."); return ERR_INVALID_VALUE; } @@ -1523,7 +1523,7 @@ ErrCode RSRenderServiceConnectionProxy::RegisterBufferAvailableListener( MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("RegisterBufferAvailableListener: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -1544,18 +1544,18 @@ ErrCode RSRenderServiceConnectionProxy::RegisterBufferAvailableListener( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_BUFFER_AVAILABLE_LISTENER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterBufferAvailableListener: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterBufferAvailableListener: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) +int32_t RSClientToServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedColorGamuts: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1571,7 +1571,7 @@ int32_t RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId i } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenSupportedColorGamuts Read result failed"); return READ_PARCEL_ERR; } if (result == SUCCESS) { @@ -1585,13 +1585,13 @@ int32_t RSRenderServiceConnectionProxy::GetScreenSupportedColorGamuts(ScreenId i return result; } -int32_t RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys( +int32_t RSClientToServiceConnectionProxy::GetScreenSupportedMetaDataKeys( ScreenId id, std::vector& keys) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedMetaDataKeys: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1607,7 +1607,7 @@ int32_t RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys( } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenSupportedMetaDataKeys Read result failed"); return READ_PARCEL_ERR; } if (result == SUCCESS) { @@ -1621,12 +1621,12 @@ int32_t RSRenderServiceConnectionProxy::GetScreenSupportedMetaDataKeys( return result; } -int32_t RSRenderServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) +int32_t RSClientToServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1642,13 +1642,13 @@ int32_t RSRenderServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenC } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenColorGamut Read result failed"); return READ_PARCEL_ERR; } if (result == SUCCESS) { uint32_t readMode{0}; if (!reply.ReadUint32(readMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorGamut Read mode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenColorGamut Read mode failed"); return READ_PARCEL_ERR; } mode = static_cast(readMode); @@ -1656,12 +1656,12 @@ int32_t RSRenderServiceConnectionProxy::GetScreenColorGamut(ScreenId id, ScreenC return result; } -int32_t RSRenderServiceConnectionProxy::SetScreenColorGamut(ScreenId id, int32_t modeIdx) +int32_t RSClientToServiceConnectionProxy::SetScreenColorGamut(ScreenId id, int32_t modeIdx) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenColorGamut: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1681,18 +1681,18 @@ int32_t RSRenderServiceConnectionProxy::SetScreenColorGamut(ScreenId id, int32_t } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenColorGamut Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenColorGamut Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderServiceConnectionProxy::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) +int32_t RSClientToServiceConnectionProxy::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1712,18 +1712,18 @@ int32_t RSRenderServiceConnectionProxy::SetScreenGamutMap(ScreenId id, ScreenGam } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenGamutMap Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenGamutMap Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderServiceConnectionProxy::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) +int32_t RSClientToServiceConnectionProxy::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenCorrection: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1743,18 +1743,18 @@ int32_t RSRenderServiceConnectionProxy::SetScreenCorrection(ScreenId id, ScreenR } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenCorrection Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenCorrection Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) +int32_t RSClientToServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenGamutMap: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1770,13 +1770,13 @@ int32_t RSRenderServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGam } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenGamutMap Read result failed"); return READ_PARCEL_ERR; } if (result == SUCCESS) { uint32_t readMode{0}; if (!reply.ReadUint32(readMode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenGamutMap Read mode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenGamutMap Read mode failed"); return READ_PARCEL_ERR; } mode = static_cast(readMode); @@ -1784,34 +1784,34 @@ int32_t RSRenderServiceConnectionProxy::GetScreenGamutMap(ScreenId id, ScreenGam return result; } -ErrCode RSRenderServiceConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) +ErrCode RSClientToServiceConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenHDRStatus WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } option.SetFlags(MessageOption::TF_SYNC); if (!data.WriteUint64(id)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenHDRStatus WriteUint64 id err."); return WRITE_PARCEL_ERR; } uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_SCREEN_HDR_STATUS); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenHDRStatus SendRequest error(%{public}d)", err); return RS_CONNECTION_ERROR; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read resCode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenHDRStatus Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { uint32_t readHdrStatus{0}; if (!reply.ReadUint32(readHdrStatus)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenHDRStatus Read HDR status failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenHDRStatus Read HDR status failed"); return READ_PARCEL_ERR; } hdrStatus = static_cast(readHdrStatus); @@ -1819,13 +1819,13 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenHDRStatus(ScreenId id, HdrStatu return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces( +ErrCode RSClientToServiceConnectionProxy::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenSupportedColorSpaces: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1843,7 +1843,7 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces( return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenSupportedColorSpaces Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { @@ -1856,13 +1856,13 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenSupportedColorSpaces( return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::GetScreenColorSpace( +ErrCode RSClientToServiceConnectionProxy::GetScreenColorSpace( ScreenId id, GraphicCM_ColorSpaceType& colorSpace, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1880,13 +1880,13 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenColorSpace( return ERR_INVALID_VALUE; } if (!reply.ReadInt32(resCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read resCode failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenColorSpace Read resCode failed"); return READ_PARCEL_ERR; } if (resCode == SUCCESS) { uint32_t type{0}; if (!reply.ReadUint32(type)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenColorSpace Read type failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenColorSpace Read type failed"); return READ_PARCEL_ERR; } colorSpace = static_cast(type); @@ -1894,13 +1894,13 @@ ErrCode RSRenderServiceConnectionProxy::GetScreenColorSpace( return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetScreenColorSpace( +ErrCode RSClientToServiceConnectionProxy::SetScreenColorSpace( ScreenId id, GraphicCM_ColorSpaceType colorSpace, int32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenColorSpace: WriteInterfaceToken GetDescriptor err."); resCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -1926,12 +1926,12 @@ ErrCode RSRenderServiceConnectionProxy::SetScreenColorSpace( return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& screenType) +int32_t RSClientToServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& screenType) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetScreenType: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -1949,7 +1949,7 @@ int32_t RSRenderServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& if (result == SUCCESS) { uint32_t type{0}; if (!reply.ReadUint32(type)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetScreenType Read type failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetScreenType Read type failed"); return READ_PARCEL_ERR; } screenType = static_cast(type); @@ -1957,12 +1957,12 @@ int32_t RSRenderServiceConnectionProxy::GetScreenType(ScreenId id, RSScreenType& return result; } -ErrCode RSRenderServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) +ErrCode RSClientToServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bitmap, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetBitmap: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -1981,11 +1981,11 @@ ErrCode RSRenderServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bi } bool result{false}; if (!reply.ReadBool(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetBitmap Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetBitmap Read result failed"); return READ_PARCEL_ERR; } if (!result || !RSMarshallingHelper::Unmarshalling(reply, bitmap)) { - RS_LOGE("RSRenderServiceConnectionProxy::GetBitmap: Unmarshalling failed"); + RS_LOGE("RSClientToServiceConnectionProxy::GetBitmap: Unmarshalling failed"); success = false; return ERR_INVALID_VALUE; } @@ -1993,12 +1993,12 @@ ErrCode RSRenderServiceConnectionProxy::GetBitmap(NodeId id, Drawing::Bitmap& bi return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetGlobalDarkColorMode(bool isDark) +ErrCode RSClientToServiceConnectionProxy::SetGlobalDarkColorMode(bool isDark) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetGlobalDarkColorMode: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2016,13 +2016,13 @@ ErrCode RSRenderServiceConnectionProxy::SetGlobalDarkColorMode(bool isDark) return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, +ErrCode RSClientToServiceConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList, bool& success) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetPixelmap: WriteInterfaceToken GetDescriptor err."); success = false; return ERR_INVALID_VALUE; @@ -2048,11 +2048,11 @@ ErrCode RSRenderServiceConnectionProxy::GetPixelmap(NodeId id, std::shared_ptr& edidData) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { return RS_CONNECTION_ERROR; } if (!data.WriteUint64(id)) { @@ -2080,11 +2080,11 @@ int32_t RSRenderServiceConnectionProxy::GetDisplayIdentificationData(ScreenId id } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetDisplayIdentificationData Read result failed"); return READ_PARCEL_ERR; } if (result != SUCCESS) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: failed"); + RS_LOGE("RSClientToServiceConnectionProxy::GetDisplayIdentificationData: failed"); return result; } if (!reply.ReadUint8(outPort)) { @@ -2092,27 +2092,27 @@ int32_t RSRenderServiceConnectionProxy::GetDisplayIdentificationData(ScreenId id } uint32_t edidSize = reply.ReadUint32(); if (edidSize == 0 || edidSize > EDID_DATA_MAX_SIZE) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize failed"); + RS_LOGE("RSClientToServiceConnectionProxy::GetDisplayIdentificationData: EdidSize failed"); return READ_PARCEL_ERR; } edidData.resize(edidSize); const uint8_t *editpnt = reply.ReadBuffer(edidSize); if (editpnt == nullptr) { - RS_LOGE("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: ReadBuffer failed"); + RS_LOGE("RSClientToServiceConnectionProxy::GetDisplayIdentificationData: ReadBuffer failed"); return READ_PARCEL_ERR; } - RS_LOGD("RSRenderServiceConnectionProxy::GetDisplayIdentificationData: EdidSize: %{public}u", edidSize); + RS_LOGD("RSClientToServiceConnectionProxy::GetDisplayIdentificationData: EdidSize: %{public}u", edidSize); edidData.assign(editpnt, editpnt + edidSize); return result; } -ErrCode RSRenderServiceConnectionProxy::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) +ErrCode RSClientToServiceConnectionProxy::SetScreenActiveRect(ScreenId id, const Rect& activeRect, uint32_t& repCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetScreenActiveRect: WriteInterfaceToken GetDescriptor err."); repCode = RS_CONNECTION_ERROR; return ERR_INVALID_VALUE; @@ -2136,19 +2136,19 @@ ErrCode RSRenderServiceConnectionProxy::SetScreenActiveRect(ScreenId id, const R return ERR_INVALID_VALUE; } if (!reply.ReadUint32(repCode)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetScreenActiveRect Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetScreenActiveRect Read result failed"); repCode = READ_PARCEL_ERR; return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderServiceConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) +void RSClientToServiceConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); return; } @@ -2164,12 +2164,12 @@ void RSRenderServiceConnectionProxy::SetScreenOffset(ScreenId id, int32_t offSet } } -void RSRenderServiceConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) +void RSClientToServiceConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t gravity) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: WriteInterfaceToken GetDescriptor err.", __func__); return; } @@ -2186,14 +2186,14 @@ void RSRenderServiceConnectionProxy::SetScreenFrameGravity(ScreenId id, int32_t } } -ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStart( +ErrCode RSClientToServiceConnectionProxy::AvcodecVideoStart( uint64_t uniqueId, std::string& surfaceName, uint32_t fps, uint64_t reportTime) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("AvcodecVideoStart: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2217,24 +2217,24 @@ ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStart( uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_START); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::AvcodecVideoStart: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStart Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::AvcodecVideoStart Read result failed"); return READ_PARCEL_ERR; } return result; } -ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) +ErrCode RSClientToServiceConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std::string& surfaceName, uint32_t fps) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("AvcodecVideoStop: WriteInterfaceToken GetDescriptor err."); return RS_CONNECTION_ERROR; } @@ -2254,24 +2254,24 @@ ErrCode RSRenderServiceConnectionProxy::AvcodecVideoStop(uint64_t uniqueId, std: uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::AVCODEC_VIDEO_STOP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::AvcodecVideoStop: Send Request err."); return RS_CONNECTION_ERROR; } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::AvcodecVideoStop Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::AvcodecVideoStop Read result failed"); return READ_PARCEL_ERR; } return result; } -ErrCode RSRenderServiceConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, +ErrCode RSClientToServiceConnectionProxy::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetHardwareEnabled: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2295,18 +2295,18 @@ ErrCode RSRenderServiceConnectionProxy::SetHardwareEnabled(NodeId id, bool isEna uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HARDWARE_ENABLED); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHardwareEnabled: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetHardwareEnabled: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) +ErrCode RSClientToServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent, uint32_t& resCode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetHidePrivacyContent: WriteInterfaceToken GetDescriptor err."); resCode = static_cast(RSInterfaceErrorCode::WRITE_PARCEL_ERROR); return ERR_INVALID_VALUE; @@ -2325,7 +2325,7 @@ ErrCode RSRenderServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool ne uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_HIDE_PRIVACY_CONTENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetHidePrivacyContent: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetHidePrivacyContent: Send Request err."); resCode = static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); return ERR_INVALID_VALUE; } @@ -2333,7 +2333,7 @@ ErrCode RSRenderServiceConnectionProxy::SetHidePrivacyContent(NodeId id, bool ne return ERR_OK; } -void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( +void RSClientToServiceConnectionProxy::SetWindowExpectedRefreshRate( const std::unordered_map& eventInfos ) { @@ -2346,7 +2346,7 @@ void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); return; } @@ -2369,12 +2369,12 @@ void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_WINDOW_ID); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); return; } } -void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( +void RSClientToServiceConnectionProxy::SetWindowExpectedRefreshRate( const std::unordered_map& eventInfos ) { @@ -2387,7 +2387,7 @@ void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetWindowExpectedRefreshRate: WriteInterfaceToken GetDescriptor err."); return; } @@ -2410,17 +2410,17 @@ void RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate( static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_WINDOW_EXPECTED_BY_VSYNC_NAME); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetWindowExpectedRefreshRate: Send Request err."); return; } } -void RSRenderServiceConnectionProxy::NotifyRefreshRateEvent(const EventInfo& eventInfo) +void RSClientToServiceConnectionProxy::NotifyRefreshRateEvent(const EventInfo& eventInfo) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("NotifyRefreshRateEvent: WriteInterfaceToken GetDescriptor err."); return; } @@ -2448,17 +2448,17 @@ void RSRenderServiceConnectionProxy::NotifyRefreshRateEvent(const EventInfo& eve uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_REFRESH_RATE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyRefreshRateEvent: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyRefreshRateEvent: Send Request err."); return; } } -ErrCode RSRenderServiceConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) +ErrCode RSClientToServiceConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint32_t rateDiscount) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("NotifySoftVsyncEvent: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2474,18 +2474,18 @@ ErrCode RSRenderServiceConnectionProxy::NotifySoftVsyncEvent(uint32_t pid, uint3 uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_SOFT_VSYNC_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifySoftVsyncEvent: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifySoftVsyncEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) +ErrCode RSClientToServiceConnectionProxy::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("NotifyTouchEvent: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2501,18 +2501,18 @@ ErrCode RSRenderServiceConnectionProxy::NotifyTouchEvent(int32_t touchStatus, in uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_TOUCH_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyTouchEvent: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyTouchEvent: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -void RSRenderServiceConnectionProxy::NotifyDynamicModeEvent(bool enableDynamicMode) +void RSClientToServiceConnectionProxy::NotifyDynamicModeEvent(bool enableDynamicMode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("NotifyDynamicModeEvent: WriteInterfaceToken GetDescriptor err."); return; } @@ -2524,18 +2524,18 @@ void RSRenderServiceConnectionProxy::NotifyDynamicModeEvent(bool enableDynamicMo uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_DYNAMIC_MODE_EVENT); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyDynamicModeEvent: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyDynamicModeEvent: Send Request err."); return; } } -ErrCode RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate( +ErrCode RSClientToServiceConnectionProxy::NotifyXComponentExpectedFrameRate( const std::string& id, int32_t expectedFrameRate) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("NotifyXComponentExpectedFrameRate: GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2550,19 +2550,19 @@ ErrCode RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate( RSIRenderServiceConnectionInterfaceCode::NOTIFY_XCOMPONENT_EXPECTED_FRAMERATE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyXComponentExpectedFrameRate: Send Request err."); return ERR_INVALID_VALUE; } return ERR_OK; } -LayerComposeInfo RSRenderServiceConnectionProxy::GetLayerComposeInfo() +LayerComposeInfo RSClientToServiceConnectionProxy::GetLayerComposeInfo() { MessageParcel data; MessageParcel reply; MessageOption option; LayerComposeInfo layerComposeInfo; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetLayerComposeInfo: WriteInterfaceToken GetDescriptor err."); return layerComposeInfo; } @@ -2570,7 +2570,7 @@ LayerComposeInfo RSRenderServiceConnectionProxy::GetLayerComposeInfo() uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::GET_LAYER_COMPOSE_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetLayerComposeInfo: Send Request err."); return layerComposeInfo; } int32_t uniformRenderFrameNumber{0}; @@ -2578,19 +2578,19 @@ LayerComposeInfo RSRenderServiceConnectionProxy::GetLayerComposeInfo() int32_t redrawFrameNumber{0}; if (!reply.ReadInt32(uniformRenderFrameNumber) || !reply.ReadInt32(offlineComposeFrameNumber) || !reply.ReadInt32(redrawFrameNumber)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetLayerComposeInfo Read parcel failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetLayerComposeInfo Read parcel failed"); return layerComposeInfo; } return LayerComposeInfo(uniformRenderFrameNumber, offlineComposeFrameNumber, redrawFrameNumber); } -HwcDisabledReasonInfos RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo() +HwcDisabledReasonInfos RSClientToServiceConnectionProxy::GetHwcDisabledReasonInfo() { MessageParcel data; MessageParcel reply; MessageOption option; HwcDisabledReasonInfos hwcDisabledReasonInfos; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("GetHwcDisabledReasonInfo: WriteInterfaceToken GetDescriptor err."); return hwcDisabledReasonInfos; } @@ -2599,18 +2599,18 @@ HwcDisabledReasonInfos RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo( GET_HARDWARE_COMPOSE_DISABLED_REASON_INFO); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetHwcDisabledReasonInfo: Send Request err."); return hwcDisabledReasonInfos; } int32_t size{0}; if (!reply.ReadInt32(size)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo Read size failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::GetHwcDisabledReasonInfo Read size failed"); return hwcDisabledReasonInfos; } size_t readableSize = reply.GetReadableBytes() / HWC_DISABLED_REASON_INFO_MINIMUM_SIZE; size_t len = static_cast(size); if (len > readableSize || len > hwcDisabledReasonInfos.max_size()) { - RS_LOGE("RSRenderServiceConnectionProxy GetHwcDisabledReasonInfo Failed read vector, size:%{public}zu," + RS_LOGE("RSClientToServiceConnectionProxy GetHwcDisabledReasonInfo Failed read vector, size:%{public}zu," " readableSize:%{public}zu", len, readableSize); return hwcDisabledReasonInfos; } @@ -2628,14 +2628,14 @@ HwcDisabledReasonInfos RSRenderServiceConnectionProxy::GetHwcDisabledReasonInfo( } #ifdef TP_FEATURE_ENABLE -EErrCode RSRenderServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, +EErrCode RSClientToServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("SetTpFeatureConfig: WriteInterfaceToken GetDescriptor err."); return ERR_INVALID_VALUE; } @@ -2665,52 +2665,52 @@ EErrCode RSRenderServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, con } #endif -void RSRenderServiceConnectionProxy::RegisterTransactionDataCallback(uint64_t token, +void RSClientToServiceConnectionProxy::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, sptr callback) { if (callback == nullptr) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback callback == nullptr."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback callback == nullptr."); return; } MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: write token err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); static_assert(std::is_same_v, "pid_t is not int32_t on this platform."); if (!data.WriteUint64(token)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: write multi token val err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: write multi token val err."); return; } if (!data.WriteUint64(timeStamp)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: write timeStamp val err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: write timeStamp val err."); return; } if (!data.WriteRemoteObject(callback->AsObject())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: write Callback val err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: write Callback val err."); return; } uint32_t code = static_cast( RSIRenderServiceConnectionInterfaceCode::REGISTER_TRANSACTION_DATA_CALLBACK); - RS_LOGD("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: timeStamp: %{public}" + RS_LOGD("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: timeStamp: %{public}" PRIu64 " token: %{public}" PRIu64, timeStamp, token); int32_t err = Remote()->SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterTransactionDataCallback: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterTransactionDataCallback: Send Request err."); return; } } -ErrCode RSRenderServiceConnectionProxy::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) +ErrCode RSClientToServiceConnectionProxy::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetLayerTopForHWC: write token err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetLayerTopForHWC: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); @@ -2719,20 +2719,20 @@ ErrCode RSRenderServiceConnectionProxy::SetLayerTopForHWC(NodeId nodeId, bool is static_cast(RSIRenderServiceConnectionInterfaceCode::SET_LAYER_TOP_FOR_HARDWARE_COMPOSER); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetLayerTopForHWC: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetLayerTopForHWC: Send Request err."); return ERR_INVALID_VALUE; } } return ERR_OK; } -ErrCode RSRenderServiceConnectionProxy::SetLayerTop(const std::string &nodeIdStr, bool isTop) +ErrCode RSClientToServiceConnectionProxy::SetLayerTop(const std::string &nodeIdStr, bool isTop) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetLayerTop: write token err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetLayerTop: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); @@ -2740,14 +2740,14 @@ ErrCode RSRenderServiceConnectionProxy::SetLayerTop(const std::string &nodeIdStr uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::SET_LAYER_TOP); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetLayerTop: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetLayerTop: Send Request err."); return ERR_INVALID_VALUE; } } return ERR_OK; } -int32_t RSRenderServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallback( +int32_t RSClientToServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, sptr callback) { if (!callback) { @@ -2758,7 +2758,7 @@ int32_t RSRenderServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallbac MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("RegisterSelfDrawingNodeRectChangeCallback: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -2794,19 +2794,19 @@ int32_t RSRenderServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallbac } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallback Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::RegisterSelfDrawingNodeRectChangeCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallback() +int32_t RSClientToServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallback() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("UnRegisterSelfDrawingNodeRectChangeCallback: WriteInterfaceToken GetDescriptor err."); return WRITE_PARCEL_ERR; } @@ -2821,13 +2821,13 @@ int32_t RSRenderServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallb } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallback Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::UnRegisterSelfDrawingNodeRectChangeCallback Read result failed"); return READ_PARCEL_ERR; } return result; } -int32_t RSRenderServiceConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, +int32_t RSClientToServiceConnectionProxy::SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { if (!Remote()) { @@ -2836,12 +2836,12 @@ int32_t RSRenderServiceConnectionProxy::SendRequest(uint32_t code, MessageParcel return Remote()->SendRequest(code, data, reply, option); } -ErrCode RSRenderServiceConnectionProxy::NotifyScreenSwitched() +ErrCode RSClientToServiceConnectionProxy::NotifyScreenSwitched() { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: Write InterfaceToken val err.", __func__); return ERR_INVALID_VALUE; } @@ -2856,12 +2856,12 @@ ErrCode RSRenderServiceConnectionProxy::NotifyScreenSwitched() } #ifdef RS_ENABLE_OVERLAY_DISPLAY -ErrCode RSRenderServiceConnectionProxy::SetOverlayDisplayMode(int32_t mode) +ErrCode RSClientToServiceConnectionProxy::SetOverlayDisplayMode(int32_t mode) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { ROSEN_LOGE("%{public}s: Write InterfaceToken val err.", __func__); return ERR_INVALID_VALUE; } @@ -2878,7 +2878,7 @@ ErrCode RSRenderServiceConnectionProxy::SetOverlayDisplayMode(int32_t mode) } int32_t result{0}; if (!reply.ReadInt32(result)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::SetOverlayDisplayMode Read result failed"); + ROSEN_LOGE("RSClientToServiceConnectionProxy::SetOverlayDisplayMode Read result failed"); return READ_PARCEL_ERR; } ROSEN_LOGI("%{public}s: mode:%{public}d, result:%{public}d.", __func__, mode, result); @@ -2886,14 +2886,14 @@ ErrCode RSRenderServiceConnectionProxy::SetOverlayDisplayMode(int32_t mode) } #endif -ErrCode RSRenderServiceConnectionProxy::NotifyPageName(const std::string &packageName, +ErrCode RSClientToServiceConnectionProxy::NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyPageName: write token err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyPageName: write token err."); return ERR_INVALID_VALUE; } option.SetFlags(MessageOption::TF_ASYNC); @@ -2901,25 +2901,25 @@ ErrCode RSRenderServiceConnectionProxy::NotifyPageName(const std::string &packag uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::NOTIFY_PAGE_NAME); int32_t err = Remote()->SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyPageName: Send Request err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyPageName: Send Request err."); return ERR_INVALID_VALUE; } } else { - ROSEN_LOGE("RSRenderServiceConnectionProxy::NotifyPageName: write data err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::NotifyPageName: write data err."); return ERR_INVALID_VALUE; } return ERR_OK; } -RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToServiceConnectionProxy::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& outFd) { const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_SERVICE_OPEN_FILE); MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerServiceOpenFile WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerServiceOpenFile WriteInterfaceToken err."); return RET_HRP_SERVICE_ERR_UNKNOWN; } option.SetFlags(MessageOption::TF_SYNC); @@ -2931,7 +2931,7 @@ RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServiceOpenFile(const int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerServiceOpenFile sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerServiceOpenFile sendrequest error : %{public}d", err); return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; } @@ -2949,7 +2949,7 @@ RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServiceOpenFile(const return (RetCodeHrpService)retCode; } -RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, +RetCodeHrpService RSClientToServiceConnectionProxy::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { const uint32_t code = @@ -2957,8 +2957,8 @@ RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles(c MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerServicePopulateFiles WriteInterfaceToken err."); return RET_HRP_SERVICE_ERR_UNKNOWN; } option.SetFlags(MessageOption::TF_SYNC); @@ -2969,7 +2969,7 @@ RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles(c int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerServicePopulateFiles sendrequest error : %{public}d", err); return RET_HRP_SERVICE_ERR_PROXY_SEND_REQUEST; } @@ -3001,38 +3001,38 @@ RetCodeHrpService RSRenderServiceConnectionProxy::ProfilerServicePopulateFiles(c return (RetCodeHrpService)retCode; } -bool RSRenderServiceConnectionProxy::ProfilerIsSecureScreen() +bool RSClientToServiceConnectionProxy::ProfilerIsSecureScreen() { const uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::PROFILER_IS_SECURE_SCREEN); MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerIsSecureScreen WriteInterfaceToken err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerIsSecureScreen WriteInterfaceToken err."); return false; } option.SetFlags(MessageOption::TF_SYNC); int32_t err = SendRequest(code, data, reply, option); if (err != ERR_NONE) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerIsSecureScreen sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerIsSecureScreen sendrequest error : %{public}d", err); return false; } bool retValue = false; if (!reply.ReadBool(retValue)) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ProfilerIsSecureScreen ReadBool err."); + ROSEN_LOGE("RSClientToServiceConnectionProxy::ProfilerIsSecureScreen ReadBool err."); return false; } return retValue; } -void RSRenderServiceConnectionProxy::ClearUifirstCache(NodeId id) +void RSClientToServiceConnectionProxy::ClearUifirstCache(NodeId id) { MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ClearUifirstCache: write token err."); + if (!data.WriteInterfaceToken(RSIClientToServiceConnection::GetDescriptor())) { + ROSEN_LOGE("RSClientToServiceConnectionProxy::ClearUifirstCache: write token err."); return; } option.SetFlags(MessageOption::TF_ASYNC); @@ -3043,7 +3043,7 @@ void RSRenderServiceConnectionProxy::ClearUifirstCache(NodeId id) uint32_t code = static_cast(RSIRenderServiceConnectionInterfaceCode::CLEAR_UIFIRST_CACHE); int32_t err = SendRequest(code, data, reply, option); if (err != NO_ERROR) { - ROSEN_LOGE("RSRenderServiceConnectionProxy::ClearUifirstCache sendrequest error : %{public}d", err); + ROSEN_LOGE("RSClientToServiceConnectionProxy::ClearUifirstCache sendrequest error : %{public}d", err); return; } } diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.h similarity index 93% rename from rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h rename to rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.h index fba4c90a6c..4ab33ba738 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_connection_proxy.h +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_client_to_service_connection_proxy.h @@ -13,22 +13,22 @@ * limitations under the License. */ -#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H -#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H +#ifndef ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_PROXY_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_PROXY_H #include "command/rs_node_showing_command.h" #include #include -#include +#include #include #include "sandbox_utils.h" namespace OHOS { namespace Rosen { -class RSRenderServiceConnectionProxy : public IRemoteProxy { +class RSClientToServiceConnectionProxy : public IRemoteProxy { public: - explicit RSRenderServiceConnectionProxy(const sptr& impl); - virtual ~RSRenderServiceConnectionProxy() noexcept = default; + explicit RSClientToServiceConnectionProxy(const sptr& impl); + virtual ~RSClientToServiceConnectionProxy() noexcept = default; ErrCode CommitTransaction(std::unique_ptr& transactionData) override; ErrCode ExecuteSynchronousTask(const std::shared_ptr& task) override; @@ -233,7 +233,7 @@ private: ErrCode SetOverlayDisplayMode(int32_t mode) override; #endif - static inline BrokerDelegator delegator_; + static inline BrokerDelegator delegator_; pid_t pid_ = GetRealPid(); uint32_t transactionDataIndex_ = 0; @@ -241,4 +241,4 @@ private: } // namespace Rosen } // namespace OHOS -#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_RENDER_SERVICE_CONNECTION_PROXY_H +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_CLIENT_TO_SERVICE_CONNECTION_PROXY_H diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp index b910ca0d83..0b73192d64 100644 --- a/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_service_client.cpp @@ -64,11 +64,11 @@ std::shared_ptr RSIRenderClient::CreateRenderServiceClient() void RSRenderServiceClient::CommitTransaction(std::unique_ptr& transactionData) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->CommitTransaction(transactionData); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->CommitTransaction(transactionData); } else { - RS_LOGE_LIMIT(__func__, __line__, "RSRenderServiceClient::CommitTransaction failed, renderService is nullptr"); + RS_LOGE_LIMIT(__func__, __line__, "RSRenderServiceClient::CommitTransaction failed, clientToService is nullptr"); } } @@ -78,85 +78,85 @@ void RSRenderServiceClient::ExecuteSynchronousTask(const std::shared_ptrExecuteSynchronousTask(task); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->ExecuteSynchronousTask(task); } } bool RSRenderServiceClient::GetUniRenderEnabled() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } bool enable; - return renderService->GetUniRenderEnabled(enable) == ERR_OK && enable; + return clientToService->GetUniRenderEnabled(enable) == ERR_OK && enable; } MemoryGraphic RSRenderServiceClient::GetMemoryGraphic(int pid) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return MemoryGraphic {}; } MemoryGraphic memoryGraphic; - renderService->GetMemoryGraphic(pid, memoryGraphic); + clientToService->GetMemoryGraphic(pid, memoryGraphic); return memoryGraphic; } std::vector RSRenderServiceClient::GetMemoryGraphics() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return {}; } std::vector memoryGraphics; - renderService->GetMemoryGraphics(memoryGraphics); + clientToService->GetMemoryGraphics(memoryGraphics); return memoryGraphics; } bool RSRenderServiceClient::GetTotalAppMemSize(float& cpuMemSize, float& gpuMemSize) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } - return renderService->GetTotalAppMemSize(cpuMemSize, gpuMemSize) == ERR_OK; + return clientToService->GetTotalAppMemSize(cpuMemSize, gpuMemSize) == ERR_OK; } bool RSRenderServiceClient::CreateNode(const RSDisplayNodeConfig& displayNodeConfig, NodeId nodeId) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } bool success; - renderService->CreateNode(displayNodeConfig, nodeId, success); + clientToService->CreateNode(displayNodeConfig, nodeId, success); return success; } bool RSRenderServiceClient::CreateNode(const RSSurfaceRenderNodeConfig& config) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } bool success; - renderService->CreateNode(config, success); + clientToService->CreateNode(config, success); return success; } std::shared_ptr RSRenderServiceClient::CreateNodeAndSurface(const RSSurfaceRenderNodeConfig& config, bool unobscured) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return nullptr; } sptr surface = nullptr; - ErrCode err = renderService->CreateNodeAndSurface(config, surface, unobscured); + ErrCode err = clientToService->CreateNodeAndSurface(config, surface, unobscured); if ((err != ERR_OK) || (surface == nullptr)) { ROSEN_LOGE("RSRenderServiceClient::CreateNodeAndSurface surface is nullptr."); return nullptr; @@ -195,14 +195,14 @@ std::shared_ptr RSRenderServiceClient::CreateVSyncReceiver( bool fromXcomponent) { ROSEN_LOGD("RSRenderServiceClient::CreateVSyncReceiver Start"); - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return nullptr; } sptr token = new IRemoteStub(); sptr conn = nullptr; VSyncConnParam vsyncConnParam = {id, windowNodeId, fromXcomponent}; - renderService->CreateVSyncConnection(conn, name, token, vsyncConnParam); + clientToService->CreateVSyncConnection(conn, name, token, vsyncConnParam); if (conn == nullptr) { ROSEN_LOGE("RSRenderServiceClient::CreateVSyncReceiver Failed"); return nullptr; @@ -212,20 +212,20 @@ std::shared_ptr RSRenderServiceClient::CreateVSyncReceiver( int32_t RSRenderServiceClient::GetPixelMapByProcessId(std::vector& pixelMapInfoVector, pid_t pid) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderService->GetPixelMapByProcessId(pixelMapInfoVector, pid, repCode); //TODO + clientToService->GetPixelMapByProcessId(pixelMapInfoVector, pid, repCode); //TODO return repCode; } std::shared_ptr RSRenderServiceClient::CreatePixelMapFromSurfaceId(uint64_t surfaceId, const Rect &srcRect) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return nullptr; } sptr surface = SurfaceUtils::GetInstance()->GetSurface(surfaceId); @@ -233,7 +233,7 @@ std::shared_ptr RSRenderServiceClient::CreatePixelMapFromSurfac return nullptr; } std::shared_ptr pixelMap = nullptr; - return renderProcess->CreatePixelMapFromSurface(surface, srcRect, pixelMap) == ERR_OK ? pixelMap : nullptr; + return clientToRender->CreatePixelMapFromSurface(surface, srcRect, pixelMap) == ERR_OK ? pixelMap : nullptr; } void RSRenderServiceClient::TriggerSurfaceCaptureCallback(NodeId id, const RSSurfaceCaptureConfig& captureConfig, @@ -307,9 +307,9 @@ bool RSRenderServiceClient::TakeSurfaceCapture(NodeId id, std::shared_ptrTakeSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig, blurParam, specifiedAreaRect); + clientToRender->TakeSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig, blurParam, specifiedAreaRect); return true; } std::vector>> RSRenderServiceClient::TakeSurfaceCaptureSoloNode( NodeId id, const RSSurfaceCaptureConfig& captureConfig) { - auto renderProcess = GetRenderProcessConnection(); + auto clientToRender = GetClientToRenderConnection(); std::vector>> pixelMapIdPairVector; - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeSurfaceCaptureSoloNode renderProcess == nullptr!"); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeSurfaceCaptureSoloNode clientToRender == nullptr!"); return pixelMapIdPairVector; } - pixelMapIdPairVector = renderProcess->TakeSurfaceCaptureSoloNode(id, captureConfig); + pixelMapIdPairVector = clientToRender->TakeSurfaceCaptureSoloNode(id, captureConfig); return pixelMapIdPairVector; } bool RSRenderServiceClient::TakeSelfSurfaceCapture(NodeId id, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeSelfSurfaceCapture renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeSelfSurfaceCapture clientToRender == nullptr!"); return false; } if (callback == nullptr) { @@ -375,7 +375,7 @@ bool RSRenderServiceClient::TakeSelfSurfaceCapture(NodeId id, std::shared_ptrTakeSelfSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig); + clientToRender->TakeSelfSurfaceCapture(id, surfaceCaptureCbDirector_, captureConfig); return true; } @@ -383,13 +383,13 @@ bool RSRenderServiceClient::SetWindowFreezeImmediately(NodeId id, bool isFreeze, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig, const RSSurfaceCaptureBlurParam& blurParam) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetWindowFreezeImmediately renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetWindowFreezeImmediately clientToRender == nullptr!"); return false; } if (!isFreeze) { - renderProcess->SetWindowFreezeImmediately(id, isFreeze, nullptr, captureConfig, blurParam); + clientToRender->SetWindowFreezeImmediately(id, isFreeze, nullptr, captureConfig, blurParam); return true; } if (callback == nullptr) { @@ -411,16 +411,16 @@ bool RSRenderServiceClient::SetWindowFreezeImmediately(NodeId id, bool isFreeze, if (surfaceCaptureCbDirector_ == nullptr) { surfaceCaptureCbDirector_ = new SurfaceCaptureCallbackDirector(this); } - renderProcess->SetWindowFreezeImmediately(id, isFreeze, surfaceCaptureCbDirector_, captureConfig, blurParam); + clientToRender->SetWindowFreezeImmediately(id, isFreeze, surfaceCaptureCbDirector_, captureConfig, blurParam); return true; } bool RSRenderServiceClient::TakeUICaptureInRange( NodeId id, std::shared_ptr callback, const RSSurfaceCaptureConfig& captureConfig) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::TakeUICaptureInRange renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::TakeUICaptureInRange clientToRender == nullptr!"); return false; } if (callback == nullptr) { @@ -443,65 +443,65 @@ bool RSRenderServiceClient::TakeUICaptureInRange( if (surfaceCaptureCbDirector_ == nullptr) { surfaceCaptureCbDirector_ = new SurfaceCaptureCallbackDirector(this); } - renderProcess->TakeUICaptureInRange(id, surfaceCaptureCbDirector_, captureConfig); + clientToRender->TakeUICaptureInRange(id, surfaceCaptureCbDirector_, captureConfig); return true; } bool RSRenderServiceClient::SetHwcNodeBounds(int64_t rsNodeId, float positionX, float positionY, float positionZ, float positionW) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - RS_LOGE("RSRenderServiceClient::SetHwcNodeBounds renderProcess is null!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + RS_LOGE("RSRenderServiceClient::SetHwcNodeBounds clientToRender is null!"); return false; } - renderProcess->SetHwcNodeBounds(rsNodeId, positionX, positionY, positionZ, positionW); + clientToRender->SetHwcNodeBounds(rsNodeId, positionX, positionY, positionZ, positionW); return true; } int32_t RSRenderServiceClient::SetFocusAppInfo(const FocusAppInfo& info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderProcess->SetFocusAppInfo(info, repCode); + clientToRender->SetFocusAppInfo(info, repCode); return repCode; } ScreenId RSRenderServiceClient::GetDefaultScreenId() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return INVALID_SCREEN_ID; } ScreenId screenId{INVALID_SCREEN_ID}; - renderService->GetDefaultScreenId(screenId); + clientToService->GetDefaultScreenId(screenId); return screenId; } ScreenId RSRenderServiceClient::GetActiveScreenId() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return INVALID_SCREEN_ID; } ScreenId screenId{INVALID_SCREEN_ID}; - renderService->GetActiveScreenId(screenId); + clientToService->GetActiveScreenId(screenId); return screenId; } std::vector RSRenderServiceClient::GetAllScreenIds() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return std::vector(); } - return renderService->GetAllScreenIds(); + return clientToService->GetAllScreenIds(); } ScreenId RSRenderServiceClient::CreateVirtualScreen( @@ -513,69 +513,69 @@ ScreenId RSRenderServiceClient::CreateVirtualScreen( int32_t flags, std::vector whiteList) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderService is null!", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s clientToService is null!", __func__); return INVALID_SCREEN_ID; } - return renderService->CreateVirtualScreen(name, width, height, surface, mirrorId, flags, whiteList); + return clientToService->CreateVirtualScreen(name, width, height, surface, mirrorId, flags, whiteList); } int32_t RSRenderServiceClient::SetVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s clientToRender is null!", __func__); return RENDER_SERVICE_NULL; } - return renderProcess->SetVirtualScreenBlackList(id, blackListVector); + return clientToRender->SetVirtualScreenBlackList(id, blackListVector); } int32_t RSRenderServiceClient::SetVirtualScreenTypeBlackList(ScreenId id, std::vector& typeBlackListVector) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t repCode; - renderProcess->SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); + clientToRender->SetVirtualScreenTypeBlackList(id, typeBlackListVector, repCode); return repCode; } int32_t RSRenderServiceClient::AddVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s clientToRender is null!", __func__); return RENDER_SERVICE_NULL; } int32_t repCode; - renderProcess->AddVirtualScreenBlackList(id, blackListVector, repCode); + clientToRender->AddVirtualScreenBlackList(id, blackListVector, repCode); return repCode; } int32_t RSRenderServiceClient::RemoveVirtualScreenBlackList(ScreenId id, std::vector& blackListVector) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - RS_LOGE("RSRenderServiceClient::%{public}s renderProcess is null!", __func__); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + RS_LOGE("RSRenderServiceClient::%{public}s clientToRender is null!", __func__); return RENDER_SERVICE_NULL; } int32_t repCode; - renderProcess->RemoveVirtualScreenBlackList(id, blackListVector, repCode); + clientToRender->RemoveVirtualScreenBlackList(id, blackListVector, repCode); return repCode; } bool RSRenderServiceClient::SetWatermark(const std::string& name, std::shared_ptr watermark) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return false; } bool success; - renderProcess->SetWatermark(name, watermark, success); + clientToRender->SetWatermark(name, watermark, success); return success; } @@ -583,85 +583,85 @@ int32_t RSRenderServiceClient::SetVirtualScreenSecurityExemptionList( ScreenId id, const std::vector& securityExemptionList) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); + return clientToRender->SetVirtualScreenSecurityExemptionList(id, securityExemptionList); } int32_t RSRenderServiceClient::SetScreenSecurityMask(ScreenId id, std::shared_ptr securityMask) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetScreenSecurityMask(id, std::move(securityMask)); + return clientToRender->SetScreenSecurityMask(id, std::move(securityMask)); } int32_t RSRenderServiceClient::SetMirrorScreenVisibleRect(ScreenId id, const Rect& mainScreenRect, bool supportRotation) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); + return clientToRender->SetMirrorScreenVisibleRect(id, mainScreenRect, supportRotation); } int32_t RSRenderServiceClient::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetCastScreenEnableSkipWindow(id, enable); + return clientToRender->SetCastScreenEnableSkipWindow(id, enable); } int32_t RSRenderServiceClient::SetVirtualScreenSurface(ScreenId id, sptr surface) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetVirtualScreenSurface(id, surface); + return clientToService->SetVirtualScreenSurface(id, surface); } void RSRenderServiceClient::RemoveVirtualScreen(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return; } - renderService->RemoveVirtualScreen(id); + clientToService->RemoveVirtualScreen(id); } #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR int32_t RSRenderServiceClient::SetPointerColorInversionConfig(float darkBuffer, float brightBuffer, int64_t interval, int32_t rangeSize) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); + return clientToRender->SetPointerColorInversionConfig(darkBuffer, brightBuffer, interval, rangeSize); } int32_t RSRenderServiceClient::SetPointerColorInversionEnabled(bool enable) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->SetPointerColorInversionEnabled(enable); + return clientToRender->SetPointerColorInversionEnabled(enable); } class CustomPointerLuminanceChangeCallback : public RSPointerLuminanceChangeCallbackStub @@ -683,22 +683,22 @@ private: int32_t RSRenderServiceClient::RegisterPointerLuminanceChangeCallback(const PointerLuminanceChangeCallback &callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } sptr cb = new CustomPointerLuminanceChangeCallback(callback); - return renderProcess->RegisterPointerLuminanceChangeCallback(cb); + return clientToRender->RegisterPointerLuminanceChangeCallback(cb); } int32_t RSRenderServiceClient::UnRegisterPointerLuminanceChangeCallback() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - return renderProcess->UnRegisterPointerLuminanceChangeCallback(); + return clientToRender->UnRegisterPointerLuminanceChangeCallback(); } #endif @@ -722,321 +722,321 @@ private: int32_t RSRenderServiceClient::SetScreenChangeCallback(const ScreenChangeCallback &callback) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is null", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::%{public}s clientToService is null", __func__); return RENDER_SERVICE_NULL; } screenChangeCb_ = new CustomScreenChangeCallback(callback); - return renderService->SetScreenChangeCallback(screenChangeCb_); + return clientToService->SetScreenChangeCallback(screenChangeCb_); } void RSRenderServiceClient::SetScreenActiveMode(ScreenId id, uint32_t modeId) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return; } - renderService->SetScreenActiveMode(id, modeId); + clientToService->SetScreenActiveMode(id, modeId); } void RSRenderServiceClient::SetScreenRefreshRate(ScreenId id, int32_t sceneId, int32_t rate) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return; } - renderService->SetScreenRefreshRate(id, sceneId, rate); + clientToService->SetScreenRefreshRate(id, sceneId, rate); } void RSRenderServiceClient::SetRefreshRateMode(int32_t refreshRateMode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return; } - renderService->SetRefreshRateMode(refreshRateMode); + clientToService->SetRefreshRateMode(refreshRateMode); } void RSRenderServiceClient::SyncFrameRateRange(FrameRateLinkerId id, const FrameRateRange& range, int32_t animatorExpectedFrameRate) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToRender == nullptr!"); return; } - return renderProcess->SyncFrameRateRange(id, range, animatorExpectedFrameRate); + return clientToRender->SyncFrameRateRange(id, range, animatorExpectedFrameRate); } void RSRenderServiceClient::UnregisterFrameRateLinker(FrameRateLinkerId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return; } - renderService->UnregisterFrameRateLinker(id); + clientToService->UnregisterFrameRateLinker(id); } uint32_t RSRenderServiceClient::GetScreenCurrentRefreshRate(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetScreenCurrentRefreshRate(id); + return clientToService->GetScreenCurrentRefreshRate(id); } int32_t RSRenderServiceClient::GetCurrentRefreshRateMode() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetCurrentRefreshRateMode(); + return clientToService->GetCurrentRefreshRateMode(); } std::vector RSRenderServiceClient::GetScreenSupportedRefreshRates(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return {}; } - return renderService->GetScreenSupportedRefreshRates(id); + return clientToService->GetScreenSupportedRefreshRates(id); } bool RSRenderServiceClient::GetShowRefreshRateEnabled() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return false; } bool enable = false; - renderService->GetShowRefreshRateEnabled(enable); + clientToService->GetShowRefreshRateEnabled(enable); return enable; } std::string RSRenderServiceClient::GetRefreshInfo(pid_t pid) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return ""; } std::string enable; - renderService->GetRefreshInfo(pid, enable); + clientToService->GetRefreshInfo(pid, enable); return enable; } std::string RSRenderServiceClient::GetRefreshInfoToSP(NodeId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return ""; } std::string enable; - renderService->GetRefreshInfoToSP(id, enable); + clientToService->GetRefreshInfoToSP(id, enable); return enable; } void RSRenderServiceClient::SetShowRefreshRateEnabled(bool enabled, int32_t type) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return; } - return renderService->SetShowRefreshRateEnabled(enabled, type); + return clientToService->SetShowRefreshRateEnabled(enabled, type); } uint32_t RSRenderServiceClient::GetRealtimeRefreshRate(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGW("RSRenderServiceClient renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGW("RSRenderServiceClient clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetRealtimeRefreshRate(id); + return clientToService->GetRealtimeRefreshRate(id); } int32_t RSRenderServiceClient::SetPhysicalScreenResolution(ScreenId id, uint32_t width, uint32_t height) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { ROSEN_LOGE("%{public}s: render service is null", __func__); return RENDER_SERVICE_NULL; } - return renderService->SetPhysicalScreenResolution(id, width, height); + return clientToService->SetPhysicalScreenResolution(id, width, height); } int32_t RSRenderServiceClient::SetVirtualScreenResolution(ScreenId id, uint32_t width, uint32_t height) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenResolution renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenResolution clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->SetVirtualScreenResolution(id, width, height); + return clientToService->SetVirtualScreenResolution(id, width, height); } RSVirtualScreenResolution RSRenderServiceClient::GetVirtualScreenResolution(ScreenId id) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RSVirtualScreenResolution {}; // return empty RSVirtualScreenResolution. } - return renderProcess->GetVirtualScreenResolution(id); + return clientToRender->GetVirtualScreenResolution(id); } void RSRenderServiceClient::MarkPowerOffNeedProcessOneFrame() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return; } - renderProcess->MarkPowerOffNeedProcessOneFrame(); + clientToRender->MarkPowerOffNeedProcessOneFrame(); } void RSRenderServiceClient::RepaintEverything() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RepaintEverything renderService is null, return"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RepaintEverything clientToService is null, return"); return; } - renderService->RepaintEverything(); + clientToService->RepaintEverything(); } void RSRenderServiceClient::ForceRefreshOneFrameWithNextVSync() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("ForceRefreshOneFrameWithNextVSync renderProcess is nullptr, return"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("ForceRefreshOneFrameWithNextVSync clientToRender is nullptr, return"); return; } - renderProcess->ForceRefreshOneFrameWithNextVSync(); + clientToRender->ForceRefreshOneFrameWithNextVSync(); } void RSRenderServiceClient::DisablePowerOffRenderControl(ScreenId id) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return; } - renderProcess->DisablePowerOffRenderControl(id); + clientToRender->DisablePowerOffRenderControl(id); } void RSRenderServiceClient::SetScreenPowerStatus(ScreenId id, ScreenPowerStatus status) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::%{public}s clientToService is nullptr", __func__); return; } - renderService->SetScreenPowerStatus(id, status); + clientToService->SetScreenPowerStatus(id, status); } RSScreenModeInfo RSRenderServiceClient::GetScreenActiveMode(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RSScreenModeInfo {}; // return empty RSScreenModeInfo. } RSScreenModeInfo screenModeInfo; - renderService->GetScreenActiveMode(id, screenModeInfo); + clientToService->GetScreenActiveMode(id, screenModeInfo); return screenModeInfo; } std::vector RSRenderServiceClient::GetScreenSupportedModes(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return {}; } - return renderService->GetScreenSupportedModes(id); + return clientToService->GetScreenSupportedModes(id); } RSScreenCapability RSRenderServiceClient::GetScreenCapability(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RSScreenCapability {}; } - return renderService->GetScreenCapability(id); + return clientToService->GetScreenCapability(id); } ScreenPowerStatus RSRenderServiceClient::GetScreenPowerStatus(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return ScreenPowerStatus::INVALID_POWER_STATUS; } uint32_t status {static_cast(ScreenPowerStatus::INVALID_POWER_STATUS)}; - renderService->GetScreenPowerStatus(id, status); + clientToService->GetScreenPowerStatus(id, status); return static_cast(status); } RSScreenData RSRenderServiceClient::GetScreenData(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RSScreenData {}; } - return renderService->GetScreenData(id); + return clientToService->GetScreenData(id); } int32_t RSRenderServiceClient::GetScreenBacklight(ScreenId id) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::%{public}s clientToService is nullptr", __func__); return INVALID_BACKLIGHT_VALUE; } int32_t backLightLevel = INVALID_BACKLIGHT_VALUE; - renderService->GetScreenBacklight(id, backLightLevel); + clientToService->GetScreenBacklight(id, backLightLevel); return backLightLevel; } void RSRenderServiceClient::SetScreenBacklight(ScreenId id, uint32_t level) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::%{public}s clientToService is nullptr", __func__); return; } - renderService->SetScreenBacklight(id, level); + clientToService->SetScreenBacklight(id, level); } class CustomBufferAvailableCallback : public RSBufferAvailableCallbackStub @@ -1076,8 +1076,8 @@ private: bool RSRenderServiceClient::RegisterBufferAvailableListener( NodeId id, const BufferAvailableCallback &callback, bool isFromRenderThread) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } std::lock_guard lock(mapMutex_); @@ -1094,7 +1094,7 @@ bool RSRenderServiceClient::RegisterBufferAvailableListener( } sptr bufferAvailableCb = new CustomBufferAvailableCallback(callback); - renderService->RegisterBufferAvailableListener(id, bufferAvailableCb, isFromRenderThread); + clientToService->RegisterBufferAvailableListener(id, bufferAvailableCb, isFromRenderThread); if (isFromRenderThread) { bufferAvailableCbRTMap_.emplace(id, bufferAvailableCb); } else { @@ -1105,12 +1105,12 @@ bool RSRenderServiceClient::RegisterBufferAvailableListener( bool RSRenderServiceClient::RegisterBufferClearListener(NodeId id, const BufferClearCallback& callback) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return false; } sptr bufferClearCb = new CustomBufferClearCallback(callback); - renderService->RegisterBufferClearListener(id, bufferClearCb); + clientToService->RegisterBufferClearListener(id, bufferClearCb); return true; } @@ -1137,183 +1137,183 @@ bool RSRenderServiceClient::UnregisterBufferAvailableListener(NodeId id) int32_t RSRenderServiceClient::GetScreenSupportedColorGamuts(ScreenId id, std::vector& mode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->GetScreenSupportedColorGamuts(id, mode); + return clientToService->GetScreenSupportedColorGamuts(id, mode); } int32_t RSRenderServiceClient::GetScreenSupportedMetaDataKeys(ScreenId id, std::vector& keys) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RequestRotation renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RequestRotation clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetScreenSupportedMetaDataKeys(id, keys); + return clientToService->GetScreenSupportedMetaDataKeys(id, keys); } int32_t RSRenderServiceClient::GetScreenColorGamut(ScreenId id, ScreenColorGamut& mode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->GetScreenColorGamut(id, mode); + return clientToService->GetScreenColorGamut(id, mode); } int32_t RSRenderServiceClient::SetScreenColorGamut(ScreenId id, int32_t modeIdx) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetScreenColorGamut(id, modeIdx); + return clientToService->SetScreenColorGamut(id, modeIdx); } int32_t RSRenderServiceClient::SetScreenGamutMap(ScreenId id, ScreenGamutMap mode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetScreenGamutMap(id, mode); + return clientToService->SetScreenGamutMap(id, mode); } int32_t RSRenderServiceClient::SetScreenCorrection(ScreenId id, ScreenRotation screenRotation) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetScreenCorrection(id, screenRotation); + return clientToService->SetScreenCorrection(id, screenRotation); } bool RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation(ScreenId id, bool canvasRotation) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation: renderProcess is nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenCanvasRotation: clientToRender is nullptr"); return false; } - return renderProcess->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); + return clientToRender->SetVirtualMirrorScreenCanvasRotation(id, canvasRotation); } int32_t RSRenderServiceClient::SetVirtualScreenAutoRotation(ScreenId id, bool isAutoRotation) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenAutoRotation: renderProcess is nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualScreenAutoRotation: clientToRender is nullptr"); return RENDER_SERVICE_NULL; } - return renderProcess->SetVirtualScreenAutoRotation(id, isAutoRotation); + return clientToRender->SetVirtualScreenAutoRotation(id, isAutoRotation); } bool RSRenderServiceClient::SetVirtualMirrorScreenScaleMode(ScreenId id, ScreenScaleMode scaleMode) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenScaleMode: renderProcess is nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetVirtualMirrorScreenScaleMode: clientToRender is nullptr"); return false; } - return renderProcess->SetVirtualMirrorScreenScaleMode(id, scaleMode); + return clientToRender->SetVirtualMirrorScreenScaleMode(id, scaleMode); } bool RSRenderServiceClient::SetGlobalDarkColorMode(bool isDark) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetGlobalDarkColorMode: renderService is nullptr"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetGlobalDarkColorMode: clientToService is nullptr"); return false; } - return renderService->SetGlobalDarkColorMode(isDark) == ERR_OK; + return clientToService->SetGlobalDarkColorMode(isDark) == ERR_OK; } int32_t RSRenderServiceClient::GetScreenGamutMap(ScreenId id, ScreenGamutMap& mode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->GetScreenGamutMap(id, mode); + return clientToService->GetScreenGamutMap(id, mode); } int32_t RSRenderServiceClient::GetScreenHDRCapability(ScreenId id, RSScreenHDRCapability& screenHdrCapability) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetScreenHDRCapability renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetScreenHDRCapability clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } - return renderProcess->GetScreenHDRCapability(id, screenHdrCapability); + return clientToRender->GetScreenHDRCapability(id, screenHdrCapability); } int32_t RSRenderServiceClient::GetPixelFormat(ScreenId id, GraphicPixelFormat& pixelFormat) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetPixelFormat renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetPixelFormat clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } int32_t resCode; - renderProcess->GetPixelFormat(id, pixelFormat, resCode); + clientToRender->GetPixelFormat(id, pixelFormat, resCode); return resCode; } int32_t RSRenderServiceClient::SetPixelFormat(ScreenId id, GraphicPixelFormat pixelFormat) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetPixelFormat renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetPixelFormat clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } int32_t resCode; - renderProcess->SetPixelFormat(id, pixelFormat, resCode); + clientToRender->SetPixelFormat(id, pixelFormat, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenSupportedHDRFormats(ScreenId id, std::vector& hdrFormats) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderProcess->GetScreenSupportedHDRFormats(id, hdrFormats, resCode); + clientToRender->GetScreenSupportedHDRFormats(id, hdrFormats, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenHDRFormat(ScreenId id, ScreenHDRFormat& hdrFormat) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderProcess->GetScreenHDRFormat(id, hdrFormat, resCode); + clientToRender->GetScreenHDRFormat(id, hdrFormat, resCode); return resCode; } int32_t RSRenderServiceClient::SetScreenHDRFormat(ScreenId id, int32_t modeIdx) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderProcess->SetScreenHDRFormat(id, modeIdx, resCode); + clientToRender->SetScreenHDRFormat(id, modeIdx, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrStatus) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - auto err = renderService->GetScreenHDRStatus(id, hdrStatus, resCode); + auto err = clientToService->GetScreenHDRStatus(id, hdrStatus, resCode); if (err != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::GetScreenHDRStatus err(%{public}d)!", err); resCode = err; @@ -1324,77 +1324,77 @@ int32_t RSRenderServiceClient::GetScreenHDRStatus(ScreenId id, HdrStatus& hdrSta int32_t RSRenderServiceClient::GetScreenSupportedColorSpaces( ScreenId id, std::vector& colorSpaces) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->GetScreenSupportedColorSpaces(id, colorSpaces, resCode); + clientToService->GetScreenSupportedColorSpaces(id, colorSpaces, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType& colorSpace) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->GetScreenColorSpace(id, colorSpace, resCode); + clientToService->GetScreenColorSpace(id, colorSpace, resCode); return resCode; } int32_t RSRenderServiceClient::SetScreenColorSpace(ScreenId id, GraphicCM_ColorSpaceType colorSpace) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } int32_t resCode; - renderService->SetScreenColorSpace(id, colorSpace, resCode); + clientToService->SetScreenColorSpace(id, colorSpace, resCode); return resCode; } int32_t RSRenderServiceClient::GetScreenType(ScreenId id, RSScreenType& screenType) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetScreenType renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetScreenType clientToService == nullptr!"); return RENDER_SERVICE_NULL; } - return renderService->GetScreenType(id, screenType); + return clientToService->GetScreenType(id, screenType); } bool RSRenderServiceClient::GetBitmap(NodeId id, Drawing::Bitmap& bitmap) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetBitmap renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetBitmap clientToService == nullptr!"); return false; } bool success; - renderService->GetBitmap(id, bitmap, success); + clientToService->GetBitmap(id, bitmap, success); return success; } bool RSRenderServiceClient::GetPixelmap(NodeId id, std::shared_ptr pixelmap, const Drawing::Rect* rect, std::shared_ptr drawCmdList) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::GetPixelmap: renderService is nullptr"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::GetPixelmap: clientToService is nullptr"); return false; } bool success; - renderService->GetPixelmap(id, pixelmap, rect, drawCmdList, success); + clientToService->GetPixelmap(id, pixelmap, rect, drawCmdList, success); return success; } bool RSRenderServiceClient::RegisterTypeface(std::shared_ptr& typeface) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterTypeface: renderProcess is nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterTypeface: clientToRender is nullptr"); return false; } uint64_t globalUniqueId = RSTypefaceCache::GenGlobalUniqueId(typeface->GetUniqueID()); @@ -1402,82 +1402,82 @@ bool RSRenderServiceClient::RegisterTypeface(std::shared_ptr& RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); // timer: 3s OHOS::Rosen::RSXCollie registerTypefaceXCollie("registerTypefaceXCollie_" + typeface->GetFamilyName(), 3); - return renderProcess->RegisterTypeface(globalUniqueId, typeface); + return clientToRender->RegisterTypeface(globalUniqueId, typeface); } bool RSRenderServiceClient::UnRegisterTypeface(std::shared_ptr& typeface) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnRegisterTypeface: renderProcess is nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnRegisterTypeface: clientToRender is nullptr"); return false; } uint64_t globalUniqueId = RSTypefaceCache::GenGlobalUniqueId(typeface->GetUniqueID()); ROSEN_LOGD("RSRenderServiceClient::UnRegisterTypeface: pid[%{public}d] unregister typface[%{public}u]", RSTypefaceCache::GetTypefacePid(globalUniqueId), RSTypefaceCache::GetTypefaceId(globalUniqueId)); - return renderProcess->UnRegisterTypeface(globalUniqueId); + return clientToRender->UnRegisterTypeface(globalUniqueId); } int32_t RSRenderServiceClient::GetDisplayIdentificationData(ScreenId id, uint8_t& outPort, std::vector& edidData) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->GetDisplayIdentificationData(id, outPort, edidData); + return clientToService->GetDisplayIdentificationData(id, outPort, edidData); } int32_t RSRenderServiceClient::SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFrameInterval) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } int32_t statusCode = SUCCESS; - renderProcess->SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode); + clientToRender->SetScreenSkipFrameInterval(id, skipFrameInterval, statusCode); return statusCode; } int32_t RSRenderServiceClient::SetVirtualScreenRefreshRate( ScreenId id, uint32_t maxRefreshRate, uint32_t& actualRefreshRate) { - auto renderProcess = GetRenderProcessConnection(); + auto clientToRender = GetClientToRenderConnection(); int32_t resCode = RENDER_SERVICE_NULL; - if (renderProcess == nullptr) { + if (clientToRender == nullptr) { return RENDER_SERVICE_NULL; } - renderProcess->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, resCode); + clientToRender->SetVirtualScreenRefreshRate(id, maxRefreshRate, actualRefreshRate, resCode); return resCode; } uint32_t RSRenderServiceClient::SetScreenActiveRect(ScreenId id, const Rect& activeRect) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } uint32_t repCode; - return renderService->SetScreenActiveRect(id, activeRect, repCode); + return clientToService->SetScreenActiveRect(id, activeRect, repCode); return repCode; } void RSRenderServiceClient::SetScreenOffset(ScreenId id, int32_t offSetX, int32_t offSetY) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return; } - renderService->SetScreenOffset(id, offSetX, offSetY); + clientToService->SetScreenOffset(id, offSetX, offSetY); } void RSRenderServiceClient::SetScreenFrameGravity(ScreenId id, int32_t gravity) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return; } - renderService->SetScreenFrameGravity(id, gravity); + clientToService->SetScreenFrameGravity(id, gravity); } class CustomOcclusionChangeCallback : public RSOcclusionChangeCallbackStub @@ -1499,14 +1499,14 @@ private: int32_t RSRenderServiceClient::RegisterOcclusionChangeCallback(const OcclusionChangeCallback& callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterOcclusionChangeCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterOcclusionChangeCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomOcclusionChangeCallback(callback); int32_t repCode; - renderProcess->RegisterOcclusionChangeCallback(cb, repCode); + clientToRender->RegisterOcclusionChangeCallback(cb, repCode); return repCode; } @@ -1530,23 +1530,23 @@ private: int32_t RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback( NodeId id, const SurfaceOcclusionChangeCallback& callback, std::vector& partitionPoints) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceOcclusionChangeCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomSurfaceOcclusionChangeCallback(callback); - return renderProcess->RegisterSurfaceOcclusionChangeCallback(id, cb, partitionPoints); + return clientToRender->RegisterSurfaceOcclusionChangeCallback(id, cb, partitionPoints); } int32_t RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback(NodeId id) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnRegisterSurfaceOcclusionChangeCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } - return renderProcess->UnRegisterSurfaceOcclusionChangeCallback(id); + return clientToRender->UnRegisterSurfaceOcclusionChangeCallback(id); } class CustomHgmConfigChangeCallback : public RSHgmConfigChangeCallbackStub @@ -1575,13 +1575,13 @@ private: int32_t RSRenderServiceClient::RegisterHgmConfigChangeCallback(const HgmConfigChangeCallback& callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmConfigChangeCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmConfigChangeCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomHgmConfigChangeCallback(callback); - return renderProcess->RegisterHgmConfigChangeCallback(cb); + return clientToRender->RegisterHgmConfigChangeCallback(cb); } class CustomHgmRefreshRateModeChangeCallback : public RSHgmConfigChangeCallbackStub @@ -1611,13 +1611,13 @@ private: int32_t RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback( const HgmRefreshRateModeChangeCallback& callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateModeChangeCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomHgmRefreshRateModeChangeCallback(callback); - return renderProcess->RegisterHgmRefreshRateModeChangeCallback(cb); + return clientToRender->RegisterHgmRefreshRateModeChangeCallback(cb); } class CustomHgmRefreshRateUpdateCallback : public RSHgmConfigChangeCallbackStub @@ -1650,9 +1650,9 @@ int32_t RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback( const HgmRefreshRateUpdateCallback& callback) { sptr cb = nullptr; - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } @@ -1661,7 +1661,7 @@ int32_t RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterHgmRefreshRateUpdateCallback called"); - return renderProcess->RegisterHgmRefreshRateUpdateCallback(cb); + return clientToRender->RegisterHgmRefreshRateUpdateCallback(cb); } class CustomFirstFrameCommitCallback : public RSFirstFrameCommitCallbackStub @@ -1686,9 +1686,9 @@ int32_t RSRenderServiceClient::RegisterFirstFrameCommitCallback( const FirstFrameCommitCallback& callback) { sptr cb = nullptr; - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterFirstFrameCommitCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterFirstFrameCommitCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } @@ -1697,7 +1697,7 @@ int32_t RSRenderServiceClient::RegisterFirstFrameCommitCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterFirstFrameCommitCallback called"); - return renderProcess->RegisterFirstFrameCommitCallback(cb); + return clientToRender->RegisterFirstFrameCommitCallback(cb); } class CustomFrameRateLinkerExpectedFpsUpdateCallback : public RSFrameRateLinkerExpectedFpsUpdateCallbackStub @@ -1723,9 +1723,9 @@ private: int32_t RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback( int32_t dstPid, const FrameRateLinkerExpectedFpsUpdateCallback& callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback renderProcess == nullptr"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback clientToRender == nullptr"); return RENDER_SERVICE_NULL; } @@ -1735,120 +1735,120 @@ int32_t RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback( } ROSEN_LOGD("RSRenderServiceClient::RegisterFrameRateLinkerExpectedFpsUpdateCallback called"); - return renderProcess->RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, cb); + return clientToRender->RegisterFrameRateLinkerExpectedFpsUpdateCallback(dstPid, cb); } void RSRenderServiceClient::SetAppWindowNum(uint32_t num) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetAppWindowNum(num); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetAppWindowNum(num); } } bool RSRenderServiceClient::SetSystemAnimatedScenes(SystemAnimatedScenes systemAnimatedScenes, bool isRegularAnimation) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetSystemAnimatedScenes renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetSystemAnimatedScenes clientToRender == nullptr!"); return false; } bool success; - renderProcess->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation, success); + clientToRender->SetSystemAnimatedScenes(systemAnimatedScenes, isRegularAnimation, success); return success; } void RSRenderServiceClient::ShowWatermark(const std::shared_ptr &watermarkImg, bool isShow) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ShowWatermark(watermarkImg, isShow); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ShowWatermark(watermarkImg, isShow); } } int32_t RSRenderServiceClient::ResizeVirtualScreen(ScreenId id, uint32_t width, uint32_t height) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::ResizeVirtualScreen renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::ResizeVirtualScreen clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } ROSEN_LOGI("RSRenderServiceClient::ResizeVirtualScreen, width:%{public}u, height:%{public}u", width, height); - return renderProcess->ResizeVirtualScreen(id, width, height); + return clientToRender->ResizeVirtualScreen(id, width, height); } void RSRenderServiceClient::ReportJankStats() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportJankStats(); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportJankStats(); } } void RSRenderServiceClient::ReportEventResponse(DataBaseRs info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportEventResponse(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportEventResponse(info); } } void RSRenderServiceClient::ReportEventComplete(DataBaseRs info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportEventComplete(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportEventComplete(info); } } void RSRenderServiceClient::ReportEventJankFrame(DataBaseRs info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportEventJankFrame(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportEventJankFrame(info); } } void RSRenderServiceClient::ReportRsSceneJankStart(AppInfo info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportRsSceneJankStart(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportRsSceneJankStart(info); } } void RSRenderServiceClient::ReportRsSceneJankEnd(AppInfo info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportRsSceneJankEnd(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportRsSceneJankEnd(info); } } void RSRenderServiceClient::ReportGameStateData(GameStateData info) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->ReportGameStateData(info); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->ReportGameStateData(info); } } void RSRenderServiceClient::SetHardwareEnabled(NodeId id, bool isEnabled, SelfDrawingNodeType selfDrawingType, bool dynamicHardwareEnable) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->SetHardwareEnabled(id, isEnabled, selfDrawingType, dynamicHardwareEnable); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->SetHardwareEnabled(id, isEnabled, selfDrawingType, dynamicHardwareEnable); } } uint32_t RSRenderServiceClient::SetHidePrivacyContent(NodeId id, bool needHidePrivacyContent) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { uint32_t resCode; - renderService->SetHidePrivacyContent(id, needHidePrivacyContent, resCode); + clientToService->SetHidePrivacyContent(id, needHidePrivacyContent, resCode); return resCode; } return static_cast(RSInterfaceErrorCode::UNKNOWN_ERROR); @@ -1856,155 +1856,155 @@ uint32_t RSRenderServiceClient::SetHidePrivacyContent(NodeId id, bool needHidePr void RSRenderServiceClient::NotifyLightFactorStatus(int32_t lightFactorStatus) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->NotifyLightFactorStatus(lightFactorStatus); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->NotifyLightFactorStatus(lightFactorStatus); } } void RSRenderServiceClient::NotifyPackageEvent(uint32_t listSize, const std::vector& packageList) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->NotifyPackageEvent(listSize, packageList); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->NotifyPackageEvent(listSize, packageList); } } void RSRenderServiceClient::NotifyAppStrategyConfigChangeEvent(const std::string& pkgName, uint32_t listSize, const std::vector>& newConfig) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->NotifyAppStrategyConfigChangeEvent(pkgName, listSize, newConfig); } } void RSRenderServiceClient::NotifyRefreshRateEvent(const EventInfo& eventInfo) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->NotifyRefreshRateEvent(eventInfo); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->NotifyRefreshRateEvent(eventInfo); } } void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->SetWindowExpectedRefreshRate(eventInfos); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->SetWindowExpectedRefreshRate(eventInfos); } } void RSRenderServiceClient::SetWindowExpectedRefreshRate(const std::unordered_map& eventInfos) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->SetWindowExpectedRefreshRate(eventInfos); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->SetWindowExpectedRefreshRate(eventInfos); } } bool RSRenderServiceClient::NotifySoftVsyncRateDiscountEvent(uint32_t pid, const std::string &name, uint32_t rateDiscount) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - return renderProcess->NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + return clientToRender->NotifySoftVsyncRateDiscountEvent(pid, name, rateDiscount); } return false; } void RSRenderServiceClient::NotifyHgmConfigEvent(const std::string &eventName, bool state) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->NotifyHgmConfigEvent(eventName, state); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->NotifyHgmConfigEvent(eventName, state); } } void RSRenderServiceClient::NotifyXComponentExpectedFrameRate(const std::string& id, int32_t expectedFrameRate) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->NotifyXComponentExpectedFrameRate(id, expectedFrameRate); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->NotifyXComponentExpectedFrameRate(id, expectedFrameRate); } } void RSRenderServiceClient::NotifyTouchEvent(int32_t touchStatus, int32_t touchCnt) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->NotifyTouchEvent(touchStatus, touchCnt); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->NotifyTouchEvent(touchStatus, touchCnt); } } void RSRenderServiceClient::NotifyDynamicModeEvent(bool enableDynamicMode) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->NotifyDynamicModeEvent(enableDynamicMode); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->NotifyDynamicModeEvent(enableDynamicMode); } } void RSRenderServiceClient::SetCacheEnabledForRotation(bool isEnabled) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetCacheEnabledForRotation(isEnabled); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetCacheEnabledForRotation(isEnabled); } } void RSRenderServiceClient::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetOnRemoteDiedCallback(callback); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetOnRemoteDiedCallback(callback); } } std::vector RSRenderServiceClient::GetActiveDirtyRegionInfo() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return {}; } - return renderProcess->GetActiveDirtyRegionInfo(); + return clientToRender->GetActiveDirtyRegionInfo(); } GlobalDirtyRegionInfo RSRenderServiceClient::GetGlobalDirtyRegionInfo() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return GlobalDirtyRegionInfo {}; } - return renderProcess->GetGlobalDirtyRegionInfo(); + return clientToRender->GetGlobalDirtyRegionInfo(); } LayerComposeInfo RSRenderServiceClient::GetLayerComposeInfo() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return LayerComposeInfo {}; } - return renderService->GetLayerComposeInfo(); + return clientToService->GetLayerComposeInfo(); } HwcDisabledReasonInfos RSRenderServiceClient::GetHwcDisabledReasonInfo() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return {}; } - return renderService->GetHwcDisabledReasonInfo(); + return clientToService->GetHwcDisabledReasonInfo(); } int64_t RSRenderServiceClient::GetHdrOnDuration() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return 0; } int64_t hdrOnDuration = 0; - auto ret = renderProcess->GetHdrOnDuration(hdrOnDuration); + auto ret = clientToRender->GetHdrOnDuration(hdrOnDuration); if (ret != ERR_OK) { ROSEN_LOGE("Failed to get HdrOnDuration, ret=%{public}d", ret); } @@ -2013,46 +2013,46 @@ int64_t RSRenderServiceClient::GetHdrOnDuration() void RSRenderServiceClient::SetVmaCacheStatus(bool flag) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { return; } - renderProcess->SetVmaCacheStatus(flag); + clientToRender->SetVmaCacheStatus(flag); } #ifdef TP_FEATURE_ENABLE void RSRenderServiceClient::SetTpFeatureConfig(int32_t feature, const char* config, TpFeatureConfigType tpFeatureConfigType) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return; } - renderService->SetTpFeatureConfig(feature, config, tpFeatureConfigType); + clientToService->SetTpFeatureConfig(feature, config, tpFeatureConfigType); } #endif void RSRenderServiceClient::SetVirtualScreenUsingStatus(bool isVirtualScreenUsingStatus) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetVirtualScreenUsingStatus(isVirtualScreenUsingStatus); } } void RSRenderServiceClient::SetCurtainScreenUsingStatus(bool isCurtainScreenOn) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetCurtainScreenUsingStatus(isCurtainScreenOn); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetCurtainScreenUsingStatus(isCurtainScreenOn); } } void RSRenderServiceClient::DropFrameByPid(const std::vector pidList) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->DropFrameByPid(pidList); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->DropFrameByPid(pidList); } } @@ -2076,45 +2076,45 @@ private: int32_t RSRenderServiceClient::RegisterUIExtensionCallback(uint64_t userId, const UIExtensionCallback& callback, bool unobscured) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterUIExtensionCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterUIExtensionCallback clientToRender == nullptr!"); return RENDER_SERVICE_NULL; } sptr cb = new CustomUIExtensionCallback(callback); - return renderProcess->RegisterUIExtensionCallback(userId, cb, unobscured); + return clientToRender->RegisterUIExtensionCallback(userId, cb, unobscured); } bool RSRenderServiceClient::SetAncoForceDoDirect(bool direct) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { bool res; - renderProcess->SetAncoForceDoDirect(direct, res); + clientToRender->SetAncoForceDoDirect(direct, res); return res; } - ROSEN_LOGE("RSRenderServiceClient::SetAncoForceDoDirect renderProcess is null"); + ROSEN_LOGE("RSRenderServiceClient::SetAncoForceDoDirect clientToRender is null"); return false; } bool RSRenderServiceClient::SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus) { - auto renderProcess = GetRenderProcessConnection(); + auto clientToRender = GetClientToRenderConnection(); bool success = false; - if (renderProcess != nullptr) { - renderProcess->SetVirtualScreenStatus(id, screenStatus, success); + if (clientToRender != nullptr) { + clientToRender->SetVirtualScreenStatus(id, screenStatus, success); } return success; } void RSRenderServiceClient::SetFreeMultiWindowStatus(bool enable) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::SetFreeMultiWindowStatus renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::SetFreeMultiWindowStatus clientToRender == nullptr!"); return; } - renderProcess->SetFreeMultiWindowStatus(enable); + clientToRender->SetFreeMultiWindowStatus(enable); } class SurfaceBufferCallbackDirector : public RSSurfaceBufferCallbackStub { @@ -2138,9 +2138,9 @@ private: bool RSRenderServiceClient::RegisterSurfaceBufferCallback( pid_t pid, uint64_t uid, std::shared_ptr callback) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceBufferCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterSurfaceBufferCallback clientToRender == nullptr!"); return false; } if (callback == nullptr) { @@ -2160,15 +2160,15 @@ bool RSRenderServiceClient::RegisterSurfaceBufferCallback( surfaceBufferCbDirector_ = new SurfaceBufferCallbackDirector(this); } } - renderProcess->RegisterSurfaceBufferCallback(pid, uid, surfaceBufferCbDirector_); + clientToRender->RegisterSurfaceBufferCallback(pid, uid, surfaceBufferCbDirector_); return true; } bool RSRenderServiceClient::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t uid) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnregisterSurfaceBufferCallback renderProcess == nullptr!"); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnregisterSurfaceBufferCallback clientToRender == nullptr!"); return false; } { @@ -2180,7 +2180,7 @@ bool RSRenderServiceClient::UnregisterSurfaceBufferCallback(pid_t pid, uint64_t } surfaceBufferCallbacks_.erase(iter); } - renderProcess->UnregisterSurfaceBufferCallback(pid, uid); + clientToRender->UnregisterSurfaceBufferCallback(pid, uid); return true; } @@ -2216,25 +2216,25 @@ void RSRenderServiceClient::TriggerOnAfterAcquireBuffer(const AfterAcquireBuffer void RSRenderServiceClient::SetLayerTopForHWC(NodeId nodeId, bool isTop, uint32_t zOrder) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->SetLayerTopForHWC(nodeId, isTop, zOrder); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->SetLayerTopForHWC(nodeId, isTop, zOrder); } } void RSRenderServiceClient::SetLayerTop(const std::string &nodeIdStr, bool isTop) { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - renderService->SetLayerTop(nodeIdStr, isTop); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + clientToService->SetLayerTop(nodeIdStr, isTop); } } void RSRenderServiceClient::SetForceRefresh(const std::string &nodeIdStr, bool isForceRefresh) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetForceRefresh(nodeIdStr, isForceRefresh); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetForceRefresh(nodeIdStr, isForceRefresh); } } @@ -2256,9 +2256,9 @@ private: bool RSRenderServiceClient::RegisterTransactionDataCallback(uint64_t token, uint64_t timeStamp, std::function callback) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterTransactionDataCallback renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterTransactionDataCallback clientToService == nullptr!"); return false; } if (callback == nullptr) { @@ -2280,7 +2280,7 @@ bool RSRenderServiceClient::RegisterTransactionDataCallback(uint64_t token, uint } RS_LOGD("RSRenderServiceClient::RegisterTransactionDataCallback, timeStamp: %{public}" PRIu64 " token: %{public}" PRIu64, timeStamp, token); - renderService->RegisterTransactionDataCallback(token, timeStamp, transactionDataCbDirector_); + clientToService->RegisterTransactionDataCallback(token, timeStamp, transactionDataCbDirector_); return true; } @@ -2304,27 +2304,27 @@ void RSRenderServiceClient::TriggerTransactionDataCallbackAndErase(uint64_t toke void RSRenderServiceClient::SetColorFollow(const std::string &nodeIdStr, bool isColorFollow) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetColorFollow(nodeIdStr, isColorFollow); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetColorFollow(nodeIdStr, isColorFollow); } } void RSRenderServiceClient::NotifyScreenSwitched() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::%{public}s renderService is nullptr", __func__); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::%{public}s clientToService is nullptr", __func__); return; } - renderService->NotifyScreenSwitched(); + clientToService->NotifyScreenSwitched(); } void RSRenderServiceClient::SetWindowContainer(NodeId nodeId, bool value) { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - renderProcess->SetWindowContainer(nodeId, value); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + clientToRender->SetWindowContainer(nodeId, value); } } @@ -2349,9 +2349,9 @@ private: int32_t RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback( const RectConstraint& constraint, const SelfDrawingNodeRectChangeCallback& callback) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback renderService == nullptr"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback clientToService == nullptr"); return RENDER_SERVICE_NULL; } @@ -2360,57 +2360,57 @@ int32_t RSRenderServiceClient::RegisterSelfDrawingNodeRectChangeCallback( cb = new CustomSelfDrawingNodeRectChangeCallback(callback); } - return renderService->RegisterSelfDrawingNodeRectChangeCallback(constraint, cb); + return clientToService->RegisterSelfDrawingNodeRectChangeCallback(constraint, cb); } int32_t RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback() { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback renderService == nullptr"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::UnRegisterSelfDrawingNodeRectChangeCallback clientToService == nullptr"); return RENDER_SERVICE_NULL; } - return renderService->UnRegisterSelfDrawingNodeRectChangeCallback(); + return clientToService->UnRegisterSelfDrawingNodeRectChangeCallback(); } #ifdef RS_ENABLE_OVERLAY_DISPLAY int32_t RSRenderServiceClient::SetOverlayDisplayMode(int32_t mode) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RENDER_SERVICE_NULL; } - return renderService->SetOverlayDisplayMode(mode); + return clientToService->SetOverlayDisplayMode(mode); } #endif void RSRenderServiceClient::NotifyPageName(const std::string &packageName, const std::string &pageName, bool isEnter) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { - ROSEN_LOGE("RSRenderServiceClient::NotifyPageName renderService == nullptr!"); + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { + ROSEN_LOGE("RSRenderServiceClient::NotifyPageName clientToService == nullptr!"); return; } - renderService->NotifyPageName(packageName, pageName, isEnter); + clientToService->NotifyPageName(packageName, pageName, isEnter); } bool RSRenderServiceClient::GetHighContrastTextState() { - auto renderProcess = GetRenderProcessConnection(); - if (renderProcess != nullptr) { - return renderProcess->GetHighContrastTextState(); + auto clientToRender = GetClientToRenderConnection(); + if (clientToRender != nullptr) { + return clientToRender->GetHighContrastTextState(); } return false; } bool RSRenderServiceClient::SetBehindWindowFilterEnabled(bool enabled) { - auto renderProcess = GetRenderProcessConnection(); - if (!renderProcess) { + auto clientToRender = GetClientToRenderConnection(); + if (!clientToRender) { return false; } - auto ret = renderProcess->SetBehindWindowFilterEnabled(enabled); + auto ret = clientToRender->SetBehindWindowFilterEnabled(enabled); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::SetBehindWindowFilterEnabled fail, ret[%{public}d]", ret); return false; @@ -2420,11 +2420,11 @@ bool RSRenderServiceClient::SetBehindWindowFilterEnabled(bool enabled) bool RSRenderServiceClient::GetBehindWindowFilterEnabled(bool& enabled) { - auto renderProcess = GetRenderProcessConnection(); - if (!renderProcess) { + auto clientToRender = GetClientToRenderConnection(); + if (!clientToRender) { return false; } - auto ret = renderProcess->GetBehindWindowFilterEnabled(enabled); + auto ret = clientToRender->GetBehindWindowFilterEnabled(enabled); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::GetBehindWindowFilterEnabled fail, ret[%{public}d]", ret); return false; @@ -2434,11 +2434,11 @@ bool RSRenderServiceClient::GetBehindWindowFilterEnabled(bool& enabled) int32_t RSRenderServiceClient::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) { - auto renderProcess = GetRenderProcessConnection(); - if (!renderProcess) { + auto clientToRender = GetClientToRenderConnection(); + if (!clientToRender) { return ERR_INVALID_DATA; } - auto ret = renderProcess->GetPidGpuMemoryInMB(pid, gpuMemInMB); + auto ret = clientToRender->GetPidGpuMemoryInMB(pid, gpuMemInMB); if (ret != ERR_OK) { ROSEN_LOGE("RSRenderServiceClient::GetPidGpuMemoryInMB fail, ret[%{public}d]", ret); } @@ -2447,8 +2447,8 @@ int32_t RSRenderServiceClient::GetPidGpuMemoryInMB(pid_t pid, float &gpuMemInMB) RetCodeHrpService RSRenderServiceClient::ProfilerServiceOpenFile(const HrpServiceDirInfo& dirInfo, const std::string& fileName, int32_t flags, int& fd) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RET_HRP_SERVICE_ERR_UNKNOWN; } @@ -2457,46 +2457,46 @@ RetCodeHrpService RSRenderServiceClient::ProfilerServiceOpenFile(const HrpServic return RET_HRP_SERVICE_ERR_INVALID_PARAM; } fd = -1; - return renderService->ProfilerServiceOpenFile(dirInfo, fileName, flags, fd); + return clientToService->ProfilerServiceOpenFile(dirInfo, fileName, flags, fd); } RetCodeHrpService RSRenderServiceClient::ProfilerServicePopulateFiles(const HrpServiceDirInfo& dirInfo, uint32_t firstFileIndex, std::vector& outFiles) { - auto renderService = GetRenderServiceConnection(); - if (renderService == nullptr) { + auto clientToService = GetClientToServiceConnection(); + if (clientToService == nullptr) { return RET_HRP_SERVICE_ERR_UNKNOWN; } if (!HrpServiceValidDirOrFileName(dirInfo.subDir) || !HrpServiceValidDirOrFileName(dirInfo.subDir2)) { return RET_HRP_SERVICE_ERR_INVALID_PARAM; } - return renderService->ProfilerServicePopulateFiles(dirInfo, firstFileIndex, outFiles); + return clientToService->ProfilerServicePopulateFiles(dirInfo, firstFileIndex, outFiles); } bool RSRenderServiceClient::ProfilerIsSecureScreen() { - auto renderService = GetRenderServiceConnection(); - if (renderService != nullptr) { - return renderService->ProfilerIsSecureScreen(); + auto clientToService = GetClientToServiceConnection(); + if (clientToService != nullptr) { + return clientToService->ProfilerIsSecureScreen(); } return false; } void RSRenderServiceClient::ClearUifirstCache(NodeId id) { - auto renderService = GetRenderServiceConnection(); - if (!renderService) { + auto clientToService = GetClientToServiceConnection(); + if (!clientToService) { return; } - renderService->ClearUifirstCache(id); + clientToService->ClearUifirstCache(id); } -std::shared_ptr RSRenderServiceClient::GetRenderServiceConnection() +std::shared_ptr RSRenderServiceClient::GetClientToServiceConnection() { return RSRenderServiceConnectHub::GetRenderService().first; } -std::shared_ptr RSRenderServiceClient::GetRenderProcessConnection() +std::shared_ptr RSRenderServiceClient::GetClientToRenderConnection() { return RSRenderServiceConnectHub::GetRenderService().second; } -- Gitee From 8e6365b40af222d6f9a3c445ab699d2951665c15 Mon Sep 17 00:00:00 2001 From: zhanglitao Date: Mon, 28 Jul 2025 17:52:43 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Node=E3=80=81Interface=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglitao --- .../ohos/rs_irender_process_connection.h | 41 +++++++++++++++++++ .../rs_render_process_connection_proxy.cpp | 24 +++++++++++ 2 files changed, 65 insertions(+) create mode 100644 rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h create mode 100644 rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp diff --git a/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h new file mode 100644 index 0000000000..64a7678c03 --- /dev/null +++ b/rosen/modules/render_service_base/include/platform/ohos/rs_irender_process_connection.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2021-2023 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 ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H +#define ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H + +#include "rs_irender_connection_token.h" +#include "rs_irender_render_connection.h" + +namespace OHOS { +namespace Rosen { + +class RSIRenderProcessConnection : public IRemoteBroker { +public: + DECLARE_INTERFACE_DESCRIPTOR(u"ohos.rosen.IRenderProcessConnection"); + + RSIRenderProcessConnection() = default; + virtual ~RSIRenderProcessConnection() noexcept = default; + + virtual bool SendMessage() = 0; + + virtual sptr CreateRenderConnection(const sptr& token, + pid_t remotePid) = 0; +}; + +} // namespace Rosen +} // namespace OHOS + +#endif // ROSEN_RENDER_SERVICE_BASE_TRANSACTION_RS_IRENDER_PROCESS_CONNECTION_H \ No newline at end of file diff --git a/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp new file mode 100644 index 0000000000..8661677425 --- /dev/null +++ b/rosen/modules/render_service_base/src/platform/ohos/rs_render_process_connection_proxy.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 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. + */ + +#include "rs_render_process_connection_proxy.h" + +namespace OHOS { +namespace Rosen { +RSRenderProcessConnectionProxy::RSRenderProcessConnectionProxy(const sptr& impl) : + IRemoteProxy(impl) {} + +} // namespace Rosen +} // namespace OHOS \ No newline at end of file -- Gitee