Commit Graph

42859 Commits

Author SHA1 Message Date
Benedict Wong
8ae7eba5c2 [automerger skipped] Update ConnDiags CTS test to expect validation result SKIPPED. am: ae00382c67 -s ours
am skip reason: Merged-In I78b78919d5b0f09348dfdd5fdb37418b8c7f861f with SHA-1 f1120be78b is already in history

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

Change-Id: I14acd7073b59e734a76a67240fac25398566e708
2021-08-06 11:44:02 +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
Chiachang Wang
a758f40ef9 Do callback unregistration automatically in tearDown am: 7a45f107de am: 4e0841524b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1787229

Change-Id: I8f72e741567288717bbc94e115f9aa0816cfad86
2021-08-05 14:14:02 +00:00
Chiachang Wang
4e0841524b Do callback unregistration automatically in tearDown am: 7a45f107de
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1787229

Change-Id: I9b2c27c6ebe2c64c95a921a5bdc363e5d8b92e43
2021-08-05 14:02:11 +00:00
Chiachang Wang
7a45f107de Do callback unregistration automatically in tearDown
Ideally, unregisterCallbackQuietly() is only needed when the
callback is registered in the try block. The callbacks
registration located outside the try block should be
registered theoretically. Otherwise, it may be a bug if the
tests get the IllegalArgumentException.

Use unregisterCallbackQuietly() in all finally may cause bug
in unregisterNetworkCallback invisible.

However, it may cause different tests with different code to
do the unregistration. Thus, do a refactor to add some methods
to wrap the NetworkCallback registration. This allows the tests
to do the unregister automatically in the tearDown().

Bug: 195364778
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: If06993f643ac7aeb23638a283347c427934a2f99
2021-08-05 19:47:20 +08:00
Chalard Jean
9f20b8ede3 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: I9d23da353164bfef42d63ffe7f0fa82d32987be0
2021-08-05 11:40:54 +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
0285b1d8a8 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: Id2cb24cb61df117b509b775cc9b15d7864fc1453
2021-08-05 07:29:48 +00:00
Remi NGUYEN VAN
883dbaeacd [automerger skipped] Add overlay options for no internet notifications am: 893494289b -s ours
am skip reason: Merged-In Ib5bd74d8cf973bf70d373dd63648c178fae0ebae with SHA-1 5dc6ca0318 is already in history

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

Change-Id: I69ada03b5edc2d1e216e849868e6442e9b0fe81d
2021-08-05 07:29:46 +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
3b02bc560b [automerger skipped] Fix a crash when changing preferences am: 5234f3acc6 -s ours
am skip reason: Merged-In Ia482e6fbf2bf300ce6cbaca72810d394ed201b98 with SHA-1 9473c984b8 is already in history

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

Change-Id: I1fc9639d0ac20314812f3e2c6ca1d1bd27cdae40
2021-08-05 03:16:19 +00:00
Treehugger Robot
bda6da7324 Merge "Catch exception of unregisterNetworkCallback" am: 740cda4358 am: 9e6b732a17
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1784389

Change-Id: I236faafdd55dd8aaad5cff2ab5b310e0e653276b
2021-08-05 02:05:44 +00:00
Treehugger Robot
9e6b732a17 Merge "Catch exception of unregisterNetworkCallback" am: 740cda4358
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1784389

Change-Id: I922ac12c29cd1539c9c284af6adb556bfe0d5976
2021-08-05 01:53:12 +00:00
Treehugger Robot
740cda4358 Merge "Catch exception of unregisterNetworkCallback" 2021-08-05 01:37:30 +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
Chalard Jean
faa5bad6c3 Merge "Fix a crash when changing preferences" am: aeb051b962 am: 916aeb7b0d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1781202

Change-Id: I39a8e756c73c675fc0eb74f3d570d128f6ecf390
2021-08-04 12:48:02 +00:00
Chalard Jean
916aeb7b0d Merge "Fix a crash when changing preferences" am: aeb051b962
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1781202

Change-Id: Ifa0249c059488029e5e8902cd7bbece06a6d54f2
2021-08-04 12:35:33 +00:00
Chalard Jean
aeb051b962 Merge "Fix a crash when changing preferences" 2021-08-04 12:23:52 +00: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
Remi NGUYEN VAN
f51a0ded84 Merge "Add overlay options for no internet notifications" am: 4f39cacbc3 am: aca228c07a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1782433

Change-Id: I87238b54c517a4efb11bca6e23cc2484b66f217e
2021-08-04 08:08:20 +00:00
Remi NGUYEN VAN
aca228c07a Merge "Add overlay options for no internet notifications" am: 4f39cacbc3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1782433

Change-Id: I8b90b76f5ce6d2da701712116ed4f07284a4eef0
2021-08-04 07:59:48 +00:00
Xiao Ma
f29e0435a9 Merge "Import net-utils-device-common-netlink instead of netlink-client." am: 609e71a46c am: dd7e9e8800
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753303

Change-Id: I4fb162f20f5816de1ee1b784cb39533362b34677
2021-08-04 07:56:23 +00:00
Remi NGUYEN VAN
4f39cacbc3 Merge "Add overlay options for no internet notifications" 2021-08-04 07:50:36 +00:00
Xiao Ma
dd7e9e8800 Merge "Import net-utils-device-common-netlink instead of netlink-client." am: 609e71a46c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753303

Change-Id: Ifc983a6a584e335170a15715136d637f5abc18a9
2021-08-04 07:43:23 +00:00
Xiao Ma
609e71a46c Merge "Import net-utils-device-common-netlink instead of netlink-client." 2021-08-04 07:27:18 +00:00
Yintang Gu
b2cc61122c Catch exception of unregisterNetworkCallback
Catch exception of unregisterNetworkCallback to
avoid reset operations afterwards being skipped by it.

Change-Id: Idb1161abfd143fb1305982338007dac169d372b5
Bug: 195364778
2021-08-04 14:05:31 +08:00
Remi NGUYEN VAN
5dc6ca0318 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
Change-Id: Ib5bd74d8cf973bf70d373dd63648c178fae0ebae
2021-08-04 11:23:03 +09:00
Treehugger Robot
d266885202 Merge "Add a small comment to a test" am: 8ba4b12dff am: 9529651ecb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1779754

Change-Id: Iff5cd49863772e5ed1d7e0cbc2f3161fc9d3b753
2021-08-03 15:44:23 +00:00
Treehugger Robot
9529651ecb Merge "Add a small comment to a test" am: 8ba4b12dff
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1779754

Change-Id: Ifd029e7d05f41b191dc927d7f56ce89f987149e6
2021-08-03 15:20:10 +00:00
Treehugger Robot
8ba4b12dff Merge "Add a small comment to a test" 2021-08-03 15:00:26 +00:00
Nucca Chen
e17f852861 Merge "Throw an errno exception when open BPF map failed" am: 22d5336279 am: 84c87a49b1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772440

Change-Id: Ib933a28d7ad5504def71e012a83b9080048fa37e
2021-08-03 09:00:34 +00:00
Nucca Chen
84c87a49b1 Merge "Throw an errno exception when open BPF map failed" am: 22d5336279
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772440

Change-Id: I280c9e505a0124ae3cd6bdbb5043f87c40f64fbd
2021-08-03 08:48:59 +00:00
Nucca Chen
22d5336279 Merge "Throw an errno exception when open BPF map failed" 2021-08-03 08:38:42 +00:00
Hungming Chen
1257e9bfff Throw an errno exception when open BPF map failed
Needed because an invalid file descriptor should notify the caller to
stop using the object.

Bug: 190523685

Test: atest BpfMaptest
Change-Id: I70fb08b54b1c0caa4be4e3f07b59bf4f2397f39d
2021-08-03 08:38:16 +00:00
Remi NGUYEN VAN
f85573a165 Merge "Do not use mockito to create HttpURLConnection" am: 83c77c088b am: 526015114e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1784391

Change-Id: I4f989b79620175486b9188965f46740619078957
2021-08-03 08:19:45 +00:00
Remi NGUYEN VAN
96019d9353 Merge "Do not apply jarjar rules on intermediate libs" am: c1e68abd6f am: 4972bf1971
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1778569

Change-Id: I4bf35535002bc1ec90913a941923f9c6e0a1c72b
2021-08-03 08:19:31 +00:00
Remi NGUYEN VAN
526015114e Merge "Do not use mockito to create HttpURLConnection" am: 83c77c088b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1784391

Change-Id: Ic167c952e137d56edfe8266f65db1a224ba65ff6
2021-08-03 08:07:10 +00:00
Remi NGUYEN VAN
4972bf1971 Merge "Do not apply jarjar rules on intermediate libs" am: c1e68abd6f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1778569

Change-Id: Iab23155e5e5c98e2933d142fe0ccde2a060c5eda
2021-08-03 08:06:48 +00:00
Remi NGUYEN VAN
83c77c088b Merge "Do not use mockito to create HttpURLConnection" 2021-08-03 07:51:34 +00:00
Remi NGUYEN VAN
c1e68abd6f Merge "Do not apply jarjar rules on intermediate libs" 2021-08-03 07:50:29 +00:00
Treehugger Robot
b8b59b96b6 [automerger skipped] Merge "Mock DisplayMetrics in NotificationManagerTest" am: b1263d0363 am: 79f077a0ea -s ours
am skip reason: Merged-In I3c2563d4ae4e3715d0c6270344ba8f7ef067872f with SHA-1 2afd0986d3 is already in history

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

Change-Id: I882d4e5093b83145ef743c120ca67c7d55c31d8a
2021-08-03 05:28:52 +00:00
Treehugger Robot
79f077a0ea Merge "Mock DisplayMetrics in NotificationManagerTest" am: b1263d0363
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1784388

Change-Id: I24c16d69009edbf448e05b526b1a6d39068b8fb9
2021-08-03 05:19:48 +00:00
Treehugger Robot
b1263d0363 Merge "Mock DisplayMetrics in NotificationManagerTest" 2021-08-03 05:09:14 +00:00
Remi NGUYEN VAN
5d67667e9b Do not use mockito to create HttpURLConnection
Instead, use a dedicated MockConnection class.
This should improve performance of the test, and works around failures
where mockito crashes when creating mocks when openConnection is called.
The failures are believed to be a bug in mockito-extended, but are not
likely to be fixed soon.

Bug: 185083316
Test: atest FrameworksNetIntegrationTests
Change-Id: I32deaaaaa5ce9876611314c8e8b9d8bdd6325df0
2021-08-03 12:43:57 +09:00
Treehugger Robot
e89c417ce3 Merge "Merge NetdServiceMonitor into NetdMonitor." am: 44021f4a17 am: 7a1dfa1238
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1767648

Change-Id: Ia6d652a9aa23ade3f9d24fef9f05676549fb1d89
2021-08-02 16:37:56 +00:00
Treehugger Robot
7a1dfa1238 Merge "Merge NetdServiceMonitor into NetdMonitor." am: 44021f4a17
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1767648

Change-Id: I0a695f1b57a8c45cafcdb156c6dca0f9fc02e87f
2021-08-02 16:25:18 +00:00
Treehugger Robot
44021f4a17 Merge "Merge NetdServiceMonitor into NetdMonitor." 2021-08-02 16:09:16 +00:00
Remi NGUYEN VAN
0015f04ec7 Do not apply jarjar rules on intermediate libs
Using jarjar on intermediate libraries causes issues when they are
combined with other libraries that use different jarjar rules, as the
resulting binary may contain multiple incompatible copies of the
classes. Instead, jarjar should be used on the final artifact, after
combining the libraries.

Ensure NetworkStackJarJarRules is not applied on intermediate libraries
like TetheringIntegrationTestsLib, but instead apply it on
TetheringIntegrationTests or CtsTetheringTest.

Bug: 192535368
Test: atest TetheringCoverageTests TetheringIntegrationTests \
          CtsTetheringTest
Change-Id: I248a533651984de81f676336c0e74e3788610bbb
2021-08-02 19:13:09 +09:00