Due to there being some slightly different timestamps between WM/SF trace and IME trace, we want to allow some "fault tolerance" -- even if a WM/SF entry comes after IME entry in time, it may still be the corresponding entry if it's within a manually-defined "fault tolerance" time. For now, fault tolerance is defined to be 200ms. So if a WM/SF entry is within IME entry +- 200ms, it may be considered a matching / corresponding entry. Within this range, we will always try to pick a WM/SF entry that comes before the IME entry. If there is no such WM/SF entry, then we will pick one that comes after. Bug: 236226833 Test: manual on local build of Winscope Change-Id: I0782ec520284517bf964eeffd552e6175758c9f1
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, a JS package manager
- Download Android source
- Navigate to
development/tools/winscope - Run
yarn install
Building & testing changes
- Navigate to
development/tools/winscope - Run
yarn run dev
Update IntDefMapping
- Build
framework-minus-apex-intdefsmodule and a preprocessor will generate the latest IntDefMapping. From theANDROID_ROOTrun:
. build/envsetup.sh
m framework-minus-apex-intdefs
- Copy the generated
intDefMapping.jsonfiles to theprebuiltsrepo.
python3 -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) > ./prebuilts/misc/common/winscope/intDefMapping.json
- Upload the changes.
cd ./prebuilts/misc/common/winscope
repo start intdef-update
git commit -am "Update intdef mapping" "Test: N/A"
repo upload --cbr .
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