Make a copy of WorkSources before noting the battery stats

The battery stats are noted asynced, the work sources could be
mutated before they are actualy recorded into battery stats.
So make a copy of them prior to the noting.

Bug: 169573447
Test: atest FrameworksCoreTests:BatteryStatsTests
Test: atest CtsIncidentHostTestCases
Test: atest BatteryStatsDumpsysTest
Change-Id: I6326f7d66f9590ce544fc491fda07cd4397ef804
1 file changed