From 6524ce0fd3c7d79fc1460b5a4d946714fe87272f Mon Sep 17 00:00:00 2001 From: shilei Date: Mon, 25 Jul 2022 20:50:08 +0800 Subject: [PATCH] fixed ded3097 from https://gitee.com/shilei91/bundlemanager_bundle_framework_lite/pulls/187 fix problem Signed-off-by: shilei Change-Id: I0d10f5de264235f1eaafa5f0563098c67d43370a --- services/bundlemgr_lite/include/bundle_daemon_client.h | 2 +- services/bundlemgr_lite/src/bundle_daemon_client.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/bundlemgr_lite/include/bundle_daemon_client.h b/services/bundlemgr_lite/include/bundle_daemon_client.h index 0387d47..641d2cb 100644 --- a/services/bundlemgr_lite/include/bundle_daemon_client.h +++ b/services/bundlemgr_lite/include/bundle_daemon_client.h @@ -41,7 +41,7 @@ public: int32_t MoveFile(const char *oldFile, const char *newFile); int32_t RemoveFile(const char *file); int32_t RemoveInstallDirectory(const char *codePath, const char *dataPath, bool keepData); - int32_t CallClientInvoke(int32_t funcId, const char *firstPath, const char *secondPath); + int32_t CallClientInvoke(int32_t funcId, const char *firstPath, const char *secondPath, bool keepData = false); static int32_t BundleDaemonCallback(uint32_t code, IpcIo* data, IpcIo* reply, MessageOption option); static void DeathCallback(void* arg); static int Notify(IOwner owner, int code, IpcIo *reply); diff --git a/services/bundlemgr_lite/src/bundle_daemon_client.cpp b/services/bundlemgr_lite/src/bundle_daemon_client.cpp index f4a405a..140ac1b 100644 --- a/services/bundlemgr_lite/src/bundle_daemon_client.cpp +++ b/services/bundlemgr_lite/src/bundle_daemon_client.cpp @@ -204,7 +204,8 @@ int32_t BundleDaemonClient::RegisterCallback() return WaitResultSync(EC_SUCCESS); } -int32_t BundleDaemonClient::CallClientInvoke(int32_t funcId, const char *firstPath, const char *secondPath) +int32_t BundleDaemonClient::CallClientInvoke(int32_t funcId, const char *firstPath, const char *secondPath, + bool keepData) { IpcIo request; char data[MAX_IO_SIZE]; @@ -215,6 +216,10 @@ int32_t BundleDaemonClient::CallClientInvoke(int32_t funcId, const char *firstPa WriteUint16(&request, strlen(firstPath)); + if (funcId == REMOVE_INSTALL_DIRECTORY) { + WriteBool(&request, keepData); + } + Lock lock(mutex_); #ifdef __LINUX__ return WaitResultSync(bdsClient_->Invoke(bdsClient_, funcId, &request, this, Notify)); @@ -366,6 +371,6 @@ int32_t BundleDaemonClient::RemoveInstallDirectory(const char *codePath, const c return EC_INVALID; } - return CallClientInvoke(REMOVE_INSTALL_DIRECTORY, codePath, dataPath); + return CallClientInvoke(REMOVE_INSTALL_DIRECTORY, codePath, dataPath, keepData); } } // OHOS -- Gitee