DMS提供系统事件、SA dump、trace打点

Signed-off-by: wangyang2022 <wangyang412@huawei.com>
Change-Id: I4b8dcd7da536a78385c24b28b661ee50c24a883a
This commit is contained in:
wangyang2022
2022-06-27 14:52:15 +08:00
parent d7402f6a2f
commit 08449818ac
18 changed files with 733 additions and 6 deletions
+9 -1
View File
@@ -18,6 +18,9 @@
"features" : [
"dmsfwk_standard_mission_manager"
],
"hisysevent_config": [
"//foundation/distributedschedule/dmsfwk/hisysevent.yaml"
],
"rom": "",
"ram": "",
"deps": {
@@ -28,6 +31,8 @@
"distributeddatamgr",
"dsoftbus",
"eventhandler",
"hisysevent_native",
"hitrace_native",
"hiviewdfx_hilog_native",
"ipc",
"multimedia_image_standard",
@@ -53,9 +58,12 @@
"adapter/dnetwork_adapter.h",
"deviceManager/dms_device_info.h",
"deviceManager/dms_device_listener.h",
"dfx/dms_hisysevent_report.h",
"dfx/dms_hitrace_chain.h",
"dfx/dms_hitrace_constants.h",
"distributed_device_node_listener.h",
"dtbschedmgr_device_info_storage.h",
"dtbschedmgr_log.h",
"dtbschedmgr_log.h",
"parcel_helper.h"
]
},
+101
View File
@@ -0,0 +1,101 @@
# 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.
domain: DISTSCHEDULE
START_REMOTE_ABILITY:
__BASE: {type: BEHAVIOR, level: MINOR, tag: start, desc: start remote ability}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
CONNECT_REMOTE_ABILITY:
__BASE: {type: BEHAVIOR, level: MINOR, tag: connect, desc: connect remote ability}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
DISCONNECT_REMOTE_ABILITY:
__BASE: {type: BEHAVIOR, level: MINOR, tag: connect, desc: disconnect remote ability}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
START_REMOTE_ABILITY_BYCALL:
__BASE: {type: BEHAVIOR, level: MINOR, tag: start, desc: start remote ability by call}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
RELEASE_REMOTE_ABILITY:
__BASE: {type: BEHAVIOR, level: MINOR, tag: start, desc: release remote ability}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
START_CONTINUATION:
__BASE: {type: BEHAVIOR, level: MINOR, tag: continue, desc: start continuation}
CALLING_TYPE: {type: STRING, desc: calling type}
CALLING_UID: {type: INT32, desc: calling uid}
CALLING_PID: {type: INT32, desc: calling pid}
TARGET_BUNDLE: {type: STRING, desc: target bundle name}
TARGET_ABILITY: {type: STRING, desc: target ability name}
CALLING_APP_UID: {type: INT32, desc: calling app uid}
RESULT: {type: INT32, desc: result}
START_ABILITY_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: start, desc: start remote ability}
ERROR_TYPE: {type: INT32, desc: error type}
CONNECT_ABILITY_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: connect, desc: connect remote ability}
ERROR_TYPE: {type: INT32, desc: error type}
DISCONNECT_ABILITY_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: connect, desc: disconnect remote ability}
ERROR_TYPE: {type: INT32, desc: error type}
START_ABILITY_BYCALL_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: start, desc: start remote ability by call}
ERROR_TYPE: {type: INT32, desc: error type}
RELEASE_ABILITY_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: start, desc: release remote ability}
ERROR_TYPE: {type: INT32, desc: error type}
START_CONTINUATION_FAILED:
__BASE: {type: FAULT, level: CRITICAL, tag: continue, desc: start continuation}
ERROR_TYPE: {type: INT32, desc: error type}
+5
View File
@@ -24,6 +24,8 @@ ohos_shared_library("dmsbaseinner") {
sources = [
"../../../services/base/src/adapter/dnetwork_adapter.cpp",
"../../../services/base/src/deviceManager/dms_device_info.cpp",
"../../../services/base/src/dfx/dms_hisysevent_report.cpp",
"../../../services/base/src/dfx/dms_hitrace_chain.cpp",
"../../../services/base/src/distributed_device_node_listener.cpp",
"../../../services/base/src/dtbschedmgr_device_info_storage.cpp",
]
@@ -35,6 +37,9 @@ ohos_shared_library("dmsbaseinner") {
"device_auth:deviceauth_sdk",
"dsoftbus:softbus_client",
"eventhandler:libeventhandler",
"hisysevent_native:libhisysevent",
"hitrace_native:hitrace_meter",
"hitrace_native:libhitrace",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"safwk:system_ability_fwk",
@@ -0,0 +1,57 @@
/*
* 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 OHOS_DISTRIBUTED_HISTSEVENT_REPORT_H
#define OHOS_DISTRIBUTED_HISTSEVENT_REPORT_H
#include <string>
namespace OHOS {
namespace DistributedSchedule {
namespace BehaviorEvent {
const std::string START_REMOTE_ABILITY = "START_REMOTE_ABILITY";
const std::string CONNECT_REMOTE_ABILITY = "CONNECT_REMOTE_ABILITY";
const std::string DISCONNECT_REMOTE_ABILITY = "DISCONNECT_REMOTE_ABILITY";
const std::string START_REMOTE_ABILITY_BYCALL = "START_REMOTE_ABILITY_BYCALL";
const std::string RELEASE_REMOTE_ABILITY = "RELEASE_REMOTE_ABILITY";
const std::string START_CONTINUATION = "START_CONTINUATION";
}
namespace FaultEvent {
const std::string START_REMOTE_ABILITY = "START_ABILITY_FAILED";
const std::string CONNECT_REMOTE_ABILITY = "CONNECT_ABILITY_FAILED";
const std::string DISCONNECT_REMOTE_ABILITY = "DISCONNECT_ABILITY_FAILED";
const std::string START_REMOTE_ABILITY_BYCALL = "START_ABILITY_BYCALL_FAILED";
const std::string RELEASE_REMOTE_ABILITY = "RELEASE_ABILITY_FAILED";
const std::string START_CONTINUATION = "START_CONTINUATION_FAILED";
}
namespace EventErrorType {
const std::string GET_BUNDLE_MGR_FAILED = "GET_BUNDLE_MGR_FAILED";
const std::string GET_ABILITY_MGR_FAILED = "GET_ABILITY_MGR_FAILED";
}
class DmsHiSysEventReport {
public:
static int ReportBehaviorEvent(const std::string& eventName, const int32_t& eventResult,
const std::string& bundleName = "", const std::string& abilityName = "", const int32_t& callingAppUid = -1);
static int ReportBehaviorEventFromRemote(const std::string& eventName, const int32_t& eventResult,
const std::string& bundleName = "", const std::string& abilityName = "", const int32_t& callingAppUid = -1);
static int ReportFaultEvent(const std::string& eventName, const std::string& errorType);
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif /* OHOS_DISTRIBUTED_HISTSEVENT_REPORT_H */
@@ -0,0 +1,33 @@
/*
* 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 OHOS_DISTRIBUTED_HITRACE_CHAIN_H
#define OHOS_DISTRIBUTED_HITRACE_CHAIN_H
#include "hitrace/hitrace.h"
namespace OHOS {
namespace DistributedSchedule {
class DmsHiTraceChain {
public:
explicit DmsHiTraceChain(const std::string &name);
~DmsHiTraceChain();
private:
OHOS::HiviewDFX::HiTraceId hiTraceId;
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif /* OHOS_DISTRIBUTED_HITRACE_CHAIN_H */
@@ -0,0 +1,39 @@
/*
* 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 OHOS_DISTRIBUTED_HITRACE_CONSTANTS_H
#define OHOS_DISTRIBUTED_HITRACE_CONSTANTS_H
#include "hitrace_meter.h"
namespace OHOS {
namespace DistributedSchedule {
namespace TraceTag {
constexpr uint64_t DSCHED = HITRACE_TAG_DISTRIBUTED_SCHEDULE;
}
namespace TraceValue {
const std::string START_REMOTE_ABILITY = "START_REMOTE_ABILITY";
const std::string CONNECT_REMOTE_ABILITY = "CONNECT_REMOTE_ABILITY";
const std::string DISCONNECT_REMOTE_ABILITY = "DISCONNECT_REMOTE_ABILITY";
const std::string START_REMOTE_ABILITY_BYCALL = "START_REMOTE_ABILITY_BYCALL";
const std::string RELEASE_REMOTE_ABILITY = "RELEASE_REMOTE_ABILITY";
const std::string START_CONTINUATION = "START_CONTINUATION";
const std::string REMOTE_PROCEDURE_CALL = "REMOTE_PROCEDURE_CALL";
}
} // namespace DistributedSchedule
} // namespace OHOS
#endif /* OHOS_DISTRIBUTED_HITRACE_CONSTANTS_H */
@@ -0,0 +1,84 @@
/*
* 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.
*/
#include "dfx/dms_hisysevent_report.h"
#include "dtbschedmgr_log.h"
#include "hisysevent.h"
#include "ipc_skeleton.h"
namespace OHOS {
namespace DistributedSchedule {
using namespace OHOS::HiviewDFX;
namespace {
const std::string TAG = "DmsHiSysEventReport";
const std::string DOMAIN_NAME = std::string(HiSysEvent::Domain::DISTRIBUTED_SCHEDULE);
const std::string KEY_CALLING_APP_UID = "CALLING_APP_UID";
const std::string KEY_CALLING_PID = "CALLING_PID";
const std::string KEY_CALLING_TYPE = "CALLING_TYPE";
const std::string KEY_CALLING_UID = "CALLING_UID";
const std::string KEY_ERROR_TYPE = "ERROR_TYPE";
const std::string KEY_RESULT = "RESULT";
const std::string KEY_TARGET_ABILITY = "TARGET_ABILITY";
const std::string KEY_TARGET_BUNDLE = "TARGET_BUNDLE";
}
int DmsHiSysEventReport::ReportBehaviorEvent(const std::string& eventName, const int32_t& eventResult,
const std::string& bundleName, const std::string& abilityName, const int32_t& callingAppUid)
{
int result = HiSysEvent::Write(DOMAIN_NAME, eventName, HiSysEvent::EventType::BEHAVIOR,
KEY_CALLING_TYPE, "local",
KEY_CALLING_UID, IPCSkeleton::GetCallingUid(),
KEY_CALLING_PID, IPCSkeleton::GetCallingPid(),
KEY_CALLING_APP_UID, callingAppUid,
KEY_TARGET_BUNDLE, bundleName,
KEY_TARGET_ABILITY, abilityName,
KEY_RESULT, eventResult);
if (result != 0) {
HILOGE("hisysevent report failed! ret %{public}d.", result);
}
return result;
}
int DmsHiSysEventReport::ReportBehaviorEventFromRemote(const std::string& eventName, const int32_t& eventResult,
const std::string& bundleName, const std::string& abilityName, const int32_t& callingAppUid)
{
int result = HiSysEvent::Write(DOMAIN_NAME, eventName, HiSysEvent::EventType::BEHAVIOR,
KEY_CALLING_TYPE, "remote",
KEY_CALLING_UID, IPCSkeleton::GetCallingUid(),
KEY_CALLING_PID, IPCSkeleton::GetCallingPid(),
KEY_CALLING_APP_UID, callingAppUid,
KEY_TARGET_BUNDLE, bundleName,
KEY_TARGET_ABILITY, abilityName,
KEY_RESULT, eventResult);
if (result != 0) {
HILOGE("hisysevent report failed! ret %{public}d.", result);
}
return result;
}
int DmsHiSysEventReport::ReportFaultEvent(const std::string& eventName, const std::string& errorType)
{
int result = HiSysEvent::Write(DOMAIN_NAME, eventName, HiSysEvent::EventType::FAULT,
KEY_ERROR_TYPE, errorType);
if (result != 0) {
HILOGE("hisysevent report failed! ret %{public}d.", result);
}
return result;
}
}
}
@@ -0,0 +1,31 @@
/*
* 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.
*/
#include "dfx/dms_hitrace_chain.h"
namespace OHOS {
namespace DistributedSchedule {
using namespace OHOS::HiviewDFX;
DmsHiTraceChain::DmsHiTraceChain(const std::string &name)
{
hiTraceId = HiTrace::Begin(name, HITRACE_FLAG_INCLUDE_ASYNC);
}
DmsHiTraceChain:: ~DmsHiTraceChain()
{
HiTrace::End(hiTraceId);
}
}
}
+3
View File
@@ -63,6 +63,9 @@ ohos_shared_library("distributedschedsvr") {
"dmsfwk_standard:dmsbaseinner",
"dsoftbus:softbus_client",
"eventhandler:libeventhandler",
"hisysevent_native:libhisysevent",
"hitrace_native:hitrace_meter",
"hitrace_native:libhitrace",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"os_account:os_account_innerkits",
@@ -15,6 +15,7 @@
#include "bundle/bundle_manager_internal.h"
#include "dfx/dms_hisysevent_report.h"
#include "distributed_sched_adapter.h"
#include "dtbschedmgr_log.h"
#include "ipc_skeleton.h"
@@ -16,6 +16,7 @@
#include "distributed_sched_adapter.h"
#include "datetime_ex.h"
#include "dfx/dms_hisysevent_report.h"
#include "distributed_sched_service.h"
#include "dtbschedmgr_device_info_storage.h"
#include "dtbschedmgr_log.h"
@@ -68,6 +69,8 @@ int32_t DistributedSchedAdapter::ConnectAbility(const OHOS::AAFwk::Want& want,
ErrCode errCode = AAFwk::AbilityManagerClient::GetInstance()->Connect();
if (errCode != ERR_OK) {
HILOGE("connect ability server failed, errCode=%{public}d", errCode);
DmsHiSysEventReport::ReportFaultEvent(FaultEvent::CONNECT_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
return errCode;
}
std::vector<int> ids;
@@ -86,6 +89,8 @@ int32_t DistributedSchedAdapter::DisconnectAbility(const sptr<IRemoteObject>& co
ErrCode errCode = AAFwk::AbilityManagerClient::GetInstance()->Connect();
if (errCode != ERR_OK) {
HILOGE("connect ability server failed, errCode=%{public}d", errCode);
DmsHiSysEventReport::ReportFaultEvent(FaultEvent::DISCONNECT_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
return errCode;
}
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(
@@ -199,6 +204,8 @@ int32_t DistributedSchedAdapter::ReleaseAbility(const sptr<IRemoteObject>& conne
ErrCode errCode = AAFwk::AbilityManagerClient::GetInstance()->Connect();
if (errCode != ERR_OK) {
HILOGE("ReleaseAbility:connect ability server failed, errCode=%{public}d", errCode);
DmsHiSysEventReport::ReportFaultEvent(FaultEvent::RELEASE_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
return errCode;
}
AppExecFwk::ElementName elementWithoutDeviceId("", element.GetBundleName(), element.GetAbilityName());
@@ -214,6 +221,8 @@ int32_t DistributedSchedAdapter::StartAbilityByCall(const OHOS::AAFwk::Want& wan
ErrCode errCode = AAFwk::AbilityManagerClient::GetInstance()->Connect();
if (errCode != ERR_OK) {
HILOGE("ResolveAbility:connect ability server failed, errCode=%{public}d", errCode);
DmsHiSysEventReport::ReportFaultEvent(FaultEvent::START_REMOTE_ABILITY_BYCALL,
EventErrorType::GET_ABILITY_MGR_FAILED);
return errCode;
}
ErrCode ret = AAFwk::AbilityManagerClient::GetInstance()->StartAbilityByCall(want,
@@ -15,8 +15,8 @@
#include "distributed_sched_proxy.h"
#include "dfx/dms_hitrace_constants.h"
#include "dtbschedmgr_log.h"
#include "ipc_types.h"
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
#include "mission/mission_info_converter.h"
@@ -87,6 +87,7 @@ int32_t DistributedSchedProxy::StartAbilityFromRemote(const OHOS::AAFwk::Want& w
std::string extraInfo = extraInfoJson.dump();
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, START_ABILITY_FROM_REMOTE, data, reply);
}
@@ -281,6 +282,7 @@ int32_t DistributedSchedProxy::ConnectAbilityFromRemote(const OHOS::AAFwk::Want&
std::string extraInfo = extraInfoJson.dump();
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, CONNECT_ABILITY_FROM_REMOTE, data, reply);
}
@@ -305,6 +307,7 @@ int32_t DistributedSchedProxy::DisconnectAbilityFromRemote(const sptr<IRemoteObj
PARCEL_WRITE_HELPER(data, Int32, uid);
PARCEL_WRITE_HELPER(data, String, sourceDeviceId);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, DISCONNECT_ABILITY_FROM_REMOTE, data, reply);
}
@@ -750,6 +753,7 @@ int32_t DistributedSchedProxy::StartAbilityByCallFromRemote(const OHOS::AAFwk::W
PARCEL_WRITE_HELPER(data, String, extraInfo);
PARCEL_WRITE_HELPER(data, Parcelable, &want);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, START_ABILITY_BY_CALL_FROM_REMOTE, data, reply);
}
@@ -779,6 +783,7 @@ int32_t DistributedSchedProxy::ReleaseAbilityFromRemote(const sptr<IRemoteObject
std::string extraInfo = "";
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, RELEASE_ABILITY_FROM_REMOTE, data, reply);
}
@@ -842,6 +847,7 @@ int32_t DistributedSchedProxy::StartFreeInstallFromRemote(const FreeInstallInfo&
std::string extraInfo = extraInfoJson.dump();
PARCEL_WRITE_HELPER(data, String, extraInfo);
MessageParcel reply;
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL);
PARCEL_TRANSACT_SYNC_RET_INT(remote, START_FREE_INSTALL_FROM_REMOTE, data, reply);
}
@@ -25,6 +25,8 @@
#include "bundle/bundle_manager_internal.h"
#include "connect_death_recipient.h"
#include "datetime_ex.h"
#include "dfx/dms_hisysevent_report.h"
#include "dfx/dms_hitrace_constants.h"
#include "distributed_sched_adapter.h"
#include "distributed_sched_dumper.h"
#include "distributed_sched_permission.h"
@@ -19,6 +19,9 @@
#include "adapter/dnetwork_adapter.h"
#include "caller_info.h"
#include "datetime_ex.h"
#include "dfx/dms_hisysevent_report.h"
#include "dfx/dms_hitrace_chain.h"
#include "dfx/dms_hitrace_constants.h"
#include "distributed_sched_permission.h"
#include "dtbschedmgr_log.h"
#include "dtbschedmgr_device_info_storage.h"
@@ -136,6 +139,8 @@ int32_t DistributedSchedStub::OnRemoteRequest(uint32_t code,
int32_t DistributedSchedStub::StartRemoteAbilityInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::START_REMOTE_ABILITY);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::START_REMOTE_ABILITY);
shared_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>());
if (want == nullptr) {
HILOGW("START_ABILITY want readParcelable failed!");
@@ -154,6 +159,8 @@ int32_t DistributedSchedStub::StartRemoteAbilityInner(MessageParcel& data, Messa
return DMS_PERMISSION_DENIED;
}
int32_t result = StartRemoteAbility(*want, callerUid, requestCode, accessToken);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_REMOTE_ABILITY, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid);
HILOGI("StartRemoteAbilityInner result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@@ -201,6 +208,8 @@ int32_t DistributedSchedStub::StartAbilityFromRemoteInner(MessageParcel& data, M
HILOGD("parse extra info, accessTokenID = %u", accessToken);
}
int32_t result = StartAbilityFromRemote(*want, abilityInfo, requestCode, callerInfo, accountInfo);
DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::START_REMOTE_ABILITY, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerInfo.uid);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_HELPER(reply, Int32, result);
int64_t end = GetTickCount();
@@ -272,6 +281,8 @@ int32_t DistributedSchedStub::ContinueMissionInner(MessageParcel& data, MessageP
int32_t DistributedSchedStub::StartContinuationInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::START_CONTINUATION);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::START_CONTINUATION);
shared_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>());
if (want == nullptr) {
HILOGW("want readParcelable failed!");
@@ -289,6 +300,8 @@ int32_t DistributedSchedStub::StartContinuationInner(MessageParcel& data, Messag
return DMS_PERMISSION_DENIED;
}
int32_t result = StartContinuation(*want, missionId, callerUid, status, accessToken);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_CONTINUATION, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@@ -326,6 +339,8 @@ int32_t DistributedSchedStub::NotifyContinuationResultFromRemoteInner(MessagePar
int32_t DistributedSchedStub::ConnectRemoteAbilityInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::CONNECT_REMOTE_ABILITY);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::CONNECT_REMOTE_ABILITY);
shared_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>());
if (want == nullptr) {
HILOGW("want readParcelable failed!");
@@ -346,12 +361,16 @@ int32_t DistributedSchedStub::ConnectRemoteAbilityInner(MessageParcel& data, Mes
return DMS_PERMISSION_DENIED;
}
int32_t result = ConnectRemoteAbility(*want, connect, callerUid, callerPid, accessToken);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::CONNECT_REMOTE_ABILITY, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
int32_t DistributedSchedStub::DisconnectRemoteAbilityInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::DISCONNECT_REMOTE_ABILITY);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::DISCONNECT_REMOTE_ABILITY);
sptr<IRemoteObject> connect = data.ReadRemoteObject();
int32_t callerUid = 0;
PARCEL_READ_HELPER(data, Int32, callerUid);
@@ -364,6 +383,7 @@ int32_t DistributedSchedStub::DisconnectRemoteAbilityInner(MessageParcel& data,
return DMS_PERMISSION_DENIED;
}
int32_t result = DisconnectRemoteAbility(connect, callerUid, accessToken);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::DISCONNECT_REMOTE_ABILITY, result);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@@ -411,6 +431,8 @@ int32_t DistributedSchedStub::ConnectAbilityFromRemoteInner(MessageParcel& data,
std::string deviceId = abilityInfo.deviceId;
int64_t begin = GetTickCount();
int32_t result = ConnectAbilityFromRemote(*want, abilityInfo, connect, callerInfo, accountInfo);
DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::CONNECT_REMOTE_ABILITY, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerInfo.uid);
HILOGW("result = %{public}d", result);
int64_t end = GetTickCount();
PARCEL_WRITE_HELPER(reply, Int32, result);
@@ -433,6 +455,7 @@ int32_t DistributedSchedStub::DisconnectAbilityFromRemoteInner(MessageParcel& da
string sourceDeviceId;
PARCEL_READ_HELPER(data, String, sourceDeviceId);
int32_t result = DisconnectAbilityFromRemote(connect, uid, sourceDeviceId);
DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::DISCONNECT_REMOTE_ABILITY, result);
HILOGI("result %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@@ -782,6 +805,8 @@ bool DistributedSchedStub::CallerInfoUnmarshalling(CallerInfo& callerInfo, Messa
int32_t DistributedSchedStub::StartRemoteAbilityByCallInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::START_REMOTE_ABILITY_BYCALL);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::START_REMOTE_ABILITY_BYCALL);
shared_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>());
if (want == nullptr) {
HILOGW("want readParcelable failed!");
@@ -800,12 +825,16 @@ int32_t DistributedSchedStub::StartRemoteAbilityByCallInner(MessageParcel& data,
return DMS_PERMISSION_DENIED;
}
int32_t result = StartRemoteAbilityByCall(*want, connect, callerUid, callerPid, accessToken);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_REMOTE_ABILITY_BYCALL, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerUid);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
int32_t DistributedSchedStub::ReleaseRemoteAbilityInner(MessageParcel& data, MessageParcel& reply)
{
DmsHiTraceChain hiTraceChain(TraceValue::RELEASE_REMOTE_ABILITY);
HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::RELEASE_REMOTE_ABILITY);
sptr<IRemoteObject> connect = data.ReadRemoteObject();
shared_ptr<AppExecFwk::ElementName> element(data.ReadParcelable<AppExecFwk::ElementName>());
if (element == nullptr) {
@@ -813,6 +842,8 @@ int32_t DistributedSchedStub::ReleaseRemoteAbilityInner(MessageParcel& data, Mes
return ERR_INVALID_VALUE;
}
int32_t result = ReleaseRemoteAbility(connect, *element);
DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::RELEASE_REMOTE_ABILITY, result,
element->GetBundleName(), element->GetAbilityName());
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@@ -850,6 +881,8 @@ int32_t DistributedSchedStub::StartAbilityByCallFromRemoteInner(MessageParcel& d
return ERR_NULL_OBJECT;
}
int32_t result = StartAbilityByCallFromRemote(*want, connect, callerInfo, accountInfo);
DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::START_REMOTE_ABILITY_BYCALL, result,
want->GetElement().GetBundleName(), want->GetElement().GetAbilityName(), callerInfo.uid);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_HELPER(reply, Int32, result);
return ERR_NONE;
@@ -873,6 +906,8 @@ int32_t DistributedSchedStub::ReleaseAbilityFromRemoteInner(MessageParcel& data,
std::string extraInfo;
PARCEL_READ_HELPER(data, String, extraInfo);
int32_t result = ReleaseAbilityFromRemote(connect, *element, callerInfo);
DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::RELEASE_REMOTE_ABILITY, result,
element->GetBundleName(), element->GetAbilityName());
HILOGI("result %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
+19 -1
View File
@@ -40,6 +40,9 @@ dsched_external_deps = [
"dmsfwk_standard:dmsbaseinner",
"dsoftbus:softbus_client",
"eventhandler:libeventhandler",
"hisysevent_native:libhisysevent",
"hitrace_native:hitrace_meter",
"hitrace_native:libhitrace",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"os_account:os_account_innerkits",
@@ -203,16 +206,31 @@ ohos_unittest("bundlemanagerinternaltest") {
part_name = "dmsfwk_standard"
}
ohos_unittest("hisyseventreporttest") {
module_out_path = module_output_path
sources = [ "unittest/dms_hisysevent_report_test.cpp" ]
sources += dtbschedmgr_sources
configs = [ ":test_config" ]
configs += dsched_configs
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
if (is_standard_system) {
external_deps = dsched_external_deps
public_deps = dsched_public_deps
}
part_name = "dmsfwk_standard"
}
group("unittest") {
testonly = true
deps = [
":bundlemanagerinternaltest",
":distributedschedsvrtest",
":dschedconnecttest",
":dschedcontinuetest",
":hisyseventreporttest",
]
if (dmsfwk_standard_mission_manager) {
deps += [
":bundlemanagerinternaltest",
":dscheddatastoragetest",
":dschedmissionmanagertest",
":dschedpermissiontest",
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* 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
@@ -17,7 +17,6 @@
#define BUNDLE_MANAGER_INTERNAL_TEST_H
#include "gtest/gtest.h"
#include "gmock/gmock.h"
namespace OHOS {
namespace DistributedSchedule {
@@ -30,4 +29,4 @@ public:
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif // DISTRIBUTED_SCHED_PERMISSION_TEST_H
#endif // BUNDLE_MANAGER_INTERNAL_TEST_H
@@ -0,0 +1,264 @@
/*
* 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.
*/
#include "dms_hisysevent_report_test.h"
#include "dfx/dms_hisysevent_report.h"
#include "test_log.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace DistributedSchedule {
namespace {
const string GROUP_ID = "TEST_GROUP_ID";
const string bundleName = "ohos.hisysevent.test";
const string abilityName = "testAbility";
const int32_t eventResult = 0;
const int32_t callingAppUid = 0;
}
void DmsHiSysEventReportTest::SetUpTestCase()
{
DTEST_LOG << "DmsHiSysEventReportTest::SetUpTestCase" << std::endl;
}
void DmsHiSysEventReportTest::TearDownTestCase()
{
DTEST_LOG << "DmsHiSysEventReportTest::TearDownTestCase" << std::endl;
}
void DmsHiSysEventReportTest::TearDown()
{
DTEST_LOG << "DmsHiSysEventReportTest::TearDown" << std::endl;
}
void DmsHiSysEventReportTest::SetUp()
{
DTEST_LOG << "DmsHiSysEventReportTest::SetUp" << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_001
* @tc.desc: report start remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_001, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_001 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::START_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_001 end ret:" << result << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_002
* @tc.desc: report connect remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_002, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_002 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::CONNECT_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::CONNECT_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_002 end ret:" << result << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_003
* @tc.desc: report continue remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_003, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_003 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_CONTINUATION, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::START_CONTINUATION, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_003 end ret:" << result << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_004
* @tc.desc: report start remote ability by call
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_004, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_004 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::START_REMOTE_ABILITY_BYCALL, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::START_REMOTE_ABILITY_BYCALL, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_004 end "<< std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_005
* @tc.desc: report disconnect remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_005, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_005 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::DISCONNECT_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::DISCONNECT_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_005 end "<< std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_006
* @tc.desc: report release remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_006, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_006 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportBehaviorEvent(BehaviorEvent::RELEASE_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
result = DmsHiSysEventReport::ReportBehaviorEventFromRemote(BehaviorEvent::RELEASE_REMOTE_ABILITY, eventResult,
bundleName, abilityName, callingAppUid);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_006 end "<< std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_007
* @tc.desc: report start remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_007, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_007 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::START_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_007 end ret:" << result << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_008
* @tc.desc: report connect remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_008, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_008 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::CONNECT_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_008 end ret:" << result << std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_009
* @tc.desc: report continue remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_009, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_009 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::START_CONTINUATION,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_009 end ret:" << result << std::endl;
}
/**
* @tc.name: HiSysEventReportTest_010
* @tc.desc: report start remote ability by call
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_010, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_010 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::START_REMOTE_ABILITY_BYCALL,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_010 end "<< std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_011
* @tc.desc: report disconnect remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_011, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_011 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::DISCONNECT_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_011 end "<< std::endl;
}
/**
* @tc.name: DmsHiSysEventReportTest_012
* @tc.desc: report release remote ability
* @tc.type: FUNC
*/
HWTEST_F(DmsHiSysEventReportTest, DmsHiSysEventReportTest_012, TestSize.Level1)
{
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_012 begin" << std::endl;
int32_t result = -1;
result = DmsHiSysEventReport::ReportFaultEvent(FaultEvent::RELEASE_REMOTE_ABILITY,
EventErrorType::GET_ABILITY_MGR_FAILED);
EXPECT_TRUE(result == 0);
DTEST_LOG << "DmsHiSysEventReportTest DmsHiSysEventReportTest_012 end "<< std::endl;
}
}
}
@@ -0,0 +1,32 @@
/*
* 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 HISYS_EVENT_REPORT_TEST_H
#define HISYS_EVENT_REPORT_TEST_H
#include "gtest/gtest.h"
namespace OHOS {
namespace DistributedSchedule {
class DmsHiSysEventReportTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp();
void TearDown();
};
} // namespace DistributedSchedule
} // namespace OHOS
#endif // HISYS_EVENT_REPORT_TEST_H