Commit Graph

3778 Commits

Author SHA1 Message Date
Treehugger Robot
21ec633e39 Fix testGetAllNetworkStateSnapshots for non-cellular
bug: 192115694
Test: atest ConnectivityManagerTest#testGetAllNetworkStateSnapshots
Original-Change: https://android-review.googlesource.com/1749483
Merged-In: Ie7f637248302f3e6b61be69ef4c6a7a906e69275
Change-Id: Ie7f637248302f3e6b61be69ef4c6a7a906e69275
2021-07-01 08:47:03 +00:00
Sudheer Shanka
f90750e26a Skip tests on unsupported devices.
Fixes: 192473577
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests
Change-Id: Ib90f0045cb574ada792c5d43fcc359c22d20f3a4
2021-07-01 08:08:30 +00:00
Lucas Lin
4ae105f517 Merge "Print the result of command when test is failed" am: c28bb26888 am: 864c93bf07
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749262

Change-Id: I1ec8cc0a99bcd730792b0d46a6e11119cd2f54fa
2021-07-01 07:55:37 +00:00
Treehugger Robot
a0dd923ffb Merge "Fix testGetAllNetworkStateSnapshots for non-cellular" am: ddf3660af8 am: f786aa57e9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749483

Change-Id: I983838a0e9a0b32d0ab66bbdcfdb117c9652cf55
2021-07-01 07:55:32 +00:00
Lucas Lin
c28bb26888 Merge "Print the result of command when test is failed" 2021-07-01 07:49:03 +00:00
Treehugger Robot
ddf3660af8 Merge "Fix testGetAllNetworkStateSnapshots for non-cellular" 2021-07-01 07:44:50 +00:00
Remi NGUYEN VAN
3a8198c3ba Make notification icons and autocancel overlayable
Allow overlays to change the connectivity notification icons, and
whether the notifications are auto-cancelled.

This does not change default behavior, but is necessary to allow vendors
to adapt the notifications to their standards.

Bug: 173171709
Bug: 172048052
Test: atest NetworkNotificationManagerTest
      Added test overlay, verified icon replaced
Change-Id: Ibbb765a5e828b8b870cbfb81e89df2dbd2828be7
2021-07-01 16:04:09 +09:00
Lucas Lin
5ca769ef4a Simplify the return condition in stop()
Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1729690
Merged-In: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
2021-07-01 06:57:53 +00:00
paulhu
de2a23958d Use Netd new added/removed uid range methods
Replace network[Add|Remove]UidRanges to
network[Add|Remove]UidRangesParcel. The new methods are passing
NativeUidRangeConfig which contains priority value for each uid
range rules.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: I08bbdbcb8450b08e6208fa730137348550f9e3d2
2021-07-01 03:10:45 +00:00
Lucas Lin
b278aac2a3 Merge "Simplify the return condition in stop()" am: 584ab08627 am: c955dcc84d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729690

Change-Id: I2dcd10df1d339a1a24e31632b399f960f749d44a
2021-07-01 02:13:04 +00:00
Lucas Lin
584ab08627 Merge "Simplify the return condition in stop()" 2021-07-01 01:46:59 +00:00
Treehugger Robot
282f743a8c Fix network callback with the same PendingIntent does not release
Currently, ConnectivityService uses EVENT_REGISTER_NETWORK_LISTENER
to dispatch registering network callback with pending intent, this
is wrong since the code flow will not check if the pending intent
is duplicated. Thus, the registration will be duplicated if the
caller uses the same pending intent and register multiple times.

This change fixes the logic by using
EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT instead of
EVENT_REGISTER_NETWORK_LISTENER when dispatching register network
callback with pending intent.

Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkRequest_identicalPendingIntents
Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback_identicalPendingIntents
Test: atest ConnectivityServiceTest#testNetworkCallbackMaximum
Test: 1. Use test app to file callback with same PendingIntent
       2. Check dumpsys output
Bug: 189868426
Original-Change: https://android-review.googlesource.com/1727470
Merged-In: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
2021-07-01 01:44:56 +00:00
Remi NGUYEN VAN
4a980eebf5 Merge "Apply jarjar rules on coverage tests" am: d590b30f72 am: 073f6e299a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: I80209723541bdfb8f5b08cd5e9cf0e76afa3593e
2021-07-01 01:08:32 +00:00
Remi NGUYEN VAN
d590b30f72 Merge "Apply jarjar rules on coverage tests" 2021-06-30 23:53:57 +00:00
Treehugger Robot
8711b078ff Merge "Fix network callback with the same PendingIntent does not release" am: 6d908a513a am: e6517c060f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727470

Change-Id: I2a27b0f3d3204fcfc3cb2d787fa5c998d45e54de
2021-06-30 22:12:04 +00:00
lucaslin
40d931c474 Simplify the return condition in stop()
Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
2021-07-01 02:29:53 +08:00
Ansik
605e77055c Change to REQUEST from LISTEN for mobile data preferred uids feature
- If Mobile data always on is OFF, mobile data preferred uids
  feature does not work.
- We need to request mobile data when MDO list is not empty.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases

Signed-off-by: Ansik <ansik.shin@samsung.com>
Change-Id: Ie9d6b3e39ef16813c4be3979900d226c8f3d656d
2021-06-30 14:22:34 +00:00
WeiZhang
1cc3f17413 Fix network callback with the same PendingIntent does not release
Currently, ConnectivityService uses EVENT_REGISTER_NETWORK_LISTENER
to dispatch registering network callback with pending intent, this
is wrong since the code flow will not check if the pending intent
is duplicated. Thus, the registration will be duplicated if the
caller uses the same pending intent and register multiple times.

This change fixes the logic by using
EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT instead of
EVENT_REGISTER_NETWORK_LISTENER when dispatching register network
callback with pending intent.

Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkRequest_identicalPendingIntents
Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback_identicalPendingIntents
Test: atest ConnectivityServiceTest#testNetworkCallbackMaximum
Test: 1. Use test app to file callback with same PendingIntent
       2. Check dumpsys output
Bug: 189868426
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
2021-06-30 12:05:43 +00:00
Paul Hu
eefacbcb5c Merge "Use appId instead of uid" into sc-dev 2021-06-30 09:38:26 +00:00
paulhu
4ac225baed Listen EXTERNAL_APPLICATIONS_AVAILABLE intent
- Some applications are installed on external storage and they
  are unavailable until exernal storage installed them
  completely. And their permission need update after becoming
  available. Thus, listen EXTERNAL_APPLICATIONS_AVAILABLE intent
  and update those package whose is listed in chaged package
  list.
- Remove user argument on buildPackageInfo() because the uid on
  ApplicationInfo is based uid.

Bug: 145234989
Test: atest FrameworksNetTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a
2021-06-30 17:07:47 +08:00
Remi NGUYEN VAN
aec0e35349 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: I5ce3c5b7dc333c802890831daf8289985c61301d
2021-06-30 08:18:57 +00:00
Remi NGUYEN VAN
a9230c1bf7 Merge "Re-skip connectivity unit tests before S" 2021-06-30 07:43:08 +00:00
Remi NGUYEN VAN
8ea5ee6d33 Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2
2021-06-30 16:00:26 +09:00
Remi NGUYEN VAN
ea395bf6a0 Merge "Add option to make sign-in notification ongoing" 2021-06-30 05:12:09 +00:00
Remi NGUYEN VAN
154cf1da20 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
2021-06-30 12:00:28 +09:00
Remi NGUYEN VAN
57c0380135 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
2021-06-30 11:59:11 +09:00
TreeHugger Robot
4fd9dfef2d Merge "Fix null PendingIntent in network listens" into sc-dev 2021-06-29 13:36:15 +00:00
Treehugger Robot
6da2b28e57 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: Ibacbb3f4ca829931b723893a1dd84a2d21de914e
2021-06-29 08:57:56 +00:00
Treehugger Robot
b0c9e64d33 Merge "Revert "Skip connectivity unit tests before S"" 2021-06-29 08:14:26 +00:00
Victor Chang
e4132c8ca0 Merge "Partial cherry-pick to remove IoUtils#deleteContents usage in FrameworksNetTests" into sc-dev 2021-06-29 08:12:04 +00:00
Paul Hu
dca7230c1d 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>
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733212
Merged-In: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4

Change-Id: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4
2021-06-29 16:07:54 +08:00
Remi NGUYEN VAN
4cb6189802 Fix null PendingIntent in network listens
In S ConnectivityService was changed to use getActiveRequest() to fill
EXTRA_NETWORK_REQUEST, but there is no active request in the case of
listens.

When getActiveRequest() is missing, use the first mRequest instead. This
should match previous behavior.

Bug: 191713869
Test: atest android.net.cts.ConnectivityManagerTest
Original-Change: https://android-review.googlesource.com/1748153
Merged-In: Id7343a4cc020aba16b7979b16334721c56b2839c
Change-Id: Id7343a4cc020aba16b7979b16334721c56b2839c
2021-06-29 07:07:28 +00:00
Treehugger Robot
b91d44a64a Fix flakes in tests running after testIsPrivateDnsBroken
The test would not reconnect wifi after restoring the private DNS setting,
so validation would not be triggered, and it would remain identified as
having broken private DNS.

Reconnect wifi after the test to avoid affecting subsequent tests.

Original-Change: https://android-review.googlesource.com/1749560
Merged-In: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Change-Id: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Test: atest android.net.cts.ConnectivityManagerTest
Bug: 182296835
2021-06-29 04:04:07 +00:00
Remi NGUYEN VAN
284b3c028c 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
2021-06-29 01:08:00 +00:00
Gaurav Sarode
4f0546ccbe Fix testGetAllNetworkStateSnapshots for non-cellular
bug: 192115694
Test: atest ConnectivityManagerTest#testGetAllNetworkStateSnapshots
Change-Id: Ie7f637248302f3e6b61be69ef4c6a7a906e69275
2021-06-28 14:24:08 -07:00
Remi NGUYEN VAN
819045fc60 Partial cherry-pick to remove IoUtils#deleteContents usage in FrameworksNetTests
It's a partial cherry-pick of https://r.android.com/1731232

Bug: 154796679
eest: atest ConnectivityCoverageTests
Merged-In: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383
Change-Id: I23565c4144e665130585a86ce66cee6c2da07b60
2021-06-28 16:53:15 +01:00
Victor Chang
99c7bdb1a4 Merge "Remove usage of internal APIs from InetAddress and ServerSocket" into sc-dev 2021-06-28 14:17:12 +00:00
Treehugger Robot
917b071f80 Merge "Move ConnectivityCoverageTests to general-tests" am: 9330953258 am: e206deb76e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749025

Change-Id: I758a275ce750b0e1929dc97a059ddd5b91758c0f
2021-06-28 13:48:18 +00:00
Treehugger Robot
9330953258 Merge "Move ConnectivityCoverageTests to general-tests" 2021-06-28 13:17:25 +00:00
Junyu Lai
dc3a7a39d4 Consider NetworkOffer is unneeded if it cannot satisfy the request
Currently, to prevent from network connect-teardown-loops that
caused by inaccurate reports, e.g. the provider always provides
a better network than the offer, the NetworkOffer is considered
needed if its provider is currently serving the request. This
is because there is no accurate way to know whether the offer is
corresponding to the network that is currently serving the
request.

However, if the offer cannot even satisfies the request, consider
the offer is needed does not make any sense. Since it can
never be the one that currently serving the request, nor be
the one that might beat current satisfier.

Test: android.net.NetworkProviderTest
Bug: 189074532
Change-Id: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
2021-06-28 12:44:31 +00:00
Victor Chang
6fae863801 Remove usage of internal APIs from InetAddress and ServerSocket
It affects the test only.

Bug: 154796679
Test: atest CtsNetTestCases
Merged-In: I77a419c459ee53b36d24f324ecab2b5dae5744de
Change-Id: I77a419c459ee53b36d24f324ecab2b5dae5744de
(cherry picked from commit ef88fadc2e)
2021-06-28 12:11:52 +01:00
Treehugger Robot
cb97471321 Merge "Fix flakes in tests running after testIsPrivateDnsBroken" am: de7eb04d71 am: d2b7990122
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749560

Change-Id: Id6d77c1eb1f862605ce741c894f895ad16ca4cc9
2021-06-28 10:46:56 +00:00
Treehugger Robot
de7eb04d71 Merge "Fix flakes in tests running after testIsPrivateDnsBroken" 2021-06-28 10:26:24 +00:00
Remi NGUYEN VAN
507d094373 Move ConnectivityCoverageTests to general-tests
The test suite is not signed with any particular key so
can be in general-tests. This is also required for TEST_MAPPING.

Bug: 187935317
Change-Id: I9dbf98eaa28172a172e707091ea75ffdddd4971b
Test: TH for test mapping
2021-06-28 09:29:51 +00:00
lucaslin
5fe3926a11 Print the result of command when test is failed
When ConnectivityManagerTest#testGetMultipathPreference() is
failed, it only prints "Unexpected format from cmd netpolicy" and
it's not helpful.
Print the result of command can help people to know what's the
difference between expected result and actual result.

Bug: 187921745
Test: atest CtsNetTestCases:ConnectivityManagerTest#testGetMultipathPreference
Change-Id: I63cd4b043e7c70775156aa5244d25ee2268f9f32
2021-06-28 16:50:38 +08:00
Remi NGUYEN VAN
9f4a31af59 Merge "Fix ConnectivityManagerTest initialization on Q" am: 72f59b3019 am: 82a32e3f4a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740779

Change-Id: I40abcac7db563480fe3c13fb5e0178d7a3629652
2021-06-28 07:40:27 +00:00
Remi NGUYEN VAN
8c89161b52 Merge "Fix null PendingIntent in network listens" am: 27a942cb32 am: 78aa9a4bdc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748153

Change-Id: I93002b6e1f6a40af501f8af6721865dbdc329984
2021-06-28 07:40:20 +00:00
Remi NGUYEN VAN
72f59b3019 Merge "Fix ConnectivityManagerTest initialization on Q" 2021-06-28 07:24:49 +00:00
Remi NGUYEN VAN
27a942cb32 Merge "Fix null PendingIntent in network listens" 2021-06-28 07:11:31 +00:00
Remi NGUYEN VAN
582770ce68 Fix flakes in tests running after testIsPrivateDnsBroken
The test would not reconnect wifi after restoring the private DNS setting,
so validation would not be triggered, and it would remain identified as
having broken private DNS.

Reconnect wifi after the test to avoid affecting subsequent tests.

Change-Id: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Test: atest android.net.cts.ConnectivityManagerTest
Bug: 182296835
2021-06-28 06:58:51 +00:00