From 3104d0292661f2f5ffa29275baaeb47895fea756 Mon Sep 17 00:00:00 2001 From: b30052170 Date: Fri, 4 Oct 2024 16:45:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=A4=E5=8F=B0=E4=B8=80?= =?UTF-8?q?=E6=A0=B7=E7=9A=84=E6=89=93=E5=8D=B0=E6=9C=BA=20Signed-off-by:b?= =?UTF-8?q?aozewei@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: b30052170 --- frameworks/helper/print_helper/BUILD.gn | 4 +++- frameworks/helper/scan_helper/BUILD.gn | 4 +++- frameworks/innerkitsimpl/scan_impl/BUILD.gn | 4 +++- frameworks/kits/extension/BUILD.gn | 4 +++- frameworks/models/print_models/BUILD.gn | 4 +++- frameworks/ohprint/BUILD.gn | 4 +++- frameworks/ohscan/BUILD.gn | 4 +++- interfaces/kits/jsnapi/print_extension/BUILD.gn | 2 +- interfaces/kits/jsnapi/print_extensionctx/BUILD.gn | 2 +- interfaces/kits/napi/print_napi/src/napi_print_ext.cpp | 2 +- interfaces/kits/napi/scan_napi/BUILD.gn | 4 +++- services/print_service/src/print_service_ability.cpp | 6 ++++++ 12 files changed, 33 insertions(+), 11 deletions(-) diff --git a/frameworks/helper/print_helper/BUILD.gn b/frameworks/helper/print_helper/BUILD.gn index 19c81a8..d26ebce 100644 --- a/frameworks/helper/print_helper/BUILD.gn +++ b/frameworks/helper/print_helper/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("print_interfaces_kits_napi_config") { visibility = [ ":*" ] include_dirs = [ "include" ] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("print_helper") { include_dirs = [ diff --git a/frameworks/helper/scan_helper/BUILD.gn b/frameworks/helper/scan_helper/BUILD.gn index 9ec85e6..8e32a3a 100644 --- a/frameworks/helper/scan_helper/BUILD.gn +++ b/frameworks/helper/scan_helper/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("scan_interfaces_kits_napi_config") { visibility = [ ":*" ] include_dirs = [ "include" ] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("scan_helper") { include_dirs = [ diff --git a/frameworks/innerkitsimpl/scan_impl/BUILD.gn b/frameworks/innerkitsimpl/scan_impl/BUILD.gn index 6367639..368e9cd 100644 --- a/frameworks/innerkitsimpl/scan_impl/BUILD.gn +++ b/frameworks/innerkitsimpl/scan_impl/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("scan_interfaces_kits_napi_config") { visibility = [ ":*" ] include_dirs = [ "include" ] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("scan_client") { diff --git a/frameworks/kits/extension/BUILD.gn b/frameworks/kits/extension/BUILD.gn index 4cfee2d..327860c 100644 --- a/frameworks/kits/extension/BUILD.gn +++ b/frameworks/kits/extension/BUILD.gn @@ -14,6 +14,8 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("ability_config") { visibility = [ ":*" ] include_dirs = [ @@ -42,7 +44,7 @@ config("ability_public_config") { "//third_party/json/include", ] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("print_extension_framework") { diff --git a/frameworks/models/print_models/BUILD.gn b/frameworks/models/print_models/BUILD.gn index 50735e2..653467b 100644 --- a/frameworks/models/print_models/BUILD.gn +++ b/frameworks/models/print_models/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("print_models_config") { visibility = [ ":*" ] include_dirs = [ "include" ] - cflags_cc = [ "-fexceptions" ] + cflags_cc += [ "-fexceptions" ] } ohos_shared_library("print_models") { include_dirs = [ "${print_utils_path}/include" ] diff --git a/frameworks/ohprint/BUILD.gn b/frameworks/ohprint/BUILD.gn index dad1eab..e4650ec 100755 --- a/frameworks/ohprint/BUILD.gn +++ b/frameworks/ohprint/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("print_ndk_config") { visibility = [ ":*" ] include_dirs = [] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("ohprint") { include_dirs = [ diff --git a/frameworks/ohscan/BUILD.gn b/frameworks/ohscan/BUILD.gn index d8e050e..c2fb500 100644 --- a/frameworks/ohscan/BUILD.gn +++ b/frameworks/ohscan/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("scan_ndk_config") { visibility = [ ":*" ] include_dirs = [] - cflags_cc = [ "-fno-exceptions" ] + cflags_cc += [ "-fno-exceptions" ] } ohos_shared_library("ohscan") { diff --git a/interfaces/kits/jsnapi/print_extension/BUILD.gn b/interfaces/kits/jsnapi/print_extension/BUILD.gn index 86c2021..0976400 100644 --- a/interfaces/kits/jsnapi/print_extension/BUILD.gn +++ b/interfaces/kits/jsnapi/print_extension/BUILD.gn @@ -55,7 +55,7 @@ ohos_shared_library("printextensionability_napi") { external_deps = [ "napi:ace_napi" ] if (build_variant == "user") { - cflags_cc += [ "-DIS_RELEASE_VERSION" ] + cflags_cc = [ "-DIS_RELEASE_VERSION" ] } relative_install_dir = "module/app/ability" diff --git a/interfaces/kits/jsnapi/print_extensionctx/BUILD.gn b/interfaces/kits/jsnapi/print_extensionctx/BUILD.gn index 1928277..4d8a822 100644 --- a/interfaces/kits/jsnapi/print_extensionctx/BUILD.gn +++ b/interfaces/kits/jsnapi/print_extensionctx/BUILD.gn @@ -55,7 +55,7 @@ ohos_shared_library("printextensioncontext_napi") { external_deps = [ "napi:ace_napi" ] if (build_variant == "user") { - cflags_cc += [ "-DIS_RELEASE_VERSION" ] + cflags_cc = [ "-DIS_RELEASE_VERSION" ] } relative_install_dir = "module" diff --git a/interfaces/kits/napi/print_napi/src/napi_print_ext.cpp b/interfaces/kits/napi/print_napi/src/napi_print_ext.cpp index 323d7ae..62ee704 100644 --- a/interfaces/kits/napi/print_napi/src/napi_print_ext.cpp +++ b/interfaces/kits/napi/print_napi/src/napi_print_ext.cpp @@ -398,7 +398,7 @@ napi_value NapiPrintExt::QueryPrinterCapabilityByUri(napi_env env, napi_callback PRINT_ASSERT_BASE(env, valuetype == napi_string, "printerId is not a string", napi_string_expected); std::string printerId = NapiPrintUtils::GetStringFromValueUtf8(env, argv[NapiPrintUtils::INDEX_ONE]); - PRINT_HILOGD("printerId : %{private}s", printerUri.c_str()); + PRINT_HILOGD("printerId : %{private}s", printerId.c_str()); context->printerId = printerId; } return napi_ok; diff --git a/interfaces/kits/napi/scan_napi/BUILD.gn b/interfaces/kits/napi/scan_napi/BUILD.gn index 7775839..0f95c61 100644 --- a/interfaces/kits/napi/scan_napi/BUILD.gn +++ b/interfaces/kits/napi/scan_napi/BUILD.gn @@ -13,11 +13,13 @@ import("//base/print/print_fwk/print.gni") import("//build/ohos.gni") +cflags_cc = [] + config("scan_interfaces_kits_napi_config") { visibility = [ ":*" ] include_dirs = [ "include" ] - cflags_cc = [ "-fexceptions" ] + cflags_cc += [ "-fexceptions" ] } ohos_shared_library("scan_napi") { diff --git a/services/print_service/src/print_service_ability.cpp b/services/print_service/src/print_service_ability.cpp index b938136..158b4f5 100644 --- a/services/print_service/src/print_service_ability.cpp +++ b/services/print_service/src/print_service_ability.cpp @@ -1544,6 +1544,12 @@ bool PrintServiceAbility::UpdatePrinterCapability(const std::string &printerId, info.GetCapability(printerCaps); WriteEprinterPreference(printerId, printerCaps); } + + if (printSystemData_.IsPrinterAdded(printerId)) { + PRINT_HILOGE("This printer has been added."); + return false; + } + CupsPrinterInfo cupsPrinterInfo; auto output = info; cupsPrinterInfo.name = info.GetPrinterName();