• Home
  • History
  • Annotate
  • only in /frameworks/base/core/java/android/net/metrics/
History log of /frameworks/base/core/java/android/net/metrics/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5eb9053c4e8c788b83cfcfd7bfd39f628dd4ca45 23-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: add transports to connect stats

This patch groups connect() events per netId. It adds netid and
transport information to serialized ConnectStatistics events.

Test: updated NetdEventListenerServiceTest
updated IpConnectivityMetricsTest
$ runtest frameworks-net passes
Bug: 34901696
Change-Id: Id0d536ff723ded5c26eafe0bb138ba75ba2856c5
Merged-In: I4769496383943e714a1d350c298e093c2ed57477

(cherry picked from commit dfc2cc5857199345e08f07977b79b20292f964a2)
onnectStats.java
nsEvent.java
2a5cfb9738867da634a3bf64ccef881aaefbfce5 22-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: log DnsEvents in-band

This patch changes how DnsEvents are logged in IpConnectivityMetrics.
The following changes are made:
- DnsEventBatch are not logged after 100 queries on the same network
- this allows to merge DnsEvent and DnsEventBatch into one class
- DnsEventBatch are not logged after a network disconnect
- this allows to remove the NetworkCallback
- DnsEvent are now logged similarly to ConnectStats when statistics are
flushed, in a direct call from IpConnectivityMetrics into
NetdEventListenerService, in a direct call from IpConnectivityMetrics
into NetdEventListenerService.
- this allows to remove the Parcelable implementation of DnsEvent
- transports information is added to DnsEvent.

Test: - simplified NetdEventListenerServiceTest covering dns logging
- updated IpConnectivityEventBuilderTest
- updated IpConnectivityMetricsTest
- $ runtest frameworks-net passes
- manually verified $ adb shell dumpsys connmetrics list proto
Bug: 34901696
Change-Id: I4fcd0ad7a7b85d587647f471a90c1e53a18fc95a
Merged-In: Ia4b33fd4212741152662a2adbb0533bd1b4902ee

(cherry picked from commit 0699cf98042a64e41ee076c464eb115a6579be08)
nsEvent.java
a365bace7a8e3e6da016531e26a6046a827acaa5 22-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: add transports pretty printing

This patch also
- partially reverts commit f927f0c52e7df5b057e7d28888c3cfed164d241a
that exposed a getTransports method on NetworkCapabilities.
- moves enumerateBits to BitUtils (as unpackBits), and adds the
reverse packBit method.

Bug: 34901696
Test: manually looked at $ adb shell dumpsys connmetrics list
Change-Id: I1650daf8fc9c1b6e0d986d2285f81e888be8847f
Merged-In: Id04f9080e7f75608deeb49306aec34941e71794c

(cherry picked from commit df456e13a1127e3c8594b1d22ea4a9b3dca67a4b)
pConnectivityLog.java
f927f0c52e7df5b057e7d28888c3cfed164d241a 17-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: add transports to validation probes

This patch adds transports info to ValidationProbeEvent and migrates
netId logging for this event to the topt-level netId field in
ConnectivityMetricsEvent.

Test: modified unit tests. $ runtest frameworks-net passes
Bug: 3490169
Change-Id: Ibf51049ba8901ae5ca4ea86e2f500944a4738b5c
pConnectivityLog.java
alidationProbeEvent.java
948a85948dcccea4aaa9d70a74405308581b0925 16-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: change how interface names are logged

This patch deprecates the ifname field for specific metrics events of
types DhcpClientEvent, DhcpErrorEvent, IpReachabilityEvent and
IpManagerEvent.

Instead ifnames are logged in ConnectivityMetricsEvent, allowing for
link layer inference.

Test: updated unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I8bfabcb115bbd5289471d653c153a40bb48f28cd
hcpClientEvent.java
hcpErrorEvent.java
pConnectivityLog.java
pManagerEvent.java
pReachabilityEvent.java
44d5d0c2fb4159cdaaf0561af047f4709158c107 16-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "ConnectivityMetricsEvent: add ifname, netid, transports"
946b7e424e0e4d5bffc65ef405f32b966d192d3c 15-Mar-2017 Hugo Benichi <hugobenichi@google.com> ConnectivityMetricsEvent: add ifname, netid, transports

This patch adds new fields to ConnectivityMetricsEvent to make it more
symmetric to IpConnectivityEvent in ipconnectivity.proto.

Follow-up patches will start populating these fields for users of
IpConnectivityLog.

Test: unit tests updated, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I396767cdfcf38cce893c0d6e1f4524f12e3fdc64
pConnectivityLog.java
97035b4abff91aec8f608de3de7dfc59f9381414 16-Mar-2017 Hugo Benichi <hugobenichi@google.com> Merge "Connectivity metrics: simplify ConnectivityMetricsEvent"
ec27c4d9f33615be1f94d6bb5c5fd1358580ac05 15-Mar-2017 Hugo Benichi <hugobenichi@google.com> Connectivity metrics: simplify ConnectivityMetricsEvent

Now that ConnectivityMetricsEvent is only used for core networking
metrics and is not @SystemApi anymore, remove unused fields and prepare
for additional new fields.

Test: updated unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I15abad19981d491f16f2a3afe401f1e833079907
pConnectivityLog.java
1809db5cb11a07522092e445525330f2b8e8b83e 15-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "IP connectivity metrics: add new APF counters."
22d9b2d430c9a4fe17b54811bb77289b821e32db 22-Feb-2017 Hugo Benichi <hugobenichi@google.com> IP connectivity metrics: add new APF counters.

This patch adds a few missing counters to APF events:
- an actual lifetime duration to ApfProgramEvent.
- counters for total number of updates to ApfStatistics.

ApfProgramEvents are now recorded at program removal in order to
populate the actual lifetime of the program. ApfProgramEvents whose
actual lifetime was less than 1 second are filtered out.

Finally, instance fields of ApfProgramEvent and ApfStats classes are
made mutable to allow for simple record-like creation. This was not
possible when these classes were tagged @SystemApi.

Test: - manually verified output of $ dumpsys connmetrics list
- unit tests updated.
Bug: 34901696

Change-Id: I02694ebb9421ce1c2aa757fa6aa209d19a654dcd
pfProgramEvent.java
pfStats.java
a2decca4f25b6d3adfd396cdc475807985783bab 22-Feb-2017 Hugo Benichi <hugobenichi@google.com> IP connectivity metrics: ConnectStats additions

This patch:
- adds a counter to ConnectStats for counting the number of successful
connect() calls done in blocking mode. This allows to compute error
rates for connect() in blocking mode.
- add printing of ConnectStats when dumping NetdEventListenerService
and/or IpConnectivityMetrics service.

Test: $ runtest frameworks-net, + manual tests verifying logged events.
Bug: 34901696
Change-Id: I889e8ccd12681b0511be487e9d2ee44290a2d7d7
onnectStats.java
95cb226c1a4ff47531da65ef2617ade0dea5c9b8 11-Jan-2017 Hugo Benichi <hugobenichi@google.com> IP connectivity metrics: cleanup obsolete code

This patch cleans obsolete code related to IP connectivity metrics:
- remove @SystemApi on android.net.metrics: now that metrics events
are processed and serialized in the frameworks only, event classes
should not appear in the system apis.
- remove obsolete Logger classes: ConnectivityMetrics app was the
unique user of ConnectivityMetricsLogger until nyc-mr1. From nyc-mr1
the app started using dumpsys to get metrics for IpConnectivity and
Telephony, which made ConnectivityMetricsLogger obsolete.
- simplifications in MetricsTestUtil

Test: - runtest frameworks-net
- manually verified $ adb shell dumpsys connmetrics
Bug: 30054585
Bug: 32648597
Change-Id: I85ef65f7f69eb9299e4636cc7af54067201d9daf
pfProgramEvent.java
pfStats.java
efaultNetworkEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pManagerEvent.java
pReachabilityEvent.java
etworkEvent.java
aEvent.java
alidationProbeEvent.java
0d4a398b7846f26e4452180915ecb5a9d4566148 25-Nov-2016 Hugo Benichi <hugobenichi@google.com> IP Connectivity metrics: add connect() statistics

This patch adds a ConnectStats class to aggregate connect() statistics
gathered in NetdEventListenerService. ConnectStats is uploaded once a
day by IpConnectivityMetrics.

Test: $ runtest frameworks-net + new unit test
Bug: 32198976
Change-Id: Iea63339035415513a5ba0ff4b8f4d79f75fc652d
onnectStats.java
147aa6d53bc1e9f8a3632553abcf936023806e1d 15-Nov-2016 Hugo Benichi <hugobenichi@google.com> NetworkMonitor metrics: add first validation information

This patch adds first validation information to:
- ValidationProbeEvent, by extending the probe_type int field of to
also include a bit indicating if the probe was part of a first
validation attempt or not.
- NetworkMonitorEvent, by defining new contants for the event_type
field.

Test: $ runtest frameworks-net
+ manually generating events and inspecting the
output of $ adb shell dumpsys connmetrics list
Bug: b/32198726
Change-Id: If5687e310ddd18ed3096f8ecbdfc2ef866519234
etworkEvent.java
alidationProbeEvent.java
d8a06fa28a3bd3fa4bbb5335d324a754f61d724c 09-Nov-2016 Erik Kline <ek@google.com> Handle IpReachabilityMonitor errors better.
am: e452660466

Change-Id: I3bb9ce7caa99e166ddc576399453fcc9e172d6a6
e4526604664cb66ecdcbeca4d8f64e8c94750c31 14-Oct-2016 Erik Kline <ek@google.com> Handle IpReachabilityMonitor errors better.

If construction of a new IpReachabilityMonitor throws an IAE then
log it and immediately call onProvisioningFailure().

Test: runtest frameworks-wifi
passes, except for selectQualifiedNetworkDoesNotChooseDeletedEphemeral()
which fails with an NPE for unrelated reasons.

Bug: 31038971
Bug: 31742703
Change-Id: Ie91b8bdd509d06ad54d062bf446e74c092eb096c
pManagerEvent.java
7720c01fcfe06294cc1ff58ec407ae35bfb54849 07-Oct-2016 Hugo Benichi <hugobenichi@google.com> Reject DHCP packets with no magic cookie am: 006e061301
am: 1ade34dd76

Change-Id: Idc93ed44260f9e2dd3343dda57b790d3efa87a18
9f713864ca86a4cdeb61650ce1128c38cbbea072 06-Oct-2016 Hugo Benichi <hugobenichi@google.com> Catch runtime exceptions when parsing DHCP packets am: e0ea7fecd6
am: c4a13afe92

Change-Id: I53cb258a3b04f2bd8b31e15794b2fcd3ae295ce6
006e0613016c1a0e0627f992f5a93a7b7198edba 05-Oct-2016 Hugo Benichi <hugobenichi@google.com> Reject DHCP packets with no magic cookie

This patch adds an explicit check in the DHCP packet parser for
rejecting packets without a magic cookie, instead of relying on the
top-level try-catch-all in the parser.

This allows to add to DHCP error metrics this specific error.

It also allows to add two poor man's fuzzing tests that tries to find
additional gaps in the DHCP packet parser by
- trying to parse all subslices of a valid offer packet.
- trying to parse random byte arrays.

Test: covered by previously introduced malformed DHCP packet unit tests
+ additional fuzzing tests.
Bug: 31850211
Change-Id: If53c9ba9df78d7604ec018c9d67c237ae59c4833
hcpErrorEvent.java
e0ea7fecd63002ac2d3df18490fd1c16578d1935 05-Oct-2016 Hugo Benichi <hugobenichi@google.com> Catch runtime exceptions when parsing DHCP packets

This patch adds a try catch all to DHCP packet parsing so that
DhcpClient does not choke on malformed packets, brinding down with it
the whole framework.

Test: added new unit tests catching the issue fixed in this patch.
Bug: 31850211
Change-Id: I3c50a149fed6b2cbc4f40bb4f0e5bb2b56859b44
hcpErrorEvent.java
2b04d1234bef6cd257b9994030dfb5fa3cac8a9e 29-Sep-2016 Hugo Benichi <hugobenichi@google.com> Captive portal detection uses 3rd fallback probe am: d953bf853d
am: bc739d0bbc

Change-Id: Iec8ccdbcd433d8b2f5538d7b4bed5c945b5b688a
d953bf853d233026c9064e6a0c962b14cf4658d6 27-Sep-2016 Hugo Benichi <hugobenichi@google.com> Captive portal detection uses 3rd fallback probe

This patch adds the possitibility to send a 3rd fallback validation
probe in sendParallelHttpProbes when neither the 1st http probe nor the
https probe came back with a conclusive answer.

This 3rd probe is only used for trying again captive portal detection
and does not return success, so that network validation always fails if
the https probe fails.

In addition, the url reveals a captive portal is now sent to the
CaptivePortalLoginActivity so that all three probes can use different
urls.

Bug: 29367974

Change-Id: I7385fde1aa1316d94aac350af0e956cb193aa4ee
alidationProbeEvent.java
e69608f8648e8d7f21c712be3bbf50b05ce8b1e3 23-Sep-2016 Hugo Benichi <hugobenichi@google.com> resolve merge conflicts of 00f07be to nyc-mr1-dev-plus-aosp

Change-Id: I82865b2847c584f8a1d728ef76113e3969f222ca
0daeac5dd41f136a1ca0a76b406016b05586e562 23-Sep-2016 Hugo Benichi <hugobenichi@google.com> New IpConnectivityMetrics service am: eab511b582
am: 3a353a2044

Change-Id: I5cf485edd3ab1ebb81a2a9d35dfb8bd6d8bcc305
00a42d4c885bf7440c2677750ad8b10974b16d7f 13-Sep-2016 Hugo Benichi <hugobenichi@google.com> IpConnectivityLog uses new metrics service

This patch connects existing IpConnectivityLog to the new
IpConnectivityMetrics service:
- IpConnectivityLog is now an independent class that pushes events
directly to the new IpConnectivityMetrics service.
- DnsEventListenerService is moved from MetricsLoggerService to
IpConnectivityMetrics.
- this patch also features end to end tests from IpConnectivityLog to
IpConnectivityMetrics dumpsys output.

Bug: 31254800
Change-Id: I4fe4a209eedde2814d5f13c574a1a0d854bd05c9
pConnectivityLog.java
eab511b582cc00364dee7835534bb511719f9231 09-Sep-2016 Hugo Benichi <hugobenichi@google.com> New IpConnectivityMetrics service

This patch defines a new metrics service for IpConnectivity events
defined in android.net.metrics, separate from currently existing
MetricsLoggerService.

Similarly to MetricsLoggerService, the new service has an event buffer.
It also implements a dumpsys interface that can be used to flush events
and output a serialized proto.

Bug: 31254800
Change-Id: I0c3faeb4008b283f85d9ba9460371fa68956ea3b
pConnectivityLog.java
d82fccd368ca605c8efc21b198e667fd30c4182e 21-Sep-2016 Michal Karpinski <mkarpinski@google.com> Rename DnsEventListenerServiceTest to NetdEventListenerServiceTest

Change-Id: I67e645306444938a4675e91a9db5d716c0bd4881
nsEvent.java
90cbc5b44450e9806ce0227d125fe7d5107c7c4b 29-Jul-2016 Hugo Benichi <hugobenichi@google.com> Fix missing IpConnectivity metrics

The IpConnectivityLog class looks up MetricsLoggerService once only
at creation. If a IpConnectivityLog user instantiates this class too
early during the boot process, the MetricsLoggerService is not found
and no event can be recorded.

This patch makes IpConnectivityLog attempt to look up
MetricsLoggerService as long as it hasn't found it yet.

This allows IpManager and ConnectivityService to upload
android.net.metrics events.

Bug: 30490301
Change-Id: I97102b95a775ea9e90351b9887ae4661fddc2af9
pConnectivityLog.java
42e608527a082af3d59f4e437ca5a4f781cb0a4e 07-Jul-2016 Hugo Benichi <hugobenichi@google.com> Merge "IpConn metrics: distinguish NUD_FAILED answers" into nyc-mr1-dev
764342352153f3d3834eefdf05337ba744211a6d 07-Jul-2016 Hugo Benichi <hugobenichi@google.com> IpConn metrics: add times to DHCP bound state

This patch adds DhcpClientEvent logging for:
- time from init state to bound state
- time from bound state to bound state when renewing

Example:
ConnectivityMetricsEvent(12:04:33.353, 0, 0): DhcpClientEvent(wlan0, WaitBeforeStartState, 94ms)
ConnectivityMetricsEvent(12:04:35.772, 0, 0): DhcpClientEvent(wlan0, DhcpInitState, 2417ms)
ConnectivityMetricsEvent(12:04:35.787, 0, 0): DhcpClientEvent(wlan0, DhcpRequestingState, 15ms)
ConnectivityMetricsEvent(12:04:35.793, 0, 0): DhcpClientEvent(wlan0, ConfiguringInterfaceState, 6ms)
ConnectivityMetricsEvent(12:04:35.811, 0, 0): DhcpClientEvent(wlan0, InitialBoundState, 2457ms)
ConnectivityMetricsEvent(12:05:35.791, 0, 0): DhcpClientEvent(wlan0, DhcpBoundState, 59998ms)
ConnectivityMetricsEvent(12:05:35.988, 0, 0): DhcpClientEvent(wlan0, WaitBeforeRenewalState, 196ms)
ConnectivityMetricsEvent(12:05:36.003, 0, 0): DhcpClientEvent(wlan0, DhcpRenewingState, 15ms)
ConnectivityMetricsEvent(12:05:36.010, 0, 0): DhcpClientEvent(wlan0, RenewingBoundState, 219ms)

Change-Id: I2540dd102a6509dff55936e38015265659b20760
hcpClientEvent.java
0d1c65b221dee1ef80a03c25877e7fd58fc106de 22-Jun-2016 Hugo Benichi <hugobenichi@google.com> IpConn metrics: distinguish NUD_FAILED answers

This patch adds in IpReachabilityMonitor a timestamp variable set
everytime that probeAll() send NUD probe requests to RTNETLINK.
This allows to distinguish between:
1) NUD_FAILED events resulting from such a forced NUD probe
2) "organic" NUD_FAILED notifications from the kernel

This distinction is added to IpReachabilityEvent as a one-bit flag.

This patch also changes the formatting of ApfProgramEvent flags to use
'|' as a joining character, similarly to other flags formatting.

Bug: 21859053
Change-Id: I24c64a3f17fa283eace5bd0a05c21a90a2305359
pfProgramEvent.java
pReachabilityEvent.java
018a2058246d1f034d25adbd69502e6b2eb81fc7 05-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "IpConn metrics: use @IntDef" into nyc-mr1-dev
cf6b12f50aa3251a3fc9929c565f8a19eaaac49e 04-Jul-2016 Hugo Benichi <hugobenichi@google.com> IpConn metrics: use @IntDef

Change-Id: Iae23f04abd3d1a43e7217f4fd641cd5fa61a7a1b
pfProgramEvent.java
efaultNetworkEvent.java
hcpErrorEvent.java
nsEvent.java
pManagerEvent.java
etworkEvent.java
alidationProbeEvent.java
54756fdfd9f710e9c0090d166c8cc27509bd1bfd 05-Jul-2016 Hugo Benichi <hugobenichi@google.com> Merge "IpConn metrics: correctly read RA lifetimes" into nyc-mr1-dev
176ed01a1fdcca5734dcc1e11fc37a2f7363f5f8 01-Jul-2016 Hugo Benichi <hugobenichi@google.com> IpConn metrics: add dhcp transition times

This patch adds lifetime durations of DhcpClient states to
DhcpClientEvents.

To record the duration of a state, the event is now recorded when the
DhcpClient state machine exits that state.

In addition this patch removes event logging of StoppedState,
DhcpState and DhcpHaveLeaseState.

Change-Id: Ibd37b5e3070f35113b6b45942b1e1ff19c27a90b
hcpClientEvent.java
6ccd51a338fed39217cb3a5c0f229ed547918634 04-Jul-2016 Hugo Benichi <hugobenichi@google.com> IpConn metrics: correctly read RA lifetimes

This patch
- adds a Builder class for RaEvent.
- uses this Builder class for correctly recording the minimum
lifetime seen for every ICMP6 options tracked, instead of
recording the last lifetime seen.
- adds unit test coverage for RaEvent logging.

Change-Id: I6443932f5cf7a613a5c695c65a60eab01e60602a
aEvent.java
cfbf7414a14cf91d1b5c83154aab54c32d6be76a 23-Jun-2016 Hugo Benichi <hugobenichi@google.com> Record events for RA option lifetimes

This patch defines a new android.net.metrics.RaEvent class carrying
lifetime values contained in RA packets. RaEvent are recorded when
ApfFilter processes a new RA for which there is no match.

Example:
ConnectivityMetricsEvent(15:39:39.808, 0, 0): RaEvent(lifetimes: router=3600s, prefix_valid=2592000s, prefix_preferred=604800s, route_info=-1s, dnssl=-1s, rdnss=3600s)

Change-Id: Ia28652e03ed442d5f2a686ef5b3fafbcb77c503a
aEvent.java
647c86d70a0f2162dcc95854e9dccb925c16ecf3 07-Jun-2016 Hugo Benichi <hugobenichi@google.com> Log RA listening statistics

This patch adds a new ApfStats event class that counts RA packet
reception statistics on the RA listener thread of ApfFilter and reports
the maximum program size advertised by hardware.

Statistics are gathered for the lifetime of a network with APF
capabilities and uploaded at network teardown when the listener thread
exits.

Example event:
ConnectivityMetricsEvent(15:44:23.741, 0, 0): ApfStats(284945ms 2048B RA: 2 received, 0 matching, 0 ignored, 0 expired, 0 parse errors, 2 program updates)

Bug: 28204408
Change-Id: Id2eaafdca97f61152a4b66d06061c971bc0aba4c
pfStats.java
4fc3ee5be223122792ebc0ee8a05c93d93e26a52 02-Jun-2016 Hugo Benichi <hugobenichi@google.com> Log events at APF program generation

Example:
ConnectivityMetricsEvent(15:24:52.018, 0, 0): ApfProgramEvent(0/0 RAs 121B forever FLAG_MULTICAST_FILTER_ON)
ConnectivityMetricsEvent(15:24:53.036, 0, 0): ApfProgramEvent(1/1 RAs 334B 600s)
ConnectivityMetricsEvent(15:24:53.590, 0, 0): ApfProgramEvent(1/1 RAs 360B 600s FLAG_MULTICAST_FILTER_ON, FLAG_HAS_IPV4_ADDRESS)
ConnectivityMetricsEvent(15:24:58.157, 0, 0): ApfProgramEvent(1/1 RAs 294B 599s FLAG_HAS_IPV4_ADDRESS)

Bug: 28204408
Change-Id: I9c4c82861cf42eb2c7e7bf5471f05e8ff2fc560c
pfProgramEvent.java
pManagerEvent.java
alidationProbeEvent.java
cfddd6879283860bb4d2cf2972ea086f585a37ec 31-May-2016 Hugo Benichi <hugobenichi@google.com> Refactor IP connectivity event logging

This patch removes static methods for logging IP connectivity events
defined in android.net.metrics and replaces them with a single log()
instance method defined on IpConnectivityLog. Event constructors are
now public also. Every classes logging such events now create an
instance of IpConnectivityLog for logging event objects directly
instantiated with new.

Removing static dependencies allow straightforward testing of logging.

This patch also removes the base IpConnectivityEvent class which is not
needed any more.

Bug: 29035129
Change-Id: I3de700f93f46deaa48a759f938f7d00e1d8bff98
efaultNetworkEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pConnectivityEvent.java
pConnectivityLog.java
pManagerEvent.java
pReachabilityEvent.java
etworkEvent.java
alidationProbeEvent.java
3bba249c4711b10b2ba5335c7b6653dc570aae64 30-May-2016 Hugo Benichi <hugobenichi@google.com> Tests for IpConnectivityMetricsLog

Bug: 28204408
Bug: 29035129
Change-Id: I429562a00904188947b11da9928ec5c01296ff97
pConnectivityLog.java
623ab7d7a6a7d948fa6338a3992b2680d0192427 30-May-2016 Hugo Benichi <hugobenichi@google.com> ConnectivityMetricsLogger subclass for IpConnectivity

IpConnectivityEvent was using ConnectivityMetricsLogger directly for
logging events. However ConnectivityMetricsLogger keeps track in a
thread-unsafe way of skipped events rejected by MetricsLoggerService.

This patch introduces a subclass of ConnectivityMetricsLogger that
does not track skipped events, for using in IpConnectivityEvent.

It also qualifies the mServiceBlockedTimestampMillis variable as
volatile so that throttling is effective accross concurrent callers
of logEvent.

Bug: 28204408
Bug: 29023888
Change-Id: I33707ba1d07487b42f3ce9a1ad9a66d785e99fa7
pConnectivityEvent.java
pConnectivityLog.java
1654b1d11c3f4195d6f691bd1b6eb5aa672ffc94 24-May-2016 Hugo Benichi <hugobenichi@google.com> Fix default network transition event recording

When disconnecting from a default network X and falling back on another
connected network Y as the new default, ConnectivityService was
attempting to record this event as a X -> Y "atomic" transition.

In practice the default network connectivity is actually lost and
recovering default network takes some non-zero time.

This patch changes the event recording to always record disconnection as
X -> 0 events. At the same time, if there is a fallback network that is
elected as the new default ConnectivityService will also record a 0 -> Y
event.

This patch also improves pretty-printing of DefaultNetworkEvent.

Extract from $ adb shell dumpsys connectivity_metrics_logger --events
17:51:00.086: DefaultNetworkEvent(0 -> 100:CELLULAR)
17:51:25.232: DefaultNetworkEvent(100:IPv4 -> 101:WIFI) # wifi goes on
17:51:44.064: DefaultNetworkEvent(101:DUAL -> 0) # wifi goes off
17:51:44.187: DefaultNetworkEvent(0 -> 100:CELLULAR)

Bug: 28204408
Change-Id: I63252633235bf6ba833b9ac431a80dda75a93e67
efaultNetworkEvent.java
c5be12e7ac43cbe8c68219fa702c6fb7f06183c3 19-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Make isCaptivePortal perform both HTTP and HTTPS probes.

Also a couple of minor cleanups and logging tweaks.

Bug: 26075613
Change-Id: I67b09e96d72764179339b616072bb2ce06aabf33
alidationProbeEvent.java
61cbccc2bf7983b50e7a7f1fdb1858caeab6fd96 26-Apr-2016 Hugo Benichi <hugobenichi@google.com> Remove unused event tags of IpConnectivityEvent

Bug: 28204408
Change-Id: I8de95add30cdf5c35c8129ee1b95d2d648b3316d
efaultNetworkEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pConnectivityEvent.java
pManagerEvent.java
pReachabilityEvent.java
etworkEvent.java
alidationProbeEvent.java
5df9d729f6c78215f287701d7e136dfc922e2bd3 25-Apr-2016 Hugo Benichi <hugobenichi@google.com> Better ConnectivityMetricsEvent printing

This patch adds more information printing for IpConnectivity event
classes in android.net.metrics.

example:

ConnectivityMetricsEvent(14:36:35.799, 0, 1026): DhcpClientEvent(wlan0, DhcpRequestingState)
ConnectivityMetricsEvent(14:36:35.805, 0, 1026): DhcpClientEvent(wlan0, DhcpHaveAddressState)
ConnectivityMetricsEvent(14:36:35.809, 0, 4096): IpManagerEvent(wlan0, PROVISIONING_OK, 155ms)
ConnectivityMetricsEvent(14:36:35.810, 0, 1026): DhcpClientEvent(wlan0, DhcpBoundState)
ConnectivityMetricsEvent(14:36:35.871, 0, 2048): NetworkEvent(101, NETWORK_CONNECTED, 0ms)
ConnectivityMetricsEvent(14:36:35.874, 0, 2051): ValidationProbeEvent(101, PROBE_HTTP:599, 3ms)
ConnectivityMetricsEvent(14:36:35.874, 0, 2048): NetworkEvent(101, NETWORK_VALIDATION_FAILED, 0ms)
ConnectivityMetricsEvent(14:36:35.928, 0, 3072): DefaultNetworkEvent(0 -> 101, [WIFI], IPv4: false, IPv6: false)
ConnectivityMetricsEvent(14:36:37.008, 0, 2051): ValidationProbeEvent(101, PROBE_HTTP:204, 134ms)
ConnectivityMetricsEvent(14:36:37.008, 0, 2050): NetworkEvent(101, NETWORK_VALIDATED, 1137ms)

Also fixes a couple of event logging issues:
- do no record spurious receive DhcpErrorEvent when a network goes down.
- add an eventType field to IpManagerEvent instead of using the
loggger component tag.

Bug: 28204408
Change-Id: Ia6f4ccfd7a0c63a5ccec18825f226c0b5781217b
efaultNetworkEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pManagerEvent.java
pReachabilityEvent.java
etworkEvent.java
alidationProbeEvent.java
cc92c6e87773df9d5a84922066716ae9bb09cd6d 21-Apr-2016 Hugo Benichi <hugobenichi@google.com> Split network monitoring and portal probe events

This patches changes how captive portal tests and network lifecycle
events are logged as connectivity events:
- it splits NetworkMonitorEvent into two event classes:
- ValidationProbeEvent for logging individual probe events.
- NetworkEvent for logging network connection, validation,
lingering, and disconnection.
- it removes the redundant CaptivePortalCheckResultEvent class.
The information logged in CaptivePortalCheckResultEvent was already
logged by NetworkMonitorEvent, but missing the evaluation durations.
It is now logged by ValidationProbeEvent.
- it removes the CaptivePortalStateChangeEvent class, which is now
redundant with NetworkEvent, but missing evaluation durations.

In addition, it adds event logging when ConnectivityService puts a
network into lingering or removes a network from lingering.

Bug: 28204408
Change-Id: I8f9752e4d36175ecfcbd1545a01a41bad6e06ea4
aptivePortalCheckResultEvent.java
aptivePortalStateChangeEvent.java
etworkEvent.java
etworkMonitorEvent.java
alidationProbeEvent.java
b99d6af3ab406db14d161cdc0000ed521957d7ca 21-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Expand NetworkMonitor metrics" into nyc-dev
7261fb27de16bb6d3ebd81bd3b73062bd212ea7e 21-Apr-2016 Hugo Benichi <hugobenichi@google.com> Merge "Some fixes in ConnectivityService event logging" into nyc-dev
a488c23dd5c9e024fb8ec702cee722916cdeaf0e 15-Apr-2016 Erik Kline <ek@google.com> Expand NetworkMonitor metrics

- add netid to CaptivePortalStateChangeEvent
- add NetworkMonitorEvent for simple duration measurements

Bug: 28204408
Change-Id: I62035e07d64013878a0bce30c67c929c2c7e7a85
aptivePortalStateChangeEvent.java
pConnectivityEvent.java
etworkMonitorEvent.java
5f16f760ad2469c8d5636f45974a2f725ef289be 19-Apr-2016 Hugo Benichi <hugobenichi@google.com> Some fixes in ConnectivityService event logging

Bug: 28204408
Change-Id: I44ed9539bb213a845c2bcc2861c947af7c3c9ef4
onnectivityServiceChangeEvent.java
efaultNetworkEvent.java
25bf8f5d5678e747933ae9e4051daa99ddfcfaa3 19-Apr-2016 Hugo Benichi <hugobenichi@google.com> Various fixes in IpReachability event logging

- fold IpReachabilityMonitor* classes into a single IpReachabilityEvent.
- only log an event for NUD_FAILED Netlink answers.
- distinguish between NUD_FAILED with or without lost of provisioning.
- do not record host ip addresses.
- record interface name instead of interface index when losing
provisioning.

- also return an error code when probeNeighbor fails, and log this error
code in IpReachability events.

Bug: 28204408
Change-Id: I5f0def0ab1ace7e467a0c69b3b82d07ef2252307
pConnectivityEvent.java
pReachabilityEvent.java
pReachabilityMonitorLostEvent.java
pReachabilityMonitorMessageEvent.java
pReachabilityMonitorProbeEvent.java
23e0e805c543f3edad54ec71c6bc21147946511d 19-Apr-2016 Hugo Benichi <hugobenichi@google.com> Remove unused DHCP timeout event tag.

DHCP timeouts should not be logged at DHCPClient level but as a timeout
event in IpManager.

Bug: 28204408
Change-Id: Ia12619e3bf71102cf289cbbcdec53fd5e7e8efff
hcpErrorEvent.java
pConnectivityEvent.java
4b6dfc2ef54723768a67887ce2a42d4f8f64d0f4 14-Apr-2016 Hugo Benichi <hugobenichi@google.com> Make android.net.metrics Event classes @SystemApi

Bug: 28204408
Change-Id: I8ffe833213bbc03a7f70c51789f4899ee08f6e08
aptivePortalCheckResultEvent.java
aptivePortalStateChangeEvent.java
onnectivityServiceChangeEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pConnectivityEvent.java
pManagerEvent.java
pReachabilityMonitorLostEvent.java
pReachabilityMonitorMessageEvent.java
pReachabilityMonitorProbeEvent.java
627b42494d82eca4fd51abfc0a5d7f330862b881 15-Apr-2016 Hugo Benichi <hugobenichi@google.com> Fixes fatal linter errors in android.net.metrics

This patch changes how Event classes are organized:
- Base IpConnectivityEvent class does not implement Parcelable because
it cannot be final (has children). It also becomes abstract because
it is not supposed to be instantiated and logged directly.
- All children classes becomes final because they are Parcelable.
- All constructors of all children classes become private, because they
are supposed to be instantiated with their associated logEvent()
methods.
- All instance fields of all children classes become public final.
Rational: if private, the ConnectivityMetrics app cannot read
their data.

Bug: 28204408
Change-Id: I1a4689c422230c6ed034307dec54a61daf8a6598
aptivePortalCheckResultEvent.java
aptivePortalStateChangeEvent.java
onnectivityServiceChangeEvent.java
hcpClientEvent.java
hcpErrorEvent.java
nsEvent.java
pConnectivityEvent.java
pManagerEvent.java
pReachabilityMonitorLostEvent.java
pReachabilityMonitorMessageEvent.java
pReachabilityMonitorProbeEvent.java
2677b1957b444e2dae5737feee989109b811547c 18-Apr-2016 Hugo Benichi <hugobenichi@google.com> Fix spurious DHCP parse error logging.

This patch moves the event logging of DHCP response packet parse errors
to DHCPClient in a single place. It also logs receive IO errors as
DHCPErrors instead of DHCPClientEvents.

BUG=28197345

Change-Id: I7ad666cff4d8b97915880477347fbb3f588fdb2a
hcpClientEvent.java
hcpErrorEvent.java
43724734d76c900fba9a004e28ff0ea4bd9d07ec 12-Apr-2016 Lorenzo Colitti <lorenzo@google.com> Metrics logging for DNS queries.

Bug: 28204408
Change-Id: I05fc9b580aa20d99e8766057e17a38b5eb6267e8
nsEvent.java
pConnectivityEvent.java
0628d324d0f1c2116c051faadd8e4bf26206b1a6 14-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Also log IPv4 and IPv6 connectivity of any previous default network" into nyc-dev
48f12f2ad6e59484f528978ce3627c16be3bf10d 14-Apr-2016 Erik Kline <ek@google.com> Also log IPv4 and IPv6 connectivity of any previous default network

Change-Id: I07595c0a131fea21914f524949cd64af87403b88
onnectivityServiceChangeEvent.java
fc18b6f3608d87f3dc53cda8d8db30636c92d6e9 14-Apr-2016 Hugo Benichi <hugobenichi@google.com> Merge "Add DHCP error event class and record DHCP errors." into nyc-dev
1feca76bd48008aa3421c8741cb147ecc1a6e912 14-Apr-2016 Pierre Imai <imaipi@google.com> Merge changes Ia71865a9,I40b6de54 into nyc-dev

* changes:
Log an event whenever we lose the default network.
Record the transport types for connectivity events.
6241874355c0e0d9ff04e993ad1d522c66b8c50b 13-Apr-2016 Hugo Benichi <hugobenichi@google.com> Add DHCP error event class and record DHCP errors.

This patch adds an event class derived from IpConnectivityEvent that
records parsing errors of DHCP response packets.

Change-Id: I19516cf05e3419c4262e3236899e52987e5f2264
hcpErrorEvent.java
6b4e15b1558e13cb9d9b3975412c4c6bda6e0c37 06-Apr-2016 Pierre Imai <imaipi@google.com> Record the transport types for connectivity events.

BUG: 25691077
Change-Id: I40b6de5446325e717c0356603fd66cd395db9acb
onnectivityServiceChangeEvent.java
5b25a0f7960048cbf5929ba144e7a575eb4f7d32 12-Apr-2016 Erik Kline <ek@google.com> Add some more metrics: IpManager, IpReachabilityMonitor

Change-Id: Ibb7150c849715a42fc2c879589eaaf86e8a007e7
pConnectivityEvent.java
pManagerEvent.java
pReachabilityMonitorLostEvent.java
bc9cc50947c129d11a282198ac458ffb82fef5bd 29-Mar-2016 Pierre Imai <imaipi@google.com> Move connectivity events to frameworks/base.

Fixes a crash in bluetooth' DhcpClient due to Class(not)Loader.

Change-Id: I318c033aa8782c27a243104f85950adbf07d03a6
BUG: 27885860
BUG: 25691077
aptivePortalCheckResultEvent.java
aptivePortalStateChangeEvent.java
onnectivityServiceChangeEvent.java
hcpClientEvent.java
pConnectivityEvent.java
pReachabilityMonitorMessageEvent.java
pReachabilityMonitorProbeEvent.java