Commit Graph

37024 Commits

Author SHA1 Message Date
Treehugger Robot
7d0eb2b22a Merge "Use appId for looking up allowed on restricted networks uids list" am: 02d7eb2abe
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1773886

Change-Id: I0a853cfa3abfec8588dc0bdc97aef60230206bb8
2021-07-22 02:21:16 +00:00
Treehugger Robot
02d7eb2abe Merge "Use appId for looking up allowed on restricted networks uids list" 2021-07-22 01:48:45 +00:00
paulhu
25094906ff 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
Change-Id: I04fe3a77464d4cb02e7d53026f8f9a10bd0829e1
2021-07-21 17:45:38 +08:00
Paul Hu
ca4a4a1b86 Merge "Change the url in testDownloadWithDownloadManagerDisallowed" am: 42cbf4ebab
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1771008

Change-Id: I2546f362d5b338aad56afec489742a0b79ec0ca8
2021-07-21 07:11:49 +00:00
Paul Hu
42cbf4ebab Merge "Change the url in testDownloadWithDownloadManagerDisallowed" 2021-07-21 06:59:15 +00:00
Mark Chien
48c9201d28 Merge "Replace throwErrnoException with JNIHelp jniThrowException" am: 7d36391ba4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769765

Change-Id: I89b051b54202df96192dea0d868acce2b12159c6
2021-07-21 06:36:07 +00:00
Aaron Huang
ef23d08eed Merge "Move battery unplug command to the beginning of the test" am: 7691152162
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769295

Change-Id: Idc76e3cc8268579f52ab98fbbc17aed34205ce99
2021-07-21 06:36:01 +00:00
Mark Chien
7d36391ba4 Merge "Replace throwErrnoException with JNIHelp jniThrowException" 2021-07-21 06:30:23 +00:00
Aaron Huang
7691152162 Merge "Move battery unplug command to the beginning of the test" 2021-07-21 06:18:08 +00:00
Aaron Huang
a3debae1eb Move battery unplug command to the beginning of the test
The test failed because the test generated traffic
before the unplug command really done.

The unplug command will eventually have onBattery changed
to true. If the traffic is generated before onBattery changed
to true, then the cellular stats won't be updated. And then,
when BatteryStatsService schedules a sync task to update the
stats which will get no delta because the stats on cellular
has already added to mLastModemNetworkStats. Thus, the test
will finally get failed.

Currently, the battery unplug command is executed after connecting
to cellular network and making sure wifi is disconnected which may
trigger battery stats service schedules sync tasks. If there are
too many tasks need to run, then change onBattery to true would
be later. Thus, move the unplug command to the beginning of the
test and add "dumpsys batterystats --write" which will wait for the
worker to finish the task before continuing. Thus, it can make sure
the batterystats are synced.

Also, the stats will be reset when the devices are unplugging after
the battery was last full or the level is 100, or have gone through
a significant charge. So, enable no-auto-reset to avoid the stats
getting reset during the test.

Bug: 192808200
Test: atest CtsNetTestCases:BatteryStatsManagerTest
Change-Id: I08b38d9955c8cbb2d680e268c29368a4c0a7d144
2021-07-21 02:14:03 +08:00
Treehugger Robot
ef7274ca97 Merge changes I6e6b40b0,I6a0d93e0,Ie26f6e52 am: 1004c23b35
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772430

Change-Id: I5283354f545ef3f9b01f9327e2558314aab1f8f0
2021-07-20 14:56:44 +00:00
Remi NGUYEN VAN
8ea56369dc Merge "Bump Tethering apex version code for S" am: 8b3213f38e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1768350

Change-Id: I04242193776c2a35a6bfc91a4c966a52a30aaceb
2021-07-20 14:56:34 +00:00
Remi NGUYEN VAN
4d535a4e51 Bump Tethering apex version code for R
The version code in the manifest is only used for development
builds, as release builds dynamically replace it.

Tethering should have been using 309999900 during S development. That
version was used in many downstream branches, so make it consistent so
it can be bumped for S in all branches.

Bug: 193853555
Change-Id: Ia0e4edaa4fce24e9600fa1d47445b5109d8ee51e
Test: m com.google.android.tethering, check version code
Merged-In: Ia3d5f2201ce67308df8e2689f6c99e28049a4877
Merged-In: I0d4bd06e79adedbf582d2fed551d9f1bde521fd1
Merged-In: Ie3a058b904cb2e3704c3a0725c8f720f81bb235e
2021-07-20 13:18:12 +00:00
Treehugger Robot
1004c23b35 Merge changes I6e6b40b0,I6a0d93e0,Ie26f6e52
* changes:
  Revert "[CTT-5] Stop update TCP conntrack entry timeout"
  Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules"
  Revert "[CTT-7] Delete the rules while half-closing tcp state entered"
2021-07-20 10:49:18 +00:00
markchien
083606292b Replace throwErrnoException with JNIHelp jniThrowException
Rather than adding throwErrnoException local function, using standard
jniThrowException in JNIHelp.h.

Also improve the readability:
1. Use throwIOException for
    jniThrowExceptionFmt(env, "java/io/IOException", ...);
2. Use throwSoecktException for
    jniThrowExceptionFmt(env, "java/net/SocketException", ...);
then the code can fit to one line.

Test: atest TetheringPrivilegedTests (ErrnoException is
test in BpfMapTest)
Change-Id: I396771e2c68e319f510d7a4ea5f263d18d7fad9d
2021-07-20 10:15:01 +00:00
paulhu
971c5fc0f8 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
Change-Id: I992c3240f0e133f5b00468cbe85d1545bcf786b0
2021-07-20 17:44:26 +08:00
Remi NGUYEN VAN
35448220a6 [automerger skipped] Merge "Bump Tethering apex version code for R" am: 5bd49caf78 -s ours
am skip reason: Merged-In Ia3d5f2201ce67308df8e2689f6c99e28049a4877 with SHA-1 997838cf13 is already in history

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

Change-Id: Ic87443891c06402e68c6999af7c606f271f63107
2021-07-20 09:12:50 +00:00
Remi NGUYEN VAN
8b3213f38e Merge "Bump Tethering apex version code for S" 2021-07-20 09:00:45 +00:00
Remi NGUYEN VAN
5bd49caf78 Merge "Bump Tethering apex version code for R" 2021-07-20 09:00:37 +00:00
Nucca Chen
199e86dcb3 Revert "[CTT-5] Stop update TCP conntrack entry timeout"
This reverts commit a5c742be69.

Reason for revert:
Stop releasing this commit because it needs more test coverage.

Bug: 190783768
Bug: 192804833
Change-Id: I6e6b40b0f6207ed197d01bfabb616f1afa31fb70
Test: atest TetheringCoverageTests
2021-07-20 08:52:38 +00:00
Nucca Chen
254ba6b235 Revert "[CTT-6] Update TCP conntrack entry timeout while adding rules"
This reverts commit 299a81157c.

Reason for revert:
Stop releasing this commit because it needs more test coverage.

Bug: 190783768
Bug: 192804833
Change-Id: I6a0d93e04814ae73e1ec7d6fd4df19e1d2787207
Test: atest TetheringCoverageTests
2021-07-20 08:50:49 +00:00
Nucca Chen
7abf514272 Revert "[CTT-7] Delete the rules while half-closing tcp state entered"
This reverts commit 118b5b578a.

Reason for revert: 
Stop releasing this commit because it needs more test coverage.

Bug: 190783768
Bug: 192804833
Change-Id: Ie26f6e528999da42cfa66a5f6c1f187ad2276ae1
Test: atest TetheringCoverageTests
2021-07-20 08:47:13 +00:00
Treehugger Robot
3f6e40dbd7 Merge "Correct log" am: 913dba8be3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772285

Change-Id: Iaa5c67c3c56ee39fee590ff8c2bed5e8731ea38d
2021-07-20 08:32:38 +00:00
Treehugger Robot
913dba8be3 Merge "Correct log" 2021-07-20 08:20:37 +00:00
Chiachang Wang
525b07d28a Correct log
Log should print the taken parameter instead of the value of
current variable

Test: m
Bug: 192149168
Change-Id: Ia3b9e607fe8b661a7faea3b46b9697fa85016440
2021-07-20 13:16:57 +08:00
Chiachang Wang
12a042be77 Merge "Specify which callback is unexpected in tests" am: 5251171b75
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769289

Change-Id: I05d42c13e430d9f76fe75e2e73ce4e41cb662820
2021-07-20 01:36:27 +00:00
Chiachang Wang
250cf2af8a Merge "Deflake test to ensure system default network as expected" am: 575fa2f103
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764308

Change-Id: I7deef58610d456bdcf0f1c1a93b861bf45653164
2021-07-20 01:36:22 +00:00
Chiachang Wang
5251171b75 Merge "Specify which callback is unexpected in tests" 2021-07-20 01:20:16 +00:00
Chiachang Wang
575fa2f103 Merge "Deflake test to ensure system default network as expected" 2021-07-20 01:20:07 +00:00
Treehugger Robot
28a6b24430 Merge "Temporarily change uid to appId" am: 1e4d4001f4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1770606

Change-Id: I2fb613b4f846605e4643c5b21dd7d5cfac2a3cc3
2021-07-19 14:03:12 +00:00
Treehugger Robot
1e4d4001f4 Merge "Temporarily change uid to appId" 2021-07-19 13:47:18 +00:00
Treehugger Robot
ec050a37ab Merge "Fix a flake with mocking." am: 527f040944
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762391

Change-Id: Ie8f389c1df00c68514dad1ac620b32ed34c2e22a
2021-07-19 12:36:34 +00:00
Treehugger Robot
527f040944 Merge "Fix a flake with mocking." 2021-07-19 12:16:18 +00:00
paulhu
0433dd20b7 Temporarily change uid to appId
Due to b/192431153, PermissionMonitor only apply permission to
app id which is listed in settings. Thus, temporarily change uid
to appId.

Bug: 192116643
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestricted\
      Networks with system & secondary user.
Change-Id: Iadec66344d88bd80170cd5441270b768cdbe0917
2021-07-19 18:51:03 +08:00
Chiachang Wang
6c80c3806d Specify which callback is unexpected in tests
Tests may be flaky due to the usage for assertNoCallback().
The method expects no any callback received. Based on the usage,
tests expect to not to receive certain callback, such as
onAvailable(). The network may update its linkproperties during
the test and trigger onLinkPropertiesChanged(). These callbacks
are ignorable in the tests. They should not fail the tests.

Replace the assertNoCallback to new assertNoCallbackThat with
callback type specified to deflake tests.

Bug: 192239030
Test: atest android.net.cts.ConnectivityManagerTest\
      --iterations 20
Change-Id: I1643c1ff15215c07e174dbcb664cfac2a38d5840
2021-07-19 18:41:53 +08:00
Chiachang Wang
ac059de6ad Deflake test to ensure system default network as expected
CtsNetUtils.toggleWifi() expects to receive a CONNECTIVITY_ACTION
broadcast after disconnecting from wifi if wifi is enabled.
The wifi may be connected but not validated since wifi just
turns back to connected from the previous test. In this case,
the system default netwok will not be wifi, so there is no
CONNECTIVITY_ACTION broadcast after disconnecting wifi. It
should ensure the wifi is system default network first before
proceeding with other verifications.

Bug: 192213759
Test: atest CtsNetTestCases --iterations 20
Change-Id: I82f0634883362e35b88854aae28e61b75a3cd7cc
2021-07-19 18:38:31 +08:00
Remi NGUYEN VAN
ab157b3c5b Merge changes from topic "sdk_int_cp" am: 800eff01d0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686027

Change-Id: I683d14bcaac2c85e2551b729d2d97d036cdc824f
2021-07-19 10:08:42 +00:00
paulhu
a73afb9790 Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity am: bee1c6d9cd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686026

Change-Id: I6dd95839749f877a272070387130aada5a157062
2021-07-19 10:08:41 +00:00
Remi NGUYEN VAN
f38d076a83 Merge "Wait for next network in waitForAvailable" am: e9f65535e0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760698

Change-Id: I3390ce0ad504e7367840ef13b9311e889a9798b1
2021-07-19 10:06:02 +00:00
Remi NGUYEN VAN
800eff01d0 Merge changes from topic "sdk_int_cp"
* changes:
  Fix testSocketKeepaliveLimitTelephony on R
  Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity
2021-07-19 09:47:21 +00:00
Remi NGUYEN VAN
e9f65535e0 Merge "Wait for next network in waitForAvailable" 2021-07-19 09:47:12 +00:00
Remi NGUYEN VAN
4bcefe111a Merge "Skip BatteryStatsManagerTest on Q" am: e2067816e9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764310

Change-Id: Iac778fc5dfe0b5ec0adf400372b3e43c5cc76d5d
2021-07-19 09:25:12 +00:00
Remi NGUYEN VAN
e2067816e9 Merge "Skip BatteryStatsManagerTest on Q" 2021-07-19 09:11:54 +00:00
Remi NGUYEN VAN
1d6e7d5117 Bump Tethering apex version code for S
The version code in the manifest is only used for development
builds, as release builds dynamically replace it.

319999900 is appropriate as it indicates that the module is compatible
with S and earlier, and allows installing development versions on any
S build, which use 31xxxxxxx versions. It will also still allow installing
production T modules (32xxxxxxx) on a development S build. This is
convenient for local testing.

The same convention is also used for other modules including
NetworkStack.

Bug: 193853555
Test: m com.google.android.tethering, check version code

Change-Id: Ib8905a641780bed490a38327facee4a76e7770a3
2021-07-19 18:09:20 +09:00
Remi NGUYEN VAN
13b8b17b11 Bump Tethering apex version code for R
The version code in the manifest is only used for development
builds, as release builds dynamically replace it.

Tethering should have been using 309999900 during S development. That
version was used in many downstream branches, so make it consistent so
it can be bumped for S in all branches.

Bug: 193853555
Test: m com.google.android.tethering, check version code
Merged-In: Ia3d5f2201ce67308df8e2689f6c99e28049a4877
Merged-In: I0d4bd06e79adedbf582d2fed551d9f1bde521fd1
Merged-In: Ie3a058b904cb2e3704c3a0725c8f720f81bb235e
Change-Id: I644f0d801efb491be45c3dc29fa1058476282772
2021-07-19 18:07:23 +09:00
Treehugger Robot
866b9c4480 Merge "No-op cleanup" am: 21592b0d93
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769285

Change-Id: I4ea2b3bd3ab5f8c58aca5ca602e22a67f6f8e0d1
2021-07-16 16:25:17 +00:00
Treehugger Robot
21592b0d93 Merge "No-op cleanup" 2021-07-16 16:08:05 +00:00
Remi NGUYEN VAN
4d5342d396 Merge "Add ConnectivityCoverageTests to presubmit" am: 0909afc08a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1768348

Change-Id: Ia83ac341917eee98078d6328f66d90b5a42fa028
2021-07-16 06:31:02 +00:00
Remi NGUYEN VAN
dfc744c81e Merge "Move ConnectivityCoverageTests to mainline-presubmit" am: 7d4ab94bc6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1754249

Change-Id: I2858a01588c723da64efba2e110097d58b868e86
2021-07-16 06:30:51 +00:00
Remi NGUYEN VAN
0909afc08a Merge "Add ConnectivityCoverageTests to presubmit" 2021-07-16 06:20:00 +00:00