Commit Graph

1108 Commits

Author SHA1 Message Date
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
Tetsutoki Shiozawa
a00d4b0bf4 Abort connecting to native daemon during shutdown
Symptom:
System_server crashed due to unsolved "netd" service.

Root cause:
Init intentionally killed services when shutdown was triggered.
NativeDaemonConnector unnecessarily tried to reconnect the killed
daemon and NetworkManagemantService got a callback of connection.
Finally, NetworkManagemantService failed to get netd service and it
crashed with NPE.

Solution:
Do not retry connecting to the target native daemon when the device
is in the middle of shutdown.

Bug: 64237349
Change-Id: I2514cdc47b3eea785b5ffe5bd8bb27609bcc1726
2017-08-01 08:40:22 +00:00
Hugo Benichi
4d457931cc Merge "NsdManager: remove duplicated argument validation" into oc-mr1-dev
am: 4f48862d0f  -s ours

Change-Id: I66aa7d2d7128272bedc04568dbdcb759a3be8afe
2017-08-01 05:27:59 +00:00
Hugo Benichi
e71cc98cb1 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: 35362108
Bug: 37013369
Bug: 62044295
Bug: 63826516
Merged-In: Iaad13e13976e9bf8f508d7188f823f8184ac414b

(cherry pick from commit f2c64f8725)

Change-Id: I5e6a1ecc6b98069ef0089bbceecf73f7692df227
2017-08-01 02:45:23 +00:00
ludi
2e438582ba Merge "Add dump info to IpSecService" am: ec5fc4872e am: b47cb8b03c am: c628b22fe5
am: 16853ff14c

Change-Id: Idbc0a6f0c88a023c3954b25cc66c8c65c70085c9
2017-07-25 03:36:41 +00:00
ludi
16853ff14c Merge "Add dump info to IpSecService" am: ec5fc4872e am: b47cb8b03c
am: c628b22fe5

Change-Id: I1a5d4c424a3c9e1638d86d177cbf98f0d1bce05d
2017-07-25 03:26:23 +00:00
ludi
b47cb8b03c Merge "Add dump info to IpSecService"
am: ec5fc4872e

Change-Id: Idd4c051e4536d32504718fdfd201c7effdeb62e3
2017-07-25 03:07:00 +00:00
ludi
89194d6e45 Add dump info to IpSecService
Bug:38350824

Test: runtest frameworks-net

Change-Id: Ifa11d55e9d337016ad865baada627db3aa8c2db3
2017-07-24 16:03:33 -07:00
Di Lu
48e3c86ea7 Merge "Add unit test for IpSecService" am: 9e3f886dca am: 8cdceb2fed am: 345db82674
am: cfb337087c

Change-Id: I788e4e8466a76f80d1f15330e6d3b91b73be1d32
2017-07-20 08:42:27 +00:00
Di Lu
cfb337087c Merge "Add unit test for IpSecService" am: 9e3f886dca am: 8cdceb2fed
am: 345db82674

Change-Id: Ia4d85bcf5c42774d7b48cb1cd648754b6dd16b69
2017-07-20 07:50:21 +00:00
Di Lu
8cdceb2fed Merge "Add unit test for IpSecService"
am: 9e3f886dca

Change-Id: I16fb89239e641ac39a8a7adeafd72b7fe03935ed
2017-07-20 07:36:19 +00:00
ludi
5e623eaa02 Add unit test for IpSecService
Test: runtest frameworks-net

Bug:38259578
Change-Id: I4a049d5fdec79e36692e3b12306bd0758c19ad75
2017-07-20 04:26:24 +00:00
Steven Moreland
ba133a202d Merge "frameworks/base: use proper nativehelper headers" am: 826eafd958 am: 4f846495a4 am: c840945a78
am: c79573c26d

Change-Id: Ibe321dd4a8aae9342c76da0780edf94b90e8cd3a
2017-07-20 03:11:00 +00:00
Steven Moreland
c79573c26d Merge "frameworks/base: use proper nativehelper headers" am: 826eafd958 am: 4f846495a4
am: c840945a78

Change-Id: I654e14f0d1b495450db81592a2e564e308746350
2017-07-20 03:05:02 +00:00
Steven Moreland
4f846495a4 Merge "frameworks/base: use proper nativehelper headers"
am: 826eafd958

Change-Id: I36f10ff4d963284a313f1cc5b368f82549a4adb2
2017-07-20 02:50:53 +00:00
Steven Moreland
881296fa45 frameworks/base: use proper nativehelper headers
libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using frameworks/base find headers
Bug: 63762847
Change-Id: I0f9f231acdebe460f279135462f43d3e32eff64d
2017-07-19 10:06:40 -07:00
nharold
c5d0d1f7e1 Merge "Launch NetD in a different thread" am: 3608598388 am: e18d235c28 am: cd3633fc01
am: fbdd1f3245

Change-Id: I64abc4069121180f873906d6e30035aec139b612
2017-07-18 22:39:38 +00:00
nharold
fbdd1f3245 Merge "Launch NetD in a different thread" am: 3608598388 am: e18d235c28
am: cd3633fc01

Change-Id: Ifaaa918e1ade21609ef1615d9315c44d89a23a6d
2017-07-18 22:23:55 +00:00
nharold
e18d235c28 Merge "Launch NetD in a different thread"
am: 3608598388

Change-Id: I0edeac83cc31b7ff9b264c35e225707ebb8418f2
2017-07-18 20:18:10 +00:00
nharold
3608598388 Merge "Launch NetD in a different thread" 2017-07-18 17:56:35 +00:00
Jeff Sharkey
d5dcc61455 Merge "Unify permissions under UPDATE_DEVICE_STATS." 2017-07-18 16:17:02 +00:00
Nathan Harold
12accd0d1b Launch NetD in a different thread
Calling run() launches in the current thread;
we want to call start() to launch in a separate
thread to unblock system initialization.

Bug: none
Test: compilation
Change-Id: Ia85059100add6a44a5e3262500b00ba8ca21e125
2017-07-17 20:22:35 -07:00
Jeff Sharkey
4fd1783314 Unify permissions under UPDATE_DEVICE_STATS.
The UPDATE_DEVICE_STATS permission has become the de-facto mechanism
that platform components use to shift blame for resource usage, so
it's confusing to also have a separate MODIFY_NETWORK_ACCOUNTING
permission.  So this change replaces MODIFY_NETWORK_ACCOUNTING with
UPDATE_DEVICE_STATS.

Bug: 62483389
Test: builds, boots
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I872759f02327b6d531ec2338bd876890aded60ad
2017-07-17 16:10:55 -06:00
nharold
ee81941aec Merge "Check ManagedResource is NonNull before Checking Owner" am: 0d1e9bb5b8 am: 83dee33162 am: 43d17a6785
am: d4da46291a

Change-Id: Ie439eca6ec805e0c60574f21deef1d49574891c8
2017-07-17 18:22:18 +00:00
nharold
d4da46291a Merge "Check ManagedResource is NonNull before Checking Owner" am: 0d1e9bb5b8 am: 83dee33162
am: 43d17a6785

Change-Id: I97f1cda1efc1fb7d699b34ab725a205d3143bdad
2017-07-17 18:11:47 +00:00
nharold
83dee33162 Merge "Check ManagedResource is NonNull before Checking Owner"
am: 0d1e9bb5b8

Change-Id: I2e8cde8a7be8bdbdeebb00df053fdc621d30cdec
2017-07-17 17:52:25 +00:00
nharold
0d1e9bb5b8 Merge "Check ManagedResource is NonNull before Checking Owner" 2017-07-17 16:57:01 +00:00
Di Lu
34556e2f57 Merge "Remove return value of ipSecAddSecurityAssociation" am: 36acf01d58 am: 84aa41dae2 am: c554c2c1cb
am: 4ba38b60e2

Change-Id: I77f2e8be5a3ce9fe1c8c49b2530a8955abf5b0cc
2017-07-12 04:21:00 +00:00
Di Lu
4ba38b60e2 Merge "Remove return value of ipSecAddSecurityAssociation" am: 36acf01d58 am: 84aa41dae2
am: c554c2c1cb

Change-Id: I94e533d415e0afdbd4be72536ec667513a32f025
2017-07-12 04:13:52 +00:00
Di Lu
84aa41dae2 Merge "Remove return value of ipSecAddSecurityAssociation"
am: 36acf01d58

Change-Id: I3cf6dbc44af4934c34b074dccdfff77dede6a693
2017-07-12 04:02:24 +00:00
Di Lu
36acf01d58 Merge "Remove return value of ipSecAddSecurityAssociation" 2017-07-12 03:53:57 +00:00
Andreas Gampe
e3e17a5ca4 Merge "IpSecService: Actually throw exception" am: 3eff26449f am: 50f53691de am: d7c0357277
am: fe09d91eae

Change-Id: Ic3440c4f933725be28d5cd2b86bebc2950206f63
2017-07-12 01:50:13 +00:00
Andreas Gampe
fe09d91eae Merge "IpSecService: Actually throw exception" am: 3eff26449f am: 50f53691de
am: d7c0357277

Change-Id: I9d5b81d6f62b6d8ff7561d908c6d61b4a21c7419
2017-07-12 01:43:13 +00:00