From 75555c40822722e4a67a2383bfa678e7fb5a55a0 Mon Sep 17 00:00:00 2001 From: xiongqiao Date: Wed, 23 Aug 2023 16:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=8E=A5=E5=8F=A3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=95=B4=E6=94=B9=20Signed-off-by:xiongqiao3@huawei.c?= =?UTF-8?q?om?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiongqiao --- interfaces/kits/jskits/@ohos.print.d.ts | 14 +++++++------- interfaces/kits/napi/src/print_task.cpp | 8 ++++---- services/src/print_service_ability.cpp | 8 ++++---- services/src/print_service_helper.cpp | 1 + .../service_test/print_service_ability_test.cpp | 8 ++++---- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/interfaces/kits/jskits/@ohos.print.d.ts b/interfaces/kits/jskits/@ohos.print.d.ts index 9bac3ef5..6975ed31 100644 --- a/interfaces/kits/jskits/@ohos.print.d.ts +++ b/interfaces/kits/jskits/@ohos.print.d.ts @@ -27,28 +27,28 @@ declare namespace print { /** * Register event callback when the current print task is in process. * @since 10 - * @param type blocked Indicates the print task has been blocked. - * type success Indicates the print task succeed. - * type failed Indicates the print task has completed with failure. - * type cancelled Indicates the print task has been cancelled. + * @param type block Indicates the print task has been blocked. + * type succeed Indicates the print task succeed. + * type fail Indicates the print task has completed with failure. + * type cancel Indicates the print task has been cancelled. * @param callback The callback function for print task change event * @permission {@code ohos.permission.PRINT} * @return - */ - on(type: 'blocked' | 'success' | 'failed' | 'cancelled', callback: () => void): void; + on(type: 'block' | 'succeed' | 'fail' | 'cancel', callback: () => void): void; /** * Unregister event callback when the current print task is in process. * @since 10 * @param type block Indicates the print task has been blocked. - * type success Indicates the print task succeed. + * type succeed Indicates the print task succeed. * type fail Indicates the print task has completed with failure. * type cancel Indicates the print task has been cancelled. * @param callback The callback function for print task change event * @permission {@code ohos.permission.PRINT} * @return - */ - off(type: 'blocked' | 'success' | 'failed' | 'cancelled', callback?: (boolean) => void): void; + off(type: 'block' | 'succeed' | 'fail' | 'cancel', callback?: (boolean) => void): void; } /** diff --git a/interfaces/kits/napi/src/print_task.cpp b/interfaces/kits/napi/src/print_task.cpp index 1f0ff51c..15aa52d8 100644 --- a/interfaces/kits/napi/src/print_task.cpp +++ b/interfaces/kits/napi/src/print_task.cpp @@ -22,10 +22,10 @@ #include "print_utils.h" namespace OHOS::Print { -const std::string EVENT_BLOCK = "blocked"; -const std::string EVENT_SUCCESS = "success"; -const std::string EVENT_FAIL = "failed"; -const std::string EVENT_CANCEL = "cancelled"; +const std::string EVENT_BLOCK = "block"; +const std::string EVENT_SUCCESS = "succeed"; +const std::string EVENT_FAIL = "fail"; +const std::string EVENT_CANCEL = "cancel"; PrintTask::PrintTask(const std::vector &innerList, const sptr &innerCallerToken_) : taskId_("") diff --git a/services/src/print_service_ability.cpp b/services/src/print_service_ability.cpp index 493f53ac..38e07ee8 100644 --- a/services/src/print_service_ability.cpp +++ b/services/src/print_service_ability.cpp @@ -64,10 +64,10 @@ static const std::string PERMISSION_NAME_PRINT_JOB = "ohos.permission.MANAGE_PRI static const std::string PRINTER_EVENT_TYPE = "printerStateChange"; static const std::string PRINTJOB_EVENT_TYPE = "jobStateChange"; static const std::string EXTINFO_EVENT_TYPE = "extInfoChange"; -static const std::string EVENT_BLOCK = "blocked"; -static const std::string EVENT_SUCCESS = "success"; -static const std::string EVENT_FAIL = "failed"; -static const std::string EVENT_CANCEL = "cancelled"; +static const std::string EVENT_BLOCK = "block"; +static const std::string EVENT_SUCCESS = "succeed"; +static const std::string EVENT_FAIL = "fail"; +static const std::string EVENT_CANCEL = "cancel"; static const std::string CALLER_PKG_NAME = "caller.pkgName"; static const std::string FD = "FD"; diff --git a/services/src/print_service_helper.cpp b/services/src/print_service_helper.cpp index 9acc4929..c2d06c30 100644 --- a/services/src/print_service_helper.cpp +++ b/services/src/print_service_helper.cpp @@ -130,6 +130,7 @@ bool PrintServiceHelper::QueryNameForUid(sptr mgr, int32 { if (mgr != nullptr) { mgr->GetNameForUid(userId, name); + return true; } PRINT_HILOGE("Invalid bundle manager"); return false; diff --git a/test/unittest/service_test/print_service_ability_test.cpp b/test/unittest/service_test/print_service_ability_test.cpp index 163176ad..6c7b66b4 100644 --- a/test/unittest/service_test/print_service_ability_test.cpp +++ b/test/unittest/service_test/print_service_ability_test.cpp @@ -46,10 +46,10 @@ static constexpr const char *DEFAULT_PRINT_FILE_C = "file://data/print/c.png"; static constexpr const char *PRINTER_EVENT_TYPE = "printerStateChange"; static constexpr const char *PRINTJOB_EVENT_TYPE = "jobStateChange"; static constexpr const char *EXTINFO_EVENT_TYPE = "extInfoChange"; -static constexpr const char *EVENT_BLOCK = "blocked"; -static constexpr const char *EVENT_SUCCESS = "success"; -static constexpr const char *EVENT_FAIL = "failed"; -static constexpr const char *EVENT_CANCEL = "cancelled"; +static constexpr const char *EVENT_BLOCK = "block"; +static constexpr const char *EVENT_SUCCESS = "succeed"; +static constexpr const char *EVENT_FAIL = "fail"; +static constexpr const char *EVENT_CANCEL = "cancel"; static constexpr const char *DEFAULT_EXT_INFO = "custom extension info"; enum EXTENSION_ID_TYPE { TYPE_DEFAULT, -- Gitee