I need to obtain a list of top-level Windows from within the Android application for that given application. Is there are a way how to do it?
It is a very similar requirement to a former Hierarchy Viewer or newer Layout Inspector, BUT I have to do it from the app itself. I don't want to fetch that for other application, that should be impossible for security and privacy reasons as correctly commented below.
See screenshot of the list that has been obtained via Layout Inspector. That is exactly the list that I want to get.