diff --git a/services/identity_checker/src/identity_checker_impl.cpp b/services/identity_checker/src/identity_checker_impl.cpp index 4eaa81fb042f6276e3def77b6e8114f31d4a98ca..c407dc989a01f5cbe0f1d5f06dc4d9c70ca188df 100644 --- a/services/identity_checker/src/identity_checker_impl.cpp +++ b/services/identity_checker/src/identity_checker_impl.cpp @@ -117,7 +117,7 @@ bool IdentityCheckerImpl::IsFocusedUIExtension(uint32_t callingTokenId, sptr(focusInfo.windowId_); } bool isFocused = false; diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 2a7b30ec2e62c3bee93a379fb665d7d425034630..237dab045dd7afef8a7a718b97af686fd7fd601f 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -2123,7 +2123,7 @@ ImfCallingWindowInfo PerUserSession::GetCallingWindowInfo(const InputClientInfo return finalWindowInfo; } if (finalWindowId == INVALID_WINDOW_ID) { - finalWindowId = focusInfo.windowId_; + finalWindowId = static_cast(focusInfo.windowId_); } return { finalWindowId, callingWindowInfo.displayId_ }; } diff --git a/test/fuzztest/imeenabledinfomanager_fuzzer/imeenabledinfomanager_fuzzer.cpp b/test/fuzztest/imeenabledinfomanager_fuzzer/imeenabledinfomanager_fuzzer.cpp index 9abace6a71d92d2c7ea32fca525f032df33bc22d..3558d4332ee7b87ac3eeb44c0ef02751a2364ad9 100644 --- a/test/fuzztest/imeenabledinfomanager_fuzzer/imeenabledinfomanager_fuzzer.cpp +++ b/test/fuzztest/imeenabledinfomanager_fuzzer/imeenabledinfomanager_fuzzer.cpp @@ -19,6 +19,7 @@ using namespace OHOS::MiscServices; namespace OHOS { +const int8_t EVEN_CHECK_NUMBER = 2; std::string GetString(const uint8_t *data, size_t size) { if (data == nullptr || size == 0) { @@ -122,7 +123,7 @@ void FuzzSetCurrentIme(const uint8_t *data, size_t size) auto userId = static_cast(size); auto fuzzedString = GetString(data, size); std::string imeId = fuzzedString; - if (size % 2 == 0) { + if (size % EVEN_NUMBER == 0) { imeId = fuzzedString + "/" + "ext"; } bool isSetByUser = false; @@ -137,7 +138,7 @@ void FuzzSetTmpIme(const uint8_t *data, size_t size) auto userId = static_cast(size); auto fuzzedString = GetString(data, size); std::string imeId = fuzzedString; - if (size % 2 == 0) { + if (size % EVEN_NUMBER == 0) { imeId = fuzzedString + "/" + "ext"; } ImeEnabledInfoManager::GetInstance().SetTmpIme(userId, imeId); diff --git a/test/fuzztest/inputmethodsystemability_fuzzer/inputmethodsystemability_fuzzer.cpp b/test/fuzztest/inputmethodsystemability_fuzzer/inputmethodsystemability_fuzzer.cpp index 0fa0496a9a9a2d42c3a7d0a22d8c3f3bd9fd68a5..ae56b0d91a54d3d8a85ba7dcd575801d9a3d8c4e 100644 --- a/test/fuzztest/inputmethodsystemability_fuzzer/inputmethodsystemability_fuzzer.cpp +++ b/test/fuzztest/inputmethodsystemability_fuzzer/inputmethodsystemability_fuzzer.cpp @@ -141,7 +141,8 @@ void FuzzHandleOperation(const uint8_t *data, size_t size) DelayedSingleton::GetInstance()->HandleWmsConnected(fuzzedInt32, fuzzedInt32); DelayedSingleton::GetInstance()->HandleScbStarted(fuzzedInt32, fuzzedInt32); DelayedSingleton::GetInstance()->HandleWmsDisconnected(fuzzedInt32, fuzzedInt32); - DelayedSingleton::GetInstance()->NeedHideWhenSwitchInputType(fuzzedInt32, inputType, fuzzedBool); + DelayedSingleton::GetInstance()->NeedHideWhenSwitchInputType(fuzzedInt32, inputType, + fuzzedBool); DelayedSingleton::GetInstance()->GetAlternativeIme(fuzzedInt32, fuzzedString); } } // namespace OHOS diff --git a/test/unittest/cpp_test/src/ime_proxy_test.cpp b/test/unittest/cpp_test/src/ime_proxy_test.cpp index c5b91f4c7b8fdf78c7d6d6cbe53a6cdcf1532fab..72cfb645bcdd6e9f1acb2afcb811da06bc5b8f04 100644 --- a/test/unittest/cpp_test/src/ime_proxy_test.cpp +++ b/test/unittest/cpp_test/src/ime_proxy_test.cpp @@ -668,5 +668,20 @@ HWTEST_F(ImeProxyTest, DiscardTypingTextTest, TestSize.Level0) auto ret = InputMethodAbility::GetInstance().OnDiscardTypingText(); EXPECT_EQ(ret, ErrorCode::NO_ERROR); } + +/** + * @tc.name: TestRegisterProxyIme + * @tc.desc: Test RegisterProxyIme + * @tc.type: FUNC + */ +HWTEST_F(ImeProxyTest, RegisterProxyImeTest, TestSize.Level0) +{ + IMSA_HILOGI("ImeProxyTest::TestRegisterProxyImeTest"); + uint64_t displayId = -1; + auto ret = InputMethodAbilityInterface::GetInstance().RegisterProxyIme(displayId); + EXPECT_NE(ret, ErrorCode::NO_ERROR); + ret = InputMethodAbilityInterface::GetInstance().UnregisterProxyIme(displayId); + EXPECT_NE(ret, ErrorCode::NO_ERROR); +} } // namespace MiscServices } // namespace OHOS diff --git a/test/unittest/cpp_test/src/window_adapter_test.cpp b/test/unittest/cpp_test/src/window_adapter_test.cpp index a3315abc2feeb2b63443d1d15dcf435ee8b22891..afb9f89bad2a9dff2e95bcf70533954c525d4fd1 100644 --- a/test/unittest/cpp_test/src/window_adapter_test.cpp +++ b/test/unittest/cpp_test/src/window_adapter_test.cpp @@ -72,5 +72,19 @@ HWTEST_F(WindowAdapterTest, WindowAdapter_GetFocusInfo, TestSize.Level0) WindowAdapter::GetInstance().GetFocusInfo(focusInfo); EXPECT_TRUE(focusInfo.displayId_ >= 0); } + +/** + * @tc.name: WindowAdapter_GetDisplayId + * @tc.desc: + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(WindowAdapterTest, WindowAdapter_GetDisplayId, TestSize.Level0) +{ + int64_t callingPid = -1000; + uint64_t displayId = 0; + auto ret = WindowAdapter::GetInstance().GetDisplayId(callingPid, displayId); + EXPECT_TRUE(ret); +} } // namespace MiscServices } // namespace OHOS