summaryrefslogtreecommitdiff
path: root/tools/streaming_proto/cpp/main.cpp
AgeCommit message (Collapse)Author
2020-02-05Proto message for "dumpsys sensorservice --proto"Mike Ma
Add SensorServiceProto for protobuf dumpsys of sensorservice. Primarily used by incident service to capture an incident report proto. Also add a gensrc rule to generate cpp headers of frameworks proto to be used by native services like sensorservice. Added "static" qualifier to a few generated fields in the header to avoid linker conflict. Command to invoke (any of the following after lunch and env setup): $ adb shell dumpsys sensorservice --proto $ adb shell incident 3053 $ incident_report 3053 Bug: 146086105 Test: Execute the above commands and compare the output against dumpsys sensorservice Change-Id: I282ff37bd3e845464d0693d69fc0d82943cc9855
2017-12-18Remove stream.proto and cpp-streaming-proto generates field name to idYi Jin
mapping by default Test: atest incident_helper_test Change-Id: Iab04973ea78b942e44503fcd6ae60808caf3b9e0
2017-12-12Create a new stream option which generates field name to id mappingYi Jin
recursively for all its submessages. Also fix the wrong prefix for ro.build.version.XXX in proto. It is safe to adjust proto number for now since it is not used yet. Bug: 68774852 Test: atest incident_helper_test Change-Id: I46e43a407da6efc393eb3c39733aaf25a5cceb13
2017-11-14Implement System Properties SectionYi Jin
Bug: 68774852 Test: unit tested and on device tests Change-Id: I0d4aadf8d4203fe56e35bbfb77e5c532116fd27e
2017-11-10Implement Cpu Info SectionYi Jin
Support carriage return in Read class, and add a new way to parse lines which is not able to split purly by delimiters Bug: 65642861 Test: unit test and on device test Change-Id: Ib82dd4e458bb7d2fa33462b23fbe11b828325916
2017-11-01Remove the extra mapping of field types in ProtoOutputStreamYi Jin
It is very unlikely the protobuf changes the value in descriptor.h, and if defines an extra mapping, there are several places to maintain: 1. java-stream, 2. cpp-stream, 3. ProtoOutputStream.java 4. ProtoOutputStream.cpp 5. Privacy.h (GetFieldId) 6. StatsLog to generate field id (type << 32 + field number) Therefore use the current value in descriptor.h seems reasonable unless they change that, very very unlikely, they probably will just add new types, and deprect the existing ones like Group. Test: test output of dumpsys proto Change-Id: I6e150ab427851dd3b5dd55d3b273deeed7a0963c
2017-10-31Refactor incident_helper to use protoutil and cppstream plugin.Yi Jin
1. Split the parsers to its own file to prevent all the parsers in one gaint file. 2. Completely get rid of protobuf-cpp-full in incident_helper, use ProtoOutputStream and cppstream instead, the incident_helper binary is reduced from ~500K to ~113K. 3. Write data to protobuf even its values are zero/default, the reason is for example we have a repeated int32 orders = 1; and people explicitly append 0 so the total repeated field has 10 values, if zero is not written to serialized data, this repeated field will only have 9 values which is not what we want at first place. This also aligns with the default protobuf serialization behavior in incident_helper_test. 4. Use Android.bp for protoutil lib since it is not able to depend on libs compiled by .mk file, it works the other way. 5. Add a new custom message option for streaming_proto, if specified, the cppstream will create extra metadata to get field ids by field name. A Table class is created in incident_helper to use it. Bug: 67860303 Test: unit tested as well as on device test Change-Id: I8e136fd15f343a4a623d20910ec64b622b478a3e
2017-10-11Create protoc-gen-cppstream tool to auto-generate cpp proto field Ids.Yi Jin
It is very similiar to protoc-gen-javastream, which generates field Ids used by ProtoOutputStream.cpp to dump protobuf data. Bug: 65641021 Test: compile the streaming_proto: $ mmm -j frameworks/base/tools/streaming_proto/ and run: $ PATH=$PATH:out/host/linux-x86/bin/protoc-gen-cppstream aprotoc --cppstream_out=tmp/ frameworks/base/core/proto/android/service/procstats.proto frameworks/base/core/proto/android/util/common.proto Change-Id: I68becc80b5166455455c5df28cd698601b4a1c1d