mirror of
https://gitee.com/openharmony/distributeddatamgr_pasteboard
synced 2024-11-23 07:59:55 +00:00
delete unused parameter settings
Signed-off-by: c459517356 <caozhijun12@huawei.com>
This commit is contained in:
parent
63db36f1f3
commit
cd3928d178
@ -71,8 +71,7 @@
|
||||
"service_group": [
|
||||
"//foundation/distributeddatamgr/pasteboard/etc/init:pasteboardservice.cfg",
|
||||
"//foundation/distributeddatamgr/pasteboard/profile:distributeddatamgr_pasteboard_sa_profiles",
|
||||
"//foundation/distributeddatamgr/pasteboard/services:pasteboard_service",
|
||||
"//foundation/distributeddatamgr/pasteboard/services/etc:pasteboard.para.dac"
|
||||
"//foundation/distributeddatamgr/pasteboard/services:pasteboard_service"
|
||||
]
|
||||
},
|
||||
"inner_kits": [
|
||||
|
@ -42,7 +42,6 @@ ohos_shared_library("pasteboard_framework") {
|
||||
"device/dev_profile.cpp",
|
||||
"device/distributed_module_config.cpp",
|
||||
"device/dm_adapter.cpp",
|
||||
"device/para_handle.cpp",
|
||||
"device/pasteboard_static_capability.cpp",
|
||||
"serializable/serializable.cpp",
|
||||
]
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "cJSON.h"
|
||||
#include "distributed_module_config.h"
|
||||
#include "dm_adapter.h"
|
||||
#include "para_handle.h"
|
||||
#include "pasteboard_hilog.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -134,25 +133,10 @@ DevProfile &DevProfile::GetInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
void DevProfile::Init()
|
||||
{
|
||||
ParaHandle::GetInstance().WatchEnabledStatus(ParameterChange);
|
||||
}
|
||||
|
||||
void DevProfile::OnReady()
|
||||
{
|
||||
}
|
||||
|
||||
void DevProfile::ParameterChange(const char *key, const char *value, void *context)
|
||||
{
|
||||
auto enabledKey = ParaHandle::DISTRIBUTED_PASTEBOARD_ENABLED_KEY;
|
||||
if (strncmp(key, enabledKey, strlen(enabledKey)) != 0) {
|
||||
PASTEBOARD_HILOGE(PASTEBOARD_MODULE_SERVICE, "key is error.");
|
||||
return;
|
||||
}
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "ParameterChange, key = %{public}s, value = %{public}s.", key, value);
|
||||
}
|
||||
|
||||
void DevProfile::PutEnabledStatus(const std::string &enabledStatus)
|
||||
{
|
||||
Notify(enabledStatus == SUPPORT_STATUS);
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-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 "para_handle.h"
|
||||
|
||||
#include "pasteboard_hilog.h"
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
constexpr int32_t HANDLE_OK = 0;
|
||||
ParaHandle::ParaHandle()
|
||||
{
|
||||
}
|
||||
|
||||
ParaHandle &ParaHandle::GetInstance()
|
||||
{
|
||||
static ParaHandle instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void ParaHandle::Init()
|
||||
{
|
||||
auto status = GetEnabledStatus();
|
||||
if (!status.empty()) {
|
||||
PASTEBOARD_HILOGI(PASTEBOARD_MODULE_SERVICE, "local device param already been set");
|
||||
return;
|
||||
}
|
||||
|
||||
auto errNo = SetParameter(DISTRIBUTED_PASTEBOARD_ENABLED_KEY, DISTRIBUTED_PASTEBOARD_ENABLED_DEFAULT_VALUE);
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "SetParameter, errNo = %{public}d.", errNo);
|
||||
}
|
||||
|
||||
void ParaHandle::WatchEnabledStatus(ParameterChgPtr ptr) const
|
||||
{
|
||||
auto errNo = WatchParameter(DISTRIBUTED_PASTEBOARD_ENABLED_KEY, ptr, nullptr);
|
||||
if (errNo != HANDLE_OK) {
|
||||
PASTEBOARD_HILOGE(PASTEBOARD_MODULE_SERVICE, "local device param watch failed, %{public}d", errNo);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ParaHandle::GetEnabledStatus() const
|
||||
{
|
||||
char value[CONFIG_LEN] = { 0 };
|
||||
auto errNo = GetParameter(DISTRIBUTED_PASTEBOARD_ENABLED_KEY, "", value, CONFIG_LEN);
|
||||
if (errNo > HANDLE_OK) {
|
||||
PASTEBOARD_HILOGE(PASTEBOARD_MODULE_SERVICE, "GetParameter success, value = %{public}s.", value);
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
@ -30,7 +30,6 @@ public:
|
||||
using Observer = std::function<void(bool isEnable)>;
|
||||
static DevProfile &GetInstance();
|
||||
bool GetEnabledStatus(const std::string &networkId);
|
||||
void Init();
|
||||
void OnReady();
|
||||
void PutEnabledStatus(const std::string &enabledStatus);
|
||||
void GetRemoteDeviceVersion(const std::string &networkId, uint32_t &deviceVersion);
|
||||
@ -67,7 +66,6 @@ public:
|
||||
private:
|
||||
DevProfile();
|
||||
~DevProfile() = default;
|
||||
static void ParameterChange(const char *key, const char *value, void *context);
|
||||
void Notify(bool isEnable);
|
||||
std::mutex callbackMutex_;
|
||||
Observer observer_ = nullptr;
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022-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 PASTE_BOARD_PARA_HANDLE_H
|
||||
#define PASTE_BOARD_PARA_HANDLE_H
|
||||
#include <string>
|
||||
|
||||
#include "api/visibility.h"
|
||||
#include "parameter.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
class API_EXPORT ParaHandle {
|
||||
public:
|
||||
static constexpr const char *DISTRIBUTED_PASTEBOARD_ENABLED_KEY = "persist.pasteboard."
|
||||
"distributedPasteboardEnabled";
|
||||
static ParaHandle &GetInstance();
|
||||
std::string GetEnabledStatus() const;
|
||||
void Init();
|
||||
void WatchEnabledStatus(ParameterChgPtr ptr) const;
|
||||
|
||||
private:
|
||||
static constexpr const char *DISTRIBUTED_PASTEBOARD_ENABLED_DEFAULT_VALUE = "true";
|
||||
static constexpr int CONFIG_LEN = 10;
|
||||
ParaHandle();
|
||||
virtual ~ParaHandle() = default;
|
||||
};
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
||||
#endif // PASTE_BOARD_PARA_HANDLE_H
|
@ -117,7 +117,7 @@ private:
|
||||
using Event = ClipPlugin::GlobalEvent;
|
||||
using ServiceListenerFunc = void (PasteboardService::*)();
|
||||
static constexpr const int32_t LISTENING_SERVICE[] = { DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID,
|
||||
DISTRIBUTED_DEVICE_PROFILE_SA_ID, WINDOW_MANAGER_SERVICE_ID, MEMORY_MANAGER_SA_ID };
|
||||
WINDOW_MANAGER_SERVICE_ID, MEMORY_MANAGER_SA_ID };
|
||||
static constexpr const char *PLUGIN_NAME = "distributed_clip";
|
||||
static constexpr uint32_t PLAIN_INDEX = 0;
|
||||
static constexpr uint32_t HTML_INDEX = 1;
|
||||
@ -219,7 +219,6 @@ private:
|
||||
void SetWebViewPasteData(PasteData &pasteData, const std::string &bundleName);
|
||||
void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override;
|
||||
void DMAdapterInit();
|
||||
void DevProfileInit();
|
||||
void NotifySaStatus();
|
||||
|
||||
ServiceRunningState state_;
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "native_token_info.h"
|
||||
#include "os_account_manager.h"
|
||||
#include "parameters.h"
|
||||
#include "para_handle.h"
|
||||
#include "pasteboard_dialog.h"
|
||||
#include "pasteboard_event_dfx.h"
|
||||
#include "pasteboard_error.h"
|
||||
@ -93,7 +92,6 @@ PasteboardService::PasteboardService()
|
||||
: SystemAbility(PASTEBOARD_SERVICE_ID, true), state_(ServiceRunningState::STATE_NOT_START)
|
||||
{
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "PasteboardService Start.");
|
||||
ServiceListenerFunc_[static_cast<int32_t>(DISTRIBUTED_DEVICE_PROFILE_SA_ID)] = &PasteboardService::DevProfileInit;
|
||||
ServiceListenerFunc_[static_cast<int32_t>(DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID)] =
|
||||
&PasteboardService::DMAdapterInit;
|
||||
ServiceListenerFunc_[static_cast<int32_t>(MEMORY_MANAGER_SA_ID)] = &PasteboardService::NotifySaStatus;
|
||||
@ -181,7 +179,6 @@ void PasteboardService::OnStop()
|
||||
serviceHandler_ = nullptr;
|
||||
state_ = ServiceRunningState::STATE_NOT_START;
|
||||
|
||||
ParaHandle::GetInstance().WatchEnabledStatus(nullptr);
|
||||
if (commonEventSubscriber_ != nullptr) {
|
||||
EventFwk::CommonEventManager::UnSubscribeCommonEvent(commonEventSubscriber_);
|
||||
}
|
||||
@ -240,12 +237,6 @@ void PasteboardService::DMAdapterInit()
|
||||
DMAdapter::GetInstance().Initialize(appInfo.bundleName);
|
||||
}
|
||||
|
||||
void PasteboardService::DevProfileInit()
|
||||
{
|
||||
ParaHandle::GetInstance().Init();
|
||||
DevProfile::GetInstance().Init();
|
||||
}
|
||||
|
||||
void PasteboardService::NotifySaStatus()
|
||||
{
|
||||
Memory::MemMgrClient::GetInstance().NotifyProcessStatus(getpid(), 1, 1, PASTEBOARD_SERVICE_ID);
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Copyright (C) 2022-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.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
ohos_prebuilt_etc("pasteboard.para.dac") {
|
||||
source = "//foundation/distributeddatamgr/pasteboard/services/etc/pasteboard.para.dac"
|
||||
part_name = "pasteboard"
|
||||
module_install_dir = "etc/param"
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
# Copyright (C) 2022-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.
|
||||
|
||||
persist.pasteboard. = pasteboard:pasteboard:0775:bool
|
Loading…
Reference in New Issue
Block a user