Repository navigation
fix: Process Manager counts a Store app as the app it is, and a window Windows keeps hidden makes nothing an app - #2936
Merged
Conversation
…w Windows keeps hidden makes nothing an app - ProcessManagerService.MainWindowsOf decides each process's main window from the visible top-level windows that QueryMainWindowsByPid collects, now with their class, cloak flags and, for an ApplicationFrameWindow, the Windows.UI.Core.CoreWindow inside it. - A frame is credited to the process of the CoreWindow inside it, with that window as the one the hung check reads, and a frame with no app inside credits nothing, so ApplicationFrameHost is no longer an app. - A window cloaked by its own app, or inside a cloaked one, is skipped; one the shell cloaks, on another virtual desktop or a Store app's while it is not on screen, still counts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2869.
What I could see here, with a read-only walk of the top-level windows while Settings and Calculator were open but not on screen: each had an
ApplicationFrameWindowowned by ApplicationFrameHost with its title and noCoreWindowinside, and each app had a top-levelWindows.UI.Core.CoreWindowof its own, cloaked by the shell. So the old map credited both apps through those windows, and also credited ApplicationFrameHost through the first frame, which is how it came to be listed as an app. Windows cloaked by their own app passed too: explorer helper windows and a hidden tool window. With an app on screen itsCoreWindowsits inside the frame, which is the case the issue describes, where the frame was all there was to credit; I did not bring a window up on this PC to watch that, so the tests feed both shapes.The changes:
QueryMainWindowsByPidcollects each visible top-level window with its owner, class, DWM cloak flags (DwmGetWindowAttribute(DWMWA_CLOAKED)) and, for a frame, theCoreWindowinside it (FindWindowExW), and the newMainWindowsOfdecides.GetClassNameWandFindWindowExWbind their wide entry points;DwmGetWindowAttributehas no A/W pair.CoreWindowinside it, and that window is the one the hung check reads: the frame's process keeps answering when the app stops. A frame with nothing inside, or only a window of its own host, credits nothing, so ApplicationFrameHost is no longer an app.DWM_CLOAKED_APP) or inside a cloaked one (DWM_CLOAKED_INHERITED) is skipped. One the shell cloaks (DWM_CLOAKED_SHELL) still counts: a window on another virtual desktop, and a Store app's own window while it is not on screen, are both cloaked that way.Not changed: the touch keyboard's host, TextInputHost, has a top-level
CoreWindowthe shell cloaks, as a Store app's is while not on screen, so it still counts as an app. Telling the two apart needs more than the window shows.Docs
README, Process Manager: "Show only apps" counts a Store app as itself, and a hidden window does not make a program an app.
Tests
ProcessManagerServiceTests: a Store app's frame with the app's window inside makes the app an app, and the hung check reads that window, throughSnapshotAsync;MainWindowsOfcredits the frame to the app and not to its host, credits nothing for a frame with no app inside or with its own host's window, skips windows cloaked by their app or inside a cloaked one, keeps a window the shell cloaks, and takes the topmost unowned window over a dialog.ProcessManagerServiceTests,ProcessManagerViewModelTests,ProcessManagerSettledTabTests,ArchitectureTestsandInclusiveTermsTests(354), and the integrationProcessManagerKillTestsandFileLockKillTests(4). All four projects build with 0 warnings, anddotnet format --verify-no-changesis clean.