Commit Graph

9588 Commits

Author SHA1 Message Date
Chalard Jean
68d0e42789 Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
2020-03-25 22:35:41 +09:00
Chalard Jean
6b1b2888f3 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" into rvc-dev am: 09b1ee6077
Change-Id: Ic896aa36b6819bcc297ce53ba8f1345ba4b6a9e4
2020-03-25 13:19:22 +00:00
Chalard Jean
c89cc407ef Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" am: a982d12943 am: 3870a078e3
Change-Id: I3e4b845af64f8e35ba0aa381f43b0e3ca939e6eb
2020-03-25 10:49:54 +00:00
Chalard Jean
abd9a140a6 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" am: a982d12943 am: 3870a078e3
Change-Id: Ia0f76216636ae11d1d9cbea5ed6ff0ee4e2a3f5b
2020-03-25 10:49:54 +00:00
Chalard Jean
d22cb127b9 Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426

Change-Id: Ibd162792a7ab02fcbb06130f21a825a386678c05
(cherry picked from commit 2c129e97cca2234ee6dd079a9c07df0c530d8b36)
2020-03-25 10:43:26 +00:00
Chalard Jean
3870a078e3 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" am: a982d12943
Change-Id: Ibd162792a7ab02fcbb06130f21a825a386678c05
2020-03-25 10:33:55 +00:00
Aaron Huang
df68f4f75e Merge "API review: make exception class and Builder final" into rvc-dev am: 9c9366b2df
Change-Id: I974be68ce205a701619a71e9ef7f43d8f8be0f8c
2020-03-25 09:47:47 +00:00
Chalard Jean
a982d12943 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" 2020-03-25 09:47:03 +00:00
Chalard Jean
5b63976366 Allow MANAGE_TEST_NETWORKS to register limited agents
This puts in force some restrictions against test networks,
and in exchange relaxes the restrictions around registering
a network agent that provides a test network.
Test networks can only ever have transport TEST, and have
only a few capabilities available to them.

This is useful in particular to test CTS. See aosp/1253423
for first, basic usage of this capability.

Test: IpSecManagerTunnelTest
Test: new CTS aosp/1253423
Bug: 139268426
Change-Id: I47600e6097e8519e50ae771daa13bb6bb7640451
2020-03-25 16:28:50 +09:00
Benedict Wong
d6e8d4ab71 Automatically set IPsec tunnel interface as up
This change makes IPsec tunnel interfaces automatically get brought up
once they are created. Originally this was considered to be an
additional safety check, as they would not be start routing traffic
until explicitly brought up. However, in the intervening time, the
NetworkManagementController now requires the NETWORK_STACK permission to
set an interface as up. Additionally, that call is a hidden API, and
thus not usable for use cases such as IWLAN.

Bug: 149348618
Test: FrameworksNetTests, CtsNetTestCases passing.
Change-Id: I55b63a748463a388e1e2991d2d5d6b3023545e60
Merged-In: I55b63a748463a388e1e2991d2d5d6b3023545e60
(cherry picked from commit 7c5704d177a903034ae1b6ae4800cc3b8457977a)
2020-03-25 06:14:13 +00:00
Aaron Huang
4b1aada0aa API review: make exception class and Builder final
- InvalidPacketException exception class should be final
- NetworkCapabilities.Builder should be final

Bug: 152203926
Test: atest FrameworksNetTests
Change-Id: If9b799151aff6d41c9bcd8bb86c65a58e46bad73
2020-03-25 13:36:38 +08:00
Benedict Wong
047915453c Merge "Automatically set IPsec tunnel interface as up" am: bc74233e8a am: c629b86519
Change-Id: Iea78d37e17961a755194e42a85fe7ab92c20c4fb
2020-03-25 05:01:42 +00:00
Benedict Wong
c44d6c9e22 Merge "Automatically set IPsec tunnel interface as up" am: bc74233e8a am: c629b86519
Change-Id: I01d10d2e1c0fcc52b88901609fae068d6d5268f7
2020-03-25 05:01:20 +00:00
Benedict Wong
c629b86519 Merge "Automatically set IPsec tunnel interface as up" am: bc74233e8a
Change-Id: I068814590192decaf353cdd8c46cc7f65badc746
2020-03-25 04:35:03 +00:00
Chalard Jean
542e60001a Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I69c00c9e3963950e55d7105d8825f7d3a3ec9b2f
Merged-In: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
(cherry picked from commit 9771f34dae9cdeb857636cac2b3c2d473713914e)
2020-03-25 13:27:04 +09:00
Benedict Wong
bc74233e8a Merge "Automatically set IPsec tunnel interface as up" 2020-03-25 04:18:50 +00:00
Chalard Jean
d45aa3cb78 Merge "Expose netId by adding getter API" am: 461f81faac am: d0484fa1dd
Change-Id: I45a3b531454d7555ece5483846047cfdb6aefc17
2020-03-25 02:59:32 +00:00
Chalard Jean
63e41dd5b1 [automerger skipped] Merge "Expose netId by adding getter API" am: 461f81faac am: d0484fa1dd -s ours
am skip reason: Change-Id Ieb1483c146aa2f7d8f251157e6e81d71c44ae899 with SHA-1 ed55c7ad03 is in history

Change-Id: Idc9f5dc82a1a155b136d07721400eeabd005832d
2020-03-25 02:59:26 +00:00
Chalard Jean
d0484fa1dd Merge "Expose netId by adding getter API" am: 461f81faac
Change-Id: Iab3bae76255fb4096aa3b2c9da8d6f12bb588d3e
2020-03-25 02:44:04 +00:00
Chalard Jean
461f81faac Merge "Expose netId by adding getter API" 2020-03-25 02:23:03 +00:00
Lucas Lin
794c4c2ea0 Merge "Fix NetworkCapabilitiesTest fail on Q device" into rvc-dev am: 1aff262943
Change-Id: I7b70c57ab03247a69a9a197429480fcfd2cb0f9f
2020-03-25 02:10:13 +00:00
Lucas Lin
1aff262943 Merge "Fix NetworkCapabilitiesTest fail on Q device" into rvc-dev 2020-03-25 02:00:35 +00:00
lucaslin
88cef1a242 Fix NetworkCapabilitiesTest fail on Q device
The getSSID() has changed to getSsid() in Android R, adding
isAtLeastR() to prevent NetworkCapabilitiesTest fail on Android
Q.

Bug: 151322799
Test: Run "atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest"
      on Android Q & R device.
Change-Id: I602ae32dae1ad29fe3293c541fa6d2cef01b81d3
2020-03-24 19:00:09 +08:00
Aaron Huang
005f9d10ae API review: access field by method
- InvalidPacketException, public field should be a method so
  add getter to get error code.
- KeepalivePacketData, public fields should be methods so
   add getter for fields.

Bug: 151322799
Test: atest FrameworksNetTests
      atest FrameworksWifiTests
      atest FrameworksTelephonyTests: some failure in CarrierAppUtilsTest
Copy from ag/10731108
Change-Id: Id01e6135193716cc21bba11da529bf1507a954f7
Merged-In: Id01e6135193716cc21bba11da529bf1507a954f7
2020-03-24 10:55:18 +00:00
TreeHugger Robot
f03a6d289f [automerger skipped] Merge "Fix addRoute replace default route unexpectedly" into rvc-dev am: 887941cbc8 -s ours
am skip reason: Change-Id I7153ec9866f14a109ba8155c905e5d9e4f85eb64 with SHA-1 a1493a52d0 is in history

Change-Id: Iada19e842e8728858517dca1de7a0def0748e157
2020-03-24 10:51:47 +00:00
Xiao Ma
2772ddd5bd Add CTS tests for ApfCapabilities static APIs.
Add tests for getApfEtherTypeBlackList and getApfDrop8023Frames APIs.

Bug: 150640397
Test: atest CtsNetTestCasesLatestSdk:android.net.apf.ApfCapabilitiesTest
      on both of Q and R devices.
Change-Id: I06c5d84d7025420a1e45a953c8c7a5cc3c452e24
2020-03-24 19:38:21 +09:00
markchien
9d26f92289 Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests

Clean CP from ag/10747732

Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
Merged-In: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
2020-03-24 09:19:26 +00:00
Treehugger Robot
cbd7b6b1dd Fix addRoute replace default route unexpectedly
In aosp/1203789, if two routes are with the same destination,
it will be replaced instead of added when calling addRoute.
This breaks scenarios which rely on the ability to add multiple
default routes, such as multiple IPv6 default routes learned
via address autoconfiguration.

This change treats the route is an update if the destination
and nexthop are the same, but different in other properties.

Test: atest OffloadControllerTest#testSetUpstreamLinkPropertiesWorking
Test: atest LinkPropertiesUtilsTest#testLinkPropertiesIdenticalEqual
Test: atest ConnectivityServiceTest#testStackedLinkProperties
Test: atest ConnectivityServiceTest#testRouteAddDeleteUpdate
  (only directly related tests are listed)
Fix: 152170074
Fix: 151911339
Bug: 142892223

Change-Id: I7153ec9866f14a109ba8155c905e5d9e4f85eb64
Merged-In: I7153ec9866f14a109ba8155c905e5d9e4f85eb64
(cherry picked from commit 11aa9cb44aee289329b306cfc51a73cfe1456b61)
2020-03-24 08:41:44 +00:00
Treehugger Robot
c73de276e3 Merge "Fix addRoute replace default route unexpectedly" am: 56d39d3251 am: c6a56b7678
Change-Id: I59759bb5241f24f5b0a3359c9c9bdb089b1b9515
2020-03-24 06:15:24 +00:00
Treehugger Robot
be64d88ab1 Merge "Fix addRoute replace default route unexpectedly" am: 56d39d3251 am: c6a56b7678
Change-Id: I62f5226f92948414838b332610262d9f6f395570
2020-03-24 06:15:19 +00:00
Treehugger Robot
c6a56b7678 Merge "Fix addRoute replace default route unexpectedly" am: 56d39d3251
Change-Id: I43e953159c33c267a5fd7f6359ed8ee8d683affb
2020-03-24 06:03:10 +00:00
Treehugger Robot
56d39d3251 Merge "Fix addRoute replace default route unexpectedly" 2020-03-24 05:51:30 +00:00
junyulai
a1493a52d0 Fix addRoute replace default route unexpectedly
In aosp/1203789, if two routes are with the same destination,
it will be replaced instead of added when calling addRoute.
This breaks scenarios which rely on the ability to add multiple
default routes, such as multiple IPv6 default routes learned
via address autoconfiguration.

This change treats the route is an update if the destination
and nexthop are the same, but different in other properties.

Test: atest OffloadControllerTest#testSetUpstreamLinkPropertiesWorking
Test: atest LinkPropertiesUtilsTest#testLinkPropertiesIdenticalEqual
Test: atest ConnectivityServiceTest#testStackedLinkProperties
Test: atest ConnectivityServiceTest#testRouteAddDeleteUpdate
  (only directly related tests are listed)
Fix: 152170074
Fix: 151911339
Bug: 142892223

Change-Id: I7153ec9866f14a109ba8155c905e5d9e4f85eb64
2020-03-24 10:27:01 +08:00
Automerger Merge Worker
21105c9771 Clean up unit testing for ConnectivityDiagnostics.
Connectivity Diagnostics included an unnecessary try-catch for verifying
that the permissions check for invoking ConnectivityDiagnosticsCallbacks
doesn't throw when the uid and package name do not match.

Bug: 149119324
Test: atest FrameworksNetTests
Change-Id: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
Merged-In: Ie302b1f4f437e819fdd15ec28adb0b56750c2c53
(cherry picked from commit 66b5e081b785a3b7e2a032342d4d424905581cf9)
2020-03-23 17:35:15 -07:00
Cody Kesting
cf7bb0ee06 Restrict VPN Diagnostics callbacks to underlying networks.
ConnectivityDiagnosticsCallbacks should only be invoked for the
underlying networks declared by active VPNs. This encourages VPN apps to
declare their underlying networks.

The previous permission model for VPNs allowed active VPNs to receive
callbacks on any network.

Bug: 148903617
Test: atest FrameworksNetTests
Change-Id: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b
Merged-In: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b
(cherry picked from commit e1f0c56f74593d3781bfa4ee4871a5efbabe303c)
2020-03-23 17:35:15 -07:00
Tobias Thierer
8e155b902c Merge "Refactor Network's use of mUrlConnectionFactory." am: f06634ae70 am: a831fdfb1f
Change-Id: I9634a6830d2436c3ba105a4ba61aeba4c1c68f06
2020-03-23 12:08:39 +00:00
Tobias Thierer
d8dff567fa Merge "Refactor Network's use of mUrlConnectionFactory." am: f06634ae70 am: a831fdfb1f
Change-Id: I7ce77a1735521cc10ee16a4c6f45e59c0a87585a
2020-03-23 12:08:11 +00:00
Tobias Thierer
a831fdfb1f Merge "Refactor Network's use of mUrlConnectionFactory." am: f06634ae70
Change-Id: I3ad8fd8479e91bc34b21297b7953a38372431a8c
2020-03-23 11:52:22 +00:00
Tobias Thierer
f06634ae70 Merge "Refactor Network's use of mUrlConnectionFactory." 2020-03-23 11:34:43 +00:00
Tobias Thierer
47c0d852da Refactor Network's use of mUrlConnectionFactory.
1.) Replace maybeInitUrlConnectionFactory() with a static method
    createUrlConnectionFactory(Dns) and move the logic to acquire
    the lock and initialize mUrlConnectionFactory out into
    openConnection. This makes it a bit clearer that the lock
    is acquired during openConnection().
2.) Use @GuardedBy("mLock") rather than a human readable comment
    on mUrlConnectionFactory.
3.) Make mUrlConnectionFactory non-volatile (since it's guarded by
    mLock), as recommended by Narayan on the review thread for
    http://r.android.com/370652
    Alternatively, the field could have remained volatile
    and we could have used double-checked locking to avoid
    acquiring the lock in the common case.
    The lock is only acquired during getSocketFactory() and
    openConnection(), so it shouldn't usually be contended.

This CL is a pure refactoring that shouldn't have any observable
behavior change.

Bug: 38311512
Test: Treehugger
Exempt-From-Owner-Approval: refactoring only, owner didn't respond in time
Change-Id: I1cf6075dc7cd994657b11d6a82de3ec63235fb1e
2020-03-23 11:34:32 +00:00
Remi NGUYEN VAN
2015ebbef6 [automerger skipped] Merge changes from topic "netstack_constant_cherrypick" am: 10adc9a7b9 am: 4a2454f475 -s ours
am skip reason: Change-Id I7855090bffbe895c8349ad4903b8f2eb55515f0b with SHA-1 aa5dfd816a is in history

Change-Id: I278c197256ccd394636c8283a5988ad57b5d7bfe
2020-03-23 04:04:40 +00:00
Remi NGUYEN VAN
5a5e5f9585 Merge changes from topic "netstack_constant_cherrypick" am: 10adc9a7b9 am: 4a2454f475
Change-Id: I393d8cc8ace27aaeed9ff6cb26bc52551628b8a1
2020-03-23 04:04:33 +00:00
Remi NGUYEN VAN
4a2454f475 Merge changes from topic "netstack_constant_cherrypick" am: 10adc9a7b9
Change-Id: I4fa3f771fe93e9b6024828d9c725502629c1ccff
2020-03-23 03:48:08 +00:00
Remi NGUYEN VAN
10adc9a7b9 Merge changes from topic "netstack_constant_cherrypick"
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant
2020-03-23 03:33:58 +00:00
Remi NGUYEN VAN
fbb0836bc6 Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Merged-In: I7855090bffbe895c8349ad4903b8f2eb55515f0b
(clean cherry-pick from internal branch)

Change-Id: If4af2846a82605e828287a9a4680d5547b76b802
2020-03-23 11:29:06 +09:00
TreeHugger Robot
81c20c25ec Merge "DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master" into stage-aosp-master am: a49dc47a50
Change-Id: I90bb2d5c1feb7f74f3677828454599a7f7bb2e88
2020-03-20 18:33:07 +00:00
Xin Li
e83b706777 DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master am: 68fa07d352
Change-Id: Ief9788fe26220b3f31d99c46a38aa6992e41d56e
2020-03-20 18:32:31 +00:00
TreeHugger Robot
d163385d42 [automerger skipped] Merge "DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master" into stage-aosp-master am: a49dc47a50 -s ours
am skip reason: subject contains skip directive

Change-Id: Ia1f95f590e25c34b4bb6dcf91c06f46a1494c523
2020-03-20 18:31:59 +00:00
TreeHugger Robot
a49dc47a50 Merge "DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp@6304901 into stage-aosp-master" into stage-aosp-master 2020-03-20 18:15:02 +00:00
Aaron Huang
4a92f0ce93 Merge "API review: access field by method" into rvc-dev am: de4c7dcda4
Change-Id: If07f22d62b3fcc341063aaf98130da9c90f7d953
2020-03-20 11:24:32 +00:00