Deduplicate items after clear interface in NetworkStats
Follow-up from commit Ie60829a65d0d9b5b63ad353695a820c0586e3665, the interface field was cleared before returning the result to the caller. However, this can cause problems in the NetworkStats#subtract method. If the interface field is cleared, the findIndexHinted method can match to a wrong entry. This is because the keys of multiple entries will now be the same. This can cause the subtract result to be unexpectedly large and the return value of getUidStatsForTransport to be mismatched with the values retrieved from other APIs. Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \ FrameworksNetTests:android.net.connectivity.android.net.NetworkStatsTest Bug: 290728278 Change-Id: I891ab29b8a2902663febc7c32b04417caf510926
Loading
Please register or sign in to comment