Commit graph android_packages_modules_Co.../tests/net/java/com/android/server
Message SHA1
Merge "Automatically set IPsec tunnel interface as up"
Benedict Wong   authored and   Gerrit Code Review   commited 2020-03-25 04:18:50 +00:00
bc74233e8a
Merge changes from topic "netstack_constant_cherrypick"
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-03-23 03:33:58 +00:00
10adc9a7b9
Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Merged-In: I7855090bffbe895c8349ad4903b8f2eb55515f0b
(clean cherry-pick from internal branch)

Change-Id: If4af2846a82605e828287a9a4680d5547b76b802

Remi NGUYEN VAN   commited 2020-03-23 11:29:06 +09:00
fbb0836bc6
Merge "Change NetworkCapabilties administrator UIDs to be stored as int[]."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-19 18:09:26 +00:00
1a78f835eb
[SM07] Make combine subtype configurable from Settings
Note that enabling/disabling would not take effect until device
reboot. This will be addressed in follow-up patch.

Test: 1. atest NetworkStatsServieTest SettingsBackupTest
      2. adb shell settings put global netstats_combine_subtype_enabled 1|0
Bug: 146415925

Change-Id: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
Merged-In: Ic94da540afa479ed18f1b6fbda4ae3216c37476b
(cherry picked from commit c4f77ac90bf2e48a655ad19b162fe74a23bf3fb0 and
 fix merge conflict in SettingsBackupTest)

junyulai   commited 2020-03-19 10:10:07 +08:00
678befa63c
[SM05] Enable record mobile network stats by collapsed rat type
Switch on the recording in device side. Metrics will be
collected in follow-up patches which can be independently
enabled/disabled.

This change also fix the fail in NetworkStatsCollectionTest
which caused by enabling this feature, where the rounding
problem happened when records are distributed into smaller
buckets and categorized into more NetworkIdentity.

Test: atest FrameworksNetTests
Bug: 129082217
Change-Id: If330e85330a4ff713dd420c98d42fa741eabd90a
Merged-In: If330e85330a4ff713dd420c98d42fa741eabd90a
(cherry picked from commit 2d4fa2c0fae8c2d79a25093d9f732a33c2f91dd4)

junyulai   commited 2020-03-19 10:10:07 +08:00
2632681cf0
Merge "Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL"
Paul Hu   authored and   Gerrit Code Review   commited 2020-03-19 01:10:55 +00:00
57b993bfb5
Change NetworkCapabilties administrator UIDs to be stored as int[].
NetworkCapabilities#mAdministratorUids is used to track the UIDs that
are administrators of the given Network. This value was previously
stored as List<Integer>. However, general Android API Council guidelines
recommend using Arrays for primitive values. In order to be consistent
with the guidelines, updating the field to use an Array.

Bug: 147903575
Test: atest FrameworksNetTests
Change-Id: I2652a5b0f276b8944454af5cb4b1383a3e054cfa
Merged-In: I2652a5b0f276b8944454af5cb4b1383a3e054cfa

Cody Kesting   commited 2020-03-18 15:18:47 -07:00
5ab1f55d1f
Merge "Restrict VPN Diagnostics callbacks to underlying networks."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-18 20:07:52 +00:00
4074c2d181
Fix flaky ConnectivityServiceTest#testNetworkFactoryUnregister
Test: atest ConnectivityServiceTest#testNetworkFactoryUnregister \
      --geneate-new-metrics 100
Bug: 151792032
Change-Id: Iece9e8ad5c51170cd404ac995d0005392d37fe0c

junyulai   commited 2020-03-18 15:22:54 +08:00
80bf34b2af
Merge "mtu: Add MTU parameter to Routes"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-18 07:20:01 +00:00
9839a4311a
Merge "[SP25] Rename functions that add Entry conditionally"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-03-18 03:16:41 +00:00
52ee59fb03
[SP25] Rename functions that add Entry conditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de
Merged-In: I9495a198cf247e6c79100f7ac1edcea370b071de
(cherry picked from ag/10700816)

junyulai   authored and   Junyu Lai   commited 2020-03-18 00:29:15 +00:00
a896436ef2
Merge "Update ConnectivityDiagnosticsCallback function name."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-17 19:00:39 +00:00
5596ba1619
Update ConnectivityDiagnosticsCallback function name.
API Council feedback suggests renaming ConnectivityDiagnosticsCallback
'onConnectivityReport' function to be 'onConnectivityReportAvailable'.

Bug: 150598997
Test: atest FrameworksNetTests
Change-Id: Ieea727ecee6cf358a53a215fd4b06233dfe967ea
Merged-In: Ieea727ecee6cf358a53a215fd4b06233dfe967ea

Cody Kesting   commited 2020-03-17 17:10:38 +00:00
fa1ef5eb1b
Merge "Ensure that NetworkFactory objects cannot be reused."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-03-17 04:35:01 +00:00
07c7c2aa67
Merge "Clean up unit testing for ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-16 19:33:33 +00:00
3fef3af249
Restrict VPN Diagnostics callbacks to underlying networks.
ConnectivityDiagnosticsCallbacks should only be invoked for the
underlying networks declared by active VPNs. This encourages VPN apps to
declare their underlying networks.

The previous permission model for VPNs allowed active VPNs to receive
callbacks on any network.

Bug: 148903617
Test: atest FrameworksNetTests
Change-Id: Ic08cdd2e2532580fda0fd3034e2bdff27e0ff84b

Cody Kesting   commited 2020-03-16 11:05:13 -07:00
d759ac61ee
Ensure that NetworkFactory objects cannot be reused.
NetworkFactory is turning into a one-time object that cannot be
re-used. Check for this in ConnectivityService.

Bug: 148635501
Test: test continues to pass
Change-Id: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80
Merged-In: I793436ee0f4b5d778788ad34b8a2575d2ad0ed80

Lorenzo Colitti   commited 2020-03-17 01:39:23 +09:00
2c74e66034
Merge "Protect ConnectivityService from SecurityException in permission check."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-16 14:33:25 +00:00
ed459f5f1a
[SP24] Rename functions that add Entry unconditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record unconditionally,
name them insertEntry.
  setIfaceValues -> insertEntry
  addEntry -> insertEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Test: m doc-comment-check-docs
Bug: 148895143
Change-Id: I801ddc49e283a254b9586700c9b597c0adb0d459

junyulai   commited 2020-03-16 14:27:45 +08:00
cc38304ad8
Merge "[SP21] Address comments for API council review about aosp/1172143"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-03-16 02:41:19 +00:00
24ab7411ba
Merge "Resolve ambiguous argument."
Chalard Jean   authored and   Gerrit Code Review   commited 2020-03-14 03:38:01 +00:00
16cad96e9f
Resolve ambiguous argument.
CTS tests don't have access to TestNetworkAgent and therefore
require overloading this method, which means 'null' is ambiguous.

Bug: 139268426
Test: FrameworksNetTests
Change-Id: I9279718bde30bd98eff901921fb3411d22da72e5

Chalard Jean   commited 2020-03-13 21:17:33 +09:00
a7cc6d8eee
Merge "Remove redundant connected notification"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-13 07:10:13 +00:00
62b8d6f24d
[SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845

junyulai   commited 2020-03-12 21:34:17 +08:00
0c88795cb5
Kill ConnectivityManager.CONNECTIVITY_ACTION_SUPL
CONNECTIVITY_ACTION_SUPL is marked as a "temporary hack" and has
never been public. Remove this intent definition since no one is
receiving this intent and should use network callback to know the
connection change.

Bug: 109636544
Test: atest FrameworksNetTests
Change-Id: Ie9e5127742beba04f1c191e894e8a29fe1e704bb

paulhu   commited 2020-03-11 22:14:11 +08:00
27ca44913a
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

Cody Kesting   commited 2020-03-10 23:27:01 -07:00
807ce6621b
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

Benedict Wong   commited 2020-03-10 23:08:16 -07:00
feff1cde9a
mtu: Add MTU parameter to Routes
- Change route to update existing route
- MTU parameter added to AddRoute

Bug: 142892223
Test: unit test
Change-Id: Ie339d0cee5be12c2232a4631fed61219a0facc64

Tyler Wear   authored and   Aaron Huang   commited 2020-03-11 13:33:10 +08:00
e4314861e3
Protect ConnectivityService from SecurityException in permission check.
ConnectivityService currently calls
LocationPermissionChecker#checkLocationPermission. This method call
throws a SecurityException if the given package name and UID do not
match. This permission check is made from the ConnectivityService
Thread, so any Exception being thrown will crash the SystemServer. This
is not acceptable, so surround the permission check in a try-catch in
case any SecurityExceptions are thrown.

Bug: 149119324
Test: atest ConnectivityServiceTest
Change-Id: Ibe2874f2a5249432270aa1b9eb7d004bbba35ac2

Cody Kesting   commited 2020-03-09 11:27:00 -07:00
a830439b37
Merge "Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-03-09 15:12:51 +00:00
42fbfe8826
Merge "Remove the NetworkScore class."
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-03-08 04:52:26 +00:00
d88d10a100
Remove the NetworkScore class.
This class is useless at this point and introduces overhead.

Bug: 113554781
Test: FrameworksNetTests
Change-Id: Ib6da6c1c7f2a0b97c847d2e64e5ce16dd821e1e7

Chalard Jean   commited 2020-03-06 11:57:53 +09:00
8cdee3a431
Remove redundant connected notification
Remove the old connected notification since there is a new file
- NetworkStackNotifier.java which will send the connected
notification when captive portal validated.

Bug: 149883761
Test: 1. atest FrameworksNetTests
      2. Sign-in a captive portal and see if there is a redundant
      connected notification.

Change-Id: I4ec9d26623af4bfc65156a28a96b982466aede31
Merged-In: Id11a9b99dd04772a92af8d527104906c47bf64cd

lucaslin   authored and   Lucas Lin   commited 2020-03-05 06:48:48 +00:00
444d43aea0
Clear UIDs when sharing NetworkCapabilties for ConnectivityDiagnostics.
ConnectivityDiagnostics shares NetworkCapabilities in
ConnectivityReports and DataStallReports. These NetworkCapabilities need
to have their UIDs scrubbed before they are shared with callbacks.

Bug: 148942124
Test: atest FrameworksNetTests
Change-Id: I5bde5a8116f7e36b8f4de49adf4cab8ec45a5aa4

Cody Kesting   commited 2020-03-04 08:40:11 -08:00
7febafb11c
Merge changes I794a24d0,Iab32b2db
* changes:
  Remove setHandler in NetworkStatsService
  Remove the need of accessing handler in NSS unit test

Junyu Lai   authored and   Gerrit Code Review   commited 2020-03-04 13:07:49 +00:00
22d91b660a
Remove setHandler in NetworkStatsService
Currently, internal handler is set by setHandler after
constructing NSS object. This was introduced in ag/866187 to
access the handler in the unit test.

However, the design put NSS in a bad situation where all classes
that need handler or executor could not be final and need to be
dynamically allocated in order to get a valid handler.

Thus, since the usage of handler is removed in previous patch,
this change eliminate setHandler by initializing the handler in
the constructor.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: I794a24d00b0ca9fdc78091e7b9ab7307e0f034b7

junyulai   commited 2020-03-04 16:01:21 +08:00
c05d1359b4
Add more assertions to testStackedLinkProperties.
Check all routes that are added and removed instead of just some
of them. This is in preparation of an upcoming change that
switches to adding and creating routes by issuing direct calls to
netd.

Also rename the misleading ipv4Default route variable to
ipv4Subnet, which is what it actually is.

Bug: 142892223
Test: test-only change
Change-Id: I7d111382be215a926a7d7d4701bd3c3e94372b99

Lorenzo Colitti   commited 2020-03-03 21:48:18 +09:00
2e6a35ef5e
Remove the need of accessing handler in NSS unit test
Currently, to wait for handler becomes idle, specific message
is used and the test would wait for condition variable to be
open when the message is processed.

However, this is already done in the HandlerUtils. Thus,
there is no need to post such message manually in the handler.

Test: atest FrameworksNetTests
Bug: 150664039

Change-Id: Iab32b2dbab01634ca159dcb90fc9f929d1fed1a2

junyulai   commited 2020-03-03 16:27:03 +08:00
3123092fd5
Merge "Move NetworkAgent#register to a new method."
Aaron Huang   authored and   Gerrit Code Review   commited 2020-03-03 03:37:07 +00:00
5d61bc285d
Merge "test: ConnectivityService: Validate Route Add/Del"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-02-27 01:00:58 +00:00
08c82181ad
test: ConnectivityService: Validate Route Add/Del
Validate route addition and deletion after linkProperties are
changed.

Test: atest ConnectivityServiceTest#testStackedLinkProperties
Change-Id: I18296b933e856a0f8a4c1dbd75bd35024853bfbb

Tyler Wear   commited 2020-02-24 17:23:02 -08:00
5668f7198b
Move NetworkAgent#register to a new method.
Calling IPC in a constructor is unusual and confusing, and can be
considered bad form. There are multiple reasons for this :
• Users can't obtain an instance of the class without calling the
  constructor, but they can't always afford an IPC where they need
  this, forcing them to know about the implementation detail and
  sometimes design around it.
• On a related but generalized note, constructors should usually
  be fast for the same range of reasons.
• Having a separate method to register the agent simply gives more
  flexibility to the app.
• It's also a lot easier to test.
But also we can't fix it without an update to the API, so here it is.

Another reason for doing this is consistency with the NetworkProvider
API.

Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Change-Id: I1ee5c7b1353d581e487c8a8a159009bebd781643
Merged-In: I1ee5c7b1353d581e487c8a8a159009bebd781643
(clean cherry-pick from internal branch)

Chalard Jean   authored and   Aaron Huang   commited 2020-02-21 14:54:18 +08:00
5863a71547
Merge "Sanitize owner UID iff owning app does not have location permissions."
Qingxi Li   authored and   Gerrit Code Review   commited 2020-02-20 05:20:27 +00:00
4d95254cb3
Sanitize owner UID iff owning app does not have location permissions.
This change adds permission checking to ensure that the following
conditions are enforced in order for apps to receive the owner UID:
1. The app must be the owner of the network
2. The app must hold the FINE_LOCATION permission/appop
3. The user must have their location toggle enabled.

Bug: 142072839
Test: atest FrameworksNetTests
Change-Id: I7a981a82f1219828ee89c8c96eb9d2efd153377f

Qingxi Li   commited 2020-02-20 01:02:42 +00:00
b274810c34
Add support for starting IKEv2/IPsec VPNs from settings
This commit allows the startLegacyVpn() call to start Platform VPN
profiles, allowing Settings to use the IKEv2/IPsec VPN options

When using an aliased private key, the
Ikev2VpnProfile.KEYSTORE_ALIAS_PREFIX must be prepended to the front of
the alias. This will in turn result in the fromVpnProfile() function to
pull the key from the KeyStore, as opposed to the inline-key that the
VpnManager API uses.

Bug: 148991741
Test: FrameworksNetTests passing, new tests added in subsequent CL
Test: Manually tested
Change-Id: Icbca695c353b2e12e99305676404dbf1a4495949

Benedict Wong   commited 2020-02-19 02:44:34 +00:00
94d31add64
Add always-on VPN support for platform VPNs
This commit allows Platform VPNs to be started as part of always-on
mode.

Test: FrameworksNetTests passing, new tests added in subsequent CL
Test: Manually tested.
Change-Id: I5eda88e5b406a0e425eb7424665cf702e0979324
Merged-In: I5eda88e5b406a0e425eb7424665cf702e0979324

Benedict Wong   commited 2020-02-18 22:13:31 +00:00
16e0e33c71
Merge changes Ide9daebc,Id47ada57
* changes:
  Ensure all VPN runners clean up state when exiting
  Enforce restricted user, getConnectionOwnerUid checks

Benedict Wong   authored and   Gerrit Code Review   commited 2020-02-17 21:30:35 +00:00
d07db8a8da
Merge changes from topics "capport_dhcpresults", "nm_cb_capport"
* changes:
  Add CaptivePortalApiUrl to DhcpResults
  Send LinkProperties update on new capport data

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2020-02-15 17:22:18 +00:00
e777d054f4