Commit Graph

8333 Commits

Author SHA1 Message Date
Lorenzo Colitti
b9cd996758 Merge "Only apply VPN isolation if it's fully routed" am: f198a43744
Change-Id: I5267b567e1b9babe3bc95d2984262dc864681a2d
2020-04-02 04:32:04 +00:00
Lorenzo Colitti
f198a43744 Merge "Only apply VPN isolation if it's fully routed" 2020-04-02 04:10:12 +00:00
Junyu Lai
e040b441b0 Merge changes from topic "sp26-networkstats-cts" am: 78bae7423a
Change-Id: I124f0def6fdaad8f1726df23edc87b6aa7856586
2020-04-02 02:21:26 +00:00
junyulai
61860a023a [SP26.2] add a method in NetworkStats that removes empty entries am: 6d745cc0a8
Change-Id: Ieee0896672625f3bab9ec02a5efa495a9d1f001b
2020-04-02 02:21:20 +00:00
Junyu Lai
78bae7423a 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
6d745cc0a8 [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
169246fd17 [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
fa429013a0 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
18483161bc Merge changes from topics "networkagent_api", "networkprovider_api" am: e6d2e6c4ac
Change-Id: I553a53bc4612fc367591738d9669e354730fdacc
2020-04-01 05:47:04 +00:00
Chalard Jean
0b32491fc4 Update NetworkAgentConfig API for council comments am: e5b9e82f86
Change-Id: I195c50ee1db2dd26b7c06f4ecbd6dbccc38895ef
2020-04-01 05:46:58 +00:00
Chalard Jean
39709833c2 Update the NetworkAgent API for council comments am: 7fe99f5dfe
Change-Id: I1337011740d2c34f886a6d2975bd3da24f371bb8
2020-04-01 05:46:50 +00:00
Aaron Huang
e6d2e6c4ac 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
f886aaf81d Merge "Update CS helper for clearing NetworkCapabilities UIDs." am: 0a45ad1dc1
Change-Id: I6769788d7c0fade7bcab912c6a68f91161b25992
2020-03-31 20:33:17 +00:00
Cody Kesting
e6a16e1466 Merge "Simplify unregister logic for Connectivity Diagnostics callbacks." am: b2582a32e8
Change-Id: I798827a3505f460a5baf633ee2d3fb2422d65137
2020-03-31 20:32:59 +00:00
Cody Kesting
0a45ad1dc1 Merge "Update CS helper for clearing NetworkCapabilities UIDs." 2020-03-31 20:18:17 +00:00
Cody Kesting
b2582a32e8 Merge "Simplify unregister logic for Connectivity Diagnostics callbacks." 2020-03-31 20:18:01 +00:00
Cody Kesting
0dcfdb77be Merge "Clarify comments for Connectivity Diagnostics reports." am: 71016c103f
Change-Id: If353d65d28842c6eb621a8881e9279a018fa9ffa
2020-03-31 18:02:08 +00:00
Cody Kesting
c475e2912b Merge "Sort administrator UIDs for NetworkCapabilities." am: 92e4bb4455
Change-Id: I4cfb80b1eb9edc5ad90a1aff957a0f6d1f3eb522
2020-03-31 18:01:47 +00:00
Cody Kesting
cfd382a47c Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." am: 1bf4b1f47b
Change-Id: Ic8b353d233eda759100952e126d77e9dd48005e5
2020-03-31 18:01:24 +00:00
Cody Kesting
71016c103f Merge "Clarify comments for Connectivity Diagnostics reports." 2020-03-31 17:43:44 +00:00
Cody Kesting
92e4bb4455 Merge "Sort administrator UIDs for NetworkCapabilities." 2020-03-31 17:43:02 +00:00
Cody Kesting
1bf4b1f47b Merge "Add combine() and equals() for NetworkCapabilities admin UIDs." 2020-03-31 17:42:18 +00:00
Cody Kesting
f580595f99 Merge "Use IBinder as key for ConnectivityDiagnostics storage in CS." am: aa53148caf
Change-Id: Ife76fa15b2dab71021251846aa69e9090f809941
2020-03-31 17:10:51 +00:00
Cody Kesting
aa53148caf Merge "Use IBinder as key for ConnectivityDiagnostics storage in CS." 2020-03-31 17:00:03 +00:00
Chalard Jean
12fe284e0c 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
e5b9e82f86 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
7fe99f5dfe 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
02b5ed5a6b Merge "Make VpnProfile.maxMtu default value match Ikev2VpnProfile" am: 548e1ecf4a
Change-Id: I525f947ce90d44c286a61d05297dd205e706a319
2020-03-31 02:37:52 +00:00
Benedict Wong
548e1ecf4a Merge "Make VpnProfile.maxMtu default value match Ikev2VpnProfile" 2020-03-31 02:22:54 +00:00
Cody Kesting
70897531b8 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
3dcaec1201 Merge "Decrement networkRequestPerUid when callbacks are unregistered." am: 95fa8eec8a
Change-Id: I1ac0276aa434748dbb22b82f0c4aca917875b168
2020-03-31 00:26:01 +00:00
Cody Kesting
c3a02d033f Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." am: 77f2293b06
Change-Id: I2d3e6be0923ec2a0d3197f71fb2d3149c40a5eea
2020-03-31 00:25:24 +00:00
Cody Kesting
95fa8eec8a Merge "Decrement networkRequestPerUid when callbacks are unregistered." 2020-03-31 00:07:01 +00:00
Cody Kesting
77f2293b06 Merge "Invoke onConnectivityReport on registering ConnectivityDiagnostics." 2020-03-31 00:06:26 +00:00
Cody Kesting
d30159678b Merge "Clean up handling of NetworkCapabilities#administratorUids." am: 7ac175925c
Change-Id: I69f1061972af362560a274084c94428b57bd46e8
2020-03-30 22:27:30 +00:00
Cody Kesting
7ac175925c Merge "Clean up handling of NetworkCapabilities#administratorUids." 2020-03-30 22:04:43 +00:00
Cody Kesting
970e77957c 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
782d0a044c 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
751d414caf 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
9e70d0d85f 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
0c55a30a9e 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
fc14fbea61 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
905b475a00 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
61c6b86550 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
c513ab9b0c Merge "Update constructor of NetworkMonitor" am: 42956a037c
Change-Id: I5ef9b48946acb83ada644600117c604028a5c0b5
2020-03-30 08:56:34 +00:00
Chiachang Wang
42956a037c Merge "Update constructor of NetworkMonitor" 2020-03-30 08:40:45 +00:00
Lucas Lin
a99cb3677c Merge "Fix NetworkCapabilitiesTest fail on Q device" am: 45bf0aab18
Change-Id: I591b621bb8b659aa7d0c163b20d03952589db428
2020-03-30 08:06:30 +00:00
Chiachang Wang
70dd24ba21 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
45bf0aab18 Merge "Fix NetworkCapabilitiesTest fail on Q device" 2020-03-30 07:41:01 +00:00
Aaron Huang
a62a8a0b63 Merge "Make LinkPropertiesTest compatible with Q" am: 0e9d759c56
Change-Id: I46148a6d1db0a64006cc1e0d829a0d472a37dda3
2020-03-30 06:25:55 +00:00