diff --git a/bundle.json b/bundle.json index 9361510ec7aa130bb3ae7cf4e03821f0ebbdd3d7..362cb2687c15b3222de165788361685515bc092d 100755 --- a/bundle.json +++ b/bundle.json @@ -1,6 +1,6 @@ { "name": "@ohos/distributedschedule_samgr", - "description": "提供系统服务的注册、发现能力。", + "description": "system ability manager", "homePage": "https://gitee.com/openharmony", "version": "3.1", "license": "Apache License 2.0", diff --git a/interfaces/innerkits/samgr_proxy/BUILD.gn b/interfaces/innerkits/samgr_proxy/BUILD.gn old mode 100644 new mode 100755 index 63687db463f03bbdc632a5f5c272c1060b29b999..6ada9ec6eed540af787a7586528b1e93e84e618d --- a/interfaces/innerkits/samgr_proxy/BUILD.gn +++ b/interfaces/innerkits/samgr_proxy/BUILD.gn @@ -15,24 +15,16 @@ import("//build/ohos.gni") import("//build/ohos_var.gni") config("samgr_proxy_config") { - include_dirs = [ - "include", - "//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include", - ] + include_dirs = [ "include" ] } config("samgr_proxy_private_config") { include_dirs = [ - "//utils/native/base/include", - "//utils/system/safwk/native/include", - "../../../services/lsamgr/include", + "include", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr", "//foundation/distributedschedule/samgr/services/lsamgr/include", - "//developtools/liblog", "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//foundation/distributedschedule/samgr/frameworks/native/jni/include", - "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include", - "//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include", + "//foundation/distributedschedule/samgr/utils/native/include", ] } @@ -51,9 +43,9 @@ ohos_shared_library("samgr_proxy") { external_deps = [ "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", + "utils_base:utils", ] - deps = [ "//utils/native/base:utils" ] part_name = "samgr_standard" } subsystem_name = "distributedschedule" diff --git a/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h b/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h index 856ddbb3f4d9732be1057d1c30f49af30e07818f..6245d39975c37fde01a6ed4d609ee3a5d2eb9cb4 100755 --- a/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h +++ b/interfaces/innerkits/samgr_proxy/include/system_ability_definition.h @@ -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 diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn old mode 100644 new mode 100755 index bc7fa7c1d0098a18e2a6cdf12297dafd6f9ba86d..e76dcb15d77026c5883a4ac403a50e7db3c3114e --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -16,24 +16,18 @@ import("//build/ohos_var.gni") config("distributed_store_config") { visibility = [ ":*" ] - include_dirs = [ - "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//third_party/json/include", - "//foundation/distributedschedule/dmsfwk/services/dtbdecidefwk/include", - ] + include_dirs = + [ "//foundation/distributedschedule/samgr/services/samgr/native/include" ] } config("sam_config") { # header file path include_dirs = [ - "//developtools/liblog", "//foundation/distributedschedule/samgr/services/samgr/native/include", - "//foundation/distributedschedule/samgr/services/samgr/java/include", "//foundation/distributedschedule/samgr/utils/native/include", - "//utils/native/base/include", - "//utils/system/safwk/native/include", "//foundation/distributedschedule/samgr/services/lsamgr/include", "//foundation/distributedschedule/samgr/interfaces/innerkits/common/include", + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", ] } @@ -68,7 +62,6 @@ ohos_executable("samgr") { "//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common", "//foundation/distributedschedule/samgr/interfaces/innerkits/lsamgr:lsamgr", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", - "//utils/native/base:utils", ] configs = [ @@ -85,6 +78,7 @@ ohos_executable("samgr") { "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", + "utils_base:utils", ] public_deps = [ "//third_party/libxml2:libxml2" ] part_name = "samgr_standard" diff --git a/services/samgr/native/test/unittest/BUILD.gn b/services/samgr/native/test/unittest/BUILD.gn index a930ae3fc75c00b25fbd2b0fd3d0ecbed469d9d2..619656d284d1e5ef70ef350174eb6c115a872287 100755 --- a/services/samgr/native/test/unittest/BUILD.gn +++ b/services/samgr/native/test/unittest/BUILD.gn @@ -21,7 +21,7 @@ config("sam_test_config") { visibility = [ ":*" ] include_dirs = [ "${samgr_services_dir}/test/unittest/include", - "//utils/system/safwk/native/include", + "//foundation/distributedschedule/samgr/utils/native/include", ] } @@ -56,7 +56,6 @@ ohos_unittest("SystemAbilityMgrTest") { "${samgr_dir}/interfaces/innerkits/lsamgr:lsamgr", "${samgr_dir}/interfaces/innerkits/samgr_proxy:samgr_proxy", "//third_party/googletest:gtest_main", - "//utils/native/base:utils", ] external_deps = [ @@ -65,6 +64,7 @@ ohos_unittest("SystemAbilityMgrTest") { "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", + "utils_base:utils", ] } @@ -74,7 +74,7 @@ ohos_executable("ondemand") { ":sam_test_config", "${samgr_dir}/interfaces/innerkits/lsamgr:config_samgr", ] - deps = [ "//utils/native/base:utils" ] + deps = [ "${samgr_dir}/interfaces/innerkits/samgr_proxy:samgr_proxy" ] if (is_standard_system) { external_deps = [ "hiviewdfx_hilog_native:libhilog_base" ] } else { @@ -88,6 +88,7 @@ ohos_executable("ondemand") { external_deps += [ "ipc:ipc_core", "samgr_standard:samgr_proxy", + "utils_base:utils", ] part_name = "samgr_standard" subsystem_name = "distributedschedule" diff --git a/utils/native/include/parcel_helper.h b/utils/native/include/parcel_helper.h new file mode 100755 index 0000000000000000000000000000000000000000..c998a2bba50813c483bc3954736d9bba169a2b46 --- /dev/null +++ b/utils/native/include/parcel_helper.h @@ -0,0 +1,113 @@ +/* + * 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_SCHEDULE_PARCEL_HELPER_H +#define OHOS_DISTRIBUTED_SCHEDULE_PARCEL_HELPER_H + +#include + +#include "sam_log.h" + +namespace OHOS { +namespace DistributedSchedule { +#define PARCEL_WRITE_HELPER(parcel, type, value) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return ERR_FLATTEN_OBJECT; \ + } \ + } while (0) + +#define PARCEL_WRITE_HELPER_NORET(parcel, type, value) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return; \ + } \ + } while (0) + +#define PARCEL_WRITE_HELPER_RET(parcel, type, value, failRet) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return failRet; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER(parcel, type, out) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGE("%{public}s read value failed!", __func__); \ + return ERR_FLATTEN_OBJECT; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER_RET(parcel, type, out, failRet) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGE("%{public}s read value failed!", __func__); \ + return failRet; \ + } \ + } while (0) + +#define PARCEL_READ_HELPER_NORET(parcel, type, out) \ + do { \ + bool ret = parcel.Read##type((out)); \ + if (!ret) { \ + HILOGW("%{public}s read value failed!", __func__); \ + } \ + } while (0) + +#define PARCEL_TRANSACT_SYNC_RET_INT(remote, code, data, reply) \ + do { \ + MessageOption option; \ + int32_t error = remote->SendRequest(code, data, reply, option); \ + if (error != ERR_NONE) { \ + HILOGE("%{public}s transact failed, error: %{public}d", __func__, error); \ + return error; \ + } \ + int32_t result = reply.ReadInt32(); \ + HILOGD("%{public}s get result from server data = %{public}d", __func__, result); \ + return result; \ + } while (0) + +#define PARCEL_TRANSACT_SYNC_NORET(remote, code, data, reply) \ + do { \ + MessageOption option; \ + int32_t error = remote->SendRequest(code, data, reply, option); \ + if (error != ERR_NONE) { \ + HILOGE("%{public}s transact failed, error: %{public}d", __func__, error); \ + return; \ + } \ + HILOGD("%{public}s transact success!", __func__); \ + } while (0) + +#define PARCEL_WRITE_REPLY_NOERROR(reply, type, result) \ + do { \ + bool ret = reply.Write##type(result); \ + if (!ret) { \ + HILOGW("%{public}s write reply failed.", __func__); \ + } \ + return ERR_NONE; \ + } while (0) +} // namespace DistributedSchedule +} // namespace OHOS + +#endif /* OHOS_DISTRIBUTED_SCHEDULE_PARCEL_HELPER_H */