2046 Commits

Author SHA1 Message Date
Hugo Benichi
7157c8e7af BitUtils: support packing/unpacking negative long values
Bug: None
Test: Compiled. New unit tests.
Change-Id: Ia543285e206b0bbc7d64458da10e68a951f9eec1
2019-11-27 11:00:32 +09:00
Chalard Jean
4b4f463d3c Merge "Decrease load-related flakiness in ConnectivityServiceTest" 2019-10-02 02:38:30 +00:00
Jeffrey Vander Stoep
152ced4b87 Merge "InetDiagSocketTest: ignore test that times out" 2019-10-01 10:44:24 +00:00
Jeff Vander Stoep
69b83c9b3c InetDiagSocketTest: ignore test that times out
Test: atest InetDiagSocketTest
Change-Id: Ieef0ca291924c0d81b1110bd25020d57fa9f0fec
Bug: 141870193
2019-10-01 08:21:41 +00:00
Jeffrey Vander Stoep
20bdc26698 Merge "Fix FD leak in ConnectivityManager.getConnectionOwnerUid" 2019-09-30 17:41:30 +00:00
Jeff Vander Stoep
59940afb16 Fix FD leak in ConnectivityManager.getConnectionOwnerUid
Add unit tests to verify that bug has been fixed.

Re-enable testGetConnectionOwnerUid() unit tests in presubmit. These
were disabled due to test flakiness caused by expected failures passing
as a result of other sockets on the system. This is fixed by checking
that failures do not have the UID of the calling process instead of
INVALID_UID since previously some Qualcomm telephony sockets were
causing lookup successes.

Test: atest InetDiagSocketTest#testGetConnectionOwnerUid
Test: ls -1 /proc/<pid of system_server>/fd | wca
Test: atest --generate-new-metrics 200 InetDiagSocketTest#testGetConnectionOwnerUid
   To verify flakes have been cleaned up.
Bug: 141603906
Bug: 141459241
Change-Id: Ib76674f10e4bd24952c557bac7b9c65fba42fdb2
2019-09-30 12:46:03 +02:00
Chalard Jean
b299b8418f Decrease load-related flakiness in ConnectivityServiceTest
Almost always this timeout is not waited anyway.

Test: ConnectivityServiceTest
Change-Id: I74376633d0ec8d93fb48609a4df73cad5fc5d508
2019-09-27 21:44:54 +09:00
Treehugger Robot
0e45bfabfe Merge "Properly test TrafficController permissions on package updates." 2019-09-27 05:35:25 +00:00
Chalard Jean
3da8e0f80f 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
fc901157dc 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
Steven Moreland
0daed48a88 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
d191463bb0 Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:23 +00:00
Lucas Lin
3f275ca900 Merge "Fix flaky test - testPartialConnectivity" 2019-09-05 11:40:01 +00:00
lucaslin
fe39f0a777 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
f8a4272491 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
bb59253d6d 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
49e64d2333 Merge "Mark 3 tests as flaky."
am: 1566e18657

Change-Id: Ie1c38e247ccfaa407d35cf6b6e28306d36cdccca
2019-09-02 12:03:12 -07:00
Treehugger Robot
1566e18657 Merge "Mark 3 tests as flaky." 2019-09-02 18:44:24 +00:00
Guang Zhu
b90866d4b2 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
Paul Hu
07dfc766d8 Merge "Fix flaky testTcpBufferReset"
am: f2c7d5c49d

Change-Id: Ia344cb1a8c0be07a62eac98117911b6cdb329525
2019-08-30 09:19:42 -07:00
paulhu
66269b3714 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
Jianpeng Li
8e27bc49d4 Merge "Update wifi interface ip state upon receiving ap disable event"
am: 25d4c75c26

Change-Id: Ia58a409f63c59ece7817f9412695595708a95c77
2019-08-15 22:48:54 -07:00
Treehugger Robot
25d4c75c26 Merge "Update wifi interface ip state upon receiving ap disable event" 2019-08-16 05:15:12 +00:00
Jianpeng Li
a70feeca7a Update wifi interface ip state upon receiving ap disable event
When turning on/off SoftAp with high frequency, sometime calling
WifiManager#updateInterfaceIpState with IFACE_IP_MODE_TETHERED
is performed after handling WIFI_AP_STATE_DISABLED event in
WifiServiceImpl while SoftAp is being terminated. This leads to
the issue that SoftAp is unable to start as startSoftAp always
returns "false". This is because mIfaceIpModes in WifiServiceImpl
keeps the mode WifiManager.IFACE_IP_MODE_TETHERED and the CL below
rejects SoftAp start request.

e257c5c9e79e3675375ca20731cfb74df02b1064 @ frameworks/opt/net/wifi
(WifiServiceImpl: Reject startSoftAp when already tethering)

This CL updates the interface ip state upon receiving ap disable
event from Tethering class to set proper state to mIfaceIpModes.

Bug: 134806980
Test: Ran script to turn on/off soft ap frequently
Signed-off-by: Daichi Ueura <daichi.ueura@sony.com>
Change-Id: I2f89214414d93f1aa942fb8a21264a9baae3452a
2019-08-16 04:16:26 +09:00
Mark Chien
538bc0fe4f Merge "Don't allow upstream if entitlement don't know any downstream"
am: 161814ffb1

Change-Id: Ibac99a20b470b48597859fe737732f3c6f491805
2019-08-13 02:49:09 -07:00
Mark Chien
161814ffb1 Merge "Don't allow upstream if entitlement don't know any downstream" 2019-08-13 09:36:16 +00:00
markchien
426311bcb5 Don't allow upstream if entitlement don't know any downstream
In case tethering donwstream is setup but don't ask EntitlementManager
to run provisioning. Cellular upstream should not be allowed if
EntilementManager don't have any donwstream record.

Bug: 134649258
Test: -build, flash, boot
      -manual test with carrier SIM
Change-Id: I609722c79f0a45a1c2164d39721ef5883e436feb
2019-08-13 02:28:41 +00:00
Remi NGUYEN VAN
62857556a4 Merge "Extract test utilities for ConnectivityService"
am: b7d270a73e

Change-Id: I0ac2a480f961bb6fd1d83dedad6a7942ee03858f
2019-08-06 14:58:43 -07:00
Remi NGUYEN VAN
95dc87ebce Extract test utilities for ConnectivityService
The utilities help using ConnectivityService in tests, and will be used
to write integration tests for ConnectivityService.

Test: atest FrameworksNetTests
Change-Id: Ie895ad05139cd5768d3d8a9bd5589d72571f47e6
2019-08-01 16:32:30 +09:00
Fedor Kudasov
8125047183 Merge changes from topic "fix_master_build"
am: 2e5319117a

Change-Id: If49999e7ce6149e847a678b03ccf8b4549f8365b
2019-07-09 06:10:01 -07:00
Fedor Kudasov
e5cb0a2216 Revert "Remove providesRoutesToMostDestinations."
This reverts commit d85b09a06fd93d5d66db5d09cc0fd24becdd9d60.

Reason for revert: multiple build breakages b/137069068

Change-Id: I60a4f71e13fe82f970b177a07c0b58439cbc64ff
2019-07-09 09:23:25 +00:00
Chalard Jean
cbaed4e7ba Merge changes Ia43f8811,I7de4f672
am: 3ef04b8e3c

Change-Id: Ifcacd81d343a29b17fdb79f4c8b54c89a293a2b8
2019-07-09 00:56:57 -07:00
Chalard Jean
81d9d197a3 Merge "Refactor TestNetworkCallback out of ConnectivityServiceTest."
am: b268cb5c6e

Change-Id: I44b66d1d606c5bb454ae49de234cfa0dbbb2bed2
2019-07-08 14:00:56 -07:00
Mark Chien
4e7c3ad945 Merge "Fix entitlement failed when device is on CBRS"
am: 073c203dae

Change-Id: I682ec8f7b8f91be5e6735e141f4da06a18a11fe1
2019-07-08 13:57:53 -07:00
Chalard Jean
d85b09a06f Remove providesRoutesToMostDestinations.
This function is not used any more.

Test: FrameworksNetTests
Change-Id: Ia43f8811cb9d575e16735b0f4b76d91e7cd42ebc
2019-07-08 20:36:33 +09:00
Chalard Jean
b268cb5c6e Merge "Refactor TestNetworkCallback out of ConnectivityServiceTest." 2019-07-05 13:09:07 +00:00
Mark Chien
073c203dae Merge "Fix entitlement failed when device is on CBRS" 2019-07-05 06:17:52 +00:00
markchien
04bdf8738b Fix entitlement failed when device is on CBRS
Tethering may use wrong sub id for entitlement when data
subscription is changed from preferred data sub id to CBRS
sub id. Fix by using the active data sub id for tethering.

Bug: 134994718
Test: -build, flash, boot
      -FrameworkNetTests
      -manual test with carrier SIMs

Change-Id: Icb3f5eeb2319e50b2dc98369ad152988c934da57
Merged-In: Icb3f5eeb2319e50b2dc98369ad152988c934da57
2019-07-04 16:23:32 +08:00
Chalard Jean
6f4216f4be Refactor TestNetworkCallback out of ConnectivityServiceTest.
TestableNetworkCallback will become a standard tool. This patch
and its companion in packages/modules/NetworkStack mostly move
it out of ConnectivityServiceTest, but also applies a few
cleanups like reordering arguments for standard order, renaming
...Like to ...That to match Mockito namings, and introduces
stonger static typing on some callbacks, which allows to remove
some unchecked casts.

Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I808a95ac33ec0c81a8829cad36a6917524297574
2019-07-04 16:12:40 +09:00
Paul Hu
4e3ec1f018 Merge "Correct FrameworksNetTests-jni-defaults lib"
am: fa71b4f4a0

Change-Id: I53ca8c198b9d4bb0e743ee5010469a7375dc3cc4
2019-07-02 10:23:03 -07:00
paulhu
dc09e6e635 Correct FrameworksNetTests-jni-defaults lib
FrameworksNetTests-jni-defaults lib should only contain jni
dependencies. Remove static_libs/libs from it and update
FrameworksNetTests/FrameworksNetSmokeTests libs as well.

Bug: NA
Test: atest FrameworksNetSmokeTests FrameworksNetTests
Change-Id: I705e949e4c00035c9734b6a240529d1c2216eb6b
2019-07-01 09:29:13 +00:00
Lorenzo Colitti
736194dfbf Merge "Unit tests for new explicitlySelected behaviour." am: d1379a4a80
am: 10c1a704c0

Change-Id: Id77a5d6a58e7ab4fdaa0b7c15b824270863b83fd
2019-06-29 02:01:55 -07:00
Chalard Jean
ba3ba4b915 Merge "Simplify Exception expressions in CSTest" am: febb37f376
am: cb5aa75dd9

Change-Id: Iae16e8d68e2b1b9a1e5aa86170177c68b22cd7b5
2019-06-28 08:57:18 -07:00
Lorenzo Colitti
b5ad613839 Unit tests for new explicitlySelected behaviour.
ag/7905088 added the ability to pass in acceptUnvalidated without
passing in explicitlySelected. Add unit tests for that code.

While I'm at it, convert a couple of "== 1"s to toBool(), and
update the comments in NetworkAgent.

Bug: 130766237
Test: atest FrameworksNetTests
Change-Id: I6b550bd621e3596975f83464c7b4b8a14269120b
2019-06-28 23:57:22 +09:00
Chalard Jean
e7b2475523 Simplify Exception expressions in CSTest
Test: CSTest
Change-Id: Ie9b9fc334b85836bf156bda71e54e8d30885b82a
2019-06-28 14:22:30 +09:00
Lorenzo Colitti
e6e57b2c8f Merge "Remove all static members from NetworkStatsFactory." am: 63f94f411b
am: 5409264cee

Change-Id: Iada14a1fea74197014e75a1112c7a5b35d6b1a1d
2019-06-27 19:40:01 -07:00
Chalard Jean
dc857983b8 Merge "Revert "Simplify Exception expressions in CSTest"" am: 73b4106d7e
am: 60422b8e88

Change-Id: I80d94fa746d533a83e3ce01377dabd2aab0c3229
2019-06-27 02:53:23 -07:00
Lorenzo Colitti
4aa8760a68 Remove all static members from NetworkStatsFactory.
NetworkStatsFactory is owned by NetworkStatsService, and any
accesses to NSF data should go through NSS.

Test: atest FrameworksNetTests
Change-Id: Idbd0dbbaeb11313f63474e7ec0e01f974349fc89
2019-06-27 17:39:05 +09:00
Lorenzo Colitti
cf545aa02a Merge "Transfer ownership of NetworkStatsFactory to NetworkStatsService." am: bd94f0afd2
am: 92292f556b

Change-Id: If897c9c95fc8571949183c45a99a5c28cb032ebb
2019-06-27 01:31:46 -07:00
Chalard Jean
73b4106d7e Merge "Revert "Simplify Exception expressions in CSTest"" 2019-06-27 08:30:57 +00:00