Commit Graph

37050 Commits

Author SHA1 Message Date
Aaron Huang
f831779307 Merge "Add INTERACT_ACROSS_USERS_FULL to test for setCurrentProxyScriptUrl" am: d8944c9e7b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1755050

Change-Id: I1ff8c3618c33c83c3a2459443cbe4809eeac3808
2021-07-29 11:40:38 +00:00
Aaron Huang
d8944c9e7b Merge "Add INTERACT_ACROSS_USERS_FULL to test for setCurrentProxyScriptUrl" 2021-07-29 11:24:54 +00:00
Remi NGUYEN VAN
53b6370ec6 Remove hidden ArrayUtils usage in TetheringTest am: 3dfafbb516
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1779756

Change-Id: Ibf6c0bc564482191e5932a71c1f36248c8053593
2021-07-29 07:16:54 +00:00
Remi NGUYEN VAN
3dfafbb516 Remove hidden ArrayUtils usage in TetheringTest
Use CollectionUtils instead, which avoids using a hidden API.

Avoiding hidden API usage in tests is good in general, but this also
helps avoid jarjar problems where the com.android.internal.util package
is jarjared to some other package as some of its classes are included
in the module, and ArrayUtils cannot be found in the renamed package.

Bug: 192535368
Test: atest TetheringTest
Change-Id: I54dc8f6429d132a953ab1a674fe349fba4335936
2021-07-28 17:00:20 +09:00
Aaron Huang
ac8c47eef6 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
Change-Id: I2ddff09b4c9cda1e7c5f3566662ba9cc07fffaae
2021-07-28 13:51:44 +08:00
Chiachang Wang
8a47dfb768 Merge "Retry and ignore ConcurrentModificationException" am: 93bda73970
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772444

Change-Id: Iffac4efceaac6b8d27b794c638ecb3358aeeff0a
2021-07-27 09:18:12 +00:00
Chiachang Wang
93bda73970 Merge "Retry and ignore ConcurrentModificationException" 2021-07-27 09:02:56 +00:00
Chiachang Wang
eb25674b5c Retry and ignore ConcurrentModificationException
The flaky callstack shows that it hits the exception in the
initialization of HashSet. The mNetworkRequests is accessed in
the ConnectivityService handler thread except dump(). The
ConcurrentModificationException should not happen in the other
flow. Thus, retry to get the current requests when the dump()
hits the ConcurrentModificationException to prevent flaky test.

Bug: 188373832
Test: atest ConnectivityServiceTest#testDumpDoesNotCrash\
      --iteration 100
Change-Id: I9625919faf947c9488764b92093ed8105271c927
2021-07-27 15:13:52 +08:00
Chalard Jean
d79bd5c622 Merge "Fix a possible system server crash" am: 51176d0a67
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1771187

Change-Id: Iddab205cf2754d326be816e6e8e92c2cc0b95771
2021-07-27 04:54:52 +00:00
Chalard Jean
51176d0a67 Merge "Fix a possible system server crash" 2021-07-27 04:37:43 +00:00
Chalard Jean
5bcc838f4e 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
Change-Id: I82a28c37450146838410bf5a059aac295a985fca
2021-07-27 04:37:29 +00:00
Chalard Jean
dcd4438dfa Merge "Remove a useless comment" am: c486f0248b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1777769

Change-Id: Ie0e10e4d2f9500271cd83ef8498c5d13d8d338b0
2021-07-27 03:12:56 +00:00
Chalard Jean
c486f0248b Merge "Remove a useless comment" 2021-07-27 02:59:41 +00:00
Chalard Jean
f126170e98 Remove a useless comment
b/145383354 is obsolete and this works as is (or we'd have found
out by now). Also min SDK version is set in the bp file and
would be overridden anyway.

Test: comment-only change
Change-Id: I6ad3263557ef67aa642672863eed82a312c2ab40
2021-07-27 02:59:11 +00:00
Chiachang Wang
ad07afc824 Merge "Remove DISCONNECTING check from handleReportNetworkConnectivity" am: 9ad8acd76e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772439

Change-Id: I66569d993972c82400eb5583f182bedea9d75a54
2021-07-26 11:11:30 +00:00
Chiachang Wang
9ad8acd76e Merge "Remove DISCONNECTING check from handleReportNetworkConnectivity" 2021-07-26 10:58:58 +00:00
Paul Hu
1e594fa4db Merge "Address aosp/1740740 leftover comments" am: 1975a57e83
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1775928

Change-Id: I8a901187e66a5f6dade6dfe36951949dcf80d458
2021-07-26 10:09:26 +00:00
Paul Hu
1975a57e83 Merge "Address aosp/1740740 leftover comments" 2021-07-26 09:49:27 +00:00
Treehugger Robot
6971e4811f Merge "Add TetheringPrivilegedTests to postsubmit" am: 94ef708b7d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1771186

Change-Id: I7c3e01900da2ef73aed6d2cccb15d2ea9e789cb1
2021-07-26 08:59:37 +00:00
Treehugger Robot
94ef708b7d Merge "Add TetheringPrivilegedTests to postsubmit" 2021-07-26 08:50:07 +00:00
Paul Hu
02c83293d6 Merge "Rename PREFERENCE_PRIORITY_* to PREFERENCE_ORDER_*" am: 0e3b1e0b57
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764732

Change-Id: Ie77a33aedbb7e68c89c5aaf15fe6f4cce344f283
2021-07-26 08:24:20 +00:00
Paul Hu
0e3b1e0b57 Merge "Rename PREFERENCE_PRIORITY_* to PREFERENCE_ORDER_*" 2021-07-26 08:12:42 +00:00
markchien
911cf8fecd Add TetheringPrivilegedTests to postsubmit
Also ignore DadProxyTest before S because it is only enabled from S.

To using ignore test rule, replace AndroidJunit with DevSdkIgnoreRunner.
It is fine because the we don't use the test UI (e.g. running test in UI
thread).

Test: atest TetheringPrivilegedTests
Change-Id: I701ee877520f78ded2394adbae1f4d9dd612d700
2021-07-26 02:17:19 +00:00
paulhu
fa2f7171af Address aosp/1740740 leftover comments
- Use SystemClock.sleep instead.
- Shorten the waiting time.

Bug: 185149952
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
Change-Id: I82221a61bdddf6dc8147b3a29c873ca6c8b05e93
2021-07-23 15:20:06 +08:00
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
Chiachang Wang
58644b1f70 Remove DISCONNECTING check from handleReportNetworkConnectivity
ConnectivityService doesn't use it, and the NetworkAgent API
never set it. This case does not happen in pratice, so remove
the check.

Bug: 192611346
Test: atest FrameworksNetTests
Change-Id: I1f114c9b65050527378ee73bc86e4cda8868bca9
2021-07-21 10:28:54 +08: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