Commit Graph

9588 Commits

Author SHA1 Message Date
Benedict Wong
538a86d63e Merge "Make VpnProfile.maxMtu default value match Ikev2VpnProfile" am: 0943dac366
Change-Id: I525f947ce90d44c286a61d05297dd205e706a319
2020-03-31 02:37:52 +00:00
Benedict Wong
0943dac366 Merge "Make VpnProfile.maxMtu default value match Ikev2VpnProfile" 2020-03-31 02:22:54 +00:00
Cody Kesting
f6adaa4185 Merge "Decrement networkRequestPerUid when callbacks are unregistered." am: dcf92c32c6 am: 21f7dba1e1
Change-Id: I10185578b859218680168cffdfcd8cd0f24de09c
2020-03-31 00:55:06 +00:00
Cody Kesting
22f3171c07 Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." am: a365c81bfa am: 7439991aec
Change-Id: Ib65d67f8d9a6e44d03f745cdcb27d7535fd40c58
2020-03-31 00:54:30 +00:00
Cody Kesting
89031bc74c Merge "Decrement networkRequestPerUid when callbacks are unregistered." am: dcf92c32c6 am: 21f7dba1e1
Change-Id: Iab77f83a544c2e0b6729f84c16cfd57f7f98dc64
2020-03-31 00:52:29 +00:00
Cody Kesting
ea729736d1 Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." am: a365c81bfa am: 7439991aec
Change-Id: I977106391a0723c2c105cd592ef67b6bf240abed
2020-03-31 00:51:43 +00:00
Cody Kesting
85308a5a14 Update CS helper for clearing NetworkCapabilities UIDs.
NetworkCapabilities needs to have its UIDs cleared (UID ranges, owner
UID, and administrator UIDs) before it can be shared with apps via
ConnectivityDiagnosticsCallback invocations. The previous helper used
for clearing these values mutated the provided NetworkCapabilities. This
is updated to instead return a sanitized copy of the provided
NetworkCapabilities

Bug: 148942124
Test: atest FrameworksNetTests
Change-Id: I2431a6d273d0d73432919baf41b4f66397f4b7dc
Merged-In: I2431a6d273d0d73432919baf41b4f66397f4b7dc
(cherry picked from commit 45bbc4f6ac910a2ea87eb6b2197e34db50d3ada8)
2020-03-30 17:46:59 -07:00
Cody Kesting
b1cd3ebfea Update CS helper for clearing NetworkCapabilities UIDs.
NetworkCapabilities needs to have its UIDs cleared (UID ranges, owner
UID, and administrator UIDs) before it can be shared with apps via
ConnectivityDiagnosticsCallback invocations. The previous helper used
for clearing these values mutated the provided NetworkCapabilities. This
is updated to instead return a sanitized copy of the provided
NetworkCapabilities

Bug: 148942124
Test: atest FrameworksNetTests
Change-Id: I2431a6d273d0d73432919baf41b4f66397f4b7dc
2020-03-30 17:40:49 -07:00
Cody Kesting
21f7dba1e1 Merge "Decrement networkRequestPerUid when callbacks are unregistered." am: dcf92c32c6
Change-Id: I1ac0276aa434748dbb22b82f0c4aca917875b168
2020-03-31 00:26:01 +00:00
Cody Kesting
7439991aec Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." am: a365c81bfa
Change-Id: I2d3e6be0923ec2a0d3197f71fb2d3149c40a5eea
2020-03-31 00:25:24 +00:00
Cody Kesting
5d51a917f5 Simplify unregister logic for Connectivity Diagnostics callbacks.
ConnectivityService is updated to simplify the logic for unregistering
ConnectivityDiagnosticsCallback instances. This change removes the given
callback from ConnectivityService's data structure. If the callback was
not registered with ConnectivityService, it is logged and the function
exits; else, the unregister() operation continues.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: I9096969a1bf33da72b117f5bbc88257df805e688
Merged-In: I9096969a1bf33da72b117f5bbc88257df805e688
(cherry picked from commit f047313940b5af49a3b0e72a5f2d94fc1dda9c9d)
2020-03-30 17:15:09 -07:00
Cody Kesting
7d4ef21010 Clarify comments for Connectivity Diagnostics reports.
Clarify when
ConnectivityDiagnosticsCallback#onConnectivityReportAvailable will be
invoked. Clarify when NetworkAgentInfo#mConnectivityReport will be null
vs non-null.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
Merged-In: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
(cherry picked from commit 604dd40cf077f42c2d4b6ff80ff41d89cfbcacee)
2020-03-30 17:14:56 -07:00
Cody Kesting
9c341963ac Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
Merged-In: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
(cherry picked from commit 2091bd9059d1d24f8c6bd1cd345361f185cab1ea)
2020-03-30 17:14:44 -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
Cody Kesting
dcf92c32c6 Merge "Decrement networkRequestPerUid when callbacks are unregistered." 2020-03-31 00:07:01 +00:00
Cody Kesting
a365c81bfa Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." 2020-03-31 00:06:26 +00:00
Cody Kesting
6b74605335 Merge "Clean up handling of NetworkCapabilities#administratorUids." am: eb0b80c9e5 am: 2ea7a457b0
Change-Id: I136e69cd6e1e64b93eed339efe92c38817cf2d00
2020-03-30 22:50:52 +00:00
Cody Kesting
5c96dc912b Merge "Clean up handling of NetworkCapabilities#administratorUids." am: eb0b80c9e5 am: 2ea7a457b0
Change-Id: Ie2e85fc61fe3765beebcc511f2256bd6b4c37b1f
2020-03-30 22:50:39 +00:00
Cody Kesting
2ea7a457b0 Merge "Clean up handling of NetworkCapabilities#administratorUids." am: eb0b80c9e5
Change-Id: I69f1061972af362560a274084c94428b57bd46e8
2020-03-30 22:27:30 +00:00
Cody Kesting
eb0b80c9e5 Merge "Clean up handling of NetworkCapabilities#administratorUids." 2020-03-30 22:04:43 +00:00
Cody Kesting
2b1a61cf4b Simplify unregister logic for Connectivity Diagnostics callbacks.
ConnectivityService is updated to simplify the logic for unregistering
ConnectivityDiagnosticsCallback instances. This change removes the given
callback from ConnectivityService's data structure. If the callback was
not registered with ConnectivityService, it is logged and the function
exits; else, the unregister() operation continues.

Bug: 150867635
Test: atest FrameworksNetTests
Change-Id: I9096969a1bf33da72b117f5bbc88257df805e688
2020-03-30 14:51:24 -07:00
Cody Kesting
9a4168bd3b Clarify comments for Connectivity Diagnostics reports.
Clarify when
ConnectivityDiagnosticsCallback#onConnectivityReportAvailable will be
invoked. Clarify when NetworkAgentInfo#mConnectivityReport will be null
vs non-null.

Bug: 147849853
Test: atest FrameworksNetTests
Change-Id: I748bd9ded72a34d89f13bd4362d6d4da62b910b8
2020-03-30 14:51:24 -07:00
Cody Kesting
ec5a0cb0ff Sort administrator UIDs for NetworkCapabilities.
Administrator UIDs stored in NetworkCapabilities should be sorted. This
allows for easier equals checks and hashCode computation. Additionally,
duplicate UIDs should be prevented.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: Ia5387ca2ce7c3fcbd04dc7fbff5266f7bcc71694
2020-03-30 14:51:24 -07:00
Chalard Jean
20e92eca29 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
2020-03-30 14:27:20 -07:00
Cody Kesting
31f1ff693b 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
2020-03-30 11:10:46 -07:00
Cody Kesting
46cb167e08 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
2020-03-30 11:10:46 -07:00
Cody Kesting
b77bf707c6 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
2020-03-30 11:10:46 -07:00
Cody Kesting
7b987276db 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
2020-03-30 16:55:21 +00:00
Chiachang Wang
42368e5de2 Merge "Update constructor of NetworkMonitor" am: 3402ee64ed am: 63f5da7bb6
Change-Id: I59f68083d374afc1d0bf38cc6abd5fe4cbe068d1
2020-03-30 09:12:37 +00:00
Chiachang Wang
96236d25ff Merge "Update constructor of NetworkMonitor" am: 3402ee64ed am: 63f5da7bb6
Change-Id: Ideb37b2e9cdcfbbb35919ac1e7ba0175166d3d61
2020-03-30 09:12:26 +00:00
Chiachang Wang
63f5da7bb6 Merge "Update constructor of NetworkMonitor" am: 3402ee64ed
Change-Id: I5ef9b48946acb83ada644600117c604028a5c0b5
2020-03-30 08:56:34 +00:00
Chiachang Wang
3402ee64ed Merge "Update constructor of NetworkMonitor" 2020-03-30 08:40:45 +00:00
Lucas Lin
6d27040af9 Merge "Fix NetworkCapabilitiesTest fail on Q device" am: b1bf1f2d36 am: 4c3ce3670c
Change-Id: I30e0cfc16e45eaeb03b71098314d6cdcedef84f5
2020-03-30 08:20:59 +00:00
Lucas Lin
66dc3653df [automerger skipped] Merge "Fix NetworkCapabilitiesTest fail on Q device" am: b1bf1f2d36 am: 4c3ce3670c -s ours
am skip reason: Change-Id I602ae32dae1ad29fe3293c541fa6d2cef01b81d3 with SHA-1 88cef1a242 is in history

Change-Id: Id82ae0b4426104a64758a9426e165d1c69087379
2020-03-30 08:20:35 +00:00
Lucas Lin
4c3ce3670c Merge "Fix NetworkCapabilitiesTest fail on Q device" am: b1bf1f2d36
Change-Id: I591b621bb8b659aa7d0c163b20d03952589db428
2020-03-30 08:06:30 +00:00
Xiao Ma
b57e276a52 [automerger skipped] Merge "Add CTS tests for ApfCapabilities static APIs." into rvc-dev am: 18511e3b08 -s ours
am skip reason: Change-Id I11555934df4b27cbb6b7ddbb81022d8fb7c25e15 with SHA-1 07a17aaa51 is in history

Change-Id: Ieb1ca59f2c72ac7ce731544cffeb8d48ad40561c
2020-03-30 08:06:18 +00:00
Chiachang Wang
0ab5158418 Update constructor of NetworkMonitor
Remove redundant parameter.

Bug: 152374582
Test: m -j40 ; atest FrameworksNetIntegrationTests
Change-Id: I3a636f0ea5145ac4435e06a9827bb8e01862542d
2020-03-30 07:52:02 +00:00
Xiao Ma
18511e3b08 Merge "Add CTS tests for ApfCapabilities static APIs." into rvc-dev 2020-03-30 07:46:30 +00:00
Lucas Lin
b1bf1f2d36 Merge "Fix NetworkCapabilitiesTest fail on Q device" 2020-03-30 07:41:01 +00:00
Aaron Huang
e59bf917ad Merge "Make LinkPropertiesTest compatible with Q" am: 9d66de5d5e am: a6bdfda91b
Change-Id: Iaf17474f9682c46c0a62870fd9f652e554bcf4a6
2020-03-30 06:39:00 +00:00
Aaron Huang
3425e2651a Merge "Make LinkPropertiesTest compatible with Q" am: 9d66de5d5e am: a6bdfda91b
Change-Id: Ifab1167a15748d6b774ab9939562e337c73d7da7
2020-03-30 06:38:49 +00:00
Aaron Huang
a6bdfda91b Merge "Make LinkPropertiesTest compatible with Q" am: 9d66de5d5e
Change-Id: I46148a6d1db0a64006cc1e0d829a0d472a37dda3
2020-03-30 06:25:55 +00:00
Aaron Huang
9d66de5d5e Merge "Make LinkPropertiesTest compatible with Q" 2020-03-30 06:06:32 +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
aa7e7dabc9 [automerger skipped] Merge "Unbreak testStartUsingNetworkFeature_enableHipri failure" into rvc-dev am: 60e3892fec -s ours
am skip reason: Change-Id I367dff0429f26f266282300edc38637b55eece38 with SHA-1 9eb9399321 is in history

Change-Id: Ifc19fecc1f19504a693eb8f2816c529853abbaf3
2020-03-30 04:39:24 +00:00
lucaslin
be8bbacfa2 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
Merged-In: I602ae32dae1ad29fe3293c541fa6d2cef01b81d3
2020-03-30 03:47:00 +00:00