已关闭
修复oobe放大手势下,焦点丢失的问题 #2124
Chanlung yeh创建于 2025年9月17日关闭于 2025年9月22日
修复oobe放大手势下,焦点丢失的问题 #2124
已关闭
从已删除 :master合入到openharmony/accessibilitymaster
共 4 个文件变更+27-1
| @@ -86,6 +86,7 @@ public: | |||
| 86 | bool CheckEvents(); | 86 | bool CheckEvents(); |
| 87 | 87 | ||
| 88 | std::map<int32_t, AccessibilityWindowInfo> a11yWindows_ {}; | 88 | std::map<int32_t, AccessibilityWindowInfo> a11yWindows_ {}; |
| 89 | + int32_t previousActiveWindowId = INVALID_WINDOW_ID; | ||
| 89 | int32_t activeWindowId_ = INVALID_WINDOW_ID; | 90 | int32_t activeWindowId_ = INVALID_WINDOW_ID; |
| 90 | int32_t a11yFocusedWindowId_ = INVALID_WINDOW_ID; | 91 | int32_t a11yFocusedWindowId_ = INVALID_WINDOW_ID; |
| 91 | std::set<int32_t> subWindows_ {}; // used for window id 1, scene board | 92 | std::set<int32_t> subWindows_ {}; // used for window id 1, scene board |
| @@ -946,6 +946,12 @@ void AccessibilityWindowManager::WindowUpdateAll(const std::vector<sptr<Rosen::A | |||
| 946 | std::lock_guard<ffrt::recursive_mutex> lock(interfaceMutex_); | 946 | std::lock_guard<ffrt::recursive_mutex> lock(interfaceMutex_); |
| 947 | auto oldA11yWindows_ = a11yWindows_; | 947 | auto oldA11yWindows_ = a11yWindows_; |
| 948 | HILOG_INFO("WindowUpdateAll start activeWindowId_: %{public}d", activeWindowId_); | 948 | HILOG_INFO("WindowUpdateAll start activeWindowId_: %{public}d", activeWindowId_); |
| 949 | + | ||
| 950 | + bool hasFocusedOrNonMagnificationWindow = false; | ||
| 951 | + if (activeWindowId_ != INVALID_WINDOW_ID) { | ||
| 952 | + previousActiveWindowId = activeWindowId_; | ||
| 953 | + } | ||
| 954 | + | ||
| 949 | WinDeInit(); | 955 | WinDeInit(); |
| 950 | for (auto &window : infos) { | 956 | for (auto &window : infos) { |
| 951 | if (window == nullptr) { | 957 | if (window == nullptr) { |
| @@ -966,7 +972,10 @@ void AccessibilityWindowManager::WindowUpdateAll(const std::vector<sptr<Rosen::A | |||
| 966 | } | 972 | } |
| 967 | 973 | ||
| 968 | // IsScenePanel for recent-task window | 974 | // IsScenePanel for recent-task window |
| 969 | - if (window->focused_ || IsScenePanel(window)) { | 975 | + if ((window->focused_ || IsScenePanel(window)) && |
| 976 | + ((window->type_ == Rosen::WindowType::WINDOW_TYPE_MAGNIFICATION || | ||
| 977 | + window->type_ == Rosen::WindowType::WINDOW_TYPE_MAGNIFICATION_MENU))) { | ||
| 978 | + hasFocusedOrNonMagnificationWindow = true; | ||
| 970 | SetActiveWindow(realWid); | 979 | SetActiveWindow(realWid); |
| 971 | } | 980 | } |
| 972 | 981 | ||
| @@ -976,6 +985,16 @@ void AccessibilityWindowManager::WindowUpdateAll(const std::vector<sptr<Rosen::A | |||
| 976 | for (auto it = oldA11yWindows_.begin(); it != oldA11yWindows_.end(); ++it) { | 985 | for (auto it = oldA11yWindows_.begin(); it != oldA11yWindows_.end(); ++it) { |
| 977 | WindowUpdateTypeEvent(it->first, oldA11yWindows_, WINDOW_UPDATE_REMOVED); | 986 | WindowUpdateTypeEvent(it->first, oldA11yWindows_, WINDOW_UPDATE_REMOVED); |
| 978 | } | 987 | } |
| 988 | + | ||
| 989 | + if (!hasFocusedOrNonMagnificationWindow) { | ||
| 990 | + if (oldA11yWindows_.count(previousActiveWindowId)) { | ||
| 991 | + auto previousActiveWindowInfo = oldA11yWindows_[previousActiveWindowId]; | ||
| 992 | + if (!a11yWindows_.count(previousActiveWindowId)) { | ||
| 993 | + a11yWindows_.emplace(previousActiveWindowId, previousActiveWindowInfo); | ||
| 994 | + } | ||
| 995 | + } | ||
| 996 | + SetActiveWindow(previousActiveWindowId); | ||
| 997 | + } | ||
| 979 | HILOG_INFO("WindowUpdateAll end activeWindowId_: %{public}d", activeWindowId_); | 998 | HILOG_INFO("WindowUpdateAll end activeWindowId_: %{public}d", activeWindowId_); |
| 980 | } | 999 | } |
| 981 | 1000 | ||
| @@ -79,6 +79,7 @@ public: | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | MOCK_METHOD0(GetCurrentAccountData, sptr<AccessibilityAccountData>()); | 81 | MOCK_METHOD0(GetCurrentAccountData, sptr<AccessibilityAccountData>()); |
| 82 | + MOCK_METHOD0(GetMagnificationState, bool()); | ||
| 82 | MOCK_METHOD1(AddedUser, void(int32_t accountId)); | 83 | MOCK_METHOD1(AddedUser, void(int32_t accountId)); |
| 83 | MOCK_METHOD1(RemovedUser, void(int32_t accountId)); | 84 | MOCK_METHOD1(RemovedUser, void(int32_t accountId)); |
| 84 | MOCK_METHOD1(SwitchedUser, void(int32_t accountId)); | 85 | MOCK_METHOD1(SwitchedUser, void(int32_t accountId)); |
| @@ -718,6 +718,11 @@ void AccessibleAbilityManagerService::SetMagnificationScale(float scale) | |||
| 718 | (void)scale; | 718 | (void)scale; |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | +bool AccessibleAbilityManagerService::GetMagnificationState() | ||
| 722 | +{ | ||
| 723 | + return true; | ||
| 724 | +} | ||
| 725 | + | ||
| 721 | std::shared_ptr<MagnificationManager> AccessibleAbilityManagerService::GetMagnificationMgr() | 726 | std::shared_ptr<MagnificationManager> AccessibleAbilityManagerService::GetMagnificationMgr() |
| 722 | { | 727 | { |
| 723 | return nullptr; | 728 | return nullptr; |