OSDN Git Service

Statsd and frameworks reference proto enums
authorBookatz <bookatz@google.com>
Fri, 12 Jan 2018 19:47:03 +0000 (11:47 -0800)
committerBookatz <bookatz@google.com>
Thu, 25 Jan 2018 23:47:57 +0000 (15:47 -0800)
commit1a1b0464cb43903ed540f4c43fd423b16e398c04
tree38d855525144f027e91afcfc2e0827bd531499ce
parenta70703175c1f5bcdfea44e5f665c51457a88b126
Statsd and frameworks reference proto enums

For frameworks constants that don't have intrinsic meaning (i.e. their actual
value and order don't matter), so that it is unlikely that their values
will be changed:
This cl introduces proto enums representing some constants found in
the Android codebase, and connects the two.

By using the Proto enum as the source-of-truth, it means that Java and
proto can be kept in sync. Otherwise, when the Java frameworks code
changes, it silently breaks the protos from working properly, since the enums
are wrong. By having the Java code reference the proto enums, it ensures
that everything is in sync. The values of the constants are unchanged.
But future changes to these constants will need to be done in the proto
file, which the Java file merely references.

The protos are necessary for incidentd and statsd and, in the future,
possibly dumpsys. In this way, the logging mechanism is much less likely
to get broken when new constants are added, and we can be ensured that
the logging accurately reflects the underlying codebase.

Bug: 69478930
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases
Change-Id: If79032c34b2799db1e3e70cb47b1312fd72092b9
22 files changed:
cmds/statsd/src/atoms.proto
cmds/statsd/tests/e2e/MetricConditionLink_e2e_test.cpp
cmds/statsd/tests/e2e/WakelockDuration_e2e_test.cpp
cmds/statsd/tests/statsd_test_util.cpp
cmds/statsd/tests/statsd_test_util.h
cmds/statsd/tools/loadtest/src/com/android/statsd/loadtest/SequencePusher.java
core/java/android/os/BatteryManager.java
core/java/android/os/PowerManager.java
core/java/android/view/Display.java
core/java/com/android/internal/os/BatteryStatsImpl.java
core/proto/android/os/batterymanager.proto [deleted file]
core/proto/android/os/batterystats.proto
core/proto/android/os/enums.proto [new file with mode: 0644]
core/proto/android/os/powermanager.proto
core/proto/android/server/powermanagerservice.proto
core/proto/android/service/battery.proto
core/proto/android/telephony/enums.proto [moved from core/proto/android/telephony/signalstrength.proto with 59% similarity]
core/proto/android/view/display.proto
core/proto/android/view/enums.proto [new file with mode: 0644]
services/core/java/com/android/server/BatteryService.java
telephony/java/android/telephony/DataConnectionRealTimeInfo.java
telephony/java/android/telephony/SignalStrength.java