!86 sasdk规范整改

Merge pull request !86 from 王毅/master
This commit is contained in:
openharmony_ci 2024-10-23 09:56:40 +00:00 committed by Gitee
commit 9580d4ba56
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 7 additions and 346 deletions

View File

@ -36,7 +36,6 @@ ohos_shared_library("libsg_classify_sdk") {
public_configs = [ ":security_guard_config" ]
include_dirs = [
"${sg_root_dir}/frameworks/common/interfaces",
"${sg_root_dir}/services/risk_classify/include",
"${sg_root_dir}/frameworks/common/constants/include",
"${sg_root_dir}/frameworks/common/log/include",

View File

@ -22,6 +22,7 @@ config("security_guard_config") {
"${sg_root_dir}/interfaces/inner_api/collector/include",
"${sg_root_dir}/interfaces/inner_api/obtaindata/include",
"${sg_root_dir}/interfaces/inner_api/acquire/include",
"${sg_root_dir}/interfaces/inner_api/data_collect_manager/include",
]
}

View File

@ -24,8 +24,12 @@ ohos_unittest("libsg_collect_sdk_test") {
"${sg_root_dir}/services/risk_collect/include",
"${sg_root_dir}/frameworks/common/constants/include",
"${sg_root_dir}/frameworks/common/log/include",
"${sg_root_dir}/interfaces/inner_api/common/include",
"${sg_root_dir}/interfaces/inner_api/collect/include",
"${sg_root_dir}/interfaces/inner_api/common/include",
"${sg_root_dir}/interfaces/inner_api/collector/include",
"${sg_root_dir}/interfaces/inner_api/obtaindata/include",
"${sg_root_dir}/interfaces/inner_api/acquire/include",
"${sg_root_dir}/interfaces/inner_api/data_collect_manager/include",
]
sources = [ "unittest/src/data_collect_kit_test.cpp" ]

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 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 SECURITY_GUARD_DATA_COLLECT_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#define SECURITY_GUARD_DATA_COLLECT_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#include <cstdint>
/* SAID: 3524 */
namespace OHOS::Security::SecurityGuard {
enum class DataCollectManagerInterfaceCode {
CMD_DATA_COLLECT = 1,
CMD_DATA_REQUEST = 2,
CMD_DATA_SUBSCRIBE = 3,
CMD_DATA_UNSUBSCRIBE = 4,
CMD_SECURITY_EVENT_QUERY = 5,
CMD_SECURITY_COLLECTOR_START = 6,
CMD_SECURITY_COLLECTOR_STOP = 7,
CMD_SECURITY_CONFIG_UPDATE = 8,
CMD_SECURITY_EVENT_CONFIG_QUERY = 9,
};
enum class DataCollectManagerCallbackInterfaceCode {
CMD_SET_REQUEST_DATA = 1,
CMD_DATA_SUBSCRIBE_CALLBACK = 2,
};
enum class SecurityEventQueryCallbackInterfaceCode {
CMD_ON_QUERY = 1,
CMD_ON_COMPLETE = 2,
CMD_ON_ERROR = 3,
};
} // namespace OHOS::Security::SecurityGuard
#endif // SECURITY_GUARD_DATA_COLLECT_MANAGER_SERVICE_IPC_INTERFACE_CODE_H

View File

@ -1,104 +0,0 @@
/*
* Copyright (c) 2022 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 SECURITY_GUARD_I_DATA_COLLECT_MANAGER_H
#define SECURITY_GUARD_I_DATA_COLLECT_MANAGER_H
#include <cstdint>
#include "iremote_broker.h"
#include "data_collect_manager_service_ipc_interface_code.h"
#include "security_collector_subscribe_info.h"
#include "security_event_ruler.h"
#include "security_event.h"
#include "security_config_update_info.h"
#include "security_event_config.h"
namespace OHOS::Security::SecurityGuard {
constexpr int32_t DATA_COLLECT_MANAGER_SA_ID = 3524;
class IDataCollectManager : public IRemoteBroker {
public:
using InterfaceCode = DataCollectManagerInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.DataCollectManager");
enum {
CMD_DATA_COLLECT = static_cast<uint32_t>(InterfaceCode::CMD_DATA_COLLECT),
CMD_DATA_REQUEST = static_cast<uint32_t>(InterfaceCode::CMD_DATA_REQUEST),
CMD_DATA_SUBSCRIBE = static_cast<uint32_t>(InterfaceCode::CMD_DATA_SUBSCRIBE),
CMD_DATA_UNSUBSCRIBE = static_cast<uint32_t>(InterfaceCode::CMD_DATA_UNSUBSCRIBE),
CMD_SECURITY_EVENT_QUERY = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_EVENT_QUERY),
CMD_SECURITY_COLLECTOR_START = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_COLLECTOR_START),
CMD_SECURITY_COLLECTOR_STOP = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_COLLECTOR_STOP),
CMD_SECURITY_CONFIG_UPDATE = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_CONFIG_UPDATE),
CMD_SECURITY_EVENT_CONFIG_QUERY = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_EVENT_CONFIG_QUERY),
};
virtual int32_t RequestDataSubmit(int64_t eventId, std::string &version, std::string &time,
std::string &content) = 0;
virtual int32_t RequestRiskData(std::string &devId, std::string &eventList,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t Subscribe(const SecurityCollector::SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t Unsubscribe(const sptr<IRemoteObject> &callback) = 0;
virtual int32_t QuerySecurityEvent(std::vector<SecurityCollector::SecurityEventRuler> rulers,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t CollectorStart(const SecurityCollector::SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t CollectorStop(const SecurityCollector::SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t ConfigUpdate(const SecurityGuard::SecurityConfigUpdateInfo &updateInfo) = 0;
virtual int32_t QuerySecurityEventConfig(std::string &result) = 0;
};
class IDataCollectManagerCallback : public IRemoteBroker {
public:
using InterfaceCode = DataCollectManagerCallbackInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.DataCollectManager.Callback");
enum {
CMD_SET_REQUEST_DATA = static_cast<uint32_t>(InterfaceCode::CMD_SET_REQUEST_DATA),
};
virtual int32_t ResponseRiskData(std::string &devId, std::string &riskData, uint32_t status,
const std::string& errMsg = "") = 0;
};
class IAcquireDataCallback : public IRemoteBroker {
public:
using InterfaceCode = DataCollectManagerCallbackInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.AcquireData.Callback");
enum {
CMD_DATA_SUBSCRIBE_CALLBACK = static_cast<uint32_t>(InterfaceCode::CMD_DATA_SUBSCRIBE_CALLBACK),
};
virtual int32_t OnNotify(const SecurityCollector::Event &event) = 0;
};
class ISecurityEventQueryCallback : public IRemoteBroker {
public:
using InterfaceCode = SecurityEventQueryCallbackInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.SecurityEventQuery.Callback");
enum {
CMD_ON_QUERY = static_cast<uint32_t>(InterfaceCode::CMD_ON_QUERY),
CMD_ON_COMPLETE = static_cast<uint32_t>(InterfaceCode::CMD_ON_COMPLETE),
CMD_ON_ERROR = static_cast<uint32_t>(InterfaceCode::CMD_ON_ERROR),
};
virtual void OnQuery(const std::vector<SecurityCollector::SecurityEvent> &events) = 0;
virtual void OnComplete() = 0;
virtual void OnError(const std::string &message) = 0;
};
} // namespace OHOS::Security::SecurityGuard
#endif // SECURITY_GUARD_I_DATA_COLLECT_MANAGER_H

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2022 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 SECURITY_GUARD_IRISK_ANALYSIS_MANAGER_H
#define SECURITY_GUARD_IRISK_ANALYSIS_MANAGER_H
#include <cstdint>
#include <cstring>
#include "iremote_broker.h"
#include "message_parcel.h"
#include "risk_analysis_manager_service_ipc_interface_code.h"
namespace OHOS::Security::SecurityGuard {
constexpr int32_t RISK_ANALYSIS_MANAGER_SA_ID = 3523;
class IRiskAnalysisManager : public IRemoteBroker {
public:
using InterfaceCode = RiskAnalysisManagerInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.RiskAnalysisManager");
enum {
CMD_GET_SECURITY_MODEL_RESULT = static_cast<uint32_t>(InterfaceCode::CMD_GET_SECURITY_MODEL_RESULT),
CMD_SET_MODEL_STATE = static_cast<uint32_t>(InterfaceCode::CMD_SET_MODEL_STATE),
};
virtual int32_t RequestSecurityModelResult(const std::string &devId, uint32_t modelId,
const std::string &param, const sptr<IRemoteObject> &callback) = 0;
virtual int32_t SetModelState(uint32_t modelId, bool enable) = 0;
};
class IRiskAnalysisManagerCallback : public IRemoteBroker {
public:
using InterfaceCode = RiskAnalysisManagerCallbackInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.RiskAnalysisManager.Callback");
enum {
CMD_SET_SECURITY_MODEL_RESULT = static_cast<uint32_t>(InterfaceCode::CMD_SET_SECURITY_MODEL_RESULT),
};
virtual int32_t ResponseSecurityModelResult(const std::string &devId, uint32_t modelId, std::string &result) = 0;
};
} // namespace OHOS::Security::SecurityGuard
#endif // SECURITY_GUARD_IRISK_ANALYSIS_MANAGER_H

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) 2022 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 ISECURITY_COLLECTOR_MANAGER_H
#define ISECURITY_COLLECTOR_MANAGER_H
#include <cstdint>
#include <cstring>
#include "iremote_broker.h"
#include "event_define.h"
#include "security_collector_subscribe_info.h"
#include "security_collector_manager_service_ipc_interface_code.h"
#include "security_event.h"
#include "security_event_ruler.h"
namespace OHOS::Security::SecurityCollector {
constexpr int32_t SECURITY_COLLECTOR_MANAGER_SA_ID = 3525;
class ISecurityCollectorManager : public IRemoteBroker {
public:
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.SecurityCollectorManager");
using InterfaceCode = SecurityCollectManagerInterfaceCode;
enum {
CMD_COLLECTOR_SUBCRIBE = static_cast<uint32_t>(InterfaceCode::CMD_COLLECTOR_SUBCRIBE),
CMD_COLLECTOR_UNSUBCRIBE = static_cast<uint32_t>(InterfaceCode::CMD_COLLECTOR_UNSUBCRIBE),
CMD_COLLECTOR_START = static_cast<uint32_t>(InterfaceCode::CMD_COLLECTOR_START),
CMD_COLLECTOR_STOP = static_cast<uint32_t>(InterfaceCode::CMD_COLLECTOR_STOP),
CMD_SECURITY_EVENT_QUERY = static_cast<uint32_t>(InterfaceCode::CMD_SECURITY_EVENT_QUERY),
};
virtual int32_t Subscribe(const SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t Unsubscribe(const sptr<IRemoteObject> &callback) = 0;
virtual int32_t CollectorStart(const SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t CollectorStop(const SecurityCollectorSubscribeInfo &subscribeInfo,
const sptr<IRemoteObject> &callback) = 0;
virtual int32_t QuerySecurityEvent(const std::vector<SecurityEventRuler> rulers,
std::vector<SecurityEvent> &events) = 0;
};
class ISecurityCollectorManagerCallback : public IRemoteBroker {
public:
using InterfaceCode = SecurityCollectManagerCallbackInterfaceCode;
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.SecurityCollectorManager.Callback");
enum {
CMD_COLLECTOR_NOTIFY = static_cast<uint32_t>(InterfaceCode::CMD_COLLECTOR_CALLBACK)
};
virtual int32_t OnNotify(const Event &event) = 0;
};
} // namespace OHOS::Security::SecurityCollector
#endif // ISECURITY_COLLECTOR_MANAGER_H

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 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 SECURITY_GUARD_RISK_ANALYSIS_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#define SECURITY_GUARD_RISK_ANALYSIS_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#include <cstdint>
/* SAID: 3523 */
namespace OHOS::Security::SecurityGuard {
enum class RiskAnalysisManagerInterfaceCode {
CMD_GET_SECURITY_MODEL_RESULT = 2,
CMD_SET_MODEL_STATE = 3,
};
enum class RiskAnalysisManagerCallbackInterfaceCode {
CMD_SET_SECURITY_MODEL_RESULT = 1,
};
} // namespace OHOS::Security::SecurityGuard
#endif // SECURITY_GUARD_RISK_ANALYSIS_MANAGER_SERVICE_IPC_INTERFACE_CODE_H

View File

@ -1,35 +0,0 @@
/*
* Copyright (c) 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 SECURITY_COLLECTOR_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#define SECURITY_COLLECTOR_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#include <cstdint>
/* SAID: 3525 */
namespace OHOS::Security::SecurityCollector {
enum class SecurityCollectManagerInterfaceCode {
CMD_COLLECTOR_SUBCRIBE = 1,
CMD_COLLECTOR_UNSUBCRIBE = 2,
CMD_COLLECTOR_START = 3,
CMD_COLLECTOR_STOP = 4,
CMD_SECURITY_EVENT_QUERY = 5
};
enum class SecurityCollectManagerCallbackInterfaceCode {
CMD_COLLECTOR_CALLBACK = 10,
};
} // namespace OHOS::Security::SecurityCollector
#endif // SECURITY_COLLECTOR_MANAGER_SERVICE_IPC_INTERFACE_CODE_H

View File

@ -29,6 +29,7 @@ ohos_fuzztest("DataCollectManagerFuzzTest") {
"${sg_root_dir}/services/data_collect/sa/include",
"${sg_root_dir}/services/risk_classify/model_manager/include",
"${sg_root_dir}/interfaces/inner_api/collector/include",
"${sg_root_dir}/interfaces/inner_api/classify/include",
]
cflags = [