Prevent the load of the slice again if it is already

in the cache.

loadSlice just fills Slice read from the DB into a
map, if there is already such slice in the map, we
could skip the async load process.

Change-Id: I6e96ef72a9dc5a833ae158492134f4a6c94a7465
Bug: 249101421
Test: robotest
This commit is contained in:
Xuanang Zhao
2022-10-12 13:28:51 +08:00
parent c2383a9f81
commit cc64ca6606

View File

@@ -385,6 +385,10 @@ public class SettingsSliceProvider extends SliceProvider {
@VisibleForTesting
void loadSlice(Uri uri) {
if (mSliceWeakDataCache.containsKey(uri)) {
Log.d(TAG, uri + " loaded from cache");
return;
}
long startBuildTime = System.currentTimeMillis();
final SliceData sliceData;