From 5f0eda51f1bcb4bffdbbe2b6c2fce0dbdd0c1c1f Mon Sep 17 00:00:00 2001 From: libo429 Date: Thu, 4 Sep 2025 20:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A3=80=E6=9F=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98&UT=E4=BF=AE=E6=94=B9=E5=9B=9E=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: libo429 --- services/service/src/device_manager_service.cpp | 2 +- test/commonunittest/UTTest_dm_auth_manager_first.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index 360c2f0de..7bfe6eae1 100644 --- a/services/service/src/device_manager_service.cpp +++ b/services/service/src/device_manager_service.cpp @@ -1117,7 +1117,7 @@ int32_t DeviceManagerService::SetUserOperation(std::string &pkgName, int32_t act } JsonObject paramJson; paramJson.Parse(params); - if (paramJson.IsDiscarded() || !IsString(paramJson, PARAM_KEY_META_TYPE)) { + if (paramJson.IsDiscarded() || !IsInt32(paramJson, PARAM_KEY_META_TYPE)) { LOGE("meta type not found"); return ERR_DM_INPUT_PARA_INVALID; } diff --git a/test/commonunittest/UTTest_dm_auth_manager_first.cpp b/test/commonunittest/UTTest_dm_auth_manager_first.cpp index deb454346..fe638b6fb 100644 --- a/test/commonunittest/UTTest_dm_auth_manager_first.cpp +++ b/test/commonunittest/UTTest_dm_auth_manager_first.cpp @@ -736,8 +736,10 @@ HWTEST_F(DmAuthManagerTest, OnUserOperation_005, testing::ext::TestSize.Level1) HWTEST_F(DmAuthManagerTest, OnUserOperation_006, testing::ext::TestSize.Level1) { int32_t action = 5; - std::string params = "5"; - int32_t ret = authManager_->OnUserOperation(action, params); + JsonObject param; + param[PIN_CODE_KEY] = "5"; + std::string paramStr = param.Dump(); + int32_t ret = authManager_->OnUserOperation(action, paramStr); ASSERT_EQ(ret, DM_OK); } -- Gitee