xref: /aosp_15_r20/development/tools/winscope/README.md (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard Worker# Tool for visualizing window manager traces
2*90c8c64dSAndroid Build Coastguard Worker
3*90c8c64dSAndroid Build Coastguard Worker## Developing WinScope
4*90c8c64dSAndroid Build Coastguard WorkerWhen the trace is enabled, Window Manager and Surface Flinger capture and
5*90c8c64dSAndroid Build Coastguard Workersave current state to a file at each point of interest.
6*90c8c64dSAndroid Build Coastguard Worker`frameworks/base/core/proto/android/server/windowmanagertrace.proto`
7*90c8c64dSAndroid Build Coastguard Workerand `frameworks/native/services/surfaceflinger/layerproto/layerstrace.proto`
8*90c8c64dSAndroid Build Coastguard Workercontain the proto definitions for their internal states.
9*90c8c64dSAndroid Build Coastguard Worker
10*90c8c64dSAndroid Build Coastguard Worker### Checking out code and setting up environment
11*90c8c64dSAndroid Build Coastguard Worker* [Download Android source](https://source.android.com/setup/build/downloading)
12*90c8c64dSAndroid Build Coastguard Worker* Navigate to `development/tools/winscope`
13*90c8c64dSAndroid Build Coastguard Worker* Run `npm install`
14*90c8c64dSAndroid Build Coastguard Worker
15*90c8c64dSAndroid Build Coastguard Worker### Build & test & deploy changes
16*90c8c64dSAndroid Build Coastguard Worker* Navigate to `development/tools/winscope`
17*90c8c64dSAndroid Build Coastguard Worker* Run `npm run` to get the list of available commands
18*90c8c64dSAndroid Build Coastguard Worker
19*90c8c64dSAndroid Build Coastguard Worker### Update IntDefMapping
20*90c8c64dSAndroid Build Coastguard Worker* Build `framework-minus-apex-intdefs` module and a preprocessor will
21*90c8c64dSAndroid Build Coastguard Worker  generate the latest IntDefMapping. From the `ANDROID_ROOT` run:
22*90c8c64dSAndroid Build Coastguard Worker```
23*90c8c64dSAndroid Build Coastguard Worker. build/envsetup.sh
24*90c8c64dSAndroid Build Coastguard Workerm framework-minus-apex-intdefs
25*90c8c64dSAndroid Build Coastguard Worker```
26*90c8c64dSAndroid Build Coastguard Worker
27*90c8c64dSAndroid Build Coastguard Worker* Copy the generated `intDefMapping.json` files to the `winscope`.
28*90c8c64dSAndroid Build Coastguard Worker```
29*90c8c64dSAndroid Build Coastguard Workerpython3 -c 'import sys,json,collections; print(json.dumps(collections.OrderedDict(sorted(collections.ChainMap(*map(lambda x:json.load(open(x)), sys.argv[1:])).items())), indent=2))' $(find out/soong/.intermediates/frameworks/base -iname intDefMapping.json) > ./development/tools/winscope/src/common/intDefMapping.json
30*90c8c64dSAndroid Build Coastguard Worker```
31*90c8c64dSAndroid Build Coastguard Worker
32*90c8c64dSAndroid Build Coastguard Worker* Upload the changes.
33*90c8c64dSAndroid Build Coastguard Worker```
34*90c8c64dSAndroid Build Coastguard Workerrepo start intdef-update
35*90c8c64dSAndroid Build Coastguard Workergit commit -am "Update intdef mapping" "Test: N/A"
36*90c8c64dSAndroid Build Coastguard Workerrepo upload --cbr .
37*90c8c64dSAndroid Build Coastguard Worker```
38*90c8c64dSAndroid Build Coastguard Worker
39*90c8c64dSAndroid Build Coastguard Worker### Building with internal extensions
40*90c8c64dSAndroid Build Coastguard WorkerInternal paths in vendor/ which are not available in AOSP must be replaced by
41*90c8c64dSAndroid Build Coastguard Workerstub files. See getWaylandSafePath for an example
42