diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index e103f6663d..7334d80dd6 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -30,10 +30,8 @@ import android.app.prediction.AppPredictor; import android.app.prediction.AppTarget; import android.app.prediction.AppTargetEvent; import android.content.ComponentName; -import android.content.pm.ShortcutInfo; import android.os.Process; import android.util.Log; -import android.util.SparseArray; import android.view.HapticFeedbackConstants; import android.view.View; import android.view.ViewGroup; @@ -67,7 +65,6 @@ import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.shortcuts.ShortcutKey; -import com.android.launcher3.shortcuts.ShortcutRequest; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; @@ -382,24 +379,16 @@ public class HotseatPredictionController implements DragController.DragListener, mRestoreHelper.restoreBackup(); } StringBuilder predictionLog = new StringBuilder("predictedApps: [\n"); - ArrayList componentKeysToBeCached = new ArrayList<>(); - SparseArray requests = new SparseArray<>(); + ArrayList componentKeys = new ArrayList<>(); for (AppTarget appTarget : appTargets) { ComponentKey key; - ShortcutRequest request = requests.get(appTarget.getUser().getIdentifier()); - if (request == null) { - request = new ShortcutRequest(mLauncher, appTarget.getUser()); - requests.put(appTarget.getUser().getIdentifier(), request); - } - List shortcutInfos = request.forPackage(appTarget.getPackageName(), - appTarget.getClassName()).query(ShortcutRequest.ALL); - if (!shortcutInfos.isEmpty()) { - key = ShortcutKey.fromInfo(shortcutInfos.get(0)); + if (appTarget.getShortcutInfo() != null) { + key = ShortcutKey.fromInfo(appTarget.getShortcutInfo()); } else { key = new ComponentKey(new ComponentName(appTarget.getPackageName(), appTarget.getClassName()), appTarget.getUser()); - componentKeysToBeCached.add(key); } + componentKeys.add(key); predictionLog.append(key.toString()); predictionLog.append(",rank:"); predictionLog.append(appTarget.getRank()); @@ -412,7 +401,7 @@ public class HotseatPredictionController implements DragController.DragListener, } updateDependencies(); fillGapsWithPrediction(); - cachePredictionComponentKeysIfNecessary(componentKeysToBeCached); + cachePredictionComponentKeysIfNecessary(componentKeys); } private void cachePredictionComponentKeysIfNecessary(ArrayList componentKeys) { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java index 51d53fd29e..597c17b4e2 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java @@ -36,7 +36,6 @@ import androidx.core.graphics.ColorUtils; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherSettings; import com.android.launcher3.R; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.graphics.IconPalette; @@ -91,9 +90,8 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView implements public void onDraw(Canvas canvas) { int count = canvas.save(); if (!mIsPinned) { - ItemInfo info = (ItemInfo) getTag(); - boolean isBadged = info != null && (!Process.myUserHandle().equals(info.user) - || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT); + boolean isBadged = getTag() instanceof WorkspaceItemInfo + && !Process.myUserHandle().equals(((ItemInfo) getTag()).user); drawEffect(canvas, isBadged); canvas.translate(getWidth() * RING_EFFECT_RATIO, getHeight() * RING_EFFECT_RATIO); canvas.scale(1 - 2 * RING_EFFECT_RATIO, 1 - 2 * RING_EFFECT_RATIO);