On android phone under settings -> developer options you have an option to "Show layout bounds". If you check this, you get to see every edge of every view element on your android phones default GUI. These are shown on a few applications also, like Instagram and Facebook. What i want to do is to understand the algorithm that my phone uses to detect these edges.
An example (with "Show layout bounds" - option checked):
edit: I want to get the layout bonds without activating the developer option. Suppose that the layout is unknown and i want to get it using a similar algorithm that my phone already uses.
edit 2: Activating "Show layout bounds" programmaticly requires the app to be a system app, which is not an option. Activating it manually and then run the program is not an option either. This is because i not only want to use the layout bonds, i also want understand the algorithm behind it.