I want to know how hierarchyViewer tool works in android. As all the android app runs in different processes, how can it know the layout of views. Who pushes the views and its properties to hierarchyViewer.
Which service of android push data to HierarchyViewer tool. Can someone please explain me this please?
It holds references to single piece of UI. See link above. Passing View view as argument in methods in most cases gives you opportunity to call method associated with this view. For example if you click on some elements, view is passed in listener so you can know which view was clicked and what attributes it have.
Android Device Monitor is a stand-alone tool that provides a graphical user interface for several Android application debugging and analysis tools. The Monitor tool does not require installation of an integrated development environment, such as Android Studio, and encapsulates the following tools: DDMS.
To inspect . trace files captured by instrumenting your app with the Debug class, record new method traces, export .
Lets first look at how adb is organized. It has 3 main components as described here -
For example when we issue a command like adb install example.apk
on shell.
It first invokes adb client on the machine and tells it wants to install example.apk.
Then server then sends the apk along with the command to the the adb daemon running on the device. The communication is done done by adb bridge communicating via TCP connection generally running at port 5554. Then adb daemon calls the System server to carry out the command.
Now lets have a look at the android device side of the story -
On every android device there is a server called as a System Server. You can find the status of this by issuing the command adb shell ps | grep system_server
. The System server is responsible for management of services. Some services run by the System Server are
The Window Manager has information like - Main Thread, Window manipulation, orientation, layering, input event management, focus etc. The information on your views is already available with the Windows Manager.
So now putting everything together the final flow for the hierarchy viewer is -
Hierarchy viewer creates adb client asking the information on viewswhen issued a command like REMOTE_COMMAND_CAPTURE_LAYERS
or COMMAND_WINDOW_MANAGER_LIST
.
The request reaches adb server which forwards it to the adbd on device running the application.
adbd forwards the request to the System Server who identifies the service to which the request has to be forwarded. Which in this case is Window Manger.
Window Manger then asks View Manager which is responsible for the managing of the thread pool for the main UI thread of application.
View Manager returns this information to the Window Manager.
Window Manager sends data back to adbd.
Adbd communicates it back to adb server.
adb server gives data back to hierarchy viewer.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With