Commit graph android_packages_modules_Co.../tests/unit/java/com/android/server
Message SHA1
Merge "Re-skip connectivity unit tests before S" am: a9230c1bf7 am: 1f3d8dc5e8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749684

Change-Id: I5e98952aa6cb7406c16e0e05fadc42d7f69759c0

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-30 08:18:37 +00:00
8705df6024
Merge "Re-skip connectivity unit tests before S"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 07:43:08 +00:00
a9230c1bf7
Merge "Add option to make sign-in notification ongoing"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 05:12:09 +00:00
ea395bf6a0
Re-skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

This applies a previous change, this time using DevSdkIgnoreRunner,
as SdkSuppress does not work as expected in branches that have a
codename 2 versions above the SDK version, as is the case in AOSP.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
      atest FrameworksNetTests on S
Change-Id: I5808d34459a4c19238baf8873afa7cf942828460

Remi NGUYEN VAN   commited 2021-06-30 12:00:28 +09:00
154cf1da20
Add option to make sign-in notification ongoing
Add an overlay boolean that allows setting the SIGN_IN notification as
an ongoing notification.

This can be useful to make sure users can always easily find the
notification to sign in to a captive portal, as studies have found that
some users have a tendency to dismiss notifications before reading them.
At the same time the notification shade is generally too crowded, which
is what causes such behaviors in the first place, so this option is not
enabled by default and should generally not be enabled without proper
user studies or metrics.

Bug: 173171709
Test: atest NetworkNotificationManagerTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ic187d2a2b7e49ad152ea2aa35bb784864b97473c

Remi NGUYEN VAN   commited 2021-06-30 11:59:11 +09:00
57c0380135
Merge "Revert "Skip connectivity unit tests before S"" am: b0c9e64d33 am: af5ae307f2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749498

Change-Id: If3e5470c07f5831e53f26da2503075544da42c0f

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-06-29 08:57:54 +00:00
1882f0ba95
Merge "Revert "Skip connectivity unit tests before S""
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-29 08:14:26 +00:00
b0c9e64d33
Revert "Skip connectivity unit tests before S"
This reverts commit 05dd1ba540.

Reason for revert: Skips more tests than it should in AOSP
Bug: 192302892

Change-Id: I7c5638d8c1cc626354d240a06af758e1cdd92e94

Remi NGUYEN VAN   commited 2021-06-29 01:08:00 +00:00
284b3c028c
Merge "Use appId instead of uid" am: 683c386403 am: 9658c8ea69
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733212

Change-Id: Ic3d593c9d0d8774b97b256b06f5e8b0af6e2ce43

Paul Hu   authored and   Automerger Merge Worker   commited 2021-06-28 04:07:19 +00:00
abdb237bbc
Merge "Use appId instead of uid"
Paul Hu   authored and   Gerrit Code Review   commited 2021-06-28 03:35:45 +00:00
683c386403
Merge "Skip connectivity unit tests before S" am: ef34fd2e21 am: 7ab2d7440c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1736507

Change-Id: Iac57b340cee656237866fc7fdf7af22600a3d56b

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-25 06:07:18 +00:00
190ac1c826
Skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
Change-Id: I10da45ae023e7f1e8cd11ec857b84346892a3fa8

Remi NGUYEN VAN   commited 2021-06-25 10:10:12 +09:00
05dd1ba540
Make yield-to-bad-wifi behavior backward compatible with R
Yielding cell wins to exiting wifi (whether good or bad).
It loses to bad wifi that's not exiting.

In R, yielding to bad wifi only affects wifis that are
unvalidated, but a wifi that is exiting should still be
dropped in favor of a cell that yields to bad wifi.

I had misunderstood the policy and implemented it wrong.
Now it's implemented right, and has careful tests.

Test: new tests for this
Bug: 186458024
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: Ib8637100d491e72a2edb837584ce55b7dda58524
Change-Id: Ib8637100d491e72a2edb837584ce55b7dda58524
  (cherry-picked from ag/14486203)

Chalard Jean   authored and   Junyu Lai   commited 2021-06-24 03:33:05 +00:00
6b2f09272c
Merge "Fix the comments from aosp/1719018" am: 0c20c4901f am: 9adee2f105
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729691

Change-Id: I41abc59d63961c4a1ee70ec6f09738cd56c41f9f

Luke Huang   authored and   Automerger Merge Worker   commited 2021-06-23 06:34:24 +00:00
c9c704ba6e
Merge "Fix the comments from aosp/1719018"
Luke Huang   authored and   Gerrit Code Review   commited 2021-06-23 03:36:02 +00:00
0c20c4901f
Merge "Provide a way to override the avoid bad wifi configuration" am: 38e8c2c94b am: 4ef85d615b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733788

Change-Id: Id2a8bb020ac469300bf4deb351238f63da89b81f

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-06-23 02:08:04 +00:00
f7e2458e52
Merge "Provide a way to override the avoid bad wifi configuration"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-06-23 00:48:17 +00:00
38e8c2c94b
Provide a way to override the avoid bad wifi configuration
ConnectivityManager.setAvoidUnvalidated only works if the
config_networkAvoidBadWifi configuration is set to 0 and the
NETWORK_AVOID_BAD_WIFI setting is unset. There is no easy way
for a testing app to temporary set a test value to verify the
behavior of the API. Thus, add a mechanism to allow test app
to set a period of time to temporary unstrict the resource
configuration, i.e. Temporary simulate config_networkAvoidBadWifi
configured to 0.

Bug: 186061922
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: If772078c61a9b12926f104d5dfc9c9071e844732

Chiachang Wang   commited 2021-06-22 14:54:02 +08:00
6eac9fb787
Merge "Add connectivity coverage tests" am: cc79d7c0f8 am: 68114fe408
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731232

Change-Id: I03c852ab8900232c3ec657d05f575dd3400aea10

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-21 13:56:54 +00:00
6c48f03a23
Merge "Add connectivity coverage tests"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-21 10:55:33 +00:00
cc79d7c0f8
Fix the comments from aosp/1719018
1. Test {start,stop}-service
2. Add waitForIdle

Bug: 181810560
Test: atest NsdServiceTest
Change-Id: I0953887d1d92a644a29a2e80521469c8cc2aa2fc

Luke Huang   commited 2021-06-21 04:54:33 +00:00
05b013c83f
Use appId instead of uid
Multiple user's ares of mApps are not initialized in startMonitoring(),
so mApps.get(uid) of multi-user's app returns null in onPackageAdded().
As the result, permission of system uid is updated to "Network" and
any system application cannot use dedicated apn like IMS.
Using appId avoids this problem.

Bug: 168932048
Test: atest FrameworksNetTests

Signed-off-by: Sangcheol Lee <goodsc.lee@samsung.com>
Change-Id: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4

Sangcheol Lee   commited 2021-06-17 13:35:58 +09:00
1e5d742596
Merge "Make tests compatible with mockito-extended" am: ad7108ce34 am: c3d789bff1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1737400

Change-Id: I56fcd6452a072d4d6af2f1e81739be5f7f00670a

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-16 13:56:03 +00:00
16bbc032c3
Merge "Make tests compatible with mockito-extended"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-16 13:22:37 +00:00
ad7108ce34
Merge "Remove ConnectivityServiceTest signature perms use" am: 54c7434f0d am: 96ad425c5e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1736615

Change-Id: I1e264659c1cd6d88a669524af8ceacb5c6c05105

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-16 11:38:00 +00:00
a08680a505
Merge "Remove ConnectivityServiceTest signature perms use"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-16 11:09:05 +00:00
54c7434f0d
Add connectivity coverage tests
The coverage tests will allow measuring code coverage for all
Connectivity+Tethering code.

This is a combination of the current TetheringCoverageTests, and
FrameworksNetTests.

Adding min_sdk_version to the test prevents it from using deprecated
IoUtils utilities. Replace it with the non-deprecated alternative.

Test: atest ConnectivityCoverageTests
Change-Id: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383

Remi NGUYEN VAN   commited 2021-06-16 19:45:20 +09:00
fe20e1317d
Make tests compatible with mockito-extended
This does not change the mockito library to use mockito-extended in
FrameworksNetTests, but changes the tests so that they would pass if
built against that library.

This is useful to run FrameworksNetTests in a common test suite with
other tests that use mockito-extended, for example a common connectivity
coverage test target.

The change includes increasing the test timeout in
ConnectivityServiceTest, as mockito-extended can have performance impact
(~3 times on hwasan builds). This change does not make tests run slower
in the current FrameworksNetTests suite though.

Bug: 187935317
Test: atest FrameworksNetTests
Change-Id: I61fa371e8957037075a2617a014647ff062207c6

Remi NGUYEN VAN   commited 2021-06-16 17:53:08 +09:00
c9c745f2f2
Remove ConnectivityServiceTest signature perms use
To allow unit tests to run without platform certificates, remove
signature permission usage in ConnectivityServiceTest.

This mocks permission checks done in ConnectivityService for which the
test assumed that the permission was held, and mocks calls to
BatteryStatsManager. Calls to ActivityManagerService (through
PendingIntent) are done with shell permissions as the test uses real
PendingIntent mechanics.

Bug: 187935317
Test: atest FrameworksNetTests
Change-Id: If309d653ac2e9bbcf1b94bcee6336367289df359

Remi NGUYEN VAN   commited 2021-06-16 16:32:03 +09:00
18a979fa41
Update CS so that per-app OEM APIs can be tested am: fa270db5f7 am: 6c54d5e4c4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723050

Change-Id: I1b13784797d2b1326d4ae31d813cc6332101c532

James Mattis   authored and   Automerger Merge Worker   commited 2021-06-16 01:29:56 +00:00
73bdd21f0a
Update CS so that per-app OEM APIs can be tested am: fa270db5f7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723050

Change-Id: Ib5937d0fd732f915416e957299e739fe10d0bf55

James Mattis   authored and   Automerger Merge Worker   commited 2021-06-16 01:11:26 +00:00
6c54d5e4c4
Merge changes from topic "per-app-cts"
* changes:
  CTS tests for setOemNetworkPreference
  Update CS so that per-app OEM APIs can be tested

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-06-16 00:47:06 +00:00
5f78e30839
Merge "Send a proxy broadcast when apps moved from/to a VPN" am: cfc86ef0f6 am: f7aa7c51ee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1717735

Change-Id: Ie3837b6561ccbd99088fba758f792596a66e71e2

Lucas Lin   authored and   Automerger Merge Worker   commited 2021-06-15 09:32:42 +00:00
655a025198
Merge "Send a proxy broadcast when apps moved from/to a VPN"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-06-15 09:26:21 +00:00
cfc86ef0f6
Add DEFAULT_NETWORK_PRIORITY constants
- Add default network priority to NetworkRequestInfo.
- The default network priority value is used when issue uid
  ranges rules to netd. Netd will use the priority value and uid
  ranges to generate corresponding ip rules specific to the given
  network preference.

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: I0ea71b348492aeb4784d487bed4cfd5d387426ba

Change-Id: I0ea71b348492aeb4784d487bed4cfd5d387426ba

paulhu   commited 2021-06-14 15:55:55 +00:00
e99137226e
Add more unit tests for mobile data preferred uids feature
- Add more tests for mobile data preferred uids.
- Also address leftover comments on implementation commit.

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: I63f65bffc1b8883ddfd774222e26e629d7ea1f94

Change-Id: I63f65bffc1b8883ddfd774222e26e629d7ea1f94

paulhu   commited 2021-06-14 15:53:05 +00:00
01f52e7cce
Merge "Add DEFAULT_NETWORK_PRIORITY constants" into sc-dev am: dcba997adf
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731886

Change-Id: I54aa207ba6a49ef576021d7e703b6bed778ef814

Paul Hu   authored and   Automerger Merge Worker   commited 2021-06-14 15:33:48 +00:00
d56d7cf880
Merge "Add DEFAULT_NETWORK_PRIORITY constants" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-06-14 15:17:23 +00:00
dcba997adf
Merge "Add more unit tests for mobile data preferred uids feature" into sc-dev am: 7d5fa3da7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14731884

Change-Id: If434ff9d82c2951376377f8ef78720a5b80f56af

Paul Hu   authored and   Automerger Merge Worker   commited 2021-06-14 14:47:45 +00:00
6b8b5c3da1
Merge "Add more unit tests for mobile data preferred uids feature" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-06-14 14:29:29 +00:00
7d5fa3da7d
Merge "Correctly get uids for per-app network preferences" am: 473ddeaebb am: d9c5536026
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1723617

Change-Id: Iaf413208ba0ac560b13f102e8a2308866b97dd3a

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-06-14 06:33:04 +00:00
8bd2cb97da
Merge "Correctly get uids for per-app network preferences"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-06-14 06:07:56 +00:00
473ddeaebb
Merge "Modify NsdServiceTest to conform to its new mechanism" am: c9a2bdf2b9 am: 31f8527bca
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1719018

Change-Id: I02fed0bbe985a844c0c56e6be4570c7036e4d47c

Luke Huang   authored and   Automerger Merge Worker   commited 2021-06-13 16:52:09 +00:00
03d9bdc6c6
Merge "Modify NsdServiceTest to conform to its new mechanism"
Luke Huang   authored and   Gerrit Code Review   commited 2021-06-13 15:20:52 +00:00
c9a2bdf2b9
Don't send onLinkPropertiesChanged after onLost for 464xlat.
Currently, when a network that uses 464xlat is torn down,
NetworkCallbacks will receive onLinkPropertiesChanged after
onLost. This is confusing and incorrect.

The incorrect callback is sent because handleLinkProperties
checks that the netId of the agent still exists, not that the
NetworkAgent is still registered. This is normally correct,
because the NetworkAgent is removed from mNetworkAgentInfos and
the netId are removed from mNetworkForNetId by the same method,
disconnectAndDestroyNetwork.

In this specific case it's not correct, because the call to
handleUpdateLinkProperties is from disconnectAndDestroyNetwork
itself via nai.clatd.update and calls Nat464Xlat#stop.

No other callers of handleUpdateLinkProperties are affected
because:

- EVENT_NETWORK_PROPERTIES_CHANGED is called only by
  maybeHandleNetworkAgentMessage, which first checks that the
  NetworkAgent is registered.
- handlePrivateDnsSettingsChanged only looks at registered
  NetworkAgents (it loops over mNetworkAgentInfos).
- handlePrivateDnsValidationUpdate, handleNat64PrefixEvent and
  handleCapportApiDataUpdate call getNetworkAgentInfoForNetId,
  which will correctly determine that the agent is no longer
  registered, since they run on the handler thread and thus
  cannot run at the same time as disconnectAndDestroyNetwork.

The existing code contains a check for the netId being current.
This is intended to ensure that an update from a NetworkAgent
cannot affect another agent with the same Network. This extra
check is not necessary, because code running on the handler
thread can never observe a NetworkAgent in mNetworkAgentInfos
unless mNetworkForNetId maps that NetworkAgent's Network to that
NetworkAgent. This is because mNetworkForNetId is updated by the
same methods as mNetworkAgentInfos, and those updates occur on
the handler thread. So all code on the handler thread will see
those two as consistent.

Bug: 176496580
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Original-Change: https://android-review.googlesource.com/1727829
Merged-In: I944f4c6ad36206bdccd85a6ea7ef71324a29c685
Change-Id: I944f4c6ad36206bdccd85a6ea7ef71324a29c685

Lorenzo Colitti   commited 2021-06-11 13:46:33 +00:00
beb7d92cbc
Improve test coverage for disconnecting networks with clat.
Ensure that NetworkCallbacks and netd operations are accounted
for. Also add a test for the spurious onLinkPropertiesChanged
callback that is currently send out after onLost.

Bug: 176496580
Test: atest ConnectivityServiceTest
Original-Change: https://android-review.googlesource.com/1729093
Merged-In: I69cf58bc87dfe55ea359a2cd76167d03fe2c953d
Change-Id: I69cf58bc87dfe55ea359a2cd76167d03fe2c953d

Lorenzo Colitti   commited 2021-06-11 13:44:46 +00:00
cfa262d8b8
Add DEFAULT_NETWORK_PRIORITY constants
- Add default network priority to NetworkRequestInfo.
- The default network priority value is used when issue uid
  ranges rules to netd. Netd will use the priority value and uid
  ranges to generate corresponding ip rules specific to the given
  network preference.

Bug: 171872461
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I0ea71b348492aeb4784d487bed4cfd5d387426ba

paulhu   commited 2021-06-11 14:22:33 +08:00
c2198778ab
Merge "Revert "Use mockito-extended in FrameworksNetTests"" am: a6c06af0fa am: 6f6035a29e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1734372

Change-Id: Ib378623e1eecf63f14bd99e70cc9af00aba1baf5

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-11 01:56:50 +00:00
feffd4df22
Merge "Revert "Use mockito-extended in FrameworksNetTests""
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-11 01:26:44 +00:00
a6c06af0fa
Merge changes I8d15b626,I993e8da9 am: d15e52eca9 am: 3cc611d69a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733772

Change-Id: I05bc411729d9960d580ccbfcee8502ec5eba3d97

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-06-11 00:04:42 +00:00
8cc60e436c