360网站建设服务器,做电商网站搭建晋升,支付网站怎么做,不会编程可以做网站吗背景#xff1a;
近来在体验调试aosp15时候#xff0c;使用了dumpsys activity containers时候#xff0c;发现wms层级结构树有一个巨大的变化。 很多学员朋友对这个优化改进都给出巨大的点赞#xff0c;有的学员朋友还想老版本自己实现一下这种树绘制#xff1a;
对比…背景
近来在体验调试aosp15时候使用了dumpsys activity containers时候发现wms层级结构树有一个巨大的变化。 很多学员朋友对这个优化改进都给出巨大的点赞有的学员朋友还想老版本自己实现一下这种树绘制
对比安卓14老版本情况 明显可以看出以前的wms层级结构树看着不像一颗树靠的序号和空格在区分但是层级一多而且相差不多时候如果只相差一层空格就不明显了经常可能需要对半天才对的清楚。
aosp15和老版本的源码分析对比
aosp15代码
/*** Dumps the names of this container children in the input print writer indenting each* level with the input prefix.*/public void dumpChildrenNames(PrintWriter pw, String prefix, boolean isLastChild) {int curWinMode getWindowingMode();String winMode windowingModeToString(curWinMode);if (curWinMode ! WINDOWING_MODE_UNDEFINED curWinMode ! WINDOWING_MODE_FULLSCREEN) {winMode winMode.toUpperCase();}int requestedWinMode getRequestedOverrideWindowingMode();String overrideWinMode windowingModeToString(requestedWinMode);if (requestedWinMode ! WINDOWING_MODE_UNDEFINED requestedWinMode ! WINDOWING_MODE_FULLSCREEN) {overrideWinMode overrideWinMode.toUpperCase();}String actType activityTypeToString(getActivityType());if (getActivityType() ! ACTIVITY_TYPE_UNDEFINED getActivityType() ! ACTIVITY_TYPE_STANDARD) {actType actType.toUpperCase();}pw.print(prefix (isLastChild ? └─ : ├─ ));//isLastChild属于新参数绘制树枝的看看是不是最后一个childpw.println(getName() type actType mode winMode override-mode overrideWinMode requested-bounds getRequestedOverrideBounds().toShortString() bounds getBounds().toShortString());String childPrefix prefix (isLastChild ? : │ );//注意这个是给子节点的标签要么是空格要么是竖线for (int i getChildCount() - 1; i 0; --i) {final E cc getChildAt(i);cc.dumpChildrenNames(pw, childPrefix, i 0 /* isLastChild */);}}
aosp14代码 /*** Dumps the names of this container children in the input print writer indenting each* level with the input prefix.*/public void dumpChildrenNames(PrintWriter pw, String prefix) {final String childPrefix prefix ;//这里有给每一层增加空格pw.println(getName() type activityTypeToString(getActivityType()) mode windowingModeToString(getWindowingMode()) override-mode windowingModeToString(getRequestedOverrideWindowingMode()) requested-bounds getRequestedOverrideBounds().toShortString() bounds getBounds().toShortString());for (int i getChildCount() - 1; i 0; --i) {final E cc getChildAt(i);pw.print(childPrefix # i );//这里主要表示child的索引cc.dumpChildrenNames(pw, childPrefix);}}
更多framework实战干货内容资料请关注下面“千里马学框架”