Commit Graph

1263 Commits

Author SHA1 Message Date
Chenbo Feng
b750b4cb0c [automerger skipped] Remove the unused file parsing function
am: d8dfd8c175  -s ours

Change-Id: I264e9826246ebfc74cf74f8af623a428909a56e3
2018-05-02 12:32:53 -07:00
android-build-prod (mdb)
93f2f28a66 Merge changes from topic "ifaceStats" am: eab28ef97c
am: b86d2b4b84

Change-Id: I460bc25806182bc2dc5fcc2512ab01e776a0e8e6
2018-05-01 19:53:30 -07:00
Chenbo Feng
3654e617c0 Use eBPF map data for per iface stats am: 2dc99dc445
am: 2e13ecc88d

Change-Id: If4944a4a5a0c49235731afb4ae3220cf72240a83
2018-05-01 19:49:53 -07:00
Chenbo Feng
d8dfd8c175 Remove the unused file parsing function
With the new xt_bpf support for iface stats. We no longer need to parse
the per interface stats from /proc/net/dev. And since the old xt_qtaguid
code path also not depend on it, we can completly remove that helper
function since no caller is depending on it now.

Bug: 72111305
Test: runtest frameworks-net -c com.android.internal.net.NetworkStatsFactoryTest
Change-Id: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
Merged-In: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
(cherry picked from aosp commit b815c978b81eee4b1494bd0b9d25bfad52f08b72)
2018-05-01 19:48:03 -07:00
Chenbo Feng
c34a67b18c Use eBPF map data for per iface stats
After adding the xt_bpf module and ifaceStatsMap, eBPF tool can now
support reading per interface data. So networkStatsFactory should move
away from parsing proc/net/dev and use the eBPF map stats instead.

Bug: 72111305
Test: atest com.android.server.net.NetworkStatsServiceTest
Change-Id: Ibcc6150d00835b3bd33af22a72e4a86e172581cf
Merged-In: Ibcc6150d00835b3bd33af22a72e4a86e172581cf
(cherry picked from aosp commit dcc56783f5b945b16c9f5e50333fba557a7c3603)
2018-05-01 19:46:09 -07:00
android-build-prod (mdb)
eab28ef97c Merge changes from topic "ifaceStats"
* changes:
  Remove the unused file parsing function
  Use eBPF map data for per iface stats
2018-05-02 01:19:23 +00:00
Chenbo Feng
1f37112a51 Remove the unused file parsing function
With the new xt_bpf support for iface stats. We no longer need to parse
the per interface stats from /proc/net/dev. And since the old xt_qtaguid
code path also not depend on it, we can completly remove that helper
function since no caller is depending on it now.

Bug: 72111305
Test: runtest frameworks-net -c com.android.internal.net.NetworkStatsFactoryTest
Change-Id: Icb7eaeef0eeb9fdffd32a90316c76ee05bafffbe
2018-05-01 14:13:55 -07:00
Chenbo Feng
2dc99dc445 Use eBPF map data for per iface stats
After adding the xt_bpf module and ifaceStatsMap, eBPF tool can now
support reading per interface data. So networkStatsFactory should move
away from parsing proc/net/dev and use the eBPF map stats instead.

Bug: 72111305
Test: atest com.android.server.net.NetworkStatsServiceTest
Change-Id: Ibcc6150d00835b3bd33af22a72e4a86e172581cf
2018-05-01 14:13:48 -07:00
Nathan Harold
86238ee312 Merge "Rework Exception Handling for IpSecManager" into pi-dev
am: 16c671dc9a

Change-Id: I9c1acdc79053c70a8484935f61a537379b9be927
2018-04-25 11:51:00 -07:00
Nathan Harold
beed0b61b7 Rework Exception Handling for IpSecManager
In order to properly support EOPNOTSUPP this CL
applies a consistent approach to handling Exceptions.
Hereafter, all exceptions that aren't of a special
method-specific type (such as SpiUnavailableException)
will all be returned to the calling process unchanged.
At the API call site, the ServiceSpecificException,
which is really an Errno, will be inspected and either
converted to an unchecked exception for types we know,
or it will be converted to an IOException in cases where
that method can return a checked exception. In cases
where we do not expect an errno, we will simply throw
a generic RuntimeException. This means all API calls
will now properly throw UnsupportedOperationException
and may be CTS tested accordingly.

Bug: 72420898
Test: runtest frameworks-net
Change-Id: I4a00e221618896223fcdb4b4279fb14cd14e34d8
2018-04-24 19:04:08 -07:00
Jeff Sharkey
ce6d660a84 Merge "Give CTS a way to force-poll network stats." into pi-dev
am: 46e58e1b40

Change-Id: Id2252b803a33ddadfef71618b3b9106c93c5be2a
2018-04-20 13:51:02 -07:00
Jeff Sharkey
5a0df01ad7 Give CTS a way to force-poll network stats.
Collecting network statistics is pretty heavy, which is why we're
throttling callers.  However, to keep CTS running fast, we provide a
way for tests to force a poll event, instead of making them wait for
the throttle timeout.

Bug: 77908520
Test: atest cts/tests/tests/app.usage/src/android/app/usage/cts/NetworkUsageStatsTest.java
Change-Id: Ia792f0cd495023366ff8c4839df54e7da2ae8331
2018-04-20 12:18:23 -06:00
Jeff Sharkey
bc05a34970 Merge "Never interact with "phone" while holding locks." into pi-dev
am: d101084db7

Change-Id: I570994cd8ab5c7499dfa94b17e42687181637de0
2018-04-19 20:00:48 -07:00
Jeff Sharkey
c0ddfa3185 Never interact with "phone" while holding locks.
We've seen devices where heavy communication between "system_server"
and the "phone" process can exhuast Binder threads, especially when
calling while holding locks.  To mitigate this, we now interact with
the "phone" process before acquiring any locks.

Update our internal data structures either when we see a connectivity
change, or when SubscriptionManager tells us something changed.

Fix bug in resolveSubscriptionPlan() that always picked the 0'th
SubscriptionPlan instead of looking for the currently active plan;
we now use the same logic for both NSS and NPMS.

Bug: 77908520, 77154412
Test: atest com.android.server.NetworkPolicyManagerServiceTest
Test: atest com.android.server.net.NetworkStatsServiceTest
Change-Id: I177d3fa6cddc78d745b35a9ede12451d458b892c
2018-04-19 14:41:35 -06:00
Jeff Sharkey
addd48f987 Merge "Add tracing for network statistics and policy." into pi-dev
am: a4cd50c93e

Change-Id: I2b6634c8df4dfe14fb4cd01bca6611e7cf7a0056
2018-04-16 18:10:40 -07:00
TreeHugger Robot
a4cd50c93e Merge "Add tracing for network statistics and policy." into pi-dev 2018-04-17 00:08:41 +00:00
Jeff Sharkey
8f3b754cd3 Add tracing for network statistics and policy.
These trace points surround areas of heavy lifting to help us debug
code that might be taking longer than expected.  (For example, slow
getting data from eBPF, slow recording into data structures, slow
writing to disk, or slow evaluating policy.)

Typical timings on a taimen:

performPollLocked:   25.5ms
snapshotUid:          4.4ms
snapshotXt:           1.4ms
[persisting]:        13.4ms
updateNotifications:  3.3ms

Bug: 77908520, 77808546, 77853238, 77154412
Test: builds, boots
Change-Id: I072bfecffee01eeec7e4cbad439bd1cdc166febc
2018-04-16 13:31:32 -06:00
Jeff Sharkey
31798e0b93 Merge "Revert "Revert "OP_GET_USAGE_STATS should be noted, not checked.""" into pi-dev
am: 004b279683

Change-Id: Ie9bcdc9736c04ab787efc193311a20d03718b593
2018-04-16 10:19:39 -07:00
Jeff Sharkey
aeaa916b66 Merge "Revert "OP_GET_USAGE_STATS should be noted, not checked."" into pi-dev
am: 893abe5d47

Change-Id: I2cc76316bca81c12e56337d6e36d82b0de6d9ded
2018-04-16 10:07:52 -07:00
Jeff Sharkey
004b279683 Merge "Revert "Revert "OP_GET_USAGE_STATS should be noted, not checked.""" into pi-dev 2018-04-16 16:54:32 +00:00
Jeff Sharkey
0eb04dc200 Revert "Revert "OP_GET_USAGE_STATS should be noted, not checked.""
This reverts commit c6624c7a1a.

Reason for revert: ijpedowitz@

Bug: 77662908
Change-Id: I596d330d64942105f447bb613012bb11e281a805
Exempt-From-Owner-Approval: keep tests passing
2018-04-16 16:50:34 +00:00
Jeff Sharkey
893abe5d47 Merge "Revert "OP_GET_USAGE_STATS should be noted, not checked."" into pi-dev 2018-04-16 16:50:06 +00:00
Jeff Sharkey
c6624c7a1a Revert "OP_GET_USAGE_STATS should be noted, not checked."
This reverts commit 930aeb0c00.

Reason for revert: ijpedowitz@

Bug: 77662908
Change-Id: I5dd0ad5038df90ea8a80ba6f583ee46fb24600c2
Exempt-From-Owner-Approval: keep tests passing
2018-04-16 16:39:55 +00:00
Jeff Sharkey
8984338162 Merge "OP_GET_USAGE_STATS should be noted, not checked." into pi-dev
am: e5a47054b3

Change-Id: I38f5aecdb94c8b886ca4eba5908ab1b4a9c1fb89
2018-04-14 18:11:58 -07:00
Jeff Sharkey
84151258a1 Merge "Don't process broadcasts until really ready." into pi-dev
am: fcc07b53fa

Change-Id: I898d5c2d351951a7c016cbc70cb81210a9e18b26
2018-04-14 17:39:59 -07:00
Jeff Sharkey
e5a47054b3 Merge "OP_GET_USAGE_STATS should be noted, not checked." into pi-dev 2018-04-13 23:58:44 +00:00
Jeff Sharkey
e6c2cfbe42 Don't process broadcasts until really ready.
Someone started setting mSystemReady too early, when we really want
to know SystemServer's real ready state.  Add a variable to track
that, and don't process broadcasts until that's set.

Bug: 78020762
Test: builds, boots
Change-Id: I65213e46044c95fb0a8a4b09b9aa463bb15c1844
2018-04-13 14:28:32 -06:00
Jeff Sharkey
930aeb0c00 OP_GET_USAGE_STATS should be noted, not checked.
Per email feedback, we should be using "noteOp" instead of "checkOp"
when testing if caller holds OP_GET_USAGE_STATS, so that we record
that caller used the operation.

Bug: 77662908
Test: builds, boots
Exempt-From-Owner-Approval: keep tests passing
Change-Id: I3a60345d590534fdbc2c1248e0d30dc85a5d6772
2018-04-13 19:32:25 +00:00
Remi NGUYEN VAN
f8536e7c44 Merge "Add rate limiting and logging for NetworkStats." into pi-dev
am: c9185b5f3c

Change-Id: I446a85f8d74fb33abb3a5f6fb1ef86f3c24bb6d4
2018-04-12 14:30:05 -07:00
Remi NGUYEN VAN
3d55d4c02e Add rate limiting and logging for NetworkStats.
Bug: 77908520, 77808546, 77853238, 77154412
Test: atest com.android.server.net.NetworkStatsServiceTest
Test: manual: flashed, verified network usage updated
Change-Id: I905dbea85e00f80103916939f6d4bf8cab931d03
2018-04-12 12:43:53 -06:00
Nathan Harold
ccc2762c55 Merge "[DO NOT MERGE] - Hide Tunnel Mode IpSec API" into pi-dev
am: 8732487ce6

Change-Id: I2542b4dcb94b306e3fe2e3e87051f1bd6a481561
2018-04-11 11:39:56 -07:00
Nathan Harold
8732487ce6 Merge "[DO NOT MERGE] - Hide Tunnel Mode IpSec API" into pi-dev 2018-04-11 17:09:07 +00:00
Florian Mayer
2aa4105bba Merge "Address API comments on NetworkStats#getDefaultNetwork." into pi-dev
am: f1657a827f

Change-Id: Ic7356df8144ca41a89bfbf194155bc41058a200d
2018-04-11 07:15:16 -07:00
Lorenzo Colitti
83be1ec1f4 Address API comments on NetworkStats#getDefaultNetwork.
Bug: 76449091
Test: android.app.usage.cts.NetworkUsageStatsTest passes
Change-Id: I7f21e0bd7bc4b726058fc2e25542ff2c3173fabe
2018-04-11 10:11:12 +00:00
Remi NGUYEN VAN
844d0f6091 Merge "Do not register callback for < MIN_THRESHOLD_BYTES" into pi-dev
am: 76823e1357

Change-Id: I7aab9434ab9b11fe588c057a4c2b774b09ad71d2
2018-04-10 20:46:55 -07:00
Remi NGUYEN VAN
76823e1357 Merge "Do not register callback for < MIN_THRESHOLD_BYTES" into pi-dev 2018-04-11 03:18:57 +00:00
Nathan Harold
67e71f0f69 [DO NOT MERGE] - Hide Tunnel Mode IpSec API
Hide the tunnel mode of the IpSec API because
there is a disincentive to launch it without
a supported customer use case. That use case,
IWLAN is having its APIs hidden, so we should
hide these as well to avoid constraining future
implementation.

Also, due to issues with the lifetime of the NATT
management object, this API needs to be hidden
until such time as the lifetime of the Keepalive
can be handled independently of the lifetime of
a Transform.

Bug: 72523623
Test: compilation (api removal)
Change-Id: I076030bdbab1cd7d69f6a034577d529970b050dc
2018-04-10 19:24:07 -07:00
Remi NGUYEN VAN
27d62a0a32 Do not register callback for < MIN_THRESHOLD_BYTES
This also avoids returning a nonzero multipath preference
if remaining data is low but nonzero.

Bug: b/72877610
Change-Id: I2459ded06de77d284ae1fe81a60d9e1df56b0c26
Fixes: b/72877610
Test: Tests in go/ag/3842960 pass
2018-04-10 10:27:00 +09:00
Jeff Sharkey
99670560ca Merge "API council requested tweaks to SubscriptionPlan." into pi-dev
am: ecd081f906

Change-Id: I447d4041d1dd0751147d13792b07d6617b27978a
2018-04-09 17:09:34 -07:00
Jeff Sharkey
ecd081f906 Merge "API council requested tweaks to SubscriptionPlan." into pi-dev 2018-04-09 23:20:43 +00:00
Benedict Wong
043ff486ce [automerger skipped] Merge "Force creation of Socket upon Transform application" into pi-dev
am: e7e135c3ad  -s ours

Change-Id: I42b4d0c1b40b9ae6df076d5845331a50b93f2dd6
2018-04-09 14:11:21 -07:00
Benedict Wong
e7e135c3ad Merge "Force creation of Socket upon Transform application" into pi-dev 2018-04-09 20:55:30 +00:00
Lorenzo Colitti
a646274f6d Merge changes from topic "unwanted" into pi-dev
am: 2eae1e3a45

Change-Id: Ib6f46ff91a6d774a516fa299284d9d552081dde6
2018-04-06 20:01:23 -07:00
Lorenzo Colitti
76bb817438 Add @param tag for state in queryDetailsForUidTagState.
Change-Id: I22de424ccb2b30b2a56edd17dc982565b8aa7d4a
Fix: 77518425
Test: make doc-comment-check-docs
2018-04-06 23:17:23 +09:00
Benedict Wong
09a8c052c8 Merge "Update IpSecManager to use InetAddress and prefixLen" into pi-dev
am: b172d5b437

Change-Id: I03c0745662ab8868f719dc65c9ff8502e2ff817c
2018-04-05 17:34:11 -07:00
Benedict Wong
d39837f7e2 Update IpSecManager to use InetAddress and prefixLen
LinkAddress constructors are currently @hide; this change updates
IpSecManager to use InetAddress and prefixLen, and then construct a
LinkAddress internally. LinkAddress is used over the binder interface to
IpSecService to ensure validity.

Bug: 77528639
Test: CTS, Java unit tests ran on walleye
Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
2018-04-05 17:41:11 +00:00
Jeff Sharkey
17a51c8a56 API council requested tweaks to SubscriptionPlan.
Return new shiny Range<> object instead of Pair<>.  Tell developers
what permission to check on refresh broadcast.  Describe what
exceptions might be thrown, and that an empty list is okay.

Allow creation of plans with richer Period object, instead of forcing
them into rigid week or day options.

Protect SubscriptionPlan broadcast.

Test: atest android.util.RecurrenceRuleTest
Test: atest com.android.server.NetworkPolicyManagerServiceTest
Bug: 74945820
Change-Id: I7e555798e0cfaa214ca93d9df627c6443fc5d986
2018-04-04 16:06:27 -06:00
Benedict Wong
50c22a9d0f Merge "Force creation of Socket upon Transform application" am: 119cf2bc61
am: abcf07af81

Change-Id: I2034448a22461d51728e66bcc0e965821aa4a42f
2018-04-04 12:52:00 -07:00
Benedict Wong
57ab3f648e Force creation of Socket upon Transform application
This change forces Socket and DatagramSocket to populate the
SocketImpl, ensuring that the socket file descriptor can be
retrieved when applying Transport mode Transforms

This is done by calling getSoLinger(), triggering a getImpl(), which
triggers setImpl() if needed.

Bug: 77491294
Test: Added tests in IpSecManagerTest, ran on walleye
Merged-In: I40da08b031357710eb794e0f866aec5660c79594
Change-Id: I40da08b031357710eb794e0f866aec5660c79594
(cherry picked from commit d175a3d3a01cfdb5ab6d4e61d15950583f8006d6)
2018-04-04 10:33:49 -07:00
Benedict Wong
78652232dd Force creation of Socket upon Transform application
This change forces Socket and DatagramSocket to populate the
SocketImpl, ensuring that the socket file descriptor can be
retrieved when applying Transport mode Transforms

This is done by calling getSoLinger(), triggering a getImpl(), which
triggers setImpl() if needed.

Bug: 77491294
Test: Added tests in IpSecManagerTest, ran on walleye
Change-Id: I40da08b031357710eb794e0f866aec5660c79594
2018-04-03 17:04:55 -07:00