The function WindowInspector.getGlobalWindowViews() is publicly available as of SDK Q (v29).
WindowInspector.getGlobalWindowViews()