解决后台任务主动聚焦失败问题

Signed-off-by: fanzexuan <fanzexuan@huawei.com>
This commit is contained in:
fanzexuan 2024-10-31 21:50:31 +08:00
parent f7d3ce90b7
commit e5f20a6b85
2 changed files with 9 additions and 1 deletions

View File

@ -56,6 +56,7 @@ public:
int64_t GetSceneBoardElementId(const int32_t windowId, const int64_t elementId);
int32_t GetRealWindowId(const sptr<Rosen::AccessibilityWindowInfo> windowInfo);
bool IsSceneBoard(const sptr<Rosen::AccessibilityWindowInfo> windowInfo);
bool IsScenePanel(const sptr<Rosen::AccessibilityWindowInfo> windowInfo);
// used for batch query, provide window and element id translation
void GetRealWindowAndElementId(int32_t& windowId, int64_t& elementId);

View File

@ -28,6 +28,7 @@ namespace OHOS {
namespace Accessibility {
namespace {
const std::string TIMER_GET_ACCESSIBILITY_WINDOWS = "accessibilty:getAccessibilityWindowInfo";
const std::string SCB_SCENE_PANEL = "SCBScenePanel";
constexpr int32_t WMS_TIMEOUT = 10; // s
}
@ -333,6 +334,11 @@ bool AccessibilityWindowManager::IsSceneBoard(const sptr<Rosen::AccessibilityWin
return false;
}
bool AccessibilityWindowManager::IsScenePanel(const sptr<Rosen::AccessibilityWindowInfo> windowInfo)
{
return windowInfo->bundleName_.find(SCB_SCENE_PANEL) != std::string::npos;
}
AccessibilityWindowInfo AccessibilityWindowManager::CreateAccessibilityWindowInfo(
const sptr<Rosen::AccessibilityWindowInfo> windowInfo)
{
@ -830,7 +836,8 @@ void AccessibilityWindowManager::WindowUpdateAll(const std::vector<sptr<Rosen::A
sceneBoardElementIdMap_.InsertPair(realWid, window->uiNodeId_);
}
if (window->focused_) {
// IsScenePanel for recent-task window
if (window->focused_ || IsScenePanel(window)) {
SetActiveWindow(realWid);
}