Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b22655f8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Allow shortcut predictions in hybrid hotseat"" into ub-launcher3-rvc-dev

parents c46daa95 857c5129
Loading
Loading
Loading
Loading
+5 −16
Original line number Original line Diff line number Diff line
@@ -30,10 +30,8 @@ import android.app.prediction.AppPredictor;
import android.app.prediction.AppTarget;
import android.app.prediction.AppTarget;
import android.app.prediction.AppTargetEvent;
import android.app.prediction.AppTargetEvent;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.pm.ShortcutInfo;
import android.os.Process;
import android.os.Process;
import android.util.Log;
import android.util.Log;
import android.util.SparseArray;
import android.view.HapticFeedbackConstants;
import android.view.HapticFeedbackConstants;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
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.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.uioverrides.QuickstepLauncher;
@@ -382,24 +379,16 @@ public class HotseatPredictionController implements DragController.DragListener,
            mRestoreHelper.restoreBackup();
            mRestoreHelper.restoreBackup();
        }
        }
        StringBuilder predictionLog = new StringBuilder("predictedApps: [\n");
        StringBuilder predictionLog = new StringBuilder("predictedApps: [\n");
        ArrayList<ComponentKey> componentKeysToBeCached = new ArrayList<>();
        ArrayList<ComponentKey> componentKeys = new ArrayList<>();
        SparseArray<ShortcutRequest> requests = new SparseArray<>();
        for (AppTarget appTarget : appTargets) {
        for (AppTarget appTarget : appTargets) {
            ComponentKey key;
            ComponentKey key;
            ShortcutRequest request = requests.get(appTarget.getUser().getIdentifier());
            if (appTarget.getShortcutInfo() != null) {
            if (request == null) {
                key = ShortcutKey.fromInfo(appTarget.getShortcutInfo());
                request = new ShortcutRequest(mLauncher, appTarget.getUser());
                requests.put(appTarget.getUser().getIdentifier(), request);
            }
            List<ShortcutInfo> shortcutInfos = request.forPackage(appTarget.getPackageName(),
                    appTarget.getClassName()).query(ShortcutRequest.ALL);
            if (!shortcutInfos.isEmpty()) {
                key = ShortcutKey.fromInfo(shortcutInfos.get(0));
            } else {
            } else {
                key = new ComponentKey(new ComponentName(appTarget.getPackageName(),
                key = new ComponentKey(new ComponentName(appTarget.getPackageName(),
                        appTarget.getClassName()), appTarget.getUser());
                        appTarget.getClassName()), appTarget.getUser());
                componentKeysToBeCached.add(key);
            }
            }
            componentKeys.add(key);
            predictionLog.append(key.toString());
            predictionLog.append(key.toString());
            predictionLog.append(",rank:");
            predictionLog.append(",rank:");
            predictionLog.append(appTarget.getRank());
            predictionLog.append(appTarget.getRank());
@@ -412,7 +401,7 @@ public class HotseatPredictionController implements DragController.DragListener,
        }
        }
        updateDependencies();
        updateDependencies();
        fillGapsWithPrediction();
        fillGapsWithPrediction();
        cachePredictionComponentKeysIfNecessary(componentKeysToBeCached);
        cachePredictionComponentKeysIfNecessary(componentKeys);
    }
    }


    private void cachePredictionComponentKeysIfNecessary(ArrayList<ComponentKey> componentKeys) {
    private void cachePredictionComponentKeysIfNecessary(ArrayList<ComponentKey> componentKeys) {
+2 −4
Original line number Original line Diff line number Diff line
@@ -36,7 +36,6 @@ import androidx.core.graphics.ColorUtils;
import com.android.launcher3.CellLayout;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.graphics.IconPalette;
@@ -91,9 +90,8 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView implements
    public void onDraw(Canvas canvas) {
    public void onDraw(Canvas canvas) {
        int count = canvas.save();
        int count = canvas.save();
        if (!mIsPinned) {
        if (!mIsPinned) {
            ItemInfo info = (ItemInfo) getTag();
            boolean isBadged = getTag() instanceof WorkspaceItemInfo
            boolean isBadged = info != null && (!Process.myUserHandle().equals(info.user)
                    && !Process.myUserHandle().equals(((ItemInfo) getTag()).user);
                    || info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT);
            drawEffect(canvas, isBadged);
            drawEffect(canvas, isBadged);
            canvas.translate(getWidth() * RING_EFFECT_RATIO, getHeight() * RING_EFFECT_RATIO);
            canvas.translate(getWidth() * RING_EFFECT_RATIO, getHeight() * RING_EFFECT_RATIO);
            canvas.scale(1 - 2 * RING_EFFECT_RATIO, 1 - 2 * RING_EFFECT_RATIO);
            canvas.scale(1 - 2 * RING_EFFECT_RATIO, 1 - 2 * RING_EFFECT_RATIO);