Commit Graph

1140 Commits

Author SHA1 Message Date
Nathan Harold
8a243c7ae2 Re-Enable Starting of the IpSecService am: 81f54633f0 am: a246237c74
am: 686a8282bb

Change-Id: Ia24348d585b2f1050dafd161eafcdadf0edd82c0
2017-09-26 22:37:44 +00:00
nharold
5a77657433 Merge changes from topic "re-enable-ipsec"
am: 61cf7b284e

Change-Id: Ia1d1f3981a9dd1eb8f60631d318211daf135d575
2017-09-26 22:13:20 +00:00
Nathan Harold
a246237c74 Re-Enable Starting of the IpSecService
am: 81f54633f0

Change-Id: I1f64aa2fdf1cce6dea91427eda65c4b8ee6f6b02
2017-09-26 22:11:58 +00:00
nharold
61cf7b284e Merge changes from topic "re-enable-ipsec"
* changes:
  Re-Expose IpSecService API Surface
  Re-Enable Starting of the IpSecService
2017-09-26 21:46:39 +00:00
Tetsutoki Shiozawa
a6f8963ba8 Merge "Merge "Abort connecting to native daemon during shutdown" am: aa8608db31" into stage-aosp-master am: 6e07110891
am: c3c4007a10

Change-Id: Iaf4f8b10727ae8b455e5cd2bfa021e2f77d4c6d6
2017-09-14 10:36:40 +00:00
Tetsutoki Shiozawa
b694d3637a Merge "Abort connecting to native daemon during shutdown" am: aa8608db31 am: d0c03869ff
am: ce96d1dd9d

Change-Id: I46c3e0c4f7241d1dccaa3963c462028ca8f1322d
2017-09-14 10:33:39 +00:00
Android Build Merger (Role)
6e07110891 Merge "Merge "Abort connecting to native daemon during shutdown" am: aa8608db31" into stage-aosp-master 2017-09-13 22:38:38 +00:00
Tetsutoki Shiozawa
af741b2b0b Merge "Abort connecting to native daemon during shutdown"
am: aa8608db31

Change-Id: I5b8984d51ff0715b29074cee98197263b5ce1c29
2017-09-13 22:36:59 +00:00
Tetsutoki Shiozawa
d0c03869ff Merge "Abort connecting to native daemon during shutdown"
am: aa8608db31

Change-Id: I044badaab323b836580b5231e9f2661aa320d1e9
2017-09-13 22:27:48 +00:00
Treehugger Robot
aa8608db31 Merge "Abort connecting to native daemon during shutdown" 2017-09-13 22:09:54 +00:00
Nathan Harold
69cb0af0a8 Re-Expose IpSecService API Surface
Note, This reverts commit 7194bb9bf9.

Bug: 64800246
Test: compilation
Change-Id: I709d4c476647cfe9f6b982fc373f8d76018b3922
2017-09-12 19:25:13 -07:00
Nathan Harold
81f54633f0 Re-Enable Starting of the IpSecService
This reverts commit 41004ff4113dc9175c993638a47af602af6d8a98.

Bug: 64800246
Test: compilation
Change-Id: I4f5e3cd23001b9d94b3f6dc9fcfe731a90650e6e
2017-09-12 19:25:09 -07:00
Hugo Benichi
8e37bf202b Merge "NetworkStats: more robust subtraction for deltas" am: e941c8a497 -s ours am: 67fbf6ac5e -s ours
am: 5509ba6d40  -s ours

Change-Id: Ib7cf5b4eb2cc858d93e2d3e49b9325495a47667e
2017-09-08 07:53:47 +00:00
Hugo Benichi
67fbf6ac5e Merge "NetworkStats: more robust subtraction for deltas"
am: e941c8a497  -s ours

Change-Id: Ibdb6876083588ad5c741fe8d45d46d119fd713fd
2017-09-08 07:29:15 +00:00
Hugo Benichi
e941c8a497 Merge "NetworkStats: more robust subtraction for deltas" 2017-09-08 07:13:37 +00:00
Hugo Benichi
624e54f225 NetworkStats: more robust subtraction for deltas
This patch ensures that subtract() between two NetworkStats object will
return a delta with no negative entries in all cases.

When the stats delta contains some negative values, there are clamped to
0. Some logging is added when this happens.

This is what's expected by NetworkStatsHistory#recordData().

Bug: 64365917
Bug: 65439160
Test: runtest frameworks-net
Merged-In: I16e97e73f600225f80e0ce517e80c07c6f399196
Merged-In: I2ac0bc3914cb65ae8ee27921856d698dc59624b2
Merged-In: I67d5dc4b52b254748ff17fe1e16c2eeb1d03c30d
Merged-In: Ib488fb034f72c92f19916490981342a3ef2eb33b

(cherry picked from commit d78311f267)

Change-Id: Ic86b65a65a2517c871221f8784088ec1de18f534
2017-09-08 13:39:44 +09:00
Hugo Benichi
619ce0a8f4 Merge "Network Service Discovery test: properly release resources" am: c9d24d203d am: 3a2e98b3ce
am: f467db29f9

Change-Id: Id9be284a16112f999d752751a7972fd735573cda
2017-09-04 12:42:56 +00:00
Hugo Benichi
3a2e98b3ce Merge "Network Service Discovery test: properly release resources"
am: c9d24d203d

Change-Id: If34b3770a5c0fef65d124201e0ca1374cc6b1eca
2017-09-04 12:14:11 +00:00
Hugo Benichi
fa8a0bb61f Network Service Discovery test: properly release resources
Bug: 32561414
Bug: 62918393
Bug: 62044295
Test: runtest frameworks-net
Change-Id: If23993b5e391947ecbdc01677f0a643144794b2b
2017-09-02 14:54:29 +09:00
Jeff Sharkey
4aa35f8d1b Merge "Gracefully handle integer overflows." into oc-mr1-dev
am: a7c5d0b053

Change-Id: I6ed70a40ad3e6df55e7669fedfe5b34faf95bd9f
2017-09-02 02:07:25 +00:00
TreeHugger Robot
a7c5d0b053 Merge "Gracefully handle integer overflows." into oc-mr1-dev 2017-09-02 01:54:58 +00:00
Jeff Sharkey
121a1fcbb2 Gracefully handle integer overflows.
Try sticking with integer-based math as much as possible for speed,
but switch to double-based math if we detect that we'd end up
causing an overflow.

New tests to verify.

Test: bit FrameworksNetTests:com.android.server.net.NetworkStatsCollectionTest
Bug: 65257769
Change-Id: I1ae35599be134f81850c0a3d86928b057fba1eff
2017-09-01 17:13:01 -06:00
Jeff Sharkey
f4dd66f12c Merge "Don't over-acquire NPMS locks." into oc-mr1-dev
am: 4576171c33

Change-Id: I2d23f8b238b8386958c0fd7348542713abb355dd
2017-09-01 22:03:47 +00:00
Jeff Sharkey
5f1befb42e Don't over-acquire NPMS locks.
We only need to hold mNetworkPoliciesSecondLock when working with
subscription plans; before this CL we could end up acquiring the two
NPMS locks out of order, resulting in a deadlock.

Also annotate objects in NSS that require mStatsLock to be held.

Test: builds, boots
Bug: 65268076
Change-Id: I06497564424316ef895dc8dceba72ae784781dc3
2017-09-01 12:36:20 -06:00
Jeff Sharkey
488cf28ae9 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
2f0f8f418f 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
Lorenzo Colitti
1d1d06f8dd Merge changes I325b13d5,I89719fe7 am: 31cb4583e5 am: d1800f3e6f am: 4fa0187015
am: 4187540d39  -s ours

Change-Id: Iddb0b4e22d942c9b399e57e17328b6911f473064
2017-08-19 03:47:59 +00:00
Lorenzo Colitti
4187540d39 Merge changes I325b13d5,I89719fe7 am: 31cb4583e5 am: d1800f3e6f
am: 4fa0187015

Change-Id: Ib980879b0e50ffe1c8209339df22da4a50d5b74e
2017-08-19 03:38:10 +00:00
Lorenzo Colitti
d1800f3e6f Merge changes I325b13d5,I89719fe7
am: 31cb4583e5

Change-Id: Iaced543ab17ea87c8f701975764d957bc1b17fc7
2017-08-19 03:15:08 +00:00
Treehugger Robot
31cb4583e5 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
c2f8a8dda3 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 f31c942e89)

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
45ab5640ef 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
f31c942e89 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
Di Lu
635d3f5345 Merge "Add user quota information into the IpSecService dump" am: fedd856546 am: 318ca31081 am: 759696c47c
am: aa32c400ce

Change-Id: Iecd820e12495121f991bb00fa65cda07bf0f2abe
2017-08-16 17:25:30 +00:00
Di Lu
aa32c400ce Merge "Add user quota information into the IpSecService dump" am: fedd856546 am: 318ca31081
am: 759696c47c

Change-Id: I8f958d4967e02a58d8baf7b4a4058cf15ca50cc6
2017-08-16 17:12:05 +00:00
Di Lu
318ca31081 Merge "Add user quota information into the IpSecService dump"
am: fedd856546

Change-Id: I1f64ab03918ece154fe31a07b698825315d39c0f
2017-08-16 16:33:18 +00:00
ludi
529fdecc4c Add user quota information into the IpSecService dump
Bug: 64093788
Test: runtest frameworks-net
Change-Id: I6c5fc9e2db4ba57e0db4f6380a1251c4e444951b
2017-08-14 16:10:55 -07:00
Jeff Sharkey
b050a094a0 Merge "Rename API to match StorageStats." into oc-mr1-dev
am: 74f7a1425f

Change-Id: I87815da4f2f96c476fcdfdb3361d0f43b895e909
2017-08-12 00:45:19 +00:00
Jeff Sharkey
b1f97acf19 Rename API to match StorageStats.
Since they're both measuring app code (APKs), name this API
consistently with StorageStats.getAppBytes().

Bug: 64331226
Test: builds, boots
Change-Id: I1b00427b619a78c043b1b5fac2d0e6406b51d454
2017-08-11 15:10:38 -06:00
nharold
07ab65cc3b Merge "Add UserQuotaTracker to IpSecService" am: a0c97b3ddb am: b1d39a7aff am: 31e299220a
am: c83a829a57

Change-Id: I9ff32634ac098238dd826ececa59547788db15fc
2017-08-09 22:12:36 +00:00
nharold
c83a829a57 Merge "Add UserQuotaTracker to IpSecService" am: a0c97b3ddb am: b1d39a7aff
am: 31e299220a

Change-Id: Icc10cf54879e8f5b103392418edc1947593a8b39
2017-08-09 18:36:13 +00:00
nharold
b1d39a7aff Merge "Add UserQuotaTracker to IpSecService"
am: a0c97b3ddb

Change-Id: I43a9617b077ecd5fc2b445a1ade8b76c00562640
2017-08-09 17:49:42 +00:00
Nathan Harold
6e4681c7e2 Add UserQuotaTracker to IpSecService
Add a small tracking object to enforce maximum
quotas for SPIs, Transforms, and Encap sockets. The
current quota limits are intentionally conservative
with the expectation that we can relax them more
easily than we can shrink them.

Bug: 37688603
Test: tbd
Change-Id: Iee59ac59ef9f4a7ab75a2e04f9ca72da82fc3229
2017-08-08 18:28:47 -07:00
Hugo Benichi
7065f9f393 Merge "Merge "NetworkStats: more robust subtraction for deltas" into oc-dr1-dev am: 5e24152e33" into oc-mr1-dev
am: 279c26fa24

Change-Id: Id85a409a2d3cc12e53f977f94f7b5a306115a09a
2017-08-08 16:16:06 +00:00
Hugo Benichi
ae3ee131d2 Merge "NetworkStats: more robust subtraction for deltas" into oc-dr1-dev am: 5e24152e33
am: b9d28344e0

Change-Id: I67d5dc4b52b254748ff17fe1e16c2eeb1d03c30d
2017-08-08 16:10:52 +00:00
Hugo Benichi
f062d08360 Merge "NetworkStats: more robust subtraction for deltas" into oc-dr1-dev
am: 5e24152e33

Change-Id: Id6040a899653c585d298b7be7208f5cba997f665
2017-08-08 16:01:10 +00:00
Hugo Benichi
b9d28344e0 Merge "NetworkStats: more robust subtraction for deltas" into oc-dr1-dev
am: 5e24152e33

Change-Id: I2ac0bc3914cb65ae8ee27921856d698dc59624b2
2017-08-08 16:01:07 +00:00
Hugo Benichi
d78311f267 NetworkStats: more robust subtraction for deltas
This patch ensures that subtract() between two NetworkStats object will
return a delta with no negative entries in all cases.

When the stats delta contains some negative values, there are clamped to
0. Some logging is added when this happens.

This is what's expected by NetworkStatsHistory#recordData().

Bug: 64365917
Test: runtest frameworks-net
Change-Id: I16e97e73f600225f80e0ce517e80c07c6f399196
2017-08-08 09:19:05 +09:00
Hugo Benichi
37d178c71e NsdManager: remove duplicated argument validation
am: 38e4783a60

Change-Id: I3cad605d34cd9612b6073e689dc4af04b1717413
2017-08-03 07:28:16 +00:00
Hugo Benichi
38e4783a60 NsdManager: remove duplicated argument validation
This patch simplifies argument validation in NsdManager public api and
regroup duplicated validation into common methods.

This makes stack traces more actionable as now specific errors will
cause the api to throw exception from specific methods, whereas before
IllegalArgumentException would be thrown from inside the same api method
for different reasons.

This patch also includes a couple of other small cleanups.

Test: $ runtest -x frameworks/base/tests/net/../NsdManagerTest.java
Bug: 37013369

(cherry picked from commit f2c64f8725)

Change-Id: Icf047532aa551fbe0a70721cfb95507eaa84d51e
2017-08-03 14:19:43 +09:00