Commit Graph

1287 Commits

Author SHA1 Message Date
Neil Fuller
33a26e3ee4 Merge "Track constructor changes in libcore/"
am: f94eb29500

Change-Id: I344d9210bd173f78651318366c852f65afe969d6
2018-07-05 05:14:26 -07:00
Neil Fuller
4b6b8dee0d Track constructor changes in libcore/
The 2-arg constructor is being removed.

Test: build / boot
Bug: 111055375
Change-Id: I72413a8c7885f9514a88f59deb649fa755deff92
2018-07-03 19:22:45 +01:00
Nathan Harold
7c250aedb1 Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Manually merging this due to skipping a merge
conflict at ef9f2740a790feceaa47a24b1a179e93c4ffb5e6

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-08 23:23:04 +00:00
Xin Li
97b2524e94 Skip ef9f2740a7 in proposed pi-dev-plus-aosp-without-vendor merge.
Bug: 79597307
Change-Id: I8ac04fdd94b069434e2f00b0bfab63eb916f6129
2018-06-08 14:36:00 -07:00
nharold
a8cfde3d35 Merge changes from topic "ipsec-sync-with-pi"
* changes:
  Disable the AppOp Restriction for IpSec Tunnels
  Rework Exception Handling for IpSecManager
  Update IpSecManager to use InetAddress and prefixLen
  Add AppOps Checks for MANAGE_IPSEC_TUNNELS
  Add MANAGE_IPSEC_TUNNELS Permission
2018-06-08 17:07:11 +00:00
Nathan Harold
147f7386da Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-07 18:44:34 -07:00
Nathan Harold
d21e909fd3 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
Merged-In: I4a00e221618896223fcdb4b4279fb14cd14e34d8
Change-Id: I4a00e221618896223fcdb4b4279fb14cd14e34d8
(cherry picked from commit beed0b61b7)
2018-06-07 18:42:52 -07:00
Benedict Wong
b25e678b4b 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
Merged-In: I19e124adef6d9f4992d8293db3190bcf74c95848
Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
(cherry picked from commit d39837f7e2)
2018-06-07 18:42:52 -07:00
Nathan Harold
cac8775b2a Add AppOps Checks for MANAGE_IPSEC_TUNNELS
Adds support for a new AppOp to permit services to
use IpSec tunnel mode. The IpSecService now needs
a context so change the service mode to a cached
service rather than a static service.

Bug: 66955045
Test: runtest frameworks-net
Merged-In: I17a4a286225b432c3e15ea1587d946189931b4f4
Change-Id: I17a4a286225b432c3e15ea1587d946189931b4f4
(cherry picked from commit 65ef843176)
2018-06-07 18:42:52 -07:00
Nathan Harold
b9df8b1fca Add MANAGE_IPSEC_TUNNELS Permission
Add a new MANAGE_IPSEC_TUNNELS permission and
protect all IPsec Tunnel mode APIs with it.
This permission is only granted to the system or
through an AppOp.

Bug: 66955045
Test: compilation
Merged-In: I0f618373b500c493ef2211bece681f74652a1833
Change-Id: I0f618373b500c493ef2211bece681f74652a1833
(cherry picked from commit 00e77247eb)
2018-06-07 18:42:52 -07:00
Chenbo Feng
5e006b9300 [automerger skipped] Merge "Check for bpf support at NetworkStatsService start" am: 0defa6e72c
am: 8196301e24  -s ours

Change-Id: I4b8e1669b80040287dd96423e8384e189db4af2d
2018-05-30 15:17:21 -07:00
Chenbo Feng
2cb46550f7 Check for bpf support at NetworkStatsService start
The current implementation check for bpf map existance whenever a
NetworkStats request comes in. The check is not efficient and may
require additional permission for threads. So a member variable is added
to NetworkStatsService to store the bpf configuration status and is
initialized when NetworkStatsService start.

Test: -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
      -m CtsUsageStatsTestCases -t android.app.usage.cts.NetworkUsageStatsTest
Bug: 79994577

Change-Id: I872ae18fb3e9631a4e6c4d773fefbba32e60a03b
Merged-In: I872ae18fb3e9631a4e6c4d773fefbba32e60a03b
2018-05-30 18:15:25 +00:00
Jeff Sharkey
eecce38819 Merge "Last-ditch clamping of negative NetworkStats." into pi-dev
am: 0026f5eb18

Change-Id: I0db4e16533aeac3aa88307a0af0b64cb6041d2c0
2018-05-23 16:20:22 -07:00
Jeff Sharkey
0026f5eb18 Merge "Last-ditch clamping of negative NetworkStats." into pi-dev 2018-05-23 16:30:25 +00:00
Jeff Sharkey
d631c5836d Last-ditch clamping of negative NetworkStats.
We've seen reports of negative values flowing through to attempt
being recorded, which will outright crash.  This change does one
last-ditch check to see if we're about to work with negative values,
reporting any trouble and clamping them to zero so we don't crash.

This gives us the data we need to continue investigating without
triggering runtime restarts in the field.

Bug: 80057433
Test: atest android.net.NetworkStatsTest
Change-Id: I8174391c6cf5dadc2c2c10a8d841ee07e1f7d934
2018-05-22 11:35:32 -06:00
Chenbo Feng
f407e646b4 Merge "Check for bpf support at NetworkStatsService start" into pi-dev
am: 6555a9fa16

Change-Id: If2fd9e040e4717f1040c16e4b5f6c61cfc14e140
2018-05-21 12:44:23 -07:00
Chenbo Feng
dc9c7fc7bf Check for bpf support at NetworkStatsService start
The current implementation check for bpf map existance whenever a
NetworkStats request comes in. The check is not efficient and may
require additional permission for threads. So a member variable is added
to NetworkStatsService to store the bpf configuration status and is
initialized when NetworkStatsService start.

Test: -m CtsNetTestCases -t android.net.cts.TrafficStatsTest
      -m CtsUsageStatsTestCases -t android.app.usage.cts.NetworkUsageStatsTest
Bug: 79994577

Change-Id: I872ae18fb3e9631a4e6c4d773fefbba32e60a03b
2018-05-18 17:10:07 -07:00
nharold
dabe7cd760 Merge "Use INetd Constant for IpSec Interface Prefix" am: 05a16e8a04
am: e651d67bcb

Change-Id: I142689ec7f7b43e745580eea393130d84fe4e99b
2018-05-14 21:59:55 -07:00
Nathan Harold
67724c654e Use INetd Constant for IpSec Interface Prefix
Convert to using a constant in INetd to ensure
that there is a consistent tunnel prefix  between
Java and native code.

Bug: 74560705
Test: atest FramworksNetTest; atest CtsNetTestCases
Change-Id: Ida233aac2e6c6b26567463964e0ebac9d52eff1e
(cherry picked from commit 7be7f4596a)
2018-05-14 13:14:10 -07:00
Nathan Harold
f12f06c7cc Merge "[DO NOT MERGE] Use INetd Constant for IpSec Interface Prefix" into pi-dev
am: 89005ff73e

Change-Id: I09fe6255126cefbbf165bc1f8af031c17aead7d1
2018-05-09 10:46:20 -07:00
Nathan Harold
89005ff73e Merge "[DO NOT MERGE] Use INetd Constant for IpSec Interface Prefix" into pi-dev 2018-05-09 17:27:13 +00:00
Nathan Harold
7be7f4596a [DO NOT MERGE] Use INetd Constant for IpSec Interface Prefix
Convert to using a constant in INetd to ensure
that there is a consistent tunnel prefix  between
Java and native code.

Bug: 74560705
Test: atest FramworksNetTest; atest CtsNetTestCases
Change-Id: Ida233aac2e6c6b26567463964e0ebac9d52eff1e
2018-05-09 01:33:06 +00:00
android-build-team Robot
4e30f9743c [automerger skipped] Merge changes from topic "ifaceStatsDetail" into pi-dev
am: 4b561abcaa  -s ours

Change-Id: Ia25540fd865f6040e2a5d943c19b2a12965c4d5b
2018-05-02 12:42:24 -07:00
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-team Robot
4b561abcaa Merge changes from topic "ifaceStatsDetail" into pi-dev
* changes:
  Remove the unused file parsing function
  Use eBPF map data for per iface stats
2018-05-02 19:17:27 +00: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