summaryrefslogtreecommitdiff
path: root/tests/unit/java/android/net/NetworkStatsCollectionTest.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-04-28 10:19:36 +0000
committerPaul Hu <paulhu@google.com>2022-04-28 13:23:39 +0000
commit1f4dfb7d93c7b4d8e02f4e463ee07fab0dde8948 (patch)
tree7ef34b0b85733e528efdd55bf28a5d68ccaeae21 /tests/unit/java/android/net/NetworkStatsCollectionTest.java
parent4111a704eceb40bab5c1f84031d4f408a3cee7bf (diff)
Make a defensive copy when sending NetworkInfo change
The issue scenario is: - Telephony registers a network agent and calls markConnected(). - NetworkAgent set mNetworkInfo to CONNECTED and call queueOrSendNetworkInfo() with mNetworkInfo, but NetworkAgent don't actually send a message to CS yet because the agent is not registered. - Telephony calls unregister because the cellular network is disconnected. - NetworkAgent set mNetworkInfo to DISCONNECTED, overwriting the previous CONNECTED state, and then call queueOrSendNetworkInfo again with mNetworkInfo. Again this doesn't send any message because the agent is not connected. - EVENT_AGENT_CONNECTED arrives. NetworkAgent replies all the messages in mPreConnectedQueue, but NetworkAgent send two DISCONNECTED NetworkInfos eventually. The CONNECTED state should be sent to CS instead of latest state DISCONNECTED. Thus, make a defensive copy when sending NetworkInfo change to prevent state overwriting. Without the NetworkAgent fix, the test will fail with no onAvailable callback. Because the Network has never been martk as CONNECTED. Bug: 228623362 Test: atest FrameworksNetTests CtsNetTestCases Original-Change: https://android-review.googlesource.com/2076406 Merged-In: I11681743d3ff87ff9affd0b7e766894dc5111028 Change-Id: I11681743d3ff87ff9affd0b7e766894dc5111028
Diffstat (limited to 'tests/unit/java/android/net/NetworkStatsCollectionTest.java')
0 files changed, 0 insertions, 0 deletions