Android winscope生成方法

先把google对winscope的描述写一下。

用于窗口转换跟踪的 WinScope 工具

Android 9 及更高版本包含用于跟踪窗口转换的 WinScope 工具。WinScope 提供了用于在转换期间和转换后记录和分析窗口管理器状态的基础架构和工具。它允许记录和单步调试窗口转换,同时将所有相关窗口管理器状态记录到跟踪文件中。您可以使用此数据重播并单步调试转换。

WinScope 工具源代码位于 platform/development/tools/winscope

注意:只有android 9及更高版本才有此功能

第二步:把android11中winscope的readme贴上来

# Tool for visualizing window manager traces

## Developing WinScope
When the trace is enabled, Window Manager and Surface Flinger capture and
save current state to a file at each point of interest.
`frameworks/base/core/proto/android/server/windowmanagertrace.proto`
and `frameworks/native/services/surfaceflinger/layerproto/layerstrace.proto`
contain the proto definitions for their internal states.

### Checking out code and setting up environment
* Install [Yarn](https://yarnpkg.com), a JS package manager
* [Download Android source](https://source.android.com/setup/build/downloading)
* Navigate to `development/tools/winscope`
* Run `yarn install`

### Building & testing changes
* Navigate to `development/tools/winscope`
* Run `yarn run dev`

### Building with internal extensions
Internal paths in vendor/ which are not available in AOSP must be replaced by
stub files. See getWaylandSafePath for an example
 

第三步:交代我实际上的操作

1:下载yarn

在Ubuntu上安装Yarn非常简单。我们将启用官方的Yarn存储库,导入存储库GPG密钥,然后安装该软件包。该存储库得到了一致的维护,并提供了最新版本。

导入存储库的GPG密钥,并通过运行以下命令将Yarn APT存储库添加到您的系统:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

正常的文档里下一步都是update和install,但我实际安装发现不行

使用 sudo npm install -g yarn 安装的才可用

无论使用哪种方式,一定是要先把yarn安装好了才行。如果用我提供的方法安装yarn有问题,请使用其他方式安装。并感谢你把你使用的方法与我分享

2:参考readme中的描述

进入development/tools/winscope

先执行yarn install

接下来winscope实际上已经可用了。但有两种方式

1:yarn run dev  这种主式必须在桌面版的linux系统中才可以,在纯命令行下会执行成功但卡住不返回

2:yarn run build  这个命令是在package.json中看到的。通过这个命令会生成dist目录,dist目录下会生成一个index.html

这个index.html是可以拷贝出来使用的,在server版中编译源码的需使用这种方式生成这个index.html,拷贝到window下直接点击就可以打开了

使用以上方法生成winscope分析工具的好处是可以生成当前android版本的winscope,特别是自己修改了proto协议的场景。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值