a3debae1eb326d4eefcdc07efbefcacb757fa93a
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
Description
android_packages_modules_Connectivity
Languages
Java
81.4%
Kotlin
7.7%
AIDL
4.5%
C++
4.5%
C
1.7%
Other
0.1%