Fix crash when launching some apps which require icons to be loaded on
the model thread Change-Id: I945a94c458d872b41e44b4b3a2d023f85d8a7c88
This commit is contained in:
@@ -44,6 +44,7 @@ import android.view.View;
|
||||
import com.android.launcher3.FastBitmapDrawable;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherModel;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
@@ -54,7 +55,6 @@ import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.util.Thunk;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -210,7 +210,7 @@ public class DragView extends View implements LauncherStateManager.StateListener
|
||||
return;
|
||||
}
|
||||
// Load the adaptive icon on a background thread and add the view in ui thread.
|
||||
new Handler(UiThreadHelper.getBackgroundLooper()).postAtFrontOfQueue(new Runnable() {
|
||||
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Object[] outObj = new Object[1];
|
||||
|
||||
@@ -40,7 +40,6 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -63,7 +62,6 @@ import com.android.launcher3.graphics.ShiftedBitmapDrawable;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.popup.SystemShortcut;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
||||
import com.android.launcher3.util.UiThreadHelper;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
@@ -642,7 +640,7 @@ public class FloatingIconView extends View implements
|
||||
originalView.setVisibility(INVISIBLE);
|
||||
};
|
||||
CancellationSignal loadIconSignal = view.mLoadIconSignal;
|
||||
new Handler(UiThreadHelper.getBackgroundLooper()).postAtFrontOfQueue(() -> {
|
||||
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
|
||||
view.getIcon(originalView, (ItemInfo) originalView.getTag(), isOpening,
|
||||
onIconLoaded, loadIconSignal);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user