将以下代码加在
com.android.server.wm.WindowManagerService#doDump
if(args.length>=2 && args[0].equals("a3")){
for (WindowState win : mWindowMap.values()) {
if(win.mAttrs.packageName.equals(args[1])){
pw.println("andy0526 WindowState +1");
}
}
return ;
}
if(args.length>=2 && args[0].equals("a4")){
mRoot.getDefaultDisplay().forAllWindows(w->{
if(w.mAttrs.packageName.equals(args[1])){
pw.println("andy0526 forAllWindows WindowState +1");}
},true);
return ;
}
执行:
adb shell dumpsys window a3 com.abc.test01
adb shell dumpsys window a4 com.abc.test01