194 Commits

Author SHA1 Message Date
Erik Kline
5f2b7992cf Tethering: support Local-only Hotspot mode for downstreams
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - "runtest frameworks-net" passes
Bug: 31466854

Change-Id: Ia50e28c8ce0af8cdd7ac63217d921aff213668e7
2017-04-10 21:42:16 +09:00
Hugo Benichi
938ab4fa39 Move back networking policy logic into NetworkPolicyManagerService
This patch removes from ConnectivityService the logic involved in
deciding if a uid has access to networking based on networking policies.

This logic is moved into NetworkPolicyManagerService which is the source
of truth with regards to the state of networking policie, both for
existing networks and uids.

Instead ConnectivityService directly queries NetworkPolicyManagerService
in a synchronous fashion for a specific uid or a (uid, network) pair.

This eliminates the need to keep a copy of the uid policy rules inside
ConnectivityService and ensures that ConnectivityService takes
networking decisions based on the correct state of networking policies,
and therefore eliminates certain data races in ConnectivityManager API
that applications are exposed to.

Test: $ runtest frameworks-net
      $ runtest -x frameworks/base/services/tests/../NetworkPolicyManagerServiceTest.java
      $ runtest -c com.android.server.net.ConnOnActivityStartTest frameworks-services
Bug: 32069544, 30919851
Change-Id: Ic75d4f7a8853e6be20e51262c4b59805ec35093a
2017-03-31 13:28:45 +09:00
TreeHugger Robot
ff51916f83 Merge "Fix NetworkNotificationManagerTest" 2017-03-23 06:25:38 +00:00
Hugo Benichi
f8b804be5a Fix NetworkNotificationManagerTest
The testNotificationsShownAndCleared test was not doing anything
because the list of notification to show was always empty.

This patch fixes this issue and actually makes the test loop on
non-empty collections, and also fixes another ordering issue in
assertions themselves, hidden until now by the first issue.

Test: runtest -x frameworks/base/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
Change-Id: I4837b1175d7c9133e9156e33acaa1e7e3341cc62
2017-03-23 12:32:27 +09:00
Dan Shi
874a0916fc Merge "Add test configs to apct tests under frameworks/base" 2017-03-22 17:55:58 +00:00
Dan Shi
7f2afd2dff Add test configs to apct tests under frameworks/base
TouchLatency is needed by test TouchLatencyJankTestWear
UiBench is needed by test UiBenchJankTests

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
make -j32 TouchLatency TouchLatencyJankTestWear  && \
tradefed.sh run template/local --template:map test=TouchLatencyJankTestWear \
      --test-tag testname --log-level-display VERBOSE
make -j32 UiBenchJankTests UiBench  && \
tradefed.sh run template/local --template:map test=UiBenchJankTests \
      --test-tag testname --log-level-display VERBOSE

Change-Id: I63f23e3a21ad1343607953958fb7bb0a5fb8c343
2017-03-21 00:05:14 -07:00
Hugo Benichi
f927f0c52e 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
2017-03-21 11:43:18 +09:00
Hugo Benichi
948a85948d 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
2017-03-21 10:18:56 +09:00
Hugo Benichi
73fd4d1faf Connectivity metrics: serialize networkId, transports, ifname
This patch adds translation from ConnectivityMetricsEvent to
IpConnectivityEvent of recently added fields:
 - top-level network id
 - top-level ifname
 - transports

Also adds inference of link layer from transports or ifname.

At the moment these new fields are not populated in
ConnectivityMetricsEvent. Follow-up patches will fill this gap for
the events of the android.net.metrics package.

Test: new unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I563a6a3183470bdfaabb7c781a1beaf6b1058bf0
2017-03-21 10:18:11 +09:00
TreeHugger Robot
587b60282e Merge "frameworks/base: Add APCT tests to the device-tests suite." 2017-03-16 17:35:12 +00:00
TreeHugger Robot
44d5d0c2fb Merge "ConnectivityMetricsEvent: add ifname, netid, transports" 2017-03-16 02:50:23 +00:00
Hugo Benichi
946b7e424e 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
2017-03-16 09:58:02 +09:00
Hugo Benichi
97035b4abf Merge "Connectivity metrics: simplify ConnectivityMetricsEvent" 2017-03-16 00:37:47 +00:00
Simran Basi
473a16e492 frameworks/base: Add APCT tests to the device-tests suite.
This CL adds the APCT tests within this project to
a similar suite as CTS known as device-tests.

The current method of running APCT tests in the infrastructure
is unaffected.

Bug: 35882476
Test: `make dist device-tests -j` and local builds of
      continuous_instrumentation_tests & continuous_native_tests

Change-Id: Ifa382fe691842c1cd76897775b9e2a1653449eb5
2017-03-15 14:46:27 -07:00
Hugo Benichi
ec27c4d9f3 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
2017-03-15 15:12:38 +09:00
TreeHugger Robot
1809db5cb1 Merge "IP connectivity metrics: add new APF counters." 2017-03-15 04:24:30 +00:00
Hugo Benichi
22d9b2d430 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
2017-03-15 11:49:48 +09:00
Erik Kline
0df5ea973d Merge "Address some comments on IpManagerTest" am: b2afa1ede5 am: dea2371e71
am: eb04c52063

Change-Id: I8716a2f49c6adec97b260c32d65d53414068e41d
2017-03-14 06:17:39 +00:00
Erik Kline
dea2371e71 Merge "Address some comments on IpManagerTest"
am: b2afa1ede5

Change-Id: Ic986c23c693757b8311e0de0c0a94281db67f62d
2017-03-14 06:08:34 +00:00
Erik Kline
246bc1f795 Address some comments on IpManagerTest
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 26991160
Change-Id: Ib543874188537e31422206d67d1760762a7c85cd
2017-03-14 13:02:49 +09:00
Erik Kline
a93f236c73 Merge "Skeleton of an IpManagerTest" am: db4333a2c2 am: cf07e0d541
am: 4e8ae3eddc

Change-Id: I25dd93146efe7ce1cd9cb81da19dcb44afc96bd3
2017-03-14 03:25:04 +00:00
Erik Kline
cf07e0d541 Merge "Skeleton of an IpManagerTest"
am: db4333a2c2

Change-Id: I5817c2458c222afb85389deaf22b43d245577b2a
2017-03-14 03:11:15 +00:00
Erik Kline
aa95ae57ec Skeleton of an IpManagerTest
Test: as follows
    - biult (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 26991160
Change-Id: Idddddf0c1a7a8d0a8acff8a5526b02a533d5f3ec
2017-03-14 10:19:52 +09:00
Hugo Benichi
a2decca4f2 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
2017-03-13 09:25:15 +09:00
Hugo Benichi
f684050e8f IP connectivity metrics: update ipconnectivity.proto
This patch adds several new fields to ipconnectivity.proto for
improving APF metrics, connect metrics, and link_layer inference.

Test: build, flashed, ran $ adb shell dumpsys connmetrics list proto
      updated metrics unit tests depending on proto schema
Bug: 34901696
Change-Id: I6f68e16f583a6b407f33f8a500133e100f3453c7
2017-03-09 15:19:02 +09:00
TreeHugger Robot
a6a31fd3eb Merge "Fix ApfTest" 2017-03-08 03:11:15 +00:00
Hugo Benichi
22291f84e0 Fix ApfTest
By adding missing native libraries to frameworks-net make file. The list
of missing libraries was found by adding libhidlbase and then resolving
new linkage errors iteratively until ApfTest worked.

This is a temporary fix. Ideally only adding libhidlbase should be
enough.

Test: $ runtest -x frameworks/base/tests/net/java/android/net/apf/ApfTest.java
Bug: 36012053
Change-Id: I0eff8b3adbf788ddbfc6ddbf9f74b8da01cdfce4
2017-03-08 10:33:57 +09:00
Erik Kline
a33ae2d884 Merge "request{LinkProperties,NetworkCapabilities} no longer needed" am: 75dfc5bd91 am: 0f901af920
am: bb54baba04

Change-Id: Id2aa8aeff6d299edb85955c12ab0a04023458597
2017-03-07 13:42:11 +00:00
Erik Kline
0f901af920 Merge "request{LinkProperties,NetworkCapabilities} no longer needed"
am: 75dfc5bd91

Change-Id: I79b9323be242ed5d2bf83962f78c613a465a20b8
2017-03-07 13:33:29 +00:00
Erik Kline
465c46d555 request{LinkProperties,NetworkCapabilities} no longer needed
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - manual USB tethering toggling between WiFi and mobile
Bug: 32163131
Change-Id: I57edf5114b6361f320577c7870e40f8b3cdf74ce
2017-03-07 17:18:06 +09:00
Erik Kline
6bbefcbf40 Merge "Always send all available state when calling onAvailable()." am: affbb8b6a9 am: e0a62a4398
am: 3765538bab

Change-Id: Ic82e3cb92841ea99972faad6ae004d77c725831b
2017-03-07 06:08:40 +00:00
Erik Kline
e0a62a4398 Merge "Always send all available state when calling onAvailable()."
am: affbb8b6a9

Change-Id: I81e70fecf060a4103b51084a60a32c78f6219f6b
2017-03-07 06:00:09 +00:00
Erik Kline
c75d4fad22 Always send all available state when calling onAvailable().
The state that needs to be transferred includes:
    - NetworkCapabilities
    - LinkProperties
    - whether the network is currently suspended

Additionally:
    - Rename notifyNetworkCallback() to notifyNetworkAvailable()
      in order to clarify its real function.
    - fix previous copy/paste error in unittest

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - USB tethering with mobile and Wi-Fi upstream toggling
Bug: 32163131
Change-Id: Ib4460bcd5d08863a9feac9e8ab41a238897bb3ea
2017-03-07 12:57:26 +09:00
Hugo Benichi
45deba76fc Merge "Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499." am: 704520c392 am: 4cf199383f
am: 22d4258a75

Change-Id: I8e66e223003a38735b707d21d7bedb19170b1937
2017-03-06 12:45:10 +00:00
Hugo Benichi
4cf199383f Merge "Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499."
am: 704520c392

Change-Id: Ia0ae78f8406b81377491407cf5ef8ca339952def
2017-03-06 12:30:05 +00:00
Hugo Benichi
649e32484e Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499.
This reverts commit faa70976b490116323107166f90fdd944c5bdc77.

Change-Id: I86c07c113f24753be7c977e6d7f570b99391e1b5
2017-03-06 06:16:51 +00:00
Hugo Benichi
00a5f2a658 Merge "ConnectivityManager: no double NetworkCallback registration" am: 06a192fa49 am: 5983a772cb
am: 974e83cc0b

Change-Id: I73569fd084c14a78067e09565418f296994cd424
2017-03-02 08:12:09 +00:00
Hugo Benichi
5983a772cb Merge "ConnectivityManager: no double NetworkCallback registration"
am: 06a192fa49

Change-Id: I250fa7d3c5e37a66caa41cc898a44bcb18c9a0c4
2017-03-02 08:04:03 +00:00
Hugo Benichi
faa70976b4 ConnectivityManager: no double NetworkCallback registration
Test: new test in ConnectivityManagerTest
Bug: 20701525
Change-Id: I205333d31d43e6e6c7fe704ce63b458065f345ce
2017-03-02 15:19:37 +09:00
Erik Kline
df71c58341 Merge "Also test for additional NetworkCallback calls" am: dff6c5c30d am: 47d8385184
am: 02310829cf

Change-Id: I0264a471312423e896a1c2f479c0eeda737a1567
2017-03-01 11:13:14 +00:00
Erik Kline
47d8385184 Merge "Also test for additional NetworkCallback calls"
am: dff6c5c30d

Change-Id: I00b3f7be06bde167872d0cdefe940cda5e138846
2017-03-01 11:03:08 +00:00
Erik Kline
1d3db32708 Also test for additional NetworkCallback calls
Specifcally:
    - onCapabilitiesChanged
    - onLinkPropertiesChanged
    - onNetworkSuspended

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 32163131

Change-Id: Ie0f7c8ac21313b11980bb335c89ecde6fd8e311c
2017-03-01 18:24:36 +09:00
Erik Kline
e20e7ebbfb Merge "Update UpstreamNetworkMonitor to use custom Handlers" am: 35c89886c2 am: 279a4feb72
am: c239511cdb

Change-Id: I9a210b4896810e7365b2403495716395b3866650
2017-02-24 08:24:51 +00:00
Erik Kline
279a4feb72 Merge "Update UpstreamNetworkMonitor to use custom Handlers"
am: 35c89886c2

Change-Id: I76433822a9b7c124e4b7cfcf2a20cb0e43a60199
2017-02-24 08:15:19 +00:00
Erik Kline
b583b03675 Update UpstreamNetworkMonitor to use custom Handlers
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 32130437
Bug: 32163131

Change-Id: I2bc3f87cdf7fa6392b4750eb8adb4ea33c6a3f43
2017-02-24 13:06:51 +09:00
Hugo Benichi
95cb226c1a 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
2017-02-22 12:56:38 +09:00
Hugo Benichi
01432b306d resolve merge conflicts of 9355bce0c323 to master
Test: none
Change-Id: Iac65e01d07edf79ec97e7d996f8cfee6f811606b
2017-02-17 10:47:58 +09:00
Hugo Benichi
9355bce0c3 Merge "IP connectivity metrics: delete obsolete logger service" am: 37e3f22c2e am: c54962a4bd
am: 9c2b6afa2f

Change-Id: I5f8cd508812d9532778c2f1f019308a4b8d8ee33
2017-02-17 00:18:35 +00:00
Hugo Benichi
c54962a4bd Merge "IP connectivity metrics: delete obsolete logger service"
am: 37e3f22c2e

Change-Id: Ib335bc5e19c2c703d23267bf2835fc89fcf5a957
2017-02-17 00:00:14 +00:00
Hugo Benichi
37e3f22c2e Merge "IP connectivity metrics: delete obsolete logger service" 2017-02-16 23:52:13 +00:00