[SettingsProvider] fix configs cache update

The bug is that after remove(), size() changed during for loop, leaving
some obsolete keys in the cache.

BUG: 276881870
Test: atest android.deviceconfig.cts.DeviceConfigApiTests
Change-Id: I9aa5152caa454c4923429168469ae3a13b05b9ae
This commit is contained in:
Songchun Fan
2023-04-04 11:12:14 -07:00
committed by Song Chun Fan
parent d765772c00
commit f02069cdf4

View File

@@ -3431,7 +3431,7 @@ public final class Settings {
+ " type:" + mUri.getPath()
+ " in package:" + cr.getPackageName());
}
for (int i = 0; i < mValues.size(); ++i) {
for (int i = mValues.size() - 1; i >= 0; i--) {
String key = mValues.keyAt(i);
if (key.startsWith(prefix)) {
mValues.remove(key);