diff --git a/OAT.xml b/OAT.xml
index 72b2731129b1887e9dedeaab90b68a25964f6fdb..f50b452b4e22bb02c662b938f80b30ca2067beb8 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -61,7 +61,7 @@ Note:If the text contains special characters, please escape them according to th
-
+
diff --git a/common/test/unittest/common_perf_profile_test/common_perf_profile_test.cpp b/common/test/unittest/common_perf_profile_test/common_perf_profile_test.cpp
index d262dbff5e128baaf43f5dad3e711271292af8d7..ebf39ea89aae850baec2dd4ec7fb97d5564e1419 100644
--- a/common/test/unittest/common_perf_profile_test/common_perf_profile_test.cpp
+++ b/common/test/unittest/common_perf_profile_test/common_perf_profile_test.cpp
@@ -746,4 +746,4 @@ HWTEST_F(CommonPerfProfileTest, PerfProfileEnable_001, TestSize.Level0)
PerfProfile::GetInstance().Reset();
profileFlag = PerfProfile::GetInstance().GetPerfProfileEnabled();
ASSERT_TRUE(profileFlag);
-}
+}
\ No newline at end of file
diff --git a/interfaces/innerkits/appexecfwk_base/include/form_constants.h b/interfaces/innerkits/appexecfwk_base/include/form_constants.h
index cfd1fc11dc5f2d93b6702908938a84e6e4f96e9c..fb8b4e262e638df84e8868cf56b9283a2a84fbef 100644
--- a/interfaces/innerkits/appexecfwk_base/include/form_constants.h
+++ b/interfaces/innerkits/appexecfwk_base/include/form_constants.h
@@ -94,7 +94,7 @@ namespace Constants {
const std::string PARAM_FORM_MANAGER_SERVICE_BUNDLENAME_KEY = "form_manager_service_bundlename";
// PROVIDER_FLAG false:ProviderFormInfo is null;true: ProviderFormInfo not null
- const std::string PROVIDER_FLAG = "provider_flag";
+ const std::string PROVIDER_FLAG = "provider_flag";
const std::string FORM_CONNECT_ID = "form_connect_id";
const std::string FORM_SUPPLY_INFO = "form_supply_info";
diff --git a/interfaces/innerkits/appexecfwk_base/include/form_js_info.h b/interfaces/innerkits/appexecfwk_base/include/form_js_info.h
index ac079d6bde1ece99ebc292976a1f31f548c74e6e..eb6d2e884a4131393ee45393edc6d9d918fa1764 100644
--- a/interfaces/innerkits/appexecfwk_base/include/form_js_info.h
+++ b/interfaces/innerkits/appexecfwk_base/include/form_js_info.h
@@ -41,7 +41,7 @@ struct FormJsInfo : public Parcelable {
std::string cssPath;
std::string jsPath;
std::string fileReousePath;
-
+
bool ReadFromParcel(Parcel &parcel);
virtual bool Marshalling(Parcel &parcel) const override;
static FormJsInfo *Unmarshalling(Parcel &parcel);
diff --git a/interfaces/innerkits/appexecfwk_base/src/form_js_info.cpp b/interfaces/innerkits/appexecfwk_base/src/form_js_info.cpp
index d78ff08a84067edc2e2743db21f705c37744ed89..0b02ae316c4d3ef5bc165252477d327d7220b370 100644
--- a/interfaces/innerkits/appexecfwk_base/src/form_js_info.cpp
+++ b/interfaces/innerkits/appexecfwk_base/src/form_js_info.cpp
@@ -30,10 +30,10 @@ bool FormJsInfo::ReadFromParcel(Parcel &parcel)
formData = Str16ToStr8(parcel.ReadString16());
auto bindingData = parcel.ReadParcelable();
- formProviderData = *bindingData;
- if (nullptr == bindingData) {
+ if (nullptr == bindingData){
return false;
}
+ formProviderData = *bindingData;
return true;
}
diff --git a/interfaces/innerkits/appexecfwk_base/src/form_provider_data.cpp b/interfaces/innerkits/appexecfwk_base/src/form_provider_data.cpp
index c929b6ec8ea138f393be3c6c7d3f553a197bfbbc..66a186f811b69ed8d8db1554ea8539bcba7060f2 100644
--- a/interfaces/innerkits/appexecfwk_base/src/form_provider_data.cpp
+++ b/interfaces/innerkits/appexecfwk_base/src/form_provider_data.cpp
@@ -266,7 +266,7 @@ bool FormProviderData::Marshalling(Parcel &parcel) const
* @brief Unmarshals this {@code FormProviderData} object from a {@link ohos.utils.Parcel} object.
* @param parcel Indicates the {@code Parcel} object for unmarshalling.
* @return FormProviderData.
- */
+ */
FormProviderData* FormProviderData::Unmarshalling(Parcel &parcel)
{
std::unique_ptr formProviderData = std::make_unique();
@@ -278,7 +278,7 @@ FormProviderData* FormProviderData::Unmarshalling(Parcel &parcel)
/**
* @brief Clear imageDataMap, rawImageBytesMap_, imageDataState_ and jsonFormProviderData_.
- */
+ */
void FormProviderData::ClearData()
{
jsonFormProviderData_.clear();
diff --git a/interfaces/innerkits/appexecfwk_base/src/form_provider_info.cpp b/interfaces/innerkits/appexecfwk_base/src/form_provider_info.cpp
index e7824e24f3c8d001fe8d4ccc837e773369252fa6..0af60cc16357003853a63b7753c4431e5a758cab 100644
--- a/interfaces/innerkits/appexecfwk_base/src/form_provider_info.cpp
+++ b/interfaces/innerkits/appexecfwk_base/src/form_provider_info.cpp
@@ -39,7 +39,6 @@ bool FormProviderInfo::Marshalling(Parcel &parcel) const
if (!parcel.WriteParcelable(&jsBindingData_)) {
return false;
}
-
return true;
}
void FormProviderInfo::SetFormDataString(std::string &dataString)
@@ -49,7 +48,7 @@ void FormProviderInfo::SetFormDataString(std::string &dataString)
/**
* @brief Merge new data to FormProviderData.
* @param addJsonData data to merge to FormProviderData
- */
+ */
void FormProviderInfo::MergeData(nlohmann::json &addJsonData)
{
jsBindingData_.MergeData(addJsonData);
diff --git a/interfaces/innerkits/appexecfwk_core/BUILD.gn b/interfaces/innerkits/appexecfwk_core/BUILD.gn
index 2447b3f3084d63195db16dd2beadb7f75d3539b2..d49be1ae50745bd64d8239428c20ff1c8dffa34a 100644
--- a/interfaces/innerkits/appexecfwk_core/BUILD.gn
+++ b/interfaces/innerkits/appexecfwk_core/BUILD.gn
@@ -119,6 +119,7 @@ ohos_shared_library("appexecfwk_core") {
"hiviewdfx_hilog_native:libhilog",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
+ "bytrace_standard:bytrace_core",
]
subsystem_name = "appexecfwk"
diff --git a/interfaces/innerkits/appexecfwk_core/include/appmgr/app_mgr_constants.h b/interfaces/innerkits/appexecfwk_core/include/appmgr/app_mgr_constants.h
index eedab3f61957910c462a4a1e17b50ed2caad3aad..a23c835dc1da48c05b5776bd61bf844e1f63cc44 100644
--- a/interfaces/innerkits/appexecfwk_core/include/appmgr/app_mgr_constants.h
+++ b/interfaces/innerkits/appexecfwk_core/include/appmgr/app_mgr_constants.h
@@ -20,6 +20,7 @@ namespace OHOS {
namespace AppExecFwk {
namespace Constants {
const std::string APP_MGR_SERVICE_NAME = "AppMgrService";
+const std::string USER_ID = "UserId";
} // namespace Constants
enum class ApplicationState {
diff --git a/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h b/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h
old mode 100644
new mode 100755
index 053c4af4b41b7d958f59cd992ac4dcf76b5da726..6ceeb84f9ed22a6189ce6b7ef0126dcd02342cdd
--- a/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h
+++ b/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_interface.h
@@ -394,7 +394,7 @@ public:
* @param userId Indicates the user id.
* @return Returns true if the data cleared successfully; returns false otherwise.
*/
- virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) = 0;
+ virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0) = 0;
/**
* @brief Register the specific bundle status callback.
* @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result.
diff --git a/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_proxy.h b/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_proxy.h
old mode 100644
new mode 100755
index 1e6409aed5de8d7c57ae5a1d51f2b4bfeeabdf99..74ab769d0109146aa9d974cc75e83811b4a77842
--- a/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_proxy.h
+++ b/interfaces/innerkits/appexecfwk_core/include/bundlemgr/bundle_mgr_proxy.h
@@ -360,7 +360,7 @@ public:
* @param userId Indicates the user id.
* @return Returns true if the data cleared successfully; returns false otherwise.
*/
- virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override;
+ virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0) override;
/**
* @brief Register the specific bundle status callback through the proxy object.
* @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result.
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_proxy.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_proxy.cpp
index b08eeb80ee681efdaad02eca0915b4f597b35bb5..e95c5556526d77fb00b44b599a5892f7f6cd8153 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_proxy.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_proxy.cpp
@@ -14,12 +14,12 @@
*/
#include "ams_mgr_proxy.h"
-#include "string_ex.h"
#include "ipc_types.h"
#include "iremote_object.h"
+#include "string_ex.h"
-#include "appexecfwk_errors.h"
#include "app_log_wrapper.h"
+#include "appexecfwk_errors.h"
namespace OHOS {
namespace AppExecFwk {
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_stub.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_stub.cpp
index 2633911ce74bfc84496443df0f752905cb03bd25..371e5581745f546a9e5ff52a7008c5e8162955fb 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_stub.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/ams_mgr_stub.cpp
@@ -20,10 +20,11 @@
#include "iremote_object.h"
#include "ability_info.h"
-#include "appexecfwk_errors.h"
#include "app_log_wrapper.h"
#include "app_mgr_proxy.h"
#include "app_scheduler_interface.h"
+#include "appexecfwk_errors.h"
+#include "bytrace.h"
#include "iapp_state_callback.h"
namespace OHOS {
@@ -80,6 +81,7 @@ int AmsMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParce
ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
sptr preToke = data.ReadParcelable();
std::shared_ptr abilityInfo(data.ReadParcelable());
@@ -100,6 +102,7 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply)
ErrCode AmsMgrStub::HandleTerminateAbility(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
TerminateAbility(token);
return NO_ERROR;
@@ -107,6 +110,7 @@ ErrCode AmsMgrStub::HandleTerminateAbility(MessageParcel &data, MessageParcel &r
ErrCode AmsMgrStub::HandleUpdateAbilityState(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
int32_t state = data.ReadInt32();
UpdateAbilityState(token, static_cast(state));
@@ -115,6 +119,7 @@ ErrCode AmsMgrStub::HandleUpdateAbilityState(MessageParcel &data, MessageParcel
ErrCode AmsMgrStub::HandleRegisterAppStateCallback(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr obj = data.ReadParcelable();
sptr callback = iface_cast(obj);
RegisterAppStateCallback(callback);
@@ -123,12 +128,14 @@ ErrCode AmsMgrStub::HandleRegisterAppStateCallback(MessageParcel &data, MessageP
ErrCode AmsMgrStub::HandleReset(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
Reset();
return NO_ERROR;
}
ErrCode AmsMgrStub::HandleAbilityBehaviorAnalysis(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
sptr preToke = data.ReadParcelable();
int32_t visibility = data.ReadInt32();
@@ -141,6 +148,7 @@ ErrCode AmsMgrStub::HandleAbilityBehaviorAnalysis(MessageParcel &data, MessagePa
ErrCode AmsMgrStub::HandleKillProcessByAbilityToken(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
KillProcessByAbilityToken(token);
@@ -149,6 +157,7 @@ ErrCode AmsMgrStub::HandleKillProcessByAbilityToken(MessageParcel &data, Message
ErrCode AmsMgrStub::HandleKillApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::string bundleName = data.ReadString();
int32_t result = KillApplication(bundleName);
reply.WriteInt32(result);
@@ -157,6 +166,7 @@ ErrCode AmsMgrStub::HandleKillApplication(MessageParcel &data, MessageParcel &re
ErrCode AmsMgrStub::HandleKillApplicationByUid(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::string bundleName = data.ReadString();
int uid = data.ReadInt32();
int32_t result = KillApplicationByUid(bundleName, uid);
@@ -166,6 +176,7 @@ ErrCode AmsMgrStub::HandleKillApplicationByUid(MessageParcel &data, MessageParce
int32_t AmsMgrStub::HandleAbilityAttachTimeOut(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
AbilityAttachTimeOut(token);
return NO_ERROR;
@@ -173,6 +184,7 @@ int32_t AmsMgrStub::HandleAbilityAttachTimeOut(MessageParcel &data, MessageParce
int32_t AmsMgrStub::HandleCompelVerifyPermission(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
auto permission = Str16ToStr8(data.ReadString16());
auto pid = data.ReadInt32();
auto uid = data.ReadInt32();
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_client.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_client.cpp
index f6a1b22d35f17b0b46606d712cdd09dfad6e4ac6..198006e7e33ff0940f2eb4afffebf4b27b7cc1d3 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_client.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_client.cpp
@@ -22,9 +22,9 @@
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
+#include "app_log_wrapper.h"
#include "app_mgr_interface.h"
#include "app_service_manager.h"
-#include "app_log_wrapper.h"
namespace OHOS {
namespace AppExecFwk {
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_stub.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_stub.cpp
index 32cb6e49740092e0d1692771e398ee2a13a209f0..97b54695c05348e50be4fc1f3438977767f9a244 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_stub.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_mgr_stub.cpp
@@ -20,10 +20,11 @@
#include "iremote_object.h"
#include "ability_info.h"
-#include "appexecfwk_errors.h"
#include "app_log_wrapper.h"
#include "app_mgr_proxy.h"
#include "app_scheduler_interface.h"
+#include "appexecfwk_errors.h"
+#include "bytrace.h"
#include "iapp_state_callback.h"
namespace OHOS {
@@ -88,6 +89,7 @@ int AppMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParce
int32_t AppMgrStub::HandleAttachApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr client = data.ReadParcelable();
AttachApplication(client);
return NO_ERROR;
@@ -95,24 +97,28 @@ int32_t AppMgrStub::HandleAttachApplication(MessageParcel &data, MessageParcel &
int32_t AppMgrStub::HandleApplicationForegrounded(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ApplicationForegrounded(data.ReadInt32());
return NO_ERROR;
}
int32_t AppMgrStub::HandleApplicationBackgrounded(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ApplicationBackgrounded(data.ReadInt32());
return NO_ERROR;
}
int32_t AppMgrStub::HandleApplicationTerminated(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ApplicationTerminated(data.ReadInt32());
return NO_ERROR;
}
int32_t AppMgrStub::HandleCheckPermission(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
int32_t recordId = data.ReadInt32();
std::string permission = data.ReadString();
int32_t result = CheckPermission(recordId, permission);
@@ -122,6 +128,7 @@ int32_t AppMgrStub::HandleCheckPermission(MessageParcel &data, MessageParcel &re
int32_t AppMgrStub::HandleAbilityCleaned(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
AbilityCleaned(token);
return NO_ERROR;
@@ -129,6 +136,7 @@ int32_t AppMgrStub::HandleAbilityCleaned(MessageParcel &data, MessageParcel &rep
int32_t AppMgrStub::HandleGetAmsMgr(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
int32_t result = NO_ERROR;
sptr amsMgr = GetAmsMgr();
if (!amsMgr) {
@@ -146,6 +154,7 @@ int32_t AppMgrStub::HandleGetAmsMgr(MessageParcel &data, MessageParcel &reply)
int32_t AppMgrStub::HandleClearUpApplicationData(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::string bundleName = data.ReadString();
int32_t result = ClearUpApplicationData(bundleName);
reply.WriteInt32(result);
@@ -154,6 +163,7 @@ int32_t AppMgrStub::HandleClearUpApplicationData(MessageParcel &data, MessagePar
int32_t AppMgrStub::HandleIsBackgroundRunningRestricted(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::string bundleName = data.ReadString();
int32_t result = IsBackgroundRunningRestricted(bundleName);
reply.WriteInt32(result);
@@ -162,6 +172,7 @@ int32_t AppMgrStub::HandleIsBackgroundRunningRestricted(MessageParcel &data, Mes
int32_t AppMgrStub::HandleGetAllRunningProcesses(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::vector info;
auto result = GetAllRunningProcesses(info);
reply.WriteInt32(info.size());
@@ -178,12 +189,14 @@ int32_t AppMgrStub::HandleGetAllRunningProcesses(MessageParcel &data, MessagePar
int32_t AppMgrStub::HandleSetAppFreezingTime(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
SetAppFreezingTime(data.ReadInt32());
return NO_ERROR;
}
int32_t AppMgrStub::HandleGetAppFreezingTime(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
int time = 0;
GetAppFreezingTime(time);
reply.WriteInt32(time);
@@ -192,6 +205,7 @@ int32_t AppMgrStub::HandleGetAppFreezingTime(MessageParcel &data, MessageParcel
int32_t AppMgrStub::HandleGetSystemMemoryAttr(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
SystemMemoryAttr memoryInfo;
std::string strConfig;
data.ReadString(strConfig);
@@ -205,6 +219,7 @@ int32_t AppMgrStub::HandleGetSystemMemoryAttr(MessageParcel &data, MessageParcel
int32_t AppMgrStub::HandleAddAbilityStageDone(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
int32_t recordId = data.ReadInt32();
AddAbilityStageDone(recordId);
return NO_ERROR;
@@ -212,6 +227,7 @@ int32_t AppMgrStub::HandleAddAbilityStageDone(MessageParcel &data, MessageParcel
int32_t AppMgrStub::HandleStartupResidentProcess(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
StartupResidentProcess();
return NO_ERROR;
}
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_host.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_host.cpp
index 08eb60495c1717d8acc0d3b7b4a50830e5f18a99..3b331932b9839db1b2dc2e8d604fd8b72e0a4282 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_host.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_host.cpp
@@ -14,10 +14,11 @@
*/
#include "app_scheduler_host.h"
-#include "ipc_types.h"
#include "ability_info.h"
-#include "appexecfwk_errors.h"
#include "app_log_wrapper.h"
+#include "appexecfwk_errors.h"
+#include "bytrace.h"
+#include "ipc_types.h"
namespace OHOS {
namespace AppExecFwk {
@@ -76,36 +77,42 @@ int AppSchedulerHost::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag
int32_t AppSchedulerHost::HandleScheduleForegroundApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleForegroundApplication();
return NO_ERROR;
}
int32_t AppSchedulerHost::HandleScheduleBackgroundApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleBackgroundApplication();
return NO_ERROR;
}
int32_t AppSchedulerHost::HandleScheduleTerminateApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleTerminateApplication();
return NO_ERROR;
}
int32_t AppSchedulerHost::HandleScheduleLowMemory(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleLowMemory();
return NO_ERROR;
}
int32_t AppSchedulerHost::HandleScheduleShrinkMemory(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleShrinkMemory(data.ReadInt32());
return NO_ERROR;
}
int32_t AppSchedulerHost::HandleScheduleLaunchAbility(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr abilityInfo(data.ReadParcelable());
if (!abilityInfo) {
APP_LOGE("ReadParcelable failed");
@@ -119,6 +126,7 @@ int32_t AppSchedulerHost::HandleScheduleLaunchAbility(MessageParcel &data, Messa
int32_t AppSchedulerHost::HandleScheduleCleanAbility(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr token = data.ReadParcelable();
ScheduleCleanAbility(token);
return NO_ERROR;
@@ -126,6 +134,7 @@ int32_t AppSchedulerHost::HandleScheduleCleanAbility(MessageParcel &data, Messag
int32_t AppSchedulerHost::HandleScheduleLaunchApplication(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr launchData(data.ReadParcelable());
if (!launchData) {
@@ -139,6 +148,7 @@ int32_t AppSchedulerHost::HandleScheduleLaunchApplication(MessageParcel &data, M
int32_t AppSchedulerHost::HandleScheduleAbilityStageInfo(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr appResidentProcessInfo(data.ReadParcelable());
if (!appResidentProcessInfo) {
APP_LOGE("ReadParcelable failed");
@@ -151,6 +161,7 @@ int32_t AppSchedulerHost::HandleScheduleAbilityStageInfo(MessageParcel &data, Me
int32_t AppSchedulerHost::HandleScheduleProfileChanged(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr profile(data.ReadParcelable());
if (!profile) {
APP_LOGE("ReadParcelable failed");
@@ -163,6 +174,7 @@ int32_t AppSchedulerHost::HandleScheduleProfileChanged(MessageParcel &data, Mess
int32_t AppSchedulerHost::HandleScheduleConfigurationUpdated(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr configuration(data.ReadParcelable());
if (!configuration) {
APP_LOGE("ReadParcelable failed");
@@ -175,6 +187,7 @@ int32_t AppSchedulerHost::HandleScheduleConfigurationUpdated(MessageParcel &data
int32_t AppSchedulerHost::HandleScheduleProcessSecurityExit(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
ScheduleProcessSecurityExit();
return NO_ERROR;
}
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_proxy.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_proxy.cpp
index d259562ea3609e1a0f6768d83a366908453be436..cefaac1f2967df88fa86b47ed201c8d582f30439 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_proxy.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_scheduler_proxy.cpp
@@ -15,10 +15,9 @@
#include "app_scheduler_proxy.h"
-#include "iremote_object.h"
-#include "ipc_types.h"
-
#include "app_log_wrapper.h"
+#include "ipc_types.h"
+#include "iremote_object.h"
namespace OHOS {
namespace AppExecFwk {
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_service_manager.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_service_manager.cpp
index 86e7bafb9e00b3156cf34068a3b0540c55a309ef..ef8c513f7f671d4d761e60458eb6b9b55845aca9 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_service_manager.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_service_manager.cpp
@@ -15,12 +15,12 @@
#include "app_service_manager.h"
+#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
#include "system_ability_definition.h"
-#include "if_system_ability_manager.h"
-#include "iservice_registry.h"
#include "app_mgr_constants.h"
+#include "iservice_registry.h"
namespace OHOS {
namespace AppExecFwk {
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_state_callback_host.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_state_callback_host.cpp
index fded57e6c9f76b98cd27fa1a5ade316230ff10ac..2a953aff5b962a590724a5b20502621b122e7785 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/app_state_callback_host.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/app_state_callback_host.cpp
@@ -15,9 +15,9 @@
#include "app_state_callback_host.h"
-#include "appexecfwk_errors.h"
#include "app_log_wrapper.h"
-
+#include "appexecfwk_errors.h"
+#include "bytrace.h"
#include "ipc_types.h"
#include "iremote_object.h"
@@ -71,6 +71,7 @@ void AppStateCallbackHost::OnAppStateChanged(const AppProcessData &)
int32_t AppStateCallbackHost::HandleOnAppStateChanged(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
std::unique_ptr processData(data.ReadParcelable());
if (!processData) {
APP_LOGE("ReadParcelable failed");
@@ -83,6 +84,7 @@ int32_t AppStateCallbackHost::HandleOnAppStateChanged(MessageParcel &data, Messa
int32_t AppStateCallbackHost::HandleOnAbilityRequestDone(MessageParcel &data, MessageParcel &reply)
{
+ BYTRACE(BYTRACE_TAG_APP);
sptr obj = data.ReadParcelable();
int32_t state = data.ReadInt32();
OnAbilityRequestDone(obj, static_cast(state));
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/configuration.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/configuration.cpp
old mode 100644
new mode 100755
index 5bb183a980c1b99d49aef339152f8f83888d6531..9fca79f9afd9394a0e4da98a8c67a10fca391630
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/configuration.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/configuration.cpp
@@ -13,10 +13,12 @@
* limitations under the License.
*/
+#include "configuration.h"
+
#include
-#include "string_ex.h"
+
#include "app_log_wrapper.h"
-#include "configuration.h"
+#include "string_ex.h"
namespace ConfigurationInner {
const std::string CONNECTION_SYMBOL {"#"};
const std::string EMPTY_STRING {""};
@@ -138,7 +140,7 @@ std::string Configuration::GetValue(const std::string &key) const
void Configuration::CompareDifferent(std::vector &diffKeyV, const Configuration &other)
{
if (other.GetItemSize() == 0) {
- return ;
+ return;
}
diffKeyV.clear();
diff --git a/interfaces/innerkits/appexecfwk_core/src/appmgr/process_info.cpp b/interfaces/innerkits/appexecfwk_core/src/appmgr/process_info.cpp
index e57d51f60f9f0af3754c25b052277185310a9c0e..de768ed07722392f5b13dca05375697796cc0c42 100644
--- a/interfaces/innerkits/appexecfwk_core/src/appmgr/process_info.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/appmgr/process_info.cpp
@@ -14,8 +14,9 @@
*/
#include "process_info.h"
-#include "string_ex.h"
+
#include "app_log_wrapper.h"
+#include "string_ex.h"
namespace OHOS {
namespace AppExecFwk {
diff --git a/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_proxy.cpp b/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_proxy.cpp
index cf1bb6dd8209674a6b4fa5a03ddfc48f4fc36f61..acbd26b85b4c7e2f42b741f09227e17b61f00fa7 100644
--- a/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_proxy.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_proxy.cpp
@@ -379,10 +379,10 @@ int FormMgrProxy::CastTempForm(const int64_t formId, const sptr &
MessageOption option;
int error = Remote()->SendRequest(
static_cast(
- IFormMgr::Message::FORM_MGR_CAST_TEMP_FORM),
- data,
- reply,
- option);
+ IFormMgr::Message::FORM_MGR_CAST_TEMP_FORM),
+ data,
+ reply,
+ option);
if (error != ERR_OK) {
APP_LOGE("%{public}s, failed to SendRequest: %{public}d", __func__, error);
return ERR_APPEXECFWK_FORM_SEND_FMS_MSG;
@@ -455,7 +455,7 @@ int FormMgrProxy::DumpFormInfoByFormId(const std::int64_t formId, std::string &f
int error = GetStringInfo(IFormMgr::Message::FORM_MGR_FORM_INFOS_BY_ID, data, formInfo);
if (error != ERR_OK) {
- APP_LOGE("%{public}s, failed to GetStringInfo: %{public}d", __func__, error);
+ APP_LOGE("%{public}s, failed to GetStringInfo: %{public}d", __func__, error);
}
return error;
@@ -480,7 +480,7 @@ int FormMgrProxy::DumpFormTimerByFormId(const std::int64_t formId, std::string &
int error = GetStringInfo(IFormMgr::Message::FORM_MGR_FORM_TIMER_INFO_BY_ID, data, isTimingService);
if (error != ERR_OK) {
- APP_LOGE("%{public}s, failed to GetStringInfo: %{public}d", __func__, error);
+ APP_LOGE("%{public}s, failed to GetStringInfo: %{public}d", __func__, error);
}
return error;
@@ -512,13 +512,13 @@ int FormMgrProxy::MessageEvent(const int64_t formId, const Want &want, const spt
APP_LOGE("%{public}s, failed to write callerToken", __func__);
return ERR_APPEXECFWK_PARCEL_ERROR;
}
-
+
MessageParcel reply;
MessageOption option;
int error = Remote()->SendRequest(
- static_cast(IFormMgr::Message::FORM_MGR_MESSAGE_EVENT),
- data,
- reply,
+ static_cast(IFormMgr::Message::FORM_MGR_MESSAGE_EVENT),
+ data,
+ reply,
option);
if (error != ERR_OK) {
APP_LOGE("%{public}s, failed to SendRequest: %{public}d", __func__, error);
@@ -636,7 +636,7 @@ int FormMgrProxy::SendTransactCmd(IFormMgr::Message code, MessageParcel &data, M
int32_t result = remote->SendRequest(static_cast(code), data, reply, option);
if (result != ERR_OK) {
APP_LOGE("%{public}s, failed to SendRequest: %{public}d, cmd: %{public}d", __func__, result, code);
- return ERR_APPEXECFWK_FORM_SEND_FMS_MSG;
+ return ERR_APPEXECFWK_FORM_SEND_FMS_MSG;
}
return ERR_OK;
}
diff --git a/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_stub.cpp b/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_stub.cpp
index cb6d0ed4fb386568e1a45a79c1438b09a841264b..a5855a2000380351ecd6b151685d2b92e41f37f7 100644
--- a/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_stub.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/formmgr/form_mgr_stub.cpp
@@ -409,7 +409,7 @@ int32_t FormMgrStub::HandleMessageEvent(MessageParcel &data, MessageParcel &repl
APP_LOGE("%{public}s, failed to ReadParcelable", __func__);
return ERR_APPEXECFWK_PARCEL_ERROR;
}
-
+
int32_t result = MessageEvent(formId, *want, client);
reply.WriteInt32(result);
return result;
diff --git a/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_proxy.cpp b/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_proxy.cpp
index eb433ebd4e68dce02e0bff470c13de67cb007f72..cb2079772655920142a75321495b11a17093f945 100644
--- a/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_proxy.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_proxy.cpp
@@ -47,7 +47,7 @@ void ProviderConnectProxy::OnAbilityConnectDone(
return;
}
- if (!data.WriteParcelable(remoteObject)) {
+ if (!data.WriteRemoteObject(remoteObject)) {
APP_LOGE("%{public}s, failed to write remote object ", __func__);
return;
}
diff --git a/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_stub.cpp b/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_stub.cpp
index cee0890826f015e1247914e34c59aa5f6773395a..d925c349a3de9606f17a04b1cf8720ba18b512ed 100644
--- a/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_stub.cpp
+++ b/interfaces/innerkits/appexecfwk_core/src/formmgr/provider_connect_stub.cpp
@@ -46,7 +46,7 @@ int ProviderConnectStub::OnRemoteRequest(
APP_LOGE("%{public}s failed, callback stub receive element is nullptr", __func__);
return ERR_APPEXECFWK_PARCEL_ERROR;
}
- auto remoteObject = data.ReadParcelable();
+ auto remoteObject = data.ReadRemoteObject();
auto resultCode = data.ReadInt32();
OnAbilityConnectDone(*element, remoteObject, resultCode);
delete element;
diff --git a/interfaces/innerkits/eventhandler_native/eventhandler/native_interface_eventhandler.cpp b/interfaces/innerkits/eventhandler_native/eventhandler/native_interface_eventhandler.cpp
index 317e0b630e57b79229639b2f838e10ac398af279..83b2bd62dae68ff8a50bc3b57bd4ea7d8f5b6760 100644
--- a/interfaces/innerkits/eventhandler_native/eventhandler/native_interface_eventhandler.cpp
+++ b/interfaces/innerkits/eventhandler_native/eventhandler/native_interface_eventhandler.cpp
@@ -14,8 +14,9 @@
*/
#include "native_interface_eventhandler.h"
-#include "native_implement_eventhandler.h"
#include "hilog/log.h"
+#include "native_implement_eventhandler.h"
+
#include
using OHOS::ErrCode;
diff --git a/interfaces/innerkits/fmskit/native/include/form_mgr.h b/interfaces/innerkits/fmskit/native/include/form_mgr.h
index 8c979be3a3046f26cc1aa5d0b699702cfdcf3f25..a6d60915b05b6cf2c2aeb6f0a13c8899aa05ef16 100644
--- a/interfaces/innerkits/fmskit/native/include/form_mgr.h
+++ b/interfaces/innerkits/fmskit/native/include/form_mgr.h
@@ -42,7 +42,6 @@ class FormMgr final : public DelayedRefSingleton {
DECLARE_DELAYED_REF_SINGLETON(FormMgr)
public:
DISALLOW_COPY_AND_MOVE(FormMgr);
-
/**
* @brief Add form with want, send want to form manager service.
* @param formId The Id of the forms to add.
@@ -61,7 +60,7 @@ public:
* @return Returns ERR_OK on success, others on failure.
*/
int DeleteForm(const int64_t formId, const sptr &callerToken);
-
+
/**
* @brief Release forms with formIds, send formIds to form manager service.
* @param formId The Id of the forms to release.
@@ -162,7 +161,7 @@ public:
/**
* @brief UnRegister death callback.
- *
+ *
* @param formDeathCallback The death callback.
*/
void UnRegisterDeathCallback(const std::shared_ptr &formDeathCallback);
@@ -183,8 +182,8 @@ public:
* @param updateType Next refresh time.
* @return Returns ERR_OK on success, others on failure.
*/
- int LifecycleUpdate(const std::vector &formIds, const sptr &callerToken,
- const int32_t updateType);
+ int LifecycleUpdate(const std::vector &formIds, const sptr &callerToken,
+ const int32_t updateType);
/**
* @brief Set fms recoverStatus.
@@ -213,7 +212,7 @@ public:
/**
* @brief Get the error message content.
- *
+ *
* @param errCode Error code.
* @return Message content.
*/
diff --git a/interfaces/innerkits/fmskit/native/src/form_mgr.cpp b/interfaces/innerkits/fmskit/native/src/form_mgr.cpp
index b70daef0f45896b9448a27ec5d0810a746fc1d8b..e7f3b4f5b074b2943fd815dca91d3eae56e90dfc 100644
--- a/interfaces/innerkits/fmskit/native/src/form_mgr.cpp
+++ b/interfaces/innerkits/fmskit/native/src/form_mgr.cpp
@@ -13,11 +13,13 @@
* limitations under the License.
*/
+#include "form_mgr.h"
+
#include
-#include "appexecfwk_errors.h"
+
#include "app_log_wrapper.h"
+#include "appexecfwk_errors.h"
#include "form_errors.h"
-#include "form_mgr.h"
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
@@ -218,7 +220,7 @@ int FormMgr::DumpFormInfoByFormId(const std::int64_t formId, std::string &formIn
if (errCode != ERR_OK) {
return errCode;
}
-
+
return remoteProxy_->DumpFormInfoByFormId(formId, formInfo);
}
/**
@@ -233,7 +235,7 @@ int FormMgr::DumpFormTimerByFormId(const std::int64_t formId, std::string &isTim
if (errCode != ERR_OK) {
return errCode;
}
-
+
return remoteProxy_->DumpFormTimerByFormId(formId, isTimingService);
}
/**
@@ -249,7 +251,7 @@ int FormMgr::MessageEvent(const int64_t formId, const Want &want, const sptrMessageEvent(formId, want, callerToken);
}
@@ -265,7 +267,7 @@ int FormMgr::SetNextRefreshTime(const int64_t formId, const int64_t nextTime)
if (errCode != ERR_OK) {
return errCode;
}
-
+
return remoteProxy_->SetNextRefreshTime(formId, nextTime);
}
@@ -526,7 +528,7 @@ void FormMgr::SetFormMgrService(sptr formMgrService)
int FormMgr::DistributedDataAddForm(const Want &want)
{
APP_LOGI("%{public}s called.", __func__);
-
+
int errCode = Connect();
if (errCode != ERR_OK) {
return errCode;
@@ -543,7 +545,7 @@ int FormMgr::DistributedDataAddForm(const Want &want)
int FormMgr::DistributedDataDeleteForm(const std::string &formId)
{
APP_LOGI("%{public}s called.", __func__);
-
+
int errCode = Connect();
if (errCode != ERR_OK) {
return errCode;
diff --git a/interfaces/innerkits/libeventhandler/BUILD.gn b/interfaces/innerkits/libeventhandler/BUILD.gn
index 53e2cf473d971e909bd9d3cfa8440d5b9ba5b0e6..7c2513840ff2e3636c330e79e701754fdded9122 100644
--- a/interfaces/innerkits/libeventhandler/BUILD.gn
+++ b/interfaces/innerkits/libeventhandler/BUILD.gn
@@ -32,7 +32,10 @@ ohos_shared_library("libeventhandler") {
public_configs = [ ":public_libeventhandler_config" ]
- external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
+ external_deps = [
+ "hiviewdfx_hilog_native:libhilog",
+ "hitrace_native:libhitrace",
+ ]
subsystem_name = "appexecfwk"
part_name = "eventhandler"
}
diff --git a/interfaces/innerkits/libeventhandler/include/inner_event.h b/interfaces/innerkits/libeventhandler/include/inner_event.h
index 0cd2e3f1aea2d3b2617c5ec31060fa9465bcaa8b..e05a7c0497c4dc7a733ded5885d1bb4cb2912cc0 100644
--- a/interfaces/innerkits/libeventhandler/include/inner_event.h
+++ b/interfaces/innerkits/libeventhandler/include/inner_event.h
@@ -26,7 +26,13 @@
#include "nocopyable.h"
namespace OHOS {
+namespace HiviewDFX {
+class HiTraceId;
+}
+
namespace AppExecFwk {
+using HiTraceId = OHOS::HiviewDFX::HiTraceId;
+
class EventHandler;
const std::string LINE_SEPARATOR = "\n";
@@ -425,6 +431,21 @@ private:
smartPtrTypeId_ = CalculateSmartPtrTypeId(object);
}
+ /**
+ * if event has trace id ,return trace id, else create span id,
+ * store it in event and return.
+ *
+ * @return return hiTrace Id.
+ */
+ const std::shared_ptr GetOrCreateTraceId();
+
+ /**
+ * return trace id.
+ *
+ * @return return hiTrace Id.
+ */
+ const std::shared_ptr GetTraceId();
+
/*
* Calculate the type id for different smart pointers.
*/
@@ -499,6 +520,9 @@ private:
// Used for synchronized event.
std::shared_ptr waiter_;
+
+ // use to store hitrace Id
+ std::shared_ptr hiTraceId_;
};
} // namespace AppExecFwk
} // namespace OHOS
diff --git a/interfaces/innerkits/napi/BUILD.gn b/interfaces/innerkits/napi/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..b6bcbe472bbde495f7af789a069e2527038abc1e
--- /dev/null
+++ b/interfaces/innerkits/napi/BUILD.gn
@@ -0,0 +1,20 @@
+# Copyright (c) 2021 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")
+
+group("napi_packages") {
+ deps = [
+ "${innerkits_path}/napi/eventhandler:emitter",
+ ]
+}
diff --git a/interfaces/innerkits/napi/eventhandler/BUILD.gn b/interfaces/innerkits/napi/eventhandler/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..4844c477ee0a0286a037e20863089e99dd077bdc
--- /dev/null
+++ b/interfaces/innerkits/napi/eventhandler/BUILD.gn
@@ -0,0 +1,50 @@
+# Copyright (c) 2021 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")
+import("//build/ohos/ace/ace.gni")
+import("//foundation/appexecfwk/standard/appexecfwk.gni")
+
+config("native_module_config") {
+ include_dirs = [ "include" ]
+}
+
+ohos_shared_library("emitter") {
+ include_dirs = [
+ "${innerkits_path}/libeventhandler/include",
+ "//third_party/node/src",
+ "//third_party/libuv/include",
+ ]
+
+ configs = [ ":native_module_config" ]
+
+ sources = [
+ "src/events_emitter.cpp",
+ "src/init.cpp",
+ ]
+
+ deps = [
+ "${innerkits_path}/libeventhandler:libeventhandler",
+ "//third_party/libuv:uv_static",
+ ]
+
+ external_deps = [
+ "hiviewdfx_hilog_native:libhilog",
+ "ipc:ipc_core",
+ "napi:ace_napi",
+ ]
+
+ relative_install_dir = "module"
+ subsystem_name = "appexecfwk"
+ part_name = "appexecfwk_standard"
+}
diff --git a/interfaces/innerkits/napi/eventhandler/include/events_emitter.h b/interfaces/innerkits/napi/eventhandler/include/events_emitter.h
new file mode 100644
index 0000000000000000000000000000000000000000..70c7a845642d2815f24fed3a7dbdf9052664623a
--- /dev/null
+++ b/interfaces/innerkits/napi/eventhandler/include/events_emitter.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_NAPI_EVENTHANDLER_JS_EMITTER_H
+#define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_NAPI_EVENTHANDLER_JS_EMITTER_H
+
+#include