Commit Graph

3201 Commits

Author SHA1 Message Date
Treehugger Robot
eee8e24724 Merge "Fix network callback with the same PendingIntent does not release" am: 6d908a513a am: e6517c060f am: 8711b078ff
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1727470

Change-Id: I92046b205588e4e88a1866bd81e15748a2ec08a4
2021-06-30 22:25:04 +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
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
Remi NGUYEN VAN
f920878bc1 Merge "Re-skip connectivity unit tests before S" am: a9230c1bf7 am: 1f3d8dc5e8 am: aec0e35349
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749684

Change-Id: I485a07ba29fd9297ed47275e6c540a50937e34f9
2021-06-30 08:36:58 +00: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
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
2a86b04c86 Merge "Revert "Skip connectivity unit tests before S"" am: b0c9e64d33 am: af5ae307f2 am: 6da2b28e57
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749498

Change-Id: Iebada4df31329177149ba73bd820869312ba413d
2021-06-29 08:58:03 +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
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
Treehugger Robot
2e90b83796 Merge "Move ConnectivityCoverageTests to general-tests" am: 9330953258 am: e206deb76e am: 917b071f80
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749025

Change-Id: Id67b8f40baba86be438a81755485cff2f4b18f5e
2021-06-28 14:01:04 +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
Treehugger Robot
4e703da944 Merge "Fix flakes in tests running after testIsPrivateDnsBroken" am: de7eb04d71 am: d2b7990122 am: cb97471321
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749560

Change-Id: Ib88f9aedaa864176c79e28e2e4557b9e1d81d44f
2021-06-28 11:01:15 +00: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
Remi NGUYEN VAN
3d99032422 Merge "Fix ConnectivityManagerTest initialization on Q" am: 72f59b3019 am: 82a32e3f4a am: 9f4a31af59
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1740779

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

Change-Id: I11eeb5b4c8d25d116dd967be0157e7603ed0a8be
2021-06-28 07:52:06 +00: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
Treehugger Robot
a8a30e8722 Merge "Move test_mainline_modules to AndroidTest.xml" am: abbee98e86 am: 6709c9b056 am: 2b373de5a4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748157

Change-Id: I9e0c74fe6c55a5efdfd67c064915e823689109a6
2021-06-28 07:07:11 +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
Treehugger Robot
2b373de5a4 Merge "Move test_mainline_modules to AndroidTest.xml" am: abbee98e86 am: 6709c9b056
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1748157

Change-Id: Idf16454383a65e6ccc1c4672c7d83e8742512ea7
2021-06-28 06:57:47 +00:00
Treehugger Robot
abbee98e86 Merge "Move test_mainline_modules to AndroidTest.xml" 2021-06-28 06:27:42 +00:00
Paul Hu
1b4fd02912 Merge "Use appId instead of uid" am: 683c386403 am: 9658c8ea69 am: e6e75faf1d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733212

Change-Id: I553d03b3bfd2855d4d257e2f09e758f8a5d8b796
2021-06-28 04:18:38 +00:00
Paul Hu
e6e75faf1d 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: Ic23e289c26e4b61864d1343eb0e6494f8cd43587
2021-06-28 04:07:10 +00:00
Paul Hu
683c386403 Merge "Use appId instead of uid" 2021-06-28 03:35:45 +00:00
Remi NGUYEN VAN
0d54d7992d Fix ConnectivityManagerTest initialization on Q
The test can't have TetheringManager as an argument to methods or a
field, otherwise the test runner will crash when scanning the class for
tests because TetheringManager did not exist in Q. Although
testFactoryReset is already skipped on Q, the test runner would fail
at initialization time, before starting the run.

Use CtsTetheringUtils instead. This ensures that TetheringManager does
not have method signatures or members that reference classes that do not
exist on Q, so the test runner can scan the class successfully before
starting the run.

Bug: 188851796
Test: atest ConnectivityManagerTest on Q
Change-Id: I87488d0f23628a1ef2d7af0242513fcc5401d598
2021-06-28 11:24:27 +09:00
Remi NGUYEN VAN
8b2a47c867 Move test_mainline_modules to AndroidTest.xml
When an AndroidTest.xml is used, configuration needs to be in the
AndroidTest.xml file, not in the Android.bp.

This currently causes tests not to be run in TEST_MAPPING as they should
be.

Test: TH needs to test
Bug: 187935317
Change-Id: Ie0aca0c64646825175769cd375bcecf65de4b4c8
2021-06-28 10:55:15 +09:00
Remi NGUYEN VAN
1e238a87e9 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
Change-Id: Id7343a4cc020aba16b7979b16334721c56b2839c
2021-06-28 09:14:30 +09:00
Junyu Lai
6a1c975562 Merge "Check null NetworkSpecifier before redacting" am: 435c4f7fc5 am: 9c5e87388d am: 6efa057bf5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1747893

Change-Id: I5ebb779b147125295d355ca6d3654a13202175f5
2021-06-25 16:10:58 +00:00
Junyu Lai
6efa057bf5 Merge "Check null NetworkSpecifier before redacting" am: 435c4f7fc5 am: 9c5e87388d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1747893

Change-Id: I7e317ebb77d921c50e21a6a710e388e453cdfe62
2021-06-25 15:54:20 +00:00
Junyu Lai
c06260b5b5 Merge changes I81bf8969,I2edba513,Ibb913979
* changes:
  Add CTS for NetworkScore.setTransportPrimary
  Add some CTS tests for NetworkScore.
  Add a first CTS for NetworkScore
2021-06-25 15:28:27 +00:00
Junyu Lai
435c4f7fc5 Merge "Check null NetworkSpecifier before redacting" 2021-06-25 15:27:55 +00:00
vichang
3def11a01c Merge "Remove usage of internal APIs from InetAddress and ServerSocket" am: c577c271ba am: 530af4bc13 am: 637b44ffed
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1737102

Change-Id: I28cddfe12300faaf44c369c200e9de05d8768a5a
2021-06-25 11:26:46 +00:00
vichang
637b44ffed Merge "Remove usage of internal APIs from InetAddress and ServerSocket" am: c577c271ba am: 530af4bc13
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1737102

Change-Id: I6a617ff3c6e8dbbe49459a12169ce42a85f801e3
2021-06-25 11:17:20 +00:00
vichang
c577c271ba Merge "Remove usage of internal APIs from InetAddress and ServerSocket" 2021-06-25 10:54:52 +00:00
Junyu Lai
144b6c742a Check null NetworkSpecifier before redacting
Do null check before redacting, since NetworkSpecifier will not
always be attached. For example, NetworkSpecifier of wifi
network is only attached when a wifi network is created
in response to a network request with specifier attached.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testGetAllNetworkStateSnapshots \
      --rerun-until-failure 100
      (tested on cuttlefish mobile and wifi)
Bug: 191944987
Change-Id: I5df3547995111fe6340facb94a577296d2228694
2021-06-25 08:24:12 +00:00
Remi NGUYEN VAN
c4880c58d9 Merge "Skip connectivity unit tests before S" am: ef34fd2e21 am: 7ab2d7440c am: 1e832f336b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1736507

Change-Id: I1f954a876a095bf2ead8344f8f601ef03402a6a1
2021-06-25 06:21:56 +00:00
Remi NGUYEN VAN
1e832f336b 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: I8f1d639243617f21ab220685108adab2a3e8d3a3
2021-06-25 06:07:10 +00:00
Remi NGUYEN VAN
05dd1ba540 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
2021-06-25 10:10:12 +09:00
Chalard Jean
20a159633a Add CTS for NetworkScore.setTransportPrimary
Bug: 184037351
Test: this
Merged-In: I81bf8969ace3cb6826b30c5bbd0b896c64c73c57
Change-Id: I81bf8969ace3cb6826b30c5bbd0b896c64c73c57
  (cherry-picked from ag/14452540)
2021-06-24 08:33:28 +00:00
Chalard Jean
b8c396b3b5 Add some CTS tests for NetworkScore.
Bug: 184037351
Test: this
Merged-In: I2edba51351cd4c71727663aa85b1d5141bff2a15
Change-Id: I2edba51351cd4c71727663aa85b1d5141bff2a15
  (cherry-picked from ag/14452538)
2021-06-24 08:33:28 +00:00
Chalard Jean
e349356eb9 Add a first CTS for NetworkScore
In an effort to make reviewing easier, this implements most of
the infra but only a mostly trivial test.

Bug: 184037351
Test: this
Merged-In: Ibb9139798ce44d748e87bae79a1e23311ec8d9b6
Change-Id: Ibb9139798ce44d748e87bae79a1e23311ec8d9b6
  (cherry-picked from ag/14452537)
2021-06-24 08:33:28 +00:00