From f27fb584ee3dd14ec38b66d64e50cd7e70325bca Mon Sep 17 00:00:00 2001 From: yyh Date: Sat, 28 Dec 2024 16:51:14 +0800 Subject: [PATCH] Description:delete bundles check Feature or Bugfix:Bugfix Bunary Source:No Signed-off-by: yyh --- framework/test/src/serializable_test.cpp | 1 - services/core/include/pasteboard_service.h | 2 -- services/core/src/pasteboard_service.cpp | 29 ++-------------------- services/load/include/config.h | 1 - services/load/include/loader.h | 1 - services/load/src/config.cpp | 2 -- services/load/src/loader.cpp | 6 ----- 7 files changed, 2 insertions(+), 40 deletions(-) diff --git a/framework/test/src/serializable_test.cpp b/framework/test/src/serializable_test.cpp index 2385495d..520a034e 100644 --- a/framework/test/src/serializable_test.cpp +++ b/framework/test/src/serializable_test.cpp @@ -82,7 +82,6 @@ bool SerializableTest::IsSame(Config &oldConfig, Config &newConfig) isSame = oldConfig.features == newConfig.features && isSame; isSame = oldConfig.plugins == newConfig.plugins && isSame; isSame = IsSame(oldConfig.components, newConfig.components) && isSame; - isSame = oldConfig.bundles == newConfig.bundles && isSame; return isSame; } diff --git a/services/core/include/pasteboard_service.h b/services/core/include/pasteboard_service.h index 9797ed5e..c30a39a1 100644 --- a/services/core/include/pasteboard_service.h +++ b/services/core/include/pasteboard_service.h @@ -278,7 +278,6 @@ private: int32_t IsDataVaild(PasteData &pasteData, uint32_t tokenId); static AppInfo GetAppInfo(uint32_t tokenId); static std::string GetAppBundleName(const AppInfo &appInfo); - bool IsDefaultIME(const AppInfo &appInfo); static void SetLocalPasteFlag(bool isCrossPaste, uint32_t tokenId, PasteData &pasteData); void ShowHintToast(uint32_t tokenId, uint32_t pid); void SetWebViewPasteData(PasteData &pasteData, const std::string &bundleName); @@ -351,7 +350,6 @@ private: std::function RemotePasteboardChange(); std::shared_ptr inputEventCallback_; DistributedModuleConfig moduleConfig_; - std::vector bundles_; int32_t uid_ = -1; RemoteDataTaskManager taskMgr_; pid_t setPasteDataUId_ = 0; diff --git a/services/core/src/pasteboard_service.cpp b/services/core/src/pasteboard_service.cpp index 81ec374f..63c22517 100644 --- a/services/core/src/pasteboard_service.cpp +++ b/services/core/src/pasteboard_service.cpp @@ -145,12 +145,6 @@ void PasteboardService::InitScreenStatus() #endif } -void PasteboardService::InitBundles(Loader &loader) -{ - std::lock_guard lock(bundleMutex_); - bundles_ = loader.LoadBundles(); -} - void PasteboardService::OnStart() { PASTEBOARD_HILOGI(PASTEBOARD_MODULE_SERVICE, "PasteboardService OnStart."); @@ -163,7 +157,6 @@ void PasteboardService::OnStart() auto appInfo = GetAppInfo(IPCSkeleton::GetCallingTokenID()); Loader loader; loader.LoadComponents(); - InitBundles(loader); uid_ = loader.LoadUid(); moduleConfig_.Init(); PASTEBOARD_HILOGI(PASTEBOARD_MODULE_SERVICE, "datasl on start ret:%{public}d", DATASL_OnStart()); @@ -390,22 +383,6 @@ int32_t PasteboardService::GetRecordValueByType(uint32_t dataId, uint32_t record return static_cast(PasteboardError::E_OK); } -bool PasteboardService::IsDefaultIME(const AppInfo &appInfo) -{ - if (appInfo.tokenType != ATokenTypeEnum::TOKEN_HAP) { - return true; - } - if (bundles_.empty()) { - return true; - } - auto it = find(bundles_.begin(), bundles_.end(), appInfo.bundleName); - if (it != bundles_.end()) { - return true; - } - - return false; -} - bool PasteboardService::VerifyPermission(uint32_t tokenId) { auto version = GetSdkVersion(tokenId); @@ -418,16 +395,14 @@ bool PasteboardService::VerifyPermission(uint32_t tokenId) auto isReadGrant = IsPermissionGranted(READ_PASTEBOARD_PERMISSION, tokenId); auto isSecureGrant = IsPermissionGranted(SECURE_PASTE_PERMISSION, tokenId); AddPermissionRecord(tokenId, isReadGrant, isSecureGrant); - auto isPrivilegeApp = IsDefaultIME(GetAppInfo(tokenId)); PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, - "isReadGrant is %{public}d, isSecureGrant is %{public}d, isPrivilegeApp is %{public}d", isReadGrant, - isSecureGrant, isPrivilegeApp); + "isReadGrant is %{public}d, isSecureGrant is %{public}d,", isReadGrant, isSecureGrant); bool isCtrlVAction = false; if (inputEventCallback_ != nullptr) { isCtrlVAction = inputEventCallback_->IsCtrlVProcess(callPid, IsFocusedApp(tokenId)); inputEventCallback_->Clear(); } - auto isGrant = isReadGrant || isSecureGrant || isPrivilegeApp || isCtrlVAction; + auto isGrant = isReadGrant || isSecureGrant || isCtrlVAction; if (!isGrant && version >= ADD_PERMISSION_CHECK_SDK_VERSION) { PASTEBOARD_HILOGE(PASTEBOARD_MODULE_SERVICE, "no permisssion, callPid is %{public}d, version is %{public}d", callPid, version); diff --git a/services/load/include/config.h b/services/load/include/config.h index 7c410c36..eb416eed 100644 --- a/services/load/include/config.h +++ b/services/load/include/config.h @@ -34,7 +34,6 @@ public: std::vector features; std::vector plugins; std::vector components; - std::vector bundles; int32_t uid = -1; bool Marshal(json &node) const override; bool Unmarshal(const json &node) override; diff --git a/services/load/include/loader.h b/services/load/include/loader.h index 8adca0aa..cf940500 100644 --- a/services/load/include/loader.h +++ b/services/load/include/loader.h @@ -22,7 +22,6 @@ public: Loader(); ~Loader(); void LoadComponents(); - std::vector LoadBundles(); int32_t LoadUid(); private: diff --git a/services/load/src/config.cpp b/services/load/src/config.cpp index 95f2060d..0444bf9a 100644 --- a/services/load/src/config.cpp +++ b/services/load/src/config.cpp @@ -43,7 +43,6 @@ bool Config::Marshal(Serializable::json &node) const SetValue(node, features, GET_NAME(features)); SetValue(node, plugins, GET_NAME(plugins)); SetValue(node, components, GET_NAME(components)); - SetValue(node, bundles, GET_NAME(bundles)); SetValue(node, uid, GET_NAME(uid)); return true; } @@ -55,7 +54,6 @@ bool Config::Unmarshal(const Serializable::json &node) GetValue(node, GET_NAME(features), features); GetValue(node, GET_NAME(plugins), plugins); GetValue(node, GET_NAME(components), components); - GetValue(node, GET_NAME(bundles), bundles); GetValue(node, GET_NAME(uid), uid); return ret; } diff --git a/services/load/src/loader.cpp b/services/load/src/loader.cpp index 359fb6be..a1118dd5 100644 --- a/services/load/src/loader.cpp +++ b/services/load/src/loader.cpp @@ -51,12 +51,6 @@ void Loader::LoadComponents() } } -std::vector Loader::LoadBundles() -{ - Config config = LoadConfig(); - return config.bundles; -} - int32_t Loader::LoadUid() { Config config = LoadConfig(); -- Gitee