官方解释:
To run Hierarchy Viewer, follow these steps:
- Connect your device or launch an emulator.
To preserve security, Hierarchy Viewer can only connect to devices running a developer version of the Android system.
但是发现一个问题,eng版本的机器居然也不行,开启不了Viewer Service;
这时候来分析这条开启Viewer Service的命令
adb shell service call window 1 i32 4939
可以看到IWindowManager.aidl中的代码:
interface IWindowManager
{
/***
* ===== NOTICE =====
* The first three methods must remain the first three methods. Scripts
* and tools rely on their transaction number to work properly.
*/
// This is used for debugging
boolean startViewServer(int port); // Transaction #1
boolean stopViewServer(); // Transaction #2
boolean isViewServerRunning(); // Transaction #3
看到这里面的Notice,我想应该就明白了那条命令的意思吧?
对于不清楚自己的window ?的,可通过一个shell脚本挨个试