Commit Graph

1091 Commits

Author SHA1 Message Date
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
Andreas Gampe
50f53691de Merge "IpSecService: Actually throw exception"
am: 3eff26449f

Change-Id: I415b249d564c5ffdd2d9381b53a31dd6f6c18eab
2017-07-12 01:29:47 +00:00
Andreas Gampe
afb01e2317 IpSecService: Actually throw exception
Add a missing throw.

Bug: 19797138
Test: m
Test: Device boots
Change-Id: I6c6058ecc95a5b85da43a42bac2846c31cefc038
2017-07-11 14:52:37 -07:00
Nathan Harold
5291cb6004 Check ManagedResource is NonNull before Checking Owner
If an invalid Resource Id is provided to the Managed Resource
Array getter, we should just return null rather than asserting
the owner of the resource.

Bug: none
Test: tbd
Change-Id: I407a96e4e82e9d6bf68e89380a88d3851efe4305
2017-07-06 21:12:38 -07:00
Jeff Sharkey
65501f8094 Only require that system UIDs tag their sockets.
Apps with a normal UID are typically isolated enough to not require
socket tagging; we're mostly interested in tracking down internal
UIDs that have lots of code sharing the same UID.

Also fix up everyone doing manual string checks of Build.TYPE, since
we now have first-class fields for those.

Bug: 38126076
Test: builds, boots
Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
2017-06-27 11:11:06 -06:00
Jeff Sharkey
8af5ad1575 Allocate well-known tag for app store updates.
This way an app store can shift blame for update-related network
traffic onto the app that is being updated.

Using a well-known tag makes it easy for developers to identify
that they didn't explicitly request the traffic at runtime, similar
to how backup/restore traffic is handled.

Bug: 38282350
Test: builds, boots
Change-Id: I003dd7c9615d4ab318250f1e44fa5d195ac94d23
2017-06-26 19:50:48 -06:00
ludi
bdd5ab8874 Remove return value of ipSecAddSecurityAssociation
Bug:38350493

Test: runtest frameworks-net

Change-Id: I48f8462d94e8c4e95d6766c1ce7f24b8a596b743
2017-06-07 15:26:50 -07:00
Etan Cohen
6d7f581187 [P2P] Add binder to service calls
Bug: 33040182
Test: unit tests, run-time behavior
Change-Id: Ic383efc858bb4454d99c98ab24365c63ad3e7f54
2017-06-06 17:23:44 +00:00
Jeff Sharkey
96d9849a0a Merge "Annotate @SystemApi with required permissions." into oc-dev am: c1406978a4
am: 4786aec7cc

Change-Id: Ib629e25dbf047c110feaf03e4ff744b5c6df9aeb
2017-06-06 15:48:24 +00:00
Jeff Sharkey
4786aec7cc Merge "Annotate @SystemApi with required permissions." into oc-dev
am: c1406978a4

Change-Id: I305967cad945a807c3f8234efabaad0ef8b591d1
2017-06-05 22:28:21 +00:00
Jeff Sharkey
ad1cebe58e Annotate @SystemApi with required permissions.
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
2017-06-05 13:27:11 -06:00
nharold
8df1bad599 Merge "Add UDP Encap Socket Support to IpSecManager" am: 4f6ec3d11d am: c530c01744 am: 3c1484c715
am: 834637a824

Change-Id: Iafed2773a6d32542b051d944341533b2190aa284
2017-06-03 00:15:53 +00:00
nharold
834637a824 Merge "Add UDP Encap Socket Support to IpSecManager" am: 4f6ec3d11d am: c530c01744
am: 3c1484c715

Change-Id: Idc082c1ab2aac63ad61e5fc74be7fa75cf6e686f
2017-06-03 00:04:41 +00:00
Nathan Harold
8086539071 Add UDP Encap Socket Support to IpSecManager
-Implement the UdpEncapsulationSocket
-Convert all ManagedResources to use resourceIds
-Rework ManagedResource to track resourceIds

Bug: 30984788
Test: cts - IpSecManagerTest#testUdpEncapsulation()

Change-Id: I7b1099c487051a8d951c1485791c4b6cef2deb1d
2017-06-02 03:18:56 +00:00
Jack Yu
eab8084104 Merge "Added video calling data usage per-uid support" am: 4a98eb7208 am: 2f74c02826 am: ce10610a9c
am: 47ab7cc247  -s ours

Change-Id: I63e6eac2b46aad6999307833b79bf6032a0721fd
2017-06-01 06:00:59 +00:00
Jack Yu
47ab7cc247 Merge "Added video calling data usage per-uid support" am: 4a98eb7208 am: 2f74c02826
am: ce10610a9c

Change-Id: I0a068e0eb7e833ad28611cf2be1a8bc18d99830a
2017-06-01 05:53:47 +00:00
Treehugger Robot
4a98eb7208 Merge "Added video calling data usage per-uid support" 2017-05-31 21:33:57 +00:00
Jack Yu
955599c547 Added video calling data usage per-uid support
Now the VT call data usage will be counted under
current dialer's data usage as well as the total
device data usage.

Test: Manual
bug: 37671326

Merged-In: I8351e9ae17c84210f7ca6c319d3bddcbb0043341
Change-Id: I8351e9ae17c84210f7ca6c319d3bddcbb0043341
2017-05-31 12:37:24 -07:00