diff --git a/services/service/src/device_manager_service.cpp b/services/service/src/device_manager_service.cpp index 360c2f0de641a60e395e164a13484e29752c0e63..7bfe6eae19b402293096ce5437e810fa81055465 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 deb4543468eb529cb7906f86ccfcfe44a4497f54..fe638b6fb2214bd807ae8b3ce7531bb051eba368 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); }