Commit Graph

7692 Commits

Author SHA1 Message Date
Chalard Jean
2d45ce0b69 Merge "[NS A41] Cut out a function to update NAI info" 2020-02-09 04:56:37 +00:00
Cody Kesting
1e304edffd Merge "Fix typo in ConnectivityDiagnosticsManager constant." 2020-02-07 16:57:19 +00:00
Cody Kesting
75c1d97c4c Merge "Use waitForIdle() to wait for Threaded processing." 2020-02-06 15:54:53 +00:00
Cody Kesting
0b3645740c Merge "Fire ConnectivityDiagnostics callbacks on Connectivity reported." 2020-02-06 15:54:06 +00:00
Cody Kesting
daeccbf13e Merge "Implement INetworkMonitorCallbacks#notifyDataStallSuspected." 2020-02-06 15:47:26 +00:00
Chalard Jean
24344d7e72 [NS A41] Cut out a function to update NAI info
Test: ConnectivityServiceTest
Change-Id: I6d92fb1699eb0acb1bcd7baa4a5d9d3e1c0dc728
2020-02-06 18:03:30 +09:00
Chalard Jean
47dad79bf6 Merge "[NS A40] Read current reassignment state instead of global state" 2020-02-06 04:14:43 +00:00
Cody Kesting
d0bb3fe33a Use waitForIdle() to wait for Threaded processing.
Unit testing for ConnectivityDiagnostics API in ConnectivityServiceTest
is updated to use HandlerUtilsKt#waitForIdle. In the general case, this
takes the same time to run as verify-with-timeout (used previously).
However, test failures due to messages not being enqueued on the handler
(backed by the ConnectivityService Thread) won't incur the timeout
delay, as the thread will be idle sooner. This shortens the delay in the
event of a programming error.

Bug: 143187964
Test: atest FrameworksNetTests
Change-Id: Iae66309501bb83449ca735dfa5e972a9852cbcd0
2020-02-05 15:05:29 -08:00
Cody Kesting
5a9a2ae4b4 Fire ConnectivityDiagnostics callbacks on Connectivity reported.
When ConnectivityService#reportNetworkTested is called, the platform
needs to fire ConnectivityDiagnostics callbacks for registered callbacks
that are permissioned for the network being reported on. This adds a new
event to ConnectivityDiagnosticsHandler for invoking these callbacks.

Bug: 143187964
Test: compiles
Test: atest CtsNetTestCases ConnectivityServiceTest
Change-Id: Icc6bcf7a2411133d8ecd7477bc351dad9333f24f
Merged-In: Icc6bcf7a2411133d8ecd7477bc351dad9333f24f
2020-02-05 15:05:29 -08:00
Cody Kesting
b12ad4ca3a Implement INetworkMonitorCallbacks#notifyDataStallSuspected.
INetworkMonitorCallbacks defines notifyDataStallSuspected() for
notifying ConnectivityService of networks encountering a potential data
stall. A new event is introduced for ConnectivityDiagnosticsHandler to
process the notification and invoke the relevant
ConnectivityDiagnosticsCallbacks.

Bug: 143187964
Test: compiles
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I70320bdda9855dced31e08e6a0b25329fb5cb535
Merged-In: I70320bdda9855dced31e08e6a0b25329fb5cb535
2020-02-05 15:05:28 -08:00
Cody Kesting
e10545c736 Merge "Implement INetworkMonitorCallbacks#notifyNetworkTestedWithExtras." 2020-02-05 19:55:05 +00:00
Cody Kesting
83bb5fa762 Implement INetworkMonitorCallbacks#notifyNetworkTestedWithExtras.
INetworkMonitorCallbacks defines notifyNetworkTestedWithExtras() for
notifying ConnectivityService of networks being tested along with a
PersistableBundle of extras. A new event is introduced for
NetworkStateTrackerHandler to notify the ConnectivityDiagnosticsHandler
before continuing with the normal processing for "network tested"
notifications. The event is also used in the
ConnectivityDiagnosticsHandler.

Bug: 143187964
Bug: 147391402
Test: compiles.
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Iab29da790c0f5faae68227770bc3a84bbc94f124
Merged-In: Iab29da790c0f5faae68227770bc3a84bbc94f124
2020-02-05 18:48:12 +00:00
Cody Kesting
c95f96910b Fix typo in ConnectivityDiagnosticsManager constant.
This change fixes a typo in the value assigned to the constant
KEY_NETWORK_PROBES_ATTEMPTED_BITMASK, which is defined in
ConnectivityDiagnosticsManager.ConnectivityReport.

Bug: 148939502
Test: compiles
Change-Id: I63863efa8c69593012bf4e95d896db192c6bfb5c
2020-02-05 08:56:48 -08:00
Chalard Jean
f1211e9531 Merge changes Ic1a5d032,I271e7f4d,I7af37281
* changes:
  [NS A39] Simplification
  [NS A38] Fill the initial reassignment
  [NS A37] Don't reassign requests multiple times
2020-02-05 00:53:28 +00:00
Benedict Wong
e2684df6ef Merge "Add separate user consent for Platform VPNs" 2020-02-04 23:56:16 +00:00
Benedict Wong
a73199168b Add separate user consent for Platform VPNs
This change adds a new VPN user consent flow (using the same text) for
granting the lesser OP_ACTIVATE_PLATFORM_VPN. A new
PlatformVpnConfirmDialog is created as a subclass to preserve all logic,
but ensure the right appop is granted for the relevant dialog.

Intent extras were considered, but are inherently unsafe, since the
caller may add any extras that they would want.

Bug: 144246835
Test: FrameworksNetTests passing
Change-Id: Ia6f36207d43c3748f938430c2780dcf29e5623f3
Merged-In: Ia6f36207d43c3748f938430c2780dcf29e5623f3
2020-02-04 21:05:36 +00:00
Chalard Jean
7e416aa19e [NS A40] Read current reassignment state instead of global state
The reassignment state has the future value, but is transient
instead of global. With this, the reassignment loop does not
read from global state any more, so it's not affected by the
side effects from the loop.

This means future patches will be able to move the side effects
out of the computation.

Test: atest ConnectivityServiceTest
Change-Id: I43499f19730bcd94b691cfea83aa1ca1d3de75db
2020-02-04 21:18:25 +09:00
Chalard Jean
933ebfa503 [NS A39] Simplification
If newNetwork is satisfying this request, it means it is the old
satisfier. Plain and simple.

Test: ConnectivityServiceTest
Change-Id: Ic1a5d032801bac476b1c1f53da6f1c4c6056bff0
2020-02-04 16:49:54 +09:00
Chalard Jean
b7ebc8a28f [NS A36] Add a test for lost trusted capability
This bug will be drive-by fixed by the next refactoring, so
set up a test to see the difference.

Bug: 113554781
Test: this
Change-Id: Icb062ffbae904d1836a4a16fc5395687c3eda7b6
2020-02-04 16:49:54 +09:00
Chalard Jean
84292aaa46 [NS A38] Fill the initial reassignment
This is more expensive for now but it will allow subsequent patches
to read relevant state from the reassignment instead of from the
global state, which will stop the computation of the reassignment
from reading state that is mutated by the same loop. Eventually
this lets us completely split the computation from the side effects.
The ugly parts of this patch will be cleaned up later as a result,
namely in patches [NS B04] and [NS B05].

Test: ConnectivityServiceTest
Change-Id: I271e7f4d4bc81493c1ea212025b7130619592a8a
2020-02-04 16:49:54 +09:00
Chalard Jean
bf91f5f182 [NS A37] Don't reassign requests multiple times
This is an optimization that skips doing intermediate assignments
of networks to requests that will undergo multiple changes during
the recomputation.
It happens to fix a bug where some of these intermediate states
used to have a visible, transient side effect.

Bug: 113554781
Test: ConnectivityServiceTest
Change-Id: I7af3728152a1cf7571de67f394088a5970ee3c1e
2020-02-04 16:49:54 +09:00
Chalard Jean
04bc807898 [NS A35] Send updated scores to factories at the end.
Test: ConnectivityServiceTests
Change-Id: I66c4e8f52e11bc7e199dd8c12d43b0b136a21f19
2020-02-04 16:49:53 +09:00
Chalard Jean
adf1aafb53 [NS A34] Still more simplification
Test: ConnectivityServiceTest
Change-Id: I85247411eb8fdfb3eae0e7c309ea9537e41cfb80
2020-02-04 16:49:53 +09:00
Chalard Jean
8e382110b8 [NS A33] Unify changing the default network
makeDefault() will be called in rematchAllNetworksAndRequests
in all cases and its first job is to set mDefaultNetwork.

The old code checks if the currently processing request is
the default request and assigns mDefaultNetwork if it is,
doing it earlier than in the new code iff the new default is
not null. However there is no good reason to assign this
member earlier in the non-null case than in the null case,
it's simpler if the same code path is used in both cases.
mDefaultNetwork is also not used between the old place where
it was set and the new place where it is set, so changing
the timing of the assignment has no observable side effects.

Test: ConnectivityServiceTest
Change-Id: Id47c19b73650ba66bff73b07edb8fd95c707e699
2020-02-04 16:49:52 +09:00
Chalard Jean
00419abe9e [NS A32] More simplification
Test: FrameworksNetTests
Change-Id: Ib713c4ae0100c8c242bbba87b2881311c5761869
2020-02-04 16:29:01 +09:00
Chalard Jean
967190ecd0 [NS A31] Simplification
The condition this is testing for cannot actually be false.

The only place where the code writes a null value into this
map is at the end of computeRequestReassignmentForNetwork :
reassignedRequests.put(nri, null).
This proves the code the if() block, which proves that
newNetwork.isSatisfyingRequest(nri.request.requestId) is true.

By definition newNetwork.isSatisfyingRequest(nri) implies that
nri.mSatifier == newNetwork, which proves that
previousSatisfier == newNetwork whenever newSatisfier is null.

Fixes: 146482072
Test: FrameworksNetTests
Change-Id: Ifd6faedce7d49757b82a5f341076ab208b0ccfcb
2020-02-04 16:28:20 +09:00
Chalard Jean
bf021685ca [NS A30] Note linger out of the rematch loop
This doesn't have to be tested every time.

Test: FrameworksNetTests
Change-Id: Ic5702c8b4bd096860fe55c4d9e4c465703561911
2020-02-04 16:24:23 +09:00
Chalard Jean
7c2f15e1a4 [NS A29] Call LOST callbacks at the end of the rematch.
Bug: 113554781
Test: FrameworksNetTests
Change-Id: I72dd210a956545c75b3c702338af779e119d70e7
2020-02-04 16:24:23 +09:00
Chalard Jean
88b2f9ecab [NS A28] Move setting the default network out of the rematch loop.
Bug: 113554781
Test: FrameworkNetTests NetworkStackTests
Change-Id: I02d85f17bf0ea37ae173f306f5a47d7551773c3a
2020-02-04 16:23:58 +09:00
Benedict Wong
3914abccce Merge changes I446a8595,I68d2293f
* changes:
  Add VpnManager calls to ConnectivityService
  Add basic logic for profile-based VPNs
2020-02-03 22:31:37 +00:00
Treehugger Robot
49c185e487 Merge changes If8c8d1f3,I3a804a9f
* changes:
  [NS A27] Remove useless logs and a useless var
  [NS A26] Move available callbacks out of the rematch computation
2020-02-03 15:06:19 +00:00
Cody Kesting
5b6967bc01 Merge "Update javadocs for ConnectivityDiagnosticsManager." 2020-02-03 14:56:13 +00:00
Cody Kesting
29edc0ecc9 Merge "Add callback registration in ConnectivityService." 2020-02-03 14:55:54 +00:00
Cody Kesting
ad51e01b3c Update javadocs for ConnectivityDiagnosticsManager.
ConnectivityDiagnosticsManager comments for
registerConnectivityDiagnosticsCallback and
unregisterConnectivityDiagnosticsCallback are updated to reflect several
changes.

For register calls, any app will be able to register callbacks, but only
permissioned applications will have their callbacks invoked (and only
for networks managed by the application). Additionally, only the
registering app (uid) will be able to unregister a callback once
registered.

Bug: 143187964
Test: docs change only. compiles.
Change-Id: Ie7ae86a1afccb22d6c84027dbac49d7b8e431e8c
2020-01-31 09:49:25 -08:00
Cody Kesting
73708bff55 Add callback registration in ConnectivityService.
ConnectivityDiagnosticsManager will send callbacks to
ConnectivityService for registering and unregistering them with the
system. ConnectivityService needs to do the processing for persisting
(and deleting) these callbacks on the ConnectivityService Thread, so
messages are sent to the Connectivity Diagnostics  Handler, which runs
on the ConnectivityService Thread.

Bug: 146444622
Bug: 143187964
Bug: 147848028
Test: compiles
Test: atest FrameworksNetTests
Change-Id: Ia5c8f90a60c050504e8676de9564a7607a9b03bc
2020-01-31 09:42:05 -08:00
Benedict Wong
79ea64f963 Add VpnManager calls to ConnectivityService
This commit adds the relevant calls to ConnectivityService for the
VpnManager API to be functional

Bug: 144246837
Test: VpnManagerTest updated, FrameworksNetTests passing
Change-Id: I446a8595e3583a842a7f89c4f8d74526a85e311c
2020-01-30 18:55:07 -08:00
Benedict Wong
df936cf1a7 Add basic logic for profile-based VPNs
This change adds stubs for the Platform built-in VPNs, along with
implementing some basic permissions checks.

Bug: 144246837
Test: FrameworksNetTests passing, new tests added
Change-Id: I68d2293fc1468544f0d9f64d02ea7e1c80c8d18c
2020-01-30 18:41:12 -08:00
David Su
ca6e20c5d2 Merge changes Iaa6f0d65,I68a16b64
* changes:
  Networking: Rename removeDoubleQuotes to sanitizeSsid
  Wifi: Rename removeDoubleQuotes to sanitizeSsid
2020-01-30 22:42:16 +00:00
Remi NGUYEN VAN
543ecddcdc Merge "Add tests to services/tests/net test mapping" 2020-01-30 06:20:39 +00:00
markchien
e1322a8a8e NetworkAgent: Fix doc build fail by invalid tag
Bug: 138306002
Bug: 139268426
Test: make doc-comment-check-docs

Change-Id: I8b8df5096b90ad10545087ab09f68ecae637aa35
Merged-In: I8b8df5096b90ad10545087ab09f68ecae637aa35
2020-01-30 03:37:45 +00:00
sqian
d60481ce20 Make most of NetworkAgent @SystemApi.
Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: I856f01f02c35c2f6a886d8b98039e5dfbc48148b
Merged-In: I856f01f02c35c2f6a886d8b98039e5dfbc48148b
(cherry picked from commit 980ed12f7f)
2020-01-29 16:45:03 -08:00
Sarah Chin
b36aaf9fae Merge "API changes for IPv6 MTU support" 2020-01-29 15:56:09 +00:00
Sarah Chin
f75d09fac1 API changes for IPv6 MTU support
Change mtu->mtuV4 and add mtuV6 for DataProfile and DataCallResult
Add mtu to RouteInfo and update test

Test: atest FrameworksTelephonyTests
Bug: 146668814
Change-Id: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb
Merged-In: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb
2020-01-30 00:17:19 +09:00
Chalard Jean
0c7b9a9eb7 [NS A27] Remove useless logs and a useless var
These logs haven't found a bug in a long time and we now have
some structural guarantees that the conditions they check for
can't happen (like the checks that everything is happening on
the same thread).
Maybe we'll reinstate similar checks later, but for now they
are in the way and removing them is a small sacrifice for the
intended benefit.

The local was simply not used any more.

Test: FrameworksNetTests
Change-Id: If8c8d1f3eb883ffcf0fbdb70824b87dd70da507c
2020-01-29 19:47:16 +09:00
Chalard Jean
d8bea3bb90 [NS A26] Move available callbacks out of the rematch computation
Bug: 113554781
Test: ConnectivityServiceTest
Change-Id: I3a804a9f6eaf50a3995eaaf6469a1c2b9387be14
2020-01-29 19:47:11 +09:00
Paul Trautrim
bc2cbc7499 Merge "Add implementation of getInterfaceHash()" 2020-01-29 05:12:12 +00:00
Paul Trautrim
79a9c8cd76 Add implementation of getInterfaceHash()
Exempt-From-Owner-Approval: cherry-pick from internal
Bug: 136065010
Test: m
Change-Id: I314f19aeca82cc8653eab71c9526ea7a208e6b50
Merged-In: I314f19aeca82cc8653eab71c9526ea7a208e6b50
2020-01-29 14:09:56 +09:00
David Su
0a4391d4f3 Networking: Rename removeDoubleQuotes to sanitizeSsid
Bug: 145745815
Test: compiles
Change-Id: Iaa6f0d65cab556c24b0a9010427de8e6a02836c1
Merged-In: Iaa6f0d65cab556c24b0a9010427de8e6a02836c1
(clean cherry-pick from internal branch)
2020-01-27 13:51:56 -08:00
Treehugger Robot
055202128f Merge changes I0ac8c022,Ia6ce0608,Ibc030d2a
* changes:
  Fixed the documentation and unit tests
  Disabled the tests
  Added expiration time and deprecation time support
2020-01-27 06:39:38 +00:00
Jack Yu
d956e5b326 Fixed the documentation and unit tests
Fixed the documentation and re-eanble the
broken unit tests.

Test: LinkAddressTest
Bug: 142949345
Merged-In: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
Change-Id: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
(cherry picked from commit b67261b01c)
2020-01-26 21:37:36 -08:00