Commit Graph

2917 Commits

Author SHA1 Message Date
Jeff Sharkey
595987e619 Merge "Augment network stats based on SubscriptionPlan." into oc-mr1-dev am: f31cf45e82
am: 8ab5f7f324

Change-Id: Ica24924ff8e5c95bd14114fb0a1d82c21a7d30d4
2017-08-30 19:27:49 +00:00
Jeff Sharkey
8ab5f7f324 Merge "Augment network stats based on SubscriptionPlan." into oc-mr1-dev
am: f31cf45e82

Change-Id: Ia6c6d5893d841f21d181363dc01f77efa6579a8f
2017-08-30 19:14:21 +00:00
Jeff Sharkey
f4de294297 Augment network stats based on SubscriptionPlan.
When a carrier provides an "anchor" of data usage at a specific
moment in time, augment the network statistics used by warning/limit
thresholds and Settings UI.  For example, if the OS measured 500MB
of usage, but the carrier says only 400MB has been used, we "squish"
down the OS measured usage to match that anchor.

Callers using the hidden API will have their data augmented by
default, and the public API offers a way to opt-into augmentation.

Thorough testing to verify behavior.

Test: bit FrameworksNetTests:android.net.,com.android.server.net.
Test: cts-tradefed run commandAndExit cts-dev -m CtsUsageStatsTestCases -t android.app.usage.cts.NetworkUsageStatsTest
Bug: 64534190
Change-Id: Id3d4d7625bbf04f57643e51dbf376e3fa0ea8eca
2017-08-30 10:01:10 -06:00
Alex Klyubin
bb2bd9fb9a Merge "Delete android.net.PskKeyManager" 2017-08-25 19:44:14 +00:00
Etan Cohen
81c76a98f9 Merge "[CS] Allow network factory implementations to re-evaluate requests" into oc-mr1-dev am: 19f12028b7
am: 58d610c5c2

Change-Id: I094ac271142898f356195ad23a7503121bae8b2a
2017-08-24 20:10:50 +00:00
Etan Cohen
58d610c5c2 Merge "[CS] Allow network factory implementations to re-evaluate requests" into oc-mr1-dev
am: 19f12028b7

Change-Id: I2a99242470c37ca423221ff31e2fdd72ea53d4f1
2017-08-24 19:54:06 +00:00
Etan Cohen
896c574bde [CS] Allow network factory implementations to re-evaluate requests
Change the evalRequests() API to protected to allow network factory
implementations to call the API.

A use-case of the API change is for factories temporarily reject a
request since they cannot fullfill it immediately but retry it at a
later time if/when conditions change.

Bug: 63866251
Test: integration tests
Change-Id: Idc50ce0799c67634b7b2fdbad78a26e443caf2e4
2017-08-24 06:47:55 -07:00
TreeHugger Robot
15628f8092 Merge "Check contents of Bundle for ScoredNetwork.equals" 2017-08-22 22:31:54 +00:00
Stephen Chen
4efd1ca536 Check contents of Bundle for ScoredNetwork.equals
Bundle just uses object equality, so this improves the equality of
ScoredNetwork by checking the contents of the bundle.

Bug: 34824590
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/ScoredNetworkTest.java

Change-Id: I1c39e574d4e1e23e0155467302be5e34076fe9a0
2017-08-22 11:09:02 -07:00
Tobias Thierer
34a555122e Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" am: be87c9ca58 am: 70b000e6e2 am: 0aa55f7b2c am: 6376859a98
am: 45ade15a7c

Change-Id: I94d4593ff8234c9ee4340b3b2e733ae936177e48
2017-08-22 15:51:15 +00:00
Tobias Thierer
45ade15a7c Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" am: be87c9ca58 am: 70b000e6e2 am: 0aa55f7b2c
am: 6376859a98

Change-Id: I1ed6962088be8a0999b81a19d84f5c1c7203dddb
2017-08-22 15:40:30 +00:00
Tobias Thierer
6376859a98 Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" am: be87c9ca58 am: 70b000e6e2
am: 0aa55f7b2c

Change-Id: I048a7695ec98711163494e3dedab785e1400d1da
2017-08-22 15:28:07 +00:00
Tobias Thierer
0aa55f7b2c Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" am: be87c9ca58
am: 70b000e6e2

Change-Id: I0e15e22f4e1561102012b012cdea74db63ac2163
2017-08-22 15:16:31 +00:00
Tobias Thierer
70b000e6e2 Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs"
am: be87c9ca58

Change-Id: I79db2f0dc0870f71ec21397545e2e6abb5c7142b
2017-08-22 15:00:24 +00:00
Tobias Thierer
be87c9ca58 Merge "Network: Use HttpURLConnectionFactory rather than OkHttp APIs" 2017-08-22 14:07:16 +00:00
Lorenzo Colitti
b9fc12d1d2 Merge changes I325b13d5,I89719fe7 am: 23868e9c09 am: 9335d2d0b1
am: 4fa0187015

Change-Id: Ib980879b0e50ffe1c8209339df22da4a50d5b74e
2017-08-19 03:38:10 +00:00
Lorenzo Colitti
4fa0187015 Merge changes I325b13d5,I89719fe7 am: 23868e9c09
am: 9335d2d0b1

Change-Id: Iac0d1a08c45816f32b0f8ab81a079883a9965e21
2017-08-19 03:25:21 +00:00
Lorenzo Colitti
9335d2d0b1 Merge changes I325b13d5,I89719fe7
am: 23868e9c09

Change-Id: Iaced543ab17ea87c8f701975764d957bc1b17fc7
2017-08-19 03:15:08 +00:00
Treehugger Robot
23868e9c09 Merge changes I325b13d5,I89719fe7
* changes:
  Add tether offload traffic to interface stats as well.
  Tell the system when tethering offload hits a limit.
2017-08-19 03:05:14 +00:00
Lorenzo Colitti
203c935d74 Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev am: 21bc3a39a4
am: 1af850fdfe

Change-Id: I2b586b84c44126e1d3b9097950a41decaa5216cc
2017-08-19 01:12:35 +00:00
Lorenzo Colitti
f1912ca49a Add tether offload traffic to interface stats as well.
Currently, we only count add tethering traffic to per-UID
stats, but not to total data usage (i.e., dev and XT stats). This
is correct for software tethering, because all software forwarded
packets are already included in interface counters, but it is
incorrect for hardware offload, because such packets do not
increment interface counters.

To fix this:
1. Add an argument to ITetheringStatsProvider#getTetherStats to
   indicate whether per-UID stats are requested. For clarity,
   define integer constants STATS_PER_IFACE and STATS_PER_UID
   to represent these operations.
2. Make NetdTetheringStatsProvider return stats only if per-UID
   stats are requested. (Otherwise tethering traffic would be
   double-counted).
3. Make OffloadController's stats provider return the same
   stats regardless of whether per-UID stats were requested or
   not.
4. Make NetworkStatsService add non-per-UID tethering stats to
   the dev and XT snapshots. The per-UID snapshots were already
   correctly adding in per-UID stats.

(cherry picked from commit 5356a35c3b)

Bug: 29337859
Bug: 32163131
Test: runtest frameworks-net
Test: runtest frameworks-telephony
Change-Id: I325b13d50e88841dfb0db4c35e7e27f163ee72fe
Merged-In: I4e8e923d68dce1a4a68608dbd6c75a91165aa4ee
2017-08-19 10:12:05 +09:00
Lorenzo Colitti
1af850fdfe Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev
am: 21bc3a39a4

Change-Id: I4e8e923d68dce1a4a68608dbd6c75a91165aa4ee
2017-08-19 01:02:33 +00:00
Lorenzo Colitti
21bc3a39a4 Merge "Add tether offload traffic to interface stats as well." into oc-mr1-dev 2017-08-19 00:54:59 +00:00
Alex Klyubin
fff7295026 Delete android.net.PskKeyManager
android.net.PskKeyManager was @remove'd in Android O (API Level 26)
which means it may still be available on Android O platform, but is
not part of its public API. This commit deletes this class from
future platform versions.

The reasoning for the removal of this class is that:
1. it is incompatible with TLS 1.3, and
2. TLS-PSK cannot be exposed as a standalone primitive in a safe by
   default way. There is no way for such primitive to ensure that
   it is used with a shared secret which is not hard-coded into the
   app or is otherwise publicly known.

Test: make
Test: Run a test app which uses PskKeyManager -- the app crashes
      because the class is not found
Bug: 34722996
Change-Id: I5f9a1a1784004b1387ef756eadf8fa06796c96bc
2017-08-18 14:58:06 -07:00
TreeHugger Robot
0f9774e1d9 Merge "Cleaned up the permission checks in NetworkScoreService" 2017-08-18 16:20:43 +00:00
Lorenzo Colitti
5356a35c3b Add tether offload traffic to interface stats as well.
Currently, we only count add tethering traffic to per-UID
stats, but not to total data usage (i.e., dev and XT stats). This
is correct for software tethering, because all software forwarded
packets are already included in interface counters, but it is
incorrect for hardware offload, because such packets do not
increment interface counters.

To fix this:
1. Add an argument to ITetheringStatsProvider#getTetherStats to
   indicate whether per-UID stats are requested. For clarity,
   define integer constants STATS_PER_IFACE and STATS_PER_UID
   to represent these operations.
2. Make NetdTetheringStatsProvider return stats only if per-UID
   stats are requested. (Otherwise tethering traffic would be
   double-counted).
3. Make OffloadController's stats provider return the same
   stats regardless of whether per-UID stats were requested or
   not.
4. Make NetworkStatsService add non-per-UID tethering stats to
   the dev and XT snapshots. The per-UID snapshots were already
   correctly adding in per-UID stats.

Bug: 29337859
Bug: 32163131
Test: runtest frameworks-net
Test: runtest frameworks-telephony
Change-Id: I7a4d04ab47694d754874136179f8edad71099638
2017-08-19 00:21:56 +09:00
Hugo Benichi
fde112a2eb Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities" into oc-mr1-dev 2017-08-18 11:46:22 +00:00
Hugo Benichi
322df2899b Merge "Add convenience methods to IpPrefix and LinkAddress" into oc-mr1-dev 2017-08-17 22:31:59 +00:00
Jeremy Joslin
1588b3b034 Cleaned up the permission checks in NetworkScoreService
Refactored the existing code into 3 permission check methods
to clear up what was being checked and to centralize the logic.

Bug:64313251
Test: bit services FrameworksServicesTests:com.android.server.NetworkScoreServiceTest
Test: bit FrameworksWifiTests:*
Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.netrec.NetRecHostTest
Change-Id: I77457ce7cf98252e83f4dfa6602da0179d638818
2017-08-17 15:19:15 -07:00
Charles He
337ee0771e Merge "Opt-out for always-on VPN: rename API." into oc-mr1-dev
am: 8b2513e439

Change-Id: Ie511c6f1034b75b4e797dbc0ca31c7c5c30f336e
2017-08-17 08:01:53 +00:00
Charles He
8b2513e439 Merge "Opt-out for always-on VPN: rename API." into oc-mr1-dev 2017-08-17 07:54:05 +00:00
Hugo Benichi
6e833f27aa Add convenience methods to IpPrefix and LinkAddress
Also moving relevant test files into tests/net as part of runtest
framworks-net.

Also removes testHashCode in LinkAddress() because this test relies on
the assumption that hashCode() is stable across releases or jdk
versions, which is absolutely not true.

This creates maintenance work for little benefit since hashCode is
already tested as part of the equality test.

For instance this test is now broken because hashing for InetAddress
changed.

Bug: 62988545
Bug: 62918393
Test: runtest frameworks-net, added coverage in tests
Merged-In: I695bc3f0e801bf13bc4fc0706565758f12b775b4
Merged-In: I6d3f3c50eaec44e3a0787e849ab28e89f6f4a72d
Merged-In: Iddfec82a08f845e728adadfa6ec58a60a078d6af
Merged-In: I8d6dd5efd226a8b1c4b05d1e1102362b58e094a1
Merged-In: Ied0cc53ac34c7c5f5539507b1979cbf9c215262e
Merged-In: I3b2b7dcb1a9a194fc08643b27bbb5a0e84e01412

(cherry picked from commit 1dfb6b6755)

Change-Id: I9a17094bfdc54b9dec671306618e132a4beb59fc
2017-08-17 11:03:24 +09:00
Hugo Benichi
86fc53aa7a Allow NetworkAgent "immutable updates" to NetworkCapabilities
This patch loosens the validation checks when a NetworkAgent updates it
NetworkCapabilities: instead of checking that capabilities labeled as
"immutable" stay identical across updates, it is now accepted to change
immutable capabilities in a way that the new NetworkCapabilities
satisfies the old NetworkCapabilities.

This allows a NetworkAgent to update itself in order to match more
requests, but will still catch NetworkAgents that sends degradation
updates causing potentially requests to not match anymore.

Bug: 64125969
Test: runtest frameworks-net
Merged-In: I2a1b3f9c0be6415e40edc989d0c1b03b5631f7b1
Merged-In: I0ab76de59e87c46a6961229399ff7200bce49838
Merged-In: Ied592bf6112574399a1e808da337004e1c35f244
Merged-In: I01e287b4df82a53a522566d33b3166f7801badca
Merged-In: I7ee60daa9c4266e9b9179032815dd7267e06377f
Merged-In: I31ef741eb83d64c476e5930d5762514b5d4cb16f

(cherry picked from commit bae105a5cc)

Change-Id: I9d630d63336f4db69f3eb52faa8483f1b1e35d16
2017-08-17 10:48:41 +09:00
Hugo Benichi
202cc407c2 Merge "Add convenience methods to IpPrefix and LinkAddress" am: 2ad60c88f1 am: ea2defe62b am: 4d7787a310
am: e9291de0c4

Change-Id: Ied0cc53ac34c7c5f5539507b1979cbf9c215262e
2017-08-16 15:20:59 +00:00
Hugo Benichi
e9291de0c4 Merge "Add convenience methods to IpPrefix and LinkAddress" am: 2ad60c88f1 am: ea2defe62b
am: 4d7787a310

Change-Id: I8d6dd5efd226a8b1c4b05d1e1102362b58e094a1
2017-08-16 15:09:12 +00:00
Hugo Benichi
4d7787a310 Merge "Add convenience methods to IpPrefix and LinkAddress" am: 2ad60c88f1
am: ea2defe62b

Change-Id: Iddfec82a08f845e728adadfa6ec58a60a078d6af
2017-08-16 14:56:51 +00:00
Hugo Benichi
ea2defe62b Merge "Add convenience methods to IpPrefix and LinkAddress"
am: 2ad60c88f1

Change-Id: I6d3f3c50eaec44e3a0787e849ab28e89f6f4a72d
2017-08-16 14:49:27 +00:00
Treehugger Robot
2ad60c88f1 Merge "Add convenience methods to IpPrefix and LinkAddress" 2017-08-16 14:38:29 +00:00
Hugo Benichi
1dfb6b6755 Add convenience methods to IpPrefix and LinkAddress
Also moving relevant test files into tests/net as part of runtest
framworks-net.

Also removes testHashCode in LinkAddress() because this test relies on
the assumption that hashCode() is stable across releases or jdk
versions, which is absolutely not true.

This creates maintenance work for little benefit since hashCode is
already tested as part of the equality test.

For instance this test is now broken because hashing for InetAddress
changed.

Bug: 62988545
Bug: 62918393
Test: runtest frameworks-net, added coverage in tests
Change-Id: I695bc3f0e801bf13bc4fc0706565758f12b775b4
2017-08-16 21:42:21 +09:00
Hugo Benichi
d1e7fc23ae Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities" am: b35719a057 am: 2f9fd9df23 am: f2ac860b7c
am: cd7393c641

Change-Id: I7ee60daa9c4266e9b9179032815dd7267e06377f
2017-08-16 12:23:25 +00:00
Hugo Benichi
cd7393c641 Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities" am: b35719a057 am: 2f9fd9df23
am: f2ac860b7c

Change-Id: I01e287b4df82a53a522566d33b3166f7801badca
2017-08-16 12:14:09 +00:00
Hugo Benichi
f2ac860b7c Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities" am: b35719a057
am: 2f9fd9df23

Change-Id: Ied592bf6112574399a1e808da337004e1c35f244
2017-08-16 12:04:38 +00:00
Hugo Benichi
2f9fd9df23 Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities"
am: b35719a057

Change-Id: I0ab76de59e87c46a6961229399ff7200bce49838
2017-08-16 11:50:55 +00:00
Treehugger Robot
b35719a057 Merge "Allow NetworkAgent "immutable updates" to NetworkCapabilities" 2017-08-16 11:34:24 +00:00
Hugo Benichi
bae105a5cc Allow NetworkAgent "immutable updates" to NetworkCapabilities
This patch loosens the validation checks when a NetworkAgent updates it
NetworkCapabilities: instead of checking that capabilities labeled as
"immutable" stay identical across updates, it is now accepted to change
immutable capabilities in a way that the new NetworkCapabilities
satisfies the old NetworkCapabilities.

This allows a NetworkAgent to update itself in order to match more
requests, but will still catch NetworkAgents that sends degradation
updates causing potentially requests to not match anymore.

Bug: 64125969
Test: runtest frameworks-net
Change-Id: I2a1b3f9c0be6415e40edc989d0c1b03b5631f7b1
2017-08-16 18:30:30 +09:00
Charles He
c57a01c166 Opt-out for always-on VPN: rename API.
Rename the opt-out flag in AndroidManifest to
SERVICE_META_DATA_SUPPORTS_ALWAYS_ON
as directed by the API Council.

Bug: 64331776
Bug: 36650087
Test: runtest --path java/com/android/server/connectivity/VpnTest.java
Change-Id: I24326fad7a89083a2409134640bda81ee0359d08
2017-08-15 15:52:39 +01:00
Lorenzo Colitti
4faae82855 Merge changes Ifbd1e8d9,I1e017b6f into oc-mr1-dev
* changes:
  Pass data usage limits to tethering offload code.
  Don't time out when fetching tether offload stats.
2017-08-15 06:47:24 +00:00
Lorenzo Colitti
62801ec2b7 Pass data usage limits to tethering offload code.
(cherry picked from commit 50b60fc34d)

Bug: 29337859
Bug: 32163131
Test: builds
Test: OffloadControllerTest passes
Change-Id: Ifbd1e8d9057aa12b956e3b4501c32aa6bcf420bd
2017-08-15 12:12:04 +09:00
Lorenzo Colitti
d14c177136 Merge changes I82d3bee0,I9c9413d7 am: deb4eb5d05 am: 51c3d6a8bf am: 0cf31d4d6d
am: 20fa45e3a9

Change-Id: I5d700c9818a89ba3eaab8a34bb799ae7145dbd28
2017-08-15 02:34:30 +00:00
Lorenzo Colitti
20fa45e3a9 Merge changes I82d3bee0,I9c9413d7 am: deb4eb5d05 am: 51c3d6a8bf
am: 0cf31d4d6d

Change-Id: I759ed9a79b6ebfa2ae6143167c0dd7d0ad84c67f
2017-08-15 02:25:36 +00:00