diff --git a/bundle.json b/bundle.json index 4f20bcf82df4b96da008cfc6e746c712f4714c14..7ba25a8a46b84ea14824860521f069e7f665c0e5 100644 --- a/bundle.json +++ b/bundle.json @@ -45,11 +45,10 @@ "sub_component": [ "//foundation/distributedhardware/devicemanager/utils:devicemanagerutils", "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk", - "//foundation/distributedhardware/devicemanager/interfaces/kits/js:devicemanager_native_js", + "//foundation/distributedhardware/devicemanager/interfaces/kits:devicemanager_native_js", "//foundation/distributedhardware/devicemanager/services/devicemanagerservice:devicemanagerservice", "//foundation/distributedhardware/devicemanager/sa_profile:dm_sa_profile", - "//foundation/distributedhardware/devicemanager/ext/pin_auth:devicemanagerext_pin_auth", - "//foundation/distributedhardware/devicemanager/ext/profile:devicemanagerext_profile" + "//foundation/distributedhardware/devicemanager/ext:ext_modules" ], "inner_kits": [ { @@ -71,4 +70,4 @@ ] } } -} \ No newline at end of file +} diff --git a/ext/BUILD.gn b/ext/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..df1b58535c2d55fa019bf3c12c6dafefad964edb --- /dev/null +++ b/ext/BUILD.gn @@ -0,0 +1,24 @@ +# 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("ext_modules") { + deps = [] + if (support_jsapi) { + deps += [ + "./pin_auth:devicemanagerext_pin_auth", + "./profile:devicemanagerext_profile", + ] + } +} diff --git a/interfaces/inner_kits/native_cpp/BUILD.gn b/interfaces/inner_kits/native_cpp/BUILD.gn index 68c8c569cadbd69c2abb355fcb8707fd8ec4939b..99011143aa34c6f8bd509c458f50138fd8ed6ce1 100644 --- a/interfaces/inner_kits/native_cpp/BUILD.gn +++ b/interfaces/inner_kits/native_cpp/BUILD.gn @@ -54,20 +54,24 @@ if (defined(ohos_lite)) { "LOG_DOMAIN=0xD004100", ] - deps = [ - "${utils_path}:devicemanagerutils", - "//foundation/aafwk/standard/interfaces/innerkits/want:want", - ] + deps = [ "${utils_path}:devicemanagerutils" ] external_deps = [ - "bundle_framework:appexecfwk_base", - "bundle_framework:appexecfwk_core", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr_standard:samgr_proxy", "utils_base:utils", ] + if (support_jsapi) { + deps += [ "//foundation/aafwk/standard/interfaces/innerkits/want:want" ] + external_deps += [ + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + ] + defines += [ "SUPPORT_CALLING_ABILITY" ] + } + subsystem_name = "distributedhardware" part_name = "device_manager_base" diff --git a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp index 900305b1eb2b6841f7acfa23458b585b1cc007ab..811a6d7f49c9bacdfd17d18f177127b3dcd7b8a6 100644 --- a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp +++ b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp @@ -15,10 +15,12 @@ #include "device_manager_impl.h" +#ifdef SUPPORT_CALLING_ABILITY #include "bundle_constants.h" #include "bundle_info.h" #include "bundle_mgr_client.h" #include "bundle_mgr_interface.h" +#endif #include "if_system_ability_manager.h" #include "iservice_registry.h" #include "system_ability_definition.h" @@ -43,13 +45,16 @@ #include "ipc_verify_authenticate_req.h" #include "securec.h" +#ifdef SUPPORT_CALLING_ABILITY using namespace OHOS::AppExecFwk; using namespace OHOS::AppExecFwk::Constants; +#endif namespace OHOS { namespace DistributedHardware { bool DeviceManagerImpl::isSystemAppCalling(void) { +#ifdef SUPPORT_CALLING_ABILITY int32_t uid = IPCSkeleton::GetCallingUid(); if (uid < 0) { LOGI("app caller uid is: %d,", uid); @@ -76,6 +81,10 @@ bool DeviceManagerImpl::isSystemAppCalling(void) } return iBundleMgr->CheckIsSystemAppByUid(uid); +#else + // Minimum system only native services will call + return true; +#endif } DeviceManagerImpl &DeviceManagerImpl::GetInstance() diff --git a/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp b/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp index f1c36875eb76b23974e04affb9ebbe31f1e40b21..987ca17c59d945707a9b04cebe7f114c6cb8f810 100644 --- a/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp +++ b/interfaces/inner_kits/native_cpp/src/notify/device_manager_notify.cpp @@ -18,7 +18,6 @@ #include "device_manager.h" #include "dm_constants.h" #include "dm_log.h" -#include "nlohmann/json.hpp" namespace OHOS { namespace DistributedHardware { diff --git a/interfaces/kits/BUILD.gn b/interfaces/kits/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..725c517af55510212a3da6358dd97d27450ae9fa --- /dev/null +++ b/interfaces/kits/BUILD.gn @@ -0,0 +1,21 @@ +# 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("devicemanager_native_js") { + deps = [] + if (support_jsapi) { + deps += [ "./js:devicemanager" ] + } +} diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 5704e27a42dac3bf80b429e59bd8733ff82daaa3..c1b70a129bef76416dad027b23f80ef52e5aed36 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -61,7 +61,3 @@ ohos_shared_library("devicemanager") { relative_install_dir = "module/distributedhardware" part_name = "device_manager_base" } - -group("devicemanager_native_js") { - deps = [ ":devicemanager" ] -} diff --git a/services/devicemanagerservice/BUILD.gn b/services/devicemanagerservice/BUILD.gn index 5c0c2ae9625aa3521516b9ab4a3635de136c83f1..c41e206007a5a005322635655f9137cf53d8c41e 100644 --- a/services/devicemanagerservice/BUILD.gn +++ b/services/devicemanagerservice/BUILD.gn @@ -23,6 +23,10 @@ if (defined(ohos_lite)) { executable("devicemanagerservice") { sources = [ "src/ipc/lite/ipc_server_main.cpp" ] } +} else if (!support_jsapi) { + group("devicemanagerservice") { + deps = [] + } } else { config("devicemanagerservice_config") { include_dirs = [ diff --git a/test/BUILD.gn b/test/BUILD.gn index d29faeb194418a02c8220d91acb1068c98a57961..e9d4fadb93b89ba74871ec5a6ffc5e69e99a7930 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -14,5 +14,8 @@ group("test") { testonly = true - deps = [ "unittest:unittest" ] + deps = [] + if (support_jsapi) { + deps += [ "unittest:unittest" ] + } }