Commit Graph

2336 Commits

Author SHA1 Message Date
TreeHugger Robot
cc7a7e2c41 Merge "Remove "final" from ResultCallback." 2016-12-19 20:59:40 +00:00
Hugo Benichi
03835f7a63 Captive portals: login activity probes like NetworkMonitor am: cdf3ba48cc
am: 403ea607a5

Change-Id: I57a5a1a92385d4a3bf2fdd6bedeaf93430ecc158
2016-12-19 18:29:41 +00:00
Hugo Benichi
403ea607a5 Captive portals: login activity probes like NetworkMonitor
am: cdf3ba48cc

Change-Id: Ie85df7dd734b872cc361d0820edbfffc928f9f3a
2016-12-19 02:07:41 +00:00
Hugo Benichi
cdf3ba48cc Captive portals: login activity probes like NetworkMonitor
This patch changes CaptivePortalLoginActivity captive portal test to be
consistent with NetworkMonitor by:
 - using Network.java to open the http connection.
 - adding a UserAgent property to the request header.

Test: manually tested.
Bug: 32369183
Change-Id: I33cbcdab9809c712d998da6d925bdd4e3093f8ff
2016-12-19 09:19:13 +09:00
Jeremy Joslin
c28e6fcf94 Fix ScanResult array parceling.
readParcelableArray() wasn't working as expected so I just parceled
the array myself.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest  -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I47bc31adbedea817feaa5953cb6ee48506f9c6d6
2016-12-16 17:55:12 -08:00
Jeremy Joslin
145c343166 Implement the request and recommend calls.
Implemented requestRecommendation() and requestScores() to call
through to the bound network recommendation provider if available.

BUG: 33593157
BUG: 33668692
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Change-Id: I8e2ed73dc6876deb1a8bd47bcaeaca8db68f3a44
2016-12-16 13:30:16 -08:00
Jeremy Joslin
fa4f08ecee Implement the discovery of a network recommendation provider.
Updated the NetworkScorerAppManager to examine the list of configured
network recommendation providers and to select the first valid
provider.

As part of this update the old logic of looking for a valid network
scorer has been removed. Scorers/recommendation providers are only
selected from the configured list now. The setActiveScorer() method
has been deprecated as a result.

The NetworkScoreService has been updated to monitor the list of
potential recommendation providers and to reevaluate the binding
whenever they change. It also monitors the new setting for
NETWORK_RECOMMENDATIONS_ENABLED to connect or disconnect from the
provider as needed.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 33158362
Change-Id: I42aeb5223da794f71f7e58cb1bdf18817200cbf2
2016-12-16 13:30:03 -08:00
Mark Lu
bce1e456dc docs: changes to broadcast documentation am: 33ec106d22 am: 377dab8ab3 am: fd737791e8
am: 45d6ba7b98

Change-Id: I2dcb6bc7f8ebf385bc7d6a571a760c140a65e9fb
2016-12-16 05:30:20 +00:00
Mark Lu
45d6ba7b98 docs: changes to broadcast documentation am: 33ec106d22 am: 377dab8ab3
am: fd737791e8

Change-Id: I18b47ba01b0af8882c25526d8823f263f456aae2
2016-12-16 05:14:34 +00:00
Mark Lu
fd737791e8 docs: changes to broadcast documentation am: 33ec106d22
am: 377dab8ab3

Change-Id: I2e8377b188ce6a10ea633e089c3a20f9ef7908fd
2016-12-16 05:06:42 +00:00
Mark Lu
1c5a117342 docs: changes to broadcast documentation am: 33ec106d22
am: 377dab8ab3

Change-Id: I7dcb1bc57fb62f2b177c7ad15a9236da98fb749f
2016-12-16 05:06:37 +00:00
Joe LaPenna
facdb6fa76 Remove "final" from ResultCallback.
Removing final makes providers easier to test using mocks.

Test: Build system image.

Change-Id: Iaaa30f73226e1d0cb0e9e68faa349e86986be72d
2016-12-15 16:47:20 -08:00
TreeHugger Robot
87a66afec2 Merge "IP Connectivity metrics: add connect() statistics" 2016-12-15 16:09:18 +00:00
Hugo Benichi
0d4a398b78 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
2016-12-15 22:53:53 +09:00
Erik Kline
62c1d307e3 Merge "Have IpManager track L2-L4 signaling traffic required for IP connectivity." am: 80ff5ecd4a
am: cdcc931d93

Change-Id: Ib46bdab897cef221f4c22326e562130822d42298
2016-12-15 12:28:41 +00:00
Erik Kline
cdcc931d93 Merge "Have IpManager track L2-L4 signaling traffic required for IP connectivity."
am: 80ff5ecd4a

Change-Id: If85702e1cc44967841ab91d723aa627862bcda21
2016-12-15 12:22:06 +00:00
Erik Kline
0663d88344 Have IpManager track L2-L4 signaling traffic required for IP connectivity. am: 473355f96b
am: eff558cd30

Change-Id: Iccd81c5d722a14409fc4f22bc34c3607bca653da
2016-12-15 10:21:08 +00:00
Erik Kline
eff558cd30 Have IpManager track L2-L4 signaling traffic required for IP connectivity.
am: 473355f96b

Change-Id: Ie95309464d8f368f5040c74b59daba9700191e86
2016-12-15 10:13:36 +00:00
Erik Kline
ade3a8ccb0 Have IpManager track L2-L4 signaling traffic required for IP connectivity.
Test: as follows
    - built and flashed
    - observed logcat
    - observed "dumpsys wifi ipmanager"
    - runtest BlockingSocketReaderTest passes
    - runtest ConnectivityPacketSummaryTest passes
Bug: 21859053
Bug: 26101306
Bug: 31742572
Bug: 31707128
Bug: 33531488

Change-Id: Ibecaf809dcc1813924b25749e8ba8eb2d4bdf114
2016-12-15 19:09:49 +09:00
Erik Kline
473355f96b Have IpManager track L2-L4 signaling traffic required for IP connectivity.
Test: as follows
    - built and flashed
    - observed logcat
    - observed "dumpsys wifi ipmanager"
    - runtest BlockingSocketReaderTest passes
    - runtest ConnectivityPacketSummaryTest passes
Bug: 21859053
Bug: 26101306
Bug: 31742572
Bug: 31707128
Bug: 33531488

Change-Id: Ibecaf809dcc1813924b25749e8ba8eb2d4bdf114
2016-12-15 17:16:48 +09:00
Jeremy Joslin
9f15b30858 Merge "Add an IPC for requesting network scores." am: e89ed4a001 am: 724b26c902
am: a00fda5311

Change-Id: I5b529ba1f9a151e108229c493cbdc0facd494d30
2016-12-14 23:28:56 +00:00
Jeremy Joslin
a00fda5311 Merge "Add an IPC for requesting network scores." am: e89ed4a001
am: 724b26c902

Change-Id: If6284c934cd47257367c614523d4928758ab34e1
2016-12-14 23:22:15 +00:00
Jeremy Joslin
724b26c902 Merge "Add an IPC for requesting network scores."
am: e89ed4a001

Change-Id: I23bee3f29d3b3f71da6103e23afafc2df128ab75
2016-12-14 20:02:45 +00:00
Jeremy Joslin
e7f273d508 Add an IPC for requesting network scores.
Migrating the NetworkScoreManager.requestScores() method to use an
IPC rather than a broadcast.

Defined the new IPC in the AIDL files for NetworkScoreService and
NetworkRecommendationProvider. Added a no-op implementation in
NetworkScoreService and a full implementation in
NetworkRecommendationProvider (plus tests).

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
BUG: 33593157
Change-Id: Iacf7b6d424ec3c57e8b89e5abc6bc3e8414097b9
Merged-In: I951f6186aa11ddbe5a94e374173a1fd40b2a4cce
2016-12-14 09:11:29 -08:00
Michal Karpinski
b2e8690507 DO NOT MERGE [DPM] DO can start network logging and listen for events
am: c3abd34cfe

Change-Id: I7952d67d22a141040f3ee3ac2b6c3aa2cfccbbf7
2016-12-14 10:50:36 +00:00
Mark Lu
33ec106d22 docs: changes to broadcast documentation
- move BroadcastReceiver info to developer guide. see cl/140402421
- add usage note to CONNECTIVITY_ACTION broadcast

bug:32533262
bug:33106411

Change-Id: Ic2aa517831d29418e0c42aa6fc1e7f9aeb50f802
2016-12-13 18:28:32 -08:00
Jeremy Joslin
b2087a159b Add an IPC for requesting network scores.
Migrating the NetworkScoreManager.requestScores() method to use an
IPC rather than a broadcast.

Defined the new IPC in the AIDL files for NetworkScoreService and
NetworkRecommendationProvider. Added a no-op implementation in
NetworkScoreService and a full implementation in
NetworkRecommendationProvider (plus tests).

Test: adb shell am instrument -e class android.net.NetworkRecommendationProviderTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
BUG: 33593157
Change-Id: I951f6186aa11ddbe5a94e374173a1fd40b2a4cce
2016-12-13 17:06:56 -08:00
Michal Karpinski
c3abd34cfe DO NOT MERGE [DPM] DO can start network logging and listen for events
This CL adds:
1) Setter and getter in DPM to manipulate logging switch (retrieval
method to come in a subsequent CL(s)).
2) A way for DPM to register to listen for events.
3) Skeleton of NetworkLogger class (more to come in subsequent CL(s)).

Bug: 29748723
Change-Id: I5c04662ccc6febd2ba294b0eaca1ed1da9c16e47
2016-12-13 17:15:38 +00:00
Jeremy Joslin
63c577c510 Merge "Make the onRequestRecommendation() method async." am: fbeacb02c0 am: a6c6bc333d
am: eb0a34f26b

Change-Id: I62200f11d6be2bf83350255d9902dc67cf1a908e
2016-12-13 16:25:44 +00:00
Jeremy Joslin
eb0a34f26b Merge "Make the onRequestRecommendation() method async." am: fbeacb02c0
am: a6c6bc333d

Change-Id: I56a830273f8e3246b598c2ea7a027b87e3066e16
2016-12-13 16:19:14 +00:00
Jeremy Joslin
a6c6bc333d Merge "Make the onRequestRecommendation() method async."
am: fbeacb02c0

Change-Id: I9b98480499c2366eee06de163b561c4583e475d2
2016-12-13 16:13:44 +00:00
Hugo Benichi
b37d43b83c DO NOT MERGE IpConnectivityMetrics: rate limit ApfProgramEvents
am: 97d10ffcad

Change-Id: I266f7b8da58513b1e6c1a9c2b37e528ba777a7d6
2016-12-13 04:09:49 +00:00
Jeremy Joslin
280f82c312 Make the onRequestRecommendation() method async.
Converted the NetworkRecommendationProvider.onRequestRecommendation()
method into an async call to give implementors more flexibility.

Added unit tests for NetworkRecommendationProvider.

Test: Added NetworkRecommendationProviderTest.
BUG: 32909424
Change-Id: I8c1d2e11baa539744d77a012e85351f750523e3b
Merged-In: Iebe72f260133e9ad1946b0b75e2f69635e154ef3
2016-12-12 17:48:41 -08:00
TreeHugger Robot
03004291e1 Merge "Make the onRequestRecommendation() method async." 2016-12-13 01:34:25 +00:00
Hugo Benichi
97d10ffcad DO NOT MERGE IpConnectivityMetrics: rate limit ApfProgramEvents
This patch uses the previously introduced TokenBucket to rate limit
ApfProgramEvents, still allowing for burst of ApfProgramEvents when a
new interface is set up (due to ipv4 provisioning, multicast lock, ipv6 RAs
triggering new APF program events in short amounts of time).

Test: new test in IpConnectivityMetricsTest
Bug: 1550402

(cherry picked from commit e1c173d224)

Change-Id: Ibe41e9a76db36ea502697a5f19fc0d91c40a3087
2016-12-13 10:20:03 +09:00
Hugo Benichi
a948fb6bdc DO NOT MERGE NetworkMonitor metrics: add first validation information
am: dd22982e25

Change-Id: I9540a8357fd44cfcb17b244c66e5883f3a1a100b
2016-12-13 00:34:19 +00:00
sghuman
b191f3dc87 Merge "Fix erroneous constructor in ScoredNetwork.java" am: 9d55f43719 am: eaed9ef0b7 am: 60a850b670
am: 3339d5b120

Change-Id: Id8966b9d9ba127fe043b6110cb5556f15c56de54
2016-12-12 23:24:07 +00:00
sghuman
60a850b670 Merge "Fix erroneous constructor in ScoredNetwork.java" am: 9d55f43719
am: eaed9ef0b7

Change-Id: I0314c02497dcabd6f3fa1caeb665ff5ecb9a0f59
2016-12-12 23:12:36 +00:00
sghuman
eaed9ef0b7 Merge "Fix erroneous constructor in ScoredNetwork.java"
am: 9d55f43719

Change-Id: I6f24c92a9638f91197a4d17bfdc3fbeeede3daf4
2016-12-12 23:07:22 +00:00
Sundeep Ghuman
23f98ebe33 Fix erroneous constructor in ScoredNetwork.java
Test: Unit tests in ag/310934.
Change-Id: I0075b15f59796872ea9779c04373563607d2f883
2016-12-12 14:36:03 -08:00
Jeremy Joslin
9f38345a08 Merge "Update registerNetworkScoreCache() to accept a filter type." am: a511a07fa3
am: 4150ec18e9

Change-Id: I589bead5cf4e9f57f21c234d7d0b5d62cdb1e2b3
2016-12-10 00:11:12 +00:00
Jeremy Joslin
4150ec18e9 Merge "Update registerNetworkScoreCache() to accept a filter type."
am: a511a07fa3

Change-Id: I51983da8fe63db15d9b38e3ebe4a20cb95cb5f13
2016-12-10 00:06:37 +00:00
Jeremy Joslin
823db059e4 Update registerNetworkScoreCache() to accept a filter type.
Defined a new IntDef in NetworkScoreManager named CacheUpdateFilter
with 3 values. Caches must be registered with a filter value and will
only receive updates based on their registered filter. Actual
filtering implementation will follow.

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 32912120
Change-Id: I3ce0bee171e6405176358479fa8a532fd5193824
Merged-In: I8940e0ed1a7bbcb5a81fb3b6a7fafe4fbbc33875
2016-12-09 13:15:15 -08:00
Jeremy Joslin
375320edaa Make the onRequestRecommendation() method async.
Converted the NetworkRecommendationProvider.onRequestRecommendation()
method into an async call to give implementors more flexibility.

Added unit tests for NetworkRecommendationProvider.

Test: Added NetworkRecommendationProviderTest.
BUG: 32909424
Change-Id: Iebe72f260133e9ad1946b0b75e2f69635e154ef3
2016-12-09 09:57:32 -08:00
Hugo Benichi
dd22982e25 DO NOT MERGE 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

(cherry picked from commit 147aa6d53b)

Change-Id: I7ed954dee006f8804a5bf8940eec180714bddd07
2016-12-09 16:14:41 +09:00
Stephen Chen
963e8ddf6d DO NOT MERGE: Implement metered tracking for NetworkStats summary queries.
Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

(cherry picked from commit 2514787897)

Change-Id: I46da93ba4afa968facf98f7c3d844fd0c469095a
2016-12-09 13:59:33 +09:00
Hugo Benichi
21680fd25d DO NOT MERGE: 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

(cherry picked from commit 147aa6d53b)

Change-Id: Ie7a62c4f62a13ce52806d3adaa9e627cb246073c
2016-12-09 13:59:20 +09:00
Jeff Sharkey
dda938a698 DO NOT MERGE: Switch over to new "time.android.com" NTP pool.
Also add logging to measure success/failure details.

Test: builds, boots, and NTP fix obtained
Bug: 32969463

(cherry picked from commit d3f689bf14)

Change-Id: I7da416099ae903fd92beb516251ef4e51673eecf
2016-12-09 13:59:18 +09:00
Jeremy Joslin
ffe5a46b3e DO NOT MERGE: VPN network stat accounting changes.
Properly account for VPN apps that make heavy use of the tun
interface. Prior to this change a VPN app could be incorrectly charged
for more data than it actually used if it sent more traffic through
the tun interface than the underlying interface.

This change excludes VPN app traffic on the tun interface from the
adjustment pool and doesn't redistribute traffic to the VPN app.
Instead all of the redistributed traffic is deducted from the VPN app
which effectively represents any overhead incurred by the VPN app.

BUG: 30557871

(cherry picked from commit 8b436d865c)

Change-Id: I06f01aa8fe5fdc06b2d36cfb9c68feb244c2e5de
2016-12-09 13:42:29 +09:00
Hugo Benichi
ce765b7a51 DO NOT MERGE: ConnectivityThread: use lazy holder idiom
This patch changes the way that the ConnectivityThread is lazily
instantiated by using the "lazy initialization holder class idiom".

The first code point that tries to obtain a reference to the unique
ConnectivityThread instance will trigger the creation of the Singleton
class, which will guarantee a thread-safe initialization of the static
INSTANCE field inside Singleton according to the language specs.

This is the Item #71 of Effective Java.

The unique static instance of ConnectivityThread is not stored directly
inside ConnectivityThread class but is stored in a static nested class.
This is to avoid triggering the creation of that unique instance when
Zygote does class preloading at phone startup. Otherwise this would lead
to Zygote creating a new OS thread during preloading, which is a fatal
error.

Test: frameworks-wifi tests pass
Bug: 26749700
Bug: 28537383
Bug: 32130437

(cherry picked from commit c4fe5d373c)

Change-Id: If13b363889a8e9396273a90c3d9f9421a48aecbc
2016-12-09 13:42:26 +09:00