Fix issue of slice icon being rendered on non-UIthread
Bug: 178989579
Test: Manual
Change-Id: I23aa5055c8f07ee9877c1f3ce51cb280ac38a2b7
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 140340a..5007ffc 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -51,6 +51,7 @@
import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.annotation.UiThread;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.Launcher.OnResumeCallback;
@@ -271,6 +272,7 @@
mDotScaleAnim.start();
}
+ @UiThread
public void applyFromWorkspaceItem(WorkspaceItemInfo info) {
applyFromWorkspaceItem(info, false);
}
@@ -287,6 +289,7 @@
}
}
+ @UiThread
public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) {
applyIconAndLabel(info);
setTag(info);
@@ -295,6 +298,7 @@
setDownloadStateContentDescription(info, info.getProgressLevel());
}
+ @UiThread
public void applyFromApplicationInfo(AppInfo info) {
applyIconAndLabel(info);
@@ -314,6 +318,7 @@
/**
* Apply label and tag using a generic {@link ItemInfoWithIcon}
*/
+ @UiThread
public void applyFromItemInfoWithIcon(ItemInfoWithIcon info) {
applyIconAndLabel(info);
// We don't need to check the info since it's not a WorkspaceItemInfo
@@ -328,11 +333,13 @@
/**
* Apply label and tag using a {@link SearchActionItemInfo}
*/
+ @UiThread
public void applyFromSearchActionItemInfo(SearchActionItemInfo searchActionItemInfo) {
applyIconAndLabel(searchActionItemInfo);
setTag(searchActionItemInfo);
}
+ @UiThread
protected void applyIconAndLabel(ItemInfoWithIcon info) {
FastBitmapDrawable iconDrawable = newIcon(getContext(), info);
mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f);
@@ -341,6 +348,7 @@
applyLabel(info);
}
+ @UiThread
private void applyLabel(ItemInfoWithIcon info) {
setText(info.title);
if (info.contentDescription != null) {