Commit Graph

4336 Commits

Author SHA1 Message Date
Hugo Benichi
0dfa4b300e Merge "DefaultNetworkEvent metrics: rehaul" am: addecd1491 am: d025358166
am: 83e05af631

Change-Id: Ia5c19bfbdf9eea553f4517f312295c14c2f02046
2017-11-06 07:41:53 +00:00
Hugo Benichi
83e05af631 Merge "DefaultNetworkEvent metrics: rehaul" am: addecd1491
am: d025358166

Change-Id: If6bf966ba547a2ce50e17340e0374dd9b75b80d9
2017-11-06 07:31:39 +00:00
Hugo Benichi
addecd1491 Merge "DefaultNetworkEvent metrics: rehaul" 2017-11-06 07:09:49 +00:00
Hugo Benichi
f123c85f29 DefaultNetworkEvent metrics: rehaul
This patch changes instrumentation of default networks and default
network events:
- stop logging events for default network transitions,
  but instead consistently log one event per continuous segment
  when one given network was the default, including logging an
  event for when there is no default network.
- keep a separate rolling buffer of DefaultNetworkEvent for
  dumpsys and bug reports.

These changes allow to simplify post aggregation of default network
event metrics by removing any need to do time series processing.
Instead, metrics and counters can be implemented withouth any ambiguity
by following the recipe:

% of x = sum(duration | x = true) / sum (all durations)

where x can be various conditions such as:
- the default network was validated
- the default network was WiFi
- the default network was IPv6
- there was no default network
- ...

Most importantly, this new logging scheme allows to measure much more
reliably:
- the % of the time that a device had Internet, in the sense that the
default network was validated.
- the time transitions between default networks, keyed by previous and
new transports/link layer, which allows to derive wakelock durations
and wakelock power costs from default network switches.

This patch also simplifies the dumpsys interface of the connmetrics
service and reduces the commands to three:
- "flush" for metrics upload.
- "proto" for printing buffered event in text proto format.
- "list" for listing all events and statistics.

Bug: 34901696
Bug: 65700460
Test: runtest frameworks-net
Change-Id: I0521f1681a60cca07ac3bfd5741d64ce44de4cdd
2017-11-06 09:04:02 +09:00
Jeff Sharkey
92675a966e Merge "Define NOT_ROAMING network capability." am: 8f380ab29c am: 3fe1ae29cd
am: 47ad296f75

Change-Id: I04220ff55fc87dbf8d417a30f15a06a877b412d4
2017-11-03 23:18:45 +00:00
Jeff Sharkey
47ad296f75 Merge "Define NOT_ROAMING network capability." am: 8f380ab29c
am: 3fe1ae29cd

Change-Id: Ib511f7af82c80fd4e95f4da9de1fdce200deb987
2017-11-03 23:07:03 +00:00
Jeff Sharkey
07e19362de Define NOT_ROAMING network capability.
The "roaming" state of a network really belongs on NetworkCapabilities
instead of being published through NetworkInfo.isRoaming().  One major
reason is to support developers creating NetworkRequests for a
non-roaming network.

Watch for any capability changes that network statistics are
interested in (either metered or roaming) and notify it to perform
an update pass; fixes bug where we previously only triggered on
roaming changes.

Fix bug in VPNs where metered/roaming capabilities of underlying
networks weren't being propagated; this was probably preventing
some jobs from running over unmetered networks, and causing other
jobs to run over roaming networks!  Also passes along link bandwidth
information from underlying networks, and propegates any changes
to underlying networks.

Fix race condition by reading prevNc inside lock.  Utility methods
correctly calculate min/max link bandwidth values.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.,com.android.server.connectivity.,com.android.server.ConnectivityServiceTest
Bug: 68397798, 16207332
Change-Id: I3e1a6544c902bf3a79356b72d3616af1fd2b0f49
2017-11-01 19:05:42 -06:00
Tobias Thierer
52cb2d9ce4 Merge "Merge "Track moving of OkHttp facade API to new package." am: 3af8a3d48a am: 1f7fcb7970" into oc-mr1-dev-plus-aosp
am: f63d128dd9

Change-Id: Ibb562280213bdaa499787c0e6cfd371c553d4f1c
2017-10-30 18:32:55 +00:00
Tobias Thierer
ff55edaea6 Merge "Track moving of OkHttp facade API to new package." am: 3af8a3d48a
am: 1f7fcb7970

Change-Id: I16e01dde45dd70cfb4ea43a81e728350a5b26d3f
2017-10-30 18:05:53 +00:00
Tobias Thierer
3af8a3d48a Merge "Track moving of OkHttp facade API to new package." 2017-10-30 17:40:36 +00:00
Tobias Thierer
c8d921a034 Track moving of OkHttp facade API to new package.
Another CL in this topic moves the classes from
  libcore.net.http
to
  com.squareup.okhttp.internalandroidapi.
In jarjar'ed build targets, this becomes
  com.android.okhttp.internalandroidapi.

This facade constitutes the API via which non-libcore parts
of the Android platform (currently framework) may access
OkHttp. It's moving because libcore.net.http is already
part of libcore, and the overlap of packages is problematic
for builds with EXPERIMENTAL_USE_OPENJDK9 set to true.

Bug: 68220880
Test: Treehugger
Change-Id: Ia79966563cc0b5ab0923d54c21e54b6192d8c990
Exempt-From-Owner-Approval: Jeff Sharkey is an owner, but only one of his accounts is listed as an owner (@android.com vs. @google.com)
2017-10-30 17:40:23 +00:00
Manoj Boopathi Raj
7b76b5f4ac Merge "Fixed NullPointerException in IpSecService-Netd binder layer" am: 626046b7f5 am: a096e8d177
am: 6e94f3f675

Change-Id: I8c51bfa708622dfb47ae55438f08b98f04c1d6c6
2017-10-27 18:21:48 +00:00
Manoj Boopathi Raj
6e94f3f675 Merge "Fixed NullPointerException in IpSecService-Netd binder layer" am: 626046b7f5
am: a096e8d177

Change-Id: I23ea94140ac3e34fc92fdc6a2c0d694396489e03
2017-10-27 18:06:09 +00:00
Manoj Boopathi Raj
626046b7f5 Merge "Fixed NullPointerException in IpSecService-Netd binder layer" 2017-10-27 17:32:56 +00:00
TreeHugger Robot
0c025ac798 Merge "Register ConnectivityService with dumpsys priorities" 2017-10-26 23:45:46 +00:00
Manoj Boopathi Raj
03bb7d9304 Fixed NullPointerException in IpSecService-Netd binder layer
Replaced null with empty byte array in createTransportModeTransform
for null auth.getKey, crypt.getKey() and authCrypt.getKey()

Test: Ran CTS test
Bug: 68052730
Change-Id: I5110b1297b4bfbb5766e8ecfd3d64f8110b52945
2017-10-26 13:10:22 -07:00
Vishnu Nair
0701e42726 Register ConnectivityService with dumpsys priorities
Register service with HIGH and NORMAL priority suppport. Dump network diagnostics as part of the HIGH priority bucket.

Test: adb shell setprop dumpstate.version "2.0-dev-priority-dumps" && \
                adb bugreport ~/tmp_new.zip
Test: adb shell dumpsys --priority HIGH

Change-Id: I1ad263efbc264c3328e70dc9f7ddeb2d31bc4d41
2017-10-26 10:08:50 -07:00
Hugo Benichi
efc9cdb106 Merge changes I59b6e04f,I55694d89 am: bccc497249 am: 93134fea64
am: 2eca2c0e3a

Change-Id: I61f321ebd67432e02b5621fa1c662953295999fd
2017-10-26 06:34:27 +00:00
Hugo Benichi
2eca2c0e3a Merge changes I59b6e04f,I55694d89 am: bccc497249
am: 93134fea64

Change-Id: I923fe9cc37463e695182c7a279d201ba7e9d6518
2017-10-26 06:23:31 +00:00
Hugo Benichi
bccc497249 Merge changes I59b6e04f,I55694d89
* changes:
  Remove Parcelable interface from DefaultNetworkEvent
  Extract logging of default network events
2017-10-26 06:01:06 +00:00
Jeff Sharkey
e4df4919d7 Merge "Improve NetworkCapabilities docs." am: 14a51058b1 am: b385ba095b
am: 74653aa0b5

Change-Id: I33ef6f930529f9c6e8502613633fffccaa18c192
2017-10-25 17:54:35 +00:00
Jeff Sharkey
74653aa0b5 Merge "Improve NetworkCapabilities docs." am: 14a51058b1
am: b385ba095b

Change-Id: I3a685156e46c980078c3a91b36e9c1301c29240f
2017-10-25 17:35:44 +00:00
Hugo Benichi
7e86f2e10f Remove Parcelable interface from DefaultNetworkEvent
This patch takes advantage of the direct DefaultNetworkMetrics interface
between ConnectivityService and IpConnectivityMetrics and removes the
Parcelable interface from DefaultNetworkEvent.

IpConnectivityMetrics, IpConnectivityEventBuilder and associated tests
are updated as necessary.

Bug: 34901696
Test: runtest frameworks-net
Change-Id: I59b6e04fc126051320d08a422cfbd4d27042123e
2017-10-25 12:40:13 +09:00
Hugo Benichi
cd8d58c405 Extract logging of default network events
This patch extracts the logging of DefaultNetworkEvent from inside
ConnectivityService and move it to a new DefaultNetworkMetrics class.

The DefaultNetworkMetrics is a singleton owned by the
IpConnectivityMetrics singleton implementing the metrics service for
core networking. ConnectivityService has access to this singleton via
LocalServices.

This class layout will allow to remove the Parcelable interface of
DefaultNetworkEvent and will instead let the IpConnectivityMetrics
service grab metrics from the DefaultNetworkMetrics directly.

Bug: 34901696
Test: runtest frameworks-net
Change-Id: I55694d89124272732aba114198776462372de18b
2017-10-25 12:36:29 +09:00
Jeff Sharkey
20f339b7df Improve NetworkCapabilities docs.
Add IntDef for constants, and rely on new auto-documentation feature
to expand all of them at usage sites.

Test: docs-only change
Bug: 64133169
Change-Id: I8a6b5f54c8eb9d4fc7ae3d0d3fb673d52320664b
2017-10-24 21:26:04 -06:00
Benedict Wong
396f1030d3 Merge "Return a port from bindToPort() in IpSecService" am: 51de41dea2 am: 0d4a1ae642
am: a52b3a7775

Change-Id: I0d1c17c3740983ab0cbc24c2cd0d3a530b56ca99
2017-10-24 17:09:28 +00:00
Benedict Wong
a52b3a7775 Merge "Return a port from bindToPort() in IpSecService" am: 51de41dea2
am: 0d4a1ae642

Change-Id: Ie59d496a38bf9775c1f40a543a24cb3fec5719bf
2017-10-24 16:54:57 +00:00
Benedict Wong
0d4a1ae642 Merge "Return a port from bindToPort() in IpSecService"
am: 51de41dea2

Change-Id: I51705d5db6af560f2423ef7861bfde6734632ec9
2017-10-24 16:44:59 +00:00
Benedict Wong
51de41dea2 Merge "Return a port from bindToPort() in IpSecService" 2017-10-24 16:31:21 +00:00
Benedict Wong
ce0dababb2 Merge "Add support for AES-GCM-ESP as an IPSec algorithm" am: b6df7f0d35 am: f0d0bdc372 am: f92bfc3b77
am: 10a7405642

Change-Id: Ie9a43c7f0519a2d7ac3326944608190503804483
2017-10-19 17:48:53 +00:00
Benedict Wong
10a7405642 Merge "Add support for AES-GCM-ESP as an IPSec algorithm" am: b6df7f0d35 am: f0d0bdc372
am: f92bfc3b77

Change-Id: I49932a5fc048b4a60512fac45a3537f050397168
2017-10-19 17:37:22 +00:00
Benedict Wong
f0d0bdc372 Merge "Add support for AES-GCM-ESP as an IPSec algorithm"
am: b6df7f0d35

Change-Id: Ic099206a28c4f21fa796969c953a8d4e81e8495b
2017-10-19 17:14:53 +00:00
Benedict Wong
212777930f Return a port from bindToPort() in IpSecService
When binding to a random port, the port number was not being
returned, so the user is incorrectly receiving a port of zero.
Return the port number that was ultimately bound.

Bug: 67662580
Test: Ran CTS test on aosp_angler-eng
Change-Id: I22f4e5cdc83d43dc453788889990feb34e451bd3
2017-10-18 11:43:43 -07:00
Benedict Wong
edc1d285d7 Add support for AES-GCM-ESP as an IPSec algorithm
Allows native AES-GCM-ESP to be used as an IPSec transport/tunnel mode
algorithm with kernel support

Bug: 63589918
Test: IPsecService tests added, existing ones pass
Change-Id: Ie1a9a902be205f269aa37bf956198f2e5b177c21
2017-10-18 11:22:24 -07:00
Hugo Benichi
d551adff6d Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum" am: f7929f37b9 am: a5ea707a44 am: 4071792cce
am: fa684574da

Change-Id: I65c210d8f0ee27540339233d45def0c464920aea
2017-10-15 03:39:01 +00:00
Hugo Benichi
fa684574da Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum" am: f7929f37b9 am: a5ea707a44
am: 4071792cce

Change-Id: Id5ee94ae9a7e2a92289f2b25b0d5c0f0b5b7381a
2017-10-15 02:53:58 +00:00
Hugo Benichi
a5ea707a44 Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum"
am: f7929f37b9

Change-Id: I1cbe45eb339903630675713d287e3375c7c98e62
2017-10-15 02:24:52 +00:00
TreeHugger Robot
3d0712af87 Merge "Migrating remaining core networking tests to Junit4" 2017-10-13 05:26:31 +00:00
Hugo Benichi
739e2eacac Migrating remaining core networking tests to Junit4
Bug: 62918393
Test: runtest frameworks-net
Change-Id: I30f7eaa0307b8fad5a8de7a0da235a4f76c18677
2017-10-13 12:16:32 +09:00
Hugo Benichi
f7929f37b9 Merge "Fix ConnectivityServiceTest#testNetworkCallbackMaximum" 2017-10-13 01:44:36 +00:00
Hugo Benichi
602996fe25 Fix ConnectivityServiceTest#testNetworkCallbackMaximum
Although commit 2a84d1cbcf fixed some flakyness issues in
testNetworkCallbackMaximum so that it became stable when ran on its own,
it introduced a new source of random failures because instead of
registering callbacks after callbacks until a limit was reached, commit
2a84d1cbcf changed the test logic to push the assertions right up to
the theoretical limit.

More precisely when registering and unregistering PendingIntents in a
loop, not introducing some delay for checking that previous
PendingIntents have been effectively unregistered can cause the test to
fail. This patch fixes this issue.

Bug: 32561414
Bug: 62918393
Test: runtest frameworks-net
      testNetworkCallbackMaximum now succeeds 100 in a row on sailfish

Change-Id: I086817a738ab99fd53ba76ca8faada6151f46472
2017-10-12 23:15:14 +09:00
Hugo Benichi
795f7d79f9 Merge "Import a few android.net unit tests into frameworks-net" am: f851fef87f am: bf80e2f376 am: 3d4d464f0a
am: cf9ab489de

Change-Id: I4922d8505e641652cea028c6d60a0f9996b130e6
2017-10-12 12:45:11 +00:00
Hugo Benichi
cf9ab489de Merge "Import a few android.net unit tests into frameworks-net" am: f851fef87f am: bf80e2f376
am: 3d4d464f0a

Change-Id: Icf9ccd265754f1b85720bb778633dc5ef515646e
2017-10-12 12:34:55 +00:00
Hugo Benichi
bf80e2f376 Merge "Import a few android.net unit tests into frameworks-net"
am: f851fef87f

Change-Id: I41655938d6d1df19130847210437f047c8b65cdf
2017-10-12 12:13:20 +00:00
Hugo Benichi
f851fef87f Merge "Import a few android.net unit tests into frameworks-net" 2017-10-12 11:58:32 +00:00
Hugo Benichi
386407387b Merge "Migrate most of core networking tests to junit4" am: 649a997437 am: 06cfeaf51f am: c40687f85a
am: 470f4382fa

Change-Id: I44024c6cfe2bcb66f00a39ac9d97182ff62a23d1
2017-10-12 09:52:28 +00:00
Hugo Benichi
470f4382fa Merge "Migrate most of core networking tests to junit4" am: 649a997437 am: 06cfeaf51f
am: c40687f85a

Change-Id: Ic59ca37bbb31ba091c8b6d31170584b946c2527a
2017-10-12 09:43:11 +00:00
Hugo Benichi
06cfeaf51f Merge "Migrate most of core networking tests to junit4"
am: 649a997437

Change-Id: Ib124efb327bfbacd5a637753f9c9724e27a218cb
2017-10-12 09:24:40 +00:00
Treehugger Robot
649a997437 Merge "Migrate most of core networking tests to junit4" 2017-10-12 09:06:24 +00:00
Hugo Benichi
87d306b45f Import a few android.net unit tests into frameworks-net
Bug: 62918393
Test: runtest frameworks-net
Change-Id: I3c7c60bcfeffec5c5ec287810312349237a2868a
2017-10-12 15:55:22 +09:00