Fix window manager logic

Instanceof check for dialogs requires checking the window is not an
inspector first as inspector is a subclass of dialog. Refactor this logic
into getWindowType and use that for customising functionality to
avoid this problem in the future.

Bug: T76076
Change-Id: Icad7c95794c7c1255314bf05b9339ed20f41afb3