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

Commit 05a3a0b8 authored by Samuel Fufa's avatar Samuel Fufa Committed by Android (Google) Code Review
Browse files

Merge "Include hotseat spots count in app launch log" into ub-launcher3-master

parents 641b24c3 18b69df8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -317,8 +317,8 @@ public class PredictionUiStateManager implements StateListener, ItemInfoUpdateRe
                && itemInfo.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT)) {
            return;
        }
        if (itemInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
            HotseatPredictionController.fillInHybridHotseatRank(itemInfo, target);
        if (itemInfo.container != LauncherSettings.Favorites.CONTAINER_PREDICTION) {
            HotseatPredictionController.encodeHotseatLayoutIntoPredictionRank(itemInfo, target);
            return;
        }

@@ -327,7 +327,7 @@ public class PredictionUiStateManager implements StateListener, ItemInfoUpdateRe
        IntStream.range(0, predictedApps.size())
                .filter((i) -> k.equals(predictedApps.get(i).getComponentKey()))
                .findFirst()
                .ifPresent((rank) -> target.predictedRank = rank);
                .ifPresent((rank) -> target.predictedRank = 0 - rank);
    }

    public static class PredictionState {
+8 −7
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ import com.android.launcher3.util.ComponentKey;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.OptionalInt;
import java.util.stream.IntStream;

/**
@@ -548,12 +549,11 @@ public class HotseatPredictionController implements DragController.DragListener,
     * Fill in predicted_rank field based on app prediction.
     * Only applicable when {@link ItemInfo#itemType} is PREDICTED_HOTSEAT
     */
    public static void fillInHybridHotseatRank(
    public static void encodeHotseatLayoutIntoPredictionRank(
            @NonNull ItemInfo itemInfo, @NonNull LauncherLogProto.Target target) {
        QuickstepLauncher launcher = QuickstepLauncher.ACTIVITY_TRACKER.getCreatedActivity();
        if (launcher == null || launcher.getHotseatPredictionController() == null
                || itemInfo.getTargetComponent() == null
                || itemInfo.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
                || itemInfo.getTargetComponent() == null) {
            return;
        }
        HotseatPredictionController controller = launcher.getHotseatPredictionController();
@@ -561,11 +561,12 @@ public class HotseatPredictionController implements DragController.DragListener,
        final ComponentKey k = new ComponentKey(itemInfo.getTargetComponent(), itemInfo.user);

        final List<ComponentKeyMapper> predictedApps = controller.mComponentKeyMappers;
        IntStream.range(0, predictedApps.size())
        OptionalInt rank = IntStream.range(0, predictedApps.size())
                .filter((i) -> k.equals(predictedApps.get(i).getComponentKey()))
                .findFirst()
                .ifPresent((rank) -> target.predictedRank =
                        Integer.parseInt(controller.mPredictedSpotsCount + "0" + rank));
                .findFirst();

        target.predictedRank = 10000 + (controller.mPredictedSpotsCount * 100)
                + (rank.isPresent() ? rank.getAsInt() + 1 : 0);
    }

    private static boolean isPredictedIcon(View view) {
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ import java.lang.reflect.Modifier;
public class LoggerUtils {
    private static final ArrayMap<Class, SparseArray<String>> sNameCache = new ArrayMap<>();
    private static final String UNKNOWN = "UNKNOWN";
    private static final int DEFAULT_PREDICTED_RANK = -100;
    private static final int DEFAULT_PREDICTED_RANK = 10000;

    public static String getFieldName(int value, Class c) {
        SparseArray<String> cache;