Commit Graph

29304 Commits

Author SHA1 Message Date
Xin Li
28c8a63f3a [automerger skipped] Merge stage-aosp-sc-ts-dev before making it an upstream am: b5c6036c29 -s ours am: 21026d8bfb -s ours
am skip reason: Merged-In I592dd5f1d6e13b020beadb11b9d913857a82e524 with SHA-1 58b493abf6 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15546967

Change-Id: Id06b722ffc5c36f71b7a8d05bebbfad28a5074b9
2021-08-13 21:20:28 +00:00
Xin Li
21026d8bfb [automerger skipped] Merge stage-aosp-sc-ts-dev before making it an upstream am: b5c6036c29 -s ours
am skip reason: Merged-In I592dd5f1d6e13b020beadb11b9d913857a82e524 with SHA-1 58b493abf6 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15546967

Change-Id: I6c8ea5e480616212dee710e111cd4b16d6533b7d
2021-08-13 20:53:31 +00:00
Xin Li
b5c6036c29 Merge stage-aosp-sc-ts-dev before making it an upstream
Bug: 169893837
Merged-In: I592dd5f1d6e13b020beadb11b9d913857a82e524
Change-Id: I9db108c5bf31c17321534a55c1e6e78f46b96c45
2021-08-13 18:26:19 +00:00
Xin Li
de12da7a25 Merge "Merge ab/7633965" into stage-aosp-sc-ts-dev 2021-08-13 00:03:19 +00:00
The Android Open Source Project
7ef5d542cd Merge ab/7633965
Bug: 169893837
Merged-In: I592dd5f1d6e13b020beadb11b9d913857a82e524
Change-Id: I4e01d58ed61c595b704bae6c935d0da1714ee398
2021-08-12 22:28:22 +00:00
Aaron Huang
47b4556fc0 Merge "Skip wifi stats test if link layer stats is not supported" into sc-dev am: 9ac9c1d575 am: 1a1ab4a4ab
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15479880

Change-Id: I98f7f0051761e8f912f980cb23a6c7cde536a181
2021-08-11 04:07:05 +00:00
Aaron Huang
1a1ab4a4ab Merge "Skip wifi stats test if link layer stats is not supported" into sc-dev am: 9ac9c1d575
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15479880

Change-Id: I677f8566496230e8ac6fd141e6e4d79aad4b1cf8
2021-08-11 03:51:56 +00:00
Aaron Huang
1b88f69d99 Skip wifi stats test if link layer stats is not supported
Wifi link layer is an optional feature so this test will be
failed on wifi stats check if a device does not support it.
Add a check to know if the  device supports wifi link layer
stats and skip it if it is not supported.

Ignore-AOSP-First: Needs cherry-picks
Bug: 195518957
Test: CtsNetTestCases:BatteryStatsManagerTest
Change-Id: I592dd5f1d6e13b020beadb11b9d913857a82e524
Merged-In: I592dd5f1d6e13b020beadb11b9d913857a82e524
(cherry picked from commit 58b493abf6)
2021-08-11 03:45:29 +00:00
Aaron Huang
9ac9c1d575 Merge "Skip wifi stats test if link layer stats is not supported" into sc-dev 2021-08-11 03:33:53 +00:00
Aaron Huang
58b493abf6 Skip wifi stats test if link layer stats is not supported
Wifi link layer is an optional feature so this test will be
failed on wifi stats check if a device does not support it.
Add a check to know if the  device supports wifi link layer
stats and skip it if it is not supported.

Ignore-AOSP-First: Needs cherry-picks
Bug: 195518957
Test: CtsNetTestCases:BatteryStatsManagerTest
Change-Id: I592dd5f1d6e13b020beadb11b9d913857a82e524
2021-08-10 14:37:51 +08:00
Lucas Lin
2883684925 Merge "Add test for [stop|start]VpnProfile()" into sc-dev am: 2900ffbb5f am: 849c3fb997
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15359731

Change-Id: I8a0f348953405ee38358739525fa9825cd3e0670
2021-08-10 02:55:36 +00:00
Lucas Lin
849c3fb997 Merge "Add test for [stop|start]VpnProfile()" into sc-dev am: 2900ffbb5f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15359731

Change-Id: I5e6f58cc9f234250a2c41e1b31313cd5663de2ae
2021-08-10 02:40:30 +00:00
Lucas Lin
2900ffbb5f Merge "Add test for [stop|start]VpnProfile()" into sc-dev 2021-08-10 02:28:24 +00:00
TreeHugger Robot
54ecd83b7e Merge "Use dns resolver v9 in connectivity and set resolverOptions to null." into sc-dev am: 4e257a92ca
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15482197

Change-Id: Ifc568e19ddd3462895749efaeaa8e944a40efda2
2021-08-06 19:00:13 +00:00
TreeHugger Robot
4e257a92ca Merge "Use dns resolver v9 in connectivity and set resolverOptions to null." into sc-dev 2021-08-06 18:35:45 +00:00
Remi NGUYEN VAN
0ccf3fb461 Use dns resolver v9 in connectivity and set resolverOptions to null.
The resolverOptions member of the ResolverParamsParcel has never
been set by AOSP code but was only used by OEMs modifying
DnsManager. Now that DnsManager is mainline code, this is no
longer possible. So the DNS resolver introduces a new
setResolverOptions IPC to allow OEMs to set the options and makes
the resolverOptions nullable.

Make DnsManager set resolverOptions to null, to ensure that when
DnsManager calls setResolverConfiguration, it does not overwrite
any options set by the OEM.

Bug: 194048056
Test: Device boots and has connectivity
Change-Id: I310a79521f5a365e50e2c65e9dd87d9b68f105d7
Merged-In: I310a79521f5a365e50e2c65e9dd87d9b68f105d7
2021-08-06 22:21:51 +09:00
Benedict Wong
1bea0853e9 Update ConnDiags CTS test to expect validation result SKIPPED. am: ae00382c67
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15474912

Change-Id: Ib4d746ad90c6d22db7630885bcfac4d78e6d231d
2021-08-06 11:44:51 +00:00
Benedict Wong
ae00382c67 Update ConnDiags CTS test to expect validation result SKIPPED.
This CL updates ConnectivityDiagnosticsManagerTest to expect
NETWORK_VALIDATION_RESULT_SKIPPED for its TestNetworks. The tests also
expect a ConnectivityReport to be sent for all calls to
ConnectivityManager#reportNetworkConnectivity.

This change is different from the one pushed into AOSP & the mainline
modules; this allows both SKIPPED and VALID in the intermediate time
while module prebuilts are generated. MTS will enforce the stricter
SKIPPED check, while this allows both the S-release behavior and
mainline update behavior.

Bug: 162407730
Bug: 195727283
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: Ia0bf1bb53289b079f26597f09b0759a89deb681f
Merged-In: I78b78919d5b0f09348dfdd5fdb37418b8c7f861f
2021-08-06 18:08:48 +09:00
Chalard Jean
b78fb70309 Merge "Revert "Allow network providers to set yield to bad wifi"" into sc-dev am: e8b35336f4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15443464

Change-Id: Iba26d5779df32c9a94b216f10fb6cc665e29cd18
2021-08-05 11:41:42 +00:00
Chalard Jean
e8b35336f4 Merge "Revert "Allow network providers to set yield to bad wifi"" into sc-dev 2021-08-05 11:31:40 +00:00
Remi NGUYEN VAN
574e8d3573 Merge changes Ic33d8976,Ib5bd74d8 into sc-dev am: 6c1e049e29
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15461111

Change-Id: I119dc7433cd8f5fa2ba1f997f7adef8985a3b492
2021-08-05 07:30:42 +00:00
Remi NGUYEN VAN
43bb3a2856 Add overlay options for no internet notifications am: 893494289b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15461110

Change-Id: Ic49531aa88bceeb4f75b3b3ef071df7acef1a71f
2021-08-05 07:30:39 +00:00
Remi NGUYEN VAN
6c1e049e29 Merge changes Ic33d8976,Ib5bd74d8 into sc-dev
* changes:
  Mock connectivity resources in integration tests
  Add overlay options for no internet notifications
2021-08-05 07:17:31 +00:00
Remi NGUYEN VAN
0a37e72f0c Mock connectivity resources in integration tests
The resources may have different values depending on devices, and
resources IDs may mismatch if the test was not built at the same time as
the installed module, so mock the resources to allow running the
integration tests on more builds.

Bug: 193847396
Test: atest FrameworksNetIntegrationTests
Ignore-AOSP-First: cherry-pick created
Change-Id: Ic33d897690a8ea84a78c01dc5f2b2e2c473d57df
2021-08-05 07:07:38 +00:00
Chiachang Wang
4dd0f9c194 Revert "Allow network providers to set yield to bad wifi"
This reverts commit c4660c98f6a63a73df1a79c34fbbf2266a6b381e.

The reverted commit removed the POLICY_YIELD_TO_BAD_WIFI exclusive
bit from the EXTERNAL_POLICIES_MASK. The new policy calculation
is done by bitwise-or-ing with existing policy. If the
POLICY_YIELD_TO_BAD_WIFI was ever set to policy in the FullScore
, CS will not be able to remove the policy to reflect the avoid
bad wifi setting change since the result is always be true unless
the policy is updated from factories.

Eventually, the original commit is the intended design but current
design could not work well with it. Thus, revert it to keep the
control on CS now.

Bug: 195612849
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: I002e206ffd41796cb0996b9c559afed3d619b67c
Ignore-AOSP-First: Commit is only available in internal branch
2021-08-05 05:23:23 +00:00
Chalard Jean
2172622826 Fix a crash when changing preferences am: 5234f3acc6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15461334

Change-Id: I2b3df58034ea683ce96e88b84243ecf1ffd0d9b4
2021-08-05 03:18:23 +00:00
Chalard Jean
5234f3acc6 Fix a crash when changing preferences
The crash occurs when some app has more than half its limit
in requests that will need to be moved to some other default
network upon changing the preferences.
This will send the requests for this app over the limit
temporarily when creating new requests for the reevaluated
ones.

While ConnectivityService has a provision for making a
transaction-like addition/removal of requests that is meant
to avoid exactly this kind of crash with the transact()
method on PerUidCounter, the code only transacts on
mSystemNetworkRequestCounter. But these requests are counted
in the mNetworkRequestCounters, which is not part of the
transaction, causing the crash anyway.

To avoid the problem, this patch allows the request counters
to go over the max if and only if the system server is
updating the request counts for a UID other than its own.
This should allow only the case where ConnectivityService is
moving the requests over to the new per-uid default, while
keeping the exception when registering from an app (then the
calling UID is not the system server), or when the system
server registers its own requests (then the UID inside the
request is that of the system server).

A much better solution than this patch would be to completely
eliminate the transact() method by somehow unregistering the
old ones before creating the new ones.
However this would be a much bigger and difficult patch than
this, and much more dangerous, because callers depend on the
list of requests to find out the old requests to remove, so
they have to be created first.

Another possible clean solution would be to count the
requests not in the NRI constructor, but later. This would be
more error-prone though because it would be very easy to
create an NRI without counting it.

Bug: 192470012
Test: ConnectivityServiceTest. Improve tests so they catch
      this case.

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1781202

Merged-In: Ia482e6fbf2bf300ce6cbaca72810d394ed201b98
Change-Id: I6744d2f60d6bd664f048b532a58461c110a5b7fe
(cherry picked from commit 916aeb7b0d)
2021-08-05 10:33:12 +09:00
Remi NGUYEN VAN
893494289b Add overlay options for no internet notifications
Add an option to display the no internet dialog directly instead of
showing a notification when the notification would have been high
priority (typically when the network was explicitly selected). This is
disabled by default, but allows device manufacturers to use a slightly
more disruptive UX to ensure that the user is aware that the network has
no connectivity, and can take action.

Also add an option to show the same notification as "no internet"
instead of the "partial connectivity" notification. This is also
disabled by default, but allows device manufacturers to use the "no
internet" text if they feel that "partial connectivity" text is hard
to understand for the user.

Bug: 193847396
Test: atest NetworkNotificationManagerTest
Original-Change: https://android-review.googlesource.com/1782433
Merged-In: Ib5bd74d8cf973bf70d373dd63648c178fae0ebae
Change-Id: Ib5bd74d8cf973bf70d373dd63648c178fae0ebae
2021-08-04 08:20:24 +00:00
Aaron Huang
652265c32a Add INTERACT_ACROSS_USERS_FULL to test for setCurrentProxyScriptUrl am: d9639a9bf4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15426434

Change-Id: I6ec322a0997468f8f27cc390b284e7762f762856
2021-07-30 10:17:01 +00:00
Aaron Huang
d9639a9bf4 Add INTERACT_ACROSS_USERS_FULL to test for setCurrentProxyScriptUrl
If the test passes uid from another user which requires
INTERACT_ACROSS_USERS_FULL permission to bind service.

Bug: 192114565
Test: atest CtsNetTestCases:PacProxyManagerTest
Original-Change: https://android-review.googlesource.com/1755050
Merged-In: I2ddff09b4c9cda1e7c5f3566662ba9cc07fffaae
Change-Id: I2ddff09b4c9cda1e7c5f3566662ba9cc07fffaae
2021-07-30 05:32:00 +00:00
lucaslin
a9ef5a9252 Add test for [stop|start]VpnProfile()
Ignore-AOSP-First: It's a part of security patches.
Bug: 191382886
Test: atest FrameworksNetTests:VpnTest
Change-Id: Ie9c0c626f404efe0dd6dc79ca891639bc224090a
2021-07-29 05:26:47 +00:00
Chalard Jean
f2fdd14157 Merge "Fix a possible system server crash" into sc-dev am: 63fd8aebbd
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15390814

Change-Id: Id836300346ba9e31e7832ee92d484b8834209079
2021-07-28 08:10:06 +00:00
Chalard Jean
63fd8aebbd Merge "Fix a possible system server crash" into sc-dev 2021-07-28 07:46:06 +00:00
Chalard Jean
0bad224c44 Fix a possible system server crash
The scenario is as follows : an app registers a network callback,
then unregisters it and dies immediately after. In this scenario,
the system server will receive a notification of the binder death
and enqueue a call to handleRemoveNetworkRequest. If the callback
unregister message has been process first, this call would result
in unlinkToDeath being called twice on the same Binder, crashing.
This patch fixes the problem by using handleReleaseNetworkRequest
instead of Remove, which looks up the NRI in a map on the handler
thread before calling Remove, returning without doing anything if
the NRI has already been removed.

Test: ConnectivityServiceTest
Test: New test for this
Bug: 194394697
Merged-In: I82a28c37450146838410bf5a059aac295a985fca
Change-Id: Iddab205cf2754d326be816e6e8e92c2cc0b95771
(cherry picked from commit d79bd5c622)
2021-07-28 04:56:19 +00:00
TreeHugger Robot
16d627d8da Merge "Update Tethering development module version numbers to 319999900" into sc-dev am: 5e0a824bb5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15320520

Change-Id: Ida8ce2aa9cb0ac546ea2f031efe02ac4cc19b3e5
2021-07-28 04:27:17 +00:00
TreeHugger Robot
5e0a824bb5 Merge "Update Tethering development module version numbers to 319999900" into sc-dev 2021-07-28 04:04:07 +00:00
Sudheer Shanka
4c47ac0a47 Merge "Verify apps cannot receive ACTION_SNOOZE_WARNING broadcast." into sc-dev am: 69fbdff0ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14824710

Change-Id: If29e21293208bd5e8c0c1bb59c7b331c5b4fd226
2021-07-27 05:29:49 +00:00
Sudheer Shanka
69fbdff0ed Merge "Verify apps cannot receive ACTION_SNOOZE_WARNING broadcast." into sc-dev 2021-07-27 05:13:23 +00:00
Sudheer Shanka
7bbbdbd4f9 Verify apps cannot receive ACTION_SNOOZE_WARNING broadcast.
Bug: 177931370
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Platform changes related to this are not in AOSP yet.
Change-Id: I6d525c4d88ba01838d51a873251593281b628898
2021-07-26 15:51:09 +00:00
TreeHugger Robot
a900a8c853 Merge "Change the url in testDownloadWithDownloadManagerDisallowed" into sc-dev am: 26848924ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15327430

Change-Id: I891c673d3840ac4b27ae0cd07709af4938987fa9
2021-07-26 09:22:15 +00:00
TreeHugger Robot
26848924ea Merge "Change the url in testDownloadWithDownloadManagerDisallowed" into sc-dev 2021-07-26 09:04:54 +00:00
Paul Hu
732e2f0a7e Merge "Temporarily change uid to appId" into sc-dev am: 9bcaabb91c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15328205

Change-Id: Ibbf30fffc0e70dec84b8ed10bbf719267313b820
2021-07-26 08:13:42 +00:00
Treehugger Robot
9841b3d7d1 Use appId for looking up allowed on restricted networks uids list am: 3c42fedeb5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15351474

Change-Id: I6b6d79867ef823e4d02e2fdad20109e51ee56f41
2021-07-26 08:13:38 +00:00
Paul Hu
9bcaabb91c Merge "Temporarily change uid to appId" into sc-dev 2021-07-26 07:55:56 +00:00
Treehugger Robot
3c42fedeb5 Use appId for looking up allowed on restricted networks uids list
aosp/1770606 change uid to appId when filling allowed on
restricted networks uids list. So add UserHandle.getAppId() to
ensure that uses appId for looking up the list.

Bug: 192116643
Test: atest FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1773886
Merged-In: I04fe3a77464d4cb02e7d53026f8f9a10bd0829e1
Change-Id: I04fe3a77464d4cb02e7d53026f8f9a10bd0829e1
2021-07-22 03:19:56 +00:00
Luke Huang
c504df3890 Merge "Modify Nsd{Service,Manager}Test to conform to its change" into sc-dev am: 3c20df39d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15320525

Change-Id: I85323ea6dff8e060af141fd0637c2d1735fafb83
2021-07-22 03:14:59 +00:00
Luke Huang
3c20df39d0 Merge "Modify Nsd{Service,Manager}Test to conform to its change" into sc-dev 2021-07-22 03:00:35 +00:00
Aaron Huang
dfe5a69d44 Move battery unplug command to the beginning of the test am: 9a2f096870
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15344537

Change-Id: Ie4557cd30c50702c0ee31db3e33e3f0cf8178249
2021-07-21 14:29:13 +00:00
Paul Hu
92c911da01 Change the url in testDownloadWithDownloadManagerDisallowed
In China, "https://www.google.com" will redirect to url
"http://www.google.cn" but cleartext traffic is default disabled
for an app. So the testDownloadWithDownloadManagerDisallowed
would failed by cleartext traffic is not permitted. Thus, change
the url in the test which is reachable in China.

Bug: 192978910
Test: atest HostsideVpnTests#testDownloadWithDownloadManagerDisallowed
Original-Change: https://android-review.googlesource.com/1771008
Merged-In: I992c3240f0e133f5b00468cbe85d1545bcf786b0
Change-Id: I992c3240f0e133f5b00468cbe85d1545bcf786b0
2021-07-21 10:17:38 +00:00
Luke Huang
952a55c62d Modify Nsd{Service,Manager}Test to conform to its change
Test: atest NsdManagerTest NsdServiceTest
Bug: 191844585
Change-Id: I3cf658498bef5755dcb01127a94fff913b6e6298
Ignore-AOSP-First: To avoid the side effect caused by automerger.
2021-07-21 08:02:26 +00:00