From c7bfb2c5856f51ea51e278f54981b7037680bac5 Mon Sep 17 00:00:00 2001 From: lnlan Date: Tue, 1 Mar 2022 07:28:16 +0000 Subject: [PATCH] =?UTF-8?q?feat(startup=5Finit=5Flite):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9syscap=20ndk=E6=8E=A5=E5=8F=A3=20=E3=80=90=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E3=80=91=E4=BF=AE=E6=94=B9syscap=20ndk=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 change syscap ndk name: HasSystemCapability to canIUse 【影响】 对现有的产品编译不会有影响。 Change-Id: I77bc76b536a087884c089fdc27be4126c01a335f Signed-off-by: lnlan --- bundle.json | 3 ++- interfaces/innerkits/BUILD.gn | 2 -- interfaces/kits/BUILD.gn | 9 +++++++- .../{systemcapability.h => syscap_ndk.h} | 7 +++--- interfaces/kits/libdeviceinfo.ndk.json | 2 +- interfaces/kits/src/syscap_ndk.c | 23 +++++++++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) rename interfaces/kits/include/{systemcapability.h => syscap_ndk.h} (87%) create mode 100644 interfaces/kits/src/syscap_ndk.c diff --git a/bundle.json b/bundle.json index e813a843..5d979b8a 100644 --- a/bundle.json +++ b/bundle.json @@ -43,6 +43,7 @@ "//base/startup/init_lite/services/begetctl:paramshell", "//base/startup/init_lite/services/plugin:plugin", "//base/startup/init_lite/interfaces/innerkits:libbegetutil", + "//base/startup/init_lite/interfaces/kits:deviceinfo_ndk", "//base/startup/init_lite/interfaces/innerkits:libbeget_proxy", "//base/startup/init_lite/interfaces/innerkits/file:libfile", "//base/startup/init_lite/interfaces/innerkits/socket:libsocket", @@ -81,4 +82,4 @@ ] } } -} \ No newline at end of file +} diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 598887a6..21bd0053 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -54,8 +54,6 @@ ohos_shared_library("libbegetutil") { deps += [ "//base/startup/init_lite/services/log:init_log" ] - symlink_target_name = [ "libdeviceinfo_ndk.z.so" ] - public_configs = [ ":exported_header_files" ] part_name = "init" install_images = [ diff --git a/interfaces/kits/BUILD.gn b/interfaces/kits/BUILD.gn index a2de1a8e..7ab2b22c 100755 --- a/interfaces/kits/BUILD.gn +++ b/interfaces/kits/BUILD.gn @@ -13,6 +13,13 @@ import("//build/ohos.gni") +ohos_shared_library("deviceinfo_ndk") { + sources = [ "src/syscap_ndk.c" ] + include_dirs = [ "./include" ] + deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil" ] + part_name = "init" +} + ohos_ndk_library("libdeviceinfo_ndk") { output_name = "deviceinfo_ndk" ndk_description_file = "./libdeviceinfo.ndk.json" @@ -21,5 +28,5 @@ ohos_ndk_library("libdeviceinfo_ndk") { ohos_ndk_headers("deviceinfo_header") { dest_dir = "$ndk_headers_out_dir/" - sources = [ "./include/systemcapability.h" ] + sources = [ "./include/syscap_ndk.h" ] } diff --git a/interfaces/kits/include/systemcapability.h b/interfaces/kits/include/syscap_ndk.h similarity index 87% rename from interfaces/kits/include/systemcapability.h rename to interfaces/kits/include/syscap_ndk.h index 0063f32c..070a6cb1 100755 --- a/interfaces/kits/include/systemcapability.h +++ b/interfaces/kits/include/syscap_ndk.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef INIT_SYSCAP_API_H -#define INIT_SYSCAP_API_H +#ifndef SYSCAP_NDK_H +#define SYSCAP_NDK_H #include @@ -24,8 +24,7 @@ extern "C" { #endif #endif - -bool HasSystemCapability(const char *cap); +bool canIUse(const char *cap); #ifdef __cplusplus #if __cplusplus diff --git a/interfaces/kits/libdeviceinfo.ndk.json b/interfaces/kits/libdeviceinfo.ndk.json index fc69801b..1ec33bd0 100755 --- a/interfaces/kits/libdeviceinfo.ndk.json +++ b/interfaces/kits/libdeviceinfo.ndk.json @@ -1,5 +1,5 @@ [ { - "name": "HasSystemCapability" + "name": "canIUse" } ] diff --git a/interfaces/kits/src/syscap_ndk.c b/interfaces/kits/src/syscap_ndk.c new file mode 100644 index 00000000..ece84547 --- /dev/null +++ b/interfaces/kits/src/syscap_ndk.c @@ -0,0 +1,23 @@ +/* + * 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 +#include "systemcapability.h" +#include "syscap_ndk.h" + +bool canIUse(const char *cap) +{ + return HasSystemCapability(cap); +} -- GitLab