Commit Graph

1287 Commits

Author SHA1 Message Date
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
Nathan Harold
6807999817 Merge "Add AppOps Checks for MANAGE_IPSEC_TUNNELS" into pi-dev
am: 80a2bba9a6

Change-Id: Icd1b2cfc699ab44e4ca536b98298d5b23db7372e
2018-04-03 14:41:56 -07:00
Nathan Harold
65ef843176 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
Change-Id: I17a4a286225b432c3e15ea1587d946189931b4f4
2018-04-03 18:23:11 +00:00
Remi NGUYEN VAN
c7aa9fa5d1 [automerger skipped] Merge "Fix network usage stats on 464xlat tethered." into pi-dev
am: 78452f1b8d  -s ours

Change-Id: I49845b0bc0183d4d1a6c694a70e30a90a9a59759
2018-04-02 20:15:50 -07:00
Lorenzo Colitti
7d3f1bbe4d Merge "Allow applications to query for foreground/background data usage." into pi-dev
am: e5161662a6

Change-Id: I755f6d28c3e881fb2f6ee864f63eb2a080a1045d
2018-04-02 19:37:19 -07:00
Remi NGUYEN VAN
78452f1b8d Merge "Fix network usage stats on 464xlat tethered." into pi-dev 2018-04-02 23:09:50 +00:00
Lorenzo Colitti
e5161662a6 Merge "Allow applications to query for foreground/background data usage." into pi-dev 2018-04-02 22:20:03 +00:00
Remi NGUYEN VAN
38ff833161 [automerger skipped] Merge "Add method to NetworkStatsService for UID stats." into pi-dev
am: 4cac91f292  -s ours

Change-Id: I4182b2dfad1f40dd29da8c3612cf0dbc4038aa7b
2018-04-02 19:43:54 +00:00
Remi NGUYEN VAN
0023be9ea9 Fix network usage stats on 464xlat tethered.
Usage stats corrections for 464xlat in NetworkStatsFactory are not applied
to tethered traffic. Add adjustments in NetworkStatsService. After
migrating external callers off NetworkStatsFactory, we will be able to
only apply adjustments in NetworkStatsService and remove stacked
interface tracking from NetworkStatsFactory.
Bug: 72107146
Fixes: 72107146
Test: runtest frameworks-net & manual - checked corrected network usage
Merged-In: Ieb25c41c651499fdd01225ae5ac21d95e3d823f5
Merged-In: I016722f3a0ae2ae0a1d48bfacc4fe07ee3578ef7
(cherry-pick of aosp I5ce450e616b4fddf21f2a491fe5d0c9e9f969bda)

Change-Id: Id41cf22a0f9a63cb1832e9375bfb045861f08e52
2018-04-02 13:30:02 +00:00
Lorenzo Colitti
b0efeaf855 Allow applications to query for foreground/background data usage.
Currently the NetworkStatsManager APIs allow applications to
query for their own data usage by UID and tag, but do not allow
applications to query by foreground/background state.

This is causing popular apps to resort to parsing xt_qtaguid
stats files directly. Because this is no longer allowed for apps
targeting P and above, provide replacement functionality.

This API allows apps to query for data usage for a given state,
but not to receive data usage broken down by state. This is
consistent with how the current UID and tag APIs work. It is also
not an undue burden on apps: there are currently only two states
of interest (FOREGROUND and everything else), and even if we add
states in the future, unmodified apps can still obtain total
traffic using STATE_ALL.

Bug: 72977484
Test: New CTS test added in other change in this topic.
Change-Id: Ic8c9194569ffd599b49e4a8197c5c2ea0ec3f7f7
2018-04-02 19:58:24 +09:00
Remi NGUYEN VAN
4cac91f292 Merge "Add method to NetworkStatsService for UID stats." into pi-dev 2018-04-02 05:40:04 +00:00
Benedict Wong
0daca16b23 [automerger skipped] Merge "Disallow Reserved SPI Allocation" into pi-dev
am: 97e1f5b953  -s ours

Change-Id: I80f554392a01a4942b5c4927b8ad13d11dd5490a
2018-03-31 01:30:03 +00:00
Nathan Harold
2ca5629668 [automerger skipped] Disallow Reserved SPI Allocation
am: 1b88f0e6ab  -s ours

Change-Id: I64fb79980348f96116ad73893571babe3d7d29a6
2018-03-31 01:05:18 +00:00
Benedict Wong
4bc550c5d1 [automerger skipped] Merge changes from topic "encap-api" into pi-dev
am: cafd11d598  -s ours

Change-Id: I19ea85409c7b8653a734e74afc092959e91a0aad
2018-03-30 22:57:46 +00:00
Benedict Wong
97e1f5b953 Merge "Disallow Reserved SPI Allocation" into pi-dev 2018-03-30 22:29:26 +00:00
Benedict Wong
addb481748 [automerger skipped] Require explicitly supplied truncation length
am: ad2615cae5  -s ours

Change-Id: I873ba85ee623a445c2ade21f656bd56e8a0fdeed
2018-03-30 22:28:03 +00:00
Benedict Wong
cafd11d598 Merge changes from topic "encap-api" into pi-dev
* changes:
  Require explicitly supplied truncation length
  Clarify UDP encapsulation socket API
2018-03-30 20:28:19 +00:00
Remi NGUYEN VAN
8edbb9b98a [automerger skipped] Merge "Allow null subscriberId in NetworkStatsManager." into pi-dev
am: 66fcefd311  -s ours

Change-Id: I6e8983cc087a8a42e1404bb5f99bcd297b0ff313
2018-03-30 15:55:32 +00:00
Benedict Wong
693f1beccc [automerger skipped] Merge "Add documentation for TCP interactions with transforms" into pi-dev
am: 0f57fe460b  -s ours

Change-Id: I6f24e8fbffedccbbce98c8bfede66ffc764a58ec
2018-03-30 10:43:36 +00:00
Remi NGUYEN VAN
944eab8689 Add method to NetworkStatsService for UID stats.
Useful for clients such as BatteryStats which currently rely
on NetworkStatsFactory. Data at that stage is incomplete as
it does not account for tethering, VT data and corresponding
464xlat corrections.

Test: runtest frameworks-net, CTS tests pass.
Bug: b/72107146
Merged-In: I31c5b9b4a7c6e72910152415894a137f000a5858
Merged-In: I2527d95000c7500c824ede70f87ecb38e21ed323
(cherry picked from aosp 088ff6824f13145ea52207bdead0d7e454a6f3ce)

Change-Id: Ie80f1bb21124241f3414f9be77aceac9a44ec6d1
2018-03-30 18:58:18 +09:00
Nathan Harold
1b88f0e6ab Disallow Reserved SPI Allocation
Disallow the allocation of SPIs in the range
reserved for future use by RFC 4303.

Bug: 77205120
Test: runtest frameworks-net
Merged-In: I05e26ed34b5871f1a07d5bd7b58b79a64cd74b67
Change-Id: I05e26ed34b5871f1a07d5bd7b58b79a64cd74b67
(cherry picked from commit 7f606ee8e57d9d8b7c5d0cb2a78421aa02efb385)
2018-03-30 01:54:36 -07:00
Lorenzo Colitti
dcc60bcef3 Merge "Disallow Reserved SPI Allocation" am: 9c68e5a5b7
am: 62e6b774e3

Change-Id: Ic5c7857754a04ae7238414b55a1e5ab653d62f6b
2018-03-30 08:33:06 +00:00
Lorenzo Colitti
9951c93f3c Merge "Require explicitly supplied truncation length" am: dc77e9c3da
am: 2749432646

Change-Id: I347bfd43be54d162dea831770ab08d792ea1443f
2018-03-30 07:45:04 +00:00
Remi NGUYEN VAN
66fcefd311 Merge "Allow null subscriberId in NetworkStatsManager." into pi-dev 2018-03-30 07:39:23 +00:00
Lorenzo Colitti
3baa94c23f Merge "Clarify UDP encapsulation socket API" am: 0cf9421304
am: a12c8fe218

Change-Id: I5fcf79691c670e710e46b3a9eac8a580c44028fb
2018-03-30 06:48:17 +00:00
Lorenzo Colitti
9c68e5a5b7 Merge "Disallow Reserved SPI Allocation" 2018-03-30 06:16:17 +00:00
Benedict Wong
ad2615cae5 Require explicitly supplied truncation length
Instead of providing default truncation lengths (based on RFC or
otherwise), this change imposes a restriction that the truncation length
must be supplied for all auth or aead algorithms.

Bug: 77204048
Test: Updated tests, ran on walleye
Merged-In: I4a0e2e71aa97259e56f44e7c8a2ce53135708d97
Change-Id: I4a0e2e71aa97259e56f44e7c8a2ce53135708d97
(cherry picked from commit bb7f2820f5bcccf8618078c2cbe4ea9836797e3b)
2018-03-29 23:07:42 -07:00