From 3a26511c593442b7fcd90ad6ed85e5879e0f28d8 Mon Sep 17 00:00:00 2001 From: dy_study Date: Mon, 16 May 2022 14:21:28 +0800 Subject: [PATCH 01/32] =?UTF-8?q?IssueNo:#I57IWN=20Description:ability=5Fb?= =?UTF-8?q?ase=E7=9B=AE=E5=BD=95=E6=95=B4=E6=94=B9=E5=8F=8A=E5=91=A8?= =?UTF-8?q?=E8=BE=B9=E5=AD=90=E7=B3=BB=E7=BB=9F=E4=BE=9D=E8=B5=96=E6=A0=87?= =?UTF-8?q?=E5=87=86=E5=8C=96=20Sig:SIG=5FApplicationFramework=20Feature?= =?UTF-8?q?=20or=20Bugfix:Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy_study Change-Id: Ia60ffefb18721c6313c4bcf180ae5fcbd5b67b9c --- ext/no_interaction_auth/BUILD.gn | 2 +- ext/pin_auth/BUILD.gn | 2 +- services/devicemanagerservice/BUILD.gn | 2 +- test/fuzztest/ipcclientmanager_fuzzer/BUILD.gn | 2 +- test/fuzztest/ipccmdregister_fuzzer/BUILD.gn | 2 +- test/fuzztest/ipcserverclientproxy_fuzzer/BUILD.gn | 2 +- test/fuzztest/ipcserverlistener_fuzzer/BUILD.gn | 2 +- test/fuzztest/ipcserverstub_fuzzer/BUILD.gn | 2 +- test/unittest/BUILD.gn | 2 +- utils/BUILD.gn | 6 ++---- 10 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ext/no_interaction_auth/BUILD.gn b/ext/no_interaction_auth/BUILD.gn index b56f7543a..76d847f9f 100644 --- a/ext/no_interaction_auth/BUILD.gn +++ b/ext/no_interaction_auth/BUILD.gn @@ -66,7 +66,6 @@ if (defined(ohos_lite)) { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -76,6 +75,7 @@ if (defined(ohos_lite)) { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/ext/pin_auth/BUILD.gn b/ext/pin_auth/BUILD.gn index 7040cf991..90d93114e 100644 --- a/ext/pin_auth/BUILD.gn +++ b/ext/pin_auth/BUILD.gn @@ -135,7 +135,6 @@ if (defined(ohos_lite)) { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${ext_path}/pin_auth/input_pin_dialog/dialog_ui/js:dialog_js_files_etc", "${ext_path}/pin_auth/show_pin_dialog/dialog_ui/js:dialog_js_files_etc", @@ -148,6 +147,7 @@ if (defined(ohos_lite)) { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/services/devicemanagerservice/BUILD.gn b/services/devicemanagerservice/BUILD.gn index 23a42d80d..1c748cc37 100755 --- a/services/devicemanagerservice/BUILD.gn +++ b/services/devicemanagerservice/BUILD.gn @@ -300,7 +300,6 @@ if (defined(ohos_lite)) { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -320,6 +319,7 @@ if (defined(ohos_lite)) { defines += [ "SUPPORT_GRAPHICS" ] } external_deps = [ + "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", diff --git a/test/fuzztest/ipcclientmanager_fuzzer/BUILD.gn b/test/fuzztest/ipcclientmanager_fuzzer/BUILD.gn index 5e07aa175..1721e4366 100644 --- a/test/fuzztest/ipcclientmanager_fuzzer/BUILD.gn +++ b/test/fuzztest/ipcclientmanager_fuzzer/BUILD.gn @@ -88,7 +88,6 @@ ohos_fuzztest("IpcClientManagerFuzzTest") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -105,6 +104,7 @@ ohos_fuzztest("IpcClientManagerFuzzTest") { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/test/fuzztest/ipccmdregister_fuzzer/BUILD.gn b/test/fuzztest/ipccmdregister_fuzzer/BUILD.gn index ba39d03e2..e8b189b63 100644 --- a/test/fuzztest/ipccmdregister_fuzzer/BUILD.gn +++ b/test/fuzztest/ipccmdregister_fuzzer/BUILD.gn @@ -89,7 +89,6 @@ ohos_fuzztest("IpcCmdRegisterFuzzTest") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -106,6 +105,7 @@ ohos_fuzztest("IpcCmdRegisterFuzzTest") { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/test/fuzztest/ipcserverclientproxy_fuzzer/BUILD.gn b/test/fuzztest/ipcserverclientproxy_fuzzer/BUILD.gn index 8ecc8590f..e34f0969b 100644 --- a/test/fuzztest/ipcserverclientproxy_fuzzer/BUILD.gn +++ b/test/fuzztest/ipcserverclientproxy_fuzzer/BUILD.gn @@ -88,7 +88,6 @@ ohos_fuzztest("IpcServerClientProxyFuzzTest") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -105,6 +104,7 @@ ohos_fuzztest("IpcServerClientProxyFuzzTest") { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/test/fuzztest/ipcserverlistener_fuzzer/BUILD.gn b/test/fuzztest/ipcserverlistener_fuzzer/BUILD.gn index f7cab81e7..47052b680 100644 --- a/test/fuzztest/ipcserverlistener_fuzzer/BUILD.gn +++ b/test/fuzztest/ipcserverlistener_fuzzer/BUILD.gn @@ -88,7 +88,6 @@ ohos_fuzztest("IpcServerListenerFuzzTest") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -105,6 +104,7 @@ ohos_fuzztest("IpcServerListenerFuzzTest") { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/test/fuzztest/ipcserverstub_fuzzer/BUILD.gn b/test/fuzztest/ipcserverstub_fuzzer/BUILD.gn index 1bfae7dca..7fa5a7e3d 100644 --- a/test/fuzztest/ipcserverstub_fuzzer/BUILD.gn +++ b/test/fuzztest/ipcserverstub_fuzzer/BUILD.gn @@ -88,7 +88,6 @@ ohos_fuzztest("IpcServerStubFuzzTest") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -105,6 +104,7 @@ ohos_fuzztest("IpcServerStubFuzzTest") { ] external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index c784979ea..1efeecb78 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -621,7 +621,6 @@ ohos_static_library("device_manager_test") { deps = [ "${aainnerkits_path}/ability_manager:ability_manager", - "${aainnerkits_path}/want:want", "${aaservices_path}/abilitymgr:abilityms", "${innerkits_path}/native_cpp:devicemanagersdk", "${utils_path}:devicemanagerutils", @@ -634,6 +633,7 @@ ohos_static_library("device_manager_test") { } external_deps = [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_core", diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 45e102e99..e877585ca 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -151,10 +151,7 @@ if (defined(ohos_lite)) { "LOG_DOMAIN=0xD004100", ] - deps = [ - "${aainnerkits_path}/want:want", - "//third_party/mbedtls:mbedtls_shared", - ] + deps = [ "//third_party/mbedtls:mbedtls_shared" ] external_deps = [ "access_token:libaccesstoken_sdk", @@ -166,6 +163,7 @@ if (defined(ohos_lite)) { ] if (support_jsapi) { external_deps += [ + "ability_base:want", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", ] -- Gitee From 8a193d5c9622df7dae24b68277ed20a955a0b824 Mon Sep 17 00:00:00 2001 From: summer8999 Date: Tue, 17 May 2022 15:07:14 +0800 Subject: [PATCH 02/32] issue modify Signed-off-by: summer8999 --- .../src/authentication/dm_auth_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index ff50edcfa..d72dcab4d 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -435,7 +435,7 @@ void DmAuthManager::RespNegotiate(const int32_t &sessionId) softbusConnector_->GetSoftbusSession()->SendData(sessionId, message); } authResponseContext_ = authResponseState_->GetAuthContext(); - if (jsonObject[TAG_CRYPTO_SUPPORT] == "true" && authResponseContext_->cryptoSupport) { + if ((jsonObject[TAG_CRYPTO_SUPPORT] == true) && authResponseContext_->cryptoSupport) { if (jsonObject[TAG_CRYPTO_NAME] == authResponseContext_->cryptoName && jsonObject[TAG_CRYPTO_VERSION] == authResponseContext_->cryptoVer) { isCryptoSupport_ = true; @@ -443,7 +443,7 @@ void DmAuthManager::RespNegotiate(const int32_t &sessionId) return; } } - jsonObject[TAG_CRYPTO_SUPPORT] = "false"; + jsonObject[TAG_CRYPTO_SUPPORT] = false; message = jsonObject.dump(); softbusConnector_->GetSoftbusSession()->SendData(sessionId, message); timer_->StartTimer(WAIT_REQUEST_TIMEOUT_TASK, WAIT_REQUEST_TIMEOUT, @@ -745,7 +745,7 @@ int32_t DmAuthManager::GetAuthenticationParam(DmAuthParam &authParam) LOGE("Authenticate is not start"); return ERR_DM_AUTH_NOT_START; } - + dmAbilityMgr_->StartAbilityDone(); AbilityRole role = dmAbilityMgr_->GetAbilityRole(); authParam.direction = (int32_t)role; -- Gitee From 911e8fee1bd3482e2b73d6d9278644c8862ad7ed Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Tue, 17 May 2022 22:49:22 +0800 Subject: [PATCH 03/32] =?UTF-8?q?js=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- common/include/dm_constants.h | 32 +++++ .../kits/js/include/native_devicemanager_js.h | 3 + .../kits/js/src/native_devicemanager_js.cpp | 4 + utils/BUILD.gn | 6 + utils/include/errormessage/errormessage.h | 49 +++++++ utils/src/errormessage/errormessage.cpp | 126 ++++++++++++++++++ 6 files changed, 220 insertions(+) create mode 100644 utils/include/errormessage/errormessage.h create mode 100644 utils/src/errormessage/errormessage.cpp diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 4ff3d02b3..1a303db25 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -199,6 +199,38 @@ const int32_t MAX_EVENT_NUMBER = 10; const int32_t EXPAND_TWICE = 2; const int32_t SEC_TO_MM = 1000; const int32_t MAX_EVENTS = 5; + +// error code info +const std::string DM_FAILED_INFO = "dm process execution failed."; +const std::string DM_TIME_OUT_INFO = "dm process execution timeout."; +const std::string DM_NOT_INIT_INFO = "dm service is not initialized, please try again later."; +const std::string DM_INIT_REPEATED_INFO = "dm service repeated initialization."; +const std::string DM_INIT_FAILED_INFO = "dm service initialize failed."; +const std::string DM_UNINIT_FAILED_INFO = "dm Service uninitialization failed."; +const std::string DM_POINT_NULL_INFO = "dm service null pointer exception occurred."; +const std::string DM_INPUT_PARAMETER_EMPTY_INFO = "the function call input parameter is empty."; +const std::string DM_NO_PERMISSION_INFO = "no permission for function call."; +const std::string DM_MALLOC_FAILED_INFO = "memory allocation failed."; +const std::string DM_DISCOVERY_FAILED_INFO = "device discovery failed."; +const std::string DM_MAP_KEY_ALREADY_EXISTS_INFO = "map key already exists."; +const std::string DM_PROFILE_EVENTS_FAILED_INFO = "process profile events failed."; +const std::string DM_IPC_WRITE_FAILED_INFO = "ipc write object failed."; +const std::string DM_IPC_COPY_FAILED_INFO = "ipc copy data failed."; +const std::string DM_IPC_SEND_REQUEST_FAILED_INFO = "ipc send request failed."; +const std::string DM_UNSUPPORTED_IPC_COMMAND_INFO = "ipc command not supported."; +const std::string DM_IPC_RESPOND_FAILED_INFO = "ipc process failed to receive response."; +const std::string DM_IPC_WRITE_TOKEN_INFO = "ipc write token failed."; +const std::string DM_DISCOVERY_REPEATED_INFO = "repeat device discovery warning."; +const std::string DM_UNSUPPORTED_AUTH_TYPE_INFO = "auth type not supported."; +const std::string DM_AUTH_BUSINESS_BUSY_INFO = "authentication service is busy."; +const std::string DM_AUTH_OPEN_SESSION_FAILED_INFO = "open auth session failed."; +const std::string DM_AUTH_PEER_REJECT_INFO = "remote device refused to authorization."; +const std::string DM_AUTH_REJECT_INFO = "local device refused to authorization."; +const std::string DM_AUTH_FAILED_INFO = "authentication failed."; +const std::string DM_AUTH_NOT_START_INFO = "auth process not started."; +const std::string DM_AUTH_MESSAGE_INCOMPLETE_INFO = "authentication message is incomplete."; +const std::string DM_CREATE_GROUP_FAILED_INFO = "create group failed."; +const std::string DM_ERROR_CODE_DEFAULT_INFO = "error code undefined."; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_CONSTANTS_H diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h index 8db0b6022..6b0883f89 100644 --- a/interfaces/kits/js/include/native_devicemanager_js.h +++ b/interfaces/kits/js/include/native_devicemanager_js.h @@ -25,6 +25,7 @@ #include "dm_native_event.h" #include "dm_subscribe_info.h" #include "dm_anonymous.h" +#include "errormessage/errormessage.h" #include "napi/native_api.h" #include "napi/native_node_api.h" #include "nlohmann/json.hpp" @@ -311,5 +312,7 @@ private: std::string bundleName_; static AuthAsyncCallbackInfo authAsyncCallbackInfo_; static AuthAsyncCallbackInfo verifyAsyncCallbackInfo_; + std::shared_ptr errorMessage_ = + std::make_shared(); }; #endif // OHOS_DM_NATIVE_DEVICEMANAGER_JS_H diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index f057d9cf6..b4cb83bc2 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -489,6 +489,8 @@ void DeviceManagerNapi::OnDiscoveryFailed(uint16_t subscribeId, int32_t failedRe napi_create_object(env_, &result); SetValueInt32(env_, "subscribeId", (int)subscribeId, result); SetValueInt32(env_, "reason", (int)failedReason, result); + std::string errCodeInfo = errorMessage_->GetErrorString((int)failedReason); + SetValueUtf8String(env_, "errInfo", errCodeInfo, result); OnEvent("discoverFail", DM_NAPI_ARGS_ONE, &result); } @@ -510,6 +512,8 @@ void DeviceManagerNapi::OnAuthResult(const std::string &deviceId, const std::str napi_create_object(env_, &result[0]); SetValueInt32(env_, "code", status, result[0]); SetValueInt32(env_, "reason", reason, result[0]); + std::string errCodeInfo = errorMessage_->GetErrorString((int)reason); + SetValueUtf8String(env_, "errInfo", errCodeInfo, result[0]); napi_get_undefined(env_, &result[1]); } diff --git a/utils/BUILD.gn b/utils/BUILD.gn index e877585ca..bf4fb711d 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -37,12 +37,14 @@ if (defined(ohos_lite)) { "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", "//third_party/bounds_checking_function/include", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", + "//utils/include/errormessage", ] sources = [ "${utils_path}/src/dm_anonymous.cpp", "${utils_path}/src/dm_log.cpp", "${utils_path}/src/dm_random.cpp", + "${utils_path}/src/errormessage/errormessage.cpp", "${utils_path}/src/permission/lite/permission_manager.cpp", ] @@ -88,11 +90,13 @@ if (defined(ohos_lite)) { "//foundation/communication/dsoftbus/interfaces/kits/transport", "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", + "//utils/include/errormessage", ] sources = [ "src/dm_anonymous.cpp", "src/dm_log.cpp", "src/dm_random.cpp", + "src/errormessage/errormessage.cpp", "src/fwkload/lite/dm_distributed_hardware_load.cpp", "src/ipc/lite/ipc_cmd_register.cpp", "src/permission/lite/permission_manager.cpp", @@ -125,6 +129,7 @@ if (defined(ohos_lite)) { "${common_path}/include/ipc/model", "include/permission/standard", "//third_party/mbedtls/include/mbedtls", + "//utils/include/errormessage", ] } @@ -134,6 +139,7 @@ if (defined(ohos_lite)) { "src/dm_hash.cpp", "src/dm_log.cpp", "src/dm_random.cpp", + "src/errormessage/errormessage.cpp", "src/ipc/standard/ipc_cmd_register.cpp", ] if (support_jsapi) { diff --git a/utils/include/errormessage/errormessage.h b/utils/include/errormessage/errormessage.h new file mode 100644 index 000000000..867749589 --- /dev/null +++ b/utils/include/errormessage/errormessage.h @@ -0,0 +1,49 @@ +/* + * 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_DM_ERROMSG_H +#define OHOS_DM_ERROMSG_H + +#include +#include +#include "dm_log.h" +#include "dm_constants.h" + +namespace OHOS { +namespace DistributedHardware { +class ErrorMessage { +public: + /** + * @tc.name: ErrorMessage::ErrorMessage + * @tc.desc: Dm Error Message Info Constructor. + * @tc.type: FUNC + */ + ErrorMessage(); + /** + * @tc.name: ErrorMessage::~ErrorMessage + * @tc.desc: Dm Error Message Info destructor. + * @tc.type: FUNC + */ + virtual ~ErrorMessage(); + /** + * @tc.name: ErrorMessage::GetErrorString + * @tc.desc: Get Error String. + * @tc.type: FUNC + */ + std::string GetErrorString(int); +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif // OHOS_DM_ERROMSG_H diff --git a/utils/src/errormessage/errormessage.cpp b/utils/src/errormessage/errormessage.cpp new file mode 100644 index 000000000..24106f6a1 --- /dev/null +++ b/utils/src/errormessage/errormessage.cpp @@ -0,0 +1,126 @@ +/* + * 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 "errormessage/errormessage.h" + +namespace OHOS { +namespace DistributedHardware { +ErrorMessage::ErrorMessage() +{ + LOGI("ErrorMessage construct."); +} + +ErrorMessage::~ErrorMessage() +{ + LOGI("ErrorMessage Destructor."); +} + +std::string ErrorMessage::GetErrorString(int failedReason) +{ + LOGI("Enter PermissionManager::GetErrorString"); + std::string tmpStr; + switch (failedReason) { + case ERR_DM_FAILED: + tmpStr = DM_FAILED_INFO; + break; + case ERR_DM_TIME_OUT: + tmpStr = DM_TIME_OUT_INFO; + break; + case ERR_DM_NOT_INIT: + tmpStr = DM_NOT_INIT_INFO; + break; + case ERR_DM_INIT_REPEATED: + tmpStr = DM_INIT_REPEATED_INFO; + break; + case ERR_DM_INIT_FAILED: + tmpStr = DM_INIT_FAILED_INFO; + break; + case ERR_DM_UNINIT_FAILED: + tmpStr = DM_UNINIT_FAILED_INFO; + break; + case ERR_DM_POINT_NULL: + tmpStr = DM_POINT_NULL_INFO; + break; + case ERR_DM_INPUT_PARAMETER_EMPTY: + tmpStr = DM_INPUT_PARAMETER_EMPTY_INFO; + break; + case ERR_DM_NO_PERMISSION: + tmpStr = DM_NO_PERMISSION_INFO; + break; + case ERR_DM_MALLOC_FAILED: + tmpStr = DM_MALLOC_FAILED_INFO; + break; + case ERR_DM_DISCOVERY_FAILED: + tmpStr = DM_DISCOVERY_FAILED_INFO; + break; + case ERR_DM_MAP_KEY_ALREADY_EXISTS: + tmpStr = DM_MAP_KEY_ALREADY_EXISTS_INFO; + break; + case DM_PROFILE_EVENTS_FAILED: + tmpStr = DM_PROFILE_EVENTS_FAILED_INFO; + break; + case ERR_DM_IPC_WRITE_FAILED: + tmpStr = DM_IPC_WRITE_FAILED_INFO; + break; + case ERR_DM_IPC_COPY_FAILED: + tmpStr = DM_IPC_COPY_FAILED_INFO; + break; + case ERR_DM_IPC_SEND_REQUEST_FAILED: + tmpStr = DM_IPC_SEND_REQUEST_FAILED_INFO; + break; + case ERR_DM_UNSUPPORTED_IPC_COMMAND: + tmpStr = DM_UNSUPPORTED_IPC_COMMAND_INFO; + break; + case ERR_DM_IPC_RESPOND_FAILED: + tmpStr = DM_IPC_RESPOND_FAILED_INFO; + break; + case ERR_DM_IPC_WRITE_TOKEN_FAILED: + tmpStr = DM_IPC_WRITE_TOKEN_INFO; + break; + case ERR_DM_DISCOVERY_REPEATED: + tmpStr = DM_DISCOVERY_REPEATED_INFO; + break; + case ERR_DM_UNSUPPORTED_AUTH_TYPE: + tmpStr = DM_UNSUPPORTED_AUTH_TYPE_INFO; + break; + case ERR_DM_AUTH_OPEN_SESSION_FAILED: + tmpStr = DM_AUTH_OPEN_SESSION_FAILED_INFO; + break; + case ERR_DM_AUTH_PEER_REJECT: + tmpStr = DM_AUTH_PEER_REJECT_INFO; + break; + case ERR_DM_AUTH_REJECT: + tmpStr = DM_AUTH_REJECT_INFO; + break; + case ERR_DM_AUTH_FAILED: + tmpStr = DM_AUTH_FAILED_INFO; + break; + case ERR_DM_AUTH_NOT_START: + tmpStr = DM_AUTH_NOT_START_INFO; + break; + case ERR_DM_AUTH_MESSAGE_INCOMPLETE: + tmpStr = DM_AUTH_MESSAGE_INCOMPLETE_INFO; + break; + case ERR_DM_CREATE_GROUP_FAILED: + tmpStr = DM_CREATE_GROUP_FAILED_INFO; + break; + default: + tmpStr = DM_ERROR_CODE_DEFAULT_INFO; + break; + } + return tmpStr; +} +} // namespace DistributedHardware +} // namespace OHOS -- Gitee From a64c279046762efb72f78be1aa39a76e62cc5806 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Wed, 18 May 2022 16:33:01 +0800 Subject: [PATCH 04/32] =?UTF-8?q?tdd=E7=94=A8=E4=BE=8B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20Signed-off-by:=20wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/unittest/UTTest_device_manager_impl.cpp | 1 + test/unittest/UTTest_dm_discovery_manager.cpp | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/test/unittest/UTTest_device_manager_impl.cpp b/test/unittest/UTTest_device_manager_impl.cpp index 353bbe6a5..8cf5ff118 100644 --- a/test/unittest/UTTest_device_manager_impl.cpp +++ b/test/unittest/UTTest_device_manager_impl.cpp @@ -1307,6 +1307,7 @@ HWTEST_F(DeviceManagerImplTest, UnAuthenticateDevice_002, testing::ext::TestSize // 1. set packName = null std::string packName = "com.ohos.helloworld"; DmDeviceInfo deviceInfo; + deviceInfo.deviceId[0] = '\0'; // 2. call DeviceManagerImpl::AuthenticateDevice with parameter int32_t ret= DeviceManager::GetInstance().UnAuthenticateDevice(packName, deviceInfo); // 3. check ret is DEVICEMANAGER_INVALID_VALUE diff --git a/test/unittest/UTTest_dm_discovery_manager.cpp b/test/unittest/UTTest_dm_discovery_manager.cpp index 764b1621c..27b40b4eb 100644 --- a/test/unittest/UTTest_dm_discovery_manager.cpp +++ b/test/unittest/UTTest_dm_discovery_manager.cpp @@ -225,21 +225,6 @@ HWTEST_F(DmDiscoveryManagerTest, OnDiscoverySuccess_002, testing::ext::TestSize. std ::string ret = pReq->GetPkgName(); EXPECT_EQ(ret, pkgName); } - -/** - * @tc.name: HandleDiscoveryTimeout_001 - * @tc.desc: set pkgName not null and return 1(true) - * @tc.type: FUNC - * @tc.require: AR000GHSJK - */ -HWTEST_F(DmDiscoveryManagerTest, HandleDiscoveryTimeout_001, testing::ext::TestSize.Level0) -{ - std::string name = "test"; - std::string pkgName = "com.ohos.helloworld"; - discoveryMgr_->HandleDiscoveryTimeout(name); - int ret = discoveryMgr_->discoveryContextMap_.count(pkgName); - EXPECT_EQ(ret, 1); -} } // namespace } // namespace DistributedHardware } // namespace OHOS -- Gitee From 28cceb30a0553bb66cf50ddaa1f3ded21517d444 Mon Sep 17 00:00:00 2001 From: wuqi0105 Date: Thu, 19 May 2022 14:27:52 +0800 Subject: [PATCH 05/32] =?UTF-8?q?wukong=20=E6=B5=8B=E8=AF=95js=20crash?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuqi0105 --- display/entry/build.gradle | 13 +- display/entry/src/main/config.json | 23 +- display/entry/src/main/js/MainAbility/app.js | 8 + .../src/main/js/MainAbility/i18n/en-US.json | 22 + .../src/main/js/MainAbility/i18n/zh-CN.json | 22 + .../main/js/MainAbility/pages/index/index.css | 285 ++++++++++ .../main/js/MainAbility/pages/index/index.hml | 149 +++++ .../main/js/MainAbility/pages/index/index.js | 519 ++++++++++++++++++ .../main/resources/base/element/string.json | 4 +- 9 files changed, 1024 insertions(+), 21 deletions(-) create mode 100644 display/entry/src/main/js/MainAbility/app.js create mode 100644 display/entry/src/main/js/MainAbility/i18n/en-US.json create mode 100644 display/entry/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 display/entry/src/main/js/MainAbility/pages/index/index.css create mode 100644 display/entry/src/main/js/MainAbility/pages/index/index.hml create mode 100644 display/entry/src/main/js/MainAbility/pages/index/index.js diff --git a/display/entry/build.gradle b/display/entry/build.gradle index f83acd766..60fc1dd8e 100644 --- a/display/entry/build.gradle +++ b/display/entry/build.gradle @@ -14,11 +14,11 @@ */ apply plugin: 'com.huawei.ohos.hap' -apply plugin: 'com.huawei.ohos.decctest' +//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 ohos { - compileSdkVersion 6 + compileSdkVersion 8 defaultConfig { - compatibleSdkVersion 6 + compatibleSdkVersion 7 } buildTypes { release { @@ -28,14 +28,9 @@ ohos { } } } - } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) - testImplementation 'junit:junit:4.13' - ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200' -} -decc { - supportType = ['html', 'xml'] + testImplementation 'junit:junit:4.13.1' } diff --git a/display/entry/src/main/config.json b/display/entry/src/main/config.json index 946df5f47..b73d3a319 100644 --- a/display/entry/src/main/config.json +++ b/display/entry/src/main/config.json @@ -11,12 +11,10 @@ "module": { "package": "com.ohos.devicemanagerui", "name": ".MyApplication", - "mainAbility": "com.ohos.devicemanagerui.MainAbility", + "mainAbility": ".MainAbility", + "srcPath": "", "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" + "phone" ], "distro": { "deliveryWithInstall": true, @@ -36,10 +34,14 @@ ] } ], + "orientation": "unspecified", "visible": true, - "name": "com.ohos.devicemanagerui.MainAbility", + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "js", "icon": "$media:icon", - "description": "$string:mainability_description", + "description": "$string:description_mainability", + "formsEnabled": false, "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" @@ -48,12 +50,13 @@ "js": [ { "pages": [ - "pages/index/index" + "pages/index/index", + "pages/second/second" ], - "name": "default", + "name": ".MainAbility", "window": { "designWidth": 720, - "autoDesignWidth": true + "autoDesignWidth": false } } ] diff --git a/display/entry/src/main/js/MainAbility/app.js b/display/entry/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..6d060ffe5 --- /dev/null +++ b/display/entry/src/main/js/MainAbility/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/display/entry/src/main/js/MainAbility/i18n/en-US.json b/display/entry/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..328519b85 --- /dev/null +++ b/display/entry/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,22 @@ +{ + "strings": { + "pinCodeConnection": "Pin connection", + "enterThePinCode": "Please enter the displayed pin code", + "delete": "Del", + "off": "Off", + + "toConnectToThisComputer": " connection", + "resourceAccess": "Resource access", + "cancel": "Cancel", + "parenthesesLeft": "(", + "parenthesesRight": ")", + "allow": "Allow", + + "applyAuth": "Allow open apply auth?", + "from": "From ", + + "enterDisplayPinCode": "Please enter the displayed pin code" + }, + "Files": { + } +} \ No newline at end of file diff --git a/display/entry/src/main/js/MainAbility/i18n/zh-CN.json b/display/entry/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..e972be210 --- /dev/null +++ b/display/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,22 @@ +{ + "strings": { + "pinCodeConnection": "PIN码连接", + "enterThePinCode": "请输入平板上显示的PIN码", + "delete": "删除", + "off": "关闭", + + "toConnectToThisComputer": "想要连接本机", + "resourceAccess": "用于资源访问", + "cancel": "取消", + "parenthesesLeft": "(", + "parenthesesRight": ")", + "allow": "允许", + + "applyAuth": "是否允许打开apply auth?", + "from": "来自", + + "enterDisplayPinCode": "请在主控端输入连接码进行验证" + }, + "Files": { + } +} \ No newline at end of file diff --git a/display/entry/src/main/js/MainAbility/pages/index/index.css b/display/entry/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..295431f2a --- /dev/null +++ b/display/entry/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,285 @@ +/* + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; + opacity: 0.8; + width: 100%; + background-color: azure; +} + +.container > div { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.main-pin { + flex-direction: column; + justify-content: center; + align-items: center; + opacity: 0.8; + width: 100%; + padding: 3% 0; + background-color: azure; +} +.main-pin > .pin-numb { + flex-direction: row; + justify-content: space-around; + align-items: center; + padding: 0 0px 3% 0px; +} +.main-pin > .pin-numb > .pin-numb-item { + font-size: 30px; + height: 14%; + margin: 0 5px; + padding-bottom: 2%; + font-weight: 800; + width: 30px; + border-bottom-width: 2px; + border-bottom-color: darkgray; + text-align: center; +} + +.main-pin > .input { + flex-direction: row; + justify-content: space-around; + align-items: center; + padding: 2%; +} + +.main-pin > .input > .numb { + text-color: black; + padding: 2%; + flex-shrink: 0; + margin: 0 5px; + flex-basis: 72px; + background-color: white; + border: 1px; +} + +.join-auth { + padding-top: 10%; +} +.join-auth-image > image { + height: 50%; +} +.join-authorize { + padding-top: 4%; +} +.join-pin { + padding: 4% 0; +} +.join-pin > .pin { + font-size: 50px; + height: 31%; + font-weight: bolder; + color: #000000; +} + +.join-auth > .title, +.join-auth-image > .title, +.join-authorize > .title { + font-size: 18px; + height: 28%; + font-weight: 800; + color: #000000; +} +.join-auth > .title { + height: 14%; +} +.join-auth-image > .title { + height: 9%; +} +.join-pin > .title { + font-size: 28px; + height: 20%; + font-weight: 800; +} +.main-pin > .title { + font-size: 30px; + height: 14%; + font-weight: bolder; +} + +.join-auth > .title-tip, +.join-auth-image > .title-tip, +.main-pin > .title-tip, +.join-authorize > .title-tip { + font-size: 15px; + height: 14%; + color: #5A5A5A; +} +.join-auth > .title-tip { + height: 14%; +} +.join-auth-image > .title-tip { + height: 8%; +} +.join-auth-image > .title-tip > image { + width: 30px; + height: 10%; + margin: 5px 10px 0 0; +} +.join-pin > .title-tip { + font-size: 20px; + height: 17%; + font-weight: 600; +} +.main-pin > .title-tip { + font-size: 18px; + height: 10%; + font-weight: 800; +} + +.join-auth > .dialog-foot, +.join-auth-image > .dialog-foot, +.join-authorize > .dialog-foot { + flex-direction: row; + justify-content: center; + align-items: center; + justify-content: space-around; + margin: 28% 20px 10% 20px; +} +.join-authorize > .dialog-foot { + margin: 35% 20px 10% 20px; +} +.join-auth-image > .dialog-foot { + margin: 3% 20px; +} +.join-pin > .dialog-foot { + margin: 3% 20px; +} + +.join-auth .button-cancel, +.join-auth-image .button-cancel, +.join-authorize .button-cancel { + width: 160px; + height: 12%; +} +.join-pin .button-cancel { + width: 100%; + font-size: 26px; + height: 17%; +} + +.join-auth .button-ok, +.join-auth-image .button-ok, +.join-authorize .button-ok { + width: 150px; + height: 12%; +} + +/* css of wifi page*/ +.join-wifi-container, +.main-wifi { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.input-container { + flex-direction: column; + justify-content: center; + align-items: center; + height: 50%; + width: 100%; + padding: 2% 15% 2% 15%; +} + +.keyboard-container { + flex-direction: column; + justify-content: center; + align-items: center; + height: 50%; + width: 100%; + padding: 1%; +} + +.input-title { + height: 15%; + font-size: 16px; + font-weight: bold; +} + +.input-area { + border: 1px solid darkgrey; + border-radius: 5px; + width: 100%; + height: 25%; + margin-top: 5%; +} + +.button-area { + flex-direction: row; + justify-content: space-around; + align-items: center; + height: 25%; + margin-top: 5%; + width: 80%; +} + +.input-label { + width: 20%; + font-size: 14px; + text-align: center; +} + +.input-text { + width: 60%; + font-size: 14px; + text-align: start; + padding-start: 5%; + max-lines: 1; +} + +.input-divider { + color: darkgrey; +} + +.button-row { + flex-direction: row; + justify-content: center; + height: 23%; + width: 100%; + margin: 1% 0; +} + +.wifi-button { + height: 100%; + font-size: 14px; +} + +.keyboard-button { + width: 9%; + margin: 0 1%; + height: 100%; + border: 1px solid darkgrey; + border-radius: 3px; + font-size: 12px; + text-align: center; +} + +.join-wifi-text { + width: 80%; + font-size: 16px; + text-align: center; + height: 33%; +} + diff --git a/display/entry/src/main/js/MainAbility/pages/index/index.hml b/display/entry/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..bc2ba39f0 --- /dev/null +++ b/display/entry/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,149 @@ + + +
+
+ {{ $t('strings.pinCodeConnection') }} + {{ $t('strings.enterThePinCode') }} +
+ {{pin[0]}} + {{pin[1]}} + {{pin[2]}} + {{pin[3]}} + {{pin[4]}} + {{pin[5]}} +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
+ {{statusInfo.deviceName}}{{ $t('strings.toConnectToThisComputer') }} + {{ $t( 'strings.resourceAccess' ) }} +
+ + +
+
+ +
+ {{ statusInfo.appName }} + {{ $t('strings.applyAuth') }} + {{ $t('strings.from') }}{{statusInfo.deviceName}} +
+ + +
+
+ +
+
+ 请输入网络信息 +
+ SSID: + + {{wifiInfo.wifiSsid}} +
+
+ Key: + + {{wifiInfo.wifiPassword}} +
+
+ + +
+
+
+
+ {{ item }} + Del +
+
+ {{ item }} + Aa +
+
+ {{ item }} +
+
+ {{ item }} +
+
+
+ +
+ {{wifiInfo.wifiSsid}} + 配网成功 + 配网失败 + +
+ +
+ +
+ + {{ statusInfo.appName }} +
+ {{ $t('strings.applyAuth') }} + {{ $t('strings.from') }}{{statusInfo.deviceName}} +
+ + +
+
+
+ {{ $t('strings.pinCodeConnection') }} + {{ $t('strings.enterDisplayPinCode') }} + {{statusInfo.pinCode.split('').join(' ')}} +
+ +
+
+ +
diff --git a/display/entry/src/main/js/MainAbility/pages/index/index.js b/display/entry/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..88772dcd8 --- /dev/null +++ b/display/entry/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,519 @@ +/* + * 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 router from '@system.router'; +import deviceManager from '@ohos.distributedHardware.deviceManager'; +function uint8ArrayToBase64(array) { + array = new Uint8Array(array); + let table = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'], + base64Str = '', length = array.byteLength, i = 0; + for(i = 0; length - i >= 3; i += 3) { + let num1 = array[i], num2 = array[i + 1], num3 = array[i + 2]; + base64Str += table[num1 >>> 2] + table[((num1 & 0b11) << 4) | (num2 >>> 4)] + table[((num2 & 0b1111) << 2) | (num3 >>> 6)] + table[num3 & 0b111111]; + } + const lastByte = length - i; + if(lastByte === 1) { + const lastNum1 = array[i]; + base64Str += table[lastNum1 >>> 2] + table[((lastNum1 & 0b11) << 4)] + '=='; + } else if(lastByte === 2){ + const lastNum1 = array[i]; + const lastNum2 = array[i + 1]; + base64Str += table[lastNum1 >>> 2] + table[((lastNum1 & 0b11) << 4) | (lastNum2 >>> 4)] + table[(lastNum2 & 0b1111) << 2] + '='; + } + return 'data:image/png;base64,' + base64Str; +} +const TAG = "DeviceManagerUI:"; + +const AUTH_TYPE_PIN = 1 +const AUTH_TYPE_WIFI = 2 + +const LOWER_CASE_KEYS = { + line1 : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], + line2 : ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'], + line3 : [',', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '.'], + line4 : [';', '*', 'z', 'x', 'c', 'v', 'b', 'n', 'm', '-', '_'], +} +const UPPER_CASE_KEYS = { + line1 : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], + line2 : ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'], + line3 : [',', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '.'], + line4 : [';', '*', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '-', '_'], +} + +const CURRENT_FOCUS_SSID = 0 +const CURRENT_FOCUS_KEY = 1 + +const USER_WIFI_CANCEL_CODE = 5 + +const ACTIVE_COLOR = '#fff' +const INACTIVE_COLOR = '#ddd' + +const WIFI_CONFIGURE_SUCCESS = 0 +const WIFI_CONFIGURE_FAILED = 1 +const WIFI_CONFIGURE_DOING = 2 +const WIFI_CONFIGURE_DEFAULT = -1 + +let dmClass; + +export default { + data: { + // showType: ['main-pin','join-authorize','join-auth','join-auth-image','join-pin'] + status: "", + // showInfo + statusInfo: { + deviceName: "AppName", + appName: 'PackageName', + appIcon: null, + appThumbnail: null, + pinCode: '', + pinToken: '' + }, + // join: join-authorize timing + timeRemaining: 0, + // input pinCode + pin: ['','','','','',''], + // input pinCode next number + pinNumb: 0, + wifiInfo: { + wifiSsid: '', + wifiPassword: '' + }, + keyboardItem : LOWER_CASE_KEYS, + isSSidFocus : false, + isKeyFocus : false, + currentSsidColor : INACTIVE_COLOR, + currentKeyColor : INACTIVE_COLOR, + configureResult : WIFI_CONFIGURE_DEFAULT + }, + + log(m) { + console.info(TAG + m); + }, + + onDestroy() { + this.log("onDestroy") + if (dmClass != null) { + dmClass.off('dmFaCallback'); + dmClass.off('deviceStateChange'); + dmClass.off('serviceDie'); + dmClass.release(); + dmClass = null + } + }, + + onShow() { + if (dmClass) { + this.log('deviceManager exist') + this.initStatue() + } else { + this.log('createDeviceManager') + deviceManager.createDeviceManager('com.ohos.devicemanagerui', (err, dm) => { + this.log("createDeviceManager err:" + JSON.stringify(err) + ' --success:' + JSON.stringify(dm)) + if (err) return; + dmClass = dm; + dmClass.on('dmFaCallback', () => { + this.log("dmFaCallback executed, dialog closed") + router.back() + }) + this.initStatue() + }); + } + }, + + onHide() { + this.log('onHide') + this.timeRemaining = 0 + }, + + /** + * Get authentication param + */ + initStatue() { + this.log('initStatue') + const data = dmClass.getFaParam(); + this.log('getFaParam:' + JSON.stringify(data)) + // const data = dmClas icationParam:' + JSON.stringify(data)) + // Authentication type, 1 for pin code. + if(data&&!data.FaType){ + return; + } + if (data && data.FaType == 1) { + this.log('initStatue:data.FaType == 1' ) + let authParam = data.authParam + this.log('initStatue authParam: ' +authParam ) + this.statusInfo = { + deviceName: authParam.extraInfo.PackageName, + appName: authParam.extraInfo.appName, + appIcon: uint8ArrayToBase64(authParam.appIcon), + appThumbnail: uint8ArrayToBase64(authParam.appThumbnail), + pinCode: authParam.extraInfo.pinCode + '', + pinToken: authParam.extraInfo.pinToken + } + this.log('initStatue statusInfo: ' +this.statusInfo ) + // direction: 1(main)/0(join) + if (authParam.extraInfo.direction == 1) { + this.log('initStatue statusInfo: authParam.extraInfo.direction == 1') + this.mainPin() + } else if (authParam.appIcon) { + this.log('initStatue statusInfo:authParam.appIcon == 1') + this.joinAuthImage() + } else if (authParam.extraInfo.business == 0) { + // business: 0(FA流转)/1(资源访问) + this.log('initStatue statusInfo:authParam.extraInfo.business == 0') + this.joinAuth() + } else { + this.log('initStatue join') + this.joinAuthorize() + } + } + this.log('initStatue wifi start') + if (data && data.FaType == AUTH_TYPE_WIFI && data.ConWifiParam == WIFI_CONFIGURE_DOING) { + this.log("show main wifi page") + this.mainWifi() + } + + if (data && data.FaType == AUTH_TYPE_WIFI && data.ConWifiParam != WIFI_CONFIGURE_DOING) { + this.log("show join wifi page") + let wifiParam = data.conWifiParam + this.wifiInfo.wifiSsid = wifiParam.wifiSsid; + this.configureResult = wifiParam.configureResult + this.joinWifi() + } + }, + + /** + * Set user Operation from devicemanager Fa, this interface can only used by devicemanager Fa. + * + * @param operateAction User Operation Actions. + * ACTION_ALLOW_AUTH = 0, allow authentication + * ACTION_CANCEL_AUTH = 1, cancel authentication + * ACTION_AUTH_CONFIRM_TIMEOUT = 2, user operation timeout for authentication confirm + * ACTION_CANCEL_PINCODE_DISPLAY = 3, cancel pinCode display + * ACTION_CANCEL_PINCODE_INPUT = 4, cancel pinCode input + */ + setUserOperation(operation) { + this.log('setUserOperation: ' + operation) + if (dmClass != null) { + var data = dmClass.setUserOperation(operation); + this.log('setUserOperation result: ' + JSON.stringify(data)) + } else { + this.log('deviceManagerObject not exit') + } + }, + + /** + * verify auth info, such as pin code. + * @param pinCode + * @return + */ + verifyAuthInfo(pinCode) { + this.log('verifyAuthInfo: ' + pinCode) + if (dmClass != null) { + dmClass.verifyAuthInfo({ + "authType": 1, + "token": this.statusInfo.pinToken, + "extraInfo": { + "pinCode": +pinCode + } + }, (err, data) => { + if (err) { + this.log("verifyAuthInfo err:" + JSON.stringify(err)) + } + this.log("verifyAuthInfo result:" + JSON.stringify(data)) + router.back() + }); + } else { + this.log('deviceManagerObject not exit') + } + }, + + /** + * Input pinCode at the main control terminal + */ + mainPin() { + this.status = 'main-pin' + this.log("mainPin") + }, + + /** + * Enter a number with the keyboard + * @param s + * @return + */ + mainInputPin(s) { + this.log('mainInputPin input: ' + s + '-' + this.pin) + if (this.pinNumb == 6) return + if (this.pinNumb < 6) { + this.pin[this.pinNumb] = + ++this.pinNumb + this.pin = [...this.pin] + } + this.log('mainInputPin pin: ' + this.pin + '-' + this.pin.join('')) + if (this.pinNumb == 6) { + // input end + this.log('mainInputPin end: ' + this.pin + '-' + this.pin.join('')) + this.verifyAuthInfo(this.pin.join('')) + router.back() + } + this.log("mainInputPin") + }, + + /** + * Keyboard delete number + */ + mainInputPinBack() { + if (this.pinNumb > 0) { + --this.pinNumb + this.pin[this.pinNumb] = '' + this.pin = [...this.pin] + } + this.log("mainInputPinBack") + }, + + /** + * Cancel pinCode input + */ + mainInputPinCancel() { + this.setUserOperation(4) + router.back() + this.log("mainInputPinCancel") + }, + + /** + * Main end wifiInfo input Page display + */ + mainWifi() { + this.status = 'main-wifi' + this.log(" this.status = 'main-wifi'") + }, + + /** + * Join end presents wifi configure result + */ + joinWifi() { + this.status = 'join-wifi' + this.log(" this.status = 'join-wifi'") + }, + + /** + * Cancel current operation + */ + mainWifiCancel() { + this.log(' mainWifiCancel') + this.setUserOperation(USER_WIFI_CANCEL_CODE) + router.back() + }, + + /** + * main end wifi ssid and pwd confirm + */ + mainWifiConfirm() { + this.log(' mainWifiConfirm') + dmClass.configureWifiInfo(this.wifiInfo, (err, data) => { + this.log('configureWifiInfo callback err = ' + err) + this.log('mainWifiConfirm + wifiSsid = ' + this.wifiInfo.wifiSsid) + }) + router.back(); + }, + + /** + * Cancel result dialog + */ + joinWifiCancel() { + this.log("joinWifiCancel") + router.back() + }, + + /** + * Join end authorization, business(FA流转)/1(资源访问): 0 + */ + joinAuthorize() { + this.status = 'join-authorize' + this.timing(60, 'join-authorize', () => { + this.setUserOperation(2) + router.back() + }) + }, + + /** + * Join end authorization, business(FA流转)/1(资源访问): 1 + */ + joinAuth() { + this.log("joinAuth") + this.status = 'join-auth' + this.timing(60, 'join-auth', () => { + this.setUserOperation(2) + router.back() + }) + }, + + /** + * Join end authorization, business(FA流转)/1(资源访问): 1, show application icon + */ + joinAuthImage() { + this.log("joinAuthImage") + this.status = 'join-auth-image' + this.timing(60, 'join-auth-image', () => { + this.setUserOperation(2) + router.back() + }) + }, + + /** + * Display pinCode at join end + */ + joinPin() { + this.status = 'join-pin' + }, + + /** + * Cancel authorization + */ + joinAuthorizeCancel() { + this.setUserOperation(1) + router.back() + }, + + /** + * Confirm authorization + */ + joinAuthorizeOk() { + this.setUserOperation(0) + this.joinPin() + }, + + /** + * Cancel authorization + */ + joinAuthCancel() { + this.setUserOperation(1) + router.back() + }, + + /** + * Confirm authorization + */ + joinAuthOk() { + this.setUserOperation(0) + this.joinPin() + }, + + /** + * Cancel authorization + */ + joinAuthImageCancel() { + this.setUserOperation(1) + router.back() + }, + + /** + * Confirm authorization + */ + joinAuthImageOk() { + this.setUserOperation(0) + this.joinPin() + }, + + /** + * Cancel authorization + */ + joinPinCancel() { + this.setUserOperation(3) + router.back() + }, + + /** + * Pure function countdown + * @param numb second + * @param status + * @param callback + * @return + */ + timing(numb, status, callback) { + this.log("timing") + this.timeRemaining = numb + const next = () => { + if (status != this.status) return + --this.timeRemaining + if (this.timeRemaining > 0) { + setTimeout(next, 1000) + } else { + callback() + } + } + next() + }, + + /** + * Change keyboard focus in wifi page + * @param currentArea - area that user clicked + */ + changeFocus(currentArea) { + this.log("changeFocus" ) + if (currentArea == CURRENT_FOCUS_SSID) { + this.isSSidFocus = true + this.currentSsidColor = ACTIVE_COLOR + + this.isKeyFocus = false + this.currentKeyColor = INACTIVE_COLOR + } + if (currentArea == CURRENT_FOCUS_KEY) { + this.isSSidFocus = false + this.currentSsidColor = INACTIVE_COLOR + + this.isKeyFocus = true + this.currentKeyColor = ACTIVE_COLOR + } + }, + + /** + * Change input case to upper case or lower case + */ + changeCase() { + this.log("changeCase" ) + if (this.keyboardItem == LOWER_CASE_KEYS) { + this.keyboardItem = UPPER_CASE_KEYS; + } else { + this.keyboardItem = LOWER_CASE_KEYS; + } + }, + + /** + * Add char to the selected input area + * @param itemChar - the char in the button that user clicked + */ + inputChar(itemChar) { + this.log("inputChar :"+itemChar) + if (this.isSSidFocus == true) { + this.ssidString = this.ssidString + itemChar + } + if (this.isKeyFocus == true) { + this.keyString = this.keyString + itemChar + } + }, + + /** + * Remove the first char of the selected input area + */ + deleteChar() { + this.log("deleteChar") + if (this.isSSidFocus == true && this.ssidString.length > 0) { + this.ssidString = this.ssidString.substring(0, this.ssidString.length - 1) + } + if (this.isKeyFocus == true && this.keyString.length > 0) { + this.keyString = this.keyString.substring(0, this.keyString.length - 1) + } + }, +} diff --git a/display/entry/src/main/resources/base/element/string.json b/display/entry/src/main/resources/base/element/string.json index 0bae6bd40..a1f1955bd 100644 --- a/display/entry/src/main/resources/base/element/string.json +++ b/display/entry/src/main/resources/base/element/string.json @@ -2,10 +2,10 @@ "string": [ { "name": "entry_MainAbility", - "value": "entry_MainAbility" + "value": "DeviceManagerUI" }, { - "name": "mainability_description", + "name": "description_mainability", "value": "JS_Empty Ability" } ] -- Gitee From fbe176207e06d4614a3f76c2fedcceca5af9ca78 Mon Sep 17 00:00:00 2001 From: wuqi0105 Date: Thu, 19 May 2022 14:39:42 +0800 Subject: [PATCH 06/32] =?UTF-8?q?wukong=20=E6=B5=8B=E8=AF=95js=20crash?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuqi0105 --- display/entry/src/main/js/MainAbility/app.js | 14 ++++++++++++++ .../src/main/js/MainAbility/pages/index/index.js | 12 ++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/display/entry/src/main/js/MainAbility/app.js b/display/entry/src/main/js/MainAbility/app.js index 6d060ffe5..4aa26e97d 100644 --- a/display/entry/src/main/js/MainAbility/app.js +++ b/display/entry/src/main/js/MainAbility/app.js @@ -1,3 +1,17 @@ +/* + * 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. + */ export default { onCreate() { console.info("Application onCreate"); diff --git a/display/entry/src/main/js/MainAbility/pages/index/index.js b/display/entry/src/main/js/MainAbility/pages/index/index.js index 88772dcd8..c10c5475c 100644 --- a/display/entry/src/main/js/MainAbility/pages/index/index.js +++ b/display/entry/src/main/js/MainAbility/pages/index/index.js @@ -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 @@ -17,11 +17,14 @@ import router from '@system.router'; import deviceManager from '@ohos.distributedHardware.deviceManager'; function uint8ArrayToBase64(array) { array = new Uint8Array(array); - let table = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'], + let table = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' + ,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2' + ,'3','4','5','6','7','8','9','+','/'], base64Str = '', length = array.byteLength, i = 0; for(i = 0; length - i >= 3; i += 3) { let num1 = array[i], num2 = array[i + 1], num3 = array[i + 2]; - base64Str += table[num1 >>> 2] + table[((num1 & 0b11) << 4) | (num2 >>> 4)] + table[((num2 & 0b1111) << 2) | (num3 >>> 6)] + table[num3 & 0b111111]; + base64Str += table[num1 >>> 2] + table[((num1 & 0b11) << 4) | (num2 >>> 4)] + table[((num2 & 0b1111) << 2) | + (num3 >>> 6)] + table[num3 & 0b111111]; } const lastByte = length - i; if(lastByte === 1) { @@ -30,7 +33,8 @@ function uint8ArrayToBase64(array) { } else if(lastByte === 2){ const lastNum1 = array[i]; const lastNum2 = array[i + 1]; - base64Str += table[lastNum1 >>> 2] + table[((lastNum1 & 0b11) << 4) | (lastNum2 >>> 4)] + table[(lastNum2 & 0b1111) << 2] + '='; + base64Str += table[lastNum1 >>> 2] + table[((lastNum1 & 0b11) << 4) | (lastNum2 >>> 4)] + table[(lastNum2 & + 0b1111) << 2] + '='; } return 'data:image/png;base64,' + base64Str; } -- Gitee From a739943d9e40e13be32d797ff85947381efef57f Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 20 May 2022 10:21:21 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E6=A3=80=E8=A7=86=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Signed-off-by:=20wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kits/js/include/native_devicemanager_js.h | 4 +- .../kits/js/src/native_devicemanager_js.cpp | 4 +- utils/BUILD.gn | 12 +- .../errormessage.h => dm_error_message.h} | 23 +--- utils/src/dm_error_message.cpp | 71 ++++++++++ utils/src/errormessage/errormessage.cpp | 126 ------------------ 6 files changed, 81 insertions(+), 159 deletions(-) rename utils/include/{errormessage/errormessage.h => dm_error_message.h} (62%) create mode 100644 utils/src/dm_error_message.cpp delete mode 100644 utils/src/errormessage/errormessage.cpp diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h index 6b0883f89..3efde1463 100644 --- a/interfaces/kits/js/include/native_devicemanager_js.h +++ b/interfaces/kits/js/include/native_devicemanager_js.h @@ -25,7 +25,7 @@ #include "dm_native_event.h" #include "dm_subscribe_info.h" #include "dm_anonymous.h" -#include "errormessage/errormessage.h" +#include "dm_error_message.h" #include "napi/native_api.h" #include "napi/native_node_api.h" #include "nlohmann/json.hpp" @@ -312,7 +312,5 @@ private: std::string bundleName_; static AuthAsyncCallbackInfo authAsyncCallbackInfo_; static AuthAsyncCallbackInfo verifyAsyncCallbackInfo_; - std::shared_ptr errorMessage_ = - std::make_shared(); }; #endif // OHOS_DM_NATIVE_DEVICEMANAGER_JS_H diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index b4cb83bc2..05042785b 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -489,7 +489,7 @@ void DeviceManagerNapi::OnDiscoveryFailed(uint16_t subscribeId, int32_t failedRe napi_create_object(env_, &result); SetValueInt32(env_, "subscribeId", (int)subscribeId, result); SetValueInt32(env_, "reason", (int)failedReason, result); - std::string errCodeInfo = errorMessage_->GetErrorString((int)failedReason); + std::string errCodeInfo = OHOS::DistributedHardware::GetErrorString((int)failedReason); SetValueUtf8String(env_, "errInfo", errCodeInfo, result); OnEvent("discoverFail", DM_NAPI_ARGS_ONE, &result); } @@ -512,7 +512,7 @@ void DeviceManagerNapi::OnAuthResult(const std::string &deviceId, const std::str napi_create_object(env_, &result[0]); SetValueInt32(env_, "code", status, result[0]); SetValueInt32(env_, "reason", reason, result[0]); - std::string errCodeInfo = errorMessage_->GetErrorString((int)reason); + std::string errCodeInfo = OHOS::DistributedHardware::GetErrorString((int)reason); SetValueUtf8String(env_, "errInfo", errCodeInfo, result[0]); napi_get_undefined(env_, &result[1]); } diff --git a/utils/BUILD.gn b/utils/BUILD.gn index bf4fb711d..a938e8ff1 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -37,14 +37,14 @@ if (defined(ohos_lite)) { "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", "//third_party/bounds_checking_function/include", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", - "//utils/include/errormessage", + "//utils/include/dm_error_message", ] sources = [ "${utils_path}/src/dm_anonymous.cpp", + "${utils_path}/src/dm_error_message.cpp", "${utils_path}/src/dm_log.cpp", "${utils_path}/src/dm_random.cpp", - "${utils_path}/src/errormessage/errormessage.cpp", "${utils_path}/src/permission/lite/permission_manager.cpp", ] @@ -90,13 +90,13 @@ if (defined(ohos_lite)) { "//foundation/communication/dsoftbus/interfaces/kits/transport", "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", - "//utils/include/errormessage", + "//utils/include/dm_error_message", ] sources = [ "src/dm_anonymous.cpp", + "src/dm_error_message.cpp", "src/dm_log.cpp", "src/dm_random.cpp", - "src/errormessage/errormessage.cpp", "src/fwkload/lite/dm_distributed_hardware_load.cpp", "src/ipc/lite/ipc_cmd_register.cpp", "src/permission/lite/permission_manager.cpp", @@ -129,17 +129,17 @@ if (defined(ohos_lite)) { "${common_path}/include/ipc/model", "include/permission/standard", "//third_party/mbedtls/include/mbedtls", - "//utils/include/errormessage", + "//utils/include/dm_error_message", ] } ohos_shared_library("devicemanagerutils") { sources = [ "src/dm_anonymous.cpp", + "src/dm_error_message.cpp", "src/dm_hash.cpp", "src/dm_log.cpp", "src/dm_random.cpp", - "src/errormessage/errormessage.cpp", "src/ipc/standard/ipc_cmd_register.cpp", ] if (support_jsapi) { diff --git a/utils/include/errormessage/errormessage.h b/utils/include/dm_error_message.h similarity index 62% rename from utils/include/errormessage/errormessage.h rename to utils/include/dm_error_message.h index 867749589..52e22059e 100644 --- a/utils/include/errormessage/errormessage.h +++ b/utils/include/dm_error_message.h @@ -16,34 +16,13 @@ #ifndef OHOS_DM_ERROMSG_H #define OHOS_DM_ERROMSG_H -#include #include #include "dm_log.h" #include "dm_constants.h" namespace OHOS { namespace DistributedHardware { -class ErrorMessage { -public: - /** - * @tc.name: ErrorMessage::ErrorMessage - * @tc.desc: Dm Error Message Info Constructor. - * @tc.type: FUNC - */ - ErrorMessage(); - /** - * @tc.name: ErrorMessage::~ErrorMessage - * @tc.desc: Dm Error Message Info destructor. - * @tc.type: FUNC - */ - virtual ~ErrorMessage(); - /** - * @tc.name: ErrorMessage::GetErrorString - * @tc.desc: Get Error String. - * @tc.type: FUNC - */ - std::string GetErrorString(int); -}; +std::string GetErrorString(int failedReason); } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_ERROMSG_H diff --git a/utils/src/dm_error_message.cpp b/utils/src/dm_error_message.cpp new file mode 100644 index 000000000..d9e244718 --- /dev/null +++ b/utils/src/dm_error_message.cpp @@ -0,0 +1,71 @@ +/* + * 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 "dm_error_message.h" + +namespace OHOS { +namespace DistributedHardware { +typedef struct ERROR_INFO +{ + int errCode; + std::string errMsg; +}ERROR_INFO; + +static ERROR_INFO g_errorMessages[] = +{ + {ERR_DM_FAILED, DM_FAILED_INFO}, + {ERR_DM_TIME_OUT, DM_TIME_OUT_INFO}, + {ERR_DM_NOT_INIT, DM_NOT_INIT_INFO}, + {ERR_DM_INIT_REPEATED, DM_INIT_REPEATED_INFO}, + {ERR_DM_INIT_FAILED, DM_INIT_FAILED_INFO}, + {ERR_DM_UNINIT_FAILED, DM_UNINIT_FAILED_INFO}, + {ERR_DM_POINT_NULL, DM_POINT_NULL_INFO}, + {ERR_DM_INPUT_PARAMETER_EMPTY, DM_INPUT_PARAMETER_EMPTY_INFO}, + {ERR_DM_NO_PERMISSION, DM_NO_PERMISSION_INFO}, + {ERR_DM_MALLOC_FAILED, DM_MALLOC_FAILED_INFO}, + {ERR_DM_DISCOVERY_FAILED, DM_DISCOVERY_FAILED_INFO}, + {ERR_DM_MAP_KEY_ALREADY_EXISTS, DM_MAP_KEY_ALREADY_EXISTS_INFO}, + {DM_PROFILE_EVENTS_FAILED, DM_PROFILE_EVENTS_FAILED_INFO}, + {ERR_DM_IPC_WRITE_FAILED, DM_IPC_WRITE_FAILED_INFO}, + {ERR_DM_IPC_COPY_FAILED, DM_IPC_COPY_FAILED_INFO}, + {ERR_DM_IPC_SEND_REQUEST_FAILED, DM_IPC_SEND_REQUEST_FAILED_INFO}, + {ERR_DM_UNSUPPORTED_IPC_COMMAND, DM_UNSUPPORTED_IPC_COMMAND_INFO}, + {ERR_DM_IPC_RESPOND_FAILED, DM_IPC_RESPOND_FAILED_INFO}, + {ERR_DM_IPC_WRITE_TOKEN_FAILED, DM_IPC_WRITE_TOKEN_INFO}, + {ERR_DM_DISCOVERY_REPEATED, DM_DISCOVERY_REPEATED_INFO}, + {ERR_DM_UNSUPPORTED_AUTH_TYPE, DM_UNSUPPORTED_AUTH_TYPE_INFO}, + {ERR_DM_AUTH_BUSINESS_BUSY, DM_AUTH_BUSINESS_BUSY_INFO}, + {ERR_DM_AUTH_OPEN_SESSION_FAILED, DM_AUTH_OPEN_SESSION_FAILED_INFO}, + {ERR_DM_AUTH_PEER_REJECT, DM_AUTH_PEER_REJECT_INFO}, + {ERR_DM_AUTH_REJECT, DM_AUTH_REJECT_INFO}, + {ERR_DM_AUTH_FAILED, DM_AUTH_FAILED_INFO}, + {ERR_DM_AUTH_NOT_START, DM_AUTH_NOT_START_INFO}, + {ERR_DM_AUTH_MESSAGE_INCOMPLETE, DM_AUTH_MESSAGE_INCOMPLETE_INFO}, + {ERR_DM_CREATE_GROUP_FAILED, DM_CREATE_GROUP_FAILED_INFO}, +}; + +std::string GetErrorString(int failedReason) +{ + std::string g_errorMessage = "dm process execution failed."; + for (int i =0; i Date: Fri, 20 May 2022 11:12:09 +0800 Subject: [PATCH 08/32] =?UTF-8?q?codecheck=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- utils/include/dm_error_message.h | 3 ++- utils/src/dm_error_message.cpp | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/utils/include/dm_error_message.h b/utils/include/dm_error_message.h index 52e22059e..ba5dfe8ef 100644 --- a/utils/include/dm_error_message.h +++ b/utils/include/dm_error_message.h @@ -16,10 +16,11 @@ #ifndef OHOS_DM_ERROMSG_H #define OHOS_DM_ERROMSG_H -#include #include "dm_log.h" #include "dm_constants.h" +#include + namespace OHOS { namespace DistributedHardware { std::string GetErrorString(int failedReason); diff --git a/utils/src/dm_error_message.cpp b/utils/src/dm_error_message.cpp index d9e244718..3f82bf288 100644 --- a/utils/src/dm_error_message.cpp +++ b/utils/src/dm_error_message.cpp @@ -17,14 +17,12 @@ namespace OHOS { namespace DistributedHardware { -typedef struct ERROR_INFO -{ +typedef struct ERROR_INFO { int errCode; std::string errMsg; -}ERROR_INFO; +} ERROR_INFO; -static ERROR_INFO g_errorMessages[] = -{ +static ERROR_INFO g_errorMessages[] = { {ERR_DM_FAILED, DM_FAILED_INFO}, {ERR_DM_TIME_OUT, DM_TIME_OUT_INFO}, {ERR_DM_NOT_INIT, DM_NOT_INIT_INFO}, @@ -59,9 +57,8 @@ static ERROR_INFO g_errorMessages[] = std::string GetErrorString(int failedReason) { std::string g_errorMessage = "dm process execution failed."; - for (int i =0; i Date: Fri, 20 May 2022 11:16:59 +0800 Subject: [PATCH 09/32] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20Signed-off-by:=20wangyb0625=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/include/dm_constants.h | 1 - 1 file changed, 1 deletion(-) diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 1a303db25..6651e13fd 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -230,7 +230,6 @@ const std::string DM_AUTH_FAILED_INFO = "authentication failed."; const std::string DM_AUTH_NOT_START_INFO = "auth process not started."; const std::string DM_AUTH_MESSAGE_INCOMPLETE_INFO = "authentication message is incomplete."; const std::string DM_CREATE_GROUP_FAILED_INFO = "create group failed."; -const std::string DM_ERROR_CODE_DEFAULT_INFO = "error code undefined."; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_CONSTANTS_H -- Gitee From 181c2681af36e031286d220c4ef1de83bfd7cdf2 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 20 May 2022 11:42:05 +0800 Subject: [PATCH 10/32] codecheck Signed-off-by: wangyb0625 --- .../kits/js/src/native_devicemanager_js.cpp | 104 ++++++++---------- 1 file changed, 43 insertions(+), 61 deletions(-) diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index f057d9cf6..a4d00bdad 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -93,15 +93,13 @@ void DmNapiInitCallback::OnRemoteDied() return; } deviceManagerNapi->OnEvent("serviceDie", 0, nullptr); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnRemoteDied work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -129,15 +127,13 @@ void DmNapiDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo &deviceInfo) return; } deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::ONLINE, callback->deviceInfo_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDeviceOnline work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -165,15 +161,13 @@ void DmNapiDeviceStateCallback::OnDeviceReady(const DmDeviceInfo &deviceInfo) return; } deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::READY, callback->deviceInfo_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDeviceReady work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -201,15 +195,13 @@ void DmNapiDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo &deviceInfo) return; } deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::OFFLINE, callback->deviceInfo_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDeviceOffline work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -227,7 +219,9 @@ void DmNapiDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo &deviceInfo) } jsCallback_ = std::make_unique(bundleName_, 0, 0, deviceInfo); - work->data = reinterpret_cast(jsCallback_.get()); + if (work != nullptr) { + work->data = reinterpret_cast(jsCallback_.get()); + } int ret = uv_queue_work(loop, work, [] (uv_work_t *work) {}, [] (uv_work_t *work, int status) { DmNapiStateJsCallback *callback = reinterpret_cast(work->data); @@ -237,15 +231,13 @@ void DmNapiDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo &deviceInfo) return; } deviceManagerNapi->OnDeviceStateChange(DmNapiDevStateChangeAction::CHANGE, callback->deviceInfo_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDeviceChanged work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -275,15 +267,13 @@ void DmNapiDiscoveryCallback::OnDeviceFound(uint16_t subscribeId, const DmDevice return; } deviceManagerNapi->OnDeviceFound(callback->subscribeId_, callback->deviceInfo_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDeviceFound work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -314,15 +304,13 @@ void DmNapiDiscoveryCallback::OnDiscoveryFailed(uint16_t subscribeId, int32_t fa return; } deviceManagerNapi->OnDiscoveryFailed(callback->subscribeId_, callback->reason_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnDiscoveryFailed work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -376,15 +364,13 @@ void DmNapiAuthenticateCallback::OnAuthResult(const std::string &deviceId, const return; } deviceManagerNapi->OnAuthResult(callback->deviceId_, callback->token_, callback->status_, callback->reason_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnAuthResult work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -412,15 +398,13 @@ void DmNapiVerifyAuthCallback::OnVerifyAuthResult(const std::string &deviceId, i return; } deviceManagerNapi->OnVerifyResult(callback->deviceId_, callback->resultCode_, callback->flag_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnVerifyAuthResult work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } @@ -1152,15 +1136,13 @@ void DmNapiDeviceManagerFaCallback::OnCall(const std::string ¶mJson) return; } deviceManagerNapi->OnDmfaCall(callback->token_); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; }); if (ret != 0) { LOGE("Failed to execute OnCall work queue"); - if (work != nullptr) { - delete work; - } + delete work; + work = nullptr; } } -- Gitee From d5a2cb81f77b90c810f3a02c0834e22a55ca3f73 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 20 May 2022 11:57:32 +0800 Subject: [PATCH 11/32] codex Signed-off-by: wangyb0625 --- utils/src/dm_error_message.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/src/dm_error_message.cpp b/utils/src/dm_error_message.cpp index 3f82bf288..a5a516af7 100644 --- a/utils/src/dm_error_message.cpp +++ b/utils/src/dm_error_message.cpp @@ -58,7 +58,7 @@ std::string GetErrorString(int failedReason) { std::string g_errorMessage = "dm process execution failed."; for (int32_t i = 0; i < sizeof(g_errorMessages); i++) { - if(failedReason == g_errorMessages[i].errCode){ + if (failedReason == g_errorMessages[i].errCode) { g_errorMessage = g_errorMessages[i].errMsg; } } -- Gitee From a163e467d52adc05e65ff05261b2f17aa478cc07 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Fri, 20 May 2022 19:09:23 +0800 Subject: [PATCH 12/32] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyb0625 --- common/include/dm_constants.h | 31 ---------------- utils/BUILD.gn | 1 - utils/src/dm_error_message.cpp | 65 +++++++++++++++++----------------- 3 files changed, 33 insertions(+), 64 deletions(-) diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 6651e13fd..4ff3d02b3 100755 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -199,37 +199,6 @@ const int32_t MAX_EVENT_NUMBER = 10; const int32_t EXPAND_TWICE = 2; const int32_t SEC_TO_MM = 1000; const int32_t MAX_EVENTS = 5; - -// error code info -const std::string DM_FAILED_INFO = "dm process execution failed."; -const std::string DM_TIME_OUT_INFO = "dm process execution timeout."; -const std::string DM_NOT_INIT_INFO = "dm service is not initialized, please try again later."; -const std::string DM_INIT_REPEATED_INFO = "dm service repeated initialization."; -const std::string DM_INIT_FAILED_INFO = "dm service initialize failed."; -const std::string DM_UNINIT_FAILED_INFO = "dm Service uninitialization failed."; -const std::string DM_POINT_NULL_INFO = "dm service null pointer exception occurred."; -const std::string DM_INPUT_PARAMETER_EMPTY_INFO = "the function call input parameter is empty."; -const std::string DM_NO_PERMISSION_INFO = "no permission for function call."; -const std::string DM_MALLOC_FAILED_INFO = "memory allocation failed."; -const std::string DM_DISCOVERY_FAILED_INFO = "device discovery failed."; -const std::string DM_MAP_KEY_ALREADY_EXISTS_INFO = "map key already exists."; -const std::string DM_PROFILE_EVENTS_FAILED_INFO = "process profile events failed."; -const std::string DM_IPC_WRITE_FAILED_INFO = "ipc write object failed."; -const std::string DM_IPC_COPY_FAILED_INFO = "ipc copy data failed."; -const std::string DM_IPC_SEND_REQUEST_FAILED_INFO = "ipc send request failed."; -const std::string DM_UNSUPPORTED_IPC_COMMAND_INFO = "ipc command not supported."; -const std::string DM_IPC_RESPOND_FAILED_INFO = "ipc process failed to receive response."; -const std::string DM_IPC_WRITE_TOKEN_INFO = "ipc write token failed."; -const std::string DM_DISCOVERY_REPEATED_INFO = "repeat device discovery warning."; -const std::string DM_UNSUPPORTED_AUTH_TYPE_INFO = "auth type not supported."; -const std::string DM_AUTH_BUSINESS_BUSY_INFO = "authentication service is busy."; -const std::string DM_AUTH_OPEN_SESSION_FAILED_INFO = "open auth session failed."; -const std::string DM_AUTH_PEER_REJECT_INFO = "remote device refused to authorization."; -const std::string DM_AUTH_REJECT_INFO = "local device refused to authorization."; -const std::string DM_AUTH_FAILED_INFO = "authentication failed."; -const std::string DM_AUTH_NOT_START_INFO = "auth process not started."; -const std::string DM_AUTH_MESSAGE_INCOMPLETE_INFO = "authentication message is incomplete."; -const std::string DM_CREATE_GROUP_FAILED_INFO = "create group failed."; } // namespace DistributedHardware } // namespace OHOS #endif // OHOS_DM_CONSTANTS_H diff --git a/utils/BUILD.gn b/utils/BUILD.gn index a938e8ff1..fe0ae5018 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -90,7 +90,6 @@ if (defined(ohos_lite)) { "//foundation/communication/dsoftbus/interfaces/kits/transport", "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", - "//utils/include/dm_error_message", ] sources = [ "src/dm_anonymous.cpp", diff --git a/utils/src/dm_error_message.cpp b/utils/src/dm_error_message.cpp index a5a516af7..17c2d474b 100644 --- a/utils/src/dm_error_message.cpp +++ b/utils/src/dm_error_message.cpp @@ -23,46 +23,47 @@ typedef struct ERROR_INFO { } ERROR_INFO; static ERROR_INFO g_errorMessages[] = { - {ERR_DM_FAILED, DM_FAILED_INFO}, - {ERR_DM_TIME_OUT, DM_TIME_OUT_INFO}, - {ERR_DM_NOT_INIT, DM_NOT_INIT_INFO}, - {ERR_DM_INIT_REPEATED, DM_INIT_REPEATED_INFO}, - {ERR_DM_INIT_FAILED, DM_INIT_FAILED_INFO}, - {ERR_DM_UNINIT_FAILED, DM_UNINIT_FAILED_INFO}, - {ERR_DM_POINT_NULL, DM_POINT_NULL_INFO}, - {ERR_DM_INPUT_PARAMETER_EMPTY, DM_INPUT_PARAMETER_EMPTY_INFO}, - {ERR_DM_NO_PERMISSION, DM_NO_PERMISSION_INFO}, - {ERR_DM_MALLOC_FAILED, DM_MALLOC_FAILED_INFO}, - {ERR_DM_DISCOVERY_FAILED, DM_DISCOVERY_FAILED_INFO}, - {ERR_DM_MAP_KEY_ALREADY_EXISTS, DM_MAP_KEY_ALREADY_EXISTS_INFO}, - {DM_PROFILE_EVENTS_FAILED, DM_PROFILE_EVENTS_FAILED_INFO}, - {ERR_DM_IPC_WRITE_FAILED, DM_IPC_WRITE_FAILED_INFO}, - {ERR_DM_IPC_COPY_FAILED, DM_IPC_COPY_FAILED_INFO}, - {ERR_DM_IPC_SEND_REQUEST_FAILED, DM_IPC_SEND_REQUEST_FAILED_INFO}, - {ERR_DM_UNSUPPORTED_IPC_COMMAND, DM_UNSUPPORTED_IPC_COMMAND_INFO}, - {ERR_DM_IPC_RESPOND_FAILED, DM_IPC_RESPOND_FAILED_INFO}, - {ERR_DM_IPC_WRITE_TOKEN_FAILED, DM_IPC_WRITE_TOKEN_INFO}, - {ERR_DM_DISCOVERY_REPEATED, DM_DISCOVERY_REPEATED_INFO}, - {ERR_DM_UNSUPPORTED_AUTH_TYPE, DM_UNSUPPORTED_AUTH_TYPE_INFO}, - {ERR_DM_AUTH_BUSINESS_BUSY, DM_AUTH_BUSINESS_BUSY_INFO}, - {ERR_DM_AUTH_OPEN_SESSION_FAILED, DM_AUTH_OPEN_SESSION_FAILED_INFO}, - {ERR_DM_AUTH_PEER_REJECT, DM_AUTH_PEER_REJECT_INFO}, - {ERR_DM_AUTH_REJECT, DM_AUTH_REJECT_INFO}, - {ERR_DM_AUTH_FAILED, DM_AUTH_FAILED_INFO}, - {ERR_DM_AUTH_NOT_START, DM_AUTH_NOT_START_INFO}, - {ERR_DM_AUTH_MESSAGE_INCOMPLETE, DM_AUTH_MESSAGE_INCOMPLETE_INFO}, - {ERR_DM_CREATE_GROUP_FAILED, DM_CREATE_GROUP_FAILED_INFO}, + {ERR_DM_FAILED, "dm process execution failed."}, + {ERR_DM_TIME_OUT, "dm process execution timeout."}, + {ERR_DM_NOT_INIT, "dm service is not initialized, please try again later."}, + {ERR_DM_INIT_REPEATED, "dm service repeated initialization."}, + {ERR_DM_INIT_FAILED, "dm service initialize failed."}, + {ERR_DM_UNINIT_FAILED, "dm Service uninitialization failed."}, + {ERR_DM_POINT_NULL, "dm service null pointer exception occurred."}, + {ERR_DM_INPUT_PARAMETER_EMPTY, "the function call input parameter is empty."}, + {ERR_DM_NO_PERMISSION, "no permission for function call."}, + {ERR_DM_MALLOC_FAILED, "memory allocation failed."}, + {ERR_DM_DISCOVERY_FAILED, "device discovery failed."}, + {ERR_DM_MAP_KEY_ALREADY_EXISTS, "map key already exists."}, + {DM_PROFILE_EVENTS_FAILED, "process profile events failed."}, + {ERR_DM_IPC_WRITE_FAILED, "ipc write object failed."}, + {ERR_DM_IPC_COPY_FAILED, "ipc copy data failed."}, + {ERR_DM_IPC_SEND_REQUEST_FAILED, "ipc send request failed."}, + {ERR_DM_UNSUPPORTED_IPC_COMMAND, "ipc command not supported."}, + {ERR_DM_IPC_RESPOND_FAILED, "ipc process failed to receive response."}, + {ERR_DM_IPC_WRITE_TOKEN_FAILED, "ipc write token failed."}, + {ERR_DM_DISCOVERY_REPEATED, "repeat device discovery warning."}, + {ERR_DM_UNSUPPORTED_AUTH_TYPE, "auth type not supported."}, + {ERR_DM_AUTH_BUSINESS_BUSY, "authentication service is busy."}, + {ERR_DM_AUTH_OPEN_SESSION_FAILED, "open auth session failed."}, + {ERR_DM_AUTH_PEER_REJECT, "remote device refused to authorization."}, + {ERR_DM_AUTH_REJECT, "local device refused to authorization."}, + {ERR_DM_AUTH_FAILED, "authentication failed."}, + {ERR_DM_AUTH_NOT_START, "auth process not started."}, + {ERR_DM_AUTH_MESSAGE_INCOMPLETE, "authentication message is incomplete."}, + {ERR_DM_CREATE_GROUP_FAILED, "create group failed."}, }; std::string GetErrorString(int failedReason) { - std::string g_errorMessage = "dm process execution failed."; + std::string errorMessage = "dm process execution failed."; for (int32_t i = 0; i < sizeof(g_errorMessages); i++) { if (failedReason == g_errorMessages[i].errCode) { - g_errorMessage = g_errorMessages[i].errMsg; + errorMessage = g_errorMessages[i].errMsg; + break; } } - return g_errorMessage; + return errorMessage; } } // namespace DistributedHardware } // namespace OHOS -- Gitee From 442764c08e3fdb3565e7a5d5996255c1555d9fed Mon Sep 17 00:00:00 2001 From: wuqi0105 Date: Mon, 23 May 2022 09:10:04 +0800 Subject: [PATCH 13/32] =?UTF-8?q?wukong=20=E6=B5=8B=E8=AF=95js=20crash?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuqi0105 --- display/entry/src/main/js/MainAbility/i18n/zh-CN.json | 4 ++-- display/entry/src/main/js/MainAbility/pages/index/index.css | 2 +- display/entry/src/main/js/MainAbility/pages/index/index.hml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/display/entry/src/main/js/MainAbility/i18n/zh-CN.json b/display/entry/src/main/js/MainAbility/i18n/zh-CN.json index e972be210..254f9c12c 100644 --- a/display/entry/src/main/js/MainAbility/i18n/zh-CN.json +++ b/display/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -1,7 +1,7 @@ { "strings": { "pinCodeConnection": "PIN码连接", - "enterThePinCode": "请输入平板上显示的PIN码", + "enterThePinCode": "请输入PIN码", "delete": "删除", "off": "关闭", @@ -12,7 +12,7 @@ "parenthesesRight": ")", "allow": "允许", - "applyAuth": "是否允许打开apply auth?", + "applyAuth": "是否允许连接?", "from": "来自", "enterDisplayPinCode": "请在主控端输入连接码进行验证" diff --git a/display/entry/src/main/js/MainAbility/pages/index/index.css b/display/entry/src/main/js/MainAbility/pages/index/index.css index 295431f2a..56a0c2ee9 100644 --- a/display/entry/src/main/js/MainAbility/pages/index/index.css +++ b/display/entry/src/main/js/MainAbility/pages/index/index.css @@ -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/display/entry/src/main/js/MainAbility/pages/index/index.hml b/display/entry/src/main/js/MainAbility/pages/index/index.hml index bc2ba39f0..fc25d7c0a 100644 --- a/display/entry/src/main/js/MainAbility/pages/index/index.hml +++ b/display/entry/src/main/js/MainAbility/pages/index/index.hml @@ -1,6 +1,6 @@