Commit Graph

7395 Commits

Author SHA1 Message Date
xshu
7e625b9802 Followup to CL 1103896
Optimizes the logic that ensures the default randomized MAC is not
returned.

Bug: 137796328
Test: atest MacAddressTest
Change-Id: Ie95d7a020bfac8850b8a67e4d396de77db22e1db
2019-09-20 16:56:54 -07:00
Chalard Jean
17ac73b6e8 Fix TestNetworkAgentWrapper flakiness
The underlying issue here is that before aosp/986824 the call to
waitForIdle is the local ConnectivityServiceTest function, but
after that patch TestNetworkAgentWrapper has an identically
named member that only wait for its own handler.

Bug: 141341704
Test: ConnectivityServiceTest --generate-new-metrics 100
Change-Id: I38709cc69ec7a261c1c6e008abe03d2882e2083d
2019-09-20 17:19:31 +09:00
Lorenzo Colitti
a597972cea Properly test TrafficController permissions on package updates.
The current test we have for a package changing TrafficController
permissions (i.e., INTERNET or UPDATE_DEVICE_STATS permissions)
is not realistic.

This is because the test simulates the update by removing and
adding the package. But TrafficController permissions are not
driven by broadcasts, they are driven by PackageListObserver,
and when an app is updated, PackageListObserver does not see a
remove and and add, but a single change event.

Add a new test for this.

Bug: 137864893
Test: new unit test added
Change-Id: I691b928f57c79c19dfb6ddb01983d55ef305c472
2019-09-20 11:58:43 +09:00
TreeHugger Robot
f0f67dcb02 Merge "Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master" into stage-aosp-master 2019-09-11 20:31:32 +00:00
Steven Moreland
fe8de15641 Merge "Remove libhwbinder/libhidltransport deps"
am: 32f968b767

Change-Id: I196f0ec3f1c3bcafc50c21f34774b089025eb046
2019-09-10 16:45:26 -07:00
Xin Li
a4cb579186 Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master
Bug: 135460123
Change-Id: I65906d82b14125c0893d5cde0cfebb73bf9e38ab
Merged-In: I1f2564837c33cd4c6c3db6aac3cbaf8c09707da9
2019-09-10 11:16:29 -07:00
paulhu
a8cf76dfab Remove @FlakyTest on testTcpBufferReset
After aosp/1111617 merged, the test pass rate of
testTcpBufferReset is 100% on Android Test Metrics. That means
this test is not flaky. So remove @FlakyTest annotation on the
test.

Change-Id: I1fb47a9fda294030c41dc53cf4bac3849a2f3d54
Fix: 140305678
Test: atest ConnectivityServiceTest#testTcpBufferReset
2019-09-10 17:44:33 +08:00
Steven Moreland
1c53e37a25 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I136e4d4459bb8c3c5abf3c0758dd5ae14d0ad2a2
2019-09-09 16:28:55 +00:00
Xin Li
50b6d54d1c [automerger skipped] Merge "DO NOT MERGE - Merge Android 10 into master"
am: 6e7bf3337c -s ours
am skip reason: subject contains skip directive

Change-Id: I47d5e62a09155529525a892c1687519f054d43f9
2019-09-05 14:18:24 -07:00
Xin Li
1ab2ab08d6 [automerger skipped] DO NOT MERGE - Merge Android 10 into master
am: c050adec3f -s ours
am skip reason: subject contains skip directive

Change-Id: I2fad02a5d974eb5bef685a9c695eb52f52f8749a
2019-09-05 13:26:43 -07:00
Xin Li
6e7bf3337c Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:23 +00:00
Lucas Lin
e6d69c7644 Merge "Fix flaky test - testPartialConnectivity"
am: 44190d3d18

Change-Id: Ic643ec7a5641b531befc8a9c4af524177f97e761
2019-09-05 05:09:48 -07:00
Lucas Lin
44190d3d18 Merge "Fix flaky test - testPartialConnectivity" 2019-09-05 11:40:01 +00:00
lucaslin
a878f700d3 Fix flaky test - testPartialConnectivity
This timing issue is happened when test case already verified
NetworkMonitor#setAcceptPartialConnectivity() before
NetworkAgent send the CONNECTED state to ConnectivityService.
This test case expects that the
NetworkMonitor#setAcceptPartialConnectivity() will be invoked
when network state is CONNECTED in
ConnectivityService#updateNetworkInfo().

NetworkAgent communicates with ConnectivityService by
AsyncChannel. Before they connect to each other, the thread of
NetworkAgent is keeping idle, so waitForIdle cannot handle this
kind of case. Although they have connected to each other, but
they don't communicate with each other, waitForIdle() still
cannot handle this case. It means waitForIdle() can only handle
the case that NetworkAgent already connected to
ConnectivityService and NetworkAgent is communicating with
ConnectivityService. So, that's why waitForIdle() sometimes
doesn't work in this case, and the most simplest and right way
to fix this case is to wait the available callback then verify
the method.

Bug: 140306320
Test: atest FrameworksNetTests: \
      ConnectivityServiceTest#testPartialConnectivity \
      --generate-new-metrics 500

Change-Id: I64bfecbfe3c5776bd5c347a821f9127e79539c48
2019-09-05 11:39:20 +00:00
Remi NGUYEN VAN
02ed6c8978 Merge "Add NetIdManagerTest"
am: 4339cf3402

Change-Id: Ifbebb446601fcbbdf91fff48dc66ad173a6ecc7c
2019-09-04 23:54:58 -07:00
Remi NGUYEN VAN
6eb1da5b5d Merge "Add ConnectivityServiceIntegrationTest"
am: 324d724fd7

Change-Id: Ib82c5e5aee9e830a0efe8ea6335933237bb33856
2019-09-04 22:41:44 -07:00
Xin Li
c050adec3f DO NOT MERGE - Merge Android 10 into master
Bug: 139893257
Change-Id: I9e3c4fe5406c9913d50fe3b07d7f7cef7a246b96
2019-09-04 13:33:59 -07:00
Remi NGUYEN VAN
df6248fe83 Add NetIdManagerTest
Add a simple test to verify that IDs loop correctly, that they skip used
IDs correctly, and throw when there is no remaining ID.

Test: atest com.android.server.NetIdManagerTest
Change-Id: I4c9518c725156d743286e062fd2eec1423a0459e
2019-09-04 15:57:58 +09:00
Remi NGUYEN VAN
317b2d2065 Add ConnectivityServiceIntegrationTest
This test exercises the Connectivity <-> NetworkMonitor integration.
This CL only contains a simple test (network validates), but more
generally it sets up a test package that contains both services.jar
classes and NetworkStack classes, and runs NetworkStack components in
another process (using TestNetworkStackService).

ConnectivityServiceIntegrationTest runs in the test process and binds to
TestNetworkStackService to obtain TestNetworkStackConnector and to
NetworkStackInstrumentationService to obtain
NetworkStackInstrumentationConnector. That last connector allows the
test to mock NetworkMonitor HTTP Requests.

Test: atest FrameworksNetIntegrationTests
Change-Id: Ieca18e273609044cf6b1870d2f0dba33ca7b38d3
2019-09-04 15:57:47 +09:00
Guang Zhu
4154f65316 Merge "Mark 3 tests as flaky."
am: ff69dc29d2

Change-Id: Ie1c38e247ccfaa407d35cf6b6e28306d36cdccca
2019-09-02 12:03:12 -07:00
Treehugger Robot
ff69dc29d2 Merge "Mark 3 tests as flaky." 2019-09-02 18:44:24 +00:00
Guang Zhu
df1d1ebc2b Mark 3 tests as flaky.
Bug: 140306320
Bug: 140305589
Bug: 140305678
Test: apct/net/networking_framework_unit_test
Change-Id: I5a288d7d64b3e95e0025c2c1f4a64ffe85cc3cd6
2019-09-01 21:37:04 -07:00
Aurimas Liutikas
4afcf291e7 [automerger skipped] Merge "Add missing nullability annotations."
am: 61789bab0c -s ours
am skip reason: change_id I109260842cfc25f06e40694997fcbb4afa02c867 with SHA1 8fae993514 is in history

Change-Id: I7b2712e4ab3635f94f8257d88f24c20bc68a3ac0
2019-08-30 11:49:09 -07:00
Aurimas Liutikas
61789bab0c Merge "Add missing nullability annotations." 2019-08-30 18:30:39 +00:00
Paul Hu
522aa587b4 Merge "Fix flaky testTcpBufferReset"
am: 09b6f14675

Change-Id: Ia344cb1a8c0be07a62eac98117911b6cdb329525
2019-08-30 09:19:42 -07:00
Paul Hu
09b6f14675 Merge "Fix flaky testTcpBufferReset" 2019-08-30 16:01:45 +00:00
junyulai
bfa8b89ed1 Merge "Fix LockdownVpnTracker deadlock when resetting legacy Always-On VPN"
am: c07aed0fd4

Change-Id: If5b3f6f1d397d3ac35b509a2e634a60933f2df6c
2019-08-30 08:30:10 -07:00
Aurimas Liutikas
9fe20bf048 Merge "Add missing nullability annotations." into stage-aosp-master 2019-08-30 15:19:45 +00:00
paulhu
22e2195a8a Fix flaky testTcpBufferReset
If EVENT_NETWORK_INFO_CHANGED was handled after waitForIdle()
method done, this test will be failed due to
INetd#setTcpRWmemorySize() was not executed yet. Instead of
waiting for idle state, it's better to use NetworkCallback to
ensure events completely on ConnectivityService.

Bug: 140206578
Test: atest ConnectivityServiceTest#testTcpBufferReset\
      --generate-new-metrics 500

Change-Id: Iad77415db38038603881d9ebe0e37586b549a45c
2019-08-30 20:21:03 +08:00
junyulai
0c27ddf71b Fix LockdownVpnTracker deadlock when resetting legacy Always-On VPN
When resetting legacy Always-On VPN, the intent is handled by
main thread. And it will also initialize VPN shutdown process,
which will cause networkInfo changed event on
ConnectivityService internal thread. These two events need to
hold their corresponding lock and ask for the other one, which
causes the deadlock.

This patch move the event handling to the same thread to prevent
such deadlock, and cleanup some unused variables.

Change-Id: I5b656c0d0381acb4e33409a11f502db9b180296c
Fix: 139122208
Test: atest FrameworksNetTests, manual test
2019-08-30 19:56:59 +08:00
Remi NGUYEN VAN
904ee8f635 Merge "Run callbacks on ConnectivityService thread"
am: 08e1dae42f

Change-Id: I7a8d035ec7453c5351eb2646c631c19964cb0f88
2019-08-30 03:36:26 -07:00
Treehugger Robot
08e1dae42f Merge "Run callbacks on ConnectivityService thread" 2019-08-30 10:18:28 +00:00
Aurimas Liutikas
07be422126 Add missing nullability annotations.
To prepare for enabling MissingNullability Metalava check this CL
works on adding missing nullability issues that metalava flags if
we tell it to flag new things since API 29.

This is not a complete CL, mostly addresses public api and
toString/equals for @SystemApi

Exempt-From-Owner-Approval: Large scale nullability clean up
Bug: 124515653
Test: make -j checkapi
Merged-In: I109260842cfc25f06e40694997fcbb4afa02c867
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-30 00:16:24 +00:00
Aurimas Liutikas
8fae993514 Add missing nullability annotations.
To prepare for enabling MissingNullability Metalava check this CL
works on adding missing nullability issues that metalava flags if
we tell it to flag new things since API 29.

This is not a complete CL, mostly addresses public api and
toString/equals for @SystemApi

Exempt-From-Owner-Approval: Large scale nullability clean up
Bug: 124515653
Test: make -j checkapi
Merged-In: I109260842cfc25f06e40694997fcbb4afa02c867
Change-Id: I109260842cfc25f06e40694997fcbb4afa02c867
2019-08-30 00:14:44 +00:00
Remi NGUYEN VAN
96521fb87d Run callbacks on ConnectivityService thread
Run MultinetworkPolicyTracker and DataConnectionStats callbacks on the
ConnectivityService handler thread.

Previously the callbacks would be using the SystemServer foreground
thread (Looper.myLooper()), or the broadcast thread for the
MultinetworkPolicyTracker BroadcastReceiver. This is error-prone, can
cause threading issues and makes it difficult to test the components.

Test: atest FrameworksNetTests
Change-Id: I189213dd363004abed294659165bf5430d153bba
2019-08-28 10:10:04 +09:00
Lorenzo Colitti
c3a98bbd65 Merge changes I69cdbb16,I6975e0b7
am: d889cb5098

Change-Id: I3c8ddf7809a0d443587c1c4c06ef56ac302fc80f
2019-08-27 03:31:02 -07:00
wangmingming1
478ba7a6d9 notify netd about uid internet permission changes when package replaced
1. If a previous version of an app doesn't declare internet permission;
2. The User upgraded it to a new version and the new one does declare the
internet permission;
3. The new app are not allowed to access the internet until next boot

Bug: 137864893
Test: Manual, just make sure the onPackageChanged would be executed on package changes
Change-Id: I69cdbb16a027a9c4e974b32371b1f64a23a51a23
Signed-off-by: wangmingming1 <wangmingming1@xiaomi.com>
2019-08-26 09:30:59 +09:00
Oscar Shu
6fcb2696cd Merge "avoid generating reserved local MACs"
am: 464e1b5e6f

Change-Id: Ia6d0eb0c5e8101d9c4b4bc63de79157f7d1c2284
2019-08-23 02:24:15 -07:00
Oscar Shu
464e1b5e6f Merge "avoid generating reserved local MACs" 2019-08-21 17:45:00 +00:00
Chiachang Wang
5048e4a80d [automerger skipped] Merge "Get resource based on subId for multi-SIM" into qt-r1-dev
am: 559e7a3de1 -s ours
am skip reason: change_id Ib5b085d97103889600773d269e03b939c29ca47d with SHA1 5fed8d9ee3 is in history

Change-Id: I405bb51787bce13441aa4c3b985ef2b92df18826
2019-08-17 07:17:49 -07:00
xshu
8438a85683 avoid generating reserved local MACs
Avoid generating WifiInfo.DEFAULT_MAC_ADDRESS as a randomized MAC
address since it's being used for another purpose.

Bug: 137796328
Test: atest MacAddressTest
Change-Id: Ia7beef0d0af5d7b39845e662cd343d81aef97702
2019-08-16 10:20:22 -07:00
Chiachang Wang
0dc044aac7 Get resource based on subId for multi-SIM
The resource loading is done based on the last SIM to come up
which is not a deterministic design. Thus, update the way to get
the resource based on the subId.

Test: atest FrameworksNetTests
Test: manually test with avoid bad wifi feature supported sim
Bug: 138956509
Change-Id: Ib5b085d97103889600773d269e03b939c29ca47d
Merged-In: Ib5b085d97103889600773d269e03b939c29ca47d
(cherry picked from commit 5e994ea02c7a820543f3726186240548676f4b4e)
2019-08-14 12:15:56 +00:00
Chiachang Wang
115b77593c Merge "Get resource based on subId for multi-SIM" am: 55752cf8d4 am: 85ff8a6902
am: 2b7f2fbb5b

Change-Id: I1e69a49c88f6123f735075934f2f2e08f15f2bff
2019-08-14 04:54:59 -07:00
Chiachang Wang
85ff8a6902 Merge "Get resource based on subId for multi-SIM"
am: 55752cf8d4

Change-Id: I020c2546fa4432d05cf27b20fdb1943508aac671
2019-08-14 04:30:57 -07:00
Chiachang Wang
5fed8d9ee3 Get resource based on subId for multi-SIM
The resource loading is done based on the last SIM to come up
which is not a deterministic design. Thus, update the way to get
the resource based on the subId.

Test: atest FrameworksNetTests
Test: manually test with avoid bad wifi feature supported sim
Bug: 138956509
Change-Id: Ib5b085d97103889600773d269e03b939c29ca47d
2019-08-14 13:56:37 +08:00
Remi NGUYEN VAN
b0cbc5d051 Merge "Extract test utilities for ConnectivityService" am: ecaff61c4b am: 9e23af5f90
am: 6d34ffb4e6

Change-Id: Ib760ef922a440d54bab8c1647d8444ab2a717094
2019-08-06 15:57:04 -07:00
Remi NGUYEN VAN
9e23af5f90 Merge "Extract test utilities for ConnectivityService"
am: ecaff61c4b

Change-Id: I0ac2a480f961bb6fd1d83dedad6a7942ee03858f
2019-08-06 14:58:43 -07:00
Treehugger Robot
ecaff61c4b Merge "Extract test utilities for ConnectivityService" 2019-08-06 11:04:36 +00:00
Chalard Jean
e9a705c65d Merge "Fix null pointer exception of calling NetworkInfo.mState.name()" am: 95d62d8e55 am: a61bb686ae
am: c560826d4d

Change-Id: Iec9e7aff73662369b5e922626494d42c025a2cb6
2019-08-02 13:57:10 -07:00
Chalard Jean
a61bb686ae Merge "Fix null pointer exception of calling NetworkInfo.mState.name()"
am: 95d62d8e55

Change-Id: Ic003b658854f9407ed8024771c6219df2b6e3806
2019-08-02 13:25:36 -07:00