Commit Graph

13 Commits

Author SHA1 Message Date
Wenjie Zhou
27030cd14e Update privacy filter for incident report protos.
Bug: 153380903
Test: manual build
Change-Id: Iff1910d619983910c1e57e9ac335053415f6fa1a
2020-04-15 16:46:32 -07:00
Adrian Roos
1d75e9c921 ProtoLogTool: Fix thread pool leak on code generation exception
Fixes an issue where the thread pool leaks when code generation
throws an exception (for example because of an invalid log string).

When the thread pool leaks, System.exit() no longer works, because
the JVM waits for all threads to exit - which never happens for the
leaked thread pool.

Test: `ProtoLog.w(LOG_GROUP, new String())` -> make droid should not hang
Change-Id: Ibdae0f1e68441c6fe004398d146f496503ccc4cd
2020-01-16 19:13:13 +00:00
Adrian Roos
a8685a3772 ProtoLog: Add end-to-end test
Adds a test that verifies we compute the correct hash end-to-end, i.e. including
the actual path logic, which previously caused a divergence between the viewer config
and the generated code.

Test: atest protologtool-tests
Change-Id: Ia2a414322aa6ccdaedda7f9754d903ec984902d6
2019-10-31 18:04:00 +00:00
Adrian Roos
6599f2dea4 ProtoLog: Fix broken hash computation
Fixes a bug caused by inconsistent paths - when transforming sources, we took the
path of the file, while when generating the viewer json, we used the path relative
to the root package.

Test: enable protolog, verify winscope can parse it.
Change-Id: Ib636515d70ca5b66da687542a84107465e51053d
2019-10-31 14:23:22 +01:00
Adrian Roos
2ca5d8601c ProtoLog: Cache the result of ProtoLogImpl.isEnabled(ProtoLogGroup)
We introduce a generated class ProtoLog$Cache, which contains a field
for each ProtoLogGroup to cache whether it is enabled or not.

This both makes lookup faster, and reduces code size.

Test: make droid
Change-Id: I581c87849c875918b182eff85996b6d19a6755ec
2019-10-18 18:22:30 +02:00
Adrian Roos
fbcd32e552 protolog: improve build time of frameworks/base/services
Improves build time by speeding up the protolog source transformation
tool:
- parallelize the transformation to use all available cores
- remove dependency on lexicographically preserving printer
- disable comment attribution and language level validation

Speeds up the build step from ~30s to ~4s.

Test: atest protologtool-tests
Test: make services.core.protologsrc && edit file in fw/base/services/core && time make services.core.protologsrc
Change-Id: I052e9eb3cc791edf60c555c6fcf59f2e59f0ba68
2019-10-18 12:34:28 +02:00
Adrian Roos
125b839889 ProtoLog: Better behavior when parsing fails
Improves behavior when parsing fails; now, ProtoLog skips the offending files, and
relies on the subsequent compilation step to catch the error.

Additionally, the build no longer fails when the canonical protolog.json file contains
obsolete entries.

Test: Introduce syntax error in services/core/ file, make and verify error messaging is sound
Change-Id: Ic23dec4a14489316ecb0e46bbabe246ddae29655
2019-10-02 19:03:34 +02:00
Adam Pardyl
9550999a73 Informative error messages, update README
ProtoLogTool error messages are hard to read, this CL addresses this
issue adding more info (including file name and line number) and using
verbose exception messages where available.

Updated README with recent ProtoLog changes.

Bug: 141672033
Test: atest protologtool-tests
Change-Id: Ibfca908808526adb6c8c5f68893f093a8233728f
2019-09-27 10:24:25 +02:00
Adam Pardyl
5e0e771f16 Remove line numbers from protolog config.
Having line numbers in log statement location info in protolog viewer
config makes the config file invalid after every code merge.

Bug:
Test: atest protologtool-tests
Change-Id: I7e9ae434517bc94ecfc7f421e71d21b07f3c233f
2019-09-26 16:15:16 +02:00
Adam Pardyl
a4e572d944 ProtoLog improvements
- Added log statement location info to viewer config
- Fixed a NPE in ProtoLogImpl
- Reworked early return for log calls
- Changed type of message hash field to signed (for Java compat)
- Fix flaky tests for ProtoLogImpl

Bug:
Test: atest protologtool-tests FrameworksServicesTests:com.android.server.protolog
Change-Id: I7874475083ab5d01fe46fd3013a058743acd3884
2019-09-25 12:36:32 +02:00
Adam Pardyl
0f1b3d4602 WindowManager ProtoLog feature
This CL implements the on-device part of ProtoLog
- the new logging system for WindowManager.

Design doc: go/windowmanager-log2proto

Change-Id: I2c88c97dabb3465ffc0615b8017b335a494bca59
Bug:
Test: atest FrameworksServicesTests:com.android.server.protolog protologtool-tests
2019-09-23 15:47:29 +00:00
Adam Pardyl
3c6f3387cf Workaround a bug in the JavaParser 3p library
A bug in the JavaParser LexicalPreservingPrinter prevents
the ProtoLogTool from correctly handling multiple subsequent
ProtoLog calls. This bug is a known issue, no fix is worked on
at this moment (https://github.com/javaparser/javaparser/issues/2290).

Bug:
Test: atest protologtool-tests
Change-Id: I919527a31c5ed21b17e5f3e271c2758d35896ea5
2019-09-12 16:37:55 +02:00
Adam Pardyl
fab9ad6ac0 Implement the ProtoLogTool
Implemented the ProtoLog code processing, viewer config generation
and binary log viewer tool.

Design doc: http://go/windowmanager-log2proto

Bug:
Test: atest protologtool-tests
Change-Id: Iff889944a6c381eb8a5b9b637b6bcd38ec60a245
2019-09-06 16:03:26 +02:00