Commit Graph

8742 Commits

Author SHA1 Message Date
Chalard Jean
4f37a69550 Add combine() and equals() for NetworkCapabilities admin UIDs. am: 0d667c5508
Change-Id: I4b52b619cde3b080bfe58f69dacdb0078a11a7e8
2020-04-01 01:33:30 +00:00
Cody Kesting
184d5e8dd0 Use IBinder as key for ConnectivityDiagnostics storage in CS. am: b65e18e638
Change-Id: I9b75e908b217cf518281e1d8471af66022c65667
2020-04-01 01:33:24 +00:00
Cody Kesting
10e11764d5 Decrement networkRequestPerUid when callbacks are unregistered. am: aebda983d3
Change-Id: I8710a66725a0d09ca652ad8ce6fc7ced0070f647
2020-04-01 01:33:22 +00:00
Cody Kesting
f37380f8cf Invoke onConnectivityReport on registering ConnectivityDiagnostics. am: fe059d8c30
Change-Id: I20430c60e27b9c3b4210ec037b71accac376ca44
2020-04-01 01:33:19 +00:00
Cody Kesting
2a26e7cfa8 Merge "Clean up handling of NetworkCapabilities#administratorUids." into rvc-dev am: c161f59909
Change-Id: I729db9d97d69a088c272a64d270aa05be474ed87
2020-03-31 18:01:30 +00:00
Cody Kesting
c161f59909 Merge "Clean up handling of NetworkCapabilities#administratorUids." into rvc-dev 2020-03-31 17:46:57 +00:00
Benedict Wong
6a0996a110 Merge changes I97ba5903,Icd80b368 into rvc-dev am: d3d72d4452
Change-Id: I5f6ac7365512b16597abae5d9f5306a755bb4879
2020-03-31 17:12:33 +00:00
Benedict Wong
701b0cc046 Merge "Automatically set IPsec tunnel interface as up" into rvc-dev am: c0192c1df6
Change-Id: Ie0ff250e5ff36b317932053a950e49df9eae2e9f
2020-03-31 17:11:16 +00:00
Benedict Wong
d3d72d4452 Merge changes I97ba5903,Icd80b368 into rvc-dev
* changes:
  Make VpnProfile.maxMtu default value match Ikev2VpnProfile
  Add negotiated DNS servers to VPN config
2020-03-31 16:52:04 +00:00
Benedict Wong
c0192c1df6 Merge "Automatically set IPsec tunnel interface as up" into rvc-dev 2020-03-31 16:51:58 +00:00
Benedict Wong
cbb19fcba7 Make VpnProfile.maxMtu default value match Ikev2VpnProfile
This change corrects the VpnProfile's maxMtu defaults to match that of
the Ikev2VpnProfile. 1400 is too high as a default, and Settings will
run into an issue here quite often.

Bug: 152573931
Test: FrameworksNetTests passing
Change-Id: I97ba5903b3cc1ed6a21c706ed3d78bd8ecbeee0c
Merged-In: I97ba5903b3cc1ed6a21c706ed3d78bd8ecbeee0c
(cherry picked from commit d0a44f49df01a1aefa505ee90c9806dee135b4e4)
2020-03-30 22:59:17 -07:00
Chalard Jean
0d667c5508 Add combine() and equals() for NetworkCapabilities admin UIDs.
NetworkCapabilities#mAdministratorUids should be checked for equality
when combining NetworkCapabilities. Administrator UIDs should also be
included in NetworkCapabilities equals() and hashCode().

Bug: 147903575
Test: FrameworksNetTests
Change-Id: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
Merged-In: I803bdec80e27ee80d3a39844c5fb7aed584ab07d
(cherry picked from commit 5fad8aa761336012bb228afc3b6f7d42fa274242)
2020-03-30 17:14:33 -07:00
Cody Kesting
b65e18e638 Use IBinder as key for ConnectivityDiagnostics storage in CS.
This change updates ConnectivityService to use IBinder instances as keys
when storing ConnectivityDiagnosticsCallbacks.

When storing ConnectivityDiagnosticsCallbacks in ConnectivityService,
the IConnectivityDiagnsoticsCallback is used as the key for
ConnectivityService.mConnectivityDiagnosticsCallbacks. However,
IConnectivityDiagnosticsCallback instances are received as different
objects. This causes them to produce different hashCode() values, so
attempts to remove an IConnectivityDiagnosticsCallback fail.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2
Merged-In: Ib99e68d5ae47fa27e12428f9a60a2c1204ac59a2
(cherry picked from commit c7c6a4ac12beb7c216076958612869426da06da0)
2020-03-30 17:14:20 -07:00
Cody Kesting
aebda983d3 Decrement networkRequestPerUid when callbacks are unregistered.
ConnectivityDiagnosticsCallbacks are tied to NetworkRequestInfo objects
when registered with the platform. Each NetworkRequestInfo is tied to a
specific uid, and ConnectivityService enforces a limit on the number of
network requests that can be associated with each uid.

When ConnectivityDiagnosticsCallbacks are unregistered from the
platform, their NetworkRequestInfo is freed and the number of network
requests per the user's uid should be decremented.

Bug: 150802582
Test: atest android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: Ia5ed39c1d8e6221cd402be4f8baf69fa643a6113
Merged-In: Ia5ed39c1d8e6221cd402be4f8baf69fa643a6113
(cherry picked from commit 662076b1a7c0f064fa746fc7b8d3204c966c8e48)
2020-03-30 17:14:07 -07:00
Cody Kesting
fe059d8c30 Invoke onConnectivityReport on registering ConnectivityDiagnostics.
This change updates the behavior for registering
ConnectivityDiagnosticsCallbacks. Now, after a successful register()
call, callbacks will receive cached ConnectivityReports for all
matching, permissioned networks. This allows registrants to be updated
with the network state for their networks without having to wait for the
next network validation.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I924ba8fdcc847f453557021591bde38602fe089c
Merged-In: I924ba8fdcc847f453557021591bde38602fe089c
(cherry picked from commit 95ec0b206b759e1d26bc1dbb2255a515bb24358a)
2020-03-30 17:13:55 -07:00
Cody Kesting
9f8773c32e Clean up handling of NetworkCapabilities#administratorUids.
Update ConnectivityService's check for administrator UIDs to use
ArrayUtils to check for UID inclusion. Update the NetworkCapabilities
annotation on the administrator UIDs field to clarify that it is
NonNull.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
Merged-In: Id630fe9d76aacdaf038fdaa5360f0327520ee0c3
(cherry picked from commit 898496365aa1f3601cdbb305004ad0de11ff6bfc)
2020-03-30 17:13:37 -07:00
Xiao Ma
c8d62edc76 Merge "Add CTS tests for ApfCapabilities static APIs." into rvc-dev am: 18511e3b08
Change-Id: If3bf3a905dcb466fb01574b6e244c5818c6577a8
2020-03-30 08:06:39 +00:00
Xiao Ma
18511e3b08 Merge "Add CTS tests for ApfCapabilities static APIs." into rvc-dev 2020-03-30 07:46:30 +00:00
Xiao Ma
ef40b406c5 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: I11555934df4b27cbb6b7ddbb81022d8fb7c25e15
Merged-In: I11555934df4b27cbb6b7ddbb81022d8fb7c25e15
(cherry picked from commit 7d51a72487dba5b2747a9de12f50ba2087007264)
2020-03-30 05:41:02 +00:00
TreeHugger Robot
85a358e793 Merge "Unbreak testStartUsingNetworkFeature_enableHipri failure" into rvc-dev am: 60e3892fec
Change-Id: Ib70529204dab1f6e43dbc46538c90f8fdddc66bc
2020-03-30 04:39:32 +00:00
Mark Chien
9904c69fa5 Unbreak testStartUsingNetworkFeature_enableHipri failure
aosp/1261619 break legacy API that only supported for SDK which is
smaller than android M, caller need to have network stack permission
to request network with legacy type. Fix failure by whitelist permission
check for the caller who built with order SDK(< M).

Bug: 152229492
Test: atest CtsTetheringTest
      atest ConnectivityManagerLegacyTest# \
      testStartUsingNetworkFeature_enableHipri

Change-Id: I02504c0eed10ee4e08c8fbf032951022255ba5fa
Merged-In: I367dff0429f26f266282300edc38637b55eece38
(cherry picked from commit b1c8acf0d6ba1fe35d8e81673d2c5c24fa2fea79)
2020-03-30 02:26:57 +00:00
Hall Liu
c8e3578fe0 Merge changes from topic "phonestatelistener-limit-rvc-dev" into rvc-dev am: f5d30b7870
Change-Id: Ic9004aa98a71d52c45c88a5636970f7e156cbca0
2020-03-28 06:55:28 +00:00
Hall Liu
f5d30b7870 Merge changes from topic "phonestatelistener-limit-rvc-dev" into rvc-dev
* changes:
  Add gating, logging for PhoneStateListener's limit
  Institute limit on PhoneStateListener
2020-03-28 06:48:56 +00:00
Hall Liu
f4667b4925 Add gating, logging for PhoneStateListener's limit
Add gating via PlatformCompat and DeviceConfig and logging via
PlatformCompat to the limit instituted on per-process listeners

Fixes: 152074216
Test: atest CtsTelephonyHostCases
Change-Id: I4d6681d90705b68c3349f4124e434a29b50fd3a2
2020-03-27 19:21:51 -07:00
Chalard Jean
a33e2487bc Merge changes from topics "api-fix-networkagent", "networkprovider_api", "satisfiedby" into rvc-dev am: 199c91b659
Change-Id: Ie0cf94ac30f7edd36aaf82344c68a18d13d7a45c
2020-03-27 22:58:45 +00:00
Chalard Jean
d34f9bd050 Address further API council comments. am: 812e8cb87e
Change-Id: I539d05a584c40606f0f27bff06e9585407b53cd8
2020-03-27 22:58:41 +00:00
Chalard Jean
07299c8536 Update the NetworkProvider API for council comments am: fd23dbbf07
Change-Id: If7798e35b8c8f4ba4b70cedd9689dcf84caf140f
2020-03-27 22:58:34 +00:00
Chalard Jean
199c91b659 Merge changes from topics "api-fix-networkagent", "networkprovider_api", "satisfiedby" into rvc-dev
* changes:
  Rename satisfiedBy into canBeSatisfiedBy
  Address further API council comments.
  Update the NetworkProvider API for council comments
2020-03-27 22:50:42 +00:00
Cody Kesting
4e0c7d0a79 Merge "Clean up unit testing for ConnectivityDiagnostics." into rvc-dev am: 26177212ed
Change-Id: Icff8ed1cf90927e521c8294aaec8bfdd6a4ccc4d
2020-03-27 19:23:37 +00:00
Cody Kesting
26177212ed Merge "Clean up unit testing for ConnectivityDiagnostics." into rvc-dev 2020-03-27 19:09:00 +00:00
Cody Kesting
3e5d74c460 Merge "Restrict VPN Diagnostics callbacks to underlying networks." into rvc-dev am: 5657f9c83c
Change-Id: Ibd8c0920b66899d36058f249904d33fe14ce9504
2020-03-27 18:38:07 +00:00
Cody Kesting
5657f9c83c Merge "Restrict VPN Diagnostics callbacks to underlying networks." into rvc-dev 2020-03-27 18:22:20 +00:00
Chalard Jean
51b8e287ad Rename satisfiedBy into canBeSatisfiedBy
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I076876a6662bde143ef7d315ce3767acafff93c1
2020-03-27 23:46:30 +09:00
Chalard Jean
812e8cb87e Address further API council comments.
Test: FrameworksNetTests NetworkStackTests
Bug: 152238712
Change-Id: I8a785ae0e74e659c317deaaa28c203356c7766ed
2020-03-27 17:57:24 +09:00
Chalard Jean
fd23dbbf07 Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
2020-03-27 17:53:05 +09:00
Chalard Jean
5865abc24d Merge changes from topic "networkagent_api" into rvc-dev am: f79df94011
Change-Id: Ie7e013eabbe39c96dc058c25aed520093131771e
2020-03-27 06:23:44 +00:00
Chalard Jean
f79df94011 Merge changes from topic "networkagent_api" into rvc-dev
* changes:
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments
2020-03-27 06:20:37 +00:00
Chalard Jean
15a3adbdf3 Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
2020-03-25 22:43:13 +09:00
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
9e34f4a117 Merge "Allow MANAGE_TEST_NETWORKS to register limited agents" into rvc-dev am: 09b1ee6077
Change-Id: I8d89e1e9737404d5ed47c8ab83d7d3dfa374a3bf
2020-03-25 13:19:40 +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
Aaron Huang
e056f0cbfb Merge "API review: make exception class and Builder final" into rvc-dev am: 9c9366b2df
Change-Id: I520c6df0ed11e24dfbb6e5c394d68e7761d515f2
2020-03-25 09:47:22 +00: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
Lucas Lin
af66a2204e Merge "Fix NetworkCapabilitiesTest fail on Q device" into rvc-dev am: 1aff262943
Change-Id: I2abfbcfbf39d9b82e581d91c873481ef4327cacb
2020-03-25 02:09:28 +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
TreeHugger Robot
a17252df6a Merge "Fix addRoute replace default route unexpectedly" into rvc-dev am: 887941cbc8
Change-Id: I975b793977c7ea01c71f603fa2912373ffc5aaaf
2020-03-24 10:51:09 +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
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