Commit Graph

8333 Commits

Author SHA1 Message Date
Lorenzo Colitti
d24e7fb5a1 Merge "Only apply VPN isolation if it's fully routed" am: 5c5d1a1282
Change-Id: I5267b567e1b9babe3bc95d2984262dc864681a2d
2020-04-02 04:32:04 +00:00
Lorenzo Colitti
5c5d1a1282 Merge "Only apply VPN isolation if it's fully routed" 2020-04-02 04:10:12 +00:00
Junyu Lai
8ea70c1969 Merge changes from topic "sp26-networkstats-cts" am: e71d3cf971
Change-Id: I124f0def6fdaad8f1726df23edc87b6aa7856586
2020-04-02 02:21:26 +00:00
junyulai
378271190c [SP26.2] add a method in NetworkStats that removes empty entries am: 1052557f33
Change-Id: Ieee0896672625f3bab9ec02a5efa495a9d1f001b
2020-04-02 02:21:20 +00:00
Junyu Lai
e71d3cf971 Merge changes from topic "sp26-networkstats-cts"
* changes:
  [SP26] add CTS for NetworkStats
  [SP26.2] add a method in NetworkStats that removes empty entries
2020-04-02 02:00:59 +00:00
junyulai
1052557f33 [SP26.2] add a method in NetworkStats that removes empty entries
In current design, entries with zeros are preserved after
addition/subtraction. These entries are not very useful
and lead to difficulty of verifying the result of
addition/subtraction.

However, change the behavior in the original NetworkStats
is considered risky in current stage.

Thus, this change provide a function that could remove these
empty entries in tests.

Test: atest FrameworksNetTests
Bug: 152827872
Bug: 150644692
Change-Id: I40a76935d55712b8083ee1e17e137a8a4ef5e029
2020-04-01 16:46:08 +08:00
junyulai
e47c7e42e5 [SP26] add CTS for NetworkStats
Test: atest NetworkStatsApiTest
Test: atest CtsNetTestCasesLatestSdk:NetworkStatsApiTest on Q device
Bug: 150644692
Change-Id: I690704b43cfd16de70c4c83916f6d750cf613f67
2020-04-01 16:46:08 +08:00
Rubin Xu
ab8cf306ea Only apply VPN isolation if it's fully routed
VPN is considered fully routed if both IPv4 and IPv6 have
either a default route or a prohibit route.

Bug: 145332510
Test: atest FrameworksNetTests
Change-Id: I59cf48552bca98092d1212e3d718fd420add5458
2020-04-01 09:36:29 +01:00
Aaron Huang
72b40b49e0 Merge changes from topics "networkagent_api", "networkprovider_api" am: f210e24871
Change-Id: I553a53bc4612fc367591738d9669e354730fdacc
2020-04-01 05:47:04 +00:00
Chalard Jean
1b2a71f06d Update NetworkAgentConfig API for council comments am: aea539a13e
Change-Id: I195c50ee1db2dd26b7c06f4ecbd6dbccc38895ef
2020-04-01 05:46:58 +00:00
Chalard Jean
4bc45aba0a Update the NetworkAgent API for council comments am: f5d1bfd77f
Change-Id: I1337011740d2c34f886a6d2975bd3da24f371bb8
2020-04-01 05:46:50 +00:00
Aaron Huang
f210e24871 Merge changes from topics "networkagent_api", "networkprovider_api"
* changes:
  Update the NetworkProvider API for council comments
  Update NetworkAgentConfig API for council comments
  Update the NetworkAgent API for council comments
2020-04-01 05:33:28 +00:00
Cody Kesting
2ecef3416b Merge "Update CS helper for clearing NetworkCapabilities UIDs." am: 28ce6a8970
Change-Id: I6769788d7c0fade7bcab912c6a68f91161b25992
2020-03-31 20:33:17 +00:00
Cody Kesting
b51ef5b7d7 Merge "Simplify unregister logic for Connectivity Diagnostics callbacks." am: bf4f1d9e98
Change-Id: I798827a3505f460a5baf633ee2d3fb2422d65137
2020-03-31 20:32:59 +00:00
Cody Kesting
28ce6a8970 Merge "Update CS helper for clearing NetworkCapabilities UIDs." 2020-03-31 20:18:17 +00:00
Cody Kesting
bf4f1d9e98 Merge "Simplify unregister logic for Connectivity Diagnostics callbacks." 2020-03-31 20:18:01 +00:00
Cody Kesting
1d99c7333f Merge "Clarify comments for Connectivity Diagnostics reports." am: 87ce14f328
Change-Id: If353d65d28842c6eb621a8881e9279a018fa9ffa
2020-03-31 18:02:08 +00:00
Cody Kesting
8d84479831 Merge "Sort administrator UIDs for NetworkCapabilities." am: c350963548
Change-Id: I4cfb80b1eb9edc5ad90a1aff957a0f6d1f3eb522
2020-03-31 18:01:47 +00:00
Cody Kesting
e0463c56eb Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." am: e4df39ba4b
Change-Id: Ic8b353d233eda759100952e126d77e9dd48005e5
2020-03-31 18:01:24 +00:00
Cody Kesting
87ce14f328 Merge "Clarify comments for Connectivity Diagnostics reports." 2020-03-31 17:43:44 +00:00
Cody Kesting
c350963548 Merge "Sort administrator UIDs for NetworkCapabilities." 2020-03-31 17:43:02 +00:00
Cody Kesting
e4df39ba4b Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." 2020-03-31 17:42:18 +00:00
Cody Kesting
8426b0a531 Merge "Use IBinder as key for ConnectivityDiagnostics storage in CS." am: 852715df47
Change-Id: Ife76fa15b2dab71021251846aa69e9090f809941
2020-03-31 17:10:51 +00:00
Cody Kesting
852715df47 Merge "Use IBinder as key for ConnectivityDiagnostics storage in CS." 2020-03-31 17:00:03 +00:00
Chalard Jean
5f12f81206 Update the NetworkProvider API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826397
Change-Id: I6b086572cfc72a0727f4510351cff0e74cbc4302
Merged-In: I6b086572cfc72a0727f4510351cff0e74cbc4302
2020-03-31 11:57:59 +00:00
Chalard Jean
aea539a13e Update NetworkAgentConfig API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10826396
Change-Id: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
Merged-In: Idca9f243a5c955f4caa30921ee520e1a93b0d11a
2020-03-31 11:51:05 +00:00
Chalard Jean
f5d1bfd77f Update the NetworkAgent API for council comments
Bug: 152238712
Test: FrameworksNetTests NetworkStackTests
Copy from ag/10824609
Change-Id: I9a2691f783f4449348c3f767568e05620f0b9df5
Merged-In: I9a2691f783f4449348c3f767568e05620f0b9df5
2020-03-31 11:34:42 +00:00
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
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
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
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
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
4c3ce3670c Merge "Fix NetworkCapabilitiesTest fail on Q device" am: b1bf1f2d36
Change-Id: I591b621bb8b659aa7d0c163b20d03952589db428
2020-03-30 08:06:30 +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
Lucas Lin
b1bf1f2d36 Merge "Fix NetworkCapabilitiesTest fail on Q device" 2020-03-30 07:41:01 +00:00
Aaron Huang
a6bdfda91b Merge "Make LinkPropertiesTest compatible with Q" am: 9d66de5d5e
Change-Id: I46148a6d1db0a64006cc1e0d829a0d472a37dda3
2020-03-30 06:25:55 +00:00