From cd2f37dcc4bc09b440753670b0f4ec7c1c425c0c Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 20 Jun 2023 17:44:14 +0800
Subject: [PATCH] remove dependency and adapt for build

---
 bundle.json                                   |  3 ++-
 common/src/dfx/standard/dm_hisysevent.cpp     | 23 ++++++++--------
 common/src/dfx/standard/dm_hitrace.cpp        |  8 +++---
 ext/no_interaction_auth/BUILD.gn              | 10 +++----
 ext/pin_auth/BUILD.gn                         |  2 +-
 interfaces/inner_kits/native_cpp/BUILD.gn     |  4 +--
 interfaces/kits/js/BUILD.gn                   |  2 +-
 services/implementation/BUILD.gn              |  6 ++---
 services/service/BUILD.gn                     | 12 +++------
 .../ipc/standard/ipc_server_listener.h        |  1 +
 .../dmcommoneventmanager_fuzzer/BUILD.gn      |  2 +-
 .../dmdiscoverymanager_fuzzer/BUILD.gn        |  2 +-
 test/fuzztest/pinauth_fuzzer/BUILD.gn         |  2 +-
 test/fuzztest/pinauthui_fuzzer/BUILD.gn       |  2 +-
 test/unittest/BUILD.gn                        | 26 +++++++++----------
 test/unittest/UTTest_dm_dfx.h                 |  2 +-
 utils/BUILD.gn                                |  6 ++---
 .../standard/permission_manager.cpp           |  2 +-
 18 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/bundle.json b/bundle.json
index 5d6b7849..bee412cb 100644
--- a/bundle.json
+++ b/bundle.json
@@ -72,7 +72,8 @@
                         "device_manager_callback.h",
                         "dm_device_info.h",
                         "dm_publish_info.h",
-                        "dm_subscribe_info.h"
+                        "dm_subscribe_info.h",
+                        "dm_app_image_info.h"
                     ],
                     "header_base": "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include"
                 }
diff --git a/common/src/dfx/standard/dm_hisysevent.cpp b/common/src/dfx/standard/dm_hisysevent.cpp
index 4e9b2970..a508cb85 100644
--- a/common/src/dfx/standard/dm_hisysevent.cpp
+++ b/common/src/dfx/standard/dm_hisysevent.cpp
@@ -17,23 +17,24 @@
 
 #include "dm_constants.h"  // for DM_OK
 #include "dm_log.h"        // for LOGE
-#include "hisysevent.h"    // for HiSysEvent, HiSysEvent::Domain, HiSysEvent...
+// #include "hisysevent.h"    // for HiSysEvent, HiSysEvent::Domain, HiSysEvent...
 #include "unistd.h"        // for getpid, getuid
 
 namespace OHOS {
 namespace DistributedHardware {
 void SysEventWrite(const std::string &status, int32_t eventType, const std::string &msg)
 {
-    int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
-        OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DEVICE_MANAGER,
-        status.c_str(),
-        (OHOS::HiviewDFX::HiSysEvent::EventType)eventType,
-        "PID", getpid(),
-        "UID", getuid(),
-        "MSG", msg.c_str());
-    if (res != DM_OK) {
-        LOGE("%s Write HiSysEvent error, res:%d", status.c_str(), res);
-    }
+    return;
+    // int32_t res = OHOS::HiviewDFX::HiSysEvent::Write(
+    //     OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_DEVICE_MANAGER,
+    //     status.c_str(),
+    //     (OHOS::HiviewDFX::HiSysEvent::EventType)eventType,
+    //     "PID", getpid(),
+    //     "UID", getuid(),
+    //     "MSG", msg.c_str());
+    // if (res != DM_OK) {
+    //     LOGE("%s Write HiSysEvent error, res:%d", status.c_str(), res);
+    // }
 }
 } // namespace DistributedHardware
 } // namespace OHOS
diff --git a/common/src/dfx/standard/dm_hitrace.cpp b/common/src/dfx/standard/dm_hitrace.cpp
index 1bbe65fa..caa79885 100644
--- a/common/src/dfx/standard/dm_hitrace.cpp
+++ b/common/src/dfx/standard/dm_hitrace.cpp
@@ -13,18 +13,20 @@
  * limitations under the License.
  */
 #include "dm_hitrace.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
 
 namespace OHOS {
 namespace DistributedHardware {
 void DmTraceStart(const std::string &msg)
 {
-    StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg);
+    return;
+    // StartTrace(HITRACE_TAG_DEVICE_MANAGER, msg);
 }
 
 void DmTraceEnd()
 {
-    FinishTrace(HITRACE_TAG_DEVICE_MANAGER);
+    return;
+    // FinishTrace(HITRACE_TAG_DEVICE_MANAGER);
 }
 } // namespace DistributedHardware
 } // namespace OHOS
diff --git a/ext/no_interaction_auth/BUILD.gn b/ext/no_interaction_auth/BUILD.gn
index 231e60e4..29b7d6c1 100644
--- a/ext/no_interaction_auth/BUILD.gn
+++ b/ext/no_interaction_auth/BUILD.gn
@@ -72,12 +72,12 @@ if (defined(ohos_lite)) {
     ]
 
     external_deps = [
-      "ability_base:want",
-      "bundle_framework:appexecfwk_base",
-      "bundle_framework:appexecfwk_core",
+      # "ability_base:want",
+      #"bundle_framework:appexecfwk_base",
+      #"bundle_framework:appexecfwk_core",
       "c_utils:utils",
-      "common_event_service:cesfwk_core",
-      "common_event_service:cesfwk_innerkits",
+      # "common_event_service:cesfwk_core",
+      # "common_event_service:cesfwk_innerkits",
       "dsoftbus:softbus_client",
       "hiviewdfx_hilog_native:libhilog",
       "init:libbeget_proxy",
diff --git a/ext/pin_auth/BUILD.gn b/ext/pin_auth/BUILD.gn
index d49e4f4a..efcb0321 100644
--- a/ext/pin_auth/BUILD.gn
+++ b/ext/pin_auth/BUILD.gn
@@ -140,7 +140,7 @@ if (defined(ohos_lite)) {
     ]
 
     external_deps = [
-      "ability_base:want",
+      # "ability_base:want",
       "init:libbegetutil",
     ]
 
diff --git a/interfaces/inner_kits/native_cpp/BUILD.gn b/interfaces/inner_kits/native_cpp/BUILD.gn
index d5726567..81ea6a65 100644
--- a/interfaces/inner_kits/native_cpp/BUILD.gn
+++ b/interfaces/inner_kits/native_cpp/BUILD.gn
@@ -149,8 +149,8 @@ if (defined(ohos_lite)) {
 
     external_deps = [
       "c_utils:utils",
-      "hisysevent_native:libhisysevent",
-      "hitrace_native:hitrace_meter",
+      # "hisysevent_native:libhisysevent",
+      # "hitrace_native:hitrace_meter",
       "hiviewdfx_hilog_native:libhilog",
       "ipc:ipc_core",
       "samgr:samgr_proxy",
diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn
index a71f79a1..bd0febab 100644
--- a/interfaces/kits/js/BUILD.gn
+++ b/interfaces/kits/js/BUILD.gn
@@ -46,7 +46,7 @@ ohos_shared_library("devicemanager") {
     "LOG_DOMAIN=0xD004100",
   ]
 
-  external_deps = [ "bundle_framework:appexecfwk_base" ]
+  external_deps = [ #"bundle_framework:appexecfwk_base" ]
 
   subsystem_name = "distributedhardware"
   relative_install_dir = "module/distributedhardware"
diff --git a/services/implementation/BUILD.gn b/services/implementation/BUILD.gn
index 126232e2..45bf523b 100644
--- a/services/implementation/BUILD.gn
+++ b/services/implementation/BUILD.gn
@@ -220,10 +220,10 @@ if (defined(ohos_lite)) {
     }
 
     external_deps = [
-      "ability_base:want",
+      # "ability_base:want",
       "c_utils:utils",
-      "common_event_service:cesfwk_core",
-      "common_event_service:cesfwk_innerkits",
+      # "common_event_service:cesfwk_core",
+      # "common_event_service:cesfwk_innerkits",
       "dsoftbus:softbus_client",
       "init:libbegetutil",
       "ipc:ipc_core",
diff --git a/services/service/BUILD.gn b/services/service/BUILD.gn
index bb353c12..fd7bb180 100644
--- a/services/service/BUILD.gn
+++ b/services/service/BUILD.gn
@@ -112,10 +112,10 @@ if (defined(ohos_lite)) {
         "//third_party/mbedtls",
       ]
 
-      external_deps = [
-        "hisysevent_native:libhisysevent",
-        "hitrace_native:hitrace_meter",
-      ]
+      # external_deps = [
+      #   # "hisysevent_native:libhisysevent",
+      #   # "hitrace_native:hitrace_meter",
+      # ]
     }
   } else {
     executable("devicemanagerservice") {
@@ -180,10 +180,6 @@ if (defined(ohos_lite)) {
       ]
     }
   }
-} else if (!support_jsapi) {
-  group("devicemanagerservice") {
-    deps = []
-  }
 } else {
   config("devicemanagerservice_config") {
     include_dirs = [
diff --git a/services/service/include/ipc/standard/ipc_server_listener.h b/services/service/include/ipc/standard/ipc_server_listener.h
index 0ff7bb80..02283724 100644
--- a/services/service/include/ipc/standard/ipc_server_listener.h
+++ b/services/service/include/ipc/standard/ipc_server_listener.h
@@ -17,6 +17,7 @@
 #define OHOS_DM_IPC_SERVER_LISTENER_H
 
 #include <cstdint>
+#include <memory>
 
 #include "ipc_req.h"
 #include "ipc_rsp.h"
diff --git a/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn b/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn
index a7dda4f8..997596f2 100644
--- a/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn
+++ b/test/fuzztest/dmcommoneventmanager_fuzzer/BUILD.gn
@@ -57,7 +57,7 @@ ohos_fuzztest("DmCommonEventManagerFuzzTest") {
   ]
 
   external_deps = [
-    "ability_base:want",
+    # "ability_base:want",
     "c_utils:utils",
     "common_event_service:cesfwk_core",
     "common_event_service:cesfwk_innerkits",
diff --git a/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn b/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn
index a183baab..64b5f7bf 100644
--- a/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn
+++ b/test/fuzztest/dmdiscoverymanager_fuzzer/BUILD.gn
@@ -56,7 +56,7 @@ ohos_fuzztest("DmDiscoveryManagerFuzzTest") {
   ]
 
   external_deps = [
-    "ability_base:want",
+    # "ability_base:want",
     "c_utils:utils",
     "common_event_service:cesfwk_core",
     "common_event_service:cesfwk_innerkits",
diff --git a/test/fuzztest/pinauth_fuzzer/BUILD.gn b/test/fuzztest/pinauth_fuzzer/BUILD.gn
index a37f310f..5d9e7b8c 100644
--- a/test/fuzztest/pinauth_fuzzer/BUILD.gn
+++ b/test/fuzztest/pinauth_fuzzer/BUILD.gn
@@ -92,7 +92,7 @@ ohos_fuzztest("PinAuthFuzzTest") {
   ]
 
   external_deps = [
-    "ability_base:want",
+    # "ability_base:want",
     "init:libbegetutil",
   ]
 }
diff --git a/test/fuzztest/pinauthui_fuzzer/BUILD.gn b/test/fuzztest/pinauthui_fuzzer/BUILD.gn
index 5de26477..dd56d78e 100644
--- a/test/fuzztest/pinauthui_fuzzer/BUILD.gn
+++ b/test/fuzztest/pinauthui_fuzzer/BUILD.gn
@@ -92,7 +92,7 @@ ohos_fuzztest("PinAuthUiFuzzTest") {
   ]
 
   external_deps = [
-    "ability_base:want",
+    # "ability_base:want",
     "init:libbegetutil",
   ]
 }
diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn
index b154fdfb..cae3a92b 100644
--- a/test/unittest/BUILD.gn
+++ b/test/unittest/BUILD.gn
@@ -178,8 +178,8 @@ ohos_unittest("UTTest_softbus_connector") {
   deps = [ ":device_manager_test_common" ]
 
   external_deps = [
-    "hisysevent_native:libhisysevent",
-    "hitrace_native:hitrace_meter",
+    # "hisysevent_native:libhisysevent",
+    # "hitrace_native:hitrace_meter",
   ]
 }
 
@@ -194,8 +194,8 @@ ohos_unittest("UTTest_softbus_session") {
   deps = [ ":device_manager_test_common" ]
 
   external_deps = [
-    "hisysevent_native:libhisysevent",
-    "hitrace_native:hitrace_meter",
+    # "hisysevent_native:libhisysevent",
+    # "hitrace_native:hitrace_meter",
   ]
 }
 
@@ -367,8 +367,8 @@ ohos_unittest("UTTest_dm_device_state_manager") {
   deps = [ ":device_manager_test_common" ]
 
   external_deps = [
-    "hisysevent_native:libhisysevent",
-    "hitrace_native:hitrace_meter",
+    # "hisysevent_native:libhisysevent",
+    # "hitrace_native:hitrace_meter",
   ]
 }
 
@@ -504,7 +504,7 @@ ohos_unittest("UTTest_dm_discovery_manager") {
 
   deps = [ ":device_manager_test_common" ]
 
-  external_deps = [ "hitrace_native:hitrace_meter" ]
+  # external_deps = [ "hitrace_native:hitrace_meter" ]
 }
 
 ## UnitTest UTTest_dm_discovery_manager }}}
@@ -528,7 +528,7 @@ ohos_unittest("UTTest_dm_publish_manager") {
 
   deps = [ ":device_manager_test_common" ]
 
-  external_deps = [ "hitrace_native:hitrace_meter" ]
+  # external_deps = [ "hitrace_native:hitrace_meter" ]
 }
 
 ## UnitTest UTTest_dm_publish_manager }}}
@@ -642,15 +642,15 @@ ohos_static_library("device_manager_test_common") {
   }
 
   external_deps = [
-    "ability_base:want",
-    "bundle_framework:appexecfwk_base",
-    "bundle_framework:appexecfwk_core",
+    # "ability_base:want",
+    #"bundle_framework:appexecfwk_base",
+    #"bundle_framework:appexecfwk_core",
     "common_event_service:cesfwk_core",
     "common_event_service:cesfwk_innerkits",
     "dsoftbus:softbus_client",
     "eventhandler:libeventhandler",
-    "hisysevent_native:libhisysevent",
-    "hitrace_native:hitrace_meter",
+    # "hisysevent_native:libhisysevent",
+    # "hitrace_native:hitrace_meter",
     "hiviewdfx_hilog_native:libhilog",
     "init:libbegetutil",
     "ipc:ipc_core",
diff --git a/test/unittest/UTTest_dm_dfx.h b/test/unittest/UTTest_dm_dfx.h
index 8bba3789..d20b9b8f 100644
--- a/test/unittest/UTTest_dm_dfx.h
+++ b/test/unittest/UTTest_dm_dfx.h
@@ -29,7 +29,7 @@
 #undef private
 #include "dm_hisysevent.h"
 #include "dm_hitrace.h"
-#include "hitrace_meter.h"
+// #include "hitrace_meter.h"
 
 namespace OHOS {
 namespace DistributedHardware {
diff --git a/utils/BUILD.gn b/utils/BUILD.gn
index 0d231c71..59e9e9bd 100644
--- a/utils/BUILD.gn
+++ b/utils/BUILD.gn
@@ -181,10 +181,10 @@ if (defined(ohos_lite)) {
     deps = [ "//third_party/mbedtls:mbedtls_shared" ]
 
     external_deps = [
-      "access_token:libaccesstoken_sdk",
+      # "access_token:libaccesstoken_sdk",
       "c_utils:utils",
-      "hisysevent_native:libhisysevent",
-      "hitrace_native:hitrace_meter",
+      # # "hisysevent_native:libhisysevent",
+      # "hitrace_native:hitrace_meter",
       "hiviewdfx_hilog_native:libhilog",
       "ipc:ipc_core",
       "samgr:samgr_proxy",
diff --git a/utils/src/permission/standard/permission_manager.cpp b/utils/src/permission/standard/permission_manager.cpp
index 11db468c..e3de417b 100644
--- a/utils/src/permission/standard/permission_manager.cpp
+++ b/utils/src/permission/standard/permission_manager.cpp
@@ -24,7 +24,7 @@
 #include "iservice_registry.h"
 #include "system_ability_definition.h"
 #include "ipc_skeleton.h"
-#include "access_token.h"
+// #include "access_token.h"
 #include "hap_token_info.h"
 #include "native_token_info.h"
 #include "accesstoken_kit.h"
-- 
2.33.0

