summaryrefslogtreecommitdiff
path: root/services/coverage/java
diff options
context:
space:
mode:
author zhuyunyi <zhuyunyi@xiaomi.com> 2021-08-17 14:10:39 +0800
committer zhuyunyi <zhuyunyi@xiaomi.com> 2021-08-17 14:10:39 +0800
commitafcd22acaa867da69407aa351e2ad1bba11796e1 (patch)
treee53641dcaf3f04c8a05ac9536691201664e16f96 /services/coverage/java
parent6efa908b95d84d0e2073e032320f03468b6b65d1 (diff)
Change Shallow Copy to Deep Copy in UsageStats
There are three reference type members in UsageStats's constructor, when using "new UsageStats(stats)" to copy, it will be a Shallow Copy, which may cause concurrent modify problem. For example, in UserUsageStatsService.java, the sUsageStatsCombiner is using "new UsageStats(stats.packageStats.valueAt(i)" to copy, and the value is passing to the computeCacheQuotaHints in CacheQuotaStrategy.java. If we change the UsageStats.mForegroundServices at the same time, IndexOutOfBounds Exception will happen. Therefore, it is necessary to modify the way of copying of the UsageStats. Signed-off-by: zhuyunyi <zhuyunyi@xiaomi.com> Change-Id: I58a54d17aad6ef5213e52658ee3387f3069339af
Diffstat (limited to 'services/coverage/java')
0 files changed, 0 insertions, 0 deletions