Merge "Speed up the cache building of app info data" into rvc-dev am: 30c894d5c2 am: 48d19b1b34

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11699074

Change-Id: Ifa71b4b28629cd88d004405b6cb355243884c9f9
This commit is contained in:
Yanting Yang
2020-06-09 13:19:52 +00:00
committed by Automerger Merge Worker

View File

@@ -60,6 +60,7 @@ import androidx.lifecycle.OnLifecycleEvent;
import com.android.internal.R; import com.android.internal.R;
import com.android.internal.util.ArrayUtils; import com.android.internal.util.ArrayUtils;
import com.android.settingslib.Utils; import com.android.settingslib.Utils;
import com.android.settingslib.utils.ThreadUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -1588,6 +1589,15 @@ public class ApplicationsState {
this.size = SIZE_UNKNOWN; this.size = SIZE_UNKNOWN;
this.sizeStale = true; this.sizeStale = true;
ensureLabel(context); ensureLabel(context);
// Speed up the cache of the icon and label description if they haven't been created.
ThreadUtils.postOnBackgroundThread(() -> {
if (this.icon == null) {
this.ensureIconLocked(context);
}
if (this.labelDescription == null) {
this.ensureLabelDescriptionLocked(context);
}
});
} }
public void ensureLabel(Context context) { public void ensureLabel(Context context) {