Commit Graph

3209 Commits

Author SHA1 Message Date
Lucas Lin
7059292726 Merge "Simplify the return condition in stop()" am: 584ab08627 am: c955dcc84d am: b278aac2a3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1729690

Change-Id: If4f1980844e042eb897db548e5afa10799917aff
2021-07-01 02:33:00 +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
Remi NGUYEN VAN
aa56ebdcb7 Merge "Apply jarjar rules on coverage tests" am: d590b30f72 am: 073f6e299a am: 4a980eebf5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749680

Change-Id: I9ffdff991415b7e353c5962b8fdf0985faa80e2b
2021-07-01 01:22:38 +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
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
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
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
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
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